const exception = function ignoreException() {};
const packagePropertyNames = Object.keys(defaults.downloadPackage);
+const API_SERVER = utils.getSearchParams(window.location).api_server;
+const FILE_SERVER = window.location.hostname === 'localhost'
+ ? API_SERVER : window.location.protocol + '//' + window.location.hostname;
function getCatalogPackageManagerServerOrigin() {
- return utils.getSearchParams(window.location).upload_server + ':4567';
+ return FILE_SERVER + ':8008';
}
function delayStatusCheck(statusCheckFunction, operation) {
copyCatalogPackage(sourcePackage) {
let operationInfo = Object.assign({}, defaults.operation);
- operationInfo.name = "Duplication of " + sourcePackage.name;
- operationInfo.id = guid();
- operationInfo.icon = imgCopy;
- operationInfo.type = 'copy';
- operationInfo.message = 'Requesting package duplication.';
+
operationInfo.args.packageType = sourcePackage['uiState']['type'].toUpperCase();
operationInfo.args.id = sourcePackage.id;
operationInfo.args.name = sourcePackage.name + ' copy';
+ operationInfo.id = guid();
+ operationInfo.icon = imgCopy;
+ operationInfo.type = 'copy';
+ operationInfo.name = "Creating " + operationInfo.args.name;
+ operationInfo.message = "Requesting duplication";
+
this.addOperation(operationInfo);
this.getInstance().requestCatalogPackageCopy(operationInfo, sourcePackage);
}
break;
case 'upload-success':
statusInfo.pending = true;
- statusInfo.progress = 100;
+ statusInfo.progress = 50;
statusInfo.message = 'Upload completed.';
statusInfo.transactionId = responseData['transaction_id'] || responseData['transaction-id'] || operation.transactionId;
break;
case 'pending':
statusInfo.pending = true;
statusInfo.progress = 50;
- statusInfo.message = responseData.events[responseData.events.length - 1].text;
+ statusInfo.message = responseData.events && responseData.events.length && responseData.events[responseData.events.length - 1].text;
break;
case 'success':
statusInfo.success = true;
if (operation.type === 'download') {
statusInfo.urlValidUntil = moment().add(defaults.downloadUrlTimeToLiveInMinutes, 'minutes').toISOString();
if (responseData.filename) {
- statusInfo.url = getCatalogPackageManagerServerOrigin() + '/api/export/' + responseData.filename;
+ statusInfo.url = getCatalogPackageManagerServerOrigin() + '/mano/export/' + responseData.filename;
} else {
- statusInfo.url = getCatalogPackageManagerServerOrigin() + '/api/export/' + operation.transactionId + '.tar.gz';
+ statusInfo.url = getCatalogPackageManagerServerOrigin() + '/mano/export/' + operation.transactionId + '.tar.gz';
}
}
break;
statusInfo.error = true;
statusInfo.message = responseData.errors[0].value;
break;
+ case 'COMPLETED':
+ statusInfo.success = true;
+ statusInfo.progress = 100;
+ statusInfo.message = "Onboarding completed";
+ break;
+ case 'IN_PROGRESS':
+ statusInfo.pending = true;
+ statusInfo.progress = (operation.progress || 25) + ((100 - operation.progress) / 2);
+ statusInfo.message = "Onboarding in progress";
+ break;
+ case 'FAILED':
+ statusInfo.error = true;
+ statusInfo.message = "Operation failed";
+ break;
default:
- throw new ReferenceError('a status of "request", "success", "failure", "pending", "upload-completed", "upload-error", "download-requested", "upload-progress", "upload-action" is required');
+ statusInfo.error = true;
+ statusInfo.message = responseData.message || "Operation failed";
}
} else {
// typically get here due to unexpected development errors (backend exceptions, down/up load server access issues)