-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathform-replacing.vue
63 lines (61 loc) · 1.76 KB
/
form-replacing.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<template>
<div class="morph-form-replacing">
<collab-form-component
v-on:collabSelected="collabSelected"
v-on:collabCreated="createNewCollab"
:isLoading="isLoading">
</collab-form-component>
<div class="error">
{{ errorMessage }}
</div>
</div>
</template>
<script>
import createCollab from '@/mixins/createCollab';
import collabFormComponent from '@/components/collab-form-component.vue';
export default {
name: 'collabFormReplacing',
data() {
return {
isLoading: false,
errorMessage: '',
findString: 'REPLACE_STRIATAL_MODEL_HERE',
replaceText: this.folder_name,
uc_name: 'optimizeastriatalfast-spikinginterneuron',
};
},
components: {
'collab-form-component': collabFormComponent,
},
props: ['folder_name'],
mixins: [createCollab], // use common functions
methods: {
collabSelected(collab) {
const that = this;
this.errorMessage = '';
this.isLoading = true;
this.createItemInExistingCollabWithReplace(collab, this.uc_name, this.replaceText, this.findString)
.catch((error) => {
that.errorMessage = error.message;
})
.finally(() => {
that.isLoading = false;
});
this.sendStatistics(collab.id, this.uc_name, this.folder_name, false);
},
createNewCollab(collab) {
const that = this;
this.errorMessage = '';
this.isLoading = true;
this.createItemInExistingCollabWithReplace(collab, this.uc_name, this.replaceText, this.findString)
.catch((error) => {
that.errorMessage = error.message;
})
.finally(() => {
that.isLoading = false;
});
this.sendStatistics(collab.id, this.uc_name, this.folder_name, true);
},
},
};
</script>