Skip to content

Commit 14a9f8b

Browse files
committed
Address copilot reviews
1 parent 2b4600a commit 14a9f8b

9 files changed

Lines changed: 14 additions & 19 deletions

File tree

plugins/database/quota/src/main/java/org/apache/cloudstack/api/command/QuotaCreditsCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class QuotaCreditsCmd extends BaseCmd {
6060

6161
@ACL
6262
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class,
63-
description = "ID of the Project for which qQuota credits will be added. Can not be specified with '" + ApiConstants.ACCOUNT_ID + "'.")
63+
description = "ID of the Project for which Quota credits will be added. Can not be specified with '" + ApiConstants.ACCOUNT_ID + "'.")
6464
private Long projectId;
6565

6666
@Parameter(name = ApiConstants.VALUE, type = CommandType.DOUBLE, required = true, description = "Amount of credits to be added (in case of a positive value) or subtracted (in case of a negative value).")

plugins/database/quota/src/main/java/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ protected void lockOrUnlockAccountIfRequired(BigDecimal currentAccountBalance, A
766766
return;
767767
}
768768

769-
if (enforceQuota && account.getState() == Account.State.ENABLED && _quotaManager.isLockable(account)) {
769+
if (Boolean.TRUE.equals(enforceQuota) && account.getState() == Account.State.ENABLED && _quotaManager.isLockable(account)) {
770770
logger.info("Locking Account [{}] due to negative balance.", accountName);
771771
_accountMgr.lockAccount(accountName, domainId, accountId);
772772
}

ui/src/components/view/ListView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,13 +677,13 @@
677677
<template v-if="text">
678678
<template v-if="!text.startsWith('PrjAcct-')">
679679
<router-link
680-
v-if="$route.path.startsWith('/quotasummary') && $router.resolve(`${$route.path}/${record.accountid}`) !== '404'"
680+
v-if="$route.path.startsWith('/quotasummary') && $router.resolve(`${$route.path}/${record.accountid}`).matched[0].redirect !== '/exception/404'"
681681
:to="{ path: `${$route.path}/${record.accountid}` }">{{ text }}</router-link>
682682
<span v-else>{{ text }}</span>
683683
</template>
684684
<template v-else>
685685
<router-link
686-
v-if="$route.path.startsWith('/quotasummary') && $router.resolve(`${$route.path}/${record.accountid}`) !== '404'"
686+
v-if="$route.path.startsWith('/quotasummary') && $router.resolve(`${$route.path}/${record.accountid}`).matched[0].redirect !== '/exception/404'"
687687
:to="{ path: `${$route.path}/${record.accountid}` }">{{ (record.projectname || record.account).concat(' (').concat($t('label.project')).concat(')') }}</router-link>
688688
<span v-else>{{ text }}</span>
689689
</template>

ui/src/utils/export.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function exportDataToCsv ({ data = null, keys = null, headers = null, col
3434

3535
if (typeof item[key] === 'string' && item[key].includes(columnDelimiter)) {
3636
dataParsed += `"${item[key]}"`
37-
} else if (dateFormat && item[key] instanceof dayjs) {
37+
} else if (dateFormat && dayjs.isDayjs(item[key])) {
3838
dataParsed += `"${item[key].format(dateFormat)}"`
3939
} else {
4040
dataParsed += item[key]

ui/src/views/AutogenView.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,9 @@ export default {
11181118
11191119
if (this.apiName === 'quotaTariffList' && !('quotaTariffCreate' in store.getters.apis || 'quotaTariffUpdate' in store.getters.apis)) {
11201120
const index = this.columns.findIndex(col => col.dataIndex === 'hasActivationRule')
1121-
this.columns.splice(index, 1)
1121+
if (index >= 0) {
1122+
this.columns.splice(index, 1)
1123+
}
11221124
}
11231125
11241126
this.loading = true

ui/src/views/plugins/quota/AddQuotaCredit.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,12 @@ export default {
9494
},
9595
created () {
9696
this.initForm()
97-
console.log(store.getters.project)
98-
console.log(store.getters.userInfo)
9997
},
10098
methods: {
10199
initForm () {
102100
this.formRef = ref()
103101
this.form = reactive({})
104102
this.rules = reactive({
105-
domainid: [{ required: true, message: this.$t('message.action.quota.credit.add.error.domainidrequired') }],
106-
accountid: [{ required: true, message: this.$t('message.action.quota.credit.add.error.accountrequired') }],
107103
value: [{ required: true, message: this.$t('message.action.quota.credit.add.error.valuerequired') }]
108104
})
109105
},
@@ -142,7 +138,6 @@ export default {
142138
this.$emit('close-action')
143139
},
144140
fetchOwnerOptions (OwnerOptions) {
145-
console.log(OwnerOptions)
146141
this.owner = {}
147142
if (OwnerOptions.selectedAccountType === 'Account') {
148143
if (!OwnerOptions.selectedAccount) {

ui/src/views/plugins/quota/QuotaBalanceTab.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ export default {
121121
async getQuotaBalance () {
122122
const params = {
123123
accountid: this.$route.params?.id,
124-
startDate: this.startDate,
125-
endDate: this.endDate
124+
startdate: this.startDate,
125+
enddate: this.endDate
126126
}
127127
128128
return await getAPI('quotaBalance', params)

ui/src/views/plugins/quota/QuotaCreditTab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export default {
132132
}
133133
134134
return await getAPI('quotaCreditsList', params)
135-
.then(json => json.quotacreditslistresponse.credit || {})
135+
.then(json => json.quotacreditslistresponse.credit || [])
136136
.catch(error => { error && this.$notification.info({ message: this.$t('message.request.no.data') }) })
137137
},
138138
exportDataToCsv () {

ui/src/views/plugins/quota/QuotaUsageTab.vue

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
class="w-100"
100100
style="margin: 5px 0 10px 0px"
101101
show-search
102-
v-model="selectedType"
103102
@change="handleSelectedTypeChange">
104103
<a-select-option
105104
v-for="quotaType of getQuotaTypesFiltered()"
@@ -133,7 +132,7 @@
133132
<span v-if="!text">
134133
-
135134
</span>
136-
<span v-if="!text === '<untraceable>' || !record.resourceid">
135+
<span v-if="text === '<untraceable>' || !record.resourceid">
137136
{{ text }}
138137
</span>
139138
<a v-else @click="handleSelectedResourceChange(record.resourceid)">
@@ -160,7 +159,6 @@
160159
class="w-100"
161160
style="margin: 5px 0 10px 0px"
162161
show-search
163-
v-model="selectedResource"
164162
@change="handleSelectedResourceChange"
165163
:disabled="getResources().length == 0">
166164
<a-select-option
@@ -339,7 +337,7 @@ export default {
339337
{
340338
title: this.$t('label.quota.consumed'),
341339
dataIndex: 'quotaconsumed',
342-
sorter: (a, b) => a.quotaused - b.quotaused
340+
sorter: (a, b) => a.quotaconsumed - b.quotaconsumed
343341
}
344342
]
345343
}
@@ -554,7 +552,7 @@ export default {
554552
pushDateToLabelsIfNotPresent (lineChartLabels, date) {
555553
const hasDate = lineChartLabels.some(d => {
556554
const diff = Math.abs(new Date(date) - new Date(d).getTime())
557-
return diff < 5 * 1000 // Do not push the label if there is already one within 5 minutes
555+
return diff < 5 * 1000 * 60 // Do not push the label if there is already one within 5 minutes
558556
})
559557
if (!hasDate) {
560558
lineChartLabels.push(date)

0 commit comments

Comments
 (0)