这是indexloc提供的服务,不要输入任何密码
Skip to content
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
10 changes: 3 additions & 7 deletions console/cypress/integration/data/permissions/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ export const savePermission = () => {
// cy.get('.notification-success').click();
};

export const permNoCheck = (tableName, query, first) => {
// first is the insert in case of tables and select in case of views
// During first, the gridcell will not be named properly;
export const permNoCheck = (tableName, query) => {
// click on the query type to edit permission
cy.get(
getElementFromAlias(`${query === first ? '' : 'role0'}-${query}`)
).click();
cy.get(getElementFromAlias(`role0-${query}`)).click();
// check the custom check textbox
// cy.get(getElementFromAlias('toggle-row-permission')).click();
cy.get(getElementFromAlias('without-checks')).click();
Expand Down Expand Up @@ -106,7 +102,7 @@ export const testPermissions = (tableName, check, isView) => {
const first = isView ? 'select' : 'insert';
if (check === 'none') {
allQueryTypes.forEach(query => {
permNoCheck(tableName, query, first);
permNoCheck(tableName, query);
});
} else {
allQueryTypes.forEach(query => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ const modifyReducer = (tableName, schemas, modifyStateOrig, action) => {
};

case PERM_SET_FILTER_SAME_AS:
case PERM_SET_FILTER:
return {
...modifyState,
permissionsState: {
Expand All @@ -343,6 +342,19 @@ const modifyReducer = (tableName, schemas, modifyStateOrig, action) => {
},
};

case PERM_SET_FILTER:
return {
...modifyState,
permissionsState: {
...updatePermissionsState(
modifyState.permissionsState,
getFilterKey(modifyState.permissionsState.query),
action.filter
),
// custom_checked: true,
},
};

case PERM_ALLOW_ALL:
return {
...modifyState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,6 @@ class Permissions extends Component {
dispatch(permCloseEdit());
};

const dispatchRoleNameChange = e => {
dispatch(permSetRoleName(e.target.value));
};

const dispatchBulkSelect = e => {
const isChecked = e.target.checked;
const selectedRole = e.target.getAttribute('data-role');
Expand Down Expand Up @@ -372,8 +368,12 @@ class Permissions extends Component {
const _permissionsRowHtml = [];

// push role value
if (newPermRow) {
const isNewRole = !roleList.includes(permissionsState.newRole);
if (!newPermRow) {
_permissionsRowHtml.push(<th key={-2}>{role}</th>);
} else {
const dispatchRoleNameChange = e => {
dispatch(permSetRoleName(e.target.value));
};

_permissionsRowHtml.push(
<th key={-2}>
Expand All @@ -383,13 +383,11 @@ class Permissions extends Component {
onChange={dispatchRoleNameChange}
type="text"
placeholder="Enter new role"
value={isNewRole ? permissionsState.newRole : ''}
value={role}
data-test="role-textbox"
/>
</th>
);
} else {
_permissionsRowHtml.push(<th key={-2}>{role}</th>);
}

// push action permission value
Expand Down Expand Up @@ -474,7 +472,9 @@ class Permissions extends Component {

// add new role row
_permissionsRowsHtml.push(
<tr key="newPerm">{getPermissionsTableRow('', true)}</tr>
<tr key="newPerm">
{getPermissionsTableRow(permissionsState.newRole, true)}
</tr>
);

return <tbody>{_permissionsRowsHtml}</tbody>;
Expand Down Expand Up @@ -709,7 +709,7 @@ class Permissions extends Component {
const queries = filterQueries[filter].join(', ');
const queryLabel = (
<span data-test="mutual-check">
With same custom checks as <b>{queries}</b>
With same custom check as <b>{queries}</b>
</span>
);
_filterOptionsSection.push(
Expand Down