From dafe18707c046b7443402fb97f27421426316ffc Mon Sep 17 00:00:00 2001 From: Minsun Date: Thu, 4 Feb 2021 22:57:48 -0500 Subject: [PATCH 1/2] wizardletSection --- src/foam/u2/wizard/WizardletSection.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/foam/u2/wizard/WizardletSection.js b/src/foam/u2/wizard/WizardletSection.js index aced2db4f53..03ca9fb0415 100644 --- a/src/foam/u2/wizard/WizardletSection.js +++ b/src/foam/u2/wizard/WizardletSection.js @@ -53,7 +53,6 @@ foam.CLASS({ name: 'isValid', class: 'Boolean', expression: function (wizardlet$of, data, data$errors_) { - if ( ! wizardlet$of ) return true; if ( ! data ) return false; let sectionErrors = []; From 26f4d454ea155f3d68eed6ede7aac474bb03eb02 Mon Sep 17 00:00:00 2001 From: Minsun Date: Fri, 5 Feb 2021 14:54:56 -0500 Subject: [PATCH 2/2] temp --- .../crunch/FlatteningCapabilityWizardlet.js | 21 +++++++++++++++++++ src/foam/u2/wizard/WizardletSection.js | 1 + 2 files changed, 22 insertions(+) diff --git a/src/foam/u2/crunch/FlatteningCapabilityWizardlet.js b/src/foam/u2/crunch/FlatteningCapabilityWizardlet.js index 8f278d904df..b164dfe065e 100644 --- a/src/foam/u2/crunch/FlatteningCapabilityWizardlet.js +++ b/src/foam/u2/crunch/FlatteningCapabilityWizardlet.js @@ -47,9 +47,30 @@ foam.CLASS({ : prereqSections.concat(sections); } }, + { + name: 'isValid', + class: 'Boolean', + expression: function (of, data, delegates, data$errors_) { + if ( ! this.of ) return true; + for ( let wizardlet of delegates ) { + if ( ! wizardlet.isValid ) return false; + } + if ( data$errors_ && data$errors_.length > 0 ) { + return false; + } + return true; + } + } ], methods: [ + function init() { + foam.core.ArraySlot.create({ + slots: this.delegates.map(wizardlet => wizardlet.isValid$) + }).sub(() => { + this.propertyChange.pub('data', this.data); + }); + }, function addPrerequisite(wizardlet) { // Add prerequisite to delegate wizardlets this.delegates.push(wizardlet); diff --git a/src/foam/u2/wizard/WizardletSection.js b/src/foam/u2/wizard/WizardletSection.js index 03ca9fb0415..aced2db4f53 100644 --- a/src/foam/u2/wizard/WizardletSection.js +++ b/src/foam/u2/wizard/WizardletSection.js @@ -53,6 +53,7 @@ foam.CLASS({ name: 'isValid', class: 'Boolean', expression: function (wizardlet$of, data, data$errors_) { + if ( ! wizardlet$of ) return true; if ( ! data ) return false; let sectionErrors = [];