Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ondemand k8s showing aws icon rather than k8s #1391

Merged
merged 1 commit into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/ui/common/src/components/resources/cards/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Box from '@mui/material/Box';
import React from 'react';

import {
resolveDisplayService,
resolveLogoService,
Resource,
resourceExecState,
} from '../../../utils/resources';
Expand Down Expand Up @@ -39,7 +39,7 @@ export const ResourceCard: React.FC<ResourceProps> = ({
</TruncatedText>
</Box>
<ResourceLogo
service={resolveDisplayService(resource)}
service={resolveLogoService(resource)}
size="small"
activated
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Typography from '@mui/material/Typography';
import React from 'react';

import {
resolveDisplayService,
resolveLogoService,
Resource,
resourceExecState,
} from '../../../utils/resources';
Expand All @@ -29,7 +29,7 @@ export const ResourceHeaderDetailsCard: React.FC<
>
<Box display="flex" flexDirection="row" alignItems="center">
<ResourceLogo
service={resolveDisplayService(resource)}
service={resolveLogoService(resource)}
size="medium"
activated
/>
Expand Down
13 changes: 10 additions & 3 deletions src/ui/common/src/utils/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,22 @@ export function resourceExecState(resource: Resource): ExecState {
return resource.exec_state || { status: ExecutionStatus.Succeeded };
}

// The only resource that does not necessarily display the same service type as
// on the resource itself is Conda.
export function resolveDisplayService(resource: Resource): Service {
// The resolve the service logo to display.
// This can be different from the actual service. For example:
// Aq with conda should display conda.
// AWS, GCP using on-demand K8s should display K8s.
export function resolveLogoService(resource: Resource): Service {
if (resource.service === 'Aqueduct') {
const aqConfig = resource.config as AqueductComputeConfig;
if (aqConfig.conda_config_serialized) {
return 'Conda';
}
}

if (resource.service === 'AWS' || resource.service === 'GCP') {
return 'Kubernetes';
}

return resource.service;
}

Expand Down