Skip to content

Commit

Permalink
nit #6940
Browse files Browse the repository at this point in the history
  • Loading branch information
chrabyrd committed Jan 22, 2021
1 parent 14b38d3 commit 61e3cbf
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ define([
sectionTitle: sectionTitle,
componentConfigs: componentConfigs,
};
};
}

function ComponentConfig(componentConfig) {
var componentConfig = ko.toJS(componentConfig);
var parsedComponentConfig = ko.toJS(componentConfig);

return {
required: ko.observable(componentConfig.required),
uniqueInstanceName: ko.observable(componentConfig.uniqueInstanceName),
componentName: ko.observable(componentConfig.componentName),
parameters: ko.observable(componentConfig.parameters),
value: ko.mapping.fromJS(componentConfig.value), /* mapping all values to observables */
required: ko.observable(parsedComponentConfig.required),
uniqueInstanceName: ko.observable(parsedComponentConfig.uniqueInstanceName),
componentName: ko.observable(parsedComponentConfig.componentName),
parameters: ko.observable(parsedComponentConfig.parameters),
value: ko.mapping.fromJS(parsedComponentConfig.value), /* mapping all values to observables */
};
};
}

function viewModel(params) {
var self = this;
Expand Down Expand Up @@ -58,16 +58,16 @@ define([

var hasAllRequiredComponentData = function(requiredComponentData) {
return Object.values(requiredComponentData).reduce(function(acc, value) {
if (!value()) { acc = false }
if (!value()) { acc = false; }
return acc;
}, true);
};

ko.toJS(layoutSections).forEach(function(layoutSection) {
var section = new Section(layoutSection.sectionTitle)
var section = new Section(layoutSection.sectionTitle);

layoutSection.componentConfigs.forEach(function(componentConfig) {
var componentConfig = new ComponentConfig(componentConfig);
layoutSection.componentConfigs.forEach(function(componentConfigData) {
var componentConfig = new ComponentConfig(componentConfigData);

/* save value on update */
componentConfig.value.subscribe(function() {
Expand Down Expand Up @@ -114,7 +114,7 @@ define([
**/
var wastebin;
if (ko.unwrap(params.wastebin)) {
wastebin = koMapping.toJS(params.wastebin)
wastebin = koMapping.toJS(params.wastebin);
}

return {
Expand All @@ -124,7 +124,7 @@ define([
};

this.initialize();
};
}

ko.components.register('component-based-step', {
viewModel: viewModel,
Expand Down

0 comments on commit 61e3cbf

Please sign in to comment.