mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-16 15:58:39 -05:00
Use eslint on ui/lib and ui/features code
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const templateUrl = require('@components/action/action-group.partial.html');
|
||||
const templateUrl = require('~components/action/action-group.partial.html');
|
||||
|
||||
function atActionGroup () {
|
||||
return {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
function ComponentsStrings (BaseString) {
|
||||
BaseString.call(this, 'components');
|
||||
|
||||
let t = this.t;
|
||||
let ns = this.components;
|
||||
const { t } = this;
|
||||
const ns = this.components;
|
||||
|
||||
ns.REPLACE = t.s('REPLACE');
|
||||
ns.REVERT = t.s('REVERT');
|
||||
@@ -18,7 +18,7 @@ function ComponentsStrings (BaseString) {
|
||||
|
||||
ns.form = {
|
||||
SUBMISSION_ERROR_TITLE: t.s('Unable to Submit'),
|
||||
SUBMISSION_ERROR_MESSAGE:t.s('Unexpected server error. View the console for more information'),
|
||||
SUBMISSION_ERROR_MESSAGE: t.s('Unexpected server error. View the console for more information'),
|
||||
SUBMISSION_ERROR_PREFACE: t.s('Unexpected Error')
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ function ComponentsStrings (BaseString) {
|
||||
ns.truncate = {
|
||||
DEFAULT: t.s('Copy full revision to clipboard.'),
|
||||
COPIED: t.s('Copied to clipboard.')
|
||||
}
|
||||
};
|
||||
|
||||
ns.layout = {
|
||||
CURRENT_USER_LABEL: t.s('Logged in as'),
|
||||
@@ -71,7 +71,7 @@ function ComponentsStrings (BaseString) {
|
||||
SETTINGS: t.s('Settings'),
|
||||
FOOTER_ABOUT: t.s('About'),
|
||||
FOOTER_COPYRIGHT: t.s('Copyright © 2017 Red Hat, Inc.')
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ComponentsStrings.$inject = ['BaseStringService'];
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
const templateUrl = require('@components/form/action.partial.html');
|
||||
const templateUrl = require('~components/form/action.partial.html');
|
||||
|
||||
function link (scope, element, attrs, controllers) {
|
||||
let formController = controllers[0];
|
||||
let actionController = controllers[1];
|
||||
const [formController, actionController] = controllers;
|
||||
|
||||
actionController.init(formController, element, scope);
|
||||
actionController.init(formController, scope);
|
||||
}
|
||||
|
||||
function atFormActionController ($state, strings) {
|
||||
let vm = this || {};
|
||||
const vm = this || {};
|
||||
|
||||
let element;
|
||||
let form;
|
||||
let scope;
|
||||
|
||||
vm.init = (_form_, _element_, _scope_) => {
|
||||
vm.init = (_form_, _scope_) => {
|
||||
form = _form_;
|
||||
element = _element_;
|
||||
scope = _scope_;
|
||||
|
||||
switch(scope.type) {
|
||||
switch (scope.type) {
|
||||
case 'cancel':
|
||||
vm.setCancelDefaults();
|
||||
break;
|
||||
@@ -33,22 +30,18 @@ function atFormActionController ($state, strings) {
|
||||
form.register('action', scope);
|
||||
};
|
||||
|
||||
vm.setCustomDefaults = () => {
|
||||
|
||||
};
|
||||
|
||||
vm.setCancelDefaults = () => {
|
||||
scope.text = strings.get('CANCEL'),
|
||||
scope.text = strings.get('CANCEL');
|
||||
scope.fill = 'Hollow';
|
||||
scope.color = 'default';
|
||||
scope.action = () => $state.go(scope.to || '^');
|
||||
scope.action = () => { $state.go(scope.to || '^'); };
|
||||
};
|
||||
|
||||
vm.setSaveDefaults = () => {
|
||||
scope.text = strings.get('SAVE'),
|
||||
scope.text = strings.get('SAVE');
|
||||
scope.fill = '';
|
||||
scope.color = 'success';
|
||||
scope.action = () => form.submit();
|
||||
scope.action = () => { form.submit(); };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const templateUrl = require('@components/form/form.partial.html');
|
||||
const templateUrl = require('~components/form/form.partial.html');
|
||||
|
||||
function atFormLink (scope, el, attrs, controllers) {
|
||||
let formController = controllers[0];
|
||||
let form = el[0];
|
||||
const formController = controllers[0];
|
||||
const form = el[0];
|
||||
|
||||
scope.ns = 'form';
|
||||
scope[scope.ns] = { modal: {} };
|
||||
@@ -11,7 +11,7 @@ function atFormLink (scope, el, attrs, controllers) {
|
||||
}
|
||||
|
||||
function AtFormController (eventService, strings) {
|
||||
let vm = this || {};
|
||||
const vm = this || {};
|
||||
|
||||
let scope;
|
||||
let modal;
|
||||
@@ -27,22 +27,22 @@ function AtFormController (eventService, strings) {
|
||||
vm.init = (_scope_, _form_) => {
|
||||
scope = _scope_;
|
||||
form = _form_;
|
||||
modal = scope[scope.ns].modal;
|
||||
({ modal } = scope[scope.ns]);
|
||||
|
||||
vm.state.disabled = scope.state.disabled;
|
||||
|
||||
vm.setListeners();
|
||||
};
|
||||
|
||||
vm.register = (category, component, el) => {
|
||||
vm.register = (category, component) => {
|
||||
component.category = category;
|
||||
component.form = vm.state;
|
||||
|
||||
vm.components.push(component)
|
||||
vm.components.push(component);
|
||||
};
|
||||
|
||||
vm.setListeners = () => {
|
||||
let listeners = eventService.addListeners([
|
||||
const listeners = eventService.addListeners([
|
||||
[form, 'keypress', vm.submitOnEnter]
|
||||
]);
|
||||
|
||||
@@ -58,14 +58,14 @@ function AtFormController (eventService, strings) {
|
||||
scope.$apply(vm.submit);
|
||||
};
|
||||
|
||||
vm.submit = event => {
|
||||
vm.submit = () => {
|
||||
if (!vm.state.isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
vm.state.disabled = true;
|
||||
|
||||
let data = vm.components
|
||||
const data = vm.components
|
||||
.filter(component => component.category === 'input')
|
||||
.reduce((values, component) => {
|
||||
if (!component.state._value) {
|
||||
@@ -87,7 +87,7 @@ function AtFormController (eventService, strings) {
|
||||
scope.state.save(data)
|
||||
.then(scope.state.onSaveSuccess)
|
||||
.catch(err => vm.onSaveError(err))
|
||||
.finally(() => vm.state.disabled = false);
|
||||
.finally(() => { vm.state.disabled = false; });
|
||||
};
|
||||
|
||||
vm.onSaveError = err => {
|
||||
@@ -103,22 +103,22 @@ function AtFormController (eventService, strings) {
|
||||
|
||||
if (!handled) {
|
||||
let message;
|
||||
let title = strings.get('form.SUBMISSION_ERROR_TITLE');
|
||||
let preface = strings.get('form.SUBMISSION_ERROR_PREFACE');
|
||||
const title = strings.get('form.SUBMISSION_ERROR_TITLE');
|
||||
const preface = strings.get('form.SUBMISSION_ERROR_PREFACE');
|
||||
|
||||
if (typeof err.data === 'object') {
|
||||
message = JSON.stringify(err.data);
|
||||
message = JSON.stringify(err.data);
|
||||
} else {
|
||||
message = err.data;
|
||||
}
|
||||
|
||||
modal.show(title, `${preface}: ${message}`)
|
||||
modal.show(title, `${preface}: ${message}`);
|
||||
}
|
||||
};
|
||||
|
||||
vm.handleUnexpectedError = err => {
|
||||
let title = strings.get('form.SUBMISSION_ERROR_TITLE');
|
||||
let message = strings.get('form.SUBMISSION_ERROR_MESSAGE');
|
||||
vm.handleUnexpectedError = () => {
|
||||
const title = strings.get('form.SUBMISSION_ERROR_TITLE');
|
||||
const message = strings.get('form.SUBMISSION_ERROR_MESSAGE');
|
||||
|
||||
modal.show(title, message);
|
||||
|
||||
@@ -126,7 +126,7 @@ function AtFormController (eventService, strings) {
|
||||
};
|
||||
|
||||
vm.handleValidationError = errors => {
|
||||
let errorMessageSet = vm.setValidationMessages(errors);
|
||||
const errorMessageSet = vm.setValidationMessages(errors);
|
||||
|
||||
if (errorMessageSet) {
|
||||
vm.check();
|
||||
@@ -138,22 +138,23 @@ function AtFormController (eventService, strings) {
|
||||
vm.setValidationMessages = (errors, errorSet) => {
|
||||
let errorMessageSet = errorSet || false;
|
||||
|
||||
for (let id in errors) {
|
||||
if (!Array.isArray(errors[id]) && typeof errors[id] === 'object') {
|
||||
errorMessageSet = vm.setValidationMessages(errors[id], errorMessageSet);
|
||||
continue;
|
||||
Object.keys(errors).forEach(error => {
|
||||
if (!Array.isArray(error) && typeof error === 'object') {
|
||||
errorMessageSet = vm.setValidationMessages(error, errorMessageSet);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
vm.components
|
||||
.filter(component => component.category === 'input')
|
||||
.filter(component => errors[component.state.id])
|
||||
.filter(component => error[component.state.id])
|
||||
.forEach(component => {
|
||||
errorMessageSet = true;
|
||||
|
||||
component.state._rejected = true;
|
||||
component.state._message = errors[component.state.id].join(' ');
|
||||
component.state._message = error[component.state.id].join(' ');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return errorMessageSet;
|
||||
};
|
||||
@@ -176,7 +177,7 @@ function AtFormController (eventService, strings) {
|
||||
};
|
||||
|
||||
vm.check = () => {
|
||||
let isValid = vm.validate();
|
||||
const isValid = vm.validate();
|
||||
|
||||
if (isValid !== vm.state.isValid) {
|
||||
vm.state.isValid = isValid;
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
import actionGroup from '@components/action/action-group.directive';
|
||||
import divider from '@components/utility/divider.directive';
|
||||
import form from '@components/form/form.directive';
|
||||
import formAction from '@components/form/action.directive';
|
||||
import inputCheckbox from '@components/input/checkbox.directive';
|
||||
import inputGroup from '@components/input/group.directive';
|
||||
import inputLabel from '@components/input/label.directive';
|
||||
import inputLookup from '@components/input/lookup.directive';
|
||||
import inputMessage from '@components/input/message.directive';
|
||||
import inputSecret from '@components/input/secret.directive';
|
||||
import inputSelect from '@components/input/select.directive';
|
||||
import inputText from '@components/input/text.directive';
|
||||
import inputTextarea from '@components/input/textarea.directive';
|
||||
import inputTextareaSecret from '@components/input/textarea-secret.directive';
|
||||
import layout from '@components/layout/layout.directive';
|
||||
import modal from '@components/modal/modal.directive';
|
||||
import panel from '@components/panel/panel.directive';
|
||||
import panelBody from '@components/panel/body.directive';
|
||||
import panelHeading from '@components/panel/heading.directive';
|
||||
import popover from '@components/popover/popover.directive';
|
||||
import sideNav from '@components/layout/side-nav.directive';
|
||||
import sideNavItem from '@components/layout/side-nav-item.directive';
|
||||
import tab from '@components/tabs/tab.directive';
|
||||
import tabGroup from '@components/tabs/group.directive';
|
||||
import topNavItem from '@components/layout/top-nav-item.directive';
|
||||
import truncate from '@components/truncate/truncate.directive';
|
||||
import actionGroup from '~components/action/action-group.directive';
|
||||
import divider from '~components/utility/divider.directive';
|
||||
import form from '~components/form/form.directive';
|
||||
import formAction from '~components/form/action.directive';
|
||||
import inputCheckbox from '~components/input/checkbox.directive';
|
||||
import inputGroup from '~components/input/group.directive';
|
||||
import inputLabel from '~components/input/label.directive';
|
||||
import inputLookup from '~components/input/lookup.directive';
|
||||
import inputMessage from '~components/input/message.directive';
|
||||
import inputSecret from '~components/input/secret.directive';
|
||||
import inputSelect from '~components/input/select.directive';
|
||||
import inputText from '~components/input/text.directive';
|
||||
import inputTextarea from '~components/input/textarea.directive';
|
||||
import inputTextareaSecret from '~components/input/textarea-secret.directive';
|
||||
import layout from '~components/layout/layout.directive';
|
||||
import modal from '~components/modal/modal.directive';
|
||||
import panel from '~components/panel/panel.directive';
|
||||
import panelBody from '~components/panel/body.directive';
|
||||
import panelHeading from '~components/panel/heading.directive';
|
||||
import popover from '~components/popover/popover.directive';
|
||||
import sideNav from '~components/layout/side-nav.directive';
|
||||
import sideNavItem from '~components/layout/side-nav-item.directive';
|
||||
import tab from '~components/tabs/tab.directive';
|
||||
import tabGroup from '~components/tabs/group.directive';
|
||||
import topNavItem from '~components/layout/top-nav-item.directive';
|
||||
import truncate from '~components/truncate/truncate.directive';
|
||||
|
||||
import BaseInputController from '@components/input/base.controller';
|
||||
import ComponentsStrings from '@components/components.strings';
|
||||
import BaseInputController from '~components/input/base.controller';
|
||||
import ComponentsStrings from '~components/components.strings';
|
||||
|
||||
angular
|
||||
.module('at.lib.components', [])
|
||||
|
||||
@@ -4,7 +4,7 @@ function BaseInputController (strings) {
|
||||
const ENCRYPTED_VALUE = '$encrypted$';
|
||||
|
||||
return function extend (type, scope, element, form) {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
|
||||
vm.strings = strings;
|
||||
|
||||
@@ -50,10 +50,10 @@ function BaseInputController (strings) {
|
||||
}
|
||||
|
||||
if (scope.state._required && !scope.state._value && !scope.state._displayValue) {
|
||||
isValid = false;
|
||||
isValid = false;
|
||||
message = vm.strings.get('message.REQUIRED_INPUT_MISSING');
|
||||
} else if (scope.state._validate) {
|
||||
let result = scope.state._validate(scope.state._value);
|
||||
const result = scope.state._validate(scope.state._value);
|
||||
|
||||
if (!result.isValid) {
|
||||
isValid = false;
|
||||
@@ -111,18 +111,16 @@ function BaseInputController (strings) {
|
||||
scope.state._activeModel = '_displayValue';
|
||||
scope.state._disabled = true;
|
||||
scope.state._enableToggle = false;
|
||||
} else {
|
||||
if (scope.state._isBeingReplaced === false) {
|
||||
} else if (scope.state._isBeingReplaced === false) {
|
||||
scope.state._disabled = true;
|
||||
scope.state._enableToggle = true;
|
||||
scope.state._value = scope.state._preEditValue;
|
||||
} else {
|
||||
scope.state._activeModel = '_value';
|
||||
scope.state._disabled = false;
|
||||
scope.state._value = '';
|
||||
scope.state._value = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vm.check();
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const templateUrl = require('@components/input/checkbox.partial.html');
|
||||
const templateUrl = require('~components/input/checkbox.partial.html');
|
||||
|
||||
function atInputCheckboxLink (scope, element, attrs, controllers) {
|
||||
let formController = controllers[0];
|
||||
let inputController = controllers[1];
|
||||
const formController = controllers[0];
|
||||
const inputController = controllers[1];
|
||||
|
||||
if (scope.tab === '1') {
|
||||
element.find('input')[0].focus();
|
||||
@@ -12,7 +12,7 @@ function atInputCheckboxLink (scope, element, attrs, controllers) {
|
||||
}
|
||||
|
||||
function AtInputCheckboxController (baseInputController) {
|
||||
let vm = this || {};
|
||||
const vm = this || {};
|
||||
|
||||
vm.init = (scope, element, form) => {
|
||||
baseInputController.call(vm, 'input', scope, element, form);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
const templateUrl = require('@components/input/group.partial.html');
|
||||
const templateUrl = require('~components/input/group.partial.html');
|
||||
|
||||
function atInputGroupLink (scope, el, attrs, controllers) {
|
||||
let groupController = controllers[0];
|
||||
let formController = controllers[1];
|
||||
let element = el[0].getElementsByClassName('at-InputGroup-container')[0];
|
||||
|
||||
const groupController = controllers[0];
|
||||
const formController = controllers[1];
|
||||
const element = el[0].getElementsByClassName('at-InputGroup-container')[0];
|
||||
|
||||
groupController.init(scope, formController, element);
|
||||
}
|
||||
|
||||
function AtInputGroupController ($scope, $compile) {
|
||||
let vm = this || {};
|
||||
const vm = this || {};
|
||||
|
||||
let form;
|
||||
let scope;
|
||||
@@ -31,7 +31,7 @@ function AtInputGroupController ($scope, $compile) {
|
||||
if (!source._value || source._value === state._value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -46,15 +46,15 @@ function AtInputGroupController ($scope, $compile) {
|
||||
|
||||
state._value = source._value;
|
||||
|
||||
let inputs = state._get(source._value);
|
||||
let group = vm.createComponentConfigs(inputs);
|
||||
const inputs = state._get(source._value);
|
||||
const group = vm.createComponentConfigs(inputs);
|
||||
|
||||
vm.insert(group);
|
||||
state._group = group;
|
||||
};
|
||||
|
||||
vm.createComponentConfigs = inputs => {
|
||||
let group = [];
|
||||
const group = [];
|
||||
|
||||
if (inputs) {
|
||||
inputs.forEach((input, i) => {
|
||||
@@ -73,7 +73,7 @@ function AtInputGroupController ($scope, $compile) {
|
||||
};
|
||||
|
||||
vm.getComponentType = input => {
|
||||
let config = {};
|
||||
const config = {};
|
||||
|
||||
if (input.type === 'string') {
|
||||
if (!input.multiline) {
|
||||
@@ -105,17 +105,17 @@ function AtInputGroupController ($scope, $compile) {
|
||||
config._data = input.choices;
|
||||
config._exp = 'choice for (index, choice) in state._data';
|
||||
} else {
|
||||
let preface = vm.strings.get('group.UNSUPPORTED_ERROR_PREFACE');
|
||||
throw new Error(`${preface}: ${input.type}`)
|
||||
const preface = vm.strings.get('group.UNSUPPORTED_ERROR_PREFACE');
|
||||
throw new Error(`${preface}: ${input.type}`);
|
||||
}
|
||||
|
||||
return config;
|
||||
};
|
||||
|
||||
vm.insert = group => {
|
||||
let container = document.createElement('div');
|
||||
const container = document.createElement('div');
|
||||
let col = 1;
|
||||
let colPerRow = 12 / scope.col;
|
||||
const colPerRow = 12 / scope.col;
|
||||
let isDivided = true;
|
||||
|
||||
group.forEach((input, i) => {
|
||||
@@ -125,7 +125,7 @@ function AtInputGroupController ($scope, $compile) {
|
||||
|
||||
container.appendChild(input._element[0]);
|
||||
|
||||
if ((input._expand || col % colPerRow === 0) && i !== group.length -1) {
|
||||
if ((input._expand || col % colPerRow === 0) && i !== group.length - 1) {
|
||||
container.appendChild(vm.createDivider()[0]);
|
||||
isDivided = true;
|
||||
col = 0;
|
||||
@@ -140,21 +140,19 @@ function AtInputGroupController ($scope, $compile) {
|
||||
};
|
||||
|
||||
vm.createComponent = (input, index) => {
|
||||
let tabindex = Number(scope.tab) + index;
|
||||
let col = input._expand ? 12 : scope.col;
|
||||
let component = angular.element(
|
||||
`<${input._component} col="${col}" tab="${tabindex}"
|
||||
const tabindex = Number(scope.tab) + index;
|
||||
const col = input._expand ? 12 : scope.col;
|
||||
const component = angular.element(`<${input._component} col="${col}" tab="${tabindex}"
|
||||
state="${state._reference}._group[${index}]">
|
||||
</${input._component}>`
|
||||
);
|
||||
</${input._component}>`);
|
||||
|
||||
$compile(component)(scope.$parent)
|
||||
$compile(component)(scope.$parent);
|
||||
|
||||
return component;
|
||||
};
|
||||
|
||||
vm.createDivider = () => {
|
||||
let divider = angular.element('<at-divider></at-divider>');
|
||||
const divider = angular.element('<at-divider></at-divider>');
|
||||
$compile(divider[0])(scope.$parent);
|
||||
|
||||
return divider;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const templateUrl = require('@components/input/label.partial.html');
|
||||
const templateUrl = require('~components/input/label.partial.html');
|
||||
|
||||
function atInputLabel () {
|
||||
return {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
const templateUrl = require('@components/input/lookup.partial.html');
|
||||
const templateUrl = require('~components/input/lookup.partial.html');
|
||||
|
||||
const DEFAULT_DEBOUNCE = 250;
|
||||
const DEFAULT_KEY = 'name';
|
||||
|
||||
function atInputLookupLink (scope, element, attrs, controllers) {
|
||||
let formController = controllers[0];
|
||||
let inputController = controllers[1];
|
||||
const formController = controllers[0];
|
||||
const inputController = controllers[1];
|
||||
|
||||
if (scope.tab === '1') {
|
||||
element.find('input')[0].focus();
|
||||
@@ -14,8 +14,8 @@ function atInputLookupLink (scope, element, attrs, controllers) {
|
||||
inputController.init(scope, element, formController);
|
||||
}
|
||||
|
||||
function AtInputLookupController (baseInputController, $q, $state, $stateParams) {
|
||||
let vm = this || {};
|
||||
function AtInputLookupController (baseInputController, $q, $state) {
|
||||
const vm = this || {};
|
||||
|
||||
let scope;
|
||||
let model;
|
||||
@@ -52,7 +52,7 @@ function AtInputLookupController (baseInputController, $q, $state, $stateParams)
|
||||
};
|
||||
|
||||
vm.lookup = () => {
|
||||
let params = {};
|
||||
const params = {};
|
||||
|
||||
if (scope.state._value && scope.state._isValid) {
|
||||
params.selected = scope.state._value;
|
||||
@@ -77,7 +77,7 @@ function AtInputLookupController (baseInputController, $q, $state, $stateParams)
|
||||
|
||||
vm.resetDebounce = () => {
|
||||
clearTimeout(vm.debounce);
|
||||
vm.searchAfterDebounce();
|
||||
vm.searchAfterDebounce();
|
||||
};
|
||||
|
||||
vm.search = () => {
|
||||
@@ -90,7 +90,9 @@ function AtInputLookupController (baseInputController, $q, $state, $stateParams)
|
||||
return model.search({ [search.key]: scope.state._displayValue }, search.config)
|
||||
.then(found => {
|
||||
if (!found) {
|
||||
return vm.reset();
|
||||
vm.reset();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
scope[scope.state._resource] = model.get('id');
|
||||
@@ -99,8 +101,8 @@ function AtInputLookupController (baseInputController, $q, $state, $stateParams)
|
||||
})
|
||||
.catch(() => vm.reset())
|
||||
.finally(() => {
|
||||
let isValid = scope.state._value !== undefined;
|
||||
let message = isValid ? '' : vm.strings.get('lookup.NOT_FOUND');
|
||||
const isValid = scope.state._value !== undefined;
|
||||
const message = isValid ? '' : vm.strings.get('lookup.NOT_FOUND');
|
||||
|
||||
vm.check({ isValid, message });
|
||||
});
|
||||
@@ -108,7 +110,9 @@ function AtInputLookupController (baseInputController, $q, $state, $stateParams)
|
||||
|
||||
vm.searchOnInput = () => {
|
||||
if (vm.isDebouncing) {
|
||||
return vm.resetDebounce();
|
||||
vm.resetDebounce();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
vm.searchAfterDebounce();
|
||||
@@ -118,8 +122,7 @@ function AtInputLookupController (baseInputController, $q, $state, $stateParams)
|
||||
AtInputLookupController.$inject = [
|
||||
'BaseInputController',
|
||||
'$q',
|
||||
'$state',
|
||||
'$stateParams'
|
||||
'$state'
|
||||
];
|
||||
|
||||
function atInputLookup () {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const templateUrl = require('@components/input/message.partial.html');
|
||||
const templateUrl = require('~components/input/message.partial.html');
|
||||
|
||||
function atInputMessage () {
|
||||
return {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const templateUrl = require('@components/input/secret.partial.html');
|
||||
const templateUrl = require('~components/input/secret.partial.html');
|
||||
|
||||
function atInputSecretLink (scope, element, attrs, controllers) {
|
||||
let formController = controllers[0];
|
||||
let inputController = controllers[1];
|
||||
const formController = controllers[0];
|
||||
const inputController = controllers[1];
|
||||
|
||||
if (scope.tab === '1') {
|
||||
element.find('input')[0].focus();
|
||||
@@ -12,7 +12,7 @@ function atInputSecretLink (scope, element, attrs, controllers) {
|
||||
}
|
||||
|
||||
function AtInputSecretController (baseInputController) {
|
||||
let vm = this || {};
|
||||
const vm = this || {};
|
||||
|
||||
let scope;
|
||||
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
const templateUrl = require('@components/input/select.partial.html');
|
||||
const templateUrl = require('~components/input/select.partial.html');
|
||||
|
||||
function atInputSelectLink (scope, element, attrs, controllers) {
|
||||
let formController = controllers[0];
|
||||
let inputController = controllers[1];
|
||||
|
||||
if (scope.tab === '1') {
|
||||
elements.select.focus();
|
||||
}
|
||||
const [formController, inputController] = controllers;
|
||||
|
||||
inputController.init(scope, element, formController);
|
||||
}
|
||||
|
||||
function AtInputSelectController (baseInputController, eventService) {
|
||||
let vm = this || {};
|
||||
const vm = this || {};
|
||||
|
||||
let scope;
|
||||
let element;
|
||||
@@ -24,8 +19,12 @@ function AtInputSelectController (baseInputController, eventService) {
|
||||
|
||||
scope = _scope_;
|
||||
element = _element_;
|
||||
input = element.find('input')[0];
|
||||
select = element.find('select')[0];
|
||||
[input] = element.find('input');
|
||||
[select] = element.find('select');
|
||||
|
||||
if (scope.tab === '1') {
|
||||
select.focus();
|
||||
}
|
||||
|
||||
if (!scope.state._data || scope.state._data.length === 0) {
|
||||
scope.state._disabled = true;
|
||||
@@ -36,14 +35,14 @@ function AtInputSelectController (baseInputController, eventService) {
|
||||
vm.check();
|
||||
|
||||
if (scope.state._value) {
|
||||
vm.updateDisplayModel();
|
||||
vm.updateDisplayModel();
|
||||
}
|
||||
};
|
||||
|
||||
vm.setListeners = () => {
|
||||
let listeners = eventService.addListeners([
|
||||
const listeners = eventService.addListeners([
|
||||
[input, 'focus', () => select.focus],
|
||||
[select, 'mousedown', () => scope.$apply(() => scope.open = !scope.open)],
|
||||
[select, 'mousedown', () => scope.$apply(() => { scope.open = !scope.open; })],
|
||||
[select, 'focus', () => input.classList.add('at-Input--focus')],
|
||||
[select, 'change', () => scope.$apply(() => {
|
||||
scope.open = false;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const templateUrl = require('@components/input/text.partial.html');
|
||||
const templateUrl = require('~components/input/text.partial.html');
|
||||
|
||||
function atInputTextLink (scope, element, attrs, controllers) {
|
||||
let formController = controllers[0];
|
||||
let inputController = controllers[1];
|
||||
const formController = controllers[0];
|
||||
const inputController = controllers[1];
|
||||
|
||||
if (scope.tab === '1') {
|
||||
element.find('input')[0].focus();
|
||||
@@ -12,7 +12,7 @@ function atInputTextLink (scope, element, attrs, controllers) {
|
||||
}
|
||||
|
||||
function AtInputTextController (baseInputController) {
|
||||
let vm = this || {};
|
||||
const vm = this || {};
|
||||
|
||||
vm.init = (scope, element, form) => {
|
||||
baseInputController.call(vm, 'input', scope, element, form);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
const templateUrl = require('@components/input/textarea-secret.partial.html');
|
||||
const templateUrl = require('~components/input/textarea-secret.partial.html');
|
||||
|
||||
function atInputTextareaSecretLink (scope, element, attrs, controllers) {
|
||||
let formController = controllers[0];
|
||||
let inputController = controllers[1];
|
||||
const [formController, inputController] = controllers;
|
||||
|
||||
if (scope.tab === '1') {
|
||||
element.find('textarea')[0].focus();
|
||||
@@ -12,35 +11,31 @@ function atInputTextareaSecretLink (scope, element, attrs, controllers) {
|
||||
}
|
||||
|
||||
function AtInputTextareaSecretController (baseInputController, eventService) {
|
||||
let vm = this || {};
|
||||
const vm = this || {};
|
||||
|
||||
let scope;
|
||||
let textarea;
|
||||
let container;
|
||||
let input;
|
||||
|
||||
vm.init = (_scope_, element, form) => {
|
||||
baseInputController.call(vm, 'input', _scope_, element, form);
|
||||
|
||||
scope = _scope_;
|
||||
textarea = element.find('textarea')[0];
|
||||
container = element[0];
|
||||
[textarea] = element.find('textarea');
|
||||
|
||||
if (scope.state.format === 'ssh_private_key') {
|
||||
scope.ssh = true;
|
||||
scope.state._hint = scope.state._hint || vm.strings.get('textarea.SSH_KEY_HINT');
|
||||
input = element.find('input')[0];
|
||||
[input] = element.find('input');
|
||||
}
|
||||
|
||||
if (scope.state._value) {
|
||||
scope.state._buttonText = vm.strings.get('REPLACE');
|
||||
scope.state._placeholder = vm.strings.get('ENCRYPTED');
|
||||
} else {
|
||||
if (scope.state.format === 'ssh_private_key') {
|
||||
} else if (scope.state.format === 'ssh_private_key') {
|
||||
vm.listeners = vm.setFileListeners(textarea, input);
|
||||
scope.state._displayHint = true;
|
||||
}
|
||||
}
|
||||
|
||||
vm.check();
|
||||
};
|
||||
@@ -59,34 +54,32 @@ function AtInputTextareaSecretController (baseInputController, eventService) {
|
||||
}
|
||||
};
|
||||
|
||||
vm.setFileListeners = (textarea, input) => {
|
||||
return eventService.addListeners([
|
||||
[textarea, 'dragenter', event => {
|
||||
vm.setFileListeners = (textareaEl, inputEl) => eventService.addListeners([
|
||||
[textareaEl, 'dragenter', event => {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
scope.$apply(() => scope.drag = true);
|
||||
scope.$apply(() => { scope.drag = true; });
|
||||
}],
|
||||
|
||||
[input, 'dragleave', event => {
|
||||
[inputEl, 'dragleave', event => {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
scope.$apply(() => scope.drag = false);
|
||||
scope.$apply(() => { scope.drag = false; });
|
||||
}],
|
||||
|
||||
[input, 'change', event => {
|
||||
let reader = new FileReader();
|
||||
[inputEl, 'change', event => {
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = () => vm.readFile(reader, event);
|
||||
reader.readAsText(input.files[0]);
|
||||
reader.readAsText(inputEl.files[0]);
|
||||
}]
|
||||
]);
|
||||
};
|
||||
|
||||
vm.readFile = (reader, event) => {
|
||||
vm.readFile = (reader) => {
|
||||
scope.$apply(() => {
|
||||
scope.state._value = reader.result;
|
||||
vm.check();
|
||||
scope.drag = false
|
||||
scope.drag = false;
|
||||
input.value = '';
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const templateUrl = require('@components/input/textarea.partial.html');
|
||||
const templateUrl = require('~components/input/textarea.partial.html');
|
||||
|
||||
function atInputTextareaLink (scope, element, attrs, controllers) {
|
||||
let formController = controllers[0];
|
||||
let inputController = controllers[1];
|
||||
const formController = controllers[0];
|
||||
const inputController = controllers[1];
|
||||
|
||||
if (scope.tab === '1') {
|
||||
element.find('input')[0].focus();
|
||||
@@ -12,7 +12,7 @@ function atInputTextareaLink (scope, element, attrs, controllers) {
|
||||
}
|
||||
|
||||
function AtInputTextareaController (baseInputController) {
|
||||
let vm = this || {};
|
||||
const vm = this || {};
|
||||
|
||||
vm.init = (scope, element, form) => {
|
||||
baseInputController.call(vm, 'input', scope, element, form);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
const templateUrl = require('@components/layout/layout.partial.html');
|
||||
const templateUrl = require('~components/layout/layout.partial.html');
|
||||
|
||||
function AtLayoutController ($scope, strings) {
|
||||
let vm = this || {};
|
||||
const vm = this || {};
|
||||
|
||||
$scope.$on('$stateChangeSuccess', function(event, next) {
|
||||
$scope.$on('$stateChangeSuccess', (event, next) => {
|
||||
vm.currentState = next.name;
|
||||
});
|
||||
|
||||
$scope.$watch('$root.current_user', function(val) {
|
||||
$scope.$watch('$root.current_user', (val) => {
|
||||
vm.isLoggedIn = val && val.username;
|
||||
if (val) {
|
||||
vm.isSuperUser = $scope.$root.user_is_superuser || $scope.$root.user_is_system_auditor;
|
||||
@@ -16,19 +16,19 @@ function AtLayoutController ($scope, strings) {
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$watch('$root.socketStatus', function(newStatus) {
|
||||
$scope.$watch('$root.socketStatus', (newStatus) => {
|
||||
vm.socketState = newStatus;
|
||||
vm.socketIconClass = "icon-socket-" + $scope.socketStatus;
|
||||
vm.socketIconClass = `icon-socket-${$scope.socketStatus}`;
|
||||
});
|
||||
|
||||
$scope.$watch('$root.licenseMissing', function(licenseMissing) {
|
||||
$scope.$watch('$root.licenseMissing', (licenseMissing) => {
|
||||
vm.licenseIsMissing = licenseMissing;
|
||||
});
|
||||
|
||||
vm.getString = function(string) {
|
||||
vm.getString = string => {
|
||||
try {
|
||||
return strings.get(`layout.${string}`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return strings.get(string);
|
||||
}
|
||||
};
|
||||
@@ -44,8 +44,7 @@ function atLayout () {
|
||||
templateUrl,
|
||||
controller: AtLayoutController,
|
||||
controllerAs: 'vm',
|
||||
scope: {
|
||||
}
|
||||
scope: {}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
const templateUrl = require('@components/layout/side-nav-item.partial.html');
|
||||
const templateUrl = require('~components/layout/side-nav-item.partial.html');
|
||||
|
||||
function atSideNavItemLink (scope, element, attrs, ctrl) {
|
||||
scope.navVm = ctrl[0];
|
||||
scope.layoutVm = ctrl[1];
|
||||
[scope.navVm, scope.layoutVm] = ctrl;
|
||||
}
|
||||
|
||||
function AtSideNavItemController ($state, $scope, strings) {
|
||||
let vm = this || {};
|
||||
const vm = this || {};
|
||||
|
||||
$scope.$watch('layoutVm.currentState', function(current) {
|
||||
$scope.$watch('layoutVm.currentState', current => {
|
||||
if ($scope.name === 'portal mode') {
|
||||
vm.isRoute = (current && current.indexOf('portalMode') === 0);
|
||||
} else {
|
||||
if (current && current.indexOf($scope.route) === 0) {
|
||||
} else if (current && current.indexOf($scope.route) === 0) {
|
||||
if (current.indexOf('jobs.schedules') === 0 && $scope.route === 'jobs') {
|
||||
vm.isRoute = false;
|
||||
} else {
|
||||
@@ -21,12 +19,11 @@ function AtSideNavItemController ($state, $scope, strings) {
|
||||
} else {
|
||||
vm.isRoute = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
vm.go = function() {
|
||||
$state.go($scope.route, {}, {reload: true});
|
||||
}
|
||||
vm.go = () => {
|
||||
$state.go($scope.route, {}, { reload: true });
|
||||
};
|
||||
|
||||
vm.tooltip = {
|
||||
popover: {
|
||||
@@ -36,7 +33,7 @@ function AtSideNavItemController ($state, $scope, strings) {
|
||||
position: 'right',
|
||||
arrowHeight: 18
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
AtSideNavItemController.$inject = ['$state', '$scope', 'ComponentsStrings'];
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
const templateUrl = require('@components/layout/side-nav.partial.html');
|
||||
const templateUrl = require('~components/layout/side-nav.partial.html');
|
||||
|
||||
function atSideNavLink (scope, element, attrs, ctrl) {
|
||||
scope.layoutVm = ctrl;
|
||||
}
|
||||
|
||||
function AtSideNavController () {
|
||||
let vm = this || {};
|
||||
const vm = this || {};
|
||||
|
||||
vm.isExpanded = false;
|
||||
|
||||
vm.toggleExpansion = () => {
|
||||
vm.isExpanded = !vm.isExpanded;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function atSideNav () {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
const templateUrl = require('@components/layout/top-nav-item.partial.html');
|
||||
const templateUrl = require('~components/layout/top-nav-item.partial.html');
|
||||
|
||||
function atTopNavItemLink (scope, element, attrs, ctrl) {
|
||||
scope.layoutVm = ctrl;
|
||||
|
||||
scope.isHidden = false;
|
||||
|
||||
var shownWhen = attrs.isShown;
|
||||
const shownWhen = attrs.isShown;
|
||||
|
||||
if (shownWhen !== 'missingLicense') {
|
||||
scope.$watch('layoutVm.licenseIsMissing', function(val) {
|
||||
scope.$watch('layoutVm.licenseIsMissing', (val) => {
|
||||
scope.isHidden = val;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
const templateUrl = require('@components/modal/modal.partial.html');
|
||||
const templateUrl = require('~components/modal/modal.partial.html');
|
||||
|
||||
const DEFAULT_ANIMATION_DURATION = 150;
|
||||
|
||||
function atModalLink (scope, el, attrs, controllers) {
|
||||
let modalController = controllers[0];
|
||||
let property = `scope.${scope.ns}.modal`;
|
||||
const modalController = controllers[0];
|
||||
const property = `scope.${scope.ns}.modal`;
|
||||
|
||||
let done = scope.$watch(property, () => {
|
||||
const done = scope.$watch(property, () => {
|
||||
modalController.init(scope, el);
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
||||
function AtModalController (eventService, strings) {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
|
||||
let overlay;
|
||||
let modal;
|
||||
@@ -22,15 +22,15 @@ function AtModalController (eventService, strings) {
|
||||
vm.strings = strings;
|
||||
|
||||
vm.init = (scope, el) => {
|
||||
overlay = el[0];
|
||||
modal = el.find('.at-Modal-window')[0];
|
||||
[overlay] = el;
|
||||
[modal] = el.find('.at-Modal-window');
|
||||
|
||||
vm.modal = scope[scope.ns].modal;
|
||||
vm.modal.show = vm.show;
|
||||
vm.modal.hide = vm.hide;
|
||||
};
|
||||
|
||||
vm.show = (title, message) => {
|
||||
vm.show = (title, message, event) => {
|
||||
vm.modal.title = title;
|
||||
vm.modal.message = message;
|
||||
|
||||
@@ -49,7 +49,9 @@ function AtModalController (eventService, strings) {
|
||||
|
||||
eventService.remove(listeners);
|
||||
|
||||
setTimeout(() => overlay.style.display = 'none', DEFAULT_ANIMATION_DURATION);
|
||||
setTimeout(() => {
|
||||
overlay.style.display = 'none';
|
||||
}, DEFAULT_ANIMATION_DURATION);
|
||||
};
|
||||
|
||||
vm.clickToHide = event => {
|
||||
@@ -59,10 +61,10 @@ function AtModalController (eventService, strings) {
|
||||
};
|
||||
|
||||
vm.clickIsOutsideModal = e => {
|
||||
let m = modal.getBoundingClientRect();
|
||||
let cx = e.clientX;
|
||||
let cy = e.clientY;
|
||||
|
||||
const m = modal.getBoundingClientRect();
|
||||
const cx = e.clientX;
|
||||
const cy = e.clientY;
|
||||
|
||||
if (cx < m.left || cx > m.right || cy > m.bottom || cy < m.top) {
|
||||
return true;
|
||||
}
|
||||
@@ -74,7 +76,7 @@ function AtModalController (eventService, strings) {
|
||||
AtModalController.$inject = [
|
||||
'EventService',
|
||||
'ComponentsStrings'
|
||||
]
|
||||
];
|
||||
|
||||
function atModal () {
|
||||
return {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const templateUrl = require('@components/panel/body.partial.html');
|
||||
const templateUrl = require('~components/panel/body.partial.html');
|
||||
|
||||
function atPanelBody () {
|
||||
return {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const templateUrl = require('@components/panel/heading.partial.html');
|
||||
const templateUrl = require('~components/panel/heading.partial.html');
|
||||
|
||||
function link (scope, el, attrs, panel) {
|
||||
panel.use(scope);
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
const templateUrl = require('@components/panel/panel.partial.html');
|
||||
const templateUrl = require('~components/panel/panel.partial.html');
|
||||
|
||||
function atPanelLink (scope, el, attrs, controllers) {
|
||||
let panelController = controllers[0];
|
||||
function atPanelLink (scope, el, attrs, controller) {
|
||||
const panelController = controller;
|
||||
|
||||
panelController.init(scope, el);
|
||||
panelController.init(scope);
|
||||
}
|
||||
|
||||
function AtPanelController ($state) {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
|
||||
let scope;
|
||||
let el;
|
||||
|
||||
vm.init = (_scope_, _el_) => {
|
||||
vm.init = (_scope_) => {
|
||||
scope = _scope_;
|
||||
el = _el_;
|
||||
};
|
||||
|
||||
vm.dismiss = () => {
|
||||
@@ -32,7 +30,7 @@ function atPanel () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
require: ['atPanel'],
|
||||
require: 'atPanel',
|
||||
transclude: true,
|
||||
templateUrl,
|
||||
controller: AtPanelController,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const templateUrl = require('@components/popover/popover.partial.html');
|
||||
const templateUrl = require('~components/popover/popover.partial.html');
|
||||
|
||||
const DEFAULT_POSITION = 'right';
|
||||
const DEFAULT_ACTION = 'click';
|
||||
@@ -10,21 +10,20 @@ const DEFAULT_REFRESH_DELAY = 50;
|
||||
const DEFAULT_RESET_ON_EXIT = false;
|
||||
|
||||
function atPopoverLink (scope, el, attr, controllers) {
|
||||
let popoverController = controllers[0];
|
||||
let container = el[0];
|
||||
let popover = container.getElementsByClassName('at-Popover-container')[0];
|
||||
let icon = container.getElementsByTagName('i')[0];
|
||||
const popoverController = controllers[0];
|
||||
const container = el[0];
|
||||
const popover = container.getElementsByClassName('at-Popover-container')[0];
|
||||
const icon = container.getElementsByTagName('i')[0];
|
||||
|
||||
let done = scope.$watch('state', () => {
|
||||
const done = scope.$watch('state', () => {
|
||||
popoverController.init(scope, container, icon, popover);
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
||||
function AtPopoverController () {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
|
||||
let container;
|
||||
let icon;
|
||||
let popover;
|
||||
let scope;
|
||||
@@ -59,24 +58,22 @@ function AtPopoverController () {
|
||||
}
|
||||
};
|
||||
|
||||
vm.createDismissListener = (createEvent) => {
|
||||
return event => {
|
||||
event.stopPropagation();
|
||||
vm.createDismissListener = () => event => {
|
||||
event.stopPropagation();
|
||||
|
||||
if (vm.isClickWithinPopover(event, popover)) {
|
||||
return;
|
||||
}
|
||||
if (vm.isClickWithinPopover(event, popover)) {
|
||||
return;
|
||||
}
|
||||
|
||||
vm.dismiss();
|
||||
vm.dismiss();
|
||||
|
||||
if (scope.popover.on === 'mouseenter') {
|
||||
icon.removeEventListener('mouseleave', vm.dismissListener);
|
||||
} else {
|
||||
window.addEventListener(scope.popover.on, vm.dismissListener);
|
||||
}
|
||||
if (scope.popover.on === 'mouseenter') {
|
||||
icon.removeEventListener('mouseleave', vm.dismissListener);
|
||||
} else {
|
||||
window.addEventListener(scope.popover.on, vm.dismissListener);
|
||||
}
|
||||
|
||||
window.removeEventListener('resize', vm.dismissListener);
|
||||
};
|
||||
window.removeEventListener('resize', vm.dismissListener);
|
||||
};
|
||||
|
||||
vm.dismiss = (refresh) => {
|
||||
@@ -91,11 +88,11 @@ function AtPopoverController () {
|
||||
popover.style.opacity = 0;
|
||||
};
|
||||
|
||||
vm.isClickWithinPopover = (event, popover) => {
|
||||
let box = popover.getBoundingClientRect();
|
||||
vm.isClickWithinPopover = (event, popoverEl) => {
|
||||
const box = popoverEl.getBoundingClientRect();
|
||||
|
||||
let x = event.clientX;
|
||||
let y = event.clientY;
|
||||
const x = event.clientX;
|
||||
const y = event.clientY;
|
||||
|
||||
if ((x <= box.right && x >= box.left) && (y >= box.top && y <= box.bottom)) {
|
||||
return true;
|
||||
@@ -104,26 +101,24 @@ function AtPopoverController () {
|
||||
return false;
|
||||
};
|
||||
|
||||
vm.createDisplayListener = () => {
|
||||
return event => {
|
||||
if (vm.open) {
|
||||
return;
|
||||
}
|
||||
vm.createDisplayListener = () => event => {
|
||||
if (vm.open) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.stopPropagation();
|
||||
event.stopPropagation();
|
||||
|
||||
vm.display();
|
||||
vm.display();
|
||||
|
||||
vm.dismissListener = vm.createDismissListener(event);
|
||||
vm.dismissListener = vm.createDismissListener(event);
|
||||
|
||||
if (scope.popover.on === 'mouseenter') {
|
||||
icon.addEventListener('mouseleave', vm.dismissListener);
|
||||
} else {
|
||||
window.addEventListener(scope.popover.on, vm.dismissListener);
|
||||
}
|
||||
if (scope.popover.on === 'mouseenter') {
|
||||
icon.addEventListener('mouseleave', vm.dismissListener);
|
||||
} else {
|
||||
window.addEventListener(scope.popover.on, vm.dismissListener);
|
||||
}
|
||||
|
||||
window.addEventListener('resize', vm.dismissListener);
|
||||
};
|
||||
window.addEventListener('resize', vm.dismissListener);
|
||||
};
|
||||
|
||||
vm.refresh = () => {
|
||||
@@ -136,12 +131,12 @@ function AtPopoverController () {
|
||||
};
|
||||
|
||||
vm.getPositions = () => {
|
||||
let arrow = popover.getElementsByClassName('at-Popover-arrow')[0];
|
||||
const arrow = popover.getElementsByClassName('at-Popover-arrow')[0];
|
||||
|
||||
arrow.style.lineHeight = `${DEFAULT_ARROW_HEIGHT}px`;
|
||||
arrow.children[0].style.lineHeight = `${scope.popover.arrowHeight}px`;
|
||||
|
||||
let data = {
|
||||
const data = {
|
||||
arrow,
|
||||
icon: icon.getBoundingClientRect(),
|
||||
popover: popover.getBoundingClientRect(),
|
||||
@@ -158,7 +153,7 @@ function AtPopoverController () {
|
||||
vm.display = () => {
|
||||
vm.open = true;
|
||||
|
||||
let positions = vm.getPositions();
|
||||
const positions = vm.getPositions();
|
||||
|
||||
popover.style.visibility = 'visible';
|
||||
popover.style.opacity = 1;
|
||||
@@ -171,19 +166,18 @@ function AtPopoverController () {
|
||||
};
|
||||
|
||||
vm.displayRight = (pos) => {
|
||||
let arrowHeight = pos.arrow.offsetHeight;
|
||||
let arrowLeft = pos.rightBoundary + DEFAULT_PADDING;
|
||||
const arrowHeight = pos.arrow.offsetHeight;
|
||||
const arrowLeft = pos.rightBoundary + DEFAULT_PADDING;
|
||||
const popoverLeft = arrowLeft + DEFAULT_PADDING - 1;
|
||||
|
||||
let popoverTop;
|
||||
let popoverLeft = arrowLeft + DEFAULT_PADDING - 1;
|
||||
|
||||
if (pos.cy < (pos.popover.height / 2)) {
|
||||
popoverTop = DEFAULT_PADDING;
|
||||
} else {
|
||||
popoverTop = Math.floor((pos.cy - pos.popover.height / 2));
|
||||
}
|
||||
|
||||
let arrowTop = Math.floor(popoverTop + (pos.popover.height / 2) - (arrowHeight / 2));
|
||||
const arrowTop = Math.floor(popoverTop + (pos.popover.height / 2) - (arrowHeight / 2));
|
||||
|
||||
pos.arrow.style.top = `${arrowTop}px`;
|
||||
pos.arrow.style.left = `${arrowLeft}px`;
|
||||
@@ -193,11 +187,11 @@ function AtPopoverController () {
|
||||
};
|
||||
|
||||
vm.displayTop = (pos) => {
|
||||
let arrowTop = pos.icon.top - pos.icon.height - DEFAULT_PADDING;
|
||||
let arrowLeft = Math.floor(pos.icon.right - pos.icon.width - (pos.arrow.style.width / 2));
|
||||
const arrowTop = pos.icon.top - pos.icon.height - DEFAULT_PADDING;
|
||||
const arrowLeft = Math.floor(pos.icon.right - pos.icon.width - (pos.arrow.style.width / 2));
|
||||
|
||||
let popoverTop = pos.icon.top - pos.popover.height - pos.icon.height - 5;
|
||||
let popoverLeft = Math.floor(pos.cx - (pos.popover.width / 2));
|
||||
const popoverTop = pos.icon.top - pos.popover.height - pos.icon.height - 5;
|
||||
const popoverLeft = Math.floor(pos.cx - (pos.popover.width / 2));
|
||||
|
||||
pos.arrow.style.top = `${arrowTop}px`;
|
||||
pos.arrow.style.left = `${arrowLeft}px`;
|
||||
|
||||
@@ -1,24 +1,10 @@
|
||||
const templateUrl = require('@components/tabs/group.partial.html');
|
||||
const templateUrl = require('~components/tabs/group.partial.html');
|
||||
|
||||
function atTabGroupLink (scope, el, attrs, controllers) {
|
||||
let groupController = controllers[0];
|
||||
|
||||
groupController.init(scope, el);
|
||||
}
|
||||
|
||||
function AtTabGroupController ($state) {
|
||||
let vm = this;
|
||||
function AtTabGroupController () {
|
||||
const vm = this;
|
||||
|
||||
vm.tabs = [];
|
||||
|
||||
let scope;
|
||||
let el;
|
||||
|
||||
vm.init = (_scope_, _el_) => {
|
||||
scope = _scope_;
|
||||
el = _el_;
|
||||
};
|
||||
|
||||
vm.register = tab => {
|
||||
tab.active = true;
|
||||
|
||||
@@ -26,18 +12,15 @@ function AtTabGroupController ($state) {
|
||||
};
|
||||
}
|
||||
|
||||
AtTabGroupController.$inject = ['$state'];
|
||||
|
||||
function atTabGroup () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
require: ['atTabGroup'],
|
||||
require: 'atTabGroup',
|
||||
transclude: true,
|
||||
templateUrl,
|
||||
controller: AtTabGroupController,
|
||||
controllerAs: 'vm',
|
||||
link: atTabGroupLink,
|
||||
scope: {
|
||||
state: '='
|
||||
}
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
const templateUrl = require('@components/tabs/tab.partial.html');
|
||||
const templateUrl = require('~components/tabs/tab.partial.html');
|
||||
|
||||
function atTabLink (scope, el, attrs, controllers) {
|
||||
let groupController = controllers[0];
|
||||
let tabController = controllers[1];
|
||||
const groupController = controllers[0];
|
||||
const tabController = controllers[1];
|
||||
|
||||
tabController.init(scope, el, groupController);
|
||||
tabController.init(scope, groupController);
|
||||
}
|
||||
|
||||
function AtTabController ($state) {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
|
||||
let scope;
|
||||
let el;
|
||||
let group;
|
||||
|
||||
vm.init = (_scope_, _el_, _group_) => {
|
||||
vm.init = (_scope_, _group_) => {
|
||||
scope = _scope_;
|
||||
el = _el_;
|
||||
group = _group_;
|
||||
|
||||
group.register(scope);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
const templateUrl = require('@components/truncate/truncate.partial.html');
|
||||
const templateUrl = require('~components/truncate/truncate.partial.html');
|
||||
|
||||
function atTruncateLink (scope, el, attr, ctrl) {
|
||||
let truncateController = ctrl;
|
||||
let string = attr.string;
|
||||
let maxlength = attr.maxlength;
|
||||
const truncateController = ctrl;
|
||||
const { string } = attr;
|
||||
const { maxlength } = attr;
|
||||
|
||||
truncateController.init(el, string, maxlength);
|
||||
}
|
||||
|
||||
function AtTruncateController (strings) {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
let el;
|
||||
let string;
|
||||
let maxlength;
|
||||
@@ -29,14 +29,14 @@ function AtTruncateController (strings) {
|
||||
position: 'top',
|
||||
icon: 'fa fa-clone',
|
||||
resetOnExit: true,
|
||||
click: copyToClipboard
|
||||
click: vm.copyToClipboard
|
||||
}
|
||||
};
|
||||
|
||||
function copyToClipboard() {
|
||||
vm.copyToClipboard = () => {
|
||||
vm.tooltip.popover.text = vm.strings.get('truncate.COPIED');
|
||||
|
||||
let textarea = el[0].getElementsByClassName('at-Truncate-textarea')[0];
|
||||
const textarea = el[0].getElementsByClassName('at-Truncate-textarea')[0];
|
||||
textarea.value = string;
|
||||
textarea.select();
|
||||
|
||||
@@ -46,7 +46,7 @@ function AtTruncateController (strings) {
|
||||
|
||||
AtTruncateController.$inject = ['ComponentsStrings'];
|
||||
|
||||
function atTruncate() {
|
||||
function atTruncate () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
@@ -60,7 +60,7 @@ function atTruncate() {
|
||||
maxLength: '@',
|
||||
string: '@'
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default atTruncate;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const templateUrl = require('@components/utility/divider.partial.html');
|
||||
const templateUrl = require('~components/utility/divider.partial.html');
|
||||
|
||||
function atPanelBody () {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user