feat: add grafana link

This commit is contained in:
jialin
2026-02-04 20:14:25 +08:00
parent 7fd2b43704
commit 8690de00a9
13 changed files with 87 additions and 14 deletions
@@ -0,0 +1,42 @@
import { GPUSTACK_API_BASE_URL } from '@/config/settings';
const useGranfanaLink = (options: {
type: 'model' | 'worker' | 'instance';
}) => {
const goToModelGrafana = (row: { id: number }) => {
window.open(
`/${GPUSTACK_API_BASE_URL}/models/${row.id}/dashboard`,
'_blank'
);
};
const goToWorkerGrafana = (row: { id: number }) => {
window.open(
`/${GPUSTACK_API_BASE_URL}/workers/${row.id}/dashboard`,
'_blank'
);
};
const goToInstanceGrafana = (row: { id: number }) => {
window.open(
`/${GPUSTACK_API_BASE_URL}/model-instances/${row.id}/dashboard`,
'_blank'
);
};
const goToGrafana = (row: { id: number }) => {
if (options.type === 'model') {
goToModelGrafana(row);
} else if (options.type === 'worker') {
goToWorkerGrafana(row);
} else if (options.type === 'instance') {
goToInstanceGrafana(row);
}
};
return {
goToGrafana
};
};
export default useGranfanaLink;
@@ -1,5 +1,6 @@
import AutoTooltip from '@/components/auto-tooltip';
import DropdownButtons from '@/components/drop-down-buttons';
import IconFont from '@/components/icon-font';
import LabelsCell from '@/components/label-cell';
import ProgressBar from '@/components/progress-bar';
import InfoColumn from '@/components/simple-table/info-column';
@@ -42,6 +43,11 @@ const IPWrapper = styled.span`
const ActionList = [
{ label: 'common.button.edit', key: 'edit', icon: <EditOutlined /> },
{
label: 'resources.metrics.details',
key: 'metrics',
icon: <IconFont type="icon-metrics" />
},
// {
// label: 'common.button.detail',
// key: 'details',