Skip to content

Commit

Permalink
fix(bulk-import): disable deletion button for non-location sourced repos
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Cai <[email protected]>
  • Loading branch information
ciiay committed Nov 20, 2024
1 parent 201f00a commit fd188e2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@ const DeleteRepository = ({ data }: { data: AddRepositoryData }) => {
setOpenDialog(true);
};

const tooltipMessage =
data.source === 'location'
? 'Remove'
: 'This repository added to the app-config file. To remove it modify the file directly';

return (
<Tooltip title="Remove">
<Tooltip title={tooltipMessage}>
<span data-testid="delete-repository">
<IconButton
color="inherit"
onClick={() => openDialog(data)}
aria-label="Delete"
size="large"
disabled={data.source !== 'location'}
>
<Delete />
</IconButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export type ImportJobStatus = {
};
status: string;
id: string;
source?: 'location' | 'config' | 'other';
lastUpdate: string;
repository: Repository;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export type AddRepositoryData = {
repoName?: string;
orgName?: string;
totalReposInOrg?: number;
source?: 'location' | 'config' | 'other';
repoUrl?: string;
organizationUrl?: string;
selectedRepositories?: AddedRepositories;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ export const prepareDataForAddedRepositories = (
...acc,
[id]: {
id,
source: val.source,
repoName: val.repository.name,
defaultBranch: val.repository.defaultBranch,
orgName: val.repository.organization,
Expand Down

0 comments on commit fd188e2

Please sign in to comment.