Skip to content

Commit

Permalink
fix: Fix the edit manager permission on create workspace (#4446)
Browse files Browse the repository at this point in the history
Signed-off-by: lannyfu <[email protected]>
  • Loading branch information
fuchunlan authored Jan 21, 2025
1 parent 8b93eab commit 49377ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,12 @@ export const StyledForm = styled(Form)`
width: 100%;
max-width: 455px;
}
.kubed-select-disabled {
cursor: not-allowed;
.kubed-select-selector {
background-color: #eff4f9;
border-color: #abb4be;
}
}
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { UIEvent } from 'react';
import { debounce } from 'lodash';
import { FormItem, Input, Select } from '@kubed/components';

import { userStore } from '@ks-console/shared';
import { hasPermission, userStore } from '@ks-console/shared';

const { useInfiniteUserList } = userStore;

Expand All @@ -23,6 +23,11 @@ function WorkspaceManagerField({ manager, setManagerName }: WorkspaceManagerFiel
annotation: 'kubesphere.io/creator',
});

const canEditManager = hasPermission({
module: 'workspaces',
action: 'manage',
});

const { data = [], fetchNextPage: nextPage, hasNextPage } = useInfiniteUserList(requestParams);

const onSearch = debounce((val: string) => {
Expand Down Expand Up @@ -72,6 +77,7 @@ function WorkspaceManagerField({ manager, setManagerName }: WorkspaceManagerFiel
options={options}
onPopupScroll={debounce(onScroll, 500)}
onSearch={onSearch}
disabled={!canEditManager}
onSelect={handleSelect}
/>
</FormItem>
Expand Down

0 comments on commit 49377ea

Please sign in to comment.