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