Cleanup apps view while removing update modal
This commit is contained in:
@@ -21,10 +21,9 @@ angular.module('Application').controller('AppsController', ['$scope', '$timeout'
|
||||
confirmed: false,
|
||||
|
||||
show: function (app) {
|
||||
$scope.reset();
|
||||
|
||||
$scope.appPostInstallConfirm.app = app;
|
||||
$scope.appPostInstallConfirm.message = app.manifest.postInstallMessage;
|
||||
$scope.appPostInstallConfirm.confirmed = false;
|
||||
|
||||
$('#appPostInstallConfirmModal').modal('show');
|
||||
|
||||
@@ -41,61 +40,17 @@ angular.module('Application').controller('AppsController', ['$scope', '$timeout'
|
||||
}
|
||||
};
|
||||
|
||||
$scope.showAppDebug = function (app) {
|
||||
$location.path('/app/' + app.id + '/debug');
|
||||
$scope.showAppConfigure = function (app, view) {
|
||||
$location.path('/app/' + app.id + '/' + view);
|
||||
};
|
||||
|
||||
$scope.appUpdate = {
|
||||
busy: false,
|
||||
error: {},
|
||||
app: {},
|
||||
manifest: {},
|
||||
portBindings: {},
|
||||
Client.onReady(function () {
|
||||
Client.refreshInstalledApps(); // refresh the new list immediately when switching from another view (appstore)
|
||||
|
||||
show: function (app, updateManifest) {
|
||||
$scope.reset();
|
||||
var refreshAppsTimer = $interval(Client.refreshInstalledApps.bind(Client), 5000);
|
||||
|
||||
$scope.appUpdate.app = app;
|
||||
$scope.appUpdate.manifest = angular.copy(updateManifest);
|
||||
if (!$scope.user.admin) return;
|
||||
|
||||
$('#appUpdateModal').modal('show');
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
$scope.appUpdate.busy = true;
|
||||
|
||||
Client.updateApp($scope.appUpdate.app.id, $scope.appUpdate.manifest, function (error) {
|
||||
if (error) {
|
||||
Client.error(error);
|
||||
} else {
|
||||
$scope.appUpdate.app = {};
|
||||
$('#appUpdateModal').modal('hide');
|
||||
}
|
||||
|
||||
$scope.appUpdate.busy = false;
|
||||
|
||||
Client.refreshAppCache($scope.appUpdate.app.id); // reflect the new app state immediately
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.reset = function () {
|
||||
// close all dialogs
|
||||
$('#appUpdateModal').modal('hide');
|
||||
$('#appPostInstallConfirmModal').modal('hide');
|
||||
|
||||
// reset update dialog
|
||||
$scope.appUpdate.error = {};
|
||||
$scope.appUpdate.app = {};
|
||||
$scope.appUpdate.manifest = {};
|
||||
|
||||
// post install confirmation dialog
|
||||
$scope.appPostInstallConfirm.app = {};
|
||||
$scope.appPostInstallConfirm.message = '';
|
||||
$scope.appPostInstallConfirm.confirmed = false;
|
||||
};
|
||||
|
||||
function getDomains() {
|
||||
Client.getDomains(function (error, result) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
@@ -105,25 +60,6 @@ angular.module('Application').controller('AppsController', ['$scope', '$timeout'
|
||||
$scope.domains = result;
|
||||
$scope.filterDomains = [ALL_DOMAINS_DOMAIN].concat(result);
|
||||
});
|
||||
}
|
||||
|
||||
Client.onReady(function () {
|
||||
Client.refreshInstalledApps(); // refresh the new list immediately when switching from another view (appstore)
|
||||
|
||||
if ($scope.user.admin) getDomains();
|
||||
|
||||
var refreshAppsTimer = $interval(Client.refreshInstalledApps.bind(Client), 5000);
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$interval.cancel(refreshAppsTimer);
|
||||
});
|
||||
});
|
||||
|
||||
// setup all the dialog focus handling
|
||||
['appUpdateModal'].forEach(function (id) {
|
||||
$('#' + id).on('shown.bs.modal', function () {
|
||||
$(this).find("[autofocus]:first").focus();
|
||||
});
|
||||
});
|
||||
|
||||
$('.modal-backdrop').remove();
|
||||
|
||||
Reference in New Issue
Block a user