Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions proxy/server.dev.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
server {
large_client_header_buffers 4 32k; # Required for OAuth2 Proxy

proxy_http_version 2;

listen 8080;
server_name localhost;
error_page 500 502 503 504 /50x.html;
Expand All @@ -12,9 +10,9 @@ server {

location /api/ {
proxy_buffering off;
proxy_pass https://server-radix-api-qa.dev.radix.equinor.com;
# proxy_pass https://server-radix-api-qa.dev.radix.equinor.com;
# proxy_pass http://<WSL_IP>:3002; #for localhost API on WSL
# proxy_pass http://host.docker.internal:3002; #for localhost API on MacOS https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host
proxy_pass http://host.docker.internal:3002; #for localhost API on MacOS https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host
}

location /cost-api/ {
Expand Down
39 changes: 18 additions & 21 deletions src/components/app-list-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Link } from 'react-router-dom'

import { routes } from '../../routes'
import {
type Component,
type Environment,
type JobSummary,
type ReplicaResourcesUtilizationResponse,
useGetApplicationResourcesUtilizationQuery,
Expand All @@ -26,8 +26,9 @@ import {
EnvironmentVulnerabilityIndicator,
} from '../environments-summary/environment-card-status'
import {
aggregateComponentEnvironmentStatus,
aggregateComponentReplicaEnvironmentStatus,
aggregateComponentReplicaStatus,
aggregateComponentStatus,
aggregateDeploymentStatus,
aggregateVulnerabilitySummaries,
EnvironmentStatus,
environmentVulnerabilitySummarizer,
Expand All @@ -43,7 +44,7 @@ export type FavouriteClickedHandler = (event: MouseEvent<HTMLButtonElement>, nam
export interface AppListItemProps {
appName: string
latestJob?: JobSummary
environmentActiveComponents?: { [key: string]: Component[] }
environments?: Environment[]
handler: FavouriteClickedHandler
isPlaceholder?: boolean
isFavourite?: boolean
Expand Down Expand Up @@ -78,7 +79,7 @@ export const AppListItem = ({ isLoading, ...props }: AppListItemProps) => {
export type AppListItemLayoutProps = {
appName: string
latestJob?: JobSummary
environmentActiveComponents?: { [key: string]: Component[] }
environments?: Environment[]
handler: FavouriteClickedHandler
isPlaceholder?: boolean
isFavourite?: boolean
Expand All @@ -91,7 +92,7 @@ export type AppListItemLayoutProps = {

export const AppListItemLayout = ({
latestJob,
environmentActiveComponents,
environments,
isDeleted,
appName,
isLoading,
Expand All @@ -109,7 +110,7 @@ export const AppListItemLayout = ({

const time = latestJob && (latestJob.status === 'Running' || !latestJob.ended ? latestJob.started : latestJob.ended)

const statusElements = parseAppForStatusElements(latestJob, environmentActiveComponents)
const statusElements = parseAppForStatusElements(latestJob, environments)

const latestJobIsChanging = latestJob && (latestJob.status === 'Running' || latestJob.status === 'Stopping')

Expand Down Expand Up @@ -210,28 +211,24 @@ const WElement = ({ appName, isPlaceholder, className, children }: PropsWithChil
)
}

function parseAppForStatusElements(
latestJob?: JobSummary,
environmentActiveComponents?: { [key: string]: Component[] }
): EnvironmentCardStatusMap {
function parseAppForStatusElements(latestJob?: JobSummary, environments?: Environment[]): EnvironmentCardStatusMap {
return {
...(latestJob && {
'Latest Job': latestJob.status == 'Failed' ? EnvironmentStatus.Danger : EnvironmentStatus.Consistent,
}),
...(environmentActiveComponents && {
Environments: aggregateEnvironmentStatus(
Object.keys(environmentActiveComponents).reduce(
(obj, x) => (environmentActiveComponents[x]?.length > 0 ? [...obj, ...environmentActiveComponents[x]] : obj),
[] as Component[]
)
),
...(environments && {
Environments: aggregateEnvironmentStatus(environments),
}),
}
}

function aggregateEnvironmentStatus(components: Component[]): EnvironmentStatus {
function aggregateEnvironmentStatus(environments: Environment[]): EnvironmentStatus {
const components = environments.flatMap((env) => env.activeDeployment?.components ?? [])
const deployments = environments.filter((env) => env.activeDeployment).map((env) => env.activeDeployment!)

return Math.max(
aggregateComponentEnvironmentStatus(components),
aggregateComponentReplicaEnvironmentStatus(components)
aggregateDeploymentStatus(deployments),
aggregateComponentStatus(components),
aggregateComponentReplicaStatus(components)
)
}
6 changes: 3 additions & 3 deletions src/components/app-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export default function AppList() {
const { data: favsData, ...favsState } = useGetSearchApplicationsQuery(
{
apps: favourites?.join(','),
includeEnvironmentActiveComponents: 'true',
includeLatestJobSummary: 'true',
includeEnvironments: true,
includeLatestJobSummary: true,
},
{ skip: favourites?.length === 0, pollingInterval }
)
Expand Down Expand Up @@ -117,7 +117,7 @@ export default function AppList() {
key={appName}
appName={appName}
isDeleted={!app}
environmentActiveComponents={app?.environmentActiveComponents}
environments={app?.environments}
latestJob={app?.latestJob}
handler={(e) => {
changeFavouriteApplication(appName, false)
Expand Down
2 changes: 2 additions & 0 deletions src/components/component/secrets/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const testData: Array<GetEnvironmentApiResponse> = [
namespace: 'any',
repository: 'any',
activeFrom: new Date('2023-12-01T11:27:17Z').toISOString(),
status: 'Ready',
},
secrets: [
{ name: 'secret_1', status: 'Consistent', component: 'component_1' },
Expand All @@ -27,6 +28,7 @@ const testData: Array<GetEnvironmentApiResponse> = [
namespace: 'any',
repository: 'any',
activeFrom: new Date('2023-12-01T11:27:17Z').toISOString(),
status: 'Ready',
},
secrets: [
{ name: 'pandora', status: 'Pending', component: 'component_1' },
Expand Down
Loading
Loading