Skip to content

Commit

Permalink
Measurable Category - Fixes based on code review
Browse files Browse the repository at this point in the history
- fixing permissions
- removing commented-out route
- clarifying input label
- aligning default icon to the default used in the database schema

#CTCTOWALTZ-3278
#7023
  • Loading branch information
db-waltz committed Aug 22, 2024
1 parent ecccdb5 commit a5f73c0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
7 changes: 0 additions & 7 deletions waltz-ng/client/system/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,6 @@ const measurableCategoryEditState = {
};



// const measurableCategoryEdit = {
// url: "/measurable-category/{id:int}/edit",
// views: { "content@": MeasurableCategoryEdit }
// };


const eudaListState = {
url: "/euda-list",
views: {"content@": EudaListView}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
id: null, // we want a new category
position: 0,
lastUpdatedBy: "defaultValue",
icon: "cog",
icon: "puzzle-piece",
allowPrimaryRatings: false
};
Expand Down Expand Up @@ -191,16 +191,16 @@
</div>
</div>
</div>
<div class="form-group">
<label for="editor_role">
Editor Role
</label>
<div>
<input id="editor_role"
bind:value={$workingCopy.ratingEditorRole}>
<div class="help-inline">
Which role is needed to edit the taxonomy
</div>
<label for="editor_role">Ratings Editor Role</label>
<input id="editor_role"
class="form-control"
style="width: 20%"
bind:value={$workingCopy.ratingEditorRole}>
<div class="help-inline">
The role needed by users to perform mappings against this taxonomy.
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
DELETE: "delete"
};
const requiredPermissions = [ // user should have at least one of these
systemRoles.ADMIN.key,
systemRoles.TAXONOMY_EDITOR.key
];
const permissionsCall = userStore.load();
let loadCategoriesCall;
Expand All @@ -27,7 +32,10 @@
let hasEditPermissions = false;
$: permissions = $permissionsCall?.data;
$: hasEditPermissions = _.includes(permissions?.roles, systemRoles.AGGREGATE_OVERLAY_DIAGRAM_EDITOR.key) || false;
$: hasEditPermissions = _.some(
permissions?.roles,
r => _.includes(requiredPermissions, r));
function loadCategories() {
loadCategoriesCall = measurableCategoryStore.findAll(true);
Expand Down
2 changes: 1 addition & 1 deletion waltz-ng/client/system/system-admin-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const referenceDataOptions= [
icon: "id-card-o"
}, {
name: "Measurable Categories",
role: "ADMIN",
role: "TAXONOMY_EDITOR",
description: "View and edit measurable categories",
state: "main.system.measurable-category.list",
icon: "puzzle-piece"
Expand Down

0 comments on commit a5f73c0

Please sign in to comment.