1
1
<template >
2
2
<div class =" wizard-tab-content" >
3
- <WizardTab :pos =" 0" :parent =" parent" title =" Parameters" :beforeChange =" checkRequirements" >
3
+ <WizardTab v-if =" !noProcessSelection" :pos =" tabPos[0]" :parent =" parent" title =" Process" :beforeChange =" checkProcessRequirements" >
4
+ <ChooseUserDefinedProcess :value =" process" :namespace =" processNamespace" @input =" submitProcess" />
5
+ </WizardTab >
6
+ <WizardTab :pos =" tabPos[1]" :parent =" parent" title =" Parameters" :beforeChange =" checkParameterRequirements" >
4
7
<ChooseProcessParameters v-if =" processSpec" v-model =" args" :process =" processSpec" />
5
8
<p class =" center" v-else-if =" loading" ><i class =" fas fa-spinner fa-spin" ></i > Loading process...</p >
6
9
<p v-else >Process not available.</p >
7
10
</WizardTab >
8
- <WizardTab :pos =" 1 " :parent =" parent" title =" Finish" >
11
+ <WizardTab :pos =" tabPos[2] " :parent =" parent" title =" Finish" >
9
12
<ChooseProcessingMode v-model =" mode" :title.sync =" jobTitle" />
10
13
</WizardTab >
11
14
</div >
14
17
<script >
15
18
import ChooseProcessingMode from ' ./tabs/ChooseProcessingMode.vue' ;
16
19
import ChooseProcessParameters from ' ./tabs/ChooseProcessParameters.vue' ;
20
+ import ChooseUserDefinedProcess from ' ./tabs/ChooseUserDefinedProcess.vue' ;
17
21
import WizardMixin from ' ./WizardMixin' ;
18
22
import Utils from ' ../../utils' ;
19
23
import { ProcessGraph } from ' @openeo/js-processgraphs' ;
@@ -24,21 +28,32 @@ export default {
24
28
WizardMixin
25
29
],
26
30
components: {
31
+ ChooseUserDefinedProcess,
27
32
ChooseProcessingMode,
28
33
ChooseProcessParameters
29
34
},
30
35
data () {
31
36
return {
32
- loading: true ,
37
+ loading: false ,
38
+ noProcessSelection: false ,
33
39
process: null ,
34
40
processSpec: null ,
41
+ processNamespace: ' user' ,
35
42
args: {},
36
43
jobTitle: " " ,
37
44
mode: " " ,
38
45
};
39
46
},
40
47
computed: {
41
48
... Utils .mapGetters ([' processes' ]),
49
+ tabPos () {
50
+ if (this .noProcessSelection ) {
51
+ return [null , 0 , 1 ];
52
+ }
53
+ else {
54
+ return [0 , 1 , 2 ];
55
+ }
56
+ },
42
57
graph () {
43
58
if (! this .process || ! this .processSpec ) {
44
59
return null ;
@@ -58,27 +73,47 @@ export default {
58
73
}
59
74
},
60
75
async beforeMount () {
61
- this .loading = true ;
62
- if ( typeof this . process !== ' string ' || this .process . length === 0 ) {
63
- this .$emit ( ' close ' , ` Sorry, no process specified. ` ) ;
64
- return ;
65
- }
66
- let [id, namespace] = Utils . extractUDPParams ( this . process ) ;
67
- try {
68
- this . processSpec = await this .loadProcess ({id, namespace} );
69
- if (this . processSpec ) {
70
- this .jobTitle = this . processSpec . id ;
76
+ if ( typeof this .process === ' string ' && this . process . length > 0 ) {
77
+ const [ id , ns ] = Utils . extractUDPParams ( this .process );
78
+ this .noProcessSelection = true ;
79
+ this . process = id ;
80
+ if (ns) {
81
+ this . processNamespace = ns ;
82
+ }
83
+ let loaded = await this .checkProcessRequirements ( );
84
+ if (! loaded ) {
85
+ this .$emit ( ' close ' , ` Sorry, the wizard can't load the requested process. ` ) ;
71
86
}
72
- } catch (error) {
73
- console .warn (error);
74
- this .$emit (' close' , ` Sorry, the wizard can't load the requested process.` );
75
- } finally {
76
- this .loading = false ;
77
87
}
78
88
},
79
89
methods: {
80
90
... Utils .mapActions ([' loadProcess' ]),
81
- checkRequirements () {
91
+ submitProcess (item ) {
92
+ this .process = item .id ;
93
+ if (item .namespace ) {
94
+ this .processNamespace = item .namespace ;
95
+ }
96
+ this .parent .nextTab ();
97
+ },
98
+ async checkProcessRequirements () {
99
+ this .loading = true ;
100
+ try {
101
+ this .processSpec = await this .loadProcess ({
102
+ id: this .process ,
103
+ namespace: this .processNamespace
104
+ });
105
+ this .loading = false ;
106
+ if (this .processSpec ) {
107
+ this .jobTitle = this .processSpec .id ;
108
+ }
109
+ return true ;
110
+ } catch (error) {
111
+ this .loading = false ;
112
+ console .warn (error);
113
+ return false ;
114
+ }
115
+ },
116
+ checkParameterRequirements () {
82
117
if (this .graph ) {
83
118
var pg = new ProcessGraph (this .graph , this .processes );
84
119
return pg .validate ();
0 commit comments