From 042bf8c707c09fd24bc136811167c2f406efda4b Mon Sep 17 00:00:00 2001 From: Norman Hooper Date: Fri, 28 Jun 2024 03:29:14 +0100 Subject: [PATCH] Reset save button on loading case properties --- .../static/data_dictionary/js/data_dictionary.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/corehq/apps/data_dictionary/static/data_dictionary/js/data_dictionary.js b/corehq/apps/data_dictionary/static/data_dictionary/js/data_dictionary.js index 7420f2f23287..dfae94f6c74a 100644 --- a/corehq/apps/data_dictionary/static/data_dictionary/js/data_dictionary.js +++ b/corehq/apps/data_dictionary/static/data_dictionary/js/data_dictionary.js @@ -32,6 +32,7 @@ hqDefine("data_dictionary/js/data_dictionary", [ geoCaseProp, isSafeToDelete, changeSaveButton, + resetSaveButton, dataUrl ) { var self = {}; @@ -44,6 +45,7 @@ hqDefine("data_dictionary/js/data_dictionary", [ self.geoCaseProp = geoCaseProp; self.canDelete = isSafeToDelete; self.changeSaveButton = changeSaveButton; + self.resetSaveButton = resetSaveButton; self.dataUrl = dataUrl; self.fetchCaseProperties = function () { @@ -56,6 +58,7 @@ hqDefine("data_dictionary/js/data_dictionary", [ const recurseChunks = function (nextUrl) { $.getJSON(nextUrl, function (data) { setCaseProperties(data.groups); + self.resetSaveButton(); nextUrl = data._links.next; if (nextUrl) { recurseChunks(nextUrl); @@ -369,6 +372,10 @@ hqDefine("data_dictionary/js/data_dictionary", [ self.saveButton.fire('change'); }; + const resetSaveButton = function () { + self.saveButton.setState('saved'); + } + self.init = function (callback) { // Get list of case types $.getJSON(dataUrl, {load_deprecated_case_types: self.showDeprecatedCaseTypes()}) @@ -382,6 +389,7 @@ hqDefine("data_dictionary/js/data_dictionary", [ data.geo_case_property, caseTypeData.is_safe_to_delete, changeSaveButton, + resetSaveButton, dataUrl ); self.caseTypes.push(caseTypeObj);