can't move groups to the root level (#485)
* can't move groups to the root level disabled "Move" button on root level * can now move groups to root * added move to root test
This commit is contained in:
parent
408caf6d0f
commit
5142d1b4bc
6 changed files with 36 additions and 13 deletions
|
@ -94,6 +94,21 @@ describe("Group test", () => {
|
|||
sidebarPage.goToGroups();
|
||||
listingPage.deleteItem(targetGroupName);
|
||||
});
|
||||
|
||||
it("Should move group to root", async () => {
|
||||
const groups = ["group1", "group2"];
|
||||
await new AdminClient().createSubGroups(groups);
|
||||
sidebarPage.goToGroups();
|
||||
listingPage.goToItemDetails(groups[0]);
|
||||
cy.wait(2000);
|
||||
listingPage.clickRowDetails(groups[1]).clickDetailMenu("Move to");
|
||||
|
||||
moveGroupModal.clickRoot().clickMove();
|
||||
sidebarPage.goToGroups();
|
||||
|
||||
new GroupDetailPage().checkListSubGroup(groups);
|
||||
listingPage.deleteItem(groups[0]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Group details", () => {
|
||||
|
|
|
@ -10,7 +10,7 @@ export default class ListingPage {
|
|||
|
||||
constructor() {
|
||||
this.searchInput = '.pf-c-toolbar__item [type="search"]';
|
||||
this.itemsRows = ".pf-c-page__main-section table";
|
||||
this.itemsRows = "table";
|
||||
this.itemRowDrpDwn = ".pf-c-dropdown > button";
|
||||
this.exportBtn = '[role="menuitem"]:nth-child(1)';
|
||||
this.deleteBtn = '[role="menuitem"]:nth-child(2)';
|
||||
|
|
|
@ -7,6 +7,11 @@ export default class MoveGroupModal {
|
|||
return this;
|
||||
}
|
||||
|
||||
clickRoot() {
|
||||
cy.get(".pf-c-breadcrumb__item > button").click();
|
||||
return this;
|
||||
}
|
||||
|
||||
checkTitle(title: string) {
|
||||
cy.get(this.title).should("have.text", title);
|
||||
return this;
|
||||
|
|
|
@ -171,7 +171,9 @@ export const GroupTable = () => {
|
|||
{
|
||||
title: t("common:delete"),
|
||||
onRowClick: async (group: GroupRepresentation) => {
|
||||
return deleteGroup(group);
|
||||
await deleteGroup(group);
|
||||
refresh();
|
||||
return true;
|
||||
},
|
||||
},
|
||||
]}
|
||||
|
@ -214,7 +216,11 @@ export const GroupTable = () => {
|
|||
delete move.membersLength;
|
||||
try {
|
||||
try {
|
||||
await adminClient.groups.setOrCreateChild({ id }, move);
|
||||
if (id) {
|
||||
await adminClient.groups.setOrCreateChild({ id }, move);
|
||||
} else {
|
||||
await adminClient.groups.create(move);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.response) {
|
||||
throw error;
|
||||
|
|
|
@ -29,7 +29,7 @@ import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
|
|||
type MoveGroupDialogProps = {
|
||||
group: GroupRepresentation;
|
||||
onClose: () => void;
|
||||
onMove: (groupId: string) => void;
|
||||
onMove: (groupId: string | undefined) => void;
|
||||
};
|
||||
|
||||
export const MoveGroupDialog = ({
|
||||
|
@ -73,14 +73,10 @@ export const MoveGroupDialog = ({
|
|||
return (
|
||||
<Modal
|
||||
variant={ModalVariant.large}
|
||||
title={
|
||||
currentGroup()
|
||||
? t("moveToGroup", {
|
||||
group1: group.name,
|
||||
group2: currentGroup().name,
|
||||
})
|
||||
: t("moveTo")
|
||||
}
|
||||
title={t("moveToGroup", {
|
||||
group1: group.name,
|
||||
group2: currentGroup() ? currentGroup().name : t("root"),
|
||||
})}
|
||||
isOpen={true}
|
||||
onClose={onClose}
|
||||
actions={[
|
||||
|
@ -89,7 +85,7 @@ export const MoveGroupDialog = ({
|
|||
key="confirm"
|
||||
variant="primary"
|
||||
form="group-form"
|
||||
onClick={() => onMove(currentGroup().id!)}
|
||||
onClick={() => onMove(currentGroup()?.id)}
|
||||
>
|
||||
{t("moveHere")}
|
||||
</Button>,
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
"path": "Path",
|
||||
"moveTo": "Move to",
|
||||
"moveToGroup": "Move {{group1}} to {{group2}}",
|
||||
"root": "Root",
|
||||
"moveHere": "Move here",
|
||||
"moveGroupEmpty": "No sub groups",
|
||||
"moveGroupEmptyInstructions": "There are no sub groups, select 'Move here' to move the selected group as a subgroup of this group",
|
||||
|
|
Loading…
Reference in a new issue