GUAC-605: Use status dialog from index, not status modal.

This commit is contained in:
Michael Jumper
2014-11-16 23:10:49 -08:00
parent 0f159d73ad
commit 80377f6663
8 changed files with 108 additions and 206 deletions

View File

@@ -69,7 +69,47 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
// If the user is unknown, force a login
if(!$scope.currentUserID)
$location.path('/login');
/**
* Shows or hides the status modal. If a status modal is currently shown,
* no further status modals will be shown until the current status is
* hidden.
*
* @param {Boolean|Object} status The status to show, or false to hide the
* current status.
* @param {String} [status.title] The title of the status modal.
* @param {String} [status.text] The body text of the status modal.
* @param {String} [status.className] The CSS class name to apply to the
* modal, in addition to the default
* "dialog" and "status" classes.
* @param {String[]} [status.actions] Array of action names which
* correspond to button captions. Each
* action will be displayed as a button
* within the status modal. Clickin a
* button will fire a guacStatusAction
* event.
*/
$scope.showStatus = function showStatus(status) {
if (!$scope.status || !status)
$scope.status = status;
};
/**
* Fires a guacStatusAction event signalling a chosen action. The status
* modal will be cloased prior to firing the action event.
*
* @param {String} action The name of the action.
*/
$scope.fireAction = function fireAction(action) {
// Hide status modal
$scope.status = false;
// Fire action event
$scope.$broadcast('guacAction', action);
};
// Allow the permissions to be reloaded elsewhere if needed
$scope.loadBasicPermissions = function loadBasicPermissions() {

View File

@@ -1,50 +0,0 @@
/*
* Copyright (C) 2014 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* The controller for the status modal.
*/
angular.module('manage').controller('statusController', ['$scope', '$rootScope', '$injector',
function statusController($scope, $rootScope, $injector) {
var statusModal = $injector.get('statusModal');
/**
* Fires a guacStatusAction event signalling a chosen action. The status
* modal will be cloased prior to firing the action event.
*
* @param {String} action The name of the action.
*/
$scope.fireAction = function fireAction(action) {
// Hide status modal
statusModal.showStatus(false);
// Fire action event
$rootScope.$broadcast('guacAction', action);
};
}]);