Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,18 @@ export default function HostedPrivateCloudSidebar() {
`/dedicatedCloud/${service.serviceName}/datacenter`,
'EPCC',
);
return datacenters.map((datacenter) => ({
...datacenter,
return datacenters
.filter((datacenter) => {
// Drop phantom datacenters (id 0 / missing): they have an
// empty label and navigating to a non-existent
// `datacenterId = 0` errors out.
const datacenterId = datacenter.stateParams?.[1];
return datacenterId && String(datacenterId) !== '0';
})
.map((datacenter) => ({
...datacenter,
routeMatcher: new RegExp(`/datacenter/${datacenter.stateParams[1]}`),
}));
}));
},
})),
];
Expand Down Expand Up @@ -296,7 +304,7 @@ export default function HostedPrivateCloudSidebar() {
label: t('sidebar_storage_backup'),
icon: (
<img
className="mb-1 mr-1 w-6 aspect-square"
className="mb-1 mr-1 aspect-square w-6"
alt=""
src={infinityCLoud}
/>
Expand Down Expand Up @@ -332,7 +340,7 @@ export default function HostedPrivateCloudSidebar() {
id: 'hpc-hycu',
label: t('sidebar_hycu'),
icon: (
<img alt="" src={hycuLogo} className="mb-1 w-6 aspect-square" />
<img alt="" src={hycuLogo} className="mb-1 aspect-square w-6" />
),
pathMatcher: new RegExp('^/hycu'),
badge: 'new',
Expand All @@ -358,7 +366,7 @@ export default function HostedPrivateCloudSidebar() {
id: 'hpc-backup-agent-iaas',
label: t('sidebar_backup_agent_iaas'),
icon: (
<img alt="" src={backupAgentLogo} className="mb-1 w-6 aspect-square" />
<img alt="" src={backupAgentLogo} className="mb-1 aspect-square w-6" />
),
pathMatcher: new RegExp('^/hpc-backup-agent-iaas'),
badge: 'new',
Expand Down Expand Up @@ -424,9 +432,9 @@ export default function HostedPrivateCloudSidebar() {
label: 'Secret Manager',
badge: feature['okms:secret-manager:beta-badge'] ? 'beta' : undefined,
icon: <OsdsIcon
name={ODS_ICON_NAME.SHIELD_CONCEPT}
size={ODS_ICON_SIZE.xxs}
color={ODS_THEME_COLOR_INTENT.text}
name={ODS_ICON_NAME.SHIELD_CONCEPT}
size={ODS_ICON_SIZE.xxs}
color={ODS_THEME_COLOR_INTENT.text}
/>,
href: navigation.getURL(app, '#/secret-manager'),
pathMatcher: new RegExp('^/okms/secret-manager/*'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ export default class {
offset - 1,
)
.then((result) => {
const data = result.list?.results;
// Drop phantom datacenters (no/0 id, e.g. id = 0)
const data = (result.list?.results || []).filter(
(datacenter) => datacenter.id,
);

this.hasLegacyDatacenter =
!!data.find((datacenter) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,14 @@ class DedicatedCloudService {
return this.icebergUtils
.icebergQuery(`/dedicatedCloud/${serviceName}/datacenter`, {})
.then(({ data }) =>
data.map((datacenter) => ({
...datacenter,
displayName: punycode.toUnicode(datacenter.name),
id: datacenter.datacenterId,
})),
// Drop phantom datacenters (no/0 id, e.g. id = 0)
data
.filter((datacenter) => datacenter?.datacenterId)
.map((datacenter) => ({
...datacenter,
displayName: punycode.toUnicode(datacenter.name),
id: datacenter.datacenterId,
})),
);
}

Expand Down
Loading