fix(gpu-service): show global instance templates under custom scopes
The Instance Templates management page requested the `mine` list scope, which drops admin-curated Global templates for non-admin callers. The Inference Backend page uses the default scope and shows Global + own rows, so the two pages behaved inconsistently. Use the default scope on the templates page so Global templates are visible alongside the caller's own, and gate Edit/Delete on the card so Global rows a non-admin can't modify render read-only.
This commit is contained in:
@@ -28,7 +28,7 @@ import {
|
||||
TemplateCard,
|
||||
ThemeTag
|
||||
} from '@gpustack/core-ui';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { useAccess, useIntl } from '@umijs/max';
|
||||
import { Button, Tag } from 'antd';
|
||||
import { useMemo } from 'react';
|
||||
import styled from 'styled-components';
|
||||
@@ -144,8 +144,15 @@ interface TemplateCardProps {
|
||||
|
||||
const TemplateCardItem: React.FC<TemplateCardProps> = ({ data, onSelect }) => {
|
||||
const intl = useIntl();
|
||||
const access = useAccess();
|
||||
const { isDarkTheme } = useUserSettings();
|
||||
|
||||
// Global templates (owner_principal_id NULL) are admin-curated and
|
||||
// only editable by an admin. Principal-owned rows only reach a
|
||||
// non-admin's list when they own them, so those are always
|
||||
// manageable by the caller.
|
||||
const canManage = !!access.canSeeAdmin || data.owner_principal_id != null;
|
||||
|
||||
const manufacturerLabelMap: Record<string, string> = useMemo(() => {
|
||||
return Object.values(GPUsConfigs).reduce(
|
||||
(acc, item) => {
|
||||
@@ -234,6 +241,9 @@ const TemplateCardItem: React.FC<TemplateCardProps> = ({ data, onSelect }) => {
|
||||
};
|
||||
|
||||
const renderActions = () => {
|
||||
if (!canManage) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<span onClick={handleonClickAction} className="operations">
|
||||
<DropdownActions
|
||||
|
||||
Reference in New Issue
Block a user