From 4f58dcc30c8f0d676b687b10172494c2559637e9 Mon Sep 17 00:00:00 2001 From: Katherine Fleming <2205659+kflemin@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:11:35 -0700 Subject: [PATCH] AH UI Fixes for access level modals (#4501) * ah ui fixes * Small fixes --------- Co-authored-by: Alex Swindler --- ...on_add_access_level_instance_modal_controller.js | 13 ++++++++++--- seed/static/seed/partials/accounts.html | 2 +- seed/static/seed/partials/accounts_nav.html | 2 +- seed/static/seed/partials/data_upload_modal.html | 1 - .../seed/partials/data_upload_modal_progress.html | 6 +++--- ...rganization_add_access_level_instance_modal.html | 6 +++--- seed/templates/seed/_header.html | 3 +-- 7 files changed, 19 insertions(+), 14 deletions(-) diff --git a/seed/static/seed/js/controllers/organization_add_access_level_instance_modal_controller.js b/seed/static/seed/js/controllers/organization_add_access_level_instance_modal_controller.js index c41650bf4d..dcd2a2613c 100644 --- a/seed/static/seed/js/controllers/organization_add_access_level_instance_modal_controller.js +++ b/seed/static/seed/js/controllers/organization_add_access_level_instance_modal_controller.js @@ -25,9 +25,10 @@ angular.module('BE.seed.controller.organization_add_access_level_instance_modal' $scope.level_names = level_names; $scope.selected_level_index = null; $scope.parent = null; - $scope.potental_parents = []; + $scope.potential_parents = []; $scope.new_level_instance_name = ''; + /* Build out access_level_instances_by_depth recursively */ const access_level_instances_by_depth = {}; const calculate_access_level_instances_by_depth = function (tree, depth = 1) { @@ -41,11 +42,17 @@ angular.module('BE.seed.controller.organization_add_access_level_instance_modal' calculate_access_level_instances_by_depth(access_level_tree, 1); $scope.change_selected_level_index = function () { - const new_level_instance_depth = parseInt($scope.selected_level_index); - $scope.potental_parents = access_level_instances_by_depth[new_level_instance_depth]; + const new_level_instance_depth = parseInt($scope.selected_level_index, 10); + $scope.potential_parents = access_level_instances_by_depth[new_level_instance_depth]; $scope.parent = null; }; + // attempt to default the access level + if ($scope.level_names.length > 1){ + $scope.selected_level_index = 1; + $scope.change_selected_level_index(); + } + $scope.create_new_level_instance = function () { organization_service.create_organization_access_level_instance(org_id, $scope.parent.id, $scope.new_level_instance_name) .then((_) => $uibModalInstance.close()) diff --git a/seed/static/seed/partials/accounts.html b/seed/static/seed/partials/accounts.html index 1464ccbeb0..857e088d0f 100644 --- a/seed/static/seed/partials/accounts.html +++ b/seed/static/seed/partials/accounts.html @@ -28,6 +28,7 @@

{$:: 'Organizations I Manage' | translate {$:: org.name $} + {$:: 'Access Level Tree' | translate $} {$:: 'Column Mappings' | translate $} @@ -45,7 +46,6 @@

{$:: 'Organizations I Manage' | translate Settings {$:: 'Sharing' | translate $} {$:: 'Sub-Organizations' | translate $} - {$:: 'Access Level Tree' | translate $} diff --git a/seed/static/seed/partials/accounts_nav.html b/seed/static/seed/partials/accounts_nav.html index 5e2b619941..1076d089fc 100644 --- a/seed/static/seed/partials/accounts_nav.html +++ b/seed/static/seed/partials/accounts_nav.html @@ -1,3 +1,4 @@ +Access Level Tree Settings Sharing Sub-Organizations -Access Level Tree diff --git a/seed/static/seed/partials/data_upload_modal.html b/seed/static/seed/partials/data_upload_modal.html index c6ba20f333..3bb6a60019 100644 --- a/seed/static/seed/partials/data_upload_modal.html +++ b/seed/static/seed/partials/data_upload_modal.html @@ -466,7 +466,6 @@

{$:: pm_meter_import_error $}
-
diff --git a/seed/static/seed/partials/data_upload_modal_progress.html b/seed/static/seed/partials/data_upload_modal_progress.html index f4e101a5ff..aac65b93a9 100644 --- a/seed/static/seed/partials/data_upload_modal_progress.html +++ b/seed/static/seed/partials/data_upload_modal_progress.html @@ -1,12 +1,12 @@
-
+
{$ uploader.progress | number:0 $}% {$:: 'Complete' | translate $} {$ uploader.status_message ? ': ' + uploader.status_message : '' $}
-
ACCESS_LEVEL_UPLOAD_PROGRESS_MSG
+
ACCESS_LEVEL_UPLOAD_PROGRESS_MSG
diff --git a/seed/static/seed/partials/organization_add_access_level_instance_modal.html b/seed/static/seed/partials/organization_add_access_level_instance_modal.html index 473d12fc50..e373bfc8b7 100644 --- a/seed/static/seed/partials/organization_add_access_level_instance_modal.html +++ b/seed/static/seed/partials/organization_add_access_level_instance_modal.html @@ -10,7 +10,7 @@

{$:: 'Add Level Instance (Node) to the Organizational Structure' | translat id="selected_level_index" ng-model="selected_level_index" ng-change="change_selected_level_index()" - ng-options="i as ('Level ' + i + ' - ' + level_name) for (i, level_name) in level_names"> + ng-options="level_names.indexOf(level_name) as ('Level ' + (level_names.indexOf(level_name) + 1) + ' - ' + level_name) for (i, level_name) in level_names.slice(1)">

@@ -21,14 +21,14 @@

{$:: 'Add Level Instance (Node) to the Organizational Structure' | translat class="form-control" id="potential_parents" ng-model="parent" - ng-options="potental_parent as potental_parent.name for potental_parent in potental_parents"> + ng-options="potential_parent as potential_parent.name for potential_parent in potential_parents">
- +
diff --git a/seed/templates/seed/_header.html b/seed/templates/seed/_header.html index e895ff94ef..27dd2acd3c 100644 --- a/seed/templates/seed/_header.html +++ b/seed/templates/seed/_header.html @@ -37,6 +37,7 @@