Skip to content

Commit

Permalink
AH - display matching criteria warning when user uploads data to the …
Browse files Browse the repository at this point in the history
…org for the first time (#4540)

* add deprecation warning

* add matching criteria warning on data upload modal

* display column settings link when user has owner permissions

* restores seed/utils/inventory_filter.py

* add ci to ah/develop

* update tests

* formatting

* restore test_filter_groups.py

---------

Co-authored-by: Hannah Eslinger <[email protected]>
Co-authored-by: Ross Perry <[email protected]>
  • Loading branch information
3 people authored Feb 21, 2024
1 parent 9495faa commit fee2e13
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches:
- "develop"
- "main"
- "AH/develop"

jobs:
# Currently GH Actions provides no simple method for "sharing"
Expand Down
Binary file modified locale/en_US/LC_MESSAGES/django.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions locale/en_US/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2596,6 +2596,9 @@ msgstr "Rename allows users to change the name of the underlying field shown in
msgid "REVIEW YOUR DATA MAPPINGS"
msgstr "REVIEW YOUR DATA MAPPINGS"

msgid "REVIEW_MATCHING_CRITERIA"
msgstr "Review your matching criteria on the Column Settings page before importing data for the first time. You will not be able to remove fields from the matching criteria after data is added to your organization."

msgid "Read more here."
msgstr "Read more here."

Expand Down Expand Up @@ -2940,6 +2943,9 @@ msgstr "STEP 1: Map Your Data"
msgid "STEP 2: Review Your Data Mappings"
msgstr "STEP 2: Review Your Data Mappings"

msgid "SUB_ORG_DEPRECATION"
msgstr "The Sub-Organization functionality is no longer recommended and will be deprecated soon. Visit the Access Level Tree page to define access levels to structure your organization's content."

msgid "SUGGEST_TO_VERIFY"
msgstr "Please verify before continuing."

Expand Down
Binary file modified locale/fr_CA/LC_MESSAGES/django.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions locale/fr_CA/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2616,6 +2616,9 @@ msgstr "Renommer permet aux utilisateurs de modifier le nom du champ sous-jacent
msgid "REVIEW YOUR DATA MAPPINGS"
msgstr "EXAMINER VOS MAPPAGES DE DONNÉES"

msgid "REVIEW_MATCHING_CRITERIA"
msgstr "Vérifiez vos critères de correspondance sur la page Paramètres de colonne avant d'importer des données pour la première fois. Vous ne pourrez pas supprimer des champs des critères de correspondance une fois les données ajoutées à votre organisation."

msgid "Read more here."
msgstr "Lire la suite ici."

Expand Down Expand Up @@ -2964,6 +2967,9 @@ msgstr "ÉTAPE 1: Mappez vos données"
msgid "STEP 2: Review Your Data Mappings"
msgstr "ÉTAPE 2: Consultez vos mappages de données"

msgid "SUB_ORG_DEPRECATION"
msgstr "La fonctionnalité Sous-organisation n’est plus recommandée et sera bientôt obsolète. Visitez la page des niveaux d'accès pour définir les niveaux d'accès afin de structurer le contenu de votre organisation."

#, fuzzy
msgid "SUGGEST_TO_VERIFY"
msgstr "Veuillez vérifier les points suivants avant de continuer."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ angular.module('BE.seed.controller.create_sub_organization_modal', []).controlle
$scope.sub_org = {};
$scope.error_message = '';


$scope.org_id = organization.id;
/**
* creates a sub organization with an owner
*/
Expand Down
17 changes: 16 additions & 1 deletion seed/static/seed/js/controllers/data_upload_modal_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ angular.module('BE.seed.controller.data_upload_modal', []).controller('data_uplo
'uploader_service',
'$state',
'audit_template_service',
'auth_service',
'dataset_service',
'mapping_service',
'matching_service',
'organization_service',
'inventory_service',
'spinner_utility',
'step',
Expand All @@ -54,9 +56,11 @@ angular.module('BE.seed.controller.data_upload_modal', []).controller('data_uplo
uploader_service,
$state,
audit_template_service,
auth_service,
dataset_service,
mapping_service,
matching_service,
organization_service,
inventory_service,
spinner_utility,
step,
Expand Down Expand Up @@ -91,7 +95,18 @@ angular.module('BE.seed.controller.data_upload_modal', []).controller('data_uplo
* newly created data set
* file: the file being upload file.filename is the file's name
*/
$scope.organization = organization;
$scope.organization = organization
// it would be better to resolve these from the calling controller, but
// this modal is multi-purpose and called from all kinds of places
// get full organization payload (to get inventory count)
organization_service.get_organization(organization.id).then((data) => {
$scope.organization = data.organization;
});
// get auth (to display column settings link)
auth_service.is_authorized(organization.id, ['requires_viewer', 'requires_owner']).then((data) => {
$scope.auth = data.auth;
});

$scope.dataset = {
name: '',
disabled() {
Expand Down
2 changes: 2 additions & 0 deletions seed/static/seed/locales/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@
"RENAME_COLUMN_TITLE": "Rename Column",
"RENAME_SYS_LEVEL_COL": "Rename allows users to change the name of the underlying field shown in Column Name \/ Field Name. Renaming a field means that field will be changed in all the data for the organization.",
"REVIEW YOUR DATA MAPPINGS": "REVIEW YOUR DATA MAPPINGS",
"REVIEW_MATCHING_CRITERIA": "Review your matching criteria on the Column Settings page before importing data for the first time. You will not be able to remove fields from the matching criteria after data is added to your organization.",
"Read more here.": "Read more here.",
"Really reset all passwords? This will sign you out of SEED.": "Really reset all passwords? This will sign you out of SEED.",
"Recent Sale Date": "Recent Sale Date",
Expand Down Expand Up @@ -957,6 +958,7 @@
"SHOWING_UNFILTERED_TAXLOTS": "Showing {start} to {end} of {total} tax lots",
"STEP 1: Map Your Data": "STEP 1: Map Your Data",
"STEP 2: Review Your Data Mappings": "STEP 2: Review Your Data Mappings",
"SUB_ORG_DEPRECATION": "The Sub-Organization functionality is no longer recommended and will be deprecated soon. Visit the Access Level Tree page to define access levels to structure your organization's content.",
"SUGGEST_TO_VERIFY": "Please verify before continuing.",
"SUGGEST_UPDATE_GEOCODE_COLS": "Update the geocoding column settings in your organization's column settings page.",
"Salesforce": "Salesforce",
Expand Down
2 changes: 2 additions & 0 deletions seed/static/seed/locales/fr_CA.json
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@
"RENAME_COLUMN_TITLE": "Renommer la Colonne",
"RENAME_SYS_LEVEL_COL": "Renommer permet aux utilisateurs de modifier le nom du champ sous-jacent affiché dans Nom de colonne \/ Nom de champ. Renommer un champ signifie que ce champ sera modifié dans toutes les données de l'organisation.",
"REVIEW YOUR DATA MAPPINGS": "EXAMINER VOS MAPPAGES DE DONNÉES",
"REVIEW_MATCHING_CRITERIA": "Vérifiez vos critères de correspondance sur la page Paramètres de colonne avant d'importer des données pour la première fois. Vous ne pourrez pas supprimer des champs des critères de correspondance une fois les données ajoutées à votre organisation.",
"Read more here.": "Lire la suite ici.",
"Really reset all passwords? This will sign you out of SEED.": "Réinitialiser tous les mots de passe? Cela vous déconnectera de SEED.",
"Recent Sale Date": "Date de vente récente",
Expand Down Expand Up @@ -957,6 +958,7 @@
"SHOWING_UNFILTERED_TAXLOTS": "Affichage {start} à {end} des {total} lots d'impôt en tout",
"STEP 1: Map Your Data": "ÉTAPE 1: Mappez vos données",
"STEP 2: Review Your Data Mappings": "ÉTAPE 2: Consultez vos mappages de données",
"SUB_ORG_DEPRECATION": "La fonctionnalité Sous-organisation n’est plus recommandée et sera bientôt obsolète. Visitez la page des niveaux d'accès pour définir les niveaux d'accès afin de structurer le contenu de votre organisation.",
"SUGGEST_TO_VERIFY": "Veuillez vérifier les points suivants avant de continuer.",
"SUGGEST_UPDATE_GEOCODE_COLS": "Mettez à jour les paramètres de colonne de géocodage dans la page des paramètres de colonne de votre organisation.",
"Salesforce": "Salesforce",
Expand Down
5 changes: 5 additions & 0 deletions seed/static/seed/partials/create_sub_organization_modal.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<div class="modal-header">
<h4 class="modal-title" id="createOrganizationLabel" translate>Create a New Sub-Organization</h4>
</div>
<div class="deprecation-warning">
<i class="fa-solid fa-triangle-exclamation"></i>
<span translate>SUB_ORG_DEPRECATION</span>
<a ui-sref="organization_access_level_tree(::{organization_id: org_id})">Access Level Tree page</a>
</div>
<form class="form-horizontal" role="form" name="sub_org_form" ng-submit="submit_form(sub_org_form.$valid)">
<div class="modal-body">
<div class="form-group" ng-class="{ 'has-error' : sub_org_form.name.$invalid && !sub_org_form.name.$pristine }">
Expand Down
6 changes: 6 additions & 0 deletions seed/static/seed/partials/data_upload_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ <h4 class="modal-title" ng-switch-when="21" translate>Successful upload!</h4>
<div class="alert alert-danger" ng-show="uploader.invalid_extension_alert" translate="INVALID_EXTENSION_ALERT"></div>
<div class="alert alert-danger" ng-show="uploader.invalid_geojson_extension_alert" translate="INVALID_GEOJSON_EXTENSION_ALERT"></div>
<div class="alert alert-danger" ng-show="uploader.invalid_xml_zip_extension_alert" translate="INVALID_XML_ZIP_EXTENSION_ALERT"></div>

<uib-tabset class="modal-tabs">
<uib-tab index="0" heading="{$:: 'Property and Tax Lot Data' | translate $}">
<div class="tab-content-section" ng-hide="uploader.in_progress">
Expand Down Expand Up @@ -77,6 +78,11 @@ <h4 class="modal-title" ng-switch-when="21" translate>Successful upload!</h4>
</div>
</div>
<div class="tab-content-section" ng-hide="uploader.in_progress">
<div class="alert alert-warning" ng-show="organization.inventory_count == 0">
<i class="fa-solid fa-triangle-exclamation"></i>
<span translate>REVIEW_MATCHING_CRITERIA</span>
<a ng-if="auth.requires_owner" target="_blank" ui-sref="organization_column_settings(::{organization_id: organization.id, inventory_type: 'properties'})">Column Settings</a>
</div>
<div class="row">
<div class="col-sm-4">
<p translate>FILE_TYPES_SUPPORTED</p>
Expand Down
5 changes: 5 additions & 0 deletions seed/static/seed/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5427,3 +5427,8 @@ tags-input .tags .tag-item {
.tooltip-long {
word-wrap: break-word;
}

.deprecation-warning {
padding: 10px;
color: #c24e00;
}
16 changes: 15 additions & 1 deletion seed/static/seed/tests/data_upload_modal_controller.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ describe('controller: data_upload_modal_controller', () => {
let data_upload_controller_scope;
let mock_mapping_service; let
mock_matching_service;
let mock_organization_service;
let mock_auth_service;
let global_step = 1;
let global_dataset = {};

Expand Down Expand Up @@ -37,7 +39,7 @@ describe('controller: data_upload_modal_controller', () => {
$httpBackend = _$httpBackend_;
$httpBackend.whenGET(/^\/static\/seed\/locales\/.*\.json/).respond(200, {});
});
inject(($controller, $rootScope, $uibModal, urls, $q, uploader_service, mapping_service, matching_service) => {
inject(($controller, $rootScope, $uibModal, urls, $q, uploader_service, mapping_service, matching_service, organization_service, auth_service) => {
controller = $controller;
data_upload_controller_scope = $rootScope.$new();
modal_state = '';
Expand All @@ -47,6 +49,8 @@ describe('controller: data_upload_modal_controller', () => {
mock_uploader_service = uploader_service;
mock_mapping_service = mapping_service;
mock_matching_service = matching_service;
mock_organization_service = organization_service;
mock_auth_service = auth_service;
spyOn(mock_uploader_service, 'check_progress').andCallFake(() =>
// return $q.reject for error scenario
$q.resolve({
Expand Down Expand Up @@ -106,6 +110,16 @@ describe('controller: data_upload_modal_controller', () => {
status: 'warning',
file_id: 3
}));
spyOn(mock_organization_service, 'get_organization').andCallFake(() =>
// return organization
$q.resolve({
organization: {},
}));
spyOn(mock_auth_service, 'is_authorized').andCallFake(() =>
// return auth
$q.resolve({
auth: {},
}));
});
});

Expand Down

0 comments on commit fee2e13

Please sign in to comment.