Have group actions mirror group flags in UI
Disable edit action for unchangeable groups, disable remove action for unremovable groups.
This commit is contained in:
1 parent
398e10588c
commit
93a80fe256
2 files changed
+5
-1
No files matched your search
@@ -356,6 +356,8 @@ $(function() {
|
||||
};
|
||||
|
||||
self.showEditGroupDialog = function(group) {
|
||||
if (!group.changeable) return;
|
||||
|
||||
self.currentGroup(group);
|
||||
self.editGroupDialog.modal("show");
|
||||
};
|
||||
@@ -397,6 +399,8 @@ $(function() {
|
||||
throw OctoPrint.InvalidArgumentError("group must be set");
|
||||
}
|
||||
|
||||
if (!group.removable) return;
|
||||
|
||||
showConfirmationDialog({
|
||||
title: gettext("Are you sure?"),
|
||||
message: _.sprintf(gettext("You are about to delete the group \"%(name)s\"."), {name: group.name}),
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<td class="settings_groups_description"><span data-bind="text: description"></span></td>
|
||||
<td class="settings_groups_permissions"><span data-bind="text: $root.access.permissionList($data)"></span></td>
|
||||
<td class="settings_groups_actions">
|
||||
<a href="#" class="icon-pencil" title="{{ _('Update group') }}" data-bind="click: function() { $root.access.groups.showEditGroupDialog($data); }"></a> | <a href="#" class="icon-trash" title="{{ _('Delete group') }}" data-bind="click: function() { $root.access.groups.removeGroup($data); }"></a>
|
||||
<a href="#" class="icon-pencil" title="{{ _('Update group') }}" data-bind="enable: changeable, css: {disabled: !changeable}, click: function() { $root.access.groups.showEditGroupDialog($data); }"></a> | <a href="#" class="icon-trash" title="{{ _('Delete group') }}" data-bind="enable: removable, css: {disabled: !removable}, click: function() { $root.access.groups.removeGroup($data); }"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
Reference in new issue
Block a user