|
78 | 78 | xml: '',
|
79 | 79 | svg: '',
|
80 | 80 | first: ''
|
81 |
| - } |
| 81 | + }, |
| 82 | + oldFlow: {} |
82 | 83 | }
|
83 | 84 | },
|
84 | 85 | methods: {
|
|
229 | 230 | subscriptionNew.moduleResource.registerAppModule = registerAppModuleNew
|
230 | 231 | subscriptionNew.moduleResource.appRoles = userRolesArr
|
231 | 232 | subscriptionNew.registeredAppModulesRole().then(resp => {
|
232 |
| - let result = null |
| 233 | + // let result = null |
233 | 234 | if (this.$route.params.id !== undefined) {
|
234 |
| - result = flowz.put(this.$route.params.id, this.flowObject) |
| 235 | + // if (this.flowObject.schema === this.oldFlow.schema) { |
| 236 | + // console.log('...........') |
| 237 | + // } else { |
| 238 | + // this.$Notice.warning({title: 'You\'ve change schema of <b>' + this.flowObject.name + '</b>', desc: '<a>Click Here</a> Set permissions', duration: 0}) |
| 239 | + // } |
| 240 | + // this.btnLoading = false |
| 241 | + flowz.put(this.$route.params.id, this.flowObject).then(response => { |
| 242 | + this.$Notice.success({title: 'Success..!', desc: 'Flow Updated..'}) |
| 243 | + this.$router.push({name: 'flow/list'}) |
| 244 | + localStorage.removeItem('BPMNXml') |
| 245 | + this.btnLoading = false |
| 246 | + }).catch(error => { |
| 247 | + console.log(error) |
| 248 | + this.$Notice.error({title: 'Error..!', desc: 'Flow Not Updated...'}) |
| 249 | + this.btnLoading = false |
| 250 | + }) |
235 | 251 | } else {
|
236 |
| - result = flowz.post(this.flowObject) |
| 252 | + flowz.post(this.flowObject).then(response => { |
| 253 | + this.$Notice.success({title: 'Success..!', desc: 'Flow Saved..'}) |
| 254 | + this.$router.push({name: 'flow/list'}) |
| 255 | + localStorage.removeItem('BPMNXml') |
| 256 | + this.btnLoading = false |
| 257 | + }).catch(error => { |
| 258 | + console.log(error) |
| 259 | + this.$Notice.error({title: 'Error..!', desc: 'Flow Not Saved...'}) |
| 260 | + this.btnLoading = false |
| 261 | + }) |
237 | 262 | }
|
238 |
| - result.then(response => { |
239 |
| - this.$Notice.success({title: 'Success..!', desc: 'Flow Saved..'}) |
240 |
| - this.$router.push({name: 'flow/list'}) |
241 |
| - localStorage.removeItem('BPMNXml') |
242 |
| - this.btnLoading = false |
243 |
| - }).catch(error => { |
244 |
| - console.log(error) |
245 |
| - this.$Notice.error({title: 'Error..!', desc: 'Flow Not Saved...'}) |
246 |
| - this.btnLoading = false |
247 |
| - }) |
248 | 263 | }).catch(err => {
|
249 | 264 | this.$Notice.error({title: 'Error..!', desc: 'Flow Not Saved. Try again.'})
|
250 | 265 | console.log('Error: ', err)
|
|
387 | 402 | Promise.all(this.processVar).then(async (response) => {
|
388 | 403 | if (this.$route.params.id !== undefined) {
|
389 | 404 | this.bpmnXML = flowz.get(this.$route.params.id).then(async (result) => {
|
| 405 | + this.oldFlow = result.data |
390 | 406 | this.bpmnXML = result.data.xml
|
391 |
| - await this.initBPMN({ |
| 407 | + this.initBPMN({ |
392 | 408 | userId: this.$store.state.user._id,
|
393 | 409 | emailTemplate: tempVar,
|
394 | 410 | cdata: result.data,
|
|
405 | 421 | }) // Create bpmn
|
406 | 422 | })
|
407 | 423 | } else {
|
408 |
| - await this.initBPMN({ |
| 424 | + this.initBPMN({ |
409 | 425 | userId: this.$store.state.user._id,
|
410 | 426 | emailTemplate: tempVar,
|
411 | 427 | schema: response[0],
|
|
0 commit comments