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

Add contextual menu for read links for remote clusters #6151

Merged
merged 2 commits into from
May 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ export function NodeContextMenu(props: Props) {
{renderHeader()}
<hr style={{ margin: '8px 0 5px 0' }} />
{menuOptions}
{renderWizardsItems()}
{(serverConfig.clusterInfo?.name ? linkParams.cluster === serverConfig.clusterInfo?.name : true) &&
renderWizardsItems()}
</div>
);
}
Expand Down Expand Up @@ -369,24 +370,29 @@ export const getOptions = (node: DecoratedGraphNodeData, jaegerInfo?: JaegerInfo
const getOptionsFromLinkParams = (linkParams: LinkParams, jaegerInfo?: JaegerInfo): ContextMenuOption[] => {
let options: ContextMenuOption[] = [];
const { namespace, type, name, cluster } = linkParams;
const detailsPageUrl = `/namespaces/${namespace}/${type}/${name}`;
let detailsPageUrl = `/namespaces/${namespace}/${type}/${name}`;
let concat = '?';
if (cluster) {
detailsPageUrl += '?cluster=' + cluster;
concat = '&';
}

options.push({ text: 'Details', url: detailsPageUrl });
if (type !== Paths.SERVICEENTRIES) {
options.push({ text: 'Traffic', url: `${detailsPageUrl}?tab=traffic` });
options.push({ text: 'Traffic', url: `${detailsPageUrl}${concat}tab=traffic` });
if (type === Paths.WORKLOADS) {
options.push({ text: 'Logs', url: `${detailsPageUrl}?tab=logs` });
options.push({ text: 'Logs', url: `${detailsPageUrl}${concat}tab=logs` });
}
options.push({
text: 'Inbound Metrics',
url: `${detailsPageUrl}?tab=${type === Paths.SERVICES ? 'metrics' : 'in_metrics'}`
url: `${detailsPageUrl}${concat}tab=${type === Paths.SERVICES ? 'metrics' : 'in_metrics'}`
});
if (type !== Paths.SERVICES) {
options.push({ text: 'Outbound Metrics', url: `${detailsPageUrl}?tab=out_metrics` });
options.push({ text: 'Outbound Metrics', url: `${detailsPageUrl}${concat}tab=out_metrics` });
}
if (type === Paths.APPLICATIONS && jaegerInfo && jaegerInfo.enabled) {
if (jaegerInfo.integration) {
options.push({ text: 'Traces', url: `${detailsPageUrl}?tab=traces` });
options.push({ text: 'Traces', url: `${detailsPageUrl}${concat}tab=traces` });
} else if (jaegerInfo.url) {
options.push({
text: 'Show Traces',
Expand All @@ -398,24 +404,6 @@ const getOptionsFromLinkParams = (linkParams: LinkParams, jaegerInfo?: JaegerInf
}
}

if (serverConfig.clusterInfo?.name && cluster !== serverConfig.clusterInfo.name) {
const externalClusterInfo = serverConfig.clusters[cluster];
const kialiInfo = externalClusterInfo?.kialiInstances?.find(instance => instance.url.length !== 0);
if (kialiInfo === undefined) {
options = options.filter(o => o.target === '_blank');
} else {
const externalKialiUrl = kialiInfo.url.replace(/\/$/g, '') + '/console';

for (let idx = 0; idx < options.length; idx++) {
if (options[idx].target !== '_blank') {
options[idx].external = true;
options[idx].target = '_blank';
options[idx].url = externalKialiUrl + options[idx].url;
}
}
}
}

return options;
};

Expand Down