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

✨ add ActionsColumn to Migration waves table #2109

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
149 changes: 80 additions & 69 deletions client/src/app/pages/migration-waves/migration-waves.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ import {
ToolbarContent,
ToolbarGroup,
ToolbarItem,
Tooltip,
} from "@patternfly/react-core";
import {
ActionsColumn,
ExpandableRowContent,
Table,
Tbody,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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={[
// {
sarinailinger marked this conversation as resolved.
Show resolved Hide resolved
// title: t("actions.edit"),
// onClick: () => setWaveModalState(migrationWave),
// },
{
isAriaDisabled:
sarinailinger marked this conversation as resolved.
Show resolved Hide resolved
migrationWave.applications.length === 0,
sarinailinger marked this conversation as resolved.
Show resolved Hide resolved
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) {
sarinailinger marked this conversation as resolved.
Show resolved Hide resolved
setWaveToManageModalState(migrationWave);
}
},
},
{
isAriaDisabled:
migrationWave.applications?.length < 1 ||
!hasExportableApplications(
sarinailinger marked this conversation as resolved.
Show resolved Hide resolved
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>
Expand Down
Loading