Skip to content

Commit

Permalink
Hierarchy tree/modal improvements (#4515)
Browse files Browse the repository at this point in the history
Fixed several issues with the AH tree and modals
  • Loading branch information
axelstudios authored Feb 2, 2024
1 parent e761b02 commit a2fd632
Show file tree
Hide file tree
Showing 17 changed files with 173 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ angular.module('BE.seed.controller.organization_access_level_tree', [])
'urls',
'$window',
'spinner_utility',
// eslint-disable-next-line func-names
function (
$scope,
$uibModal,
Expand Down Expand Up @@ -46,10 +47,11 @@ angular.module('BE.seed.controller.organization_access_level_tree', [])
}
};

$scope.open_add_level_modal = function () {
$scope.open_add_level_modal = () => {
$uibModal.open({
templateUrl: `${urls.static_url}seed/partials/organization_add_access_level_modal.html`,
controller: 'organization_add_access_level_modal_controller',
backdrop: 'static',
resolve: {
org_id: () => $scope.org.id,
current_access_level_names: () => $scope.access_level_names
Expand All @@ -60,10 +62,11 @@ angular.module('BE.seed.controller.organization_access_level_tree', [])
});
};

$scope.open_add_level_instance_modal = function () {
$scope.open_add_level_instance_modal = () => {
$uibModal.open({
templateUrl: `${urls.static_url}seed/partials/organization_add_access_level_instance_modal.html`,
controller: 'organization_add_access_level_instance_modal_controller',
backdrop: 'static',
resolve: {
org_id: () => $scope.org.id,
level_names: () => $scope.access_level_names,
Expand All @@ -75,11 +78,12 @@ angular.module('BE.seed.controller.organization_access_level_tree', [])
});
};

$scope.open_upload_al_instances_modal = function () {
$scope.open_upload_al_instances_modal = () => {
const step = 20; // this is the step that corresponds to uploading access levels
$uibModal.open({
templateUrl: `${urls.static_url}seed/partials/data_upload_modal.html`,
controller: 'data_upload_modal_controller',
backdrop: 'static',
resolve: {
cycles: () => [],
step: () => step,
Expand All @@ -91,16 +95,17 @@ angular.module('BE.seed.controller.organization_access_level_tree', [])
});
};

$scope.open_delete_al_instance_modal = function(instance_id, instance_name) {
$scope.open_delete_al_instance_modal = (instance_id, instance_name) => {
$uibModal.open({
templateUrl: urls.static_url + 'seed/partials/organization_delete_access_level_instance_modal.html',
templateUrl: `${urls.static_url}seed/partials/organization_delete_access_level_instance_modal.html`,
controller: 'organization_delete_access_level_instance_modal_controller',
backdrop: 'static',
resolve: {
org_id: function() {return $scope.org.id},
instance_id: function() {return instance_id},
instance_name: function() {return instance_name}
},
}).result.then(function () {
org_id: () => $scope.org.id,
instance_id: () => instance_id,
instance_name: () => instance_name
}
}).result.then(() => {
spinner_utility.show();
$window.location.reload();
});
Expand All @@ -110,6 +115,7 @@ angular.module('BE.seed.controller.organization_access_level_tree', [])
$uibModal.open({
templateUrl: `${urls.static_url}seed/partials/organization_delete_access_level_instance_modal.html`,
controller: 'organization_delete_access_level_instance_modal_controller',
backdrop: 'static',
resolve: {
org_id: () => $scope.org.id,
instance_id: () => instance_id,
Expand All @@ -121,10 +127,11 @@ angular.module('BE.seed.controller.organization_access_level_tree', [])
});
};

$scope.open_edit_al_instance_modal = function (instance_id, instance_name) {
$scope.open_edit_al_instance_modal = (instance_id, instance_name) => {
$uibModal.open({
templateUrl: `${urls.static_url}seed/partials/organization_edit_access_level_instance_modal.html`,
controller: 'organization_edit_access_level_instance_modal_controller',
backdrop: 'static',
resolve: {
org_id: () => $scope.org.id,
instance_id: () => instance_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ angular.module('BE.seed.controller.organization_add_access_level_modal', [])
'org_id',
'current_access_level_names',
'Notification',
// eslint-disable-next-line func-names
function (
$scope,
$state,
Expand All @@ -20,16 +21,13 @@ angular.module('BE.seed.controller.organization_add_access_level_modal', [])
current_access_level_names,
Notification
) {
$scope.current_access_level_names = [...current_access_level_names];
$scope.new_access_level_names = current_access_level_names;
$scope.new_access_level_names = angular.copy(current_access_level_names);

$scope.is_modifed = () => !_.isEqual($scope.current_access_level_names, $scope.new_access_level_names);
$scope.is_modified = () => !_.isEqual(current_access_level_names, $scope.new_access_level_names);

$scope.save_access_level_names = function () {
$scope.save_access_level_names = () => {
organization_service.update_organization_access_level_names(org_id, $scope.new_access_level_names)
.then(
(_) => $uibModalInstance.close()
)
.then(() => $uibModalInstance.close())
.catch((err) => {
console.log(err.data.message);
Notification.error(err.data.message);
Expand All @@ -41,7 +39,7 @@ angular.module('BE.seed.controller.organization_add_access_level_modal', [])
};

$scope.add_level = () => {
$scope.new_access_level_names.push("");
$scope.new_access_level_names.push('');
};

$scope.cancel = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ angular.module('BE.seed.controller.organization_edit_access_level_instance_modal
'instance_id',
'instance_name',
'Notification',
// eslint-disable-next-line func-names
function (
$scope,
$state,
Expand All @@ -25,13 +26,15 @@ angular.module('BE.seed.controller.organization_edit_access_level_instance_modal
$scope.instance_id = instance_id;
$scope.level_instance_name = instance_name;

$scope.edit_level_instance = function () {
$scope.save_if_changed = () => {
if (instance_name === $scope.level_instance_name) $scope.cancel();

organization_service.edit_organization_access_level_instance(org_id, $scope.instance_id, $scope.level_instance_name)
.then((_) => $uibModalInstance.close())
.then(() => $uibModalInstance.close())
.catch((err) => { Notification.error(err); });
};

$scope.cancel = function () {
$scope.cancel = () => {
$uibModalInstance.dismiss('cancel');
};
}]);
2 changes: 1 addition & 1 deletion seed/static/seed/partials/analyses.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</td>
<td>{$:: analysis.created_at | date : 'MM-dd-yyyy HH:mm' $}</td>
<td class="analysis-status {$ analysis.status.toLowerCase() $}">
<i class="fa-solid fa-arrows-rotate fa-pulse fa-fw" style="padding-right: 0" ng-if="!analysis._finished_with_tasks"></i>
<i class="fa-solid fa-arrows-rotate fa-spin-pulse fa-fw" style="padding-right: 0" ng-if="!analysis._finished_with_tasks"></i>
{$ analysis.status $}
</td>
<td>{$:: analysis.start_time | date : 'MM-dd-yyyy HH:mm' $}</td>
Expand Down
2 changes: 1 addition & 1 deletion seed/static/seed/partials/analysis_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1 class="grow">{$:: analysis.name $} <small>Run #{$:: analysis.views[0] $}</small></h1>
<!-- <span class="link" ui-sref="analysis(::{organization_id: org.id, analysis_id: analysis.id})">Analysis {$:: analysis.name $}</span> -->
<span>
<i class="fa-solid fa-arrows-rotate fa-pulse fa-fw" style="padding-right: 0" ng-if="!analysis._finished_with_tasks"></i>
<i class="fa-solid fa-arrows-rotate fa-spin-pulse fa-fw" style="padding-right: 0" ng-if="!analysis._finished_with_tasks"></i>
{$ analysis.status $}
</span>
<span ng-if="allowActions">
Expand Down
2 changes: 1 addition & 1 deletion seed/static/seed/partials/analysis_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</td>
<td>{$:: analysis.created_at | date : 'MM-dd-yyyy HH:mm' $}</td>
<td class="analysis-status {$ analysis.status.toLowerCase() $}">
<i class="fa-solid fa-arrows-rotate fa-pulse fa-fw" style="padding-right: 0" ng-if="!analysis._finished_with_tasks"></i>
<i class="fa-solid fa-arrows-rotate fa-spin-pulse fa-fw" style="padding-right: 0" ng-if="!analysis._finished_with_tasks"></i>
{$ analysis.status $}
</td>
<td style="white-space: break-spaces">{$:: (messages | filter : {'analysis_property_view':null})[0]['user_message'] $}</td>
Expand Down
2 changes: 1 addition & 1 deletion seed/static/seed/partials/at_scenarios.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</div>
</tr>
<tr ng-repeat-end>
<td colspan="6" class="hiddenRow" style="padding: 0">
<td colspan="6" class="hidden-row" style="padding: 0">
<div class="accordian-body collapse measure-section scenario-collapse" id="scenario-{$ scenario.id $}">
<div class="measures-header" ng-if="measureGridOptionsByScenarioId[scenario.id].data.length">MEASURES</div>
<div
Expand Down
2 changes: 1 addition & 1 deletion seed/static/seed/partials/data_upload_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ <h4 class="modal-title" ng-switch-when="21" translate>Successful upload!</h4>
ng-if="uploader.progress_last_updated != null && uploader.progress_last_checked != null && (uploader.progress_last_checked - uploader.progress_last_updated) / 1000 > 60"
class="progress_bar_copy_bottom"
>
<i class="fa-solid fa-spinner fa-pulse fa-fw" style="padding-right: 0"></i>
<i class="fa-solid fa-spinner fa-spin-pulse fa-fw" style="padding-right: 0"></i>
SEED is still working. Please do not refresh or leave this page. (Last updated at {$ uploader.progress_last_checked | date:'hh:mm a' $})
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions seed/static/seed/partials/data_upload_modal_progress.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<div
class="progress_bar_copy_top"
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 }"
ng-attr-translate="UPLOADING_PROGRESS_NO_CYCLE"
translate-values="{ dataset_filename: dataset.filename }"
></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>
Expand Down
2 changes: 1 addition & 1 deletion seed/static/seed/partials/inventory_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ <h2>
<!-- Show read-only current derived column value -->
<td ng-if="edit_form_showing===false && col.derived_column" class="ellipsis">
<span class="sd-data-content" uib-popover="{$ item_derived_values[col.column_description] $}" popover-trigger="'outsideClick'" popover-animation="false" popover-placement="top-left">
<span ng-if="!item_derived_values.hasOwnProperty(col.id)"><i class="fa-solid fa-spinner fa-pulse fa-fw" style="padding-right: 0"></i> Loading...</span>
<span ng-if="!item_derived_values.hasOwnProperty(col.id)"><i class="fa-solid fa-spinner fa-spin-pulse fa-fw" style="padding-right: 0"></i> Loading...</span>
<span ng-if="!!item_derived_values.hasOwnProperty(col.id)">{$ item_derived_values[col.id] $}</span>
</span>
</td>
Expand Down
2 changes: 1 addition & 1 deletion seed/static/seed/partials/mapping.html
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ <h1 translate="DATA_MAPPING_AND_VALIDATION" translate-values="{ filename: import
</div>
<div class="right_60 section_action_container section_action_btn">
<button type="button" class="btn btn-default" ng-click="open_data_quality_modal()">
<i class="fa-solid fa-spinner fa-pulse fa-fw" style="padding-right: 0" ng-if="!data_quality_results_ready"></i>
<i class="fa-solid fa-spinner fa-spin-pulse fa-fw" style="padding-right: 0" ng-if="!data_quality_results_ready"></i>
<span ng-if="data_quality_results_ready && data_quality_errors > 0"> {$ data_quality_errors $} <i class="fa-solid fa-triangle-exclamation" style="color: #ffb7b7"></i> </span>
<span ng-if="data_quality_results_ready && data_quality_warnings > 0"> {$ data_quality_warnings $} <i class="fa-solid fa-triangle-exclamation" style="color: #fdf4bf"></i> </span>
{$:: 'Data Quality Results' | translate $}
Expand Down
Loading

0 comments on commit a2fd632

Please sign in to comment.