Skip to content

Commit a23cea2

Browse files
committed
ui: getAPI-postAPI logic
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent 72afbc4 commit a23cea2

8 files changed

+21
-21
lines changed

ui/src/views/extension/AddCustomAction.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128

129129
<script>
130130
import { ref, reactive, toRaw } from 'vue'
131-
import { api } from '@/api'
131+
import { postAPI } from '@/api'
132132
import TooltipLabel from '@/components/widgets/TooltipLabel'
133133
import InfiniteScrollSelect from '@/components/widgets/InfiniteScrollSelect'
134134
import ParametersInput from '@/views/extension/ParametersInput'
@@ -209,7 +209,7 @@ export default {
209209
params['details[0].' + key] = value
210210
})
211211
}
212-
api('addCustomAction', params).then(response => {
212+
postAPI('addCustomAction', params).then(response => {
213213
this.$emit('refresh-data')
214214
this.$notification.success({
215215
message: this.$t('label.create.extension'),

ui/src/views/extension/CreateExtension.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105

106106
<script>
107107
import { ref, reactive, toRaw } from 'vue'
108-
import { api } from '@/api'
108+
import { postAPI } from '@/api'
109109
import TooltipLabel from '@/components/widgets/TooltipLabel'
110110
import DetailsInput from '@/components/widgets/DetailsInput'
111111
@@ -201,7 +201,7 @@ export default {
201201
params['details[0].' + key] = value
202202
})
203203
}
204-
api('createExtension', params).then(response => {
204+
postAPI('createExtension', params).then(response => {
205205
this.$emit('refresh-data')
206206
this.$notification.success({
207207
message: this.$t('label.create.extension'),

ui/src/views/extension/ExtensionCustomActionsTab.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
</template>
120120

121121
<script>
122-
import { api } from '@/api'
122+
import { getAPI, postAPI } from '@/api'
123123
import ObjectListTable from '@/components/view/ObjectListTable.vue'
124124
import TooltipButton from '@/components/widgets/TooltipButton'
125125
import AddCustomAction from '@/views/extension/AddCustomAction.vue'
@@ -210,7 +210,7 @@ export default {
210210
listall: true
211211
}
212212
this.tabLoading = true
213-
api('listCustomActions', params).then(json => {
213+
getAPI('listCustomActions', params).then(json => {
214214
this.extensionCustomActions = []
215215
this.totalCount = json?.listcustomactionsresponse?.count || 0
216216
this.extensionCustomActions = json?.listcustomactionsresponse?.extensioncustomaction || []
@@ -237,7 +237,7 @@ export default {
237237
enabled: !record.enabled
238238
}
239239
this.updateLoading = true
240-
api('updateCustomAction', params).then(json => {
240+
postAPI('updateCustomAction', params).then(json => {
241241
this.fetchCustomActions()
242242
this.$notification.success({
243243
message: record.enabled ? this.$t('label.disable.custom.action') : this.$t('label.enable.custom.action'),
@@ -254,7 +254,7 @@ export default {
254254
id: record.id
255255
}
256256
this.deleteLoading = true
257-
api('deleteCustomAction', params).then(json => {
257+
postAPI('deleteCustomAction', params).then(json => {
258258
this.fetchCustomActions()
259259
this.$notification.success({
260260
message: this.$t('label.delete.custom.action'),

ui/src/views/extension/ExtensionResourcesTab.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
</template>
6464

6565
<script>
66-
import { api } from '@/api'
66+
import { postAPI } from '@/api'
6767
import eventBus from '@/config/eventBus'
6868
import ObjectListTable from '@/components/view/ObjectListTable.vue'
6969
import TooltipButton from '@/components/widgets/TooltipButton'
@@ -118,7 +118,7 @@ export default {
118118
resourceid: record.id,
119119
resourcetype: record.type
120120
}
121-
api('unregisterExtension', params).then(json => {
121+
postAPI('unregisterExtension', params).then(json => {
122122
eventBus.emit('async-job-complete', null)
123123
this.$notification.success({
124124
message: this.$t('label.unregister.extension'),

ui/src/views/extension/RegisterExtension.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676

7777
<script>
7878
import { ref, reactive, toRaw } from 'vue'
79-
import { api } from '@/api'
79+
import { getAPI, postAPI } from '@/api'
8080
import TooltipLabel from '@/components/widgets/TooltipLabel'
8181
import DetailsInput from '@/components/widgets/DetailsInput'
8282
@@ -140,7 +140,7 @@ export default {
140140
if (['cluster'].includes(type)) {
141141
params.hypervisor = 'External'
142142
}
143-
api(resourceApi, params).then(json => {
143+
getAPI(resourceApi, params).then(json => {
144144
this.resources.opts = json?.[resourceApi.toLowerCase() + 'response']?.[type] || []
145145
}).finally(() => {
146146
this.resources.loading = false
@@ -163,7 +163,7 @@ export default {
163163
params['details[0].' + key] = value
164164
})
165165
}
166-
api('registerExtension', params).then(response => {
166+
postAPI('registerExtension', params).then(response => {
167167
this.$emit('refresh-data')
168168
this.$notification.success({
169169
message: this.$t('label.register.extension'),

ui/src/views/extension/RunCustomAction.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100

101101
<script>
102102
import { ref, reactive, toRaw, h } from 'vue'
103-
import { api } from '@/api'
103+
import { getAPI, postAPI } from '@/api'
104104
import TooltipLabel from '@/components/widgets/TooltipLabel'
105105
import DetailsInput from '@/components/widgets/DetailsInput'
106106
@@ -166,7 +166,7 @@ export default {
166166
resourceid: this.resource.id,
167167
enabled: true
168168
}
169-
api('listCustomActions', params).then(json => {
169+
getAPI('listCustomActions', params).then(json => {
170170
this.customActions = json?.listcustomactionsresponse?.extensioncustomaction || []
171171
}).finally(() => {
172172
this.loading = false
@@ -244,7 +244,7 @@ export default {
244244
const httpMethod = this.currentParameters.find(p => p.validationformat === 'PASSWORD') ? 'POST' : 'GET'
245245
const args = httpMethod === 'POST' ? {} : params
246246
const data = httpMethod === 'POST' ? params : {}
247-
api('runCustomAction', args, httpMethod, data).then(response => {
247+
postAPI('runCustomAction', args, httpMethod, data).then(response => {
248248
this.$pollJob({
249249
jobId: response.runcustomactionresponse.jobid,
250250
title: this.currentAction.name || this.$t('label.run.custom.action'),

ui/src/views/extension/UpdateCustomAction.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102

103103
<script>
104104
import { ref, reactive, toRaw } from 'vue'
105-
import { api } from '@/api'
105+
import { postAPI } from '@/api'
106106
import TooltipLabel from '@/components/widgets/TooltipLabel'
107107
import ParametersInput from '@/views/extension/ParametersInput'
108108
import DetailsInput from '@/components/widgets/DetailsInput'
@@ -194,7 +194,7 @@ export default {
194194
} else {
195195
params.cleanupdetails = true
196196
}
197-
api('updateCustomAction', params).then(response => {
197+
postAPI('updateCustomAction', params).then(response => {
198198
this.$emit('refresh-data')
199199
this.$notification.success({
200200
message: this.$t('label.update.custom.action'),

ui/src/views/extension/UpdateExtension.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
<script>
5858
import { ref, reactive, toRaw } from 'vue'
59-
import { api } from '@/api'
59+
import { getAPI, postAPI } from '@/api'
6060
import TooltipLabel from '@/components/widgets/TooltipLabel'
6161
import DetailsInput from '@/components/widgets/DetailsInput'
6262
@@ -95,7 +95,7 @@ export default {
9595
},
9696
fetchData () {
9797
this.loading = true
98-
api('listExtensions', { id: this.resource.id }).then(json => {
98+
getAPI('listExtensions', { id: this.resource.id }).then(json => {
9999
this.form.details = json?.listextensionsresponse?.extension?.[0]?.details
100100
}).finally(() => {
101101
this.loading = false
@@ -121,7 +121,7 @@ export default {
121121
params['details[0].' + key] = value
122122
})
123123
}
124-
api('updateExtension', params).then(response => {
124+
postAPI('updateExtension', params).then(response => {
125125
this.$emit('refresh-data')
126126
this.$notification.success({
127127
message: this.$t('label.update.extension'),

0 commit comments

Comments
 (0)