Add pre-flight and fix clone dialog
This commit is contained in:
+8
-8
@@ -202,22 +202,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="text-center" ng-show="appClone.location && appClone.domain.provider === 'manual'">
|
||||
<b>Add an A record manually for {{ appClone.location }} to this Cloudron's public IP</b>
|
||||
<p class="text-center" ng-show="clone.location && clone.domain.provider === 'manual'">
|
||||
<b>Add an A record manually for {{ clone.location }} to this Cloudron's public IP</b>
|
||||
<br>
|
||||
</p>
|
||||
|
||||
<div class="has-error text-center" ng-show="appClone.error.port">{{ appClone.error.port }}</div>
|
||||
<div ng-repeat="(env, info) in appClone.portBindingsInfo">
|
||||
<div class="has-error text-center" ng-show="clone.error.port">{{ clone.error.port }}</div>
|
||||
<div ng-repeat="(env, info) in clone.portBindingsInfo">
|
||||
<ng-form name="portInfo_form">
|
||||
<div class="form-group" ng-class="{ 'has-error': (!appClone.itemName{{$index}}.$dirty && appClone.error.port) || (portInfo_form.itemName{{$index}}.$dirty && portInfo_form.itemName{{$index}}.$invalid) }">
|
||||
<label class="control-label" for="inputPortInfo{{env}}"><input type="checkbox" ng-model="appClone.portBindingsEnabled[env]">
|
||||
<div class="form-group" ng-class="{ 'has-error': (!clone.itemName{{$index}}.$dirty && clone.error.port) || (portInfo_form.itemName{{$index}}.$dirty && portInfo_form.itemName{{$index}}.$invalid) }">
|
||||
<label class="control-label" for="inputPortInfo{{env}}"><input type="checkbox" ng-model="clone.portBindingsEnabled[env]">
|
||||
{{ info.title }}
|
||||
<sup>
|
||||
<a popover-placement="top-right" popover-trigger="outsideClick" uib-popover="{{info.description}} ({{ HOST_PORT_MIN }} - {{ HOST_PORT_MAX }})"><i class="fa fa-question-circle"></i></a>
|
||||
</sup>
|
||||
</label>
|
||||
<input type="number" class="form-control" ng-model="appClone.portBindings[env]" ng-disabled="!appClone.portBindingsEnabled[env]" id="inputPortInfo{{env}}" later-name="itemName{{$index}}" min="{{hostPortMin}}" max="{{hostPortMax}}" required>
|
||||
<input type="number" class="form-control" ng-model="clone.portBindings[env]" ng-disabled="!clone.portBindingsEnabled[env]" id="inputPortInfo{{env}}" later-name="itemName{{$index}}" min="{{hostPortMin}}" max="{{hostPortMax}}" required>
|
||||
</div>
|
||||
</ng-form>
|
||||
</div>
|
||||
@@ -227,7 +227,7 @@
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-success" ng-click="appClone.submit()"><i class="far fa-clone"></i> Clone</button>
|
||||
<button type="button" class="btn btn-success" ng-click="clone.submit()"><i class="far fa-clone" ng-hide="clone.busy"></i><i class="fa fa-circle-notch fa-spin" ng-show="clone.busy"></i> Clone</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+41
-16
@@ -6,6 +6,7 @@
|
||||
/* global asyncForEach */
|
||||
/* global RSTATES */
|
||||
/* global ISTATES */
|
||||
/* global ERROR */
|
||||
|
||||
|
||||
// TODO use this once we enable custom SSL certificate ui again
|
||||
@@ -690,7 +691,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
};
|
||||
|
||||
$scope.clone = {
|
||||
busy: true,
|
||||
busy: false,
|
||||
error: {},
|
||||
|
||||
backup: null,
|
||||
@@ -734,28 +735,52 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
backupId: $scope.clone.backup.id
|
||||
};
|
||||
|
||||
Client.cloneApp($scope.app.id, data, function (error/*, clonedApp */) {
|
||||
$scope.clone.busy = false;
|
||||
|
||||
Client.checkDNSRecords(data.domain, data.location, function (error, result) {
|
||||
if (error) {
|
||||
if (error.statusCode === 409) {
|
||||
if (error.portName) {
|
||||
$scope.clone.error.port = error.message;
|
||||
} else if (error.domain) {
|
||||
$scope.clone.error.location = 'This location is already taken.';
|
||||
$('#cloneLocationInput').focus();
|
||||
} else {
|
||||
Client.error(error);
|
||||
}
|
||||
Client.error(error);
|
||||
$scope.clone.busy = false;
|
||||
return;
|
||||
}
|
||||
if (result.error) {
|
||||
if (result.error.reason === ERROR.ACCESS_DENIED) {
|
||||
$scope.clone.error.location = 'DNS credentials for ' + data.domain + ' are invalid. Update it in Domains & Certs view';
|
||||
} else {
|
||||
Client.error(error);
|
||||
$scope.clone.error.location = result.error.message;
|
||||
}
|
||||
$scope.clone.needsOverwrite = true;
|
||||
$scope.clone.busy = false;
|
||||
return;
|
||||
}
|
||||
if (result.needsOverwrite) {
|
||||
$scope.clone.error.location = 'DNS Record already exists. Confirm that the domain is not in use for services external to Cloudron';
|
||||
$scope.clone.needsOverwrite = true;
|
||||
$scope.clone.busy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
$('#cloneModal').modal('hide');
|
||||
Client.cloneApp($scope.app.id, data, function (error/*, clonedApp */) {
|
||||
$scope.clone.busy = false;
|
||||
|
||||
$location.path('/apps');
|
||||
if (error) {
|
||||
if (error.statusCode === 409) {
|
||||
if (error.portName) {
|
||||
$scope.clone.error.port = error.message;
|
||||
} else if (error.domain) {
|
||||
$scope.clone.error.location = 'This location is already taken.';
|
||||
$('#cloneLocationInput').focus();
|
||||
} else {
|
||||
Client.error(error);
|
||||
}
|
||||
} else {
|
||||
Client.error(error);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$('#cloneModal').modal('hide');
|
||||
|
||||
$location.path('/apps');
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/* global angular:false */
|
||||
/* global $:false */
|
||||
/* global ERROR */
|
||||
|
||||
angular.module('Application').controller('AppStoreController', ['$scope', '$location', '$timeout', '$routeParams', 'Client', function ($scope, $location, $timeout, $routeParams, Client) {
|
||||
Client.onReady(function () { if (!Client.getUserInfo().admin) $location.path('/'); });
|
||||
|
||||
Reference in New Issue
Block a user