Skip to content

Commit

Permalink
feat: renamed files and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Sep 7, 2023
1 parent f9dac24 commit 8150f40
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 40 deletions.
14 changes: 14 additions & 0 deletions ui/src/modals/RuleModal.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
33 changes: 14 additions & 19 deletions ui/src/modals/RuleModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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`)
})
},
Expand Down
4 changes: 2 additions & 2 deletions ui/src/modals/RuleModalInputTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</b-form-group>

<p class="text-muted">The rule handler will look for subjects that <b>contain</b> the following inputs.</p>
<RuleModalInputTabInputComponent v-for="input in ruleApp.inputs" :key="input._id"
<RuleModalInputTabCard v-for="input in ruleApp.inputs" :key="input._id"
:project="project"
:input="input"
:rule-session-match="sessionMatch"
Expand Down Expand Up @@ -43,7 +43,7 @@ export default {
TagEditor: () => import('@/components/tageditor'),
DataTypeTag: () => import('@/components/datatypetag'),
ProjectSelector: () => import('@/components/projectselector'),
RuleModalInputTabInputComponent: () => import('@/modals/RuleModalInputTabInputComponent')
RuleModalInputTabCard: () => import('@/modals/RuleModalInputTabCard')
},
emits: [
'update:rule-subject-match',
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions ui/src/modals/RuleModalOutputTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<DataTypeTag :datatype="output.datatype" :tags="output.datatype_tags"/>
<p v-if="output.desc" style="margin-bottom: 0px;"><small>{{output.desc}}</small></p>
</div>
<RuleModalOutputTabOutputComponent
<RuleModalOutputTabCardBody
:project="project"
:output="output"
:archive="archive[output.id]"
Expand All @@ -22,7 +22,7 @@
export default {
components: {
DataTypeTag: () => import('@/components/datatypetag'),
RuleModalOutputTabOutputComponent: () => import('@/modals/RuleModalOutputTabOutputComponent'),
RuleModalOutputTabCardBody: () => import('@/modals/RuleModalOutputTabCardBody'),
},
props: {
project: String,
Expand Down
35 changes: 18 additions & 17 deletions ui/src/modals/ezbidsimporter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<b-modal :no-close-on-backdrop="true" title="Import ezBIDS Dataset" ref="modal" size="lg" @ok="submit">
<div v-if="!task">
<b-row>
<b-col class="text-muted" cols="3">ezBIDS Session ID</b-col>
<b-col class="text-muted" cols="3">ezBIDS Session ID</b-col>
<b-col>
<b-form-input v-model="sessionId" readonly></b-form-input>
<br>
Expand Down Expand Up @@ -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();
});
Expand All @@ -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});
});
Expand All @@ -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});
});
Expand All @@ -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});
});
Expand All @@ -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);
});
});
Expand Down Expand Up @@ -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);
});
},
Expand Down

0 comments on commit 8150f40

Please sign in to comment.