weizhouapache commented on code in PR #9708:
URL: https://github.com/apache/cloudstack/pull/9708#discussion_r1766489832


##########
ui/src/views/network/NicsTab.vue:
##########
@@ -368,9 +376,26 @@ export default {
         this.$pollJob({
           jobId: response.addnictovirtualmachineresponse.jobid,
           successMessage: this.$t('message.success.add.network'),
-          successMethod: () => {
-            this.loadingNic = false
-            this.closeModals()
+          successMethod: async () => {
+            if (this.addNetworkData.makedefault) {
+              try {
+                this.nic = await this.getNic(params.networkid, 
params.virtualmachineid)
+                if (this.nic) {
+                  this.setAsDefault(this.nic)
+                } else {
+                  this.$notifyError('NIC data not found.')
+                  this.loadingNic = false
+                  this.closeModals()
+                }
+              } catch (error) {
+                this.$notifyError('Failed to fetch NIC data.')
+                this.loadingNic = false
+                this.closeModals()
+              }
+            } else {
+              this.loadingNic = false

Review Comment:
   can the following be moved to the line before `errorMessage` ?
   
   ```
                 this.loadingNic = false
                 this.closeModals()
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to