-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rework groups view * Fix params issues * fix requests spam * fix group_management test * add allSettled promise * comment out and skip permissions related tests * add api changes and fixes * fix translation * update changes * fix pagination and UI * show only selected roles * add custom permissions and hide No permission * drop i18n-js from lockfile Issue: AAH-1130
- Loading branch information
1 parent
d5e4396
commit 26857a5
Showing
26 changed files
with
1,170 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Update groups view to allow for role assignment |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { PulpAPI } from './pulp'; | ||
import { RoleAPI } from './role'; | ||
|
||
class API extends PulpAPI { | ||
constructor() { | ||
super('groups/'); | ||
} | ||
|
||
getRolesWithPermissions(id, params?) { | ||
const assignedRoles = this.list(params, `${id}/roles/`); | ||
|
||
const allRoles = RoleAPI.list(); | ||
|
||
return Promise.all([assignedRoles, allRoles]).then(([assigned, all]) => { | ||
// match roles with assigned roles | ||
const results = assigned.data.results | ||
.map(({ role, pulp_href }) => { | ||
const data = all['data'].results.find(({ name }) => name === role); | ||
if (data) { | ||
return { | ||
...data, | ||
// swap pulp_href role with assigned pulp_href role | ||
// to delete the assigned role | ||
pulp_href, | ||
}; | ||
} | ||
}) | ||
.filter(Boolean); | ||
|
||
return { | ||
data: results, | ||
count: results.length, | ||
}; | ||
}); | ||
} | ||
|
||
removeRole(id, pulpId) { | ||
return this.http.delete(`${id}/roles/${pulpId}/`); | ||
} | ||
|
||
addRoleToGroup(id, role, content_object = null) { | ||
return this.http.post(`${id}/roles/`, { | ||
role: role.name, | ||
content_object, | ||
}); | ||
} | ||
} | ||
|
||
export const GroupRoleAPI = new API(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
import { BaseAPI } from './base'; | ||
|
||
export class PulpAPI extends BaseAPI { | ||
constructor() { | ||
super(API_HOST + PULP_API_BASE_PATH); | ||
constructor(extendPath?: string) { | ||
if (extendPath) { | ||
super(API_HOST + PULP_API_BASE_PATH + extendPath); | ||
} else { | ||
super(API_HOST + PULP_API_BASE_PATH); | ||
} | ||
} | ||
|
||
list(params?, apiPath?) { | ||
const changedParams = { ...params }; | ||
if (changedParams['sort']) { | ||
changedParams['ordering'] = changedParams['sort']; | ||
delete changedParams['sort']; | ||
} | ||
return super.list(changedParams, apiPath); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { t } from '@lingui/macro'; | ||
import React from 'react'; | ||
import { | ||
Modal, | ||
ModalVariant, | ||
Wizard as PFWizard, | ||
WizardStep, | ||
} from '@patternfly/react-core'; | ||
|
||
interface Props { | ||
steps: WizardStep[]; | ||
title: string; | ||
variant?: ModalVariant; | ||
onClose: () => void; | ||
onSave: () => void; | ||
} | ||
|
||
export const WizardModal = ({ | ||
steps, | ||
title, | ||
onClose, | ||
onSave, | ||
variant, | ||
}: Props) => ( | ||
<Modal | ||
isOpen | ||
variant={variant ?? ModalVariant.large} | ||
showClose={false} | ||
aria-label={title} | ||
hasNoBodyWrapper | ||
> | ||
<PFWizard | ||
hasNoBodyPadding | ||
navAriaLabel={t`${title} steps`} | ||
mainAriaLabel={t`${title} content`} | ||
titleId='wizard-modal-title' | ||
descriptionId='wizard-modal-description' | ||
title={title} | ||
steps={steps} | ||
onClose={onClose} | ||
onSave={onSave} | ||
/> | ||
</Modal> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...ontainers/group-management/group-detail-role-management/group-detail-role-management.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
.hub-empty-state-box { | ||
min-height: 500px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.hub-custom-wizard-layout { | ||
padding: 1rem 1.5rem 0; | ||
|
||
.hub-select-roles-content { | ||
overflow: auto; | ||
} | ||
|
||
.pf-c-pagination.pf-m-bottom { | ||
padding-top: 0; | ||
} | ||
|
||
.hub-permission { | ||
margin: 3px; | ||
} | ||
|
||
.hub-preview-roles { | ||
margin-top: 20px; | ||
} | ||
|
||
.hub-permissions { | ||
margin: 10px 0; | ||
} | ||
|
||
.hub-filter { | ||
width: 250px; | ||
} | ||
|
||
.hub-selected-roles-list { | ||
overflow-x: auto; | ||
} | ||
|
||
.hub-no-filter-data { | ||
display: flex; | ||
justify-content: center; | ||
height: 400px; | ||
} | ||
} | ||
|
||
.hub-loading-wizard { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.hub-no-data { | ||
display: flex; | ||
justify-content: center; | ||
min-height: 590px; | ||
} |
Oops, something went wrong.