Support ApiServer to enforce POST requests for state changing APIs and requests with timestamps (#10899)

Co-authored-by: Kevin Li <kli74@apple.com>
This commit is contained in:
Suresh Kumar Anaparti 2025-07-05 18:55:48 +05:30 committed by GitHub
parent d5fd3ec36e
commit 749ddb975f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
261 changed files with 1581 additions and 1478 deletions

View File

@ -22,6 +22,7 @@ package org.apache.cloudstack.api;
*/
public enum ApiErrorCode {
BAD_REQUEST(400),
UNAUTHORIZED(401),
UNAUTHORIZED2FA(511),
METHOD_NOT_ALLOWED(405),

View File

@ -48,4 +48,6 @@ public interface ApiServerService {
boolean forgotPassword(UserAccount userAccount, Domain domain);
boolean resetPassword(UserAccount userAccount, String token, String password);
boolean isPostRequestsAndTimestampsEnforced();
}

View File

@ -201,6 +201,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
private static final String SANITIZATION_REGEX = "[\n\r]";
private static boolean encodeApiResponse = false;
private boolean isPostRequestsAndTimestampsEnforced = false;
/**
* Non-printable ASCII characters - numbers 0 to 31 and 127 decimal
@ -284,6 +285,13 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
, "Session cookie is marked as secure if this is enabled. Secure cookies only work when HTTPS is used."
, false
, ConfigKey.Scope.Global);
static final ConfigKey<Boolean> EnforcePostRequestsAndTimestamps = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED
, Boolean.class
, "enforce.post.requests.and.timestamps"
, "false"
, "Enable/Disable whether the ApiServer should only accept POST requests for state-changing APIs and requests with timestamps."
, false
, ConfigKey.Scope.Global);
private static final ConfigKey<String> JSONDefaultContentType = new ConfigKey<> (ConfigKey.CATEGORY_ADVANCED
, String.class
, "json.content.type"
@ -441,6 +449,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
public boolean start() {
Security.addProvider(new BouncyCastleProvider());
Integer apiPort = IntegrationAPIPort.value(); // api port, null by default
isPostRequestsAndTimestampsEnforced = EnforcePostRequestsAndTimestamps.value();
final Long snapshotLimit = ConcurrentSnapshotsThresholdPerHost.value();
if (snapshotLimit == null || snapshotLimit <= 0) {
@ -720,6 +729,11 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
return response;
}
@Override
public boolean isPostRequestsAndTimestampsEnforced() {
return isPostRequestsAndTimestampsEnforced;
}
private String getBaseAsyncResponse(final long jobId, final BaseAsyncCmd cmd) {
final AsyncJobResponse response = new AsyncJobResponse();
@ -967,7 +981,6 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
// put the name in a list that we'll sort later
final List<String> parameterNames = new ArrayList<>(requestParameters.keySet());
Collections.sort(parameterNames);
String signatureVersion = null;
@ -1019,12 +1032,22 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
}
final Date now = new Date(System.currentTimeMillis());
final Date thresholdTime = new Date(now.getTime() + 15 * 60 * 1000);
if (expiresTS.before(now)) {
signature = signature.replaceAll(SANITIZATION_REGEX, "_");
apiKey = apiKey.replaceAll(SANITIZATION_REGEX, "_");
logger.debug("Request expired -- ignoring ...sig [{}], apiKey [{}].", signature, apiKey);
return false;
} else if (isPostRequestsAndTimestampsEnforced && expiresTS.after(thresholdTime)) {
signature = signature.replaceAll(SANITIZATION_REGEX, "_");
apiKey = apiKey.replaceAll(SANITIZATION_REGEX, "_");
logger.debug(String.format("Expiration parameter is set for too long -- ignoring ...sig [%s], apiKey [%s].", signature, apiKey));
return false;
}
} else if (isPostRequestsAndTimestampsEnforced) {
// Force expiration parameter
logger.debug("Signature Version must be 3, and should be along with the Expires parameter -- ignoring request.");
return false;
}
final TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
@ -1648,6 +1671,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
@Override
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {
EnforcePostRequestsAndTimestamps,
IntegrationAPIPort,
ConcurrentSnapshotsThresholdPerHost,
EncodeApiResponse,

View File

@ -22,8 +22,11 @@ import java.net.URLDecoder;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import java.util.Set;
import javax.inject.Inject;
import javax.servlet.ServletConfig;
@ -46,6 +49,7 @@ import org.apache.cloudstack.api.command.user.consoleproxy.CreateConsoleEndpoint
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.managed.context.ManagedContext;
import org.apache.cloudstack.utils.consoleproxy.ConsoleAccessUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
@ -78,6 +82,39 @@ public class ApiServlet extends HttpServlet {
private static final Logger ACCESSLOGGER = LogManager.getLogger("apiserver." + ApiServlet.class.getName());
private static final String REPLACEMENT = "_";
private static final String LOGGER_REPLACEMENTS = "[\n\r\t]";
private static final Pattern GET_REQUEST_COMMANDS = Pattern.compile("^(get|list|query|find)(\\w+)+$");
private static final HashSet<String> GET_REQUEST_COMMANDS_LIST = new HashSet<>(Set.of("isaccountallowedtocreateofferingswithtags",
"readyforshutdown", "cloudianisenabled", "quotabalance", "quotasummary", "quotatarifflist", "quotaisenabled", "quotastatement", "verifyoauthcodeandgetuser"));
private static final HashSet<String> POST_REQUESTS_TO_DISABLE_LOGGING = new HashSet<>(Set.of(
"login",
"oauthlogin",
"createaccount",
"createuser",
"updateuser",
"forgotpassword",
"resetpassword",
"importrole",
"updaterolepermission",
"updateprojectrolepermission",
"createstoragepool",
"addhost",
"updatehostpassword",
"addcluster",
"addvmwaredc",
"configureoutofbandmanagement",
"uploadcustomcertificate",
"addciscovnmcresource",
"addnetscalerloadbalancer",
"createtungstenfabricprovider",
"addnsxcontroller",
"configtungstenfabricservice",
"createnetworkacl",
"updatenetworkaclitem",
"quotavalidateactivationrule",
"quotatariffupdate",
"listandswitchsamlaccount",
"uploadresourceicon"
));
@Inject
ApiServerService apiServer;
@ -193,11 +230,24 @@ public class ApiServlet extends HttpServlet {
utf8Fixup(req, params);
final Object[] commandObj = params.get(ApiConstants.COMMAND);
final String command = commandObj == null ? null : (String) commandObj[0];
// logging the request start and end in management log for easy debugging
String reqStr = "";
String cleanQueryString = StringUtils.cleanString(req.getQueryString());
if (LOGGER.isDebugEnabled()) {
reqStr = auditTrailSb.toString() + " " + cleanQueryString;
if (req.getMethod().equalsIgnoreCase("POST") && org.apache.commons.lang3.StringUtils.isNotBlank(command)) {
if (!POST_REQUESTS_TO_DISABLE_LOGGING.contains(command.toLowerCase()) && !reqParams.containsKey(ApiConstants.USER_DATA)) {
String cleanParamsString = getCleanParamsString(reqParams);
if (org.apache.commons.lang3.StringUtils.isNotBlank(cleanParamsString)) {
reqStr += "\n" + cleanParamsString;
}
} else {
reqStr += " " + command;
}
}
LOGGER.debug("===START=== " + reqStr);
}
@ -213,8 +263,6 @@ public class ApiServlet extends HttpServlet {
responseType = (String)responseTypeParam[0];
}
final Object[] commandObj = params.get(ApiConstants.COMMAND);
final String command = commandObj == null ? null : (String) commandObj[0];
final Object[] userObj = params.get(ApiConstants.USERNAME);
String username = userObj == null ? null : (String)userObj[0];
if (LOGGER.isTraceEnabled()) {
@ -317,6 +365,19 @@ public class ApiServlet extends HttpServlet {
}
}
if (apiServer.isPostRequestsAndTimestampsEnforced() && !isStateChangingCommandUsingPOST(command, req.getMethod(), params)) {
String errorText = String.format("State changing command %s needs to be sent using POST request", command);
if (command.equalsIgnoreCase("updateConfiguration") && params.containsKey("name")) {
errorText = String.format("Changes for configuration %s needs to be sent using POST request", params.get("name")[0]);
}
auditTrailSb.append(" " + HttpServletResponse.SC_BAD_REQUEST + " " + errorText);
final String serializedResponse =
apiServer.getSerializedApiError(new ServerApiException(ApiErrorCode.BAD_REQUEST, errorText), params,
responseType);
HttpUtils.writeHttpResponse(resp, serializedResponse, HttpServletResponse.SC_BAD_REQUEST, responseType, ApiServer.JSONcontentType.value());
return;
}
Long userId = null;
if (!isNew) {
userId = (Long)session.getAttribute("userid");
@ -407,6 +468,15 @@ public class ApiServlet extends HttpServlet {
return verify2FA;
}
private boolean isStateChangingCommandUsingPOST(String command, String method, Map<String, Object[]> params) {
if (command == null || (!GET_REQUEST_COMMANDS.matcher(command.toLowerCase()).matches() && !GET_REQUEST_COMMANDS_LIST.contains(command.toLowerCase())
&& !command.equalsIgnoreCase("updateConfiguration") && !method.equals("POST"))) {
return false;
}
return !command.equalsIgnoreCase("updateConfiguration") || method.equals("POST") || (params.containsKey("name")
&& params.get("name")[0].toString().equalsIgnoreCase(ApiServer.EnforcePostRequestsAndTimestamps.key()));
}
protected boolean skip2FAcheckForAPIs(String command) {
boolean skip2FAcheck = false;
@ -644,4 +714,45 @@ public class ApiServlet extends HttpServlet {
}
return null;
}
private String getCleanParamsString(Map<String, String[]> reqParams) {
if (MapUtils.isEmpty(reqParams)) {
return "";
}
StringBuilder cleanParamsString = new StringBuilder();
for (Map.Entry<String, String[]> reqParam : reqParams.entrySet()) {
if (org.apache.commons.lang3.StringUtils.isBlank(reqParam.getKey())) {
continue;
}
cleanParamsString.append(reqParam.getKey());
cleanParamsString.append("=");
if (reqParam.getKey().toLowerCase().contains("password")
|| reqParam.getKey().toLowerCase().contains("privatekey")
|| reqParam.getKey().toLowerCase().contains("accesskey")
|| reqParam.getKey().toLowerCase().contains("secretkey")) {
cleanParamsString.append("\n");
continue;
}
if (reqParam.getValue() == null || reqParam.getValue().length == 0) {
cleanParamsString.append("\n");
continue;
}
for (String param : reqParam.getValue()) {
if (org.apache.commons.lang3.StringUtils.isBlank(param)) {
continue;
}
String cleanParamString = StringUtils.cleanString(param.trim());
cleanParamsString.append(cleanParamString);
cleanParamsString.append(" ");
}
cleanParamsString.append("\n");
}
return cleanParamsString.toString();
}
}

View File

@ -23,18 +23,10 @@ import {
ACCESS_TOKEN
} from '@/store/mutation-types'
export function api (command, args = {}, method = 'GET', data = {}) {
let params = {}
export function getAPI (command, args = {}) {
args.command = command
args.response = 'json'
if (data) {
params = new URLSearchParams()
Object.entries(data).forEach(([key, value]) => {
params.append(key, value)
})
}
const sessionkey = vueProps.$localStorage.get(ACCESS_TOKEN) || Cookies.get('sessionkey')
if (sessionkey) {
args.sessionkey = sessionkey
@ -45,8 +37,30 @@ export function api (command, args = {}, method = 'GET', data = {}) {
...args
},
url: '/',
method,
data: params || {}
method: 'GET'
})
}
export function postAPI (command, data = {}) {
const params = new URLSearchParams()
params.append('command', command)
params.append('response', 'json')
if (data) {
Object.entries(data).forEach(([key, value]) => {
if (value !== undefined && value !== null && value !== '') {
params.append(key, value)
}
})
}
const sessionkey = vueProps.$localStorage.get(ACCESS_TOKEN) || Cookies.get('sessionkey')
if (sessionkey) {
params.append('sessionkey', sessionkey)
}
return axios({
url: '/',
method: 'POST',
data: params
})
}
@ -56,7 +70,7 @@ export function login (arg) {
}
// Logout before login is called to purge any duplicate sessionkey cookies
api('logout')
postAPI('logout')
const params = new URLSearchParams()
params.append('command', 'login')
@ -66,7 +80,7 @@ export function login (arg) {
params.append('response', 'json')
return axios({
url: '/',
method: 'post',
method: 'POST',
data: params,
headers: {
'content-type': 'application/x-www-form-urlencoded'
@ -77,7 +91,7 @@ export function login (arg) {
export function logout () {
message.destroy()
notification.destroy()
return api('logout')
return postAPI('logout')
}
export function oauthlogin (arg) {
@ -86,7 +100,7 @@ export function oauthlogin (arg) {
}
// Logout before login is called to purge any duplicate sessionkey cookies
api('logout')
postAPI('logout')
const params = new URLSearchParams()
params.append('command', 'oauthlogin')

View File

@ -51,7 +51,7 @@
<script>
import store from '@/store'
import { api } from '@/api'
import { postAPI } from '@/api'
import _ from 'lodash'
export default {
@ -73,7 +73,7 @@ export default {
const samlAccounts = []
const getNextPage = () => {
this.loading = true
api('listAndSwitchSamlAccount', { details: 'min', page: page, pageSize: 500 }).then(json => {
postAPI('listAndSwitchSamlAccount', { details: 'min', page: page, pageSize: 500 }).then(json => {
if (json && json.listandswitchsamlaccountresponse && json.listandswitchsamlaccountresponse.samluseraccount) {
samlAccounts.push(...json.listandswitchsamlaccountresponse.samluseraccount)
}
@ -102,7 +102,7 @@ export default {
},
changeAccount (index) {
const account = this.samlAccounts[index]
api('listAndSwitchSamlAccount', {}, 'POST', {
postAPI('listAndSwitchSamlAccount', {
userid: account.userId,
domainid: account.domainId
}).then(response => {

View File

@ -71,7 +71,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import CreateMenu from './CreateMenu'
import ExternalLink from './ExternalLink'
import HeaderNotice from './HeaderNotice'
@ -143,7 +143,7 @@ export default {
this.image = this.$store.getters.avatar
resolve(this.image)
}
api('listUsers', {
getAPI('listUsers', {
id: id,
showicon: true
}).then(json => {

View File

@ -128,7 +128,7 @@ import { triggerWindowResizeEvent } from '@/utils/util'
import { mapState, mapActions } from 'vuex'
import { mixin, mixinDevice } from '@/utils/mixin.js'
import { isAdmin } from '@/role'
import { api } from '@/api'
import { getAPI } from '@/api'
import Drawer from '@/components/widgets/Drawer'
import Setting from '@/components/view/Setting.vue'
@ -260,7 +260,7 @@ export default {
this.$store.commit('SET_COUNT_NOTIFY', 0)
},
checkShutdown () {
api('readyForShutdown', { managementserverid: this.$store.getters.msId }).then(json => {
getAPI('readyForShutdown', { managementserverid: this.$store.getters.msId }).then(json => {
this.$store.dispatch('SetShutdownTriggered', json.readyforshutdownresponse.readyforshutdown.shutdowntriggered || false)
this.$store.dispatch('SetMaintenanceInitiated', json.readyforshutdownresponse.readyforshutdown.maintenanceinitiated || false)
})

View File

@ -101,7 +101,7 @@
</template>
<script>
import { api } from '@/api'
import { postAPI } from '@/api'
import Console from '@/components/widgets/Console'
export default {
@ -194,7 +194,7 @@ export default {
const action = actionBadge[i]
arrAsync.push(new Promise((resolve, reject) => {
api(action.api, action.param).then(json => {
postAPI(action.api, action.param).then(json => {
let responseJsonName
const response = {}

View File

@ -119,7 +119,7 @@
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
export default {
name: 'AnnotationsTab',
@ -217,7 +217,7 @@ export default {
}
this.loadingAnnotations = true
this.notes = []
api('listAnnotations', { entityid: this.resource.id, entitytype: this.annotationType, annotationfilter: 'all', page: this.page, pagesize: this.pageSize }).then(json => {
getAPI('listAnnotations', { entityid: this.resource.id, entitytype: this.annotationType, annotationfilter: 'all', page: this.page, pagesize: this.pageSize }).then(json => {
if (json.listannotationsresponse && json.listannotationsresponse.annotation) {
this.notes = json.listannotationsresponse.annotation
this.itemCount = json.listannotationsresponse.count
@ -246,7 +246,7 @@ export default {
args.entitytype = this.annotationType
args.annotation = this.annotation
args.adminsonly = this.annotationAdminsOnly
api('addAnnotation', args).catch(error => {
postAPI('addAnnotation', args).catch(error => {
this.$notifyError(error)
}).finally(e => {
this.getAnnotations()
@ -258,7 +258,7 @@ export default {
this.loadingAnnotations = true
const args = {}
args.id = annotation.id
api('removeAnnotation', args).catch(error => {
postAPI('removeAnnotation', args).catch(error => {
this.$notifyError(error)
}).finally(e => {
this.getAnnotations()
@ -270,7 +270,7 @@ export default {
id: annotation.id,
adminsonly: !annotation.adminsonly
}
api('updateAnnotationVisibility', args).catch(error => {
postAPI('updateAnnotationVisibility', args).catch(error => {
this.$notifyError(error)
}).finally(e => {
this.getAnnotations()

View File

@ -53,7 +53,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import DedicateModal from './DedicateModal'
export default {
@ -124,7 +124,7 @@ export default {
}
},
fetchDedicatedZones () {
api('listDedicatedZones', {
getAPI('listDedicatedZones', {
zoneid: this.resource.id
}).then(response => {
if (response?.listdedicatedzonesresponse?.dedicatedzone?.length > 0) {
@ -136,7 +136,7 @@ export default {
})
},
fetchDedicatedPods () {
api('listDedicatedPods', {
getAPI('listDedicatedPods', {
podid: this.resource.id
}).then(response => {
if (response?.listdedicatedpodsresponse?.dedicatedpod?.length > 0) {
@ -148,7 +148,7 @@ export default {
})
},
fetchDedicatedClusters () {
api('listDedicatedClusters', {
getAPI('listDedicatedClusters', {
clusterid: this.resource.id
}).then(response => {
if (response?.listdedicatedclustersresponse?.dedicatedcluster?.length > 0) {
@ -160,7 +160,7 @@ export default {
})
},
fetchDedicatedHosts () {
api('listDedicatedHosts', {
getAPI('listDedicatedHosts', {
hostid: this.resource.id
}).then(response => {
if (response?.listdedicatedhostsresponse?.dedicatedhost?.length > 0) {
@ -172,7 +172,7 @@ export default {
})
},
releaseDedidcatedZone () {
api('releaseDedicatedZone', {
postAPI('releaseDedicatedZone', {
zoneid: this.resource.id
}).then(response => {
this.$pollJob({
@ -195,7 +195,7 @@ export default {
})
},
releaseDedidcatedPod () {
api('releaseDedicatedPod', {
postAPI('releaseDedicatedPod', {
podid: this.resource.id
}).then(response => {
this.$pollJob({
@ -218,7 +218,7 @@ export default {
})
},
releaseDedidcatedCluster () {
api('releaseDedicatedCluster', {
postAPI('releaseDedicatedCluster', {
clusterid: this.resource.id
}).then(response => {
this.$pollJob({
@ -241,7 +241,7 @@ export default {
})
},
releaseDedidcatedHost () {
api('releaseDedicatedHost', {
postAPI('releaseDedicatedHost', {
hostid: this.resource.id
}).then(response => {
this.$pollJob({

View File

@ -60,7 +60,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
export default {
name: 'DedicateDomain',
@ -90,7 +90,7 @@ export default {
methods: {
fetchData () {
this.domainsLoading = true
api('listDomains', {
getAPI('listDomains', {
listAll: true,
details: 'min'
}).then(response => {
@ -107,7 +107,7 @@ export default {
})
},
fetchAccounts () {
api('listAccounts', {
getAPI('listAccounts', {
domainid: this.domainId
}).then(response => {
this.accountsList = response.listaccountsresponse.account || []

View File

@ -37,7 +37,7 @@
</template>
<script>
import { api } from '@/api'
import { postAPI } from '@/api'
import DedicateDomain from './DedicateDomain'
export default {
@ -92,7 +92,7 @@ export default {
this.domainError = true
return
}
api('dedicateZone', {
postAPI('dedicateZone', {
zoneId: this.resource.id,
domainId: this.domainId,
account: this.dedicatedAccount
@ -134,7 +134,7 @@ export default {
this.domainError = true
return
}
api('dedicatePod', {
postAPI('dedicatePod', {
podId: this.resource.id,
domainId: this.domainId,
account: this.dedicatedAccount
@ -176,7 +176,7 @@ export default {
this.domainError = true
return
}
api('dedicateCluster', {
postAPI('dedicateCluster', {
clusterId: this.resource.id,
domainId: this.domainId,
account: this.dedicatedAccount
@ -218,7 +218,7 @@ export default {
this.domainError = true
return
}
api('dedicateHost', {
postAPI('dedicateHost', {
hostId: this.resource.id,
domainId: this.domainId,
account: this.dedicatedAccount

View File

@ -128,7 +128,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import TooltipButton from '@/components/widgets/TooltipButton'
export default {
@ -209,11 +209,11 @@ export default {
return { name: k, value: resource.details[k], edit: false }
})
}
api('listDetailOptions', { resourcetype: this.resourceType, resourceid: resource.id }).then(json => {
getAPI('listDetailOptions', { resourcetype: this.resourceType, resourceid: resource.id }).then(json => {
this.detailOptions = json.listdetailoptionsresponse.detailoptions.details
})
this.disableSettings = (this.$route.meta.name === 'vm' && resource.state !== 'Stopped')
api('listTemplates', { templatefilter: 'all', id: resource.templateid }).then(json => {
getAPI('listTemplates', { templatefilter: 'all', id: resource.templateid }).then(json => {
this.deployasistemplate = json.listtemplatesresponse.template[0].deployasis
})
},
@ -291,7 +291,7 @@ export default {
var params = { id: this.resource.id }
params = Object.assign(params, this.getDetailsParam(this.details))
this.loading = true
api(apiName, params).then(json => {
postAPI(apiName, params).then(json => {
var details = {}
if (this.resourceType === 'UserVm' && json.updatevirtualmachineresponse.virtualmachine.details) {
details = json.updatevirtualmachineresponse.virtualmachine.details

View File

@ -48,7 +48,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import { genericCompare } from '@/utils/sort.js'
import ListView from '@/components/view/ListView'
@ -127,7 +127,7 @@ export default {
listall: true
}
this.tabLoading = true
api('listEvents', params).then(json => {
getAPI('listEvents', params).then(json => {
this.events = []
this.totalCount = json?.listeventsresponse?.count || 0
this.events = json?.listeventsresponse?.event || []

View File

@ -75,7 +75,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
export default {
name: 'ImageStoreSelector',
@ -141,7 +141,7 @@ export default {
page: this.page,
pagesize: this.pageSize
}
api('listImageStores', params).then(response => {
getAPI('listImageStores', params).then(response => {
this.imageStores = response.listimagestoresresponse.imagestore || []
this.totalCount = response.listimagestoresresponse.count
}).catch(error => {

View File

@ -900,7 +900,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { createPathBasedOnVmType } from '@/utils/plugins'
import { validateLinks } from '@/utils/links'
import Console from '@/components/widgets/Console'
@ -1071,7 +1071,7 @@ export default {
fetchOsCategoryAndIcon () {
const osId = this.resource.guestosid || this.resource.ostypeid
if (osId && 'listOsTypes' in this.$store.getters.apis) {
api('listOsTypes', { id: osId }).then(json => {
getAPI('listOsTypes', { id: osId }).then(json => {
this.osCategoryId = json?.listostypesresponse?.ostype?.[0]?.oscategoryid || null
if (this.osCategoryId) {
this.fetchResourceIcon(this.osCategoryId, 'guestoscategory')
@ -1120,7 +1120,7 @@ export default {
},
fetchAccount () {
return new Promise((resolve, reject) => {
api('listAccounts', {
getAPI('listAccounts', {
name: this.resource.account,
domainid: this.resource.domainid,
showicon: true
@ -1135,7 +1135,7 @@ export default {
fetchResourceIcon (resourceid, type) {
if (resourceid) {
return new Promise((resolve, reject) => {
api('listResourceIcon', {
getAPI('listResourceIcon', {
resourceids: resourceid,
resourcetype: type
}).then(json => {
@ -1173,7 +1173,7 @@ export default {
if (!('getUserKeys' in this.$store.getters.apis)) {
return
}
api('getUserKeys', { id: this.resource.id }).then(json => {
getAPI('getUserKeys', { id: this.resource.id }).then(json => {
this.showKeys = true
this.newResource.secretkey = json.getuserkeysresponse.userkeys.secretkey
if (!this.isAdmin()) {
@ -1196,7 +1196,7 @@ export default {
if (this.$route.meta.name === 'project') {
params.projectid = this.resource.id
}
api('listTags', params).then(json => {
getAPI('listTags', params).then(json => {
if (json.listtagsresponse && json.listtagsresponse.tag) {
this.tags = json.listtagsresponse.tag
}
@ -1231,7 +1231,7 @@ export default {
args.resourcetype = this.resourceType
args['tags[0].key'] = this.inputKey
args['tags[0].value'] = this.inputValue
api('createTags', args).then(json => {
postAPI('createTags', args).then(json => {
}).finally(e => {
this.getTags()
})
@ -1247,7 +1247,7 @@ export default {
args.resourcetype = this.resourceType
args['tags[0].key'] = tag.key
args['tags[0].value'] = tag.value
api('deleteTags', args).then(json => {
postAPI('deleteTags', args).then(json => {
}).finally(e => {
this.getTags()
})

View File

@ -63,7 +63,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import VolumeStoragePoolSelectForm from '@/components/view/VolumeStoragePoolSelectForm'
export default {
@ -168,7 +168,7 @@ export default {
fetchVolumes () {
this.volumesLoading = true
this.volumes = []
api('listVolumes', {
getAPI('listVolumes', {
listAll: true,
virtualmachineid: this.resource.id
}).then(response => {

View File

@ -82,7 +82,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import { mixinDevice } from '@/utils/mixin.js'
import Status from '@/components/widgets/Status'
@ -177,7 +177,7 @@ export default {
params.listall = true
params.response = 'json'
params.details = 'min'
api(this.apiName, params).then(json => {
getAPI(this.apiName, params).then(json => {
var responseName
var objectName
for (const key in json) {

View File

@ -613,7 +613,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import OsLogo from '@/components/widgets/OsLogo'
import Status from '@/components/widgets/Status'
import QuickView from '@/components/view/QuickView'
@ -803,7 +803,7 @@ export default {
this.$router.push({ name: 'dashboard' })
},
saveValue (record) {
api('updateConfiguration', {
postAPI('updateConfiguration', {
name: record.name,
value: this.editableValue
}).then(json => {
@ -827,7 +827,7 @@ export default {
})
},
resetConfig (item) {
api('resetConfiguration', {
postAPI('resetConfiguration', {
name: item.name
}).then(() => {
this.$messageConfigSuccess(`${this.$t('label.setting')} ${item.name} ${this.$t('label.reset.config.value')}`, item)
@ -885,7 +885,7 @@ export default {
const apiString = this.getUpdateApi()
return new Promise((resolve, reject) => {
api(apiString, {
postAPI(apiString, {
id,
sortKey: index
}).then((response) => {
@ -1024,7 +1024,7 @@ export default {
}
},
updateAdminsOnly (e) {
api('updateAnnotationVisibility', {
postAPI('updateAnnotationVisibility', {
id: e.target.value,
adminsonly: e.target.checked
}).finally(() => {
@ -1081,7 +1081,7 @@ export default {
},
getUsageTypes () {
if (this.$route.path.split('/')[1] === 'usage') {
api('listUsageTypes').then(json => {
getAPI('listUsageTypes').then(json => {
if (json && json.listusagetypesresponse && json.listusagetypesresponse.usagetype) {
this.usageTypes = json.listusagetypesresponse.usagetype.map(x => {
return {

View File

@ -70,7 +70,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
export default {
name: 'NicNetworkSelectForm',
@ -151,7 +151,7 @@ export default {
domainid: this.$store.getters.project && this.$store.getters.project.id ? null : this.$store.getters.userInfo.domainid,
account: this.$store.getters.project && this.$store.getters.project.id ? null : this.$store.getters.userInfo.account
}
api('listNetworks', params).then(response => {
getAPI('listNetworks', params).then(response => {
this.networks = response.listnetworksresponse.network || []
this.totalCount = response.listnetworksresponse.count
}).catch(error => {

View File

@ -75,7 +75,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import _ from 'lodash'
export default {
@ -228,7 +228,7 @@ export default {
listResourceLimits (params) {
return new Promise((resolve, reject) => {
let dataResource = []
api('listResourceLimits', params).then(json => {
getAPI('listResourceLimits', params).then(json => {
if (json.listresourcelimitsresponse.resourcelimit) {
dataResource = json.listresourcelimitsresponse.resourcelimit
dataResource.sort((a, b) => a.resourcetype - b.resourcetype)
@ -251,7 +251,7 @@ export default {
},
updateResourceLimit (params) {
return new Promise((resolve, reject) => {
api('updateResourceLimit', params).then(json => {
postAPI('updateResourceLimit', params).then(json => {
resolve()
}).catch(error => {
reject(error)

View File

@ -68,7 +68,7 @@
import DetailsTab from '@/components/view/DetailsTab'
import InfoCard from '@/components/view/InfoCard'
import ResourceLayout from '@/layouts/ResourceLayout'
import { api } from '@/api'
import { getAPI } from '@/api'
import { mixinDevice } from '@/utils/mixin.js'
export default {
@ -137,7 +137,7 @@ export default {
methods: {
fetchData () {
if (this.resource.associatednetworkid) {
api('listNetworks', { id: this.resource.associatednetworkid, listall: true }).then(response => {
getAPI('listNetworks', { id: this.resource.associatednetworkid, listall: true }).then(response => {
if (response && response.listnetworksresponse && response.listnetworksresponse.network) {
this.networkService = response.listnetworksresponse.network[0]
} else {

View File

@ -161,7 +161,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI } from '@/api'
import { isAdmin } from '@/role'
import TooltipButton from '@/components/widgets/TooltipButton'
import ResourceIcon from '@/components/view/ResourceIcon'
@ -785,7 +785,7 @@ export default {
},
fetchZones (searchKeyword) {
return new Promise((resolve, reject) => {
api('listZones', { showicon: true, keyword: searchKeyword }).then(json => {
getAPI('listZones', { showicon: true, keyword: searchKeyword }).then(json => {
const zones = json.listzonesresponse.zone
resolve({
type: 'zoneid',
@ -798,7 +798,7 @@ export default {
},
fetchDomains (searchKeyword) {
return new Promise((resolve, reject) => {
api('listDomains', { listAll: true, details: 'min', showicon: true, keyword: searchKeyword }).then(json => {
getAPI('listDomains', { listAll: true, details: 'min', showicon: true, keyword: searchKeyword }).then(json => {
const domain = json.listdomainsresponse.domain
resolve({
type: 'domainid',
@ -815,7 +815,7 @@ export default {
if (this.form.domainid) {
params.domainid = this.form.domainid
}
api('listAccounts', params).then(json => {
getAPI('listAccounts', params).then(json => {
let account = json?.listaccountsresponse?.account || []
if (this.form.domainid) {
account = account.filter(a => a.domainid === this.form.domainid)
@ -831,7 +831,7 @@ export default {
},
fetchHypervisors () {
return new Promise((resolve, reject) => {
api('listHypervisors').then(json => {
getAPI('listHypervisors').then(json => {
const hypervisor = json.listhypervisorsresponse.hypervisor.map(a => { return { id: a.name, name: a.name } })
resolve({
type: 'hypervisor',
@ -844,7 +844,7 @@ export default {
},
fetchImageStores (searchKeyword) {
return new Promise((resolve, reject) => {
api('listImageStores', { listAll: true, showicon: true, keyword: searchKeyword }).then(json => {
getAPI('listImageStores', { listAll: true, showicon: true, keyword: searchKeyword }).then(json => {
const imageStore = json.listimagestoresresponse.imagestore
resolve({
type: 'imagestoreid',
@ -857,7 +857,7 @@ export default {
},
fetchStoragePools (searchKeyword) {
return new Promise((resolve, reject) => {
api('listStoragePools', { listAll: true, showicon: true, keyword: searchKeyword }).then(json => {
getAPI('listStoragePools', { listAll: true, showicon: true, keyword: searchKeyword }).then(json => {
const storagePool = json.liststoragepoolsresponse.storagepool
resolve({
type: 'storageid',
@ -870,7 +870,7 @@ export default {
},
fetchPods (searchKeyword) {
return new Promise((resolve, reject) => {
api('listPods', { keyword: searchKeyword }).then(json => {
getAPI('listPods', { keyword: searchKeyword }).then(json => {
const pods = json.listpodsresponse.pod
resolve({
type: 'podid',
@ -883,7 +883,7 @@ export default {
},
fetchClusters (searchKeyword) {
return new Promise((resolve, reject) => {
api('listClusters', { keyword: searchKeyword }).then(json => {
getAPI('listClusters', { keyword: searchKeyword }).then(json => {
const clusters = json.listclustersresponse.cluster
resolve({
type: 'clusterid',
@ -896,7 +896,7 @@ export default {
},
fetchInstanceGroups (searchKeyword) {
return new Promise((resolve, reject) => {
api('listInstanceGroups', { listAll: true, keyword: searchKeyword }).then(json => {
getAPI('listInstanceGroups', { listAll: true, keyword: searchKeyword }).then(json => {
const instancegroups = json.listinstancegroupsresponse.instancegroup
resolve({
type: 'groupid',
@ -909,7 +909,7 @@ export default {
},
fetchServiceOfferings (searchKeyword) {
return new Promise((resolve, reject) => {
api('listServiceOfferings', { listAll: true, keyword: searchKeyword }).then(json => {
getAPI('listServiceOfferings', { listAll: true, keyword: searchKeyword }).then(json => {
const serviceOfferings = json.listserviceofferingsresponse.serviceoffering
resolve({
type: 'serviceofferingid',
@ -922,7 +922,7 @@ export default {
},
fetchDiskOfferings (searchKeyword) {
return new Promise((resolve, reject) => {
api('listDiskOfferings', { listAll: true, keyword: searchKeyword }).then(json => {
getAPI('listDiskOfferings', { listAll: true, keyword: searchKeyword }).then(json => {
const diskOfferings = json.listdiskofferingsresponse.diskoffering
resolve({
type: 'diskofferingid',
@ -935,7 +935,7 @@ export default {
},
fetchNetworks (searchKeyword) {
return new Promise((resolve, reject) => {
api('listNetworks', { listAll: true, keyword: searchKeyword }).then(json => {
getAPI('listNetworks', { listAll: true, keyword: searchKeyword }).then(json => {
const networks = json.listnetworksresponse.network
resolve({
type: 'networkid',
@ -956,7 +956,7 @@ export default {
})
} else {
return new Promise((resolve, reject) => {
api('listAlertTypes').then(json => {
getAPI('listAlertTypes').then(json => {
const alerttypes = json.listalerttypesresponse.alerttype.map(a => { return { id: a.alerttypeid, name: a.name } })
this.alertTypes = alerttypes
resolve({
@ -979,7 +979,7 @@ export default {
})
} else {
return new Promise((resolve, reject) => {
api('listAffinityGroupTypes').then(json => {
getAPI('listAffinityGroupTypes').then(json => {
const alerttypes = json.listaffinitygrouptypesresponse.affinityGroupType.map(a => {
let name = a.type
if (a.type === 'host anti-affinity') {
@ -1006,7 +1006,7 @@ export default {
},
fetchVolumes (searchKeyword) {
return new Promise((resolve, reject) => {
api('listvolumes', { listAll: true, isencrypted: searchKeyword }).then(json => {
getAPI('listvolumes', { listAll: true, isencrypted: searchKeyword }).then(json => {
const volumes = json.listvolumesresponse.volume
resolve({
type: 'isencrypted',
@ -1019,7 +1019,7 @@ export default {
},
fetchManagementServers (searchKeyword) {
return new Promise((resolve, reject) => {
api('listManagementServers', { listAll: true, keyword: searchKeyword }).then(json => {
getAPI('listManagementServers', { listAll: true, keyword: searchKeyword }).then(json => {
const managementservers = json.listmanagementserversresponse.managementserver
resolve({
type: 'managementserverid',
@ -1032,7 +1032,7 @@ export default {
},
fetchOsCategories (searchKeyword) {
return new Promise((resolve, reject) => {
api('listOsCategories', { showicon: true, keyword: searchKeyword }).then(json => {
getAPI('listOsCategories', { showicon: true, keyword: searchKeyword }).then(json => {
const osCategories = json.listoscategoriesresponse.oscategory
resolve({
type: 'oscategoryid',
@ -1334,7 +1334,7 @@ export default {
},
fetchUsageTypes () {
return new Promise((resolve, reject) => {
api('listUsageTypes')
getAPI('listUsageTypes')
.then(json => {
const usageTypes = json.listusagetypesresponse.usagetype.map(entry => {
return {

View File

@ -31,7 +31,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import TooltipButton from '@/components/widgets/TooltipButton'
import ConfigurationTable from '@/views/setting/ConfigurationTable.vue'
@ -125,7 +125,7 @@ export default {
if (this.filter) {
params.keyword = this.filter
}
api('listConfigurations', params).then(response => {
getAPI('listConfigurations', params).then(response => {
this.items = response.listconfigurationsresponse.configuration
}).catch(error => {
console.error(error)

View File

@ -249,7 +249,7 @@
</div>
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import moment from 'moment'
import 'chartjs-adapter-moment'
import DateTimeFilter from './DateTimeFilter'
@ -455,7 +455,7 @@ export default {
if (this.endDate) {
params.endDate = moment(this.endDate).format()
}
api(this.resourceStatsApi, params).then(response => {
getAPI(this.resourceStatsApi, params).then(response => {
this.handleStatsResponse(response)
}).catch(error => {
this.$notifyError(error)

View File

@ -96,7 +96,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
export default {
name: 'VolumeStoragePoolSelector',
@ -184,7 +184,7 @@ export default {
fetchStoragePools () {
this.loading = true
if (this.suitabilityEnabled) {
api('findStoragePoolsForMigration', {
getAPI('findStoragePoolsForMigration', {
id: this.resource.id,
keyword: this.searchQuery,
page: this.page,
@ -207,7 +207,7 @@ export default {
if (this.clusterId) {
params.clusterid = this.clusterId
}
api('listStoragePools', params).then(response => {
getAPI('listStoragePools', params).then(response => {
this.storagePools = response.liststoragepoolsresponse.storagepool || []
this.totalCount = response.liststoragepoolsresponse.count
}).catch(error => {

View File

@ -88,7 +88,7 @@
</template>
<script>
import { api } from '@/api'
import { postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'
import Status from '@/components/widgets/Status'
@ -191,7 +191,7 @@ export default {
if (this.secretKey) {
params.secretKey = this.secretKey
}
api('executeWebhookDelivery', params).then(response => {
postAPI('executeWebhookDelivery', params).then(response => {
this.response = response.executewebhookdeliveryresponse.webhookdelivery
this.$emit('update-success', response.success)
}).catch(error => {

View File

@ -92,7 +92,7 @@
<script>
import store from '@/store'
import { api } from '@/api'
import { postAPI } from '@/api'
import DetailsTab from '@/components/view/DetailsTab'
import ResourceView from '@/components/view/ResourceView'
import ResourceLayout from '@/layouts/ResourceLayout'
@ -268,7 +268,7 @@ export default {
}
return new Promise(resolve => {
api(this.apiChildren, params).then(json => {
postAPI(this.apiChildren, params).then(json => {
const dataResponse = this.getResponseJsonData(json)
const dataGenerate = this.generateTreeData(dataResponse)
treeNode.dataRef.children = dataGenerate
@ -390,7 +390,7 @@ export default {
this.treeViewData = []
this.loadingSearch = true
this.$emit('change-tree-store', {})
api(this.apiList, params).then(json => {
postAPI(this.apiList, params).then(json => {
const listDomains = this.getResponseJsonData(json)
this.treeVerticalData = this.treeVerticalData.concat(listDomains)
@ -454,7 +454,7 @@ export default {
params.pageSize = 1
this.detailLoading = true
api(apiName, params).then(json => {
postAPI(apiName, params).then(json => {
const jsonResponse = this.getResponseJsonData(json)
resolve(jsonResponse[0])
}).catch(() => {

View File

@ -118,7 +118,7 @@
</div>
</template>
<script>
import { api } from '@/api'
import { postAPI } from '@/api'
import eventBus from '@/config/eventBus'
export default {
@ -247,7 +247,7 @@ export default {
newImage.src = await this.getResourceIcon()
base64Canvas = await this.getNewImage(newImage)
}
api('uploadResourceIcon', {}, 'POST', {
postAPI('uploadResourceIcon', {
resourceids: resourceid,
resourcetype: resourceType,
base64image: base64Canvas
@ -279,7 +279,7 @@ export default {
deleteIcon () {
const resourceType = this.$getResourceType()
const resourceid = this.resource.id
api('deleteResourceIcon', {
postAPI('deleteResourceIcon', {
resourcetype: resourceType,
resourceids: resourceid
}).then(json => {

View File

@ -35,7 +35,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
export default {
props: {
@ -65,7 +65,7 @@ export default {
methods: {
fetchData () {
if (!this.resource.id) return
api('listVmwareDcs', {
getAPI('listVmwareDcs', {
zoneid: this.resource.id
}).then(response => {
if (response.listvmwaredcsresponse.VMwareDC && response.listvmwaredcsresponse.VMwareDC.length > 0) {

View File

@ -49,7 +49,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import Status from '@/components/widgets/Status'
export default {
@ -132,7 +132,7 @@ export default {
}
},
getVolumes () {
api('listVolumes', { listall: true, listsystemvms: true, virtualmachineid: this.vm.id }).then(json => {
getAPI('listVolumes', { listall: true, listsystemvms: true, virtualmachineid: this.vm.id }).then(json => {
this.volumes = json.listvolumesresponse.volume
if (this.volumes) {
this.volumes.sort((a, b) => { return a.deviceid - b.deviceid })

View File

@ -112,7 +112,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { isAdmin } from '@/role'
import { genericCompare } from '@/utils/sort.js'
import moment from 'moment'
@ -253,7 +253,7 @@ export default {
params.eventtype = this.searchParams.eventtype
}
this.tabLoading = true
api('listWebhookDeliveries', params).then(json => {
getAPI('listWebhookDeliveries', params).then(json => {
this.deliveries = []
this.totalCount = json?.listwebhookdeliveriesresponse?.count || 0
this.deliveries = json?.listwebhookdeliveriesresponse?.webhookdelivery || []
@ -321,7 +321,7 @@ export default {
id: id
}
promises.push(new Promise((resolve, reject) => {
api('deleteWebhookDelivery', params).then(json => {
postAPI('deleteWebhookDelivery', params).then(json => {
return resolve(id)
}).catch(error => {
return reject(error)
@ -344,7 +344,7 @@ export default {
webhookid: this.resource.id
}
this.tabLoading = true
api('deleteWebhookDelivery', params).then(json => {
postAPI('deleteWebhookDelivery', params).then(json => {
this.$message.success(this.$t('message.success.clear.webhook.deliveries'))
this.fetchData()
}).catch(error => {
@ -370,7 +370,7 @@ export default {
id: item.id
}
this.tabLoading = true
api('executeWebhookDelivery', params).then(json => {
postAPI('executeWebhookDelivery', params).then(json => {
this.$message.success(this.$t('message.success.redeliver.webhook.delivery'))
this.fetchData()
}).catch(error => {
@ -396,7 +396,7 @@ export default {
id: item.id
}
this.tabLoading = true
api('deleteWebhookDelivery', params).then(json => {
postAPI('deleteWebhookDelivery', params).then(json => {
const message = `${this.$t('message.success.delete')} ${this.$t('label.webhook.delivery')}`
this.$message.success(message)
this.fetchData()

View File

@ -28,7 +28,7 @@
<script>
import { SERVER_MANAGER } from '@/store/mutation-types'
import { api } from '@/api'
import { postAPI } from '@/api'
export default {
name: 'Console',
@ -52,7 +52,7 @@ export default {
consoleUrl () {
const params = {}
params.virtualmachineid = this.resource.id
api('createConsoleEndpoint', params).then(json => {
postAPI('createConsoleEndpoint', params).then(json => {
this.url = (json && json.createconsoleendpointresponse) ? json.createconsoleendpointresponse.consoleendpoint.url : '#/exception/404'
if (json.createconsoleendpointresponse.consoleendpoint.success) {
if (this.copyUrlToClipboard) {

View File

@ -88,7 +88,7 @@
</template>
<script>
import { api } from '@/api'
import { postAPI } from '@/api'
import ResourceIcon from '@/components/view/ResourceIcon'
export default {
@ -191,7 +191,7 @@ export default {
if (this.showIcon) {
params.showicon = true
}
api(this.api, params).then(json => {
postAPI(this.api, params).then(json => {
const response = json[this.api.toLowerCase() + 'response'] || {}
if (this.totalCount === null) {
this.totalCount = response.count || 0

View File

@ -29,7 +29,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
export default {
name: 'OsLogo',
@ -79,7 +79,7 @@ export default {
return
}
this.name = 'linux'
api('listOsTypes', { id: osId }).then(json => {
getAPI('listOsTypes', { id: osId }).then(json => {
if (json && json.listostypesresponse && json.listostypesresponse.ostype && json.listostypesresponse.ostype.length > 0) {
this.discoverOsLogo(json.listostypesresponse.ostype[0].description)
} else {

View File

@ -23,7 +23,7 @@ import semver from 'semver'
import { vueProps } from '@/vue-app'
import router from '@/router'
import store from '@/store'
import { oauthlogin, login, logout, api } from '@/api'
import { oauthlogin, login, logout, getAPI } from '@/api'
import { i18n } from '@/locales'
import { axios } from '../../utils/request'
import { getParsedVersion } from '@/utils/util'
@ -331,7 +331,7 @@ const user = {
commit('SET_MS_ID', msId)
// Ensuring we get the user info so that store.getters.user is never empty when the page is freshly loaded
api('listUsers', { id: Cookies.get('userid'), listall: true }).then(response => {
getAPI('listUsers', { id: Cookies.get('userid'), listall: true }).then(response => {
const result = response.listusersresponse.user[0]
commit('SET_INFO', result)
commit('SET_NAME', result.firstname + ' ' + result.lastname)
@ -342,13 +342,13 @@ const user = {
})
} else if (store.getters.loginFlag) {
const hide = message.loading(i18n.global.t('message.discovering.feature'), 0)
api('listZones').then(json => {
getAPI('listZones').then(json => {
const zones = json.listzonesresponse.zone || []
commit('SET_ZONES', zones)
}).catch(error => {
reject(error)
})
api('listApis').then(response => {
getAPI('listApis').then(response => {
const apis = {}
const apiList = response.listapisresponse.api
for (var idx = 0; idx < apiList.length; idx++) {
@ -375,7 +375,7 @@ const user = {
reject(error)
})
api('listNetworks', { restartrequired: true, forvpc: false }).then(response => {
getAPI('listNetworks', { restartrequired: true, forvpc: false }).then(response => {
if (response.listnetworksresponse.count > 0) {
store.dispatch('AddHeaderNotice', {
key: 'NETWORK_RESTART_REQUIRED',
@ -389,7 +389,7 @@ const user = {
}
}).catch(ignored => {})
api('listVPCs', { restartrequired: true }).then(response => {
getAPI('listVPCs', { restartrequired: true }).then(response => {
if (response.listvpcsresponse.count > 0) {
store.dispatch('AddHeaderNotice', {
key: 'VPC_RESTART_REQUIRED',
@ -404,7 +404,7 @@ const user = {
}).catch(ignored => {})
}
api('listUsers', { id: Cookies.get('userid'), showicon: true }).then(response => {
getAPI('listUsers', { id: Cookies.get('userid'), showicon: true }).then(response => {
const result = response.listusersresponse.user[0]
commit('SET_INFO', result)
commit('SET_NAME', result.firstname + ' ' + result.lastname)
@ -414,7 +414,7 @@ const user = {
reject(error)
})
api(
getAPI(
'listNetworkServiceProviders',
{ name: 'SecurityGroupProvider', state: 'Enabled' }
).then(response => {
@ -423,7 +423,7 @@ const user = {
}).catch(ignored => {
})
api('listCapabilities').then(response => {
getAPI('listCapabilities').then(response => {
const result = response.listcapabilitiesresponse.capability
commit('SET_FEATURES', result)
if (result && result.defaultuipagesize) {
@ -439,14 +439,14 @@ const user = {
reject(error)
})
api('listLdapConfigurations').then(response => {
getAPI('listLdapConfigurations').then(response => {
const ldapEnable = (response.ldapconfigurationresponse.count > 0)
commit('SET_LDAP', ldapEnable)
}).catch(error => {
reject(error)
})
api('cloudianIsEnabled').then(response => {
getAPI('cloudianIsEnabled').then(response => {
const cloudian = response.cloudianisenabledresponse.cloudianisenabled || {}
commit('SET_CLOUDIAN', cloudian)
}).catch(ignored => {
@ -519,7 +519,7 @@ const user = {
},
ProjectView ({ commit }, projectid) {
return new Promise((resolve, reject) => {
api('listApis', { projectid: projectid }).then(response => {
getAPI('listApis', { projectid: projectid }).then(response => {
const apis = {}
const apiList = response.listapisresponse.api
for (var idx = 0; idx < apiList.length; idx++) {
@ -544,7 +544,7 @@ const user = {
},
RefreshFeatures ({ commit }) {
return new Promise((resolve, reject) => {
api('listCapabilities').then(response => {
getAPI('listCapabilities').then(response => {
const result = response.listcapabilitiesresponse.capability
resolve(result)
commit('SET_FEATURES', result)
@ -552,7 +552,7 @@ const user = {
reject(error)
})
api('listConfigurations', { name: 'hypervisor.custom.display.name' }).then(json => {
getAPI('listConfigurations', { name: 'hypervisor.custom.display.name' }).then(json => {
if (json.listconfigurationsresponse.configuration !== null) {
const config = json.listconfigurationsresponse.configuration[0]
commit('SET_CUSTOM_HYPERVISOR_NAME', config.value)
@ -564,7 +564,7 @@ const user = {
},
UpdateConfiguration ({ commit }) {
return new Promise((resolve, reject) => {
api('listLdapConfigurations').then(response => {
getAPI('listLdapConfigurations').then(response => {
const ldapEnable = (response.ldapconfigurationresponse.count > 0)
commit('SET_LDAP', ldapEnable)
}).catch(error => {

View File

@ -17,7 +17,7 @@
import _ from 'lodash'
import { i18n } from '@/locales'
import { api } from '@/api'
import { getAPI } from '@/api'
import { message, notification, Modal } from 'ant-design-vue'
import eventBus from '@/config/eventBus'
import store from '@/store'
@ -88,7 +88,7 @@ export const pollJobPlugin = {
})
options.originalPage = options.originalPage || this.$router.currentRoute.value.path
api('queryAsyncJobResult', { jobId }).then(json => {
getAPI('queryAsyncJobResult', { jobId }).then(json => {
const result = json.queryasyncjobresultresponse
eventBus.emit('update-job-details', { jobId, resourceId })
if (result.jobstatus === 1) {

View File

@ -457,7 +457,7 @@
<script>
import { ref, reactive, toRaw, h } from 'vue'
import { Button } from 'ant-design-vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { mixinDevice } from '@/utils/mixin.js'
import { genericCompare } from '@/utils/sort.js'
import { sourceToken } from '@/utils/request'
@ -731,7 +731,7 @@ export default {
if (!projectId || !projectId.length || projectId.length !== 36) {
return
}
api('listProjects', { id: projectId, listall: true, details: 'min' }).then(json => {
getAPI('listProjects', { id: projectId, listall: true, details: 'min' }).then(json => {
if (!json || !json.listprojectsresponse || !json.listprojectsresponse.project) return
const projects = json.listprojectsresponse.project
const project = json.listprojectsresponse.project[0]
@ -988,7 +988,7 @@ export default {
delete params.listall
}
api(this.apiName, params).then(json => {
postAPI(this.apiName, params).then(json => {
var responseName
var objectName
for (const key in json) {
@ -1019,7 +1019,7 @@ export default {
this.itemCount = apiItemCount
if (this.dataView && this.$route.path.includes('/zone/') && 'listVmwareDcs' in this.$store.getters.apis) {
api('listVmwareDcs', { zoneid: this.items[0].id }).then(response => {
getAPI('listVmwareDcs', { zoneid: this.items[0].id }).then(response => {
this.items[0].vmwaredc = response.listvmwaredcsresponse.VMwareDC
})
}
@ -1318,7 +1318,7 @@ export default {
if (showIcon) {
params.showicon = true
}
api(possibleApi, params).then(json => {
postAPI(possibleApi, params).then(json => {
param.loading = false
for (const obj in json) {
if (obj.includes('response')) {
@ -1488,7 +1488,7 @@ export default {
callGroupApi (params, resourceName) {
return new Promise((resolve, reject) => {
const action = this.currentAction
api(action.api, params).then(json => {
postAPI(action.api, params).then(json => {
resolve(this.handleResponse(json, resourceName, this.getDataIdentifier(params), action, false))
this.closeAction()
}).catch(error => {
@ -1653,13 +1653,8 @@ export default {
var hasJobId = false
this.actionLoading = true
let args = null
if (action.post) {
args = [action.api, {}, 'POST', params]
} else {
args = [action.api, params]
}
api(...args).then(json => {
const args = [action.api, params]
postAPI(...args).then(json => {
var response = this.handleResponse(json, resourceName, this.getDataIdentifier(params), action)
if (!response) {
this.fetchData()

View File

@ -98,7 +98,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { postAPI } from '@/api'
import store from '@/store'
import { SERVER_MANAGER } from '@/store/mutation-types'
import TranslationMenu from '@/components/header/TranslationMenu'
@ -159,7 +159,7 @@ export default {
if (!loginParams.domain) {
loginParams.domain = '/'
}
api('forgotPassword', {}, 'POST', loginParams)
postAPI('forgotPassword', loginParams)
.finally(() => {
this.$message.success(this.$t('message.forgot.password.success'))
this.$router.push({ path: '/login' }).catch(() => {})

View File

@ -196,7 +196,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import store from '@/store'
import { mapActions } from 'vuex'
import { sourceToken } from '@/utils/request'
@ -286,7 +286,7 @@ export default {
}
},
fetchData () {
api('listIdps').then(response => {
getAPI('listIdps').then(response => {
if (response) {
this.idps = response.listidpsresponse.idp || []
this.idps.sort(function (a, b) {
@ -297,7 +297,7 @@ export default {
this.form.idp = this.idps[0].id || ''
}
})
api('listOauthProvider', {}).then(response => {
getAPI('listOauthProvider', {}).then(response => {
if (response) {
const oauthproviders = response.listoauthproviderresponse.oauthprovider || []
oauthproviders.forEach(item => {
@ -315,7 +315,7 @@ export default {
this.socialLogin = this.googleprovider || this.githubprovider
}
})
api('forgotPassword', {}).then(response => {
postAPI('forgotPassword', {}).then(response => {
this.forgotPasswordEnabled = response.forgotpasswordresponse.enabled
}).catch((err) => {
if (err?.response?.data === null) {

View File

@ -124,7 +124,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { postAPI } from '@/api'
import store from '@/store'
import { SERVER_MANAGER } from '@/store/mutation-types'
import TranslationMenu from '@/components/header/TranslationMenu'
@ -200,7 +200,7 @@ export default {
loginParams.domain = '/'
}
api('resetPassword', {}, 'POST', loginParams)
postAPI('resetPassword', loginParams)
.then((res) => {
if (res?.resetpasswordresponse?.success) {
this.$message.success(this.$t('message.password.reset.success'))

View File

@ -65,7 +65,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import ResourceIcon from '@/components/view/ResourceIcon'
import OwnershipSelection from '@views/compute/wizard/OwnershipSelection'
@ -120,7 +120,7 @@ export default {
params.account = this.selectedAccount
params.ignoreproject = true
}
api('listNetworks', params).then(response => {
getAPI('listNetworks', params).then(response => {
this.networks = response.listnetworksresponse.network || []
}).catch(error => {
this.$notifyError(error)
@ -154,7 +154,7 @@ export default {
}
this.loading = true
api('assignVirtualMachine', {
postAPI('assignVirtualMachine', {
response: 'json',
virtualmachineid: this.resource.id,
domainid: this.selectedDomain,

View File

@ -55,7 +55,7 @@
</template>
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import _ from 'lodash'
export default {
@ -110,7 +110,7 @@ export default {
isofilter: isoFilter
}
return new Promise((resolve, reject) => {
api('listIsos', params).then((response) => {
getAPI('listIsos', params).then((response) => {
const isos = response.listisosresponse.iso || []
this.isos.push(...isos)
resolve(response)
@ -138,7 +138,7 @@ export default {
this.loading = true
const title = this.$t('label.action.attach.iso')
api('attachIso', params).then(json => {
postAPI('attachIso', params).then(json => {
const jobId = json.attachisoresponse.jobid
if (jobId) {
this.$pollJob({

View File

@ -323,7 +323,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import Status from '@/components/widgets/Status'
import TooltipButton from '@/components/widgets/TooltipButton'
import TooltipLabel from '@/components/widgets/TooltipLabel'
@ -425,7 +425,7 @@ export default {
methods: {
fetchInitData () {
this.loading = true
api('listAutoScaleVmGroups', {
getAPI('listAutoScaleVmGroups', {
listAll: true,
id: this.resource.id
}).then(response => {
@ -437,12 +437,12 @@ export default {
this.policy = this.policies?.[0]
this.selectedPolicyId = this.policy.id
}
api('listLoadBalancerRules', {
getAPI('listLoadBalancerRules', {
listAll: true,
id: lbruleid
}).then(response => {
const networkid = response.listloadbalancerrulesresponse?.loadbalancerrule?.[0]?.networkid
api('listNetworks', {
getAPI('listNetworks', {
listAll: true,
projectid: this.resource.projectid,
id: networkid
@ -450,7 +450,7 @@ export default {
const services = response.listnetworksresponse?.network?.[0]?.service
const index = services.map(svc => { return svc.name }).indexOf('Lb')
const provider = services[index].provider[0].name
api('listCounters', {
getAPI('listCounters', {
listAll: true,
provider: provider
}).then(response => {
@ -464,7 +464,7 @@ export default {
},
fetchData () {
this.loading = true
api('listAutoScalePolicies', {
getAPI('listAutoScalePolicies', {
listAll: true,
id: this.selectedPolicyId
}).then(response => {
@ -507,7 +507,7 @@ export default {
async pollJob (jobId) {
return new Promise(resolve => {
const asyncJobInterval = setInterval(() => {
api('queryAsyncJobResult', { jobId }).then(async json => {
getAPI('queryAsyncJobResult', { jobId }).then(async json => {
const result = json.queryasyncjobresultresponse
if (result.jobstatus === 0) {
return
@ -522,7 +522,7 @@ export default {
addCondition (params) {
this.loading = true
return new Promise((resolve, reject) => {
api('createCondition', params).then(async json => {
postAPI('createCondition', params).then(async json => {
this.$pollJob({
jobId: json.conditionresponse.jobid,
successMethod: (result) => {
@ -543,7 +543,7 @@ export default {
deleteCondition (conditionId) {
this.loading = true
return new Promise((resolve, reject) => {
api('deleteCondition', { id: conditionId }).then(response => {
postAPI('deleteCondition', { id: conditionId }).then(response => {
const jobId = response.deleteconditionresponse.jobid
this.$pollJob({
title: this.$t('label.action.delete.condition'),
@ -587,7 +587,7 @@ export default {
}
this.updateConditionModalLoading = true
api('updateCondition', {
postAPI('updateCondition', {
id: this.selectedCondition.id,
relationaloperator: this.updateConditionDetails.relationaloperator,
threshold: this.updateConditionDetails.threshold
@ -726,7 +726,7 @@ export default {
createAutoScalePolicy (params) {
this.loading = true
return new Promise((resolve, reject) => {
api('createAutoScalePolicy', params).then(async json => {
postAPI('createAutoScalePolicy', params).then(async json => {
this.$pollJob({
jobId: json.autoscalepolicyresponse.jobid,
successMethod: (result) => {
@ -760,7 +760,7 @@ export default {
}
return new Promise((resolve, reject) => {
api('updateAutoScalePolicy', {
postAPI('updateAutoScalePolicy', {
id: this.policy.id,
name: this.policy.name,
duration: this.policy.duration,
@ -790,7 +790,7 @@ export default {
this.loading = true
return new Promise((resolve, reject) => {
api('updateAutoScaleVmGroup', params).then(response => {
postAPI('updateAutoScaleVmGroup', params).then(response => {
this.$pollJob({
jobId: response.updateautoscalevmgroupresponse.jobid,
successMethod: (result) => {

View File

@ -297,7 +297,7 @@
<script>
import { ref, reactive, toRaw, nextTick } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { mixinForm } from '@/utils/mixin'
import Status from '@/components/widgets/Status'
import TooltipButton from '@/components/widgets/TooltipButton'
@ -445,7 +445,7 @@ export default {
fetchListTiers () {
this.tiers.loading = true
api('listNetworks', {
getAPI('listNetworks', {
account: this.resource.account,
domainid: this.resource.domainid,
supportedservices: 'Lb',
@ -462,7 +462,7 @@ export default {
this.lbRules = []
this.stickinessPolicies = []
api('listLoadBalancerRules', {
getAPI('listLoadBalancerRules', {
listAll: true,
id: this.resource.lbruleid,
page: this.page,
@ -488,7 +488,7 @@ export default {
fetchLBRuleInstances () {
for (const rule of this.lbRules) {
this.loading = true
api('listLoadBalancerRuleInstances', {
getAPI('listLoadBalancerRuleInstances', {
listAll: true,
lbvmips: true,
id: rule.id
@ -504,7 +504,7 @@ export default {
fetchLBStickinessPolicies () {
this.loading = true
this.lbRules.forEach(rule => {
api('listLBStickinessPolicies', {
getAPI('listLBStickinessPolicies', {
listAll: true,
lbruleid: rule.id
}).then(response => {
@ -519,7 +519,7 @@ export default {
fetchAutoScaleVMgroups () {
this.loading = true
this.lbRules.forEach(rule => {
api('listAutoScaleVmGroups', {
getAPI('listAutoScaleVmGroups', {
listAll: true,
lbruleid: rule.id
}).then(response => {
@ -565,7 +565,7 @@ export default {
this.tagsModalVisible = true
this.tags = []
this.selectedRule = id
api('listTags', {
getAPI('listTags', {
resourceId: id,
resourceType: 'LoadBalancer',
listAll: true
@ -586,7 +586,7 @@ export default {
const formRaw = toRaw(this.form)
const values = this.handleRemoveFields(formRaw)
api('createTags', {
postAPI('createTags', {
'tags[0].key': values.key,
'tags[0].value': values.value,
resourceIds: this.selectedRule,
@ -623,7 +623,7 @@ export default {
},
handleDeleteTag (tag) {
this.tagsModalLoading = true
api('deleteTags', {
postAPI('deleteTags', {
'tags[0].key': tag.key,
'tags[0].value': tag.value,
resourceIds: tag.resourceid,
@ -682,7 +682,7 @@ export default {
}
},
handleAddStickinessPolicy (data, values) {
api('createLBStickinessPolicy', {
postAPI('createLBStickinessPolicy', {
...data,
lbruleid: this.selectedRule,
name: values.name,
@ -719,7 +719,7 @@ export default {
},
handleDeleteStickinessPolicy () {
this.stickinessModalLoading = true
api('deleteLBStickinessPolicy', { id: this.selectedStickinessPolicy.id }).then(response => {
postAPI('deleteLBStickinessPolicy', { id: this.selectedStickinessPolicy.id }).then(response => {
this.$pollJob({
jobId: response.deleteLBstickinessrruleresponse.jobid,
successMessage: this.$t('message.success.remove.sticky.policy'),
@ -803,7 +803,7 @@ export default {
},
handleDeleteInstanceFromRule (instance, rule, ip) {
this.loading = true
api('removeFromLoadBalancerRule', {
postAPI('removeFromLoadBalancerRule', {
id: rule.id,
'vmidipmap[0].vmid': instance.loadbalancerruleinstance.id,
'vmidipmap[0].vmip': ip
@ -840,7 +840,7 @@ export default {
if (this.editRuleModalLoading) return
this.loading = true
this.editRuleModalLoading = true
api('updateLoadBalancerRule', {
postAPI('updateLoadBalancerRule', {
...this.editRuleDetails,
id: this.selectedRule.id
}).then(response => {

View File

@ -323,7 +323,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import Status from '@/components/widgets/Status'
import TooltipButton from '@/components/widgets/TooltipButton'
import TooltipLabel from '@/components/widgets/TooltipLabel'
@ -425,7 +425,7 @@ export default {
methods: {
fetchInitData () {
this.loading = true
api('listAutoScaleVmGroups', {
getAPI('listAutoScaleVmGroups', {
listAll: true,
id: this.resource.id
}).then(response => {
@ -437,12 +437,12 @@ export default {
this.policy = this.policies?.[0]
this.selectedPolicyId = this.policy.id
}
api('listLoadBalancerRules', {
getAPI('listLoadBalancerRules', {
listAll: true,
id: lbruleid
}).then(response => {
const networkid = response.listloadbalancerrulesresponse?.loadbalancerrule?.[0]?.networkid
api('listNetworks', {
getAPI('listNetworks', {
listAll: true,
projectid: this.resource.projectid,
id: networkid
@ -450,7 +450,7 @@ export default {
const services = response.listnetworksresponse?.network?.[0]?.service
const index = services.map(svc => { return svc.name }).indexOf('Lb')
const provider = services[index].provider[0].name
api('listCounters', {
getAPI('listCounters', {
listAll: true,
provider: provider
}).then(response => {
@ -464,7 +464,7 @@ export default {
},
fetchData () {
this.loading = true
api('listAutoScalePolicies', {
getAPI('listAutoScalePolicies', {
listAll: true,
id: this.selectedPolicyId
}).then(response => {
@ -507,7 +507,7 @@ export default {
async pollJob (jobId) {
return new Promise(resolve => {
const asyncJobInterval = setInterval(() => {
api('queryAsyncJobResult', { jobId }).then(async json => {
getAPI('queryAsyncJobResult', { jobId }).then(async json => {
const result = json.queryasyncjobresultresponse
if (result.jobstatus === 0) {
return
@ -522,7 +522,7 @@ export default {
addCondition (params) {
this.loading = true
return new Promise((resolve, reject) => {
api('createCondition', params).then(async json => {
postAPI('createCondition', params).then(async json => {
this.$pollJob({
jobId: json.conditionresponse.jobid,
successMethod: (result) => {
@ -543,7 +543,7 @@ export default {
deleteCondition (conditionId) {
this.loading = true
return new Promise((resolve, reject) => {
api('deleteCondition', { id: conditionId }).then(response => {
postAPI('deleteCondition', { id: conditionId }).then(response => {
const jobId = response.deleteconditionresponse.jobid
this.$pollJob({
title: this.$t('label.delete.condition'),
@ -587,7 +587,7 @@ export default {
}
this.updateConditionModalLoading = true
api('updateCondition', {
postAPI('updateCondition', {
id: this.selectedCondition.id,
relationaloperator: this.updateConditionDetails.relationaloperator,
threshold: this.updateConditionDetails.threshold
@ -728,7 +728,7 @@ export default {
createAutoScalePolicy (params) {
this.loading = true
return new Promise((resolve, reject) => {
api('createAutoScalePolicy', params).then(async json => {
postAPI('createAutoScalePolicy', params).then(async json => {
this.$pollJob({
jobId: json.autoscalepolicyresponse.jobid,
successMethod: (result) => {
@ -762,7 +762,7 @@ export default {
}
return new Promise((resolve, reject) => {
api('updateAutoScalePolicy', {
postAPI('updateAutoScalePolicy', {
id: this.policy.id,
name: this.policy.name,
duration: this.policy.duration,
@ -792,7 +792,7 @@ export default {
this.loading = true
return new Promise((resolve, reject) => {
api('updateAutoScaleVmGroup', params).then(response => {
postAPI('updateAutoScaleVmGroup', params).then(response => {
this.$pollJob({
jobId: response.updateautoscalevmgroupresponse.jobid,
successMethod: (result) => {

View File

@ -307,7 +307,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { isAdmin, isAdminOrDomainAdmin } from '@/role'
import Status from '@/components/widgets/Status'
import TooltipButton from '@/components/widgets/TooltipButton'
@ -409,7 +409,7 @@ export default {
this.fetchData()
},
fetchUserData () {
api('listUsers', {
getAPI('listUsers', {
domainid: this.resource.domainid,
account: this.resource.account
}).then(json => {
@ -427,7 +427,7 @@ export default {
} else {
params.templatefilter = 'executable'
}
api('listTemplates', params).then(json => {
getAPI('listTemplates', params).then(json => {
this.templatesList = json.listtemplatesresponse?.template || []
})
},
@ -439,14 +439,14 @@ export default {
if (isAdminOrDomainAdmin()) {
params.isrecursive = 'true'
}
api('listServiceOfferings', params).then(json => {
getAPI('listServiceOfferings', params).then(json => {
this.serviceOfferingsList = json.listserviceofferingsresponse?.serviceoffering || []
this.serviceOfferingsList = this.serviceOfferingsList.filter(offering => !offering.iscustomized)
})
},
fetchData () {
this.loading = true
api('listAutoScaleVmProfiles', {
getAPI('listAutoScaleVmProfiles', {
listAll: true,
id: this.resource.vmprofileid
}).then(response => {
@ -572,7 +572,7 @@ export default {
params['otherdeployparams[' + j + '].value'] = paramValueToAdd
}
api('updateAutoScaleVmProfile', params).then(response => {
postAPI('updateAutoScaleVmProfile', params).then(response => {
this.$pollJob({
jobId: response.updateautoscalevmprofileresponse.jobid,
successMethod: (result) => {
@ -600,7 +600,7 @@ export default {
const args = params
const data = {}
api('updateAutoScaleVmProfile', args, httpMethod, data).then(response => {
postAPI('updateAutoScaleVmProfile', args, httpMethod, data).then(response => {
this.$pollJob({
jobId: response.updateautoscalevmprofileresponse.jobid,
successMethod: (result) => {

View File

@ -35,7 +35,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import FormSchedule from '@views/compute/backup/FormSchedule'
import BackupSchedule from '@views/compute/backup/BackupSchedule'
@ -72,7 +72,7 @@ export default {
this.dataSource = {}
this.loading = true
params.virtualmachineid = this.resource.id
api('listBackupSchedule', params).then(json => {
getAPI('listBackupSchedule', params).then(json => {
this.dataSource = json.listbackupscheduleresponse.backupschedule || {}
}).finally(() => {
this.loading = false

View File

@ -56,7 +56,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { genericCompare } from '@/utils/sort.js'
export default {
@ -110,7 +110,7 @@ export default {
this.loading = true
this.items = []
this.total = 0
api('listAffinityGroups', {
getAPI('listAffinityGroups', {
keyword: this.options.keyword,
domainid: this.resource.domainid,
accountid: this.resource.accountid,
@ -145,7 +145,7 @@ export default {
handleSubmit () {
if (this.loading) return
this.loading = true
api('updateVMAffinityGroup', {
postAPI('updateVMAffinityGroup', {
id: this.resource.id,
affinitygroupids: this.selectedRowKeys.join(',')
}).then(response => {

View File

@ -1030,7 +1030,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import _ from 'lodash'
import { mixin, mixinDevice } from '@/utils/mixin.js'
import store from '@/store'
@ -1893,7 +1893,7 @@ export default {
}
if (!apiName) return resolve(zones)
api(apiName, params).then(json => {
postAPI(apiName, params).then(json => {
let objectName
const responseName = [apiName.toLowerCase(), 'response'].join('')
for (const key in json[responseName]) {
@ -1961,7 +1961,7 @@ export default {
this.fetchOptions(param, 'loadbalancers')
},
fetchCountersList () {
api('listNetworks', {
getAPI('listNetworks', {
listAll: true,
id: this.defaultNetworkId
}).then(response => {
@ -1973,7 +1973,7 @@ export default {
return
}
this.selectedLbProdiver = services[index].provider[0].name
api('listCounters', {
getAPI('listCounters', {
listAll: true,
provider: this.selectedLbProdiver
}).then(response => {
@ -1982,7 +1982,7 @@ export default {
})
},
fetchUserData () {
api('listUsers', {
getAPI('listUsers', {
domainid: store.getters.project && store.getters.project.id ? null : store.getters.userInfo.domainid,
account: store.getters.project && store.getters.project.id ? null : store.getters.userInfo.account
}).then(json => {
@ -2249,7 +2249,7 @@ export default {
}
this.form.userdataid = id
this.userDataParams = []
api('listUserData', { id: id }).then(json => {
getAPI('listUserData', { id: id }).then(json => {
const resp = json?.listuserdataresponse?.userdata || []
if (resp) {
var params = resp[0].params
@ -2272,7 +2272,7 @@ export default {
}
this.templateUserDataParams = []
api('listUserData', { id: id }).then(json => {
getAPI('listUserData', { id: id }).then(json => {
const resp = json?.listuserdataresponse?.userdata || []
if (resp) {
var params = resp[0].params
@ -2298,7 +2298,7 @@ export default {
async pollJob (jobId) {
return new Promise(resolve => {
const asyncJobInterval = setInterval(() => {
api('queryAsyncJobResult', { jobId }).then(async json => {
getAPI('queryAsyncJobResult', { jobId }).then(async json => {
const result = json.queryasyncjobresultresponse
if (result.jobstatus === 0) {
return
@ -2381,11 +2381,7 @@ export default {
j++
}
const httpMethod = createVmGroupData.userdata ? 'POST' : 'GET'
const args = httpMethod === 'POST' ? {} : params
const data = httpMethod === 'POST' ? params : {}
api('createAutoScaleVmProfile', args, httpMethod, data).then(async json => {
postAPI('createAutoScaleVmProfile', params).then(async json => {
const jobId = json.autoscalevmprofileresponse.jobid
if (jobId) {
const result = await this.pollJob(jobId)
@ -2411,7 +2407,7 @@ export default {
relationaloperator: relationaloperator,
threshold: threshold
}
api('createCondition', params).then(async json => {
postAPI('createCondition', params).then(async json => {
const jobId = json.conditionresponse.jobid
if (jobId) {
const result = await this.pollJob(jobId)
@ -2439,7 +2435,7 @@ export default {
quiettime: quiettime,
conditionids: conditionIds
}
api('createAutoScalePolicy', params).then(async json => {
postAPI('createAutoScalePolicy', params).then(async json => {
const jobId = json.autoscalepolicyresponse.jobid
if (jobId) {
const result = await this.pollJob(jobId)
@ -2843,7 +2839,7 @@ export default {
minmembers: values.minmembers,
interval: values.interval
}
api('createAutoScaleVmGroup', params).then(async response => {
postAPI('createAutoScaleVmGroup', params).then(async response => {
const jobId = response.autoscalevmgroupresponse.jobid
const result = await this.pollJob(jobId)
if (result.jobstatus === 2) {
@ -2899,7 +2895,7 @@ export default {
const param = this.params.zones
const args = { showicon: true }
if (zoneId) args.id = zoneId
api(param.list, args).then(json => {
postAPI(param.list, args).then(json => {
const zoneResponse = (json.listzonesresponse.zone || []).filter(item => item.securitygroupsenabled === false)
if (listZoneAllow && listZoneAllow.length > 0) {
zoneResponse.map(zone => {
@ -2931,7 +2927,7 @@ export default {
if (!('listall' in options) && !['zones', 'pods', 'clusters', 'hosts', 'dynamicScalingVmConfig', 'hypervisors'].includes(name)) {
options.listall = true
}
api(param.list, options).then((response) => {
postAPI(param.list, options).then((response) => {
param.loading = false
_.map(response, (responseItem, responseKey) => {
if (Object.keys(responseItem).length === 0) {
@ -3002,7 +2998,7 @@ export default {
delete args.featured
return new Promise((resolve, reject) => {
api('listTemplates', args).then((response) => {
getAPI('listTemplates', args).then((response) => {
resolve(response)
}).catch((reason) => {
// ToDo: Handle errors

View File

@ -430,7 +430,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { mixinForm } from '@/utils/mixin'
import ResourceIcon from '@/components/view/ResourceIcon'
import TooltipLabel from '@/components/widgets/TooltipLabel'
@ -574,7 +574,7 @@ export default {
const params = {}
this.zoneLoading = true
params.showicon = true
api('listZones', params).then(json => {
getAPI('listZones', params).then(json => {
var listZones = json.listzonesresponse.zone
if (listZones) {
listZones = listZones.filter(x => x.allocationstate === 'Enabled')
@ -606,7 +606,7 @@ export default {
params.zoneid = this.selectedZone.id
}
this.kubernetesVersionLoading = true
api('listKubernetesSupportedVersions', params).then(json => {
getAPI('listKubernetesSupportedVersions', params).then(json => {
const versionObjs = json.listkubernetessupportedversionsresponse.kubernetessupportedversion
if (this.arrayHasItems(versionObjs)) {
for (var i = 0; i < versionObjs.length; i++) {
@ -631,7 +631,7 @@ export default {
this.serviceOfferings = []
const params = {}
this.serviceOfferingLoading = true
api('listServiceOfferings', params).then(json => {
getAPI('listServiceOfferings', params).then(json => {
var items = json.listserviceofferingsresponse.serviceoffering
var minCpu = 2
var minMemory = 2048
@ -674,7 +674,7 @@ export default {
forcks: true
}
this.templateLoading = true
api('listTemplates', params).then(json => {
getAPI('listTemplates', params).then(json => {
var templates = json?.listtemplatesresponse?.template || []
ckstemplates.push(...templates)
}).finally(() => {
@ -690,7 +690,7 @@ export default {
}
this.networkLoading = true
this.networks = []
api('listNetworks', params).then(json => {
getAPI('listNetworks', params).then(json => {
var listNetworks = json.listnetworksresponse.network
if (this.arrayHasItems(listNetworks)) {
listNetworks = listNetworks.filter(n => n.type !== 'L2')
@ -707,7 +707,7 @@ export default {
fetchKeyPairData () {
const params = {}
this.keyPairLoading = true
api('listSSHKeyPairs', params).then(json => {
getAPI('listSSHKeyPairs', params).then(json => {
const listKeyPairs = json.listsshkeypairsresponse.sshkeypair
if (this.arrayHasItems(listKeyPairs)) {
for (var i = 0; i < listKeyPairs.length; i++) {
@ -730,7 +730,7 @@ export default {
}
this.hypervisorLoading = true
api('listHypervisors', params).then(json => {
getAPI('listHypervisors', params).then(json => {
const listResponse = json.listhypervisorsresponse.hypervisor || []
if (listResponse) {
this.selectedZoneHypervisors = listResponse
@ -747,7 +747,7 @@ export default {
name: 'cloud.kubernetes.cluster.network.offering'
}
this.configLoading = true
api('listConfigurations', params).then(json => {
getAPI('listConfigurations', params).then(json => {
if (json.listconfigurationsresponse.configuration !== null) {
const config = json.listconfigurationsresponse.configuration[0]
if (config && config.name === params.name) {
@ -766,7 +766,7 @@ export default {
name: offeringName
}
api('listNetworkOfferings', args).then(json => {
getAPI('listNetworkOfferings', args).then(json => {
const listNetworkOfferings = json.listnetworkofferingsresponse.networkoffering || []
resolve(listNetworkOfferings)
this.cksNetworkOffering = listNetworkOfferings[0] || {}
@ -779,13 +779,13 @@ export default {
const params = {}
params.zoneid = this.selectedZone.id
params.isallocated = false
api('listASNumbers', params).then(json => {
getAPI('listASNumbers', params).then(json => {
this.asNumbersZone = json.listasnumbersresponse.asnumber
})
},
fetchCniConfigurations () {
this.cniConfigLoading = true
api('listCniConfiguration', {}).then(
getAPI('listCniConfiguration', {}).then(
response => {
const listResponse = response.listcniconfigurationresponse.cniconfig || []
if (listResponse) {
@ -802,7 +802,7 @@ export default {
}
this.form.cniconfigurationid = id
this.cniConfigParams = []
api('listCniConfiguration', { id: id }).then(json => {
getAPI('listCniConfiguration', { id: id }).then(json => {
const resp = json?.listcniconfigurationresponse?.cniconfig || []
if (resp) {
var params = resp[0].params
@ -913,7 +913,7 @@ export default {
params.asnumber = values.asnumber
}
api('createKubernetesCluster', params).then(json => {
postAPI('createKubernetesCluster', params).then(json => {
const jobId = json.createkubernetesclusterresponse.jobid
this.$pollJob({
jobId,

View File

@ -94,7 +94,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { mixinForm } from '@/utils/mixin'
import TooltipLabel from '@/components/widgets/TooltipLabel'
@ -156,7 +156,7 @@ export default {
fetchDomainData () {
const params = {}
this.domainLoading = true
api('listDomains', params).then(json => {
getAPI('listDomains', params).then(json => {
const listdomains = json.listdomainsresponse.domain
this.domains = this.domains.concat(listdomains)
}).finally(() => {
@ -190,7 +190,7 @@ export default {
}
if (this.isValidValueForKey(values, 'publickey') && values.publickey.length > 0) {
params.publickey = values.publickey
api('registerSSHKeyPair', params).then(json => {
postAPI('registerSSHKeyPair', params).then(json => {
this.$message.success(this.$t('message.success.register.keypair') + ' ' + values.name)
}).catch(error => {
this.$notifyError(error)
@ -200,7 +200,7 @@ export default {
this.closeAction()
})
} else {
api('createSSHKeyPair', params).then(json => {
postAPI('createSSHKeyPair', params).then(json => {
this.$message.success(this.$t('message.success.create.keypair') + ' ' + values.name)
if (json.createsshkeypairresponse?.keypair?.privatekey) {
this.isSubmitted = true

View File

@ -78,7 +78,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { mixinForm } from '@/utils/mixin'
import TooltipLabel from '@/components/widgets/TooltipLabel'
@ -124,7 +124,7 @@ export default {
this.hypervisorSupportsQuiesceVm = true
}
api('listVolumes', { virtualMachineId: this.resource.id, listall: true })
getAPI('listVolumes', { virtualMachineId: this.resource.id, listall: true })
.then(json => {
this.listVolumes = json.listvolumesresponse.volume || []
})
@ -155,7 +155,7 @@ export default {
this.loading = true
api('createSnapshot', params)
postAPI('createSnapshot', params)
.then(json => {
const jobId = json.createsnapshotresponse.jobid
if (jobId) {

View File

@ -880,7 +880,7 @@
<script>
import { ref, reactive, toRaw, nextTick, h } from 'vue'
import { Button } from 'ant-design-vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import _ from 'lodash'
import { mixin, mixinDevice } from '@/utils/mixin.js'
import store from '@/store'
@ -1781,7 +1781,7 @@ export default {
}
if (!apiName) return resolve(zones)
api(apiName, params).then(json => {
postAPI(apiName, params).then(json => {
let objectName
const responseName = [apiName.toLowerCase(), 'response'].join('')
for (const key in json[responseName]) {
@ -1879,7 +1879,7 @@ export default {
},
fetchInstaceGroups () {
this.options.instanceGroups = []
api('listInstanceGroups', {
getAPI('listInstanceGroups', {
account: this.$store.getters.project?.id ? null : this.$store.getters.userInfo.account,
domainid: this.$store.getters.project?.id ? null : this.$store.getters.userInfo.domainid,
listall: true
@ -2025,7 +2025,7 @@ export default {
this.form.userdataid = id
this.userDataParams = []
api('listUserData', { id: id }).then(json => {
getAPI('listUserData', { id: id }).then(json => {
const resp = json?.listuserdataresponse?.userdata || []
if (resp[0]) {
const params = resp[0].params
@ -2045,7 +2045,7 @@ export default {
}
this.templateUserDataParams = []
api('listUserData', { id: id }).then(json => {
getAPI('listUserData', { id: id }).then(json => {
const resp = json.listuserdataresponse.userdata || []
if (resp.length > 0) {
var params = resp[0].params
@ -2378,11 +2378,7 @@ export default {
}
}
const httpMethod = deployVmData.userdata ? 'POST' : 'GET'
const args = httpMethod === 'POST' ? {} : deployVmData
const data = httpMethod === 'POST' ? deployVmData : {}
api('deployVirtualMachine', args, httpMethod, data).then(response => {
postAPI('deployVirtualMachine', deployVmData).then(response => {
const jobId = response.deployvirtualmachineresponse.jobid
if (jobId) {
this.$pollJob({
@ -2479,7 +2475,7 @@ export default {
const param = this.params.zones
const args = { showicon: true }
if (zoneId) args.id = zoneId
api(param.list, args).then(json => {
postAPI(param.list, args).then(json => {
const zoneResponse = json.listzonesresponse.zone || []
if (listZoneAllow && listZoneAllow.length > 0) {
zoneResponse.map(zone => {
@ -2511,7 +2507,7 @@ export default {
if (!('listall' in options) && !['zones', 'pods', 'clusters', 'hosts', 'dynamicScalingVmConfig', 'hypervisors'].includes(name)) {
options.listall = true
}
api(param.list, options).then((response) => {
postAPI(param.list, options).then((response) => {
param.loading = false
_.map(response, (responseItem, responseKey) => {
if (Object.keys(responseItem).length === 0) {
@ -2591,7 +2587,7 @@ export default {
delete args.featured
return new Promise((resolve, reject) => {
api('listTemplates', args).then((response) => {
getAPI('listTemplates', args).then((response) => {
resolve(response)
}).catch((reason) => {
// ToDo: Handle errors
@ -2625,7 +2621,7 @@ export default {
delete args.featured
return new Promise((resolve, reject) => {
api('listIsos', args).then((response) => {
getAPI('listIsos', args).then((response) => {
resolve(response)
}).catch((reason) => {
// ToDo: Handle errors

View File

@ -836,7 +836,7 @@
<script>
import { ref, reactive, toRaw, nextTick } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import _ from 'lodash'
import { mixin, mixinDevice } from '@/utils/mixin.js'
import store from '@/store'
@ -1720,7 +1720,7 @@ export default {
}
if (!apiName) return resolve(zones)
api(apiName, params).then(json => {
postAPI(apiName, params).then(json => {
let objectName
const responseName = [apiName.toLowerCase(), 'response'].join('')
for (const key in json[responseName]) {
@ -1817,7 +1817,7 @@ export default {
},
fetchInstaceGroups () {
this.options.instanceGroups = []
api('listInstanceGroups', {
getAPI('listInstanceGroups', {
account: this.$store.getters.userInfo.account,
domainid: this.$store.getters.userInfo.domainid,
listall: true
@ -1947,7 +1947,7 @@ export default {
}
this.form.userdataid = id
this.userDataParams = []
api('listUserData', { id: id }).then(json => {
getAPI('listUserData', { id: id }).then(json => {
const resp = json.listuserdataresponse?.userdata || []
if (resp.length > 0) {
var params = resp[0]?.params || null
@ -1970,7 +1970,7 @@ export default {
}
this.templateUserDataParams = []
api('listUserData', { id: id }).then(json => {
getAPI('listUserData', { id: id }).then(json => {
const resp = json?.listuserdataresponse?.userdata || []
if (resp) {
var params = resp[0]?.params || null
@ -2349,11 +2349,7 @@ export default {
}
}
const httpMethod = createVnfAppData.userdata ? 'POST' : 'GET'
const args = httpMethod === 'POST' ? {} : createVnfAppData
const data = httpMethod === 'POST' ? createVnfAppData : {}
api('deployVnfAppliance', args, httpMethod, data).then(response => {
postAPI('deployVnfAppliance', createVnfAppData).then(response => {
const jobId = response.deployvirtualmachineresponse.jobid
if (jobId) {
this.$pollJob({
@ -2450,7 +2446,7 @@ export default {
const param = this.params.zones
const args = { showicon: true }
if (zoneId) args.id = zoneId
api(param.list, args).then(json => {
postAPI(param.list, args).then(json => {
const zoneResponse = json.listzonesresponse.zone || []
if (listZoneAllow && listZoneAllow.length > 0) {
zoneResponse.map(zone => {
@ -2482,7 +2478,7 @@ export default {
if (!('listall' in options) && !['zones', 'pods', 'clusters', 'hosts', 'dynamicScalingVmConfig', 'hypervisors'].includes(name)) {
options.listall = true
}
api(param.list, options).then((response) => {
postAPI(param.list, options).then((response) => {
param.loading = false
_.map(response, (responseItem, responseKey) => {
if (Object.keys(responseItem).length === 0) {
@ -2558,7 +2554,7 @@ export default {
delete args.featured
return new Promise((resolve, reject) => {
api('listVnfTemplates', args).then((response) => {
getAPI('listVnfTemplates', args).then((response) => {
resolve(response)
}).catch((reason) => {
// ToDo: Handle errors

View File

@ -141,7 +141,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'
import BulkActionProgress from '@/components/view/BulkActionProgress'
@ -228,7 +228,7 @@ export default {
callListVolume (vmId) {
return new Promise((resolve) => {
this.volumes = []
api('listVolumes', {
getAPI('listVolumes', {
virtualMachineId: vmId,
type: 'DATADISK',
details: 'min',
@ -304,7 +304,7 @@ export default {
},
destroyVM (params) {
return new Promise((resolve, reject) => {
api('destroyVirtualMachine', params).then(json => {
postAPI('destroyVirtualMachine', params).then(json => {
const jobId = json.destroyvirtualmachineresponse.jobid
return resolve(jobId)
}).catch(error => {

View File

@ -156,7 +156,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'
export default {
@ -243,7 +243,7 @@ export default {
this.fetchUserData()
},
fetchZoneDetails () {
api('listZones', {
getAPI('listZones', {
id: this.resource.zoneid
}).then(response => {
const zone = response?.listzonesresponse?.zone || []
@ -252,7 +252,7 @@ export default {
},
fetchSecurityGroups () {
this.securitygroups.loading = true
api('listSecurityGroups', {
getAPI('listSecurityGroups', {
zoneid: this.resource.zoneid
}).then(json => {
const items = json.listsecuritygroupsresponse.securitygroup || []
@ -275,7 +275,7 @@ export default {
params.id = this.resource.serviceofferingid
params.isrecursive = true
var apiName = 'listServiceOfferings'
api(apiName, params).then(json => {
getAPI(apiName, params).then(json => {
const offerings = json?.listserviceofferingsresponse?.serviceoffering || []
this.serviceOffering = offerings[0] || {}
})
@ -286,7 +286,7 @@ export default {
params.isrecursive = true
params.templatefilter = 'all'
var apiName = 'listTemplates'
api(apiName, params).then(json => {
getAPI(apiName, params).then(json => {
const templateResponses = json.listtemplatesresponse.template
this.template = templateResponses[0]
})
@ -296,7 +296,7 @@ export default {
params.name = 'enable.dynamic.scale.vm'
params.zoneid = this.resource.zoneid
var apiName = 'listConfigurations'
api(apiName, params).then(json => {
getAPI(apiName, params).then(json => {
const configResponse = json.listconfigurationsresponse.configuration
this.dynamicScalingVmConfig = configResponse[0]?.value === 'true'
})
@ -307,7 +307,7 @@ export default {
fetchOsTypes () {
this.osTypes.loading = true
this.osTypes.opts = []
api('listOsTypes').then(json => {
getAPI('listOsTypes').then(json => {
this.osTypes.opts = json.listostypesresponse.ostype || []
}).catch(error => {
this.$notifyError(error)
@ -325,7 +325,7 @@ export default {
} else {
params.account = this.$store.getters.userInfo.account
}
api('listInstanceGroups', params).then(json => {
getAPI('listInstanceGroups', params).then(json => {
const groups = json.listinstancegroupsresponse.instancegroup || []
groups.forEach(x => {
this.groups.opts.push({ id: x.name, value: x.name })
@ -352,7 +352,7 @@ export default {
id: networkId,
listall: true
}
api(`listNetworks`, listNetworkParams).then(json => {
getAPI(`listNetworks`, listNetworkParams).then(json => {
json.listnetworksresponse.network[0].service.forEach(service => {
if (service.name === 'UserData') {
this.userDataEnabled = true
@ -362,7 +362,7 @@ export default {
userdata: true,
listall: true
}
api('listVirtualMachines', listVmParams).then(json => {
getAPI('listVirtualMachines', listVmParams).then(json => {
this.form.userdata = atob(json.listvirtualmachinesresponse.virtualmachine[0].userdata || '')
})
}
@ -403,7 +403,7 @@ export default {
}
this.loading = true
api('updateVirtualMachine', {}, 'POST', params).then(json => {
postAPI('updateVirtualMachine', params).then(json => {
this.$message.success({
content: `${this.$t('label.action.edit.instance')} - ${values.name}`,
duration: 2

View File

@ -253,7 +253,7 @@
<script>
import { reactive, ref, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import ListView from '@/components/view/ListView'
import Status from '@/components/widgets/Status'
import TooltipLabel from '@/components/widgets/TooltipLabel'
@ -373,7 +373,7 @@ export default {
this.showAddModal()
},
removeVMSchedule (schedule) {
api('deleteVMSchedule', {
postAPI('deleteVMSchedule', {
id: schedule.id,
virtualmachineid: this.virtualmachine.id
}).then(() => {
@ -429,7 +429,7 @@ export default {
command = 'updateVMSchedule'
}
api(command, params).then(response => {
postAPI(command, params).then(response => {
this.$notification.success({
message: this.$t('label.schedule'),
description: this.$t('message.success.config.vm.schedule')
@ -485,7 +485,7 @@ export default {
listall: true
}
this.tabLoading = true
api('listVMSchedule', params).then(json => {
getAPI('listVMSchedule', params).then(json => {
this.schedules = []
this.totalCount = json?.listvmscheduleresponse?.count || 0
this.schedules = json?.listvmscheduleresponse?.vmschedule || []

View File

@ -127,7 +127,7 @@
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { mixinDevice } from '@/utils/mixin.js'
import ResourceLayout from '@/layouts/ResourceLayout'
import DetailsTab from '@/components/view/DetailsTab'
@ -238,14 +238,14 @@ export default {
if (!this.vm || !this.vm.id) {
return
}
api('listAnnotations', { entityid: this.dataResource.id, entitytype: 'VM', annotationfilter: 'all' }).then(json => {
getAPI('listAnnotations', { entityid: this.dataResource.id, entitytype: 'VM', annotationfilter: 'all' }).then(json => {
if (json.listannotationsresponse && json.listannotationsresponse.annotation) {
this.annotations = json.listannotationsresponse.annotation
}
})
},
listDiskOfferings () {
api('listDiskOfferings', {
getAPI('listDiskOfferings', {
listAll: 'true',
zoneid: this.vm.zoneid
}).then(response => {
@ -276,7 +276,7 @@ export default {
this.securitygroupids = securitygroupids || []
},
updateSecurityGroups () {
api('updateVirtualMachine', { id: this.vm.id, securitygroupids: this.securitygroupids.join(',') }).catch(error => {
postAPI('updateVirtualMachine', { id: this.vm.id, securitygroupids: this.securitygroupids.join(',') }).catch(error => {
this.$notifyError(error)
}).finally(() => {
this.closeModals()

View File

@ -174,7 +174,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { isAdmin } from '@/role'
import { mixinDevice } from '@/utils/mixin.js'
import DetailsTab from '@/components/view/DetailsTab'
@ -343,7 +343,7 @@ export default {
},
fetchComments () {
this.clusterConfigLoading = true
api('listAnnotations', { entityid: this.resource.id, entitytype: 'KUBERNETES_CLUSTER', annotationfilter: 'all' }).then(json => {
getAPI('listAnnotations', { entityid: this.resource.id, entitytype: 'KUBERNETES_CLUSTER', annotationfilter: 'all' }).then(json => {
if (json.listannotationsresponse?.annotation) {
this.annotations = json.listannotationsresponse.annotation
}
@ -359,7 +359,7 @@ export default {
if (!this.isObjectEmpty(this.resource)) {
var params = {}
params.id = this.resource.id
api('getKubernetesClusterConfig', params).then(json => {
getAPI('getKubernetesClusterConfig', params).then(json => {
const config = json.getkubernetesclusterconfigresponse.clusterconfig
if (!this.isObjectEmpty(config) &&
this.isValidValueForKey(config, 'configdata') &&
@ -387,7 +387,7 @@ export default {
this.resource.kubernetesversionid !== '') {
var params = {}
params.id = this.resource.kubernetesversionid
api('listKubernetesSupportedVersions', params).then(json => {
getAPI('listKubernetesSupportedVersions', params).then(json => {
const versionObjs = json.listkubernetessupportedversionsresponse.kubernetessupportedversion
if (this.arrayHasItems(versionObjs)) {
this.kubernetesVersion = versionObjs[0]
@ -416,7 +416,7 @@ export default {
fetchNetwork () {
this.networkLoading = true
return new Promise((resolve, reject) => {
api('listNetworks', {
getAPI('listNetworks', {
listAll: true,
id: this.resource.networkid
}).then(json => {
@ -449,7 +449,7 @@ export default {
params.associatednetworkid = this.resource.networkid
}
}
api('listPublicIpAddresses', params).then(json => {
getAPI('listPublicIpAddresses', params).then(json => {
let ips = json.listpublicipaddressesresponse.publicipaddress
if (this.arrayHasItems(ips)) {
ips = ips.filter(x => x.issourcenat)
@ -465,7 +465,7 @@ export default {
const params = {}
params.name = 'cloud.kubernetes.etcd.node.start.port'
var apiName = 'listConfigurations'
api(apiName, params).then(json => {
getAPI(apiName, params).then(json => {
const configResponse = json.listconfigurationsresponse.configuration
this.etcdSshPort = configResponse[0]?.value
})
@ -489,7 +489,7 @@ export default {
id: this.resource.id,
nodeids: node.id
}
api('scaleKubernetesCluster', params).then(json => {
postAPI('scaleKubernetesCluster', params).then(json => {
const jobId = json.scalekubernetesclusterresponse.jobid
console.log(jobId)
this.$store.dispatch('AddAsyncJob', {

View File

@ -54,7 +54,7 @@
</template>
<script>
import { api } from '@/api'
import { postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'
import StoragePoolSelectView from '@/components/view/StoragePoolSelectView'
import InstanceVolumesStoragePoolSelectListView from '@/components/view/InstanceVolumesStoragePoolSelectListView'
@ -158,7 +158,7 @@ export default {
} else {
params.storageid = storageId
}
api(migrateApi, params).then(response => {
postAPI(migrateApi, params).then(response => {
const jobId = response[migrateApi.toLowerCase() + 'response'].jobid
this.$pollJob({
title: `${this.$t('label.migrating')} ${this.resource.name}`,

View File

@ -124,7 +124,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'
import InstanceVolumesStoragePoolSelectListView from '@/components/view/InstanceVolumesStoragePoolSelectListView'
@ -213,7 +213,7 @@ export default {
},
fetchData () {
this.loading = true
api('findHostsForMigration', {
getAPI('findHostsForMigration', {
virtualmachineid: this.resource.id,
keyword: this.searchQuery,
page: this.page,
@ -264,7 +264,7 @@ export default {
fetchVolumes () {
this.loading = true
this.volumes = []
api('listVolumes', {
getAPI('listVolumes', {
listAll: true,
virtualmachineid: this.resource.id
}).then(response => {
@ -312,7 +312,7 @@ export default {
params['migrateto[' + i + '].pool'] = mapping.pool
}
}
api(migrateApi, params).then(response => {
postAPI(migrateApi, params).then(response => {
const jobId = response[migrateApi.toLowerCase() + 'response'].jobid
this.$pollJob({
jobId: jobId,

View File

@ -129,7 +129,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'
export default {
@ -192,7 +192,7 @@ export default {
fetchDomainData () {
const params = {}
this.domainLoading = true
api('listDomains', params).then(json => {
getAPI('listDomains', params).then(json => {
const listdomains = json.listdomainsresponse.domain
this.domains = this.domains.concat(listdomains)
}).finally(() => {
@ -240,7 +240,7 @@ export default {
params.params = userdataparams
}
api(apiName, {}, 'POST', params).then(json => {
postAPI(apiName, params).then(json => {
this.$message.success(this.$t('message.success.register.user.data') + ' ' + values.name)
}).catch(error => {
this.$notifyError(error)

View File

@ -131,7 +131,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import DiskOfferingSelection from '@views/compute/wizard/DiskOfferingSelection'
import DiskSizeSelection from '@views/compute/wizard/DiskSizeSelection'
import OsBasedImageSelection from '@views/compute/wizard/OsBasedImageSelection'
@ -270,7 +270,7 @@ export default {
params.rootdisksize = this.overrideRootDiskSize
}
params.expunge = this.expungeDisk
api('restoreVirtualMachine', params).then(response => {
postAPI('restoreVirtualMachine', params).then(response => {
this.$pollJob({
jobId: response.restorevmresponse.jobid,
successMessage: this.$t('label.reinstall.vm') + ' ' + this.$t('label.success'),
@ -308,7 +308,7 @@ export default {
featured: true,
showicon: true
}
api('listOsCategories', params).then((response) => {
getAPI('listOsCategories', params).then((response) => {
this.options.guestOsCategories = response?.listoscategoriesresponse?.oscategory || []
if (this.showUserCategoryForModernImageSelection) {
const userCategory = {
@ -374,7 +374,7 @@ export default {
args.showicon = 'true'
return new Promise((resolve, reject) => {
api('listTemplates', args).then((response) => {
getAPI('listTemplates', args).then((response) => {
resolve(response)
}).catch((reason) => {
reject(reason)
@ -382,7 +382,7 @@ export default {
})
},
fetchDiskOfferings (params) {
api('listDiskOfferings', { zoneid: this.resource.zoneid, listall: true, ...params }).then((response) => {
getAPI('listDiskOfferings', { zoneid: this.resource.zoneid, listall: true, ...params }).then((response) => {
this.options.diskOfferings = response?.listdiskofferingsresponse?.diskoffering || []
this.count.diskOfferings = response?.listdiskofferingsresponse?.count || 0
})

View File

@ -60,7 +60,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { genericCompare } from '@/utils/sort.js'
export default {
@ -115,7 +115,7 @@ export default {
this.loading = true
this.items = []
this.total = 0
api('listSSHKeyPairs', this.options).then(response => {
getAPI('listSSHKeyPairs', this.options).then(response => {
this.total = response.listsshkeypairsresponse.count
if (this.total !== 0) {
this.items = response.listsshkeypairsresponse.sshkeypair
@ -140,7 +140,7 @@ export default {
handleSubmit () {
if (this.loading) return
this.loading = true
api('resetSSHKeyForVirtualMachine', {
postAPI('resetSSHKeyForVirtualMachine', {
id: this.resource.id,
keypairs: this.selectedRowKeys.join(',')
}).then(response => {

View File

@ -124,7 +124,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { genericCompare } from '@/utils/sort.js'
import UserDataSelection from '@views/compute/wizard/UserDataSelection'
@ -231,7 +231,7 @@ export default {
this.loadingData = true
this.items = []
this.total = 0
api('listUserData', this.options).then(response => {
getAPI('listUserData', this.options).then(response => {
this.total = response.listuserdataresponse.count
if (this.total !== 0) {
this.items = response.listuserdataresponse.userdata
@ -246,7 +246,7 @@ export default {
params.isrecursive = true
params.templatefilter = 'all'
var apiName = 'listTemplates'
api(apiName, params).then(json => {
getAPI(apiName, params).then(json => {
const templateResponses = json.listtemplatesresponse.template
this.template = templateResponses[0]
this.updateTemplateLinkedUserData(this.template.userdataid)
@ -259,7 +259,7 @@ export default {
}
this.templateUserDataParams = []
api('listUserData', { id: id }).then(json => {
getAPI('listUserData', { id: id }).then(json => {
const resp = json?.listuserdataresponse?.userdata || []
if (resp) {
var params = resp[0].params
@ -303,7 +303,7 @@ export default {
}
this.form.userdataid = id
this.userDataParams = []
api('listUserData', { id: id }).then(json => {
getAPI('listUserData', { id: id }).then(json => {
const resp = json?.listuserdataresponse?.userdata || []
if (resp.length > 0) {
var params = resp[0].params
@ -362,11 +362,8 @@ export default {
params.id = this.resource.resetUserDataResourceId ? this.resource.resetUserDataResourceId : this.resource.id
const resetUserDataApiName = this.resource.resetUserDataApiName ? this.resource.resetUserDataApiName : 'resetUserDataForVirtualMachine'
const httpMethod = params.userdata ? 'POST' : 'GET'
const args = httpMethod === 'POST' ? {} : params
const data = httpMethod === 'POST' ? params : {}
api(resetUserDataApiName, args, httpMethod, data).then(json => {
postAPI(resetUserDataApiName, params).then(json => {
this.$message.success({
content: `${this.$t('label.action.userdata.reset')} - ${this.$t('label.success')}`,
duration: 2

View File

@ -149,7 +149,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { mixinForm } from '@/utils/mixin'
import TooltipLabel from '@/components/widgets/TooltipLabel'
@ -239,7 +239,7 @@ export default {
}
var minCpu = 0
var minMemory = 0
api('listServiceOfferings', params).then(json => {
getAPI('listServiceOfferings', params).then(json => {
var items = json?.listserviceofferingsresponse?.serviceoffering || []
if (this.arrayHasItems(items) && !this.isObjectEmpty(items[0])) {
minCpu = items[0].cpunumber
@ -256,7 +256,7 @@ export default {
}
var minCpu = 0
var minMemory = 0
api('listKubernetesSupportedVersions', params).then(json => {
getAPI('listKubernetesSupportedVersions', params).then(json => {
const versionObjs = json?.listkubernetessupportedversionsresponse?.kubernetessupportedversion || []
if (this.arrayHasItems(versionObjs) && !this.isObjectEmpty(versionObjs[0])) {
minCpu = versionObjs[0].mincpunumber
@ -278,7 +278,7 @@ export default {
memory: minMemory
}
this.serviceOfferingLoading = true
api('listServiceOfferings', params).then(json => {
getAPI('listServiceOfferings', params).then(json => {
var items = json?.listserviceofferingsresponse?.serviceoffering || []
if (this.arrayHasItems(items)) {
for (var i = 0; i < items.length; i++) {
@ -358,7 +358,7 @@ export default {
params['nodeofferings[' + advancedOfferings + '].offering'] = this.etcdOfferings[values.etcdofferingid].id
advancedOfferings++
}
api('scaleKubernetesCluster', params).then(json => {
postAPI('scaleKubernetesCluster', params).then(json => {
const jobId = json.scalekubernetesclusterresponse.jobid
this.$pollJob({
jobId,

View File

@ -80,7 +80,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import ComputeOfferingSelection from '@views/compute/wizard/ComputeOfferingSelection'
import ComputeSelection from '@views/compute/wizard/ComputeSelection'
import DiskSizeSelection from '@views/compute/wizard/DiskSizeSelection'
@ -137,7 +137,7 @@ export default {
this.total = 0
this.offerings = []
this.offeringsMap = []
api('listServiceOfferings', {
getAPI('listServiceOfferings', {
virtualmachineid: this.resource.id,
keyword: options.keyword,
page: options.page,
@ -186,7 +186,7 @@ export default {
},
getTemplate () {
return new Promise((resolve, reject) => {
api('listTemplates', {
getAPI('listTemplates', {
templatefilter: 'all',
id: this.resource.templateid
}).then(response => {
@ -223,7 +223,7 @@ export default {
this.selectedOffering = this.offeringsMap[id]
this.selectedDiskOffering = null
if (this.selectedOffering.diskofferingid) {
api('listDiskOfferings', {
getAPI('listDiskOfferings', {
id: this.selectedOffering.diskofferingid
}).then(response => {
const diskOfferings = response.listdiskofferingsresponse.diskoffering || []
@ -253,7 +253,7 @@ export default {
delete this.params[this.cpuSpeedKey]
}
api('scaleVirtualMachine', this.params).then(response => {
postAPI('scaleVirtualMachine', this.params).then(response => {
const jobId = response.scalevirtualmachineresponse.jobid
if (jobId) {
this.$pollJob({

View File

@ -115,7 +115,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'
export default {
@ -169,7 +169,7 @@ export default {
this.pods = []
this.podsLoading = true
const params = { zoneid: this.resource.zoneid }
api('listPods', params).then(json => {
getAPI('listPods', params).then(json => {
this.pods = json.listpodsresponse.pod || []
if (this.pods.length === 0) {
this.$notification.error({
@ -188,7 +188,7 @@ export default {
if (podid) {
params.podid = podid
}
api('listClusters', params).then(json => {
getAPI('listClusters', params).then(json => {
this.clusters = json.listclustersresponse.cluster || []
if (this.clusters.length === 0) {
this.$notification.error({
@ -210,7 +210,7 @@ export default {
if (clusterid) {
params.clusterid = clusterid
}
api('listHosts', params).then(json => {
getAPI('listHosts', params).then(json => {
this.hosts = json.listhostsresponse.host || []
if (this.hosts.length === 0) {
this.$notification.error({
@ -247,7 +247,7 @@ export default {
params[key] = values[key]
}
}
api('startVirtualMachine', params).then(json => {
postAPI('startVirtualMachine', params).then(json => {
const jobId = json.startvirtualmachineresponse.jobid
this.$pollJob({
jobId,

View File

@ -60,7 +60,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'
export default {
@ -117,7 +117,7 @@ export default {
params.minimumkubernetesversionid = this.resource.kubernetesversionid
}
this.kubernetesVersionLoading = true
api('listKubernetesSupportedVersions', params).then(json => {
getAPI('listKubernetesSupportedVersions', params).then(json => {
const versionObjs = json.listkubernetessupportedversionsresponse.kubernetessupportedversion
if (this.arrayHasItems(versionObjs)) {
var clusterVersion = null
@ -157,7 +157,7 @@ export default {
if (this.isValidValueForKey(values, 'kubernetesversionid') && this.arrayHasItems(this.kubernetesVersions)) {
params.kubernetesversionid = this.kubernetesVersions[values.kubernetesversionid].id
}
api('upgradeKubernetesCluster', params).then(json => {
postAPI('upgradeKubernetesCluster', params).then(json => {
this.$emit('refresh-data')
const jobId = json.upgradekubernetesclusterresponse.jobid
this.$pollJob({

View File

@ -78,7 +78,7 @@
</template>
<script>
import { api } from '@/api'
import { postAPI } from '@/api'
import { timeZoneName } from '@/utils/timezone'
import TooltipButton from '@/components/widgets/TooltipButton'
@ -169,7 +169,7 @@ export default {
const params = {}
params.virtualmachineid = record.virtualmachineid
this.actionLoading = true
api('deleteBackupSchedule', params).then(json => {
postAPI('deleteBackupSchedule', params).then(json => {
if (json.deletebackupscheduleresponse.success) {
this.$notification.success({
message: this.$t('label.scheduled.backups'),

View File

@ -155,7 +155,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { postAPI } from '@/api'
import { timeZone } from '@/utils/timezone'
import { mixinForm } from '@/utils/mixin'
import debounce from 'lodash/debounce'
@ -276,7 +276,7 @@ export default {
break
}
this.actionLoading = true
api('createBackupSchedule', params).then(json => {
postAPI('createBackupSchedule', params).then(json => {
this.$notification.success({
message: this.$t('label.scheduled.backups'),
description: this.$t('message.success.config.backup.schedule')

View File

@ -72,7 +72,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import CheckBoxSelectPair from '@/components/CheckBoxSelectPair'
export default {
@ -179,7 +179,7 @@ export default {
fetchDiskOfferings () {
this.diskOfferings = []
this.loading = true
api('listDiskOfferings', {
getAPI('listDiskOfferings', {
zoneid: this.zoneId,
listall: true
}).then(response => {

View File

@ -81,7 +81,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import _ from 'lodash'
import CheckBoxInputPair from '@/components/CheckBoxInputPair'
@ -221,7 +221,7 @@ export default {
params.domainid = this.domainid
params.account = this.account
}
api('listNetworks', params).then(response => {
getAPI('listNetworks', params).then(response => {
this.networks = response.listnetworksresponse.network || []
}).catch(() => {
this.networks = []

View File

@ -101,7 +101,7 @@
<script>
import _ from 'lodash'
import { api } from '@/api'
import { getAPI } from '@/api'
import { isAdmin } from '@/role'
import store from '@/store'
import CreateNetwork from '@/views/network/CreateNetwork'
@ -251,7 +251,7 @@ export default {
}
},
loading () {
api('listZones', { id: this.zoneId }).then(json => {
getAPI('listZones', { id: this.zoneId }).then(json => {
const zoneResponse = json.listzonesresponse.zone || []
this.showCreateButton = false
if ('createNetwork' in store.getters.apis && zoneResponse && zoneResponse.length > 0 && (!zoneResponse[0].securitygroupsenabled || (isAdmin() && zoneResponse[0].networktype === 'Advanced'))) {
@ -314,7 +314,7 @@ export default {
if (projectId) {
params.projectid = projectId
}
api('listVPCs', {
getAPI('listVPCs', {
params
}).then((response) => {
this.vpcs = _.get(response, 'listvpcsresponse.vpc')
@ -327,7 +327,7 @@ export default {
if (!projectId) {
return false
}
api('listVPCs', {
getAPI('listVPCs', {
projectid: store.getters.project.id
}).then((response) => {
this.vpcs = _.get(response, 'listvpcsresponse.vpc')
@ -383,7 +383,7 @@ export default {
args.specifyvlan = false
args.state = 'Enabled'
api('listNetworkOfferings', args).then(json => {
getAPI('listNetworkOfferings', args).then(json => {
const listNetworkOfferings = json.listnetworkofferingsresponse.networkoffering || []
resolve(listNetworkOfferings)
}).catch(error => {

View File

@ -128,7 +128,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import ResourceIcon from '@/components/view/ResourceIcon.vue'
export default {
@ -157,7 +157,7 @@ export default {
methods: {
fetchData () {
this.loading = true
api('listDomains', {
getAPI('listDomains', {
response: 'json',
listAll: true,
showicon: true,
@ -188,7 +188,7 @@ export default {
},
fetchAccounts () {
this.loading = true
api('listAccounts', {
getAPI('listAccounts', {
response: 'json',
domainId: this.selectedDomain,
showicon: true,
@ -218,7 +218,7 @@ export default {
},
fetchProjects () {
this.loading = true
api('listProjects', {
getAPI('listProjects', {
response: 'json',
domainId: this.selectedDomain,
state: 'Active',

View File

@ -54,7 +54,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import _ from 'lodash'
export default {
@ -154,7 +154,7 @@ export default {
this.items = []
this.fetchLoading = true
api('listSecurityGroups', params).then(json => {
getAPI('listSecurityGroups', params).then(json => {
const items = json.listsecuritygroupsresponse.securitygroup || []
this.rowCount = json.listsecuritygroupsresponse.count || 0
if (items && items.length > 0) {

View File

@ -332,7 +332,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import ChartCard from '@/components/widgets/ChartCard'
import ResourceIcon from '@/components/view/ResourceIcon'
@ -456,7 +456,7 @@ export default {
},
listCapacity (zone, latest = false, additive = false) {
this.capacityLoading = true
api('listCapacity', { zoneid: zone.id, fetchlatest: latest }).then(json => {
getAPI('listCapacity', { zoneid: zone.id, fetchlatest: latest }).then(json => {
this.capacityLoading = false
let stats = []
if (json && json.listcapacityresponse && json.listcapacityresponse.capacity) {
@ -502,56 +502,56 @@ export default {
routers: 0
}
this.loading = true
api('listPods', { zoneid: zone.id }).then(json => {
getAPI('listPods', { zoneid: zone.id }).then(json => {
this.loading = false
this.data.pods = json?.listpodsresponse?.count
if (!this.data.pods) {
this.data.pods = 0
}
})
api('listClusters', { zoneid: zone.id }).then(json => {
getAPI('listClusters', { zoneid: zone.id }).then(json => {
this.loading = false
this.data.clusters = json?.listclustersresponse?.count
if (!this.data.clusters) {
this.data.clusters = 0
}
})
api('listHosts', { zoneid: zone.id, listall: true, details: 'min', type: 'routing', page: 1, pagesize: 1 }).then(json => {
getAPI('listHosts', { zoneid: zone.id, listall: true, details: 'min', type: 'routing', page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.totalHosts = json?.listhostsresponse?.count
if (!this.data.totalHosts) {
this.data.totalHosts = 0
}
})
api('listHosts', { zoneid: zone.id, listall: true, details: 'min', type: 'routing', state: 'alert', page: 1, pagesize: 1 }).then(json => {
getAPI('listHosts', { zoneid: zone.id, listall: true, details: 'min', type: 'routing', state: 'alert', page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.alertHosts = json?.listhostsresponse?.count
if (!this.data.alertHosts) {
this.data.alertHosts = 0
}
})
api('listStoragePools', { zoneid: zone.id }).then(json => {
getAPI('listStoragePools', { zoneid: zone.id }).then(json => {
this.loading = false
this.data.pools = json?.liststoragepoolsresponse?.count
if (!this.data.pools) {
this.data.pools = 0
}
})
api('listSystemVms', { zoneid: zone.id }).then(json => {
getAPI('listSystemVms', { zoneid: zone.id }).then(json => {
this.loading = false
this.data.systemvms = json?.listsystemvmsresponse?.count
if (!this.data.systemvms) {
this.data.systemvms = 0
}
})
api('listRouters', { zoneid: zone.id, listall: true, projectid: '-1' }).then(json => {
getAPI('listRouters', { zoneid: zone.id, listall: true, projectid: '-1' }).then(json => {
this.loading = false
this.data.routers = json?.listroutersresponse?.count
if (!this.data.routers) {
this.data.routers = 0
}
})
api('listVirtualMachines', { zoneid: zone.id, listall: true, projectid: '-1', details: 'min', page: 1, pagesize: 1 }).then(json => {
getAPI('listVirtualMachines', { zoneid: zone.id, listall: true, projectid: '-1', details: 'min', page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.instances = json?.listvirtualmachinesresponse?.count
if (!this.data.instances) {
@ -566,7 +566,7 @@ export default {
listall: true
}
this.loading = true
api('listAlerts', params).then(json => {
getAPI('listAlerts', params).then(json => {
this.alerts = []
this.loading = false
if (json && json.listalertsresponse && json.listalertsresponse.alert) {
@ -581,7 +581,7 @@ export default {
listall: true
}
this.loading = true
api('listEvents', params).then(json => {
getAPI('listEvents', params).then(json => {
this.events = []
this.loading = false
if (json && json.listeventsresponse && json.listeventsresponse.event) {
@ -599,7 +599,7 @@ export default {
return 'blue'
},
listZones () {
api('listZones', { showicon: true }).then(json => {
getAPI('listZones', { showicon: true }).then(json => {
if (json && json.listzonesresponse && json.listzonesresponse.zone) {
this.zones = json.listzonesresponse.zone
if (this.zones.length > 0) {

View File

@ -30,7 +30,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import store from '@/store'
import CapacityDashboard from './CapacityDashboard'
import UsageDashboard from './UsageDashboard'
@ -84,7 +84,7 @@ export default {
if (!['Admin'].includes(this.$store.getters.userInfo.roletype)) {
return
}
api('listZones').then(json => {
getAPI('listZones').then(json => {
this.showOnboarding = json.listzonesresponse.count ? json.listzonesresponse.count === 0 : true
})
}

View File

@ -139,7 +139,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { ref, reactive, toRaw } from 'vue'
import store from '@/store'
import VueQrious from 'vue-qrious'
@ -192,7 +192,7 @@ export default {
},
handleSelectChange (val) {
if (this.twoFAenabled) {
api('setupUserTwoFactorAuthentication', { enable: 'false' }).then(response => {
postAPI('setupUserTwoFactorAuthentication', { enable: 'false' }).then(response => {
this.pin = ''
this.username = ''
this.totpUrl = ''
@ -220,7 +220,7 @@ export default {
} else {
provider = this.selectedProvider
}
api('setupUserTwoFactorAuthentication', { provider: provider }).then(response => {
postAPI('setupUserTwoFactorAuthentication', { provider: provider }).then(response => {
this.pin = response.setupusertwofactorauthenticationresponse.setup2fa.secretcode
if (this.selectedProvider === 'totp' || this.selectedProvider === 'othertotp') {
this.username = response.setupusertwofactorauthenticationresponse.setup2fa.username
@ -247,7 +247,7 @@ export default {
})
},
disable2FAProvider () {
api('setupUserTwoFactorAuthentication', { enable: false }).then(response => {
postAPI('setupUserTwoFactorAuthentication', { enable: false }).then(response => {
this.showPin = false
this.twoFAenabled = false
this.twoFAverified = false
@ -259,7 +259,7 @@ export default {
})
},
list2FAProviders () {
api('listUserTwoFactorAuthenticatorProviders', {}).then(response => {
getAPI('listUserTwoFactorAuthenticatorProviders', {}).then(response => {
var providerlist = response.listusertwofactorauthenticatorprovidersresponse.providers || []
var providernames = []
for (const provider of providerlist) {
@ -277,7 +277,7 @@ export default {
if (values.code !== null) {
this.verifybuttonstate = true
}
api('validateUserTwoFactorAuthenticationCode', { codefor2fa: values.code }).then(response => {
postAPI('validateUserTwoFactorAuthenticationCode', { codefor2fa: values.code }).then(response => {
this.$message.success({
content: `${this.$t('label.action.enable.two.factor.authentication')}`,
duration: 2

View File

@ -359,7 +359,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI } from '@/api'
import store from '@/store'
import ChartCard from '@/components/widgets/ChartCard'
@ -468,7 +468,7 @@ export default {
},
listAccount () {
this.loading = true
api('listAccounts', { id: this.$store.getters.userInfo.accountid }).then(json => {
getAPI('listAccounts', { id: this.$store.getters.userInfo.accountid }).then(json => {
this.loading = false
if (json && json.listaccountsresponse && json.listaccountsresponse.account) {
this.account = json.listaccountsresponse.account[0]
@ -481,7 +481,7 @@ export default {
id: store.getters.project.id,
listall: true
}
api('listProjects', params).then(json => {
getAPI('listProjects', params).then(json => {
this.loading = false
if (json?.listprojectsresponse?.project) {
this.project = json.listprojectsresponse.project[0]
@ -505,49 +505,49 @@ export default {
this.listEvents()
if ('listKubernetesClusters' in this.$store.getters.apis) {
this.loading = true
api('listKubernetesClusters', { listall: true, page: 1, pagesize: 1 }).then(json => {
getAPI('listKubernetesClusters', { listall: true, page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.kubernetes = json?.listkubernetesclustersresponse?.count
})
}
if ('listVolumes' in this.$store.getters.apis) {
this.loading = true
api('listVolumes', { listall: true, page: 1, pagesize: 1 }).then(json => {
getAPI('listVolumes', { listall: true, page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.volumes = json?.listvolumesresponse?.count
})
}
if ('listSnapshots' in this.$store.getters.apis) {
this.loading = true
api('listSnapshots', { listall: true, page: 1, pagesize: 1 }).then(json => {
getAPI('listSnapshots', { listall: true, page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.snapshots = json?.listsnapshotsresponse?.count
})
}
if ('listNetworks' in this.$store.getters.apis) {
this.loading = true
api('listNetworks', { listall: true, page: 1, pagesize: 1 }).then(json => {
getAPI('listNetworks', { listall: true, page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.networks = json?.listnetworksresponse?.count
})
}
if ('listVPCs' in this.$store.getters.apis) {
this.loading = true
api('listVPCs', { listall: true, page: 1, pagesize: 1 }).then(json => {
getAPI('listVPCs', { listall: true, page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.vpcs = json?.listvpcsresponse?.count
})
}
if ('listPublicIpAddresses' in this.$store.getters.apis) {
this.loading = true
api('listPublicIpAddresses', { listall: true, page: 1, pagesize: 1 }).then(json => {
getAPI('listPublicIpAddresses', { listall: true, page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.ips = json?.listpublicipaddressesresponse?.count
})
}
if ('listTemplates' in this.$store.getters.apis) {
this.loading = true
api('listTemplates', { templatefilter: 'self', listall: true, page: 1, pagesize: 1 }).then(json => {
getAPI('listTemplates', { templatefilter: 'self', listall: true, page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.templates = json?.listtemplatesresponse?.count
})
@ -558,20 +558,20 @@ export default {
return
}
this.loading = true
api('listVirtualMachines', { listall: true, details: 'min', page: 1, pagesize: 1 }).then(json => {
getAPI('listVirtualMachines', { listall: true, details: 'min', page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.instances = json?.listvirtualmachinesresponse?.count
})
api('listVirtualMachines', { listall: true, details: 'min', state: 'running', page: 1, pagesize: 1 }).then(json => {
getAPI('listVirtualMachines', { listall: true, details: 'min', state: 'running', page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.running = json?.listvirtualmachinesresponse?.count
})
api('listVirtualMachines', { listall: true, details: 'min', state: 'stopped', page: 1, pagesize: 1 }).then(json => {
getAPI('listVirtualMachines', { listall: true, details: 'min', state: 'stopped', page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.stopped = json?.listvirtualmachinesresponse?.count
})
if (this.isLeaseFeatureEnabled) {
api('listVirtualMachines', { leased: true, listall: true, details: 'min', page: 1, pagesize: 1 }).then(json => {
getAPI('listVirtualMachines', { leased: true, listall: true, details: 'min', page: 1, pagesize: 1 }).then(json => {
this.loading = false
this.data.leasedinstances = json?.listvirtualmachinesresponse?.count
if (!this.data.leasedinstances) {
@ -590,7 +590,7 @@ export default {
listall: true
}
this.loading = true
api('listEvents', params).then(json => {
getAPI('listEvents', params).then(json => {
this.events = []
this.loading = false
if (json && json.listeventsresponse && json.listeventsresponse.event) {

View File

@ -23,7 +23,7 @@
<script>
import store from '@/store'
import { mapActions } from 'vuex'
import { api } from '@/api'
import { getAPI } from '@/api'
import { OAUTH_DOMAIN, OAUTH_PROVIDER } from '@/store/mutation-types'
export default {
@ -47,7 +47,7 @@ export default {
const code = params.get('code')
const provider = this.$localStorage.get(OAUTH_PROVIDER)
this.state.loginBtn = true
api('verifyOAuthCodeAndGetUser', { provider: provider, secretcode: code }).then(response => {
getAPI('verifyOAuthCodeAndGetUser', { provider: provider, secretcode: code }).then(response => {
const email = response.verifyoauthcodeandgetuserresponse.oauthemail.email
const loginParams = {}
loginParams.email = email

View File

@ -55,7 +55,7 @@
</template>
<script>
import { api } from '@/api'
import { postAPI } from '@/api'
import { ref, reactive, toRaw } from 'vue'
export default {
@ -94,7 +94,7 @@ export default {
if (values.code !== null) {
this.buttonstate = true
}
api('validateUserTwoFactorAuthenticationCode', { codefor2fa: values.code }).then(response => {
postAPI('validateUserTwoFactorAuthenticationCode', { codefor2fa: values.code }).then(response => {
this.twoFAresponse = true
if (this.twoFAresponse) {
this.$notification.destroy()

View File

@ -191,7 +191,7 @@
</template>
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { timeZone } from '@/utils/timezone'
import debounce from 'lodash/debounce'
import ResourceIcon from '@/components/view/ResourceIcon'
@ -293,7 +293,7 @@ export default {
params.pagesize = 100
params.page = page
var count
api(apiToCall, params).then(json => {
getAPI(apiToCall, params).then(json => {
const listDomains = json.listdomainsresponse.domain
count = json.listdomainsresponse.count
this.domainsList = this.domainsList.concat(listDomains)
@ -309,7 +309,7 @@ export default {
this.roleLoading = true
const params = {}
params.state = 'enabled'
api('listRoles', params).then(response => {
getAPI('listRoles', params).then(response => {
this.roles = response.listrolesresponse.role || []
this.form.roleid = this.roles[0].id
if (this.isDomainAdmin()) {
@ -333,7 +333,7 @@ export default {
},
fetchIdps () {
this.idpLoading = true
api('listIdps').then(response => {
getAPI('listIdps').then(response => {
this.idps = response.listidpsresponse.idp || []
this.form.samlentity = this.idps[0].id || ''
}).finally(() => {
@ -366,7 +366,7 @@ export default {
params.networkdomain = values.networkdomain
}
api('createAccount', {}, 'POST', params).then(response => {
postAPI('createAccount', params).then(response => {
this.$emit('refresh-data')
this.$notification.success({
message: this.$t('label.create.account'),
@ -375,7 +375,7 @@ export default {
const users = response.createaccountresponse.account.user
if (values.samlenable && users) {
for (var i = 0; i < users.length; i++) {
api('authorizeSamlSso', {
postAPI('authorizeSamlSso', {
enable: values.samlenable,
entityid: values.samlentity,
userid: users[i].id

View File

@ -164,7 +164,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { timeZone } from '@/utils/timezone'
import store from '@/store'
@ -313,7 +313,7 @@ export default {
params.domainid = result[0].id
}
}
api('listLdapUsers', params).then(json => {
getAPI('listLdapUsers', params).then(json => {
const listLdapUsers = json.ldapuserresponse.LdapUser
if (listLdapUsers) {
const ldapUserLength = listLdapUsers.length
@ -332,7 +332,7 @@ export default {
fetchListDomains () {
return new Promise((resolve, reject) => {
const params = {}
api('listDomains', params).then(json => {
getAPI('listDomains', params).then(json => {
const listDomains = json.listdomainsresponse.domain
resolve(listDomains)
}).catch(error => {
@ -343,7 +343,7 @@ export default {
fetchListRoles () {
return new Promise((resolve, reject) => {
const params = {}
api('listRoles', params).then(json => {
getAPI('listRoles', params).then(json => {
const listRoles = json.listrolesresponse.role
resolve(listRoles)
}).catch(error => {
@ -353,7 +353,7 @@ export default {
},
fetchIdps () {
return new Promise((resolve, reject) => {
api('listIdps').then(json => {
getAPI('listIdps').then(json => {
const listIdps = json.listidpsresponse.idp || []
if (listIdps.length !== 0) {
this.form.samlEntity = listIdps[0].id
@ -384,7 +384,7 @@ export default {
params.group = values.group
apiName = 'importLdapUsers'
promises.push(new Promise((resolve, reject) => {
api(apiName, params).then(json => {
postAPI(apiName, params).then(json => {
resolve(json)
}).catch(error => {
reject(error)
@ -394,7 +394,7 @@ export default {
this.selectedRowKeys.forEach(username => {
params.username = username
promises.push(new Promise((resolve, reject) => {
api(apiName, params).then(json => {
postAPI(apiName, params).then(json => {
resolve(json)
}).catch(error => {
reject(error)
@ -467,7 +467,7 @@ export default {
params.userid = users[i].id
params.entityid = entityId
promises.push(new Promise((resolve, reject) => {
api('authorizeSamlSso', params).catch(error => {
postAPI('authorizeSamlSso', params).catch(error => {
reject(error)
})
}))

View File

@ -180,7 +180,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { timeZone } from '@/utils/timezone'
import debounce from 'lodash/debounce'
import ResourceIcon from '@/components/view/ResourceIcon'
@ -256,7 +256,7 @@ export default {
showicon: true,
details: 'min'
}
api('listDomains', params).then(response => {
getAPI('listDomains', params).then(response => {
this.domainsList = response.listdomainsresponse.domain || []
}).catch(error => {
this.$notification.error({
@ -278,7 +278,7 @@ export default {
if (domainid) {
params.domainid = domainid
}
api('listAccounts', params).then(response => {
getAPI('listAccounts', params).then(response => {
this.accountList = response.listaccountsresponse.account || []
}).catch(error => {
this.$notification.error({
@ -300,7 +300,7 @@ export default {
},
fetchIdps () {
this.idpLoading = true
api('listIdps').then(response => {
getAPI('listIdps').then(response => {
this.idps = response.listidpsresponse.idp || []
this.form.samlentity = this.idps[0].id || ''
}).finally(() => {
@ -331,7 +331,7 @@ export default {
const user = userCreationResponse?.createuserresponse?.user
if (values.samlenable && user) {
await api('authorizeSamlSso', {
await postAPI('authorizeSamlSso', {
enable: values.samlenable,
entityid: values.samlentity,
userid: user.id
@ -385,7 +385,7 @@ export default {
params.timezone = rawParams.timezone
}
return api('createUser', {}, 'POST', params)
return postAPI('createUser', params)
},
async validateConfirmPassword (rule, value) {
if (!value || value.length === 0) {

View File

@ -61,7 +61,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'
export default {
@ -134,7 +134,7 @@ export default {
if (this.isValidValueForKey(values, 'currentpassword') && values.currentpassword.length > 0) {
params.currentpassword = values.currentpassword
}
api('updateUser', {}, 'POST', params).then(json => {
postAPI('updateUser', params).then(json => {
this.$notification.success({
message: this.$t('label.action.change.password'),
description: `${this.$t('message.success.change.password')} ${this.resource.username}`

View File

@ -52,7 +52,7 @@
</template>
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
export default {
name: 'ConfigureSamlSsoAuth',
@ -81,14 +81,14 @@ export default {
fetchData () {
this.IsUserSamlAuthorized()
this.loading = true
api('listIdps').then(response => {
getAPI('listIdps').then(response => {
this.idps = response.listidpsresponse.idp || []
}).finally(() => {
this.loading = false
})
},
IsUserSamlAuthorized () {
api('listSamlAuthorization', {
getAPI('listSamlAuthorization', {
userid: this.resource.id
}).then(response => {
this.form.samlEnable = response.listsamlauthorizationsresponse.samlauthorization[0].status || false
@ -103,7 +103,7 @@ export default {
if (this.loading) return
this.formRef.value.validate().then(() => {
const values = toRaw(this.form)
api('authorizeSamlSso', {
postAPI('authorizeSamlSso', {
enable: values.samlEnable,
userid: this.resource.id,
entityid: values.samlEntity

View File

@ -117,7 +117,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { mixinForm } from '@/utils/mixin'
import TooltipLabel from '@/components/widgets/TooltipLabel'
@ -196,7 +196,7 @@ export default {
},
createRole (params) {
this.loading = true
api('createRole', params).then(json => {
postAPI('createRole', params).then(json => {
const role = json.createroleresponse.role
if (role) {
this.$emit('refresh-data')
@ -214,7 +214,7 @@ export default {
},
fetchRoles () {
const params = {}
api('listRoles', params).then(json => {
getAPI('listRoles', params).then(json => {
if (json && json.listrolesresponse && json.listrolesresponse.role) {
this.roles = json.listrolesresponse.role
}

View File

@ -55,7 +55,7 @@
<script>
import { ref, reactive } from 'vue'
import { api } from '@/api'
import { postAPI } from '@/api'
export default {
name: 'DeleteAccount',
@ -106,7 +106,7 @@ export default {
this.$router.push({ path: '/account' })
.then(() => {
// After successful navigation, start the deletion job
api('deleteAccount', {
postAPI('deleteAccount', {
id: accountId
}).then(response => {
this.$pollJob({
@ -128,7 +128,7 @@ export default {
this.isDeleting = false
// If navigation fails, still try to delete the account
// but don't navigate afterwards
api('deleteAccount', {
postAPI('deleteAccount', {
id: accountId
}).then(response => {
this.$pollJob({

View File

@ -134,7 +134,7 @@
</template>
<script>
import { api } from '@/api'
import { postAPI } from '@/api'
import { ref, reactive, toRaw } from 'vue'
import TooltipLabel from '@/components/widgets/TooltipLabel'
@ -242,7 +242,7 @@ export default {
delete params[key]
}
})
api(this.action.api, params).then(json => {
postAPI(this.action.api, params).then(json => {
for (const obj in json) {
if (obj.includes('response')) {
for (const res in json[obj]) {

View File

@ -78,7 +78,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import store from '@/store'
import { mixinDevice } from '@/utils/mixin.js'
@ -173,7 +173,7 @@ export default {
this.loading = true
params.showicon = true
api('listDomains', params).then(json => {
getAPI('listDomains', params).then(json => {
const domains = json.listdomainsresponse.domain || []
this.treeData = this.generateTreeData(domains)
this.resource = domains[0] || {}
@ -274,23 +274,20 @@ export default {
}
param.loading = true
param.opts = []
api(possibleApi, params).then(json => {
param.loading = false
for (const obj in json) {
if (obj.includes('response')) {
for (const res in json[obj]) {
if (res === 'count') {
continue
}
param.opts = json[obj][res]
break
postAPI(possibleApi, params)
.then(json => {
param.loading = false
const responseObj = Object.values(json).find(obj => obj.includes('response'))
if (responseObj) {
const responseData = Object.entries(responseObj).find(([res, value]) => res !== 'count')
if (responseData) {
param.opts = responseData[1]
}
break
}
}
}).catch(() => {
param.loading = false
})
})
.catch(() => {
param.loading = false
})
},
generateTreeData (treeData) {
const result = []

View File

@ -77,7 +77,7 @@
</template>
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'
export default {
@ -128,7 +128,7 @@ export default {
this.roleLoading = true
const params = {}
params.state = 'enabled'
api('listRoles', params).then(response => {
getAPI('listRoles', params).then(response => {
this.roles = response.listrolesresponse.role || []
this.form.roleid = this.resource.roleid
}).finally(() => {
@ -154,7 +154,7 @@ export default {
params.networkdomain = values.networkdomain
}
api('updateAccount', params).then(response => {
getAPI('updateAccount', params).then(response => {
this.$emit('refresh-data')
this.$notification.success({
message: this.$t('label.edit.account'),

View File

@ -102,7 +102,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { postAPI } from '@/api'
import { timeZone } from '@/utils/timezone'
import debounce from 'lodash/debounce'
import TooltipLabel from '@/components/widgets/TooltipLabel'
@ -209,7 +209,7 @@ export default {
params.timezone = values.timezone
}
api('updateUser', params).then(response => {
postAPI('updateUser', params).then(response => {
this.$emit('refresh-data')
this.$notification.success({
message: this.$t('label.edit.user'),

View File

@ -105,7 +105,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { postAPI } from '@/api'
import TooltipLabel from '@/components/widgets/TooltipLabel'
export default {
@ -207,7 +207,7 @@ export default {
},
importRole (params) {
this.loading = true
api('importRole', {}, 'POST', params).then(json => {
postAPI('importRole', params).then(json => {
const role = json.importroleresponse.role
if (role) {
this.$emit('refresh-data')

View File

@ -115,7 +115,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import draggable from 'vuedraggable'
import PermissionEditable from './PermissionEditable'
import RuleDelete from './RuleDelete'
@ -180,7 +180,7 @@ export default {
},
fetchData (callback = null) {
if (!this.resource.id) return
api('listRolePermissions', { roleid: this.resource.id }).then(response => {
getAPI('listRolePermissions', { roleid: this.resource.id }).then(response => {
this.rules = response.listrolepermissionsresponse.rolepermission
this.totalRules = this.rules
}).catch(error => {
@ -200,7 +200,7 @@ export default {
},
changeOrder () {
this.updateTable = true
api('updateRolePermission', {}, 'POST', {
postAPI('updateRolePermission', {
roleid: this.resource.id,
ruleorder: this.rules.map(rule => rule.id)
}).catch(error => {
@ -212,7 +212,7 @@ export default {
},
onRuleDelete (key) {
this.updateTable = true
api('deleteRolePermission', { id: key }).catch(error => {
postAPI('deleteRolePermission', { id: key }).catch(error => {
this.$notifyError(error)
}).finally(() => {
this.updateTable = false
@ -225,7 +225,7 @@ export default {
if (!record) return
this.updateTable = true
api('updateRolePermission', {
postAPI('updateRolePermission', {
roleid: this.resource.id,
ruleid: record.id,
permission: value
@ -247,7 +247,7 @@ export default {
}
this.updateTable = true
api('createRolePermission', {
postAPI('createRolePermission', {
rule: this.newRule,
permission: this.newRulePermission,
description: this.newRuleDescription,

View File

@ -72,7 +72,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import TooltipButton from '@/components/widgets/TooltipButton'
export default {
@ -160,7 +160,7 @@ export default {
this.loading = true
api('listSslCerts', params).then(json => {
getAPI('listSslCerts', params).then(json => {
const listSslResponse = json.listsslcertsresponse.sslcert
// check exists json response
@ -191,7 +191,7 @@ export default {
const message = `${this.$t('label.delete.certificate')} ${this.$t('label.in.progress.for')} ${row.name}`
const loading = this.$message.loading(message, 0)
api('deleteSslCert', params).then(json => {
postAPI('deleteSslCert', params).then(json => {
const jsonResponse = json.deletesslcertresponse
// hide loading

View File

@ -130,7 +130,7 @@
</template>
<script>
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import { ref, reactive, toRaw } from 'vue'
import store from '@/store'
import VueQrious from 'vue-qrious'
@ -183,7 +183,7 @@ export default {
},
handleSelectChange (val) {
if (this.twoFAenabled) {
api('setupUserTwoFactorAuthentication', { enable: 'false' }).then(response => {
postAPI('setupUserTwoFactorAuthentication', { enable: 'false' }).then(response => {
this.pin = ''
this.username = ''
this.totpUrl = ''
@ -211,7 +211,7 @@ export default {
} else {
provider = this.selectedProvider
}
api('setupUserTwoFactorAuthentication', { provider: provider }).then(response => {
postAPI('setupUserTwoFactorAuthentication', { provider: provider }).then(response => {
this.pin = response.setupusertwofactorauthenticationresponse.setup2fa.secretcode
if (this.selectedProvider === 'totp' || this.selectedProvider === 'othertotp') {
this.username = response.setupusertwofactorauthenticationresponse.setup2fa.username
@ -238,7 +238,7 @@ export default {
})
},
disable2FAProvider () {
api('setupUserTwoFactorAuthentication', { enable: false }).then(response => {
postAPI('setupUserTwoFactorAuthentication', { enable: false }).then(response => {
this.showPin = false
this.twoFAenabled = false
this.twoFAverified = false
@ -250,7 +250,7 @@ export default {
})
},
list2FAProviders () {
api('listUserTwoFactorAuthenticatorProviders', {}).then(response => {
getAPI('listUserTwoFactorAuthenticatorProviders', {}).then(response => {
var providerlist = response.listusertwofactorauthenticatorprovidersresponse.providers || []
var providernames = []
for (const provider of providerlist) {
@ -268,7 +268,7 @@ export default {
if (values.code !== null) {
this.verifybuttonstate = true
}
api('validateUserTwoFactorAuthenticationCode', { codefor2fa: values.code }).then(response => {
postAPI('validateUserTwoFactorAuthenticationCode', { codefor2fa: values.code }).then(response => {
this.$message.success({
content: `${this.$t('label.action.enable.two.factor.authentication')}`,
duration: 2

View File

@ -137,7 +137,7 @@
<script>
import { ref, reactive, toRaw } from 'vue'
import { api } from '@/api'
import { getAPI, postAPI } from '@/api'
import ResourceIcon from '@/components/view/ResourceIcon'
import TooltipLabel from '@/components/widgets/TooltipLabel'
@ -229,7 +229,7 @@ export default {
const params = {}
params.showicon = true
this.zoneLoading = true
api('listZones', params).then(json => {
getAPI('listZones', params).then(json => {
const listZones = json.listzonesresponse.zone
if (listZones) {
this.zones = this.zones.concat(listZones)
@ -281,7 +281,7 @@ export default {
if (this.isValidValueForKey(values, 'minmemory') && values.minmemory > 0) {
params.minmemory = values.minmemory
}
api('addKubernetesSupportedVersion', params).then(json => {
postAPI('addKubernetesSupportedVersion', params).then(json => {
this.$message.success(`${this.$t('message.success.add.kuberversion')}: ${values.semanticversion}`)
this.$emit('refresh-data')
this.closeAction()

Some files were not shown because too many files have changed in this diff Show More