3 * ============LICENSE_START=======================================================
4 * Copyright (C) 2022 Nordix Foundation.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 import i18n from 'nfvo-utils/i18n/i18n';
24 export default class VspUploadStatus {
25 static UPLOADING = 'UPLOADING';
26 static VALIDATING = 'VALIDATING';
27 static PROCESSING = 'PROCESSING';
28 static SUCCESS = 'SUCCESS';
29 static ERROR = 'ERROR';
39 constructor(vspUploadStatusResponse) {
40 this.status = vspUploadStatusResponse.status;
41 this.complete = vspUploadStatusResponse.complete;
42 this.created = vspUploadStatusResponse.created;
43 this.lockId = vspUploadStatusResponse.lockId;
44 this.updated = vspUploadStatusResponse.updated;
45 this.vspId = vspUploadStatusResponse.vspId;
46 this.vspVersionId = vspUploadStatusResponse.vspVersionId;
53 switch (this.status) {
54 case VspUploadStatus.UPLOADING: {
55 return i18n('upload.status.uploading');
57 case VspUploadStatus.VALIDATING: {
58 return i18n('upload.status.validating');
60 case VspUploadStatus.PROCESSING: {
61 return i18n('upload.status.processing');
63 case VspUploadStatus.SUCCESS: {
64 return i18n('upload.status.success');
66 case VspUploadStatus.ERROR: {
67 return i18n('upload.status.error');