GUAC-968: Reduce number of namespaces. Adopt consistent string naming. Reorganize and reformat. Remove unused strings.

This commit is contained in:
Michael Jumper
2014-12-26 17:00:31 -08:00
parent 83bd541925
commit 74b94f9b2e
22 changed files with 607 additions and 454 deletions

View File

@@ -33,18 +33,19 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
var PermissionSet = $injector.get('PermissionSet');
// Required services
var $location = $injector.get('$location');
var $routeParams = $injector.get('$routeParams');
var connectionService = $injector.get('connectionService');
var connectionGroupService = $injector.get('connectionGroupService');
var protocolService = $injector.get('protocolService');
var $location = $injector.get('$location');
var $routeParams = $injector.get('$routeParams');
var connectionService = $injector.get('connectionService');
var connectionGroupService = $injector.get('connectionGroupService');
var protocolService = $injector.get('protocolService');
var translationStringService = $injector.get('translationStringService');
/**
* An action to be provided along with the object sent to showStatus which
* closes the currently-shown status dialog.
*/
var ACKNOWLEDGE_ACTION = {
name : "manage.error.action.acknowledge",
name : "MANAGE_CONNECTION.ACTION_ACKNOWLEDGE",
// Handle action
callback : function acknowledgeCallback() {
$scope.showStatus(false);
@@ -103,6 +104,41 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
$scope.parameters = {};
}
/**
* Given the internal name of a protocol, produces the translation string
* for the localized version of that protocol's name.
*
* @param {String} protocolName
* The name of the protocol.
*
* @returns {String}
* The translation string which produces the localized name of the
* protocol specified.
*/
$scope.getProtocolName = function getProtocolName(protocolName) {
return 'PROTOCOL_' + translationStringService.canonicalize(protocolName) + '.NAME';
};
/**
* Given the internal name of a protocol and the internal name of a
* parameter for that protocol, produces the translation string
* for the localized, human-readable name of that protocol parameter.
*
* @param {String} protocolName
* The name of the protocol.
*
* @param {String} parameterName
* The name of the protocol parameter.
*
* @returns {String}
* The translation string which produces the translated name of the
* protocol parameter specified.
*/
$scope.getProtocolParameterName = function getProtocolParameterName(protocolName, parameterName) {
return 'PROTOCOL_' + translationStringService.canonicalize(protocolName)
+ '.FIELD_HEADER_' + translationStringService.canonicalize(parameterName);
};
/**
* Cancels all pending edits, returning to the management page.
*/
@@ -128,7 +164,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
.error(function connectionSaveFailed(error) {
$scope.showStatus({
'className' : 'error',
'title' : 'manage.error.title',
'title' : 'MANAGE_CONNECTION.DIALOG_HEADER_ERROR',
'text' : error.message,
'actions' : [ ACKNOWLEDGE_ACTION ]
});
@@ -141,7 +177,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
* immediately deletes the current connection.
*/
var DELETE_ACTION = {
name : "manage.edit.connection.delete",
name : "MANAGE_CONNECTION.ACTION_DELETE",
className : "danger",
// Handle action
callback : function deleteCallback() {
@@ -155,7 +191,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
* closes the currently-shown status dialog.
*/
var CANCEL_ACTION = {
name : "manage.edit.connection.cancel",
name : "MANAGE_CONNECTION.ACTION_CANCEL",
// Handle action
callback : function cancelCallback() {
$scope.showStatus(false);
@@ -178,7 +214,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
.error(function connectionDeletionFailed(error) {
$scope.showStatus({
'className' : 'error',
'title' : 'manage.error.title',
'title' : 'MANAGE_CONNECTION.DIALOG_HEADER_ERROR',
'text' : error.message,
'actions' : [ ACKNOWLEDGE_ACTION ]
});
@@ -194,8 +230,8 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
// Confirm deletion request
$scope.showStatus({
'title' : 'manage.edit.connection.confirmDelete.title',
'text' : 'manage.edit.connection.confirmDelete.text',
'title' : 'MANAGE_CONNECTION.DIALOG_HEADER_CONFIRM_DELETE',
'text' : 'MANAGE_CONNECTION.TEXT_CONFIRM_DELETE',
'actions' : [ DELETE_ACTION, CANCEL_ACTION]
});

View File

@@ -40,7 +40,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
* closes the currently-shown status dialog.
*/
var ACKNOWLEDGE_ACTION = {
name : "manage.error.action.acknowledge",
name : "MANAGE_CONNECTION_GROUP.ACTION_ACKNOWLEDGE",
// Handle action
callback : function acknowledgeCallback() {
$scope.showStatus(false);
@@ -80,11 +80,11 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
*/
$scope.types = [
{
label: "organizational",
label: "MANAGE_CONNECTION_GROUP.NAME_TYPE_ORGANIZATIONAL",
value: ConnectionGroup.Type.ORGANIZATIONAL
},
{
label : "balancing",
label: "MANAGE_CONNECTION_GROUP.NAME_TYPE_BALANCING",
value : ConnectionGroup.Type.BALANCING
}
];
@@ -112,7 +112,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
.error(function connectionGroupSaveFailed(error) {
$scope.showStatus({
'className' : 'error',
'title' : 'manage.error.title',
'title' : 'MANAGE_CONNECTION_GROUP.DIALOG_HEADER_ERROR',
'text' : error.message,
'actions' : [ ACKNOWLEDGE_ACTION ]
});
@@ -125,7 +125,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
* immediately deletes the current connection group.
*/
var DELETE_ACTION = {
name : "manage.edit.connectionGroup.delete",
name : "MANAGE_CONNECTION_GROUP.ACTION_DELETE",
className : "danger",
// Handle action
callback : function deleteCallback() {
@@ -139,7 +139,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
* closes the currently-shown status dialog.
*/
var CANCEL_ACTION = {
name : "manage.edit.connectionGroup.cancel",
name : "MANAGE_CONNECTION_GROUP.ACTION_CANCEL",
// Handle action
callback : function cancelCallback() {
$scope.showStatus(false);
@@ -162,7 +162,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
.error(function connectionGroupDeletionFailed(error) {
$scope.showStatus({
'className' : 'error',
'title' : 'manage.error.title',
'title' : 'MANAGE_CONNECTION_GROUP.DIALOG_HEADER_ERROR',
'text' : error.message,
'actions' : [ ACKNOWLEDGE_ACTION ]
});
@@ -178,8 +178,8 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
// Confirm deletion request
$scope.showStatus({
'title' : 'manage.edit.connectionGroup.confirmDelete.title',
'text' : 'manage.edit.connectionGroup.confirmDelete.text',
'title' : 'MANAGE_CONNECTION_GROUP.DIALOG_HEADER_CONFIRM_DELETE',
'text' : 'MANAGE_CONNECTION_GROUP.TEXT_CONFIRM_DELETE',
'actions' : [ DELETE_ACTION, CANCEL_ACTION]
});

View File

@@ -40,7 +40,7 @@ angular.module('manage').controller('manageController', ['$scope', '$injector',
* closes the currently-shown status dialog.
*/
var ACKNOWLEDGE_ACTION = {
name : "manage.error.action.acknowledge",
name : "MANAGE.ACTION_ACKNOWLEDGE",
// Handle action
callback : function acknowledgeCallback() {
$scope.showStatus(false);
@@ -90,7 +90,7 @@ angular.module('manage').controller('manageController', ['$scope', '$injector',
.error(function userCreationFailed(error) {
$scope.showStatus({
'className' : 'error',
'title' : 'manage.error.title',
'title' : 'MANAGE.DIALOG_HEADER_ERROR',
'text' : error.message,
'actions' : [ ACKNOWLEDGE_ACTION ]
});

View File

@@ -43,7 +43,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
* closes the currently-shown status dialog.
*/
var ACKNOWLEDGE_ACTION = {
name : "manage.error.action.acknowledge",
name : "MANAGE_USER.ACTION_ACKNOWLEDGE",
// Handle action
callback : function acknowledgeCallback() {
$scope.showStatus(false);
@@ -81,19 +81,19 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
*/
$scope.systemPermissionTypes = [
{
label: "manage.edit.user.administerSystem",
label: "MANAGE_USER.FIELD_HEADER_ADMINISTER_SYSTEM",
value: PermissionSet.SystemPermissionType.ADMINISTER
},
{
label: "manage.edit.user.createUser",
label: "MANAGE_USER.FIELD_HEADER_CREATE_NEW_USERS",
value: PermissionSet.SystemPermissionType.CREATE_USER
},
{
label: "manage.edit.user.createConnection",
label: "MANAGE_USER.FIELD_HEADER_CREATE_NEW_CONNECTIONS",
value: PermissionSet.SystemPermissionType.CREATE_CONNECTION
},
{
label: "manage.edit.user.createConnectionGroup",
label: "MANAGE_USER.FIELD_HEADER_CREATE_NEW_CONNECTION_GROUPS",
value: PermissionSet.SystemPermissionType.CREATE_CONNECTION_GROUP
}
];
@@ -328,8 +328,8 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
if ($scope.passwordMatch !== $scope.user.password) {
$scope.showStatus({
'className' : 'error',
'title' : 'manage.error.title',
'text' : 'manage.edit.user.passwordMismatch',
'title' : 'MANAGE_USER.DIALOG_HEADER_ERROR',
'text' : 'MANAGE_USER.ERROR_PASSWORD_MISMATCH',
'actions' : [ ACKNOWLEDGE_ACTION ]
});
return;
@@ -349,7 +349,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
.error(function userPermissionsPatchFailed(error) {
$scope.showStatus({
'className' : 'error',
'title' : 'manage.error.title',
'title' : 'MANAGE_USER.DIALOG_HEADER_ERROR',
'text' : error.message,
'actions' : [ ACKNOWLEDGE_ACTION ]
});
@@ -361,7 +361,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
.error(function userSaveFailed(error) {
$scope.showStatus({
'className' : 'error',
'title' : 'manage.error.title',
'title' : 'MANAGE_USER.DIALOG_HEADER_ERROR',
'text' : error.message,
'actions' : [ ACKNOWLEDGE_ACTION ]
});
@@ -374,7 +374,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
* immediately deletes the current user.
*/
var DELETE_ACTION = {
name : "manage.edit.user.delete",
name : "MANAGE_USER.ACTION_DELETE",
className : "danger",
// Handle action
callback : function deleteCallback() {
@@ -388,7 +388,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
* closes the currently-shown status dialog.
*/
var CANCEL_ACTION = {
name : "manage.edit.user.cancel",
name : "MANAGE_USER.ACTION_CANCEL",
// Handle action
callback : function cancelCallback() {
$scope.showStatus(false);
@@ -411,7 +411,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
.error(function userDeletionFailed(error) {
$scope.showStatus({
'className' : 'error',
'title' : 'manage.error.title',
'title' : 'MANAGE_USER.DIALOG_HEADER_ERROR',
'text' : error.message,
'actions' : [ ACKNOWLEDGE_ACTION ]
});
@@ -427,8 +427,8 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
// Confirm deletion request
$scope.showStatus({
'title' : 'manage.edit.user.confirmDelete.title',
'text' : 'manage.edit.user.confirmDelete.text',
'title' : 'MANAGE_USER.DIALOG_HEADER_CONFIRM_DELETE',
'text' : 'MANAGE_USER.TEXT_CONFIRM_DELETE',
'actions' : [ DELETE_ACTION, CANCEL_ACTION]
});