fix: menu status mismatch
This commit is contained in:
+5
-1
@@ -164,7 +164,11 @@ export default [
|
|||||||
icon: 'icon-cluster2-outline',
|
icon: 'icon-cluster2-outline',
|
||||||
selectedIcon: 'icon-cluster2-filled',
|
selectedIcon: 'icon-cluster2-filled',
|
||||||
defaultIcon: 'icon-cluster2-outline',
|
defaultIcon: 'icon-cluster2-outline',
|
||||||
component: './cluster-management/clusters'
|
component: './cluster-management/clusters',
|
||||||
|
subMenu: [
|
||||||
|
'/cluster-management/clusters/detail',
|
||||||
|
'/cluster-management/clusters/create'
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'clusterDetail',
|
name: 'clusterDetail',
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ const SiderMenu: React.FC<SiderMenuProps> = (props) => {
|
|||||||
const { styles, cx } = useStyles();
|
const { styles, cx } = useStyles();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const [collapseKeys, setCollapseKeys] = useState<Set<string>>(new Set());
|
const [collapseKeys, setCollapseKeys] = useState<Set<string>>(new Set());
|
||||||
console.log('SiderMenu', props);
|
console.log('SiderMenu', location.pathname);
|
||||||
|
|
||||||
const dividerStyles = useMemo(() => {
|
const dividerStyles = useMemo(() => {
|
||||||
if (collapsed) {
|
if (collapsed) {
|
||||||
@@ -167,7 +167,9 @@ const SiderMenu: React.FC<SiderMenuProps> = (props) => {
|
|||||||
to={menuItem.path.replace('/*', '')}
|
to={menuItem.path.replace('/*', '')}
|
||||||
target={menuItem.target}
|
target={menuItem.target}
|
||||||
className={cx(styles.menuItemWrapper, 'menu-item', {
|
className={cx(styles.menuItemWrapper, 'menu-item', {
|
||||||
'menu-item-selected': location.pathname === menuItem.path
|
'menu-item-selected':
|
||||||
|
location.pathname === menuItem.path ||
|
||||||
|
menuItem.subMenu?.includes(location.pathname)
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{collapsed ? (
|
{collapsed ? (
|
||||||
@@ -175,7 +177,8 @@ const SiderMenu: React.FC<SiderMenuProps> = (props) => {
|
|||||||
<span className="icon-wrapper">
|
<span className="icon-wrapper">
|
||||||
<IconFont
|
<IconFont
|
||||||
type={
|
type={
|
||||||
location.pathname === menuItem.path
|
location.pathname === menuItem.path ||
|
||||||
|
menuItem.subMenu?.includes(location.pathname)
|
||||||
? menuItem.selectedIcon || ''
|
? menuItem.selectedIcon || ''
|
||||||
: menuItem.defaultIcon || ''
|
: menuItem.defaultIcon || ''
|
||||||
}
|
}
|
||||||
@@ -186,7 +189,8 @@ const SiderMenu: React.FC<SiderMenuProps> = (props) => {
|
|||||||
<>
|
<>
|
||||||
<IconFont
|
<IconFont
|
||||||
type={
|
type={
|
||||||
location.pathname === menuItem.path
|
location.pathname === menuItem.path ||
|
||||||
|
menuItem.subMenu?.includes(location.pathname)
|
||||||
? menuItem.selectedIcon || ''
|
? menuItem.selectedIcon || ''
|
||||||
: menuItem.defaultIcon || ''
|
: menuItem.defaultIcon || ''
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
|
|
||||||
const initClusterId = () => {
|
const initClusterId = () => {
|
||||||
const cluster_id =
|
const cluster_id =
|
||||||
clusterList?.find((item) => item.provider === ProviderValueMap.Custom)
|
clusterList?.find((item) => item.provider === ProviderValueMap.Docker)
|
||||||
?.value || clusterList?.[0]?.value;
|
?.value || clusterList?.[0]?.value;
|
||||||
|
|
||||||
console.log('cluster_id:', cluster_id);
|
console.log('cluster_id:', cluster_id);
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
|
|
||||||
const initClusterId = () => {
|
const initClusterId = () => {
|
||||||
const cluster_id =
|
const cluster_id =
|
||||||
clusterList?.find((item) => item.provider === ProviderValueMap.Custom)
|
clusterList?.find((item) => item.provider === ProviderValueMap.Docker)
|
||||||
?.value || clusterList?.[0]?.value;
|
?.value || clusterList?.[0]?.value;
|
||||||
|
|
||||||
return cluster_id;
|
return cluster_id;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ const DownloadModel: React.FC<AddModalProps> = (props) => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
const customWorker = workerOptions.find(
|
const customWorker = workerOptions.find(
|
||||||
(item) => item.provider === ProviderValueMap.Custom
|
(item) => item.provider === ProviderValueMap.Docker
|
||||||
);
|
);
|
||||||
|
|
||||||
const worker_id = getWorkerId(customWorker || workerOptions[0]);
|
const worker_id = getWorkerId(customWorker || workerOptions[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user