Skip to content

Commit

Permalink
Merge pull request #3157 from SEED-platform/3127-feat/meter-import-count
Browse files Browse the repository at this point in the history
3127 feat/meter import count
  • Loading branch information
Ryo committed Mar 10, 2022
2 parents 837c9bd + 3566287 commit 7812762
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
10 changes: 10 additions & 0 deletions seed/static/seed/js/controllers/data_upload_modal_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ angular.module('BE.seed.controller.data_upload_modal', [])
};

var present_parsed_meters_confirmation = function (result) {
$scope.proposed_meters_count = result.proposed_imports.length;
$scope.proposed_meters_count_string = $scope.proposed_meters_count > 1 ? `${$scope.proposed_meters_count} Meters` : `${$scope.proposed_meters_count} Meter`;
$scope.proposed_properties_count = new Set(result.proposed_imports.map((meter) => meter.pm_property_id)).size;
$scope.proposed_properties_count_string = $scope.proposed_properties_count > 1 ? `${$scope.proposed_properties_count} Properties` : `${$scope.proposed_properties_count} Property`;
$scope.unlinkable_properties_count = result.unlinkable_pm_ids.length;
$scope.unlinkable_properties_count_string = $scope.unlinkable_properties_count > 1 ? `${$scope.unlinkable_properties_count} Properties` : `${$scope.unlinkable_properties} Property`;
$scope.proposed_imports_options = {
data: result.proposed_imports,
columnDefs: [{
Expand Down Expand Up @@ -593,6 +599,10 @@ angular.module('BE.seed.controller.data_upload_modal', [])
$scope.uploader.status_message = 'saving complete';
$scope.uploader.progress = 100;
if (is_meter_data) {
$scope.import_meters_count = progress_data.message.length;
$scope.import_meters_count_string = $scope.import_meters_count > 1 ? `${$scope.import_meters_count} Meters` : `${$scope.import_meters_count} Meter`;
$scope.import_properties_count = new Set(progress_data.message.map((meter) => meter.pm_property_id)).size;
$scope.import_properties_count_string = $scope.import_properties_count > 1 ? `${$scope.import_properties_count} Properties` : `${$scope.import_properties_count} Property`;
$scope.import_results_options = meter_import_results(progress_data.message);
$scope.step.number = 16;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ angular.module('BE.seed.controller.green_button_upload_modal', [])

var show_confirmation_info = function () {
uploader_service.greenbutton_meters_preview($scope.file_id, $scope.organization_id, $scope.view_id).then(function (result) {
$scope.proposed_meters_count = result.proposed_imports.length
$scope.proposed_meters_count_string = $scope.proposed_meters_count > 1 ? `${$scope.proposed_meters_count} Meters` : `${$scope.proposed_meters_count} Meter`
$scope.proposed_imports_options = {
data: result.proposed_imports,
columnDefs: base_green_button_col_defs,
Expand Down Expand Up @@ -172,6 +174,9 @@ angular.module('BE.seed.controller.green_button_upload_modal', [])
enableVerticalScrollbar: message.length <= 5 ? uiGridConstants.scrollbars.NEVER : uiGridConstants.scrollbars.WHEN_NEEDED,
minRowsToShow: grid_rows_to_display(message)
};
$scope.import_meters_count = message.length
$scope.import_meters_count_string = $scope.import_meters_count > 1 ? `${$scope.import_meters_count} Meters` : `${$scope.import_meters_count} Meter`

};

$scope.accept_greenbutton_meters = function () {
Expand Down
9 changes: 9 additions & 0 deletions seed/static/seed/partials/data_upload_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ <h4 class="modal-title" ng-switch-when="16" translate>PM_METER_IMPORT_RESULTS</h
<div class="alert alert-warning" ng-if="proposed_imports_options.data.length">
<div ng-if="proposed_imports_options.data.length">
<div translate><b>METER_READING_COUNTS_TITLE</b></div>
<ul class="meter-count" ng-if="proposed_properties_count">
<li>{$ proposed_meters_count_string $} from {$ proposed_properties_count_string $}</li>
</ul>
<div ui-grid="proposed_imports_options" ui-grid-resize-columns></div>
</div>
<br>
Expand All @@ -369,6 +372,9 @@ <h4 class="modal-title" ng-switch-when="16" translate>PM_METER_IMPORT_RESULTS</h
</div>
<div class="alert alert-danger" ng-if="unlinkable_pm_ids_options.data.length">
<div translate><b>PM_METER_IMPORT_NO_ASSOCIATION</b></div>
<ul class="meter-count" ng-if="unlinkable_properties_count">
<li>{$ unlinkable_properties_count_string $}</li>
</ul>
<div ui-grid="unlinkable_pm_ids_options" ui-grid-resize-columns></div>
</div>
</div>
Expand All @@ -379,6 +385,9 @@ <h4 class="modal-title" ng-switch-when="16" translate>PM_METER_IMPORT_RESULTS</h
<div class="row">
<div class="alert alert-info">
<div translate><b>METER_READING_COUNTS_TITLE</b></div>
<ul class="meter-count" ng-if="import_properties_count">
<li>{$ import_meters_count_string $} Imported from {$ import_properties_count_string $} </li>
</ul>
<div ui-grid="import_results_options"></div>
</div>
<div class="alert alert-danger" ng-if="unlinkable_pm_ids.length">
Expand Down
6 changes: 6 additions & 0 deletions seed/static/seed/partials/green_button_upload_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ <h4 class="modal-title" ng-switch-when="4" translate>UPLOAD_COMPLETE_TITLE</h4>
<div class="alert alert-warning green-button-preview">
<div>
<div translate><b>METER_READING_COUNTS_TITLE</b></div>
<ul class="meter-count" ng-if="proposed_meters_count">
<li>{$ proposed_meters_count_string $} </li>
</ul>
<div ui-grid="proposed_imports_options" ui-grid-resize-columns></div>
</div>
<br>
Expand All @@ -47,6 +50,9 @@ <h4 class="modal-title" ng-switch-when="4" translate>UPLOAD_COMPLETE_TITLE</h4>
<div class="data_upload_steps" ng-switch-when="4">
<div class="alert alert-info green-button-preview">
<div translate><b>METER_READING_COUNTS_TITLE</b></div>
<ul class="meter-count" ng-if="import_meters_count">
<li>{$ import_meters_count_string $}</li>
</ul>
<div ui-grid="import_result_options" ui-grid-resize-columns></div>
</div>
</div>
Expand Down
8 changes: 8 additions & 0 deletions seed/static/seed/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1810,6 +1810,14 @@ a:not([href]) {
padding-left: 0;
}

.meter-count {
margin-bottom: 0px;

li {
padding: 5px;
}
}

}

.modal-footer {
Expand Down

0 comments on commit 7812762

Please sign in to comment.