feat: add model access control
This commit is contained in:
@@ -7,6 +7,7 @@ import PageTools from '@/components/page-tools';
|
||||
import BaseSelect from '@/components/seal-form/base/select';
|
||||
import SealTable from '@/components/seal-table';
|
||||
import { PageAction } from '@/config';
|
||||
import { PageActionType } from '@/config/types';
|
||||
import useBodyScroll from '@/hooks/use-body-scroll';
|
||||
import useExpandedRowKeys from '@/hooks/use-expanded-row-keys';
|
||||
import useTableRowSelection from '@/hooks/use-table-row-selection';
|
||||
@@ -56,6 +57,7 @@ import {
|
||||
} from '../config/types';
|
||||
import useFormInitialValues from '../hooks/use-form-initial-values';
|
||||
import useModelsColumns from '../hooks/use-models-columns';
|
||||
import AccessControlModal from './access-control-modal';
|
||||
import APIAccessInfoModal from './api-access-info';
|
||||
import DeployModal from './deploy-modal';
|
||||
import Instances from './instances';
|
||||
@@ -177,6 +179,17 @@ const Models: React.FC<ModelsProps> = ({
|
||||
url: '',
|
||||
status: ''
|
||||
});
|
||||
const [openAccessControlModal, setOpenAccessControlModal] = useState<{
|
||||
open: boolean;
|
||||
currentData: ListItem | null;
|
||||
title: string;
|
||||
action: PageActionType;
|
||||
}>({
|
||||
open: false,
|
||||
currentData: null,
|
||||
title: '',
|
||||
action: PageAction.CREATE
|
||||
});
|
||||
const modalRef = useRef<any>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -451,6 +464,15 @@ const Models: React.FC<ModelsProps> = ({
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (val === 'accessControl') {
|
||||
setOpenAccessControlModal({
|
||||
title: 'Edit Access Control',
|
||||
action: PageAction.EDIT,
|
||||
currentData: row,
|
||||
open: true
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
// ignore
|
||||
}
|
||||
@@ -557,6 +579,16 @@ const Models: React.FC<ModelsProps> = ({
|
||||
}
|
||||
});
|
||||
|
||||
const handleCancelAccessControl = () => {
|
||||
setOpenAccessControlModal({
|
||||
...openAccessControlModal,
|
||||
currentData: null,
|
||||
open: false
|
||||
});
|
||||
};
|
||||
|
||||
const handleSubmitAccessControl = (data: any) => {};
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageContainer
|
||||
@@ -723,6 +755,14 @@ const Models: React.FC<ModelsProps> = ({
|
||||
});
|
||||
}}
|
||||
></APIAccessInfoModal>
|
||||
<AccessControlModal
|
||||
onCancel={handleCancelAccessControl}
|
||||
onOk={handleSubmitAccessControl}
|
||||
title={openAccessControlModal.title}
|
||||
open={openAccessControlModal.open}
|
||||
currentData={openAccessControlModal.currentData}
|
||||
action={openAccessControlModal.action}
|
||||
></AccessControlModal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user