Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

save changes prompt #4905

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions seed/static/seed/js/controllers/column_mappings_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ angular.module('SEED.controller.column_mappings', []).controller('column_mapping
'inventory_service',
'mappable_property_columns_payload',
'mappable_taxlot_columns_payload',
'modified_service',
'organization_payload',
'urls',
'COLUMN_MAPPING_PROFILE_TYPE_NORMAL',
Expand All @@ -32,6 +33,7 @@ angular.module('SEED.controller.column_mappings', []).controller('column_mapping
inventory_service,
mappable_property_columns_payload,
mappable_taxlot_columns_payload,
modified_service,
organization_payload,
urls,
COLUMN_MAPPING_PROFILE_TYPE_NORMAL,
Expand Down Expand Up @@ -88,6 +90,9 @@ angular.module('SEED.controller.column_mappings', []).controller('column_mapping

$scope.current_profile = $scope.profiles[0] ?? {};
$scope.dropdown_selected_profile = $scope.current_profile;
$scope.$watch('dropdown_selected_profile.mappings', (a, b) => {
if (a !== b && !$scope.saved) modified_service.setModified();
}, true);

// Inventory Types
$scope.setAllFields = '';
Expand Down Expand Up @@ -257,6 +262,8 @@ angular.module('SEED.controller.column_mappings', []).controller('column_mapping

$scope.changes_possible = false;
Notification.primary(`Saved ${$scope.current_profile.name}`);
modified_service.resetModified();
$scope.saved = true;
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ angular.module('SEED.controller.organization_settings', []).controller('organiza
'auth_payload',
'property_columns',
'analyses_service',
'modified_service',
'organization_service',
'salesforce_mapping_service',
'salesforce_config_service',
Expand All @@ -35,6 +36,7 @@ angular.module('SEED.controller.organization_settings', []).controller('organiza
auth_payload,
property_columns,
analyses_service,
modified_service,
organization_service,
salesforce_mapping_service,
salesforce_config_service,
Expand All @@ -50,6 +52,8 @@ angular.module('SEED.controller.organization_settings', []).controller('organiza
) {
$scope.org = organization_payload.organization;

$scope.$watch('org', (a, b) => (a !== b ? modified_service.setModified() : null), true);

$scope.conf = {};
if (salesforce_configs_payload.length > 0) {
$scope.conf = salesforce_configs_payload[0];
Expand Down Expand Up @@ -360,6 +364,7 @@ angular.module('SEED.controller.organization_settings', []).controller('organiza
default_reports_y_axis_options: $scope.selected_y_columns
})
.then(() => {
modified_service.resetModified();
$scope.settings_updated = true;
$scope.org_static = angular.copy($scope.org);
$scope.$emit('organization_list_updated');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ angular.module('SEED.controller.two_factor_profile', []).controller('two_factor_
'$scope',
'$uibModal',
'urls',
'modified_service',
'Notification',
'two_factor_service',
'user_service',
Expand All @@ -18,6 +19,7 @@ angular.module('SEED.controller.two_factor_profile', []).controller('two_factor_
$scope,
$uibModal,
urls,
modified_service,
Notification,
two_factor_service,
user_service,
Expand All @@ -31,6 +33,8 @@ angular.module('SEED.controller.two_factor_profile', []).controller('two_factor_
$scope.orgs_require_2fa = $scope.organizations.filter((org) => org.require_2fa).map((org) => org.name).join(', ');
$scope.user = user_profile_payload;
$scope.temp_user = { ...$scope.user };
$scope.$watch('temp_user', (a, b) => (a !== b ? modified_service.setModified() : null), true);

$scope.settings_unchanged = () => _.isEqual($scope.temp_user, $scope.user);

const email = $scope.user.email;
Expand Down Expand Up @@ -58,6 +62,7 @@ angular.module('SEED.controller.two_factor_profile', []).controller('two_factor_
// refetch user payload
user_service.get_user_profile().then((user) => {
$scope.user = user;
modified_service.resetModified();
if (response.qr_code) {
$scope.qr_code_img = `data:image/png;base64,${response.qr_code}`;
open_qr_code_scan_modal();
Expand Down