Skip to content

Fix the deletion of WRC created variables. #137

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

Merged
merged 1 commit into from
Jun 6, 2022
Merged
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
21 changes: 15 additions & 6 deletions webui/src/js/viewModels/model-design-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ function(accUtils, i18n, ko, project, urlCatalog, viewHelper, wktLogger, ViewMod
fileContents: this.project.wdtModel.modelContent()
};

if (!providerOptions.fileContents) {
const modelTemplates = this.designer.getProperty('modelTemplate');
providerOptions.fileContents = modelTemplates.domain;
}

// A name is needed to create a WDT Model File provider.
//
providerOptions['name'] = this.project.wdtModel.getDefaultModelFile();
Expand Down Expand Up @@ -174,7 +169,21 @@ function(accUtils, i18n, ko, project, urlCatalog, viewHelper, wktLogger, ViewMod
wktLogger.debug('Received changesAutoDownloaded event with modelContent = %s', event.detail.value);
this.wrcBackendTriggerChange = true;
this.project.wdtModel.modelContent(event.detail.value);
if (event.detail.properties) this.project.wdtModel.getModelPropertiesObject().observable(event.detail.properties);
if (event.detail.properties) {
const existingProperties = this.project.wdtModel.getModelPropertiesObject().observable();
event.detail.properties.forEach((item) => {
const index = existingProperties.map(item1 => item1.uid).indexOf(item.uid);
if (index === -1) {
// Must call addNewItem() in order to get remove() function added
this.project.wdtModel.getModelPropertiesObject().addNewItem({uid: item.uid, Name: item.Name, Value: item.Value});
}
else {
// Update existing properties with data from "Design View"
existingProperties[index].Name = item.Name;
existingProperties[index].Value = item.Value;
}
});
}
};

this.archiveUpdated = (event) => {
Expand Down