Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
  • Loading branch information
vishesh92 and sureshanaparti committed Jul 15, 2025
commit 732332160348067f5c99cc6a6c9ad28e684af4e1
4 changes: 2 additions & 2 deletions ui/src/views/compute/KubernetesAddNodes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

<script>
import { ref, reactive, toRaw } from 'vue'
import { getAPI } from '@/api'
import { getAPI, postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'

export default {
Expand Down Expand Up @@ -172,7 +172,7 @@ export default {
},
addNodesToKubernetesCluster (params) {
return new Promise((resolve, reject) => {
getAPI('addNodesToKubernetesCluster', params).then(json => {
postAPI('addNodesToKubernetesCluster', params).then(json => {
Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can simplify this method by returning postAPI(...).then(json => json.addnodestokubernetesclusterresponse.jobid) directly, removing the explicit new Promise wrapper and reducing boilerplate.

Copilot uses AI. Check for mistakes.
const jobId = json.addnodestokubernetesclusterresponse.jobid
return resolve(jobId)
}).catch(error => {
Expand Down
4 changes: 2 additions & 2 deletions ui/src/views/compute/KubernetesRemoveNodes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<script>
import { ref, reactive, toRaw } from 'vue'
import { getAPI } from '@/api'
import { postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'

export default {
Expand Down Expand Up @@ -137,7 +137,7 @@ export default {
},
removeNodesFromKubernetesCluster (params) {
return new Promise((resolve, reject) => {
getAPI('removeNodesFromKubernetesCluster', params).then(json => {
postAPI('removeNodesFromKubernetesCluster', params).then(json => {
Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid wrapping postAPI in a new Promise. Instead, return the promise directly and chain .then() to extract the job ID, which simplifies the code and ensures errors propagate correctly.

Copilot uses AI. Check for mistakes.
const jobId = json.removenodesfromkubernetesclusterresponse.jobid
return resolve(jobId)
}).catch(error => {
Expand Down