Fix error case in uploading tar, more comments

This commit is contained in:
Sam Chow 2018-06-22 13:21:44 -04:00
parent d6d0bb640a
commit 872be8605a
6 changed files with 37 additions and 17 deletions

View file

@ -2,6 +2,8 @@ import {Component, EventEmitter, Inject, Output} from 'ng-metadata/core';
const templateUrl = require('./load-config.html');
const styleUrl = require('./load-config.css');
declare var bootbox: any;
@Component({
selector: 'load-config',
templateUrl,
@ -29,9 +31,17 @@ export class LoadConfigComponent {
if (success) {
this.configLoaded.emit({});
} else {
this.apiService.errorDisplay('Error loading configuration',
'Could not upload configuration. Please reload the page and try again.\n' +
'If this problem persists, please contact support')();
bootbox.dialog({
"message": 'Could not upload configuration. Please check you have provided a valid tar file' +
'If this problem persists, please contact support',
"title": 'Error Loading Configuration',
"buttons": {
"close": {
"label": "Close",
"className": "btn-primary"
}
}
});
}
});
}

View file

@ -31,10 +31,9 @@ const templateUrl = require('./setup.html');
$scope.HOSTNAME_REGEX = '^[a-zA-Z-0-9_\.\-]+(:[0-9]+)?$';
$scope.validateHostname = function(hostname) {
// TODO(sam): maybe revert?
// if (hostname.indexOf('127.0.0.1') == 0 || hostname.indexOf('localhost') == 0) {
// return 'Please specify a non-localhost hostname. "localhost" will refer to the container, not your machine.'
// }
if (hostname.indexOf('127.0.0.1') == 0 || hostname.indexOf('localhost') == 0) {
return 'Please specify a non-localhost hostname. "localhost" will refer to the container, not your machine.'
}
return null;
};