-
Notifications
You must be signed in to change notification settings - Fork 40
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
✨ add ActionsColumn to Migration waves table #2109
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,10 @@ import { | |
ToolbarContent, | ||
ToolbarGroup, | ||
ToolbarItem, | ||
Tooltip, | ||
} from "@patternfly/react-core"; | ||
import { | ||
ActionsColumn, | ||
ExpandableRowContent, | ||
Table, | ||
Tbody, | ||
|
@@ -62,14 +64,14 @@ import { WaveStatusTable } from "./components/wave-status-table"; | |
import { WaveForm } from "./components/migration-wave-form"; | ||
import { ManageApplicationsForm } from "./components/manage-applications-form"; | ||
import { deleteMigrationWave } from "@app/api/rest"; | ||
import { ConditionalTooltip } from "@app/components/ConditionalTooltip"; | ||
import { ConditionalRender } from "@app/components/ConditionalRender"; | ||
import { AppPlaceholder } from "@app/components/AppPlaceholder"; | ||
import { ToolbarBulkSelector } from "@app/components/ToolbarBulkSelector"; | ||
import { ConfirmDialog } from "@app/components/ConfirmDialog"; | ||
import { toRefs } from "@app/utils/model-utils"; | ||
import { useFetchTickets } from "@app/queries/tickets"; | ||
import { isInClosedRange } from "@app/components/FilterToolbar/dateUtils"; | ||
import { PencilAltIcon } from "@patternfly/react-icons"; | ||
|
||
export const MigrationWaves: React.FC = () => { | ||
const { t } = useTranslation(); | ||
|
@@ -455,6 +457,15 @@ export const MigrationWaves: React.FC = () => { | |
? migrationWave.status | ||
: "--"} | ||
</Td> | ||
<Td isActionCell id="pencil-action"> | ||
<Tooltip content={t("actions.edit")}> | ||
<Button | ||
variant="plain" | ||
icon={<PencilAltIcon />} | ||
onClick={() => setWaveModalState(migrationWave)} | ||
/> | ||
</Tooltip> | ||
</Td> | ||
<Td isActionCell id="row-actions"> | ||
<Dropdown | ||
isOpen={isRowDropdownOpen === migrationWave.id} | ||
|
@@ -482,74 +493,74 @@ export const MigrationWaves: React.FC = () => { | |
)} | ||
shouldFocusToggleOnSelect | ||
> | ||
<DropdownItem | ||
key="edit" | ||
component="button" | ||
onClick={() => setWaveModalState(migrationWave)} | ||
> | ||
{t("actions.edit")} | ||
</DropdownItem> | ||
<ConditionalTooltip | ||
key="manage-app" | ||
isTooltipEnabled={applications.length === 0} | ||
content={ | ||
"No applications are available for assignment." | ||
} | ||
> | ||
<DropdownItem | ||
key="manage-app" | ||
isAriaDisabled={applications.length === 0} | ||
onClick={() => { | ||
setWaveToManageModalState(migrationWave); | ||
}} | ||
> | ||
{t("composed.manage", { | ||
what: t("terms.applications").toLowerCase(), | ||
})} | ||
</DropdownItem> | ||
</ConditionalTooltip> | ||
<ConditionalTooltip | ||
key="export-to-issue-manager" | ||
isTooltipEnabled={ | ||
migrationWave.applications?.length < 1 || | ||
!hasExportableApplications( | ||
tickets, | ||
migrationWave?.applications | ||
) | ||
} | ||
content={ | ||
"No applications are available for export." | ||
} | ||
> | ||
<DropdownItem | ||
key="export-to-issue-manager" | ||
isAriaDisabled={ | ||
migrationWave.applications?.length < 1 || | ||
!hasExportableApplications( | ||
tickets, | ||
migrationWave?.applications | ||
) | ||
} | ||
onClick={() => | ||
setApplicationsToExport( | ||
migrationWave.fullApplications | ||
) | ||
} | ||
> | ||
{t("terms.exportToIssue")} | ||
</DropdownItem> | ||
</ConditionalTooltip> | ||
<DropdownItem | ||
key="delete" | ||
onClick={() => | ||
setMigrationWaveToDelete({ | ||
id: migrationWave.id, | ||
name: migrationWave.name, | ||
}) | ||
} | ||
> | ||
{t("actions.delete")} | ||
</DropdownItem> | ||
<ActionsColumn | ||
items={[ | ||
// { | ||
// title: t("actions.edit"), | ||
// onClick: () => setWaveModalState(migrationWave), | ||
// }, | ||
{ | ||
isAriaDisabled: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice! I haven't used it yet but |
||
migrationWave.applications.length === 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You use several ways of checking that the applications list is empty - they all OK but for the sake of consistency I would pick one option. My preference would be the one that is already used in the legacy code but feel free to chose. |
||
tooltipProps: { | ||
content: | ||
migrationWave.applications.length === 0 | ||
? "No applications are available for assignment." | ||
: "", | ||
}, | ||
title: t("composed.manage", { | ||
what: t("terms.applications").toLowerCase(), | ||
}), | ||
onClick: () => { | ||
if (migrationWave.applications.length > 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this check ? I would expect that |
||
setWaveToManageModalState(migrationWave); | ||
} | ||
}, | ||
}, | ||
{ | ||
isAriaDisabled: | ||
migrationWave.applications?.length < 1 || | ||
!hasExportableApplications( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to check for both conditions? I haven't tested this flow but looking at the code: when there is no apps then there should also be no exportable apps so the second condition alone would do the job. |
||
tickets, | ||
migrationWave?.applications | ||
), | ||
tooltipProps: { | ||
content: | ||
migrationWave.applications?.length < 1 || | ||
!hasExportableApplications( | ||
tickets, | ||
migrationWave?.applications | ||
) | ||
? "No applications are available for export." | ||
: "", | ||
}, | ||
title: t("terms.exportToIssue"), | ||
onClick: () => { | ||
if ( | ||
migrationWave.applications?.length > 0 && | ||
hasExportableApplications( | ||
tickets, | ||
migrationWave?.applications | ||
) | ||
) { | ||
setApplicationsToExport( | ||
migrationWave.fullApplications | ||
); | ||
} | ||
}, | ||
}, | ||
{ | ||
title: t("actions.delete"), | ||
onClick: () => { | ||
setMigrationWaveToDelete({ | ||
id: migrationWave.id, | ||
name: migrationWave.name, | ||
}); | ||
}, | ||
isDanger: true, | ||
}, | ||
]} | ||
/> | ||
</Dropdown> | ||
</Td> | ||
</TableRowContentWithControls> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove commented code.