@@ -56,20 +56,35 @@ function operationBtnColor(index) {
56
56
async function pollOperationCompletion (operationID ) {
57
57
const url = store .datalabApiBaseUrl + ' datasessions/' + props .session_id + ' /operations/' + operationID + ' /'
58
58
59
- const updateOperationPercentages = (response ) => {
60
- if (response && response .percent_completion !== undefined && response .status != ' COMPLETED' ) {
61
- operationPercentages .value [operationID] = response .percent_completion * DEC_TO_PERCENT
62
- } else {
63
- operationPercentages .value [operationID] = COMPLETE_PERCENT
64
- emit (' operationCompleted' , response)
65
- if (operationID in operationPollingTimers) {
66
- clearInterval (operationPollingTimers[operationID])
67
- setTimeout (clearPollingData (operationID), POLL_WAIT_TIME )
59
+ const updateOperationStatus = (response ) => {
60
+ if (response){
61
+ const operationStatus = response .status
62
+ const percentCompletion = response .percent_completion
63
+
64
+ switch (operationStatus){
65
+ case ' PENDING' :
66
+ break
67
+ case ' IN_PROGRESS' :
68
+ operationPercentages .value [operationID] = percentCompletion * DEC_TO_PERCENT
69
+ break
70
+ case ' COMPLETED' :
71
+ operationPercentages .value [operationID] = COMPLETE_PERCENT
72
+ emit (' operationCompleted' , response)
73
+ if (operationID in operationPollingTimers) {
74
+ clearInterval (operationPollingTimers[operationID])
75
+ setTimeout (clearPollingData (operationID), POLL_WAIT_TIME )
76
+ }
77
+ break
78
+ default :
79
+ console .error (' Unknown Operation Status:' , operationStatus)
68
80
}
69
81
}
82
+ else {
83
+ console .error (' No response on status for operation:' , operationID)
84
+ }
70
85
}
71
86
72
- await fetchApiCall ({ url: url, method: ' GET' , successCallback: updateOperationPercentages , failCallback: handleError })
87
+ await fetchApiCall ({ url: url, method: ' GET' , successCallback: updateOperationStatus , failCallback: handleError })
73
88
}
74
89
75
90
function clearPollingData (operationID ) {
@@ -118,20 +133,44 @@ onBeforeUnmount(() => {
118
133
<h3 class =" operations" >
119
134
OPERATIONS
120
135
</h3 >
121
- <v-divider class =" mb-6" />
122
- <v-row v-for =" (operation, index) in operations" :key =" operation.id" align =" center" justify =" center" class =" mb-2" >
123
- <v-btn :class =" operationBtnColor(index)" variant =" outlined" class =" operation_button" @click =" selectOperation(index)" >
136
+ <v-row
137
+ v-for =" (operation, index) in operations"
138
+ :key =" operation.id"
139
+ align =" center"
140
+ justify =" center"
141
+ class =" operation mb-2"
142
+ >
143
+ <v-btn
144
+ :class =" operationBtnColor(index)"
145
+ variant =" outlined"
146
+ class =" operation_button"
147
+ @click =" selectOperation(index)"
148
+ >
124
149
{{ index }}: {{ operation.name }}
125
150
</v-btn >
126
- <v-progress-linear v-if =" operationPercentages[operation.id] !== undefined" class =" operation_completion"
127
- :model-value =" operationPercentages[operation.id]" :height =" 5" />
151
+ <v-progress-linear
152
+ v-if =" operationPercentages[operation.id] !== undefined"
153
+ class =" operation_completion"
154
+ :model-value =" operationPercentages[operation.id]"
155
+ :height =" 5"
156
+ />
128
157
</v-row >
129
- <v-divider class =" mb-4 mt-4" />
130
- <v-btn variant =" flat" class =" addop_button" >
158
+ <v-btn
159
+ variant =" flat"
160
+ class =" addop_button"
161
+ >
131
162
Add Operation
132
- <v-dialog v-model =" showWizardDialog" activator =" parent" fullscreen transition =" dialog-bottom-transition" >
133
- <operation-wizard :images =" images" @close-wizard =" showWizardDialog = false"
134
- @add-operation =" emit('addOperation', $event); showWizardDialog = false;" />
163
+ <v-dialog
164
+ v-model =" showWizardDialog"
165
+ activator =" parent"
166
+ fullscreen
167
+ transition =" dialog-bottom-transition"
168
+ >
169
+ <operation-wizard
170
+ :images =" images"
171
+ @close-wizard =" showWizardDialog = false"
172
+ @add-operation =" emit('addOperation', $event); showWizardDialog = false;"
173
+ />
135
174
</v-dialog >
136
175
</v-btn >
137
176
</template >
@@ -143,6 +182,10 @@ onBeforeUnmount(() => {
143
182
font-size : 2rem ;
144
183
}
145
184
185
+ .operation {
186
+ margin-top : 1rem ;
187
+ }
188
+
146
189
.addop_button {
147
190
width : 16rem ;
148
191
height : 4rem ;
@@ -151,6 +194,7 @@ onBeforeUnmount(() => {
151
194
background-color : var (--light-blue );
152
195
font-weight : 700 ;
153
196
color : white ;
197
+ margin-top : 1rem ;
154
198
}
155
199
156
200
.operation_button {
0 commit comments