Skip to content

Commit e0ab55a

Browse files
UI fixes and changes to use POST requests for state changing APIs
1 parent a82a8bb commit e0ab55a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+218
-230
lines changed

ui/src/components/header/SamlDomainSwitcher.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default {
102102
},
103103
changeAccount (index) {
104104
const account = this.samlAccounts[index]
105-
postAPI('listAndSwitchSamlAccount', {}, 'POST', {
105+
postAPI('listAndSwitchSamlAccount', {
106106
userid: account.userId,
107107
domainid: account.domainId
108108
}).then(response => {

ui/src/components/view/ImageStoreSelectView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
</template>
7676

7777
<script>
78-
import { api } from '@/api'
78+
import { getAPI } from '@/api'
7979
8080
export default {
8181
name: 'ImageStoreSelector',
@@ -141,7 +141,7 @@ export default {
141141
page: this.page,
142142
pagesize: this.pageSize
143143
}
144-
api('listImageStores', params).then(response => {
144+
getAPI('listImageStores', params).then(response => {
145145
this.imageStores = response.listimagestoresresponse.imagestore || []
146146
this.totalCount = response.listimagestoresresponse.count
147147
}).catch(error => {

ui/src/components/view/TestWebhookDeliveryView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
</template>
8989

9090
<script>
91-
import { api } from '@/api'
91+
import { postAPI } from '@/api'
9292
import TooltipLabel from '@/components/widgets/TooltipLabel'
9393
import Status from '@/components/widgets/Status'
9494
@@ -191,7 +191,7 @@ export default {
191191
if (this.secretKey) {
192192
params.secretKey = this.secretKey
193193
}
194-
api('executeWebhookDelivery', params).then(response => {
194+
postAPI('executeWebhookDelivery', params).then(response => {
195195
this.response = response.executewebhookdeliveryresponse.webhookdelivery
196196
this.$emit('update-success', response.success)
197197
}).catch(error => {

ui/src/components/view/UploadResourceIcon.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export default {
247247
newImage.src = await this.getResourceIcon()
248248
base64Canvas = await this.getNewImage(newImage)
249249
}
250-
postAPI('uploadResourceIcon', {}, 'POST', {
250+
postAPI('uploadResourceIcon', {
251251
resourceids: resourceid,
252252
resourcetype: resourceType,
253253
base64image: base64Canvas

ui/src/components/view/WebhookDeliveriesTab.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
</template>
113113

114114
<script>
115-
import { api } from '@/api'
115+
import { getAPI, postAPI } from '@/api'
116116
import { isAdmin } from '@/role'
117117
import { genericCompare } from '@/utils/sort.js'
118118
import moment from 'moment'
@@ -253,7 +253,7 @@ export default {
253253
params.eventtype = this.searchParams.eventtype
254254
}
255255
this.tabLoading = true
256-
api('listWebhookDeliveries', params).then(json => {
256+
getAPI('listWebhookDeliveries', params).then(json => {
257257
this.deliveries = []
258258
this.totalCount = json?.listwebhookdeliveriesresponse?.count || 0
259259
this.deliveries = json?.listwebhookdeliveriesresponse?.webhookdelivery || []
@@ -321,7 +321,7 @@ export default {
321321
id: id
322322
}
323323
promises.push(new Promise((resolve, reject) => {
324-
api('deleteWebhookDelivery', params).then(json => {
324+
postAPI('deleteWebhookDelivery', params).then(json => {
325325
return resolve(id)
326326
}).catch(error => {
327327
return reject(error)
@@ -344,7 +344,7 @@ export default {
344344
webhookid: this.resource.id
345345
}
346346
this.tabLoading = true
347-
api('deleteWebhookDelivery', params).then(json => {
347+
postAPI('deleteWebhookDelivery', params).then(json => {
348348
this.$message.success(this.$t('message.success.clear.webhook.deliveries'))
349349
this.fetchData()
350350
}).catch(error => {
@@ -370,7 +370,7 @@ export default {
370370
id: item.id
371371
}
372372
this.tabLoading = true
373-
api('executeWebhookDelivery', params).then(json => {
373+
postAPI('executeWebhookDelivery', params).then(json => {
374374
this.$message.success(this.$t('message.success.redeliver.webhook.delivery'))
375375
this.fetchData()
376376
}).catch(error => {
@@ -396,7 +396,7 @@ export default {
396396
id: item.id
397397
}
398398
this.tabLoading = true
399-
api('deleteWebhookDelivery', params).then(json => {
399+
postAPI('deleteWebhookDelivery', params).then(json => {
400400
const message = `${this.$t('message.success.delete')} ${this.$t('label.webhook.delivery')}`
401401
this.$message.success(message)
402402
this.fetchData()

ui/src/components/widgets/InfiniteScrollSelect.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
</template>
8989

9090
<script>
91-
import { api } from '@/api'
91+
import { postAPI } from '@/api'
9292
import ResourceIcon from '@/components/view/ResourceIcon'
9393

9494
export default {
@@ -191,7 +191,7 @@ export default {
191191
if (this.showIcon) {
192192
params.showicon = true
193193
}
194-
api(this.api, params).then(json => {
194+
postAPI(this.api, params).then(json => {
195195
const response = json[this.api.toLowerCase() + 'response'] || {}
196196
if (this.totalCount === null) {
197197
this.totalCount = response.count || 0

ui/src/views/auth/ForgotPassword.vue

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

9999
<script>
100100
import { ref, reactive, toRaw } from 'vue'
101-
import { api } from '@/api'
101+
import { postAPI } from '@/api'
102102
import store from '@/store'
103103
import { SERVER_MANAGER } from '@/store/mutation-types'
104104
import TranslationMenu from '@/components/header/TranslationMenu'
@@ -159,7 +159,7 @@ export default {
159159
if (!loginParams.domain) {
160160
loginParams.domain = '/'
161161
}
162-
api('forgotPassword', {}, 'POST', loginParams)
162+
postAPI('forgotPassword', loginParams)
163163
.finally(() => {
164164
this.$message.success(this.$t('message.forgot.password.success'))
165165
this.$router.push({ path: '/login' }).catch(() => {})

ui/src/views/auth/ResetPassword.vue

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

125125
<script>
126126
import { ref, reactive, toRaw } from 'vue'
127-
import { api } from '@/api'
127+
import { postAPI } from '@/api'
128128
import store from '@/store'
129129
import { SERVER_MANAGER } from '@/store/mutation-types'
130130
import TranslationMenu from '@/components/header/TranslationMenu'
@@ -200,7 +200,7 @@ export default {
200200
loginParams.domain = '/'
201201
}
202202
203-
api('resetPassword', {}, 'POST', loginParams)
203+
postAPI('resetPassword', loginParams)
204204
.then((res) => {
205205
if (res?.resetpasswordresponse?.success) {
206206
this.$message.success(this.$t('message.password.reset.success'))

ui/src/views/compute/CreateAutoScaleVmGroup.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,11 +2312,7 @@ export default {
23122312
j++
23132313
}
23142314
2315-
const httpMethod = createVmGroupData.userdata ? 'POST' : 'GET'
2316-
const args = httpMethod === 'POST' ? {} : params
2317-
const data = httpMethod === 'POST' ? params : {}
2318-
2319-
postAPI('createAutoScaleVmProfile', args, httpMethod, data).then(async json => {
2315+
postAPI('createAutoScaleVmProfile', params).then(async json => {
23202316
const jobId = json.autoscalevmprofileresponse.jobid
23212317
if (jobId) {
23222318
const result = await this.pollJob(jobId)

ui/src/views/compute/DeployVM.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,11 +2235,7 @@ export default {
22352235
}
22362236
}
22372237
2238-
const httpMethod = deployVmData.userdata ? 'POST' : 'GET'
2239-
const args = httpMethod === 'POST' ? {} : deployVmData
2240-
const data = httpMethod === 'POST' ? deployVmData : {}
2241-
2242-
postAPI('deployVirtualMachine', args, httpMethod, data).then(response => {
2238+
postAPI('deployVirtualMachine', deployVmData).then(response => {
22432239
const jobId = response.deployvirtualmachineresponse.jobid
22442240
if (jobId) {
22452241
this.$pollJob({

ui/src/views/compute/DeployVnfAppliance.vue

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@
856856

857857
<script>
858858
import { ref, reactive, toRaw, nextTick } from 'vue'
859-
import { api } from '@/api'
859+
import { getAPI, postAPI } from '@/api'
860860
import _ from 'lodash'
861861
import { mixin, mixinDevice } from '@/utils/mixin.js'
862862
import store from '@/store'
@@ -1682,7 +1682,7 @@ export default {
16821682
}
16831683
if (!apiName) return resolve(zones)
16841684
1685-
api(apiName, params).then(json => {
1685+
postAPI(apiName, params).then(json => {
16861686
let objectName
16871687
const responseName = [apiName.toLowerCase(), 'response'].join('')
16881688
for (const key in json[responseName]) {
@@ -1775,7 +1775,7 @@ export default {
17751775
},
17761776
fetchInstaceGroups () {
17771777
this.options.instanceGroups = []
1778-
api('listInstanceGroups', {
1778+
getAPI('listInstanceGroups', {
17791779
account: this.$store.getters.userInfo.account,
17801780
domainid: this.$store.getters.userInfo.domainid,
17811781
listall: true
@@ -1925,7 +1925,7 @@ export default {
19251925
}
19261926
this.form.userdataid = id
19271927
this.userDataParams = []
1928-
api('listUserData', { id: id }).then(json => {
1928+
getAPI('listUserData', { id: id }).then(json => {
19291929
const resp = json.listuserdataresponse?.userdata || []
19301930
if (resp.length > 0) {
19311931
var params = resp[0]?.params || null
@@ -1948,7 +1948,7 @@ export default {
19481948
}
19491949
this.templateUserDataParams = []
19501950
1951-
api('listUserData', { id: id }).then(json => {
1951+
getAPI('listUserData', { id: id }).then(json => {
19521952
const resp = json?.listuserdataresponse?.userdata || []
19531953
if (resp) {
19541954
var params = resp[0]?.params || null
@@ -2273,11 +2273,7 @@ export default {
22732273
}
22742274
}
22752275
2276-
const httpMethod = createVnfAppData.userdata ? 'POST' : 'GET'
2277-
const args = httpMethod === 'POST' ? {} : createVnfAppData
2278-
const data = httpMethod === 'POST' ? createVnfAppData : {}
2279-
2280-
api('deployVnfAppliance', args, httpMethod, data).then(response => {
2276+
postAPI('deployVnfAppliance', createVnfAppData).then(response => {
22812277
const jobId = response.deployvirtualmachineresponse.jobid
22822278
if (jobId) {
22832279
this.$pollJob({
@@ -2373,7 +2369,7 @@ export default {
23732369
const param = this.params.zones
23742370
const args = { showicon: true }
23752371
if (zoneId) args.id = zoneId
2376-
api(param.list, args).then(json => {
2372+
postAPI(param.list, args).then(json => {
23772373
const zoneResponse = json.listzonesresponse.zone || []
23782374
if (listZoneAllow && listZoneAllow.length > 0) {
23792375
zoneResponse.map(zone => {
@@ -2406,7 +2402,7 @@ export default {
24062402
if (!('listall' in options) && !['zones', 'pods', 'clusters', 'hosts', 'dynamicScalingVmConfig', 'hypervisors'].includes(name)) {
24072403
options.listall = true
24082404
}
2409-
api(param.list, options).then((response) => {
2405+
postAPI(param.list, options).then((response) => {
24102406
param.loading = false
24112407
_.map(response, (responseItem, responseKey) => {
24122408
if (Object.keys(responseItem).length === 0) {
@@ -2469,7 +2465,7 @@ export default {
24692465
args.id = this.templateId
24702466
24712467
return new Promise((resolve, reject) => {
2472-
api('listVnfTemplates', args).then((response) => {
2468+
getAPI('listVnfTemplates', args).then((response) => {
24732469
resolve(response)
24742470
}).catch((reason) => {
24752471
// ToDo: Handle errors
@@ -2490,7 +2486,7 @@ export default {
24902486
args.id = this.isoId
24912487
24922488
return new Promise((resolve, reject) => {
2493-
api('listIsos', args).then((response) => {
2489+
getAPI('listIsos', args).then((response) => {
24942490
resolve(response)
24952491
}).catch((reason) => {
24962492
// ToDo: Handle errors

ui/src/views/compute/EditVM.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ export default {
356356
}
357357
this.loading = true
358358
359-
postAPI('updateVirtualMachine', {}, 'POST', params).then(json => {
359+
postAPI('updateVirtualMachine', params).then(json => {
360360
this.$message.success({
361361
content: `${this.$t('label.action.edit.instance')} - ${values.name}`,
362362
duration: 2

ui/src/views/compute/InstanceSchedules.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
<script>
254254
255255
import { reactive, ref, toRaw } from 'vue'
256-
import { api } from '@/api'
256+
import { getAPI, postAPI } from '@/api'
257257
import ListView from '@/components/view/ListView'
258258
import Status from '@/components/widgets/Status'
259259
import TooltipLabel from '@/components/widgets/TooltipLabel'
@@ -373,7 +373,7 @@ export default {
373373
this.showAddModal()
374374
},
375375
removeVMSchedule (schedule) {
376-
api('deleteVMSchedule', {
376+
postAPI('deleteVMSchedule', {
377377
id: schedule.id,
378378
virtualmachineid: this.virtualmachine.id
379379
}).then(() => {
@@ -429,7 +429,7 @@ export default {
429429
command = 'updateVMSchedule'
430430
}
431431
432-
api(command, params).then(response => {
432+
postAPI(command, params).then(response => {
433433
this.$notification.success({
434434
message: this.$t('label.schedule'),
435435
description: this.$t('message.success.config.vm.schedule')
@@ -485,7 +485,7 @@ export default {
485485
listall: true
486486
}
487487
this.tabLoading = true
488-
api('listVMSchedule', params).then(json => {
488+
getAPI('listVMSchedule', params).then(json => {
489489
this.schedules = []
490490
this.totalCount = json?.listvmscheduleresponse?.count || 0
491491
this.schedules = json?.listvmscheduleresponse?.vmschedule || []

ui/src/views/compute/RegisterUserData.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export default {
216216
params.params = userdataparams
217217
}
218218
219-
postAPI('registerUserData', {}, 'POST', params).then(json => {
219+
postAPI('registerUserData', params).then(json => {
220220
this.$message.success(this.$t('message.success.register.user.data') + ' ' + values.name)
221221
}).catch(error => {
222222
this.$notifyError(error)

ui/src/views/compute/wizard/OwnershipSelection.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
</template>
129129

130130
<script>
131-
import { api } from '@/api'
131+
import { getAPI } from '@/api'
132132
import ResourceIcon from '@/components/view/ResourceIcon.vue'
133133
134134
export default {
@@ -157,7 +157,7 @@ export default {
157157
methods: {
158158
fetchData () {
159159
this.loading = true
160-
api('listDomains', {
160+
getAPI('listDomains', {
161161
response: 'json',
162162
listAll: true,
163163
showicon: true,
@@ -188,7 +188,7 @@ export default {
188188
},
189189
fetchAccounts () {
190190
this.loading = true
191-
api('listAccounts', {
191+
getAPI('listAccounts', {
192192
response: 'json',
193193
domainId: this.selectedDomain,
194194
showicon: true,
@@ -218,7 +218,7 @@ export default {
218218
},
219219
fetchProjects () {
220220
this.loading = true
221-
api('listProjects', {
221+
getAPI('listProjects', {
222222
response: 'json',
223223
domainId: this.selectedDomain,
224224
state: 'Active',

ui/src/views/dashboard/VerifyOauth.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<script>
2424
import store from '@/store'
2525
import { mapActions } from 'vuex'
26-
import { api } from '@/api'
26+
import { getAPI } from '@/api'
2727
import { OAUTH_DOMAIN, OAUTH_PROVIDER } from '@/store/mutation-types'
2828
2929
export default {
@@ -47,7 +47,7 @@ export default {
4747
const code = params.get('code')
4848
const provider = this.$localStorage.get(OAUTH_PROVIDER)
4949
this.state.loginBtn = true
50-
api('verifyOAuthCodeAndGetUser', { provider: provider, secretcode: code }).then(response => {
50+
getAPI('verifyOAuthCodeAndGetUser', { provider: provider, secretcode: code }).then(response => {
5151
const email = response.verifyoauthcodeandgetuserresponse.oauthemail.email
5252
const loginParams = {}
5353
loginParams.email = email

ui/src/views/iam/AddAccount.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ export default {
366366
params.networkdomain = values.networkdomain
367367
}
368368
369-
postAPI('createAccount', {}, 'POST', params).then(response => {
369+
postAPI('createAccount', params).then(response => {
370370
this.$emit('refresh-data')
371371
this.$notification.success({
372372
message: this.$t('label.create.account'),

0 commit comments

Comments
 (0)