Skip to content

Conversation

@artemmufazalov
Copy link
Member

No description provided.

@artemmufazalov artemmufazalov force-pushed the cluster-in-monitoring-link branch from c569612 to f9fe109 Compare April 10, 2024 14:15
@artemmufazalov artemmufazalov marked this pull request as ready for review April 10, 2024 14:16
@artemmufazalov artemmufazalov changed the title fix: update monitoring links fix: add cluster dashboard to monitoring link object Apr 10, 2024
href = `${monitoringUrl}&host=${host}&slot=${slot}&database=${dbName}&dashboard=${dashboard}`;
}
href = encodeURI(href);
const href = `${monitoringUrl}/${dashboard}?p.cluster=${finalClusterName}&p.host=${host}&p.slot=${slot}&p.database=${dbName}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's rewrite this function like this:

    if (data) {
        const host = data.host ?? 'cluster';
        const slot = data.slot ?? 'static';

        const finalClusterName = data.cluster_name || clusterName || '';

        const url = new URL(data.monitoring_url);
        if (!url.searchParams.size) {
            const dashboard =
                dbType === ETenantType.Serverless
                    ? data.serverless_dashboard
                    : data.dedicated_dashboard;

            url.pathname += `/${dashboard}`;
        }

        if (!url.searchParams.has('p.cluster')) {
            url.searchParams.set('p.cluster', finalClusterName);
        }
        url.searchParams.set('p.host', host);
        url.searchParams.set('p.slot', slot);
        url.searchParams.set('p.database', dbName);

        return url.toString();
    }

@artemmufazalov artemmufazalov force-pushed the cluster-in-monitoring-link branch from 79e8f4f to ba49af5 Compare April 11, 2024 14:07
@artemmufazalov artemmufazalov merged commit b021fe0 into main Apr 12, 2024
@artemmufazalov artemmufazalov deleted the cluster-in-monitoring-link branch April 12, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants