+
);
@@ -244,6 +260,7 @@ export default class PermissionsDialog extends React.Component {
// Fill any missing fields
perms.get = perms.get || Map();
perms.find = perms.find || Map();
+ perms.count = perms.count || Map();
perms.create = perms.create || Map();
perms.update = perms.update || Map();
perms.delete = perms.delete || Map();
@@ -329,6 +346,7 @@ export default class PermissionsDialog extends React.Component {
if (this.props.advanced) {
nextPerms = nextPerms.setIn(['get', id], true);
nextPerms = nextPerms.setIn(['find', id], true);
+ nextPerms = nextPerms.setIn(['count', id], true);
nextPerms = nextPerms.setIn(['create', id], true);
nextPerms = nextPerms.setIn(['update', id], true);
nextPerms = nextPerms.setIn(['delete', id], true);
@@ -398,6 +416,7 @@ export default class PermissionsDialog extends React.Component {
newPerms = newPerms
.deleteIn(['get', key])
.deleteIn(['find', key])
+ .deleteIn(['count', key])
.deleteIn(['create', key])
.deleteIn(['update', key])
.deleteIn(['delete', key])
@@ -431,7 +450,7 @@ export default class PermissionsDialog extends React.Component {
let output = {};
let fields = [ 'read', 'write' ];
if (this.props.advanced) {
- fields = [ 'get', 'find', 'create', 'update', 'delete', 'addField' ];
+ fields = [ 'get', 'find', 'count', 'create', 'update', 'delete', 'addField' ];
}
fields.forEach((field) => {
diff --git a/src/components/PermissionsDialog/PermissionsDialog.scss b/src/components/PermissionsDialog/PermissionsDialog.scss
index 1a495e38f4..841ae6d600 100644
--- a/src/components/PermissionsDialog/PermissionsDialog.scss
+++ b/src/components/PermissionsDialog/PermissionsDialog.scss
@@ -7,12 +7,24 @@
*/
@import 'stylesheets/globals.scss';
+$labelWidth: 330px;
+$colWidth: 82px;
+$writeColWidth: 92px;
+$addFieldColWidth: 118px;
+$deleteColWidth: 44px;
+
+$sumReadColsWidth: calc(3 * #{$colWidth});
+$sumWriteColsWidth: calc(3 * #{$writeColWidth});
+
+$permissionsDialogWidth: calc(#{$labelWidth} + (2 * #{$colWidth}) + #{$deleteColWidth});
+$permissionsDialogMaxWidth: calc(#{$labelWidth} + #{$sumReadColsWidth} + #{$sumWriteColsWidth} + #{$addFieldColWidth} + #{$deleteColWidth});
+
.dialog {
@include modalAnimation();
position: absolute;
top: 50%;
left: 50%;
- width: 540px;
+ width: $permissionsDialogWidth;
background: white;
border-radius: 5px;
overflow: hidden;
@@ -54,7 +66,7 @@
.level {
height: 50px;
- width: 540px;
+ width: $permissionsDialogWidth;
background: #0E69A1;
position: relative;
color: white;
@@ -82,26 +94,17 @@
overflow-x: hidden;
}
-.second {
- width: 82px;
-}
-.third {
- width: 82px;
+.second, .third, .fourth {
+ width: $colWidth;
}
-.fourth {
- width: 92px;
-}
-.fifth {
- width: 92px;
-}
-.sixth {
- width: 92px;
-}
-.seventh {
- width: 118px;
+.fifth, .sixth, .seventh {
+ width: $writeColWidth;
}
.eighth {
- width: 44px;
+ width: $addFieldColWidth;
+}
+.nineth {
+ width: $deleteColWidth;
}
.table {
@@ -116,16 +119,16 @@
background: rgba(0,0,40,0.03);
&.second {
- left: 330px;
+ left: $labelWidth;
}
&.fourth {
- left: 494px;
+ left: calc(#{$labelWidth} + (2 * #{$colWidth}));
}
&.sixth {
- left: 678px;
+ left: calc(#{$labelWidth} + #{$sumReadColsWidth} + #{$writeColWidth});
}
&.eighth {
- left: 888px;
+ left: calc(#{$labelWidth} + #{$sumReadColsWidth} + #{$sumWriteColsWidth});
}
}
}
@@ -159,7 +162,7 @@
transition: height .3s cubic-bezier(0.645,0.045,0.355,1) .5s;
background: #56AEE3;
height: 0;
- padding-left: 330px;
+ padding-left: $labelWidth;
text-align: center;
color: white;
font-size: 12px;
@@ -174,23 +177,23 @@
}
.readHeader {
- width: 164px;
+ width: $sumReadColsWidth;
}
.writeHeader {
- width: 276px;
+ width: $sumWriteColsWidth;
}
.addHeader {
- width: 118px;
+ width: $addFieldColWidth;
border-right: 1px solid white;
}
.advanced {
- width: 930px;
+ width: $permissionsDialogMaxWidth;
.level {
- width: 930px;
+ width: $permissionsDialogMaxWidth;
}
.headers {
@@ -218,7 +221,7 @@
.label {
display: inline-block;
- width: 330px;
+ width: $labelWidth;
padding: 0 20px;
}
.check {
@@ -233,12 +236,12 @@
.pointerRead {
display: inline-block;
- width: 164px;
+ width: $sumReadColsWidth;
padding: 5px 10px;
}
.pointerWrite {
display: inline-block;
- width: 394px;
+ width: calc(#{$sumWriteColsWidth} + #{$addFieldColWidth});
padding: 5px 10px;
}