6262 <div class =" form__label" >
6363 <tooltip-label :title =" $t('label.templatename')" :tooltip =" createAutoScaleVmProfileApiParams.templateid.description" />
6464 </div >
65- {{ getTemplateName( templateid) }}
65+ {{ templateName || templateid }}
6666 </div >
6767 </div >
6868 <div class =" form" >
@@ -338,6 +338,7 @@ export default {
338338 autoscaleuserid: null ,
339339 expungevmgraceperiod: null ,
340340 templateid: null ,
341+ templateName: null ,
341342 serviceofferingid: null ,
342343 userdata: null ,
343344 userdataid: null ,
@@ -422,6 +423,9 @@ export default {
422423 domainid: this .resource .domainid ,
423424 account: this .resource .account
424425 }
426+ if (this .resource .projectid ) {
427+ params .projectid = this .resource .projectid
428+ }
425429 if (isAdmin ()) {
426430 params .templatefilter = ' all'
427431 } else {
@@ -436,6 +440,9 @@ export default {
436440 listall: ' true' ,
437441 issystem: ' false'
438442 }
443+ if (this .resource .projectid ) {
444+ params .projectid = this .resource .projectid
445+ }
439446 if (isAdminOrDomainAdmin ()) {
440447 params .isrecursive = ' true'
441448 }
@@ -446,15 +453,20 @@ export default {
446453 },
447454 fetchData () {
448455 this .loading = true
449- api ( ' listAutoScaleVmProfiles ' , {
456+ const params = {
450457 listAll: true ,
451458 id: this .resource .vmprofileid
452- }).then (response => {
459+ }
460+ if (this .resource .projectid ) {
461+ params .projectid = this .resource .projectid
462+ }
463+ api (' listAutoScaleVmProfiles' , params).then (response => {
453464 this .profileid = response .listautoscalevmprofilesresponse ? .autoscalevmprofile ? .[0 ]? .id
454465 this .autoscaleuserid = response .listautoscalevmprofilesresponse ? .autoscalevmprofile ? .[0 ]? .autoscaleuserid
455466 this .expungevmgraceperiod = response .listautoscalevmprofilesresponse ? .autoscalevmprofile ? .[0 ]? .expungevmgraceperiod
456467 this .serviceofferingid = response .listautoscalevmprofilesresponse ? .autoscalevmprofile ? .[0 ]? .serviceofferingid
457468 this .templateid = response .listautoscalevmprofilesresponse ? .autoscalevmprofile ? .[0 ]? .templateid
469+ this .fetchTemplate (this .templateid )
458470 this .userdata = this .decodeUserData (decodeURIComponent (response .listautoscalevmprofilesresponse ? .autoscalevmprofile ? .[0 ]? .userdata || ' ' ))
459471 this .userdataid = response .listautoscalevmprofilesresponse ? .autoscalevmprofile ? .[0 ]? .userdataid
460472 this .userdataname = response .listautoscalevmprofilesresponse ? .autoscalevmprofile ? .[0 ]? .userdataname
@@ -468,13 +480,22 @@ export default {
468480 this .loading = false
469481 })
470482 },
471- getTemplateName (templateid ) {
472- for ( const template of this . templatesList ) {
473- if ( template . id === templateid) {
474- return template . name
475- }
483+ fetchTemplate (templateid ) {
484+ if ( ! templateid) return
485+ const params = {
486+ id : templateid,
487+ templatefilter : ' executable '
476488 }
477- return ' '
489+ if (this .resource .projectid ) {
490+ params .projectid = this .resource .projectid
491+ }
492+ api (' listTemplates' , params).then (json => {
493+ if (json .listtemplatesresponse ? .template ? .[0 ]) {
494+ this .templateName = json .listtemplatesresponse .template [0 ].name
495+ } else {
496+ this .templateName = templateid
497+ }
498+ })
478499 },
479500 getServiceOfferingName (serviceofferingid ) {
480501 for (const serviceoffering of this .serviceOfferingsList ) {
@@ -576,16 +597,20 @@ export default {
576597 this .$pollJob ({
577598 jobId: response .updateautoscalevmprofileresponse .jobid ,
578599 successMethod : (result ) => {
600+ this .fetchData ()
579601 },
580602 errorMessage: this .$t (' message.update.autoscale.vm.profile.failed' ),
581603 errorMethod : () => {
604+ this .fetchData ()
582605 }
583606 })
584607 }).finally (() => {
585608 this .loading = false
586609 })
587610 },
588611 updateAutoScaleVmProfile () {
612+ if (this .loading ) return
613+ this .loading = true
589614 const params = {
590615 id: this .profileid ,
591616 expungevmgraceperiod: this .expungevmgraceperiod ,
@@ -604,6 +629,7 @@ export default {
604629 this .$pollJob ({
605630 jobId: response .updateautoscalevmprofileresponse .jobid ,
606631 successMethod : (result ) => {
632+ this .closeModal ()
607633 },
608634 errorMessage: this .$t (' message.update.autoscale.vm.profile.failed' ),
609635 errorMethod : () => {
@@ -618,6 +644,7 @@ export default {
618644 return decodedData .toString (' utf-8' )
619645 },
620646 closeModal () {
647+ this .fetchData ()
621648 this .editProfileModalVisible = false
622649 }
623650 }
0 commit comments