From 8150f4062e8dd72a85fec0661fd449a8e69e8fc8 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 7 Sep 2023 14:43:28 +0000 Subject: [PATCH] feat: renamed files and minor fixes --- ui/src/modals/RuleModal.helpers.js | 14 ++++++++ ui/src/modals/RuleModal.vue | 33 ++++++++--------- ui/src/modals/RuleModalInputTab.vue | 4 +-- ...omponent.vue => RuleModalInputTabCard.vue} | 0 ui/src/modals/RuleModalOutputTab.vue | 4 +-- ...ent.vue => RuleModalOutputTabCardBody.vue} | 0 ui/src/modals/ezbidsimporter.vue | 35 ++++++++++--------- 7 files changed, 50 insertions(+), 40 deletions(-) rename ui/src/modals/{RuleModalInputTabInputComponent.vue => RuleModalInputTabCard.vue} (100%) rename ui/src/modals/{RuleModalOutputTabOutputComponent.vue => RuleModalOutputTabCardBody.vue} (100%) diff --git a/ui/src/modals/RuleModal.helpers.js b/ui/src/modals/RuleModal.helpers.js index 6827f6dd..eae8fd1b 100644 --- a/ui/src/modals/RuleModal.helpers.js +++ b/ui/src/modals/RuleModal.helpers.js @@ -34,8 +34,22 @@ function getEmptyIOConfigObj() { } } +// TODO: in the future, we will want to support many more pipelines. What +// is a better implementation of this? +const SUPPORTED_PIPELINES = { + DWI: [ + "5dc1c2e57f55b85a93bd3021", //QSIPrep + "5e9dced9f1745d6994f692c0", //MRTrix3 + "5fe1056057aacd480f2f8e48", // FreeSurfer + "5cc73ef44ed9df00317f6288", // White Matter Anatomy Segmentation + "5cc9eca04b5e4502275edba6", // Remove Tract Outliers + "5ed02b780a8ed88a57482c92" // Tract Analysis Profiles + ] +} + export { removeUndefinedOrNullProperties, composeOutputTag, getEmptyIOConfigObj, + SUPPORTED_PIPELINES } \ No newline at end of file diff --git a/ui/src/modals/RuleModal.vue b/ui/src/modals/RuleModal.vue index 80532d0b..166d9374 100644 --- a/ui/src/modals/RuleModal.vue +++ b/ui/src/modals/RuleModal.vue @@ -52,23 +52,15 @@ import Vue from 'vue' import search_app_mixin from '@/mixins/searchapp' import ReconnectingWebSocket from 'reconnectingwebsocket' -import { getEmptyIOConfigObj, removeUndefinedOrNullProperties, composeOutputTag } from '@/modals/RuleModal.helpers' +import { + getEmptyIOConfigObj, + removeUndefinedOrNullProperties, + composeOutputTag, + SUPPORTED_PIPELINES +} from '@/modals/RuleModal.helpers' const lib = require('@/lib'); -// TODO: in the future, we will want to support many more pipelines. What -// is a better implementation of this? -const SUPPORTED_PIPELINES = { - DWI: [ - "5dc1c2e57f55b85a93bd3021", //QSIPrep - "5e9dced9f1745d6994f692c0", //MRTrix3 - "5fe1056057aacd480f2f8e48", // FreeSurfer - "5cc73ef44ed9df00317f6288", // White Matter Anatomy Segmentation - "5cc9eca04b5e4502275edba6", // Remove Tract Outliers - "5ed02b780a8ed88a57482c92" // Tract Analysis Profiles - ] -} - export default { mixins: [ search_app_mixin ], components: { @@ -149,18 +141,21 @@ export default { _id: undefined, }, { config: this.initializeAppConfigIdsInRuleConfigObj(this.rule.app ? this.rule.app.config : undefined, this.rule.config) }, - opt.rule, + opt.rule, // don't let anything overwrite data passed in via opt.rule ); this.subscribe(); this.$root.$emit('bv::show::modal', 'modal-rule') }); + // this trigger does not actually cause the ruleModal to open. It is simply + // here to create rules for a given pipeline. We do that here so that we have + // access to all the methods for creating a rule this.$root.$on('create_pipeline', async ({ projectId, pipelineName }) => { // check if we support the given pipeline first - const upperCasePipelineName = (pipelineName || '').toLocaleUpperCase(); + const upperCasePipelineName = (pipelineName || '').toLocaleUpperCase(); const pipeline = SUPPORTED_PIPELINES[upperCasePipelineName]; - if (!pipeline) return; + if (!pipeline || !projectId) return; const retrievedApps = await Promise.all(pipeline.map(appId => this.$http.get(`app/${appId}`))); const retrievedAppsData = retrievedApps.map(x => x.data); // dont want all the HTTP info, just the data returned from server @@ -189,7 +184,7 @@ export default { // no need to check and clean up tags as we have not received any input from the user // so everything is controlled and "sterile" app.inputs.forEach((input) => { - if (input.multi) newRule.input_multicount[input.id] = 1; // sane default + if (input.multi) newRule.input_multicount[input.id] = "1"; // sane default }) removeUndefinedOrNullProperties(newRule.input_project_override); @@ -202,8 +197,8 @@ export default { }); const res = await Promise.all(newRules.map((newRule) => this.$http.post(`rule`, newRule))); + console.log(res) this.$notify({ text: `Successfully created DWI Pipeline`, type: 'success' }); - this.$router.push(`/project/${projectId}/pipeline`) }) }, diff --git a/ui/src/modals/RuleModalInputTab.vue b/ui/src/modals/RuleModalInputTab.vue index 779da57d..930fd95c 100644 --- a/ui/src/modals/RuleModalInputTab.vue +++ b/ui/src/modals/RuleModalInputTab.vue @@ -13,7 +13,7 @@

The rule handler will look for subjects that contain the following inputs.

- import('@/components/tageditor'), DataTypeTag: () => import('@/components/datatypetag'), ProjectSelector: () => import('@/components/projectselector'), - RuleModalInputTabInputComponent: () => import('@/modals/RuleModalInputTabInputComponent') + RuleModalInputTabCard: () => import('@/modals/RuleModalInputTabCard') }, emits: [ 'update:rule-subject-match', diff --git a/ui/src/modals/RuleModalInputTabInputComponent.vue b/ui/src/modals/RuleModalInputTabCard.vue similarity index 100% rename from ui/src/modals/RuleModalInputTabInputComponent.vue rename to ui/src/modals/RuleModalInputTabCard.vue diff --git a/ui/src/modals/RuleModalOutputTab.vue b/ui/src/modals/RuleModalOutputTab.vue index e2752945..60bd6e7b 100644 --- a/ui/src/modals/RuleModalOutputTab.vue +++ b/ui/src/modals/RuleModalOutputTab.vue @@ -7,7 +7,7 @@

{{output.desc}}

- import('@/components/datatypetag'), - RuleModalOutputTabOutputComponent: () => import('@/modals/RuleModalOutputTabOutputComponent'), + RuleModalOutputTabCardBody: () => import('@/modals/RuleModalOutputTabCardBody'), }, props: { project: String, diff --git a/ui/src/modals/RuleModalOutputTabOutputComponent.vue b/ui/src/modals/RuleModalOutputTabCardBody.vue similarity index 100% rename from ui/src/modals/RuleModalOutputTabOutputComponent.vue rename to ui/src/modals/RuleModalOutputTabCardBody.vue diff --git a/ui/src/modals/ezbidsimporter.vue b/ui/src/modals/ezbidsimporter.vue index c64d1680..db1f9db0 100644 --- a/ui/src/modals/ezbidsimporter.vue +++ b/ui/src/modals/ezbidsimporter.vue @@ -2,7 +2,7 @@
- ezBIDS Session ID + ezBIDS Session ID
@@ -112,11 +112,12 @@ export default { this.task = null; //load finalized ezbids content - this.$http.get(Vue.config.ezbids_api+"/download/"+this.sessionId+"/finalized.json").then(res=>{ + this.$http.get(Vue.config.ezbids_api+"/download/"+this.sessionId+"/finalized.json").then((res) => { this.ezBIDS = res.data; this.project_name = this.ezBIDS.datasetDescription.Name; this.project_desc = this.ezBIDS.readme; - }).catch(err=>{ + }).catch((err) => { + console.error(err); this.$notify({type: 'error', text: "Failed to load the specified ezBIDS session. Please contact brainlife.io team"}); this.close(); }); @@ -129,12 +130,12 @@ export default { service: "brainlife/app-bids-import", }) }, - }).then(res=>{ + }).then((res) => { if(res.data.tasks.length != 0) { this.task = res.data.tasks[res.data.tasks.length-1]; this.subscribeTask(this.task); } - }).catch(err=>{ + }).catch((err) => { console.error(err); this.$notify({type: 'error', text: err.body.message}); }); @@ -159,10 +160,14 @@ export default { this.$http.post('project', { name: this.project_name, desc: this.project_desc, - }).then(res=>{ + }).then((res) => { this.project = res.data._id; + if (this.pipelineName) { + console.log('EMIT', this.project, this.pipelineName) + this.$root.$emit("create_pipeline", { projectId: this.project, pipelineName: this.pipelineName }) + } this.$root.$emit("refresh_jwt", this.submit_import); - }).catch(err=>{ + }).catch((err) => { console.error(err); this.$notify({type: "error", text: err.response.data.message}); }); @@ -183,14 +188,10 @@ export default { jwt: Vue.config.jwt, } } - this.$http.post(Vue.config.amaretti_api+'/task', params).then(res=>{ + this.$http.post(Vue.config.amaretti_api+'/task', params).then((res) => { this.task = res.data.task; this.subscribeTask(this.task); - if (this.pipelineName) { - this.$root.$emit("create_pipeline", { projectId: this.project, pipelineName: this.pipelineName }) - } - this.close(); - }).catch(err=>{ + }).catch((err) => { console.error(err); this.$notify({type: 'error', text: err.body.message}); }); @@ -209,10 +210,10 @@ export default { this.$http.post(Vue.config.amaretti_api+'/instance', { name, group_id: this.project.group_id, - }).then(res=>{ + }).then((res) => { const instance = res.data; return cb(null, instance); - }).catch(err=>{ + }).catch((err) => { console.error(err); }); }); @@ -244,11 +245,11 @@ export default { cancelImport() { this.$http.put(Vue.config.amaretti_api+'/task/stop/'+this.task._id) - .then(res=>{ + .then((res) => { this.$notify({ text: res.data.message, type: 'success'}); this.close(); }) - .catch(err=>{ + .catch((err) => { console.error(err); }); },