Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Applications: bulk delete disabled when no selection #1149

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@ export const ApplicationsTableAnalyze: React.FC = () => {
importWriteAccess = checkAccess(userScopes, importsWriteScopes),
applicationWriteAccess = checkAccess(userScopes, applicationsWriteScopes);

const areAppsInWaves = selectedRows.some(
(application) => application.migrationWave !== null
);

const importDropdownItems = importWriteAccess
? [
<DropdownItem
Expand Down Expand Up @@ -455,18 +459,14 @@ export const ApplicationsTableAnalyze: React.FC = () => {
? [
<ConditionalTooltip
key="delete-app-tooltip"
isTooltipEnabled={selectedRows.some(
(application) => application.migrationWave !== null
)}
isTooltipEnabled={areAppsInWaves}
content={
"Cannot delete application(s) assigned to migration wave(s)."
}
>
<DropdownItem
key="applications-bulk-delete"
isAriaDisabled={selectedRows.some(
(application) => application.migrationWave !== null
)}
isAriaDisabled={areAppsInWaves || selectedRows.length < 1}
onClick={() => {
openBulkDeleteModal(selectedRows);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,10 @@ export const ApplicationsTable: React.FC = () => {
importWriteAccess = checkAccess(userScopes, importsWriteScopes),
applicationWriteAccess = checkAccess(userScopes, applicationsWriteScopes);

const areAppsInWaves = selectedRows.some(
(application) => application.migrationWave !== null
);

const importDropdownItems = importWriteAccess
? [
<DropdownItem
Expand All @@ -631,18 +635,14 @@ export const ApplicationsTable: React.FC = () => {
? [
<ConditionalTooltip
key="delete-app-tooltip"
isTooltipEnabled={selectedRows.some(
(application) => application.migrationWave !== null
)}
isTooltipEnabled={areAppsInWaves}
content={
"Cannot delete application(s) assigned to migration wave(s)."
}
>
<DropdownItem
key="applications-bulk-delete"
isAriaDisabled={selectedRows.some(
(application) => application.migrationWave !== null
)}
isAriaDisabled={areAppsInWaves || selectedRows.length < 1}
onClick={() => {
openBulkDeleteModal(selectedRows);
}}
Expand Down