Skip to content

Commit

Permalink
fix(dedicated.pcc): fix display of operation tasks
Browse files Browse the repository at this point in the history
ref: MANAGER-16581 PRB0040995 PRB0041695

Signed-off-by: David Arsène <david.arsene.ext@ovhcloud.com>
  • Loading branch information
darsene committed Dec 20, 2024
1 parent 5dc4f4b commit 728a3bf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -551,15 +551,15 @@ class DedicatedCloudService {

/* ------- ICEBERG -------*/

icebergQuery(url, params) {
icebergQuery(url, paginationParams, urlParams) {
const {
filters,
pageSize,
offset,
sort,
sortOrder,
defaultFilterColumn,
} = params;
} = paginationParams;

let request = this.iceberg(url)
.query()
Expand All @@ -573,7 +573,7 @@ class DedicatedCloudService {
}

return this.$q
.resolve(request.execute(null, true).$promise)
.resolve(request.execute(urlParams, true).$promise)
.then(({ data, headers }) => ({
data,
meta: {
Expand Down Expand Up @@ -1468,8 +1468,12 @@ class DedicatedCloudService {

/* ------- Operations -------*/

getOperations(serviceName, params) {
return this.icebergQuery(`/dedicatedCloud/${serviceName}/task`, params);
getOperations(serviceName, paginationParams, urlParams) {
return this.icebergQuery(
`/dedicatedCloud/${serviceName}/task`,
paginationParams,
urlParams,
);
}

getOperation(serviceName, opts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class {
return this.DedicatedCloud.getModels()
.then((data) => {
this.stateEnum = data.models['dedicatedCloud.TaskStateEnum'].enum;
this.progressionFilter = null;
this.progressionFilter = 'doing';
this.progressionFilterList = map(this.stateEnum, (state) => ({
value: state,
label: this.$translate.instant(
Expand Down Expand Up @@ -57,23 +57,31 @@ export default class {
}

loadOperations({ offset, pageSize, sort }) {
const params = {
const paginationParams = {
offset,
pageSize,
sort: sort.property,
sortOrder: sort.dir === 1 ? 'ASC' : 'DESC',
defaultFilterColumn: 'executionDate',
filters: this.progressionFilter
? [
{
field: 'state',
comparator: 'is',
reference: [this.progressionFilter],
},
]
: [],
};
return this.DedicatedCloud.getOperations(this.productId, params);
return this.DedicatedCloud.getOperations(this.productId, paginationParams, {
state: this.progressionFilter,
}).catch((error) => {
// fallback only for the last 6 months in case of too many data
if (error.status >= 500) {
const date = new Date();
date.setMonth(date.getMonth() - 6);
return this.DedicatedCloud.getOperations(
this.productId,
paginationParams,
{
state: this.progressionFilter,
executionDate: date.toISOString(),
},
);
}
return error;
});
}

setRelatedServices(operation) {
Expand Down

0 comments on commit 728a3bf

Please sign in to comment.