Skip to content

Commit

Permalink
add support for new nav with workspace
Browse files Browse the repository at this point in the history
Signed-off-by: Eric <[email protected]>
  • Loading branch information
mengweieric committed Nov 12, 2024
1 parent 285ccc4 commit 38edaf0
Showing 1 changed file with 26 additions and 32 deletions.
58 changes: 26 additions & 32 deletions public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,27 +261,6 @@ export class ObservabilityPlugin
}),
order: 5095,
},
cluster: {
id: 'observability-kubernetes-cluster',
label: i18n.translate('core.ui.observabilityNavList.label', {
defaultMessage: 'Cluster',
}),
order: 5096,
},
namespaces: {
id: 'observability-kubernetes-namespaces',
label: i18n.translate('core.ui.observabilityNavList.label', {
defaultMessage: 'Namespaces',
}),
order: 5097,
},
pod: {
id: 'observability-kubernetes-node',
label: i18n.translate('core.ui.observabilityNavList.label', {
defaultMessage: 'node',
}),
order: 5098,
}
});

// Adding a variation entails associating a key-value pair, where a change in the key results in
Expand Down Expand Up @@ -362,14 +341,6 @@ export class ObservabilityPlugin
);
};

core.chrome.navGroup.addNavLinksToGroup(OBSERVABILITY_APP_CATEGORIES.kubernetes, [
{
id: 'observability-kubernetes',
category: DEFAULT_APP_CATEGORIES.observability,
parentNavLinkId: DEFAULT_APP_CATEGORIES.observability.id,
},
]);

core.application.register({
id: observabilityMetricsID,
title: observabilityMetricsTitle,
Expand Down Expand Up @@ -397,6 +368,15 @@ export class ObservabilityPlugin
});
console.log('core.chrome.navGroup.getNavGroupEnabled(): ', core.chrome.navGroup.getNavGroupEnabled());
if (core.chrome.navGroup.getNavGroupEnabled()) {

core.chrome.navGroup.addNavLinksToGroup(
DEFAULT_NAV_GROUPS.observability,
[{
id: 'observability-kubernetes',
parentNavLinkId: DEFAULT_APP_CATEGORIES.investigate.id,
},]
);

core.application.register({
id: observabilityOverviewID,
title: observabilityOverviewTitle,
Expand Down Expand Up @@ -432,12 +412,21 @@ export class ObservabilityPlugin
core.application.register({
id: 'observability-kubernetes',
title: 'Kubernetes',
category: DEFAULT_APP_CATEGORIES.investigate,
category: OBSERVABILITY_APP_CATEGORIES.observability,
order: 5095,
mount: appMountWithStartPage('kubernetes'),
});

} else {

core.chrome.navGroup.addNavLinksToGroup(OBSERVABILITY_APP_CATEGORIES.kubernetes, [
{
id: 'observability-kubernetes',
category: DEFAULT_APP_CATEGORIES.observability,
parentNavLinkId: DEFAULT_APP_CATEGORIES.observability.id,
},
]);

core.application.register({
id: observabilityTracesID,
title: observabilityTracesTitle,
Expand Down Expand Up @@ -523,7 +512,7 @@ export class ObservabilityPlugin
const navLinks = [
{
id: 'kubernetes-configurations',
parentNavLinkId: OBSERVABILITY_APP_CATEGORIES.kubernetes.id,
parentNavLinkId: 'observability-kubernetes',
},
{
id: 'kubernetes-overview',
Expand All @@ -543,8 +532,13 @@ export class ObservabilityPlugin
},
];

// core.chrome.navGroup.addNavLinksToGroup(
// OBSERVABILITY_APP_CATEGORIES.kubernetes,
// navLinks
// );

core.chrome.navGroup.addNavLinksToGroup(
OBSERVABILITY_APP_CATEGORIES.kubernetes,
DEFAULT_NAV_GROUPS.observability,
navLinks
);

Expand Down

0 comments on commit 38edaf0

Please sign in to comment.