Skip to content

Commit

Permalink
AH UI Fixes for access level modals (#4501)
Browse files Browse the repository at this point in the history
* ah ui fixes

* Small fixes

---------

Co-authored-by: Alex Swindler <[email protected]>
  • Loading branch information
kflemin and axelstudios authored Jan 24, 2024
1 parent 0207aef commit 4f58dcc
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion seed/static/seed/partials/accounts.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ <h2><i class="fa-solid fa-users"></i> {$:: 'Organizations I Manage' | translate
<a ui-sref="organization_members(::{organization_id: org.id})">{$:: org.name $}</a>
</td>
<td class="account_org right">
<a ui-sref="organization_access_level_tree(::{organization_id: org.id})"><i class="fa-solid fa-users"></i>{$:: 'Access Level Tree' | translate $}</a>
<a ui-sref="organization_column_mappings(::{organization_id: org.id, inventory_type: 'properties'})" ng-if="::org.is_parent"
><i class="fa-solid fa-sitemap"></i>{$:: 'Column Mappings' | translate $}</a
>
Expand All @@ -45,7 +46,6 @@ <h2><i class="fa-solid fa-users"></i> {$:: 'Organizations I Manage' | translate
<a ui-sref="organization_settings(::{organization_id: org.id})"><i class="fa-solid fa-gears"></i>Settings</a>
<a ui-sref="organization_sharing(::{organization_id: org.id})" ng-if="::org.is_parent"><i class="fa-solid fa-share-from-square"></i>{$:: 'Sharing' | translate $}</a>
<a ui-sref="organization_sub_orgs(::{organization_id: org.id})" ng-if="::org.is_parent"><i class="fa-solid fa-users"></i>{$:: 'Sub-Organizations' | translate $}</a>
<a ui-sref="organization_access_level_tree(::{organization_id: org.id})"><i class="fa fa-users"></i>{$:: 'Access Level Tree' | translate $}</a>
<i class="fa-solid fa-gear"></i>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion seed/static/seed/partials/accounts_nav.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<a ui-sref="organization_access_level_tree(::{organization_id: org.id})" ui-sref-active="active" translate>Access Level Tree</a>
<a
ui-sref="organization_column_mappings(::{organization_id: org.id, inventory_type: 'properties'})"
ng-if="::auth.requires_owner"
Expand Down Expand Up @@ -33,4 +34,3 @@
<a ui-sref="organization_settings(::{organization_id: org.id})" ng-if="::auth.requires_owner" ui-sref-active="active" translate>Settings</a>
<a ui-sref="organization_sharing(::{organization_id: org.id})" ng-if="::org.is_parent && auth.requires_owner" ui-sref-active="active" translate>Sharing</a>
<a ui-sref="organization_sub_orgs(::{organization_id: org.id})" ng-if="::org.is_parent && auth.requires_owner" ui-sref-active="active" translate>Sub-Organizations</a>
<a ui-sref="organization_access_level_tree(::{organization_id: org.id})" ui-sref-active="active" translate>Access Level Tree</a>
1 change: 0 additions & 1 deletion seed/static/seed/partials/data_upload_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ <h4 class="modal-title" ng-switch-when="21" translate>Successful upload!</h4>
<!-- Step 15: Upload PM Meter Readings -->
<div class="data_upload_steps" ng-switch-when="15">
<div class="alert alert-danger" ng-show="pm_meter_import_error" translate>{$:: pm_meter_import_error $}</div>

<div class="progress_bar_container" ng-show="uploader.in_progress">
<div class="progress_bar_copy_top" translate="UPLOADING_PROGRESS" translate-values="{ dataset_filename: dataset.filename , cycle_name: selectedCycle.name }"></div>

Expand Down
6 changes: 3 additions & 3 deletions seed/static/seed/partials/data_upload_modal_progress.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div class="progress_bar_container">
<div class="progress_bar_copy_top" ng-if="step.number!==17 && step.number!==20" ng-attr-translate="{$ multipleCycleUpload ? 'UPLOADING_PROGRESS_MULTIPLE_CYCLE' : 'UPLOADING_PROGRESS' $}" translate-values="{ dataset_filename: dataset.filename , cycle_name: selectedCycle.name }"></div>
<div class="progress_bar_copy_top" ng-if="step.number !== 17 && step.number !== 20" ng-attr-translate="{$ multipleCycleUpload ? 'UPLOADING_PROGRESS_MULTIPLE_CYCLE' : 'UPLOADING_PROGRESS' $}" translate-values="{ dataset_filename: dataset.filename , cycle_name: selectedCycle.name }"></div>
<div
class="progress_bar_copy_top"
ng-if="step.number !== 20"
ng-if="step.number === 20"
ng-attr-translate="{$ multipleCycleUpload ? 'UPLOADING_PROGRESS_MULTIPLE_CYCLE' : 'UPLOADING_PROGRESS' $}"
translate-values="{ dataset_filename: dataset.filename , cycle_name: selectedCycle.name }"
></div>
<uib-progressbar class="progress-striped active" value="uploader.progress" type="success"></uib-progressbar>
<div ng-if="step.number !== 20" class="progress_bar_copy_bottom">{$ uploader.progress | number:0 $}% {$:: 'Complete' | translate $} {$ uploader.status_message ? ': ' + uploader.status_message : '' $}</div>
<div ng-if="step.number == 20" class="progress_bar_copy_bottom" translate>ACCESS_LEVEL_UPLOAD_PROGRESS_MSG</div>
<div ng-if="step.number === 20" class="progress_bar_copy_bottom" translate>ACCESS_LEVEL_UPLOAD_PROGRESS_MSG</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h4> {$:: '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)">
</select>
</div>
</div>
Expand All @@ -21,14 +21,14 @@ <h4> {$:: '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">
</select>
</div>
</div>
<div class="row pad-bot-10">
<div class="form-group col-sm-12">
<label for="name" translate>Enter a Name for the new Access Level Instance</label>
<input id="name" style="margin: 10px 0px;" type="text" class="form-control" ng-model="new_level_instance_name">
<input id="name" style="margin: 10px 0;" type="text" class="form-control" ng-model="new_level_instance_name">
</div>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions seed/templates/seed/_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<ul uib-dropdown-menu class="dropdown-menu pull-right justify-left" role="menu" aria-labelledby="btnCreateNew">
<li class="dropdown-header" translate>Organization Settings</li>
<li class="divider"></li>
<li><a ui-sref="organization_access_level_tree({organization_id: menu.user.organization.id})" ui-sref-active="active" translate>Access Level Tree</a></li>
<li>
<a ui-sref="organization_column_mappings({organization_id: menu.user.organization.id, inventory_type: 'properties'})" ng-if="auth.requires_owner" ui-sref-active="active" translate
>Column Mappings</a
Expand Down Expand Up @@ -73,8 +74,6 @@
>Sub-Organizations</a
>
</li>
<li><a ui-sref="organization_access_level_tree({organization_id: menu.user.organization.id})" ui-sref-active="active" translate>Access Level Tree</a></li>

<!--<li>
<a data-toggle="modal" data-target="#newProjectModalIndex" ng-click="open_create_project_modal()">Project</a>
</li>
Expand Down

0 comments on commit 4f58dcc

Please sign in to comment.