Skip to content

Commit 163c6ab

Browse files
UI fixes and changes to use POST requests for state changing APIs
1 parent b189ddf commit 163c6ab

File tree

65 files changed

+219
-231
lines changed

Some content is hidden

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

65 files changed

+219
-231
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({

0 commit comments

Comments
 (0)