mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-13 15:58:41 -05:00
Merge pull request #7041 from gconsidine/ui/add-string-override-support
Ui/add string override support
This commit is contained in:
@@ -36,14 +36,14 @@ function atFormActionController ($state, strings) {
|
||||
};
|
||||
|
||||
vm.setCancelDefaults = () => {
|
||||
scope.text = strings.CANCEL;
|
||||
scope.text = strings.get('CANCEL'),
|
||||
scope.fill = 'Hollow';
|
||||
scope.color = 'default';
|
||||
scope.action = () => $state.go(scope.to || '^');
|
||||
};
|
||||
|
||||
vm.setSaveDefaults = () => {
|
||||
scope.text = strings.SAVE;
|
||||
scope.text = strings.get('SAVE'),
|
||||
scope.fill = '';
|
||||
scope.color = 'success';
|
||||
scope.action = () => form.submit();
|
||||
|
||||
@@ -15,8 +15,6 @@ function AtFormController (eventService, strings) {
|
||||
let modal;
|
||||
let form;
|
||||
|
||||
strings = strings.components.forms;
|
||||
|
||||
vm.components = [];
|
||||
vm.state = {
|
||||
isValid: false,
|
||||
@@ -101,8 +99,8 @@ function AtFormController (eventService, strings) {
|
||||
|
||||
if (!handled) {
|
||||
let message;
|
||||
let title = strings.SUBMISSION_ERROR_TITLE;
|
||||
let preface = strings.SUBMISSION_ERROR_PREFACE;
|
||||
let title = strings.get('form.SUBMISSION_ERROR_TITLE');
|
||||
let preface = strings.get('form.SUBMISSION_ERROR_PREFACE');
|
||||
|
||||
if (typeof err.data === 'object') {
|
||||
message = JSON.stringify(err.data);
|
||||
@@ -115,8 +113,8 @@ function AtFormController (eventService, strings) {
|
||||
};
|
||||
|
||||
vm.handleUnexpectedError = err => {
|
||||
let title = strings.SUBMISSION_ERROR_TITLE;
|
||||
let message = strings.SUBMISSION_ERROR_MESSAGE;
|
||||
let title = strings.get('form.SUBMISSION_ERROR_TITLE');
|
||||
let message = strings.get('form.SUBMISSION_ERROR_MESSAGE');
|
||||
|
||||
modal.show(title, message);
|
||||
|
||||
|
||||
@@ -51,13 +51,13 @@ function BaseInputController (strings) {
|
||||
|
||||
if (scope.state._required && !scope.state._value && !scope.state._displayValue) {
|
||||
isValid = false;
|
||||
message = vm.strings.components.message.REQUIRED_INPUT_MISSING;
|
||||
message = vm.strings.get('message.REQUIRED_INPUT_MISSING');
|
||||
} else if (scope.state._validate) {
|
||||
let result = scope.state._validate(scope.state._value);
|
||||
|
||||
if (!result.isValid) {
|
||||
isValid = false;
|
||||
message = result.message || vm.strings.components.message.INVALID_INPUT;
|
||||
message = result.message || vm.strings.get('message.INVALID_INPUT');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,14 +83,14 @@ function BaseInputController (strings) {
|
||||
scope.state._isBeingReplaced = !scope.state._isBeingReplaced;
|
||||
|
||||
if (!scope.state._isBeingReplaced) {
|
||||
scope.state._buttonText = vm.strings.components.REPLACE;
|
||||
scope.state._buttonText = vm.strings.get('REPLACE');
|
||||
scope.state._disabled = true;
|
||||
scope.state._enableToggle = true;
|
||||
scope.state._value = scope.state._preEditValue;
|
||||
scope.state._activeModel = '_displayValue';
|
||||
scope.state._placeholder = vm.strings.components.ENCRYPTED;
|
||||
scope.state._placeholder = vm.strings.get('ENCRYPTED');
|
||||
} else {
|
||||
scope.state._buttonText = vm.strings.components.REVERT;
|
||||
scope.state._buttonText = vm.strings.get('REVERT');
|
||||
scope.state._disabled = false;
|
||||
scope.state._enableToggle = false;
|
||||
scope.state._activeModel = '_value';
|
||||
|
||||
@@ -15,7 +15,7 @@ function AtInputCheckboxController (baseInputController) {
|
||||
vm.init = (scope, element, form) => {
|
||||
baseInputController.call(vm, 'input', scope, element, form);
|
||||
scope.label = scope.state.label;
|
||||
scope.state.label = vm.strings.components.OPTIONS;
|
||||
scope.state.label = vm.strings.get('OPTIONS');
|
||||
|
||||
vm.check();
|
||||
};
|
||||
|
||||
@@ -101,7 +101,7 @@ function AtInputGroupController ($scope, $compile) {
|
||||
config._data = input.choices;
|
||||
config._exp = 'index as choice for (index, choice) in state._data';
|
||||
} else {
|
||||
let preface = vm.strings.components.UNSUPPORTED_ERROR_PREFACE;
|
||||
let preface = vm.strings.get('group.UNSUPPORTED_ERROR_PREFACE');
|
||||
throw new Error(`${preface}: ${input.type}`)
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<input type="checkbox"
|
||||
ng-model="state._promptOnLaunch"
|
||||
ng-change="vm.togglePromptOnLaunch()" />
|
||||
<p>{{ vm.strings.components.label.PROMPT_ON_LAUNCH }}</p>
|
||||
<p>{{:: vm.strings.get('label.PROMPT_ON_LAUNCH') }}</p>
|
||||
</label>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
@@ -68,7 +68,7 @@ function AtInputLookupController (baseInputController, $state, $stateParams) {
|
||||
|
||||
return {
|
||||
isValid: false,
|
||||
message: vm.strings.components.lookup.NOT_FOUND
|
||||
message: vm.strings.get('lookup.NOT_FOUND')
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ function AtInputSecretController (baseInputController) {
|
||||
scope = _scope_;
|
||||
|
||||
if (!scope.state._value || scope.state._promptOnLaunch) {
|
||||
scope.state._buttonText = vm.strings.components.SHOW;
|
||||
scope.state._buttonText = vm.strings.get('SHOW');
|
||||
scope.type = 'password';
|
||||
|
||||
vm.toggle = vm.toggleShowHide;
|
||||
} else {
|
||||
scope.state._buttonText = vm.strings.components.REPLACE;
|
||||
scope.state._placeholder = vm.strings.components.ENCRYPTED;
|
||||
scope.state._buttonText = vm.strings.get('REPLACE');
|
||||
scope.state._placeholder = vm.strings.get('ENCRYPTED');
|
||||
vm.toggle = vm.toggleRevertReplace;
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ function AtInputSecretController (baseInputController) {
|
||||
vm.toggleShowHide = () => {
|
||||
if (scope.type === 'password') {
|
||||
scope.type = 'text';
|
||||
scope.state._buttonText = vm.strings.components.HIDE;
|
||||
scope.state._buttonText = vm.strings.get('HIDE');
|
||||
} else {
|
||||
scope.type = 'password';
|
||||
scope.state._buttonText = vm.strings.components.SHOW;
|
||||
scope.state._buttonText = vm.strings.get('SHOW');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ function AtInputSelectController (baseInputController, eventService) {
|
||||
|
||||
if (!scope.state._data || scope.state._data.length === 0) {
|
||||
scope.state._disabled = true;
|
||||
scope.state._placeholder = vm.strings.components.EMPTY_PLACEHOLDER;
|
||||
scope.state._placeholder = vm.strings.get('select.EMPTY_PLACEHOLDER');
|
||||
}
|
||||
|
||||
vm.setListeners();
|
||||
@@ -65,7 +65,7 @@ function AtInputSelectController (baseInputController, eventService) {
|
||||
} else if (scope.state._format === 'grouped-object') {
|
||||
scope.displayModel = scope.state._value[scope.state._display];
|
||||
} else {
|
||||
throw new Error(vm.strings.components.UNSUPPORTED_TYPE_ERROR);
|
||||
throw new Error(vm.strings.get('select.UNSUPPORTED_TYPE_ERROR'));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ function AtInputTextareaSecretController (baseInputController, eventService) {
|
||||
|
||||
if (scope.state.format === 'ssh_private_key') {
|
||||
scope.ssh = true;
|
||||
scope.state._hint = scope.state._hint || vm.strings.components.textarea.SSH_KEY_HINT;
|
||||
scope.state._hint = scope.state._hint || vm.strings.get('textarea.SSH_KEY_HINT');
|
||||
input = element.find('input')[0];
|
||||
}
|
||||
|
||||
if (scope.state._value) {
|
||||
scope.state._buttonText = vm.strings.components.REPLACE;
|
||||
scope.state._placeholder = vm.strings.components.ENCRYPTED;
|
||||
scope.state._buttonText = vm.strings.get('REPLACE');
|
||||
scope.state._placeholder = vm.strings.get('ENCRYPTED');
|
||||
} else {
|
||||
if (scope.state.format === 'ssh_private_key') {
|
||||
vm.listeners = vm.setFileListeners(textarea, input);
|
||||
@@ -52,7 +52,7 @@ function AtInputTextareaSecretController (baseInputController, eventService) {
|
||||
vm.listeners = vm.setFileListeners(textarea, input);
|
||||
} else {
|
||||
scope.state._displayHint = false;
|
||||
scope.state._placeholder = vm.strings.components.ENCRYPTED;
|
||||
scope.state._placeholder = vm.strings.get('ENCRYPTED');
|
||||
eventService.remove(vm.listeners);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn at-ButtonHollow--default"
|
||||
ng-click="vm.hide()">
|
||||
{{ vm.strings.OK }}
|
||||
{{:: vm.strings.get('OK') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -22,7 +22,7 @@ function AtTruncateController (strings) {
|
||||
|
||||
vm.tooltip = {
|
||||
popover: {
|
||||
text: vm.strings.components.truncate.DEFAULT,
|
||||
text: vm.strings.get('truncate.DEFAULT'),
|
||||
on: 'mouseover',
|
||||
position: 'top',
|
||||
icon: 'fa fa-clone',
|
||||
@@ -32,7 +32,7 @@ function AtTruncateController (strings) {
|
||||
};
|
||||
|
||||
function copyToClipboard() {
|
||||
vm.tooltip.popover.text = vm.strings.components.truncate.COPIED;
|
||||
vm.tooltip.popover.text = vm.strings.get('truncate.COPIED');
|
||||
|
||||
let textarea = el[0].getElementsByClassName('at-Truncate-textarea')[0];
|
||||
textarea.value = string;
|
||||
@@ -65,4 +65,4 @@ atTruncate.$inject = [
|
||||
'PathService'
|
||||
];
|
||||
|
||||
export default atTruncate;
|
||||
export default atTruncate;
|
||||
|
||||
Reference in New Issue
Block a user