Ember update (#5386)

Ember update - update ember-cli, ember-data, and ember to 3.4 series
This commit is contained in:
Matthew Irish 2018-09-25 11:28:26 -05:00 committed by GitHub
parent ed1e41ba5c
commit d509588cd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
531 changed files with 13156 additions and 11617 deletions

View File

@ -23,16 +23,14 @@ matrix:
- go: tip
cache:
yarn: true
directories:
- ui/node_modules
before_install:
- nvm install 8
- nvm use 8
# Repo for Yarn
- sudo apt-key adv --fetch-keys http://dl.yarnpkg.com/debian/pubkey.gpg
- echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- sudo apt-get update -qq
- sudo apt-get install -y -qq yarn
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.9.4
- export PATH="$HOME/.yarn/bin:$PATH"
branches:
only:

View File

@ -13,6 +13,11 @@ insert_final_newline = true
indent_style = space
indent_size = 2
[*.js]
quote_type = single
max_line_length = 110
[*.hbs]
insert_final_newline = false

18
ui/.eslintignore Normal file
View File

@ -0,0 +1,18 @@
# unconventional js
/blueprints/*/files/
/vendor/
# compiled output
/dist/
/tmp/
# dependencies
/bower_components/
# misc
/coverage/
# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try

View File

@ -7,7 +7,8 @@ module.exports = {
experimentalObjectRestSpread: true,
},
},
extends: 'eslint:recommended',
plugins: ['ember'],
extends: ['eslint:recommended', 'plugin:ember/recommended'],
env: {
browser: true,
es6: true,
@ -19,4 +20,26 @@ module.exports = {
TextEncoderLite: true,
TextDecoderLite: true,
},
overrides: [
// node files
{
files: [
'.template-lintrc.js',
'ember-cli-build.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'lib/*/index.js',
'scripts/start-vault.js',
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015,
},
env: {
browser: false,
node: true,
},
},
],
};

22
ui/.gitignore vendored
View File

@ -1,23 +1,23 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/dist/
/tmp/
# dependencies
/node_modules
/bower_components
/bower_components/
/node_modules/
# misc
/.sass-cache
/connect.lock
/coverage/*
/coverage/
/libpeerconnection.log
npm-debug.log*
yarn-error.log
testem.log
/npm-debug.log*
/testem.log
/yarn-error.log
# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try

27
ui/.template-lintrc.js Normal file
View File

@ -0,0 +1,27 @@
'use strict';
module.exports = {
extends: 'recommended',
rules: {
// should definitely move to template only
// glimmer components for this one
'no-partial': false,
// these need to be looked into, but
// may be a bigger change
'no-invalid-interactive': false,
'simple-unless': false,
'self-closing-void-elements': false,
'no-unnecessary-concat': false,
'no-quoteless-attributes': false,
'no-nested-interactive': false,
// not sure we'll ever want these on,
// would be nice but if prettier isn't doing
// it for us, then not sure it's worth it
'attribute-indentation': false,
'block-indentation': false,
quotes: false,
},
};

View File

@ -1,25 +0,0 @@
---
language: node_js
node_js:
- "4"
sudo: false
cache:
directories:
- $HOME/.npm
- $HOME/.cache # includes bowers cache
before_install:
- npm config set spin false
- npm install -g bower
- bower --version
- npm install phantomjs-prebuilt
- node_modules/phantomjs-prebuilt/bin/phantomjs --version
install:
- npm install
- bower install
script:
- npm test

View File

@ -9,6 +9,7 @@ You will need the following things properly installed on your computer.
* [Node.js](https://nodejs.org/) (with NPM)
* [Yarn](https://yarnpkg.com/en/)
* [Git](https://git-scm.com/)
* [Ember CLI](https://ember-cli.com/)
@ -47,6 +48,12 @@ acceptance tests then run, proxing requests back to that server.
* `yarn run test -f="policies"` to filter the tests that are run. `-f` gets passed into
[QUnit's `filter` config](https://api.qunitjs.com/config/QUnit.config#qunitconfigfilter-string--default-undefined)
### Linting
* `yarn lint:hbs`
* `yarn lint:js`
* `yarn lint:js -- --fix`
### Building Vault UI into a Vault Binary
We use `go-bindata-assetfs` to build the static assets of the
Ember application into a Vault binary.

View File

@ -1,18 +1,20 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { assign } from '@ember/polyfills';
import { set } from '@ember/object';
import RSVP from 'rsvp';
import DS from 'ember-data';
import fetch from 'fetch';
import config from '../config/environment';
const { APP } = config;
const { POLLING_URLS, NAMESPACE_ROOT_URLS } = APP;
const { inject, assign, set, RSVP } = Ember;
export default DS.RESTAdapter.extend({
auth: inject.service(),
namespaceService: inject.service('namespace'),
controlGroup: inject.service(),
auth: service(),
namespaceService: service('namespace'),
controlGroup: service(),
flashMessages: inject.service(),
flashMessages: service(),
namespace: 'v1/sys',

View File

@ -1,4 +1,5 @@
import Ember from 'ember';
import { assign } from '@ember/polyfills';
import { get, set } from '@ember/object';
import ApplicationAdapter from './application';
import DS from 'ember-data';
@ -14,7 +15,7 @@ export default ApplicationAdapter.extend({
},
findAll(store, type, sinceToken, snapshotRecordArray) {
let isUnauthenticated = Ember.get(snapshotRecordArray || {}, 'adapterOptions.unauthenticated');
let isUnauthenticated = get(snapshotRecordArray || {}, 'adapterOptions.unauthenticated');
if (isUnauthenticated) {
let url = `/${this.urlPrefix()}/internal/ui/mounts`;
return this.ajax(url, 'GET', {
@ -33,7 +34,7 @@ export default ApplicationAdapter.extend({
}
return this.ajax(this.url(), 'GET').catch(e => {
if (e instanceof DS.AdapterError) {
Ember.set(e, 'policyPath', 'sys/auth');
set(e, 'policyPath', 'sys/auth');
}
throw e;
});
@ -47,7 +48,7 @@ export default ApplicationAdapter.extend({
return this.ajax(this.url(path), 'POST', { data }).then(() => {
// ember data doesn't like 204s if it's not a DELETE
return {
data: Ember.assign({}, data, { path: path + '/', id: path }),
data: assign({}, data, { path: path + '/', id: path }),
};
});
},

View File

@ -1,6 +1,6 @@
import { set } from '@ember/object';
import ApplicationAdapter from './application';
import DS from 'ember-data';
import Ember from 'ember';
export default ApplicationAdapter.extend({
pathForType() {
@ -10,7 +10,7 @@ export default ApplicationAdapter.extend({
findRecord(store, type, id) {
return this.ajax(this.buildURL(type), 'POST', { data: { paths: [id] } }).catch(e => {
if (e instanceof DS.AdapterError) {
Ember.set(e, 'policyPath', 'sys/capabilities-self');
set(e, 'policyPath', 'sys/capabilities-self');
}
throw e;
});

View File

@ -1,9 +1,13 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { assign } from '@ember/polyfills';
import { hash, resolve } from 'rsvp';
import { assert } from '@ember/debug';
import { pluralize } from 'ember-inflector';
import ApplicationAdapter from './application';
import DS from 'ember-data';
const { AdapterError } = DS;
const { assert, inject } = Ember;
const ENDPOINTS = ['health', 'seal-status', 'tokens', 'token', 'seal', 'unseal', 'init', 'capabilities-self'];
@ -19,8 +23,8 @@ const REPLICATION_ENDPOINTS = {
const REPLICATION_MODES = ['dr', 'performance'];
export default ApplicationAdapter.extend({
version: inject.service(),
namespaceService: inject.service('namespace'),
version: service(),
namespaceService: service('namespace'),
shouldBackgroundReloadRecord() {
return true;
},
@ -32,24 +36,24 @@ export default ApplicationAdapter.extend({
if (this.get('version.isEnterprise') && this.get('namespaceService.inRootNamespace')) {
fetches.replicationStatus = this.replicationStatus().catch(e => e);
}
return Ember.RSVP.hash(fetches).then(({ health, sealStatus, replicationStatus }) => {
return hash(fetches).then(({ health, sealStatus, replicationStatus }) => {
let ret = {
id,
name: snapshot.attr('name'),
};
ret = Ember.assign(ret, health);
ret = assign(ret, health);
if (sealStatus instanceof AdapterError === false) {
ret = Ember.assign(ret, { nodes: [sealStatus] });
ret = assign(ret, { nodes: [sealStatus] });
}
if (replicationStatus && replicationStatus instanceof AdapterError === false) {
ret = Ember.assign(ret, replicationStatus.data);
ret = assign(ret, replicationStatus.data);
}
return Ember.RSVP.resolve(ret);
return resolve(ret);
});
},
pathForType(type) {
return type === 'cluster' ? 'clusters' : Ember.String.pluralize(type);
return type === 'cluster' ? 'clusters' : pluralize(type);
},
health() {

View File

@ -3,8 +3,6 @@ import ApplicationAdapter from './application';
export default ApplicationAdapter.extend({
namespace: 'v1',
defaultSerializer: 'ssh',
url(snapshot, action) {
const { backend, caType, type } = snapshot.attributes();
if (action === 'sign-intermediate') {
@ -20,7 +18,7 @@ export default ApplicationAdapter.extend({
},
createRecordOrUpdate(store, type, snapshot, requestType) {
const serializer = store.serializerFor(this.get('defaultSerializer'));
const serializer = store.serializerFor('application');
const isUpload = snapshot.attr('uploadPemBundle');
const isSetSignedIntermediate = snapshot.adapterOptions.method === 'setSignedIntermediate';
let action = snapshot.adapterOptions.method === 'signIntermediate' ? 'sign-intermediate' : null;

View File

@ -1,4 +1,4 @@
import Ember from 'ember';
import { assign } from '@ember/polyfills';
import Adapter from './pki';
export default Adapter.extend({
@ -33,7 +33,7 @@ export default Adapter.extend({
data.id = id;
data.id_for_nav = `cert/${id}`;
}
return Ember.assign({}, resp, data);
return assign({}, resp, data);
});
},
@ -60,7 +60,7 @@ export default Adapter.extend({
serial_number: id,
backend,
};
return Ember.assign({}, resp, data);
return assign({}, resp, data);
});
},
});

View File

@ -1,12 +1,12 @@
import { hash, resolve } from 'rsvp';
import { capitalize } from '@ember/string';
import { set } from '@ember/object';
import ApplicationAdapter from './application';
import DS from 'ember-data';
import Ember from 'ember';
export default ApplicationAdapter.extend({
namespace: 'v1',
defaultSerializer: 'config',
urlFor(backend, section) {
const urls = {
tidy: `/v1/${backend}/tidy`,
@ -18,7 +18,7 @@ export default ApplicationAdapter.extend({
createOrUpdate(store, type, snapshot) {
const url = this.urlFor(snapshot.record.get('backend'), snapshot.adapterOptions.method);
const serializer = store.serializerFor(this.get('defaultSerializer'));
const serializer = store.serializerFor(type.modelName);
if (!url) {
return;
}
@ -31,7 +31,11 @@ export default ApplicationAdapter.extend({
}
return data;
}, {});
return this.ajax(url, 'POST', { data });
return this.ajax(url, 'POST', { data }).then(resp => {
let response = resp || {};
response.id = `${snapshot.record.get('backend')}-${snapshot.adapterOptions.method}`;
return response;
});
},
createRecord() {
@ -46,10 +50,10 @@ export default ApplicationAdapter.extend({
const sections = ['cert', 'urls', 'crl', 'tidy'];
if (!section || !sections.includes(section)) {
const error = new DS.AdapterError();
Ember.set(error, 'httpStatus', 404);
set(error, 'httpStatus', 404);
throw error;
}
return this[`fetch${Ember.String.capitalize(section)}`](backendPath);
return this[`fetch${capitalize(section)}`](backendPath);
},
id(backendPath) {
@ -62,7 +66,7 @@ export default ApplicationAdapter.extend({
const pemURL = `${derURL}/pem`;
const chainURL = `${derURL}_chain`;
return Ember.RSVP.hash({
return hash({
backend: backendPath,
id: this.id(backendPath),
der: this.rawRequest(derURL, 'GET', { unauthenticated: true }).then(response => response.blob()),
@ -82,7 +86,7 @@ export default ApplicationAdapter.extend({
})
.catch(e => {
if (e.httpStatus === 404) {
return Ember.RSVP.resolve({ id });
return resolve({ id });
} else {
throw e;
}
@ -109,7 +113,7 @@ export default ApplicationAdapter.extend({
fetchTidy(backendPath) {
const id = this.id(backendPath);
return Ember.RSVP.resolve({ id, backend: backendPath });
return resolve({ id, backend: backendPath });
},
queryRecord(store, type, query) {

View File

@ -1,13 +1,11 @@
import { assert } from '@ember/debug';
import ApplicationAdapter from './application';
import Ember from 'ember';
export default ApplicationAdapter.extend({
namespace: 'v1',
defaultSerializer: 'ssh',
url(/*role*/) {
Ember.assert('Override the `url` method to extend the SSH adapter', false);
assert('Override the `url` method to extend the SSH adapter', false);
},
createRecord(store, type, snapshot, requestType) {

View File

@ -1,4 +1,4 @@
import Ember from 'ember';
import { assign } from '@ember/polyfills';
import ApplicationAdapter from './application';
export default ApplicationAdapter.extend({
@ -16,7 +16,7 @@ export default ApplicationAdapter.extend({
return this.ajax(this.buildURL(type.modelName, name), 'PUT', { data }).then(() => {
// doing this to make it like a Vault response - ember data doesn't like 204s if it's not a DELETE
return {
data: Ember.assign({}, snapshot.record.toJSON(), { id: name }),
data: assign({}, snapshot.record.toJSON(), { id: name }),
};
});
},

View File

@ -1,5 +1,5 @@
import { assign } from '@ember/polyfills';
import ApplicationAdapter from './application';
import Ember from 'ember';
export default ApplicationAdapter.extend({
namespace: 'v1',
@ -55,7 +55,7 @@ export default ApplicationAdapter.extend({
backend,
};
return Ember.assign({}, resp, data);
return assign({}, resp, data);
});
},

View File

@ -1,5 +1,5 @@
import { assign } from '@ember/polyfills';
import ApplicationAdapter from './application';
import Ember from 'ember';
export default ApplicationAdapter.extend({
namespace: 'v1',
@ -55,7 +55,7 @@ export default ApplicationAdapter.extend({
backend,
};
return Ember.assign({}, resp, data);
return assign({}, resp, data);
});
},

View File

@ -1,5 +1,6 @@
import { assign } from '@ember/polyfills';
import { resolve, allSettled } from 'rsvp';
import ApplicationAdapter from './application';
import Ember from 'ember';
export default ApplicationAdapter.extend({
namespace: 'v1',
@ -50,13 +51,13 @@ export default ApplicationAdapter.extend({
fetchByQuery(store, query) {
const { id, backend } = query;
let zeroAddressAjax = Ember.RSVP.resolve();
let zeroAddressAjax = resolve();
const queryAjax = this.ajax(this.urlForRole(backend, id), 'GET', this.optionsForQuery(id));
if (!id) {
zeroAddressAjax = this.findAllZeroAddress(store, query);
}
return Ember.RSVP.allSettled([queryAjax, zeroAddressAjax]).then(results => {
return allSettled([queryAjax, zeroAddressAjax]).then(results => {
// query result 404d, so throw the adapterError
if (!results[0].value) {
throw results[0].reason;
@ -65,14 +66,15 @@ export default ApplicationAdapter.extend({
id,
name: id,
backend,
data: {},
};
results.forEach(result => {
if (result.value) {
if (result.value.data.roles) {
resp = Ember.assign({}, resp, { zero_address_roles: result.value.data.roles });
resp.data = assign({}, resp.data, { zero_address_roles: result.value.data.roles });
} else {
resp = Ember.assign({}, resp, result.value);
resp.data = assign({}, resp.data, result.value.data);
}
}
});

View File

@ -1,4 +1,4 @@
import Ember from 'ember';
import { assign } from '@ember/polyfills';
import ApplicationAdapter from './application';
export default ApplicationAdapter.extend({
@ -27,7 +27,7 @@ export default ApplicationAdapter.extend({
return this.ajax(this.url(path), 'POST', { data }).then(() => {
// ember data doesn't like 204s if it's not a DELETE
return {
data: Ember.assign({}, data, { path: path + '/', id: path }),
data: assign({}, data, { path: path + '/', id: path }),
};
});
},

View File

@ -1,4 +1,4 @@
import Ember from 'ember';
import { isEmpty } from '@ember/utils';
import SecretAdapter from './secret';
export default SecretAdapter.extend({
@ -14,7 +14,7 @@ export default SecretAdapter.extend({
urlForSecret(backend, id, infix = 'data') {
let url = `${this.buildURL()}/${backend}/${infix}/`;
if (!Ember.isEmpty(id)) {
if (!isEmpty(id)) {
url = url + id;
}
return url;

View File

@ -1,4 +1,4 @@
import Ember from 'ember';
import { isEmpty } from '@ember/utils';
import ApplicationAdapter from './application';
export default ApplicationAdapter.extend({
@ -27,7 +27,7 @@ export default ApplicationAdapter.extend({
urlForSecret(backend, id) {
let url = `${this.buildURL()}/${backend}/`;
if (!Ember.isEmpty(id)) {
if (!isEmpty(id)) {
url = url + id;
}

View File

@ -1,5 +1,5 @@
import { assert } from '@ember/debug';
import ApplicationAdapter from './application';
import Ember from 'ember';
export default ApplicationAdapter.extend({
namespace: 'v1',
@ -7,7 +7,7 @@ export default ApplicationAdapter.extend({
defaultSerializer: 'ssh',
url(/*role*/) {
Ember.assert('Override the `url` method to extend the SSH adapter', false);
assert('Override the `url` method to extend the SSH adapter', false);
},
createRecord(store, type, snapshot, requestType) {

View File

@ -1,5 +1,5 @@
import Ember from 'ember';
import ApplicationAdapter from './application';
import { pluralize } from 'ember-inflector';
export default ApplicationAdapter.extend({
namespace: 'v1',
@ -40,7 +40,7 @@ export default ApplicationAdapter.extend({
path = 'secrets';
break;
default:
path = Ember.String.pluralize(type);
path = pluralize(type);
break;
}
return path;

View File

@ -1,11 +1,11 @@
import Ember from 'ember';
import Application from '@ember/application';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';
let App;
App = Ember.Application.extend({
App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver,

View File

@ -1,14 +1,13 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
import DS from 'ember-data';
const { inject } = Ember;
const AuthConfigBase = Ember.Component.extend({
const AuthConfigBase = Component.extend({
tagName: '',
model: null,
flashMessages: inject.service(),
flashMessages: service(),
saveModel: task(function*() {
try {

View File

@ -1,8 +1,12 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { match, alias, or } from '@ember/object/computed';
import { assign } from '@ember/polyfills';
import { dasherize } from '@ember/string';
import Component from '@ember/component';
import { get, computed } from '@ember/object';
import { supportedAuthBackends } from 'vault/helpers/supported-auth-backends';
import { task } from 'ember-concurrency';
const BACKENDS = supportedAuthBackends();
const { computed, inject, get } = Ember;
const DEFAULTS = {
token: null,
@ -11,12 +15,12 @@ const DEFAULTS = {
customPath: null,
};
export default Ember.Component.extend(DEFAULTS, {
router: inject.service(),
auth: inject.service(),
flashMessages: inject.service(),
store: inject.service(),
csp: inject.service('csp-event'),
export default Component.extend(DEFAULTS, {
router: service(),
auth: service(),
flashMessages: service(),
store: service(),
csp: service('csp-event'),
// set during init and potentially passed in via a query param
selectedAuth: null,
@ -24,6 +28,7 @@ export default Ember.Component.extend(DEFAULTS, {
cluster: null,
redirectTo: null,
namespace: null,
wrappedToken: null,
// internal
oldNamespace: null,
didReceiveAttrs() {
@ -50,30 +55,24 @@ export default Ember.Component.extend(DEFAULTS, {
didRender() {
this._super(...arguments);
let firstMethod = this.firstMethod();
// on very narrow viewports the active tab may be overflowed, so we scroll it into view here
let activeEle = this.element.querySelector('li.is-active');
if (activeEle) {
activeEle.scrollIntoView();
}
// this is here because we're changing the `with` attr and there's no way to short-circuit rendering,
// so we'll just nav -> get new attrs -> re-render
// set `with` to the first method
if (
(this.get('fetchMethods.isIdle') && !this.get('selectedAuth')) ||
(this.get('fetchMethods.isIdle') && firstMethod && !this.get('selectedAuth')) ||
(this.get('selectedAuth') && !this.get('selectedAuthBackend'))
) {
this.set('selectedAuth', this.firstMethod());
this.get('router').replaceWith({
queryParams: {
with: this.firstMethod(),
wrappedToken: this.get('wrappedToken'),
namespace: this.get('namespace'),
},
});
this.set('selectedAuth', firstMethod);
}
},
firstMethod() {
let firstMethod = this.get('methodsToShow.firstObject');
if (!firstMethod) return;
// prefer backends with a path over those with a type
return get(firstMethod, 'path') || get(firstMethod, 'type');
},
@ -82,34 +81,28 @@ export default Ember.Component.extend(DEFAULTS, {
this.setProperties(DEFAULTS);
},
selectedAuthIsPath: computed.match('selectedAuth', /\/$/),
selectedAuthBackend: Ember.computed(
'methods',
'methods.[]',
'selectedAuth',
'selectedAuthIsPath',
function() {
let methods = this.get('methods');
let selectedAuth = this.get('selectedAuth');
let keyIsPath = this.get('selectedAuthIsPath');
if (!methods) {
return {};
}
if (keyIsPath) {
return methods.findBy('path', selectedAuth);
}
return BACKENDS.findBy('type', selectedAuth);
selectedAuthIsPath: match('selectedAuth', /\/$/),
selectedAuthBackend: computed('methods', 'methods.[]', 'selectedAuth', 'selectedAuthIsPath', function() {
let methods = this.get('methods');
let selectedAuth = this.get('selectedAuth');
let keyIsPath = this.get('selectedAuthIsPath');
if (!methods) {
return {};
}
),
if (keyIsPath) {
return methods.findBy('path', selectedAuth);
}
return BACKENDS.findBy('type', selectedAuth);
}),
providerPartialName: computed('selectedAuthBackend', function() {
let type = this.get('selectedAuthBackend.type') || 'token';
type = type.toLowerCase();
let templateName = Ember.String.dasherize(type);
let templateName = dasherize(type);
return `partials/auth-form/${templateName}`;
}),
hasCSPError: computed.alias('csp.connectionViolations.firstObject'),
hasCSPError: alias('csp.connectionViolations.firstObject'),
cspErrorText: `This is a standby Vault node but can't communicate with the active node via request forwarding. Sign in at the active node to use the Vault UI.`,
@ -159,7 +152,7 @@ export default Ember.Component.extend(DEFAULTS, {
}
}),
showLoading: computed.or('fetchMethods.isRunning', 'unwrapToken.isRunning'),
showLoading: or('fetchMethods.isRunning', 'unwrapToken.isRunning'),
handleError(e) {
this.set('loading', false);
@ -186,25 +179,27 @@ export default Ember.Component.extend(DEFAULTS, {
);
let attributes = get(backendMeta || {}, 'formAttributes') || {};
data = Ember.assign(data, this.getProperties(...attributes));
data = assign(data, this.getProperties(...attributes));
if (this.get('customPath') || get(backend, 'id')) {
data.path = this.get('customPath') || get(backend, 'id');
}
const clusterId = this.get('cluster.id');
this.get('auth').authenticate({ clusterId, backend: get(backend, 'type'), data }).then(
({ isRoot, namespace }) => {
this.set('loading', false);
const transition = this.get('router').transitionTo(targetRoute, { queryParams: { namespace } });
if (isRoot) {
transition.followRedirects().then(() => {
this.get('flashMessages').warning(
'You have logged in with a root token. As a security precaution, this root token will not be stored by your browser and you will need to re-authenticate after the window is closed or refreshed.'
);
});
}
},
(...errArgs) => this.handleError(...errArgs)
);
this.get('auth')
.authenticate({ clusterId, backend: get(backend, 'type'), data })
.then(
({ isRoot, namespace }) => {
this.set('loading', false);
const transition = this.get('router').transitionTo(targetRoute, { queryParams: { namespace } });
if (isRoot) {
transition.followRedirects().then(() => {
this.get('flashMessages').warning(
'You have logged in with a root token. As a security precaution, this root token will not be stored by your browser and you will need to re-authenticate after the window is closed or refreshed.'
);
});
}
},
(...errArgs) => this.handleError(...errArgs)
);
},
},
});

View File

@ -1,19 +1,19 @@
import Ember from 'ember';
const { Component, inject, computed, run } = Ember;
import { inject as service } from '@ember/service';
import { or } from '@ember/object/computed';
import Component from '@ember/component';
import { run } from '@ember/runloop';
export default Component.extend({
auth: inject.service(),
wizard: inject.service(),
routing: inject.service('-routing'),
auth: service(),
wizard: service(),
router: service(),
transitionToRoute: function() {
var router = this.get('routing.router');
router.transitionTo.apply(router, arguments);
this.get('router').transitionTo(...arguments);
},
classNames: 'user-menu auth-info',
isRenewing: computed.or('fakeRenew', 'auth.isRenewing'),
isRenewing: or('fakeRenew', 'auth.isRenewing'),
actions: {
restartGuide() {
@ -28,9 +28,11 @@ export default Component.extend({
},
revokeToken() {
this.get('auth').revokeCurrentToken().then(() => {
this.transitionToRoute('vault.cluster.logout');
});
this.get('auth')
.revokeCurrentToken()
.then(() => {
this.transitionToRoute('vault.cluster.logout');
});
},
},
});

View File

@ -1,10 +1,12 @@
import Ember from 'ember';
import { equal } from '@ember/object/computed';
import { isBlank } from '@ember/utils';
import Component from '@ember/component';
import { set, get, computed } from '@ember/object';
import { encodeString, decodeString } from 'vault/utils/b64';
const { computed, get, set } = Ember;
const B64 = 'base64';
const UTF8 = 'utf-8';
export default Ember.Component.extend({
export default Component.extend({
tagName: 'button',
attributeBindings: ['type'],
type: 'button',
@ -72,7 +74,7 @@ export default Ember.Component.extend({
* @private
* @type boolean
*/
isBase64: computed.equal('currentEncoding', B64),
isBase64: equal('currentEncoding', B64),
/*
* Does the current value match the cached _value, i.e. has the input been mutated since we encoded.
@ -82,7 +84,7 @@ export default Ember.Component.extend({
*/
valuesMatch: computed('value', '_value', function() {
const { value, _value } = this.getProperties('value', '_value');
const anyBlank = Ember.isBlank(value) || Ember.isBlank(_value);
const anyBlank = isBlank(value) || isBlank(_value);
return !anyBlank && value === _value;
}),

View File

@ -1,11 +1,12 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { not } from '@ember/object/computed';
import Component from '@ember/component';
import { computed } from '@ember/object';
const { computed, inject } = Ember;
export default Ember.Component.extend({
export default Component.extend({
classNames: 'config-pki-ca',
store: inject.service('store'),
flashMessages: inject.service(),
store: service('store'),
flashMessages: service(),
/*
* @param boolean
@ -34,7 +35,7 @@ export default Ember.Component.extend({
*
* true when there's no CA cert currently configured
*/
needsConfig: computed.not('config.pem'),
needsConfig: not('config.pem'),
/*
* @param DS.Model
@ -62,7 +63,7 @@ export default Ember.Component.extend({
* function that gets called to refresh the config model
*
*/
onRefresh: () => {},
onRefresh() {},
loading: false,
@ -148,6 +149,9 @@ export default Ember.Component.extend({
);
}
})
.catch(() => {
// handle promise rejection - error will be shown by message-error component
})
.finally(() => {
this.set('loading', false);
});

View File

@ -1,10 +1,10 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { get } from '@ember/object';
const { get, inject } = Ember;
export default Ember.Component.extend({
export default Component.extend({
classNames: 'config-pki',
flashMessages: inject.service(),
flashMessages: service(),
/*
*
@ -32,7 +32,7 @@ export default Ember.Component.extend({
* function that gets called to refresh the config model
*
*/
onRefresh: () => {},
onRefresh() {},
loading: false,
@ -55,6 +55,9 @@ export default Ember.Component.extend({
}
this.send('refresh');
})
.catch(() => {
// handle promise rejection - error will be shown by message-error component
})
.finally(() => {
this.set('loading', false);
});

View File

@ -1,7 +1,7 @@
import Ember from 'ember';
import Component from '@ember/component';
import hbs from 'htmlbars-inline-precompile';
export default Ember.Component.extend({
export default Component.extend({
tagName: 'span',
classNames: ['confirm-action'],
layout: hbs`

View File

@ -1,7 +1,7 @@
import Ember from 'ember';
import Component from '@ember/component';
import keys from 'vault/lib/keycodes';
export default Ember.Component.extend({
export default Component.extend({
onExecuteCommand() {},
onFullscreen() {},
onValueUpdate() {},

View File

@ -1,3 +1,3 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({});
export default Component.extend({});

View File

@ -1,3 +1,3 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({});
export default Component.extend({});

View File

@ -1,3 +1,3 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({});
export default Component.extend({});

View File

@ -1,5 +1,5 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
'data-test-component': 'console/log-json',
});

View File

@ -1,7 +1,7 @@
import Ember from 'ember';
const { computed } = Ember;
import Component from '@ember/component';
import { computed } from '@ember/object';
export default Ember.Component.extend({
export default Component.extend({
content: null,
list: computed('content', function() {
return this.get('content').keys;

View File

@ -1,6 +1,7 @@
import Ember from 'ember';
import { capitalize } from '@ember/string';
import Component from '@ember/component';
import { computed } from '@ember/object';
import columnify from 'columnify';
const { computed } = Ember;
export function stringifyObjectValues(data) {
Object.keys(data).forEach(item => {
@ -12,7 +13,7 @@ export function stringifyObjectValues(data) {
});
}
export default Ember.Component.extend({
export default Component.extend({
content: null,
columns: computed('content', function() {
let data = this.get('content');
@ -21,7 +22,7 @@ export default Ember.Component.extend({
return columnify(data, {
preserveNewLines: true,
headingTransform: function(heading) {
return Ember.String.capitalize(heading);
return capitalize(heading);
},
});
}),

View File

@ -1,3 +1,3 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({});
export default Component.extend({});

View File

@ -1,5 +1,5 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
'data-test-component': 'console/log-text',
});

View File

@ -1,6 +1,6 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
'data-test-component': 'console/output-log',
log: null,
});

View File

@ -1,4 +1,8 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { alias, or } from '@ember/object/computed';
import Component from '@ember/component';
import { getOwner } from '@ember/application';
import { run } from '@ember/runloop';
import { task } from 'ember-concurrency';
import ControlGroupError from 'vault/lib/control-group-error';
import {
@ -10,19 +14,17 @@ import {
executeUICommand,
} from 'vault/lib/console-helpers';
const { inject, computed, getOwner, run } = Ember;
export default Ember.Component.extend({
console: inject.service(),
router: inject.service(),
controlGroup: inject.service(),
store: inject.service(),
export default Component.extend({
console: service(),
router: service(),
controlGroup: service(),
store: service(),
classNames: 'console-ui-panel-scroller',
classNameBindings: ['isFullscreen:fullscreen'],
isFullscreen: false,
inputValue: null,
log: computed.alias('console.log'),
log: alias('console.log'),
didRender() {
this._super(...arguments);
@ -34,7 +36,7 @@ export default Ember.Component.extend({
run.schedule('afterRender', () => this.scrollToBottom());
},
isRunning: computed.or('executeCommand.isRunning', 'refreshRoute.isRunning'),
isRunning: or('executeCommand.isRunning', 'refreshRoute.isRunning'),
executeCommand: task(function*(command, shouldThrow = false) {
this.set('inputValue', '');

View File

@ -1,12 +1,11 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
const { inject } = Ember;
export default Ember.Component.extend({
router: inject.service(),
controlGroup: inject.service(),
store: inject.service(),
export default Component.extend({
router: service(),
controlGroup: service(),
store: service(),
// public attrs
model: null,

View File

@ -1,12 +1,13 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { alias, or } from '@ember/object/computed';
import Component from '@ember/component';
import { computed, get } from '@ember/object';
import { task } from 'ember-concurrency';
const { get, computed, inject } = Ember;
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
auth: inject.service(),
controlGroup: inject.service(),
auth: service(),
controlGroup: service(),
// public API
model: null,
@ -18,7 +19,7 @@ export default Ember.Component.extend({
this.set('controlGroupResponse', data);
},
currentUserEntityId: computed.alias('auth.authData.entity_id'),
currentUserEntityId: alias('auth.authData.entity_id'),
currentUserIsRequesting: computed('currentUserEntityId', 'model.requestEntity.id', function() {
return this.get('currentUserEntityId') === this.get('model.requestEntity.id');
@ -29,7 +30,7 @@ export default Ember.Component.extend({
return Boolean(authorizations.findBy('id', this.get('currentUserEntityId')));
}),
isSuccess: computed.or('currentUserHasAuthorized', 'model.approved'),
isSuccess: or('currentUserHasAuthorized', 'model.approved'),
requestorName: computed('currentUserIsRequesting', 'model.requestEntity', function() {
let entity = this.get('model.requestEntity');

View File

@ -1,8 +1,7 @@
import Ember from 'ember';
import Component from '@ember/component';
import { computed } from '@ember/object';
import hbs from 'htmlbars-inline-precompile';
const { Component, computed } = Ember;
export default Component.extend({
tagName: 'a',
classNames: ['doc-link'],

View File

@ -1,9 +1,8 @@
import Ember from 'ember';
import Component from '@ember/component';
import { computed } from '@ember/object';
import hbs from 'htmlbars-inline-precompile';
const { computed } = Ember;
export default Ember.Component.extend({
export default Component.extend({
layout: hbs`{{#if hasBlock}} {{yield}} {{else}} {{actionText}} {{/if}}`,
tagName: 'a',
role: 'button',

View File

@ -1,10 +1,10 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
import DS from 'ember-data';
const { inject } = Ember;
export default Ember.Component.extend({
flashMessages: inject.service(),
export default Component.extend({
flashMessages: service(),
// public API
model: null,

View File

@ -1,10 +1,11 @@
import Ember from 'ember';
import { computed } from '@ember/object';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
tagName: 'span',
classNames: 'tag is-outlined edition-badge',
attributeBindings: ['edition:aria-label'],
icon: Ember.computed('edition', function() {
icon: computed('edition', function() {
const edition = this.get('edition');
const entEditions = ['Enterprise', 'Premium', 'Pro'];

View File

@ -1,8 +1,6 @@
import Ember from 'ember';
import { getWithDefault, computed } from '@ember/object';
import FlashMessage from 'ember-cli-flash/components/flash-message';
const { computed, getWithDefault } = Ember;
export default FlashMessage.extend({
// override alertType to get Bulma specific prefix
//https://github.com/poteto/ember-cli-flash/blob/master/addon/components/flash-message.js#L35

View File

@ -1,6 +1,6 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
classNames: 'column',
header: null,
content: null,

View File

@ -1,8 +1,7 @@
import Ember from 'ember';
import Component from '@ember/component';
import { computed } from '@ember/object';
const { computed } = Ember;
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
/*

View File

@ -1,10 +1,10 @@
import Ember from 'ember';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { capitalize } from 'vault/helpers/capitalize';
import { humanize } from 'vault/helpers/humanize';
import { dasherize } from 'vault/helpers/dasherize';
const { computed } = Ember;
export default Ember.Component.extend({
export default Component.extend({
'data-test-field': true,
classNames: ['field'],
@ -42,7 +42,7 @@ export default Ember.Component.extend({
* Computed property used in the label element next to the form element
*
*/
labelString: computed('attr.name', 'attr.options.label', function() {
labelString: computed('attr.{name,options.label}', function() {
const label = this.get('attr.options.label');
const name = this.get('attr.name');
if (label) {
@ -61,7 +61,7 @@ export default Ember.Component.extend({
* Computed property used to set values on the passed model
*
*/
valuePath: computed('attr.name', 'attr.options.fieldValue', function() {
valuePath: computed('attr.{name,options.fieldValue}', function() {
return this.get('attr.options.fieldValue') || this.get('attr.name');
}),
@ -80,7 +80,9 @@ export default Ember.Component.extend({
*
* Used by the pgp-file component when an attr is editType of 'file'
*/
file: { value: '' },
file: computed(function() {
return { value: '' };
}),
emptyData: '{\n}',
actions: {

View File

@ -1,6 +1,6 @@
import Ember from 'ember';
const { get, set, computed, Component, inject } = Ember;
import { inject as service } from '@ember/service';
import { computed, set } from '@ember/object';
import Component from '@ember/component';
const MODEL_TYPES = {
'ssh-sign': {
@ -26,13 +26,14 @@ const MODEL_TYPES = {
};
export default Component.extend({
wizard: inject.service(),
store: inject.service(),
routing: inject.service('-routing'),
wizard: service(),
store: service(),
router: service(),
// set on the component
backend: null,
backendType: null,
backendPath: null,
roleName: null,
action: null,
role: null,
model: null,
loading: false,
@ -44,13 +45,12 @@ export default Component.extend({
return type.model;
}
// if we don't have a mode for that type then redirect them back to the backend list
const router = this.get('routing.router');
router.transitionTo.call(router, 'vault.cluster.secrets.backend.list-root', this.get('model.backend'));
this.get('router').transitionTo('vault.cluster.secrets.backend.list-root', this.get('backendPath'));
},
options: computed('action', 'backend.type', function() {
options: computed('action', 'backendType', function() {
const action = this.get('action') || 'creds';
return MODEL_TYPES[`${this.get('backend.type')}-${action}`];
return MODEL_TYPES[`${this.get('backendType')}-${action}`];
}),
init() {
@ -63,7 +63,7 @@ export default Component.extend({
this.get('wizard').transitionFeatureMachine(
this.get('wizard.featureState'),
'CONTINUE',
this.get('backend.type')
this.get('backendType')
);
}
},
@ -76,7 +76,8 @@ export default Component.extend({
createOrReplaceModel() {
const modelType = this.modelForType();
const model = this.get('model');
const roleModel = this.get('role');
const roleName = this.get('roleName');
const backendPath = this.get('backendPath');
if (!modelType) {
return;
}
@ -84,8 +85,11 @@ export default Component.extend({
model.unloadRecord();
}
const attrs = {
role: roleModel,
id: `${get(roleModel, 'backend')}-${get(roleModel, 'name')}`,
role: {
backend: backendPath,
name: roleName,
},
id: `${backendPath}-${roleName}`,
};
const newModel = this.get('store').createRecord(modelType, attrs);
this.set('model', newModel);
@ -102,7 +106,7 @@ export default Component.extend({
this.get('wizard').transitionFeatureMachine(
this.get('wizard.featureState'),
'ERROR',
this.get('backend.type')
this.get('backendType')
);
}
})

View File

@ -1,6 +1,5 @@
import Ember from 'ember';
const { Component, computed } = Ember;
import Component from '@ember/component';
import { computed } from '@ember/object';
export default Component.extend({
tagName: '',

View File

@ -1,6 +1,6 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
'data-test-hover-copy': true,
classNameBindings: 'alwaysShow:hover-copy-button-static:hover-copy-button',
copyValue: null,

View File

@ -1,7 +1,8 @@
import Ember from 'ember';
import { camelize } from '@ember/string';
import Component from '@ember/component';
import { computed } from '@ember/object';
import hbs from 'htmlbars-inline-precompile';
const { computed } = Ember;
const GLYPHS_WITH_SVG_TAG = [
'learn',
'video',
@ -23,7 +24,7 @@ const GLYPHS_WITH_SVG_TAG = [
'edition-oss',
];
export default Ember.Component.extend({
export default Component.extend({
layout: hbs`
{{#if excludeSVG}}
{{partial partialName}}
@ -54,6 +55,6 @@ export default Ember.Component.extend({
partialName: computed('glyph', function() {
const glyph = this.get('glyph');
return `svg/icons/${Ember.String.camelize(glyph)}`;
return `svg/icons/${camelize(glyph)}`;
}),
});

View File

@ -1,9 +1,10 @@
import Ember from 'ember';
const { assert, inject, Component } = Ember;
import { inject as service } from '@ember/service';
import { assert } from '@ember/debug';
import Component from '@ember/component';
export default Component.extend({
tagName: '',
flashMessages: inject.service(),
flashMessages: service(),
params: null,
successMessage() {
return 'Save was successful';

View File

@ -1,10 +1,11 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { task } from 'ember-concurrency';
import { humanize } from 'vault/helpers/humanize';
const { computed, inject } = Ember;
export default Ember.Component.extend({
flashMessages: inject.service(),
export default Component.extend({
flashMessages: service(),
'data-test-component': 'identity-edit-form',
model: null,

View File

@ -1,9 +1,8 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
const { inject } = Ember;
export default Ember.Component.extend({
flashMessages: inject.service(),
export default Component.extend({
flashMessages: service(),
actions: {
enable(model) {

View File

@ -1,13 +1,12 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
import { underscore } from 'vault/helpers/underscore';
const { inject } = Ember;
export default Ember.Component.extend({
store: inject.service(),
flashMessages: inject.service(),
routing: inject.service('-routing'),
export default Component.extend({
store: service(),
flashMessages: service(),
router: service(),
// Public API - either 'entity' or 'group'
// this will determine which adapter is used to make the lookup call
@ -21,10 +20,12 @@ export default Ember.Component.extend({
init() {
this._super(...arguments);
this.get('store').findAll('auth-method').then(methods => {
this.set('authMethods', methods);
this.set('aliasMountAccessor', methods.get('firstObject.accessor'));
});
this.get('store')
.findAll('auth-method')
.then(methods => {
this.set('authMethods', methods);
this.set('aliasMountAccessor', methods.get('firstObject.accessor'));
});
},
adapter() {
@ -63,11 +64,7 @@ export default Ember.Component.extend({
return;
}
if (response) {
return this.get('routing.router').transitionTo(
'vault.cluster.access.identity.show',
response.id,
'details'
);
return this.get('router').transitionTo('vault.cluster.access.identity.show', response.id, 'details');
} else {
flash.danger(`We were unable to find an identity ${type} with a "${param}" of "${paramValue}".`);
}

View File

@ -1,9 +1,9 @@
import { alias } from '@ember/object/computed';
import { computed } from '@ember/object';
import Base from './_popup-base';
import Ember from 'ember';
const { computed } = Ember;
export default Base.extend({
model: computed.alias('params.firstObject'),
model: alias('params.firstObject'),
groupArray: computed('params', function() {
return this.get('params').objectAt(1);

View File

@ -1,9 +1,9 @@
import { alias } from '@ember/object/computed';
import { computed } from '@ember/object';
import Base from './_popup-base';
import Ember from 'ember';
const { computed } = Ember;
export default Base.extend({
model: computed.alias('params.firstObject'),
model: alias('params.firstObject'),
policyName: computed('params', function() {
return this.get('params').objectAt(1);
}),

View File

@ -1,9 +1,12 @@
import Ember from 'ember';
import { typeOf } from '@ember/utils';
import { computed } from '@ember/object';
import { or } from '@ember/object/computed';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
'data-test-component': 'info-table-row',
classNames: ['info-table-row'],
isVisible: Ember.computed.or('alwaysRender', 'value'),
isVisible: or('alwaysRender', 'value'),
/*
* @param boolean
@ -25,7 +28,7 @@ export default Ember.Component.extend({
*/
value: null,
valueIsBoolean: Ember.computed('value', function() {
return Ember.typeOf(this.get('value')) === 'boolean';
valueIsBoolean: computed('value', function() {
return typeOf(this.get('value')) === 'boolean';
}),
});

View File

@ -1,6 +1,6 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
'data-test-component': 'info-tooltip',
tagName: 'span',
classNames: ['is-inline-block'],

View File

@ -1,7 +1,5 @@
import { assign } from '@ember/polyfills';
import IvyCodemirrorComponent from './ivy-codemirror';
import Ember from 'ember';
const { assign } = Ember;
const JSON_EDITOR_DEFAULTS = {
// IMPORTANT: `gutters` must come before `lint` since the presence of
// `gutters` is cached internally when `lint` is toggled

View File

@ -1,7 +1,8 @@
import Ember from 'ember';
import { computed } from '@ember/object';
import Component from '@ember/component';
import utils from 'vault/lib/key-utils';
export default Ember.Component.extend({
export default Component.extend({
tagName: 'nav',
classNames: 'key-value-header breadcrumb',
ariaLabel: 'breadcrumbs',
@ -16,7 +17,7 @@ export default Ember.Component.extend({
return str[str.length - 1] === '/' ? str.slice(0, -1) : str;
},
currentPath: Ember.computed('mode', 'path', 'showCurrent', function() {
currentPath: computed('mode', 'path', 'showCurrent', function() {
const mode = this.get('mode');
const path = this.get('path');
const showCurrent = this.get('showCurrent');
@ -26,7 +27,7 @@ export default Ember.Component.extend({
return `vault.cluster.secrets.backend.${mode}`;
}),
secretPath: Ember.computed('baseKey', 'baseKey.display', 'baseKey.id', 'root', 'showCurrent', function() {
secretPath: computed('baseKey', 'baseKey.{display,id}', 'root', 'showCurrent', function() {
let crumbs = [];
const root = this.get('root');
const baseKey = this.get('baseKey.display') || this.get('baseKey.id');

View File

@ -1,5 +1,5 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
});

View File

@ -1,8 +1,10 @@
import Ember from 'ember';
import { isNone } from '@ember/utils';
import { assert } from '@ember/debug';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { guidFor } from '@ember/object/internals';
import KVObject from 'vault/lib/kv-object';
const { assert, Component, computed, guidFor } = Ember;
export default Component.extend({
'data-test-component': 'kv-object-editor',
classNames: ['field', 'form-section'],
@ -39,7 +41,7 @@ export default Component.extend({
addRow() {
let data = this.get('kvData');
let newObj = { name: '', value: '' };
if (!Ember.isNone(data.findBy('name', ''))) {
if (!isNone(data.findBy('name', ''))) {
return;
}
guidFor(newObj);

View File

@ -1,7 +1,7 @@
import Ember from 'ember';
import LinkComponent from '@ember/routing/link-component';
Ember.LinkComponent.reopen({
LinkComponent.reopen({
activeClass: 'is-active',
});
export default Ember.LinkComponent;
export default LinkComponent;

View File

@ -1,12 +1,14 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import hbs from 'htmlbars-inline-precompile';
let LinkedBlockComponent = Ember.Component.extend({
let LinkedBlockComponent = Component.extend({
router: service(),
layout: hbs`{{yield}}`,
classNames: 'linked-block',
routing: Ember.inject.service('-routing'),
queryParams: null,
click(event) {
@ -17,13 +19,12 @@ let LinkedBlockComponent = Ember.Component.extend({
$target.closest('button', event.currentTarget).length > 0 ||
$target.closest('a', event.currentTarget).length > 0;
if (!isAnchorOrButton) {
const router = this.get('routing.router');
const params = this.get('params');
const queryParams = this.get('queryParams');
if (queryParams) {
params.push({ queryParams });
}
router.transitionTo.apply(router, params);
this.get('router').transitionTo(...params);
}
},
});

View File

@ -1,9 +1,9 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
const { inject } = Ember;
export default Ember.Component.extend({
flashMessages: inject.service(),
export default Component.extend({
flashMessages: service(),
tagName: '',
linkParams: null,
componentName: null,

View File

@ -1,5 +1,5 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
});

View File

@ -1,5 +1,5 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
});

View File

@ -1,9 +1,9 @@
import Ember from 'ember';
import { gt } from '@ember/object/computed';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { range } from 'ember-composable-helpers/helpers/range';
const { computed } = Ember;
export default Ember.Component.extend({
export default Component.extend({
classNames: ['box', 'is-shadowless', 'list-pagination'],
page: null,
lastPage: null,
@ -18,7 +18,7 @@ export default Ember.Component.extend({
return this.get('page') > 1;
}),
segmentLinks: computed.gt('lastPage', 10),
segmentLinks: gt('lastPage', 10),
pageRange: computed('page', 'lastPage', function() {
const { spread, page, lastPage } = this.getProperties('spread', 'page', 'lastPage');

View File

@ -1,8 +1,8 @@
import Ember from 'ember';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { pluralize } from 'ember-inflector';
const { computed } = Ember;
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
items: null,
itemNoun: 'item',

View File

@ -1,8 +1,7 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
const { inject } = Ember;
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
version: inject.service(),
version: service(),
});

View File

@ -1,51 +1,49 @@
import Ember from 'ember';
const { computed } = Ember;
import Component from '@ember/component';
import { computed } from '@ember/object';
import autosize from 'autosize';
export default Ember.Component.extend({
value: null,
didInsertElement(){
this._super(...arguments);
autosize(this.element.querySelector('textarea'));
},
didUpdate(){
this._super(...arguments);
autosize.update(this.element.querySelector('textarea'));
},
willDestroyElement(){
this._super(...arguments);
autosize.destroy(this.element.querySelector('textarea'));
},
shouldObscure: computed("isMasked", "isFocused", "value", function(){
if(this.get('value') === "" ){
return false;
}
if(this.get('isFocused') === true){
return false;
}
return this.get('isMasked');
}),
displayValue: computed("shouldObscure", function(){
if(this.get("shouldObscure")){
return "■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■";
}
else{
return this.get('value');
}
}),
isMasked: true,
isFocused: false,
displayOnly: false,
onKeyDown(){},
onChange(){},
actions: {
toggleMask(){
this.toggleProperty('isMasked');
},
updateValue(e){
this.set('value', e.target.value);
this.onChange();
},
}
export default Component.extend({
value: null,
didInsertElement() {
this._super(...arguments);
autosize(this.element.querySelector('textarea'));
},
didUpdate() {
this._super(...arguments);
autosize.update(this.element.querySelector('textarea'));
},
willDestroyElement() {
this._super(...arguments);
autosize.destroy(this.element.querySelector('textarea'));
},
shouldObscure: computed('isMasked', 'isFocused', 'value', function() {
if (this.get('value') === '') {
return false;
}
if (this.get('isFocused') === true) {
return false;
}
return this.get('isMasked');
}),
displayValue: computed('shouldObscure', function() {
if (this.get('shouldObscure')) {
return '■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■';
} else {
return this.get('value');
}
}),
isMasked: true,
isFocused: false,
displayOnly: false,
onKeyDown() {},
onChange() {},
actions: {
toggleMask() {
this.toggleProperty('isMasked');
},
updateValue(e) {
this.set('value', e.target.value);
this.onChange();
},
},
});

View File

@ -1,6 +1,6 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
classNames: ['column', 'is-sidebar'],
classNameBindings: ['isActive:is-active'],
isActive: false,

View File

@ -1,15 +1,16 @@
import Ember from 'ember';
import { computed } from '@ember/object';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
model: null,
errors: [],
errors: computed(function() {
return [];
}),
errorMessage: null,
displayErrors: Ember.computed(
displayErrors: computed(
'errorMessage',
'model.isError',
'model.adapterError.message',
'model.adapterError.errors.@each',
'model.{isError,adapterError.message,adapterError.errors.@each}',
'errors',
'errors.@each',
function() {

View File

@ -1,9 +1,9 @@
import Ember from 'ember';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { messageTypes } from 'vault/helpers/message-types';
const { computed } = Ember;
export default Ember.Component.extend({
export default Component.extend({
type: null,
yieldWithoutColumn: false,

View File

@ -1,10 +1,9 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
const { inject } = Ember;
export default Ember.Component.extend({
store: inject.service(),
export default Component.extend({
store: service(),
// Public API
//value for the external mount selector

View File

@ -1,17 +1,17 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
import { methods } from 'vault/helpers/mountable-auth-methods';
import { engines } from 'vault/helpers/mountable-secret-engines';
const { inject, computed, Component } = Ember;
const METHODS = methods();
const ENGINES = engines();
export default Component.extend({
store: inject.service(),
wizard: inject.service(),
flashMessages: inject.service(),
routing: inject.service('-routing'),
store: service(),
wizard: service(),
flashMessages: service(),
/*
* @param Function
@ -20,8 +20,8 @@ export default Component.extend({
* Optional param to call a function upon successfully mounting a backend
*
*/
onMountSuccess: () => {},
onConfigError: () => {},
onMountSuccess() {},
onConfigError() {},
/*
* @param String
* @public
@ -81,7 +81,7 @@ export default Component.extend({
return;
}
let configRef = mount.hasMany('authConfigs').value();
let currentConfig = configRef.get('firstObject');
let currentConfig = configRef && configRef.get('firstObject');
if (currentConfig) {
// rollbackAttributes here will remove the the config model from the store
// because `isNew` will be true
@ -125,18 +125,26 @@ export default Component.extend({
yield this.get('saveConfig').perform(mountModel);
}).drop(),
advanceWizard() {
this.get('wizard').transitionFeatureMachine(
this.get('wizard.featureState'),
'CONTINUE',
this.get('mountModel').get('type')
);
},
saveConfig: task(function*(mountModel) {
const configRef = mountModel.hasMany('authConfigs').value();
const config = configRef.get('firstObject');
const { type, path } = mountModel.getProperties('type', 'path');
if (!configRef) {
this.advanceWizard();
yield this.get('onMountSuccess')(type, path);
return;
}
const config = configRef.get('firstObject');
try {
if (config && Object.keys(config.changedAttributes()).length) {
yield config.save();
this.get('wizard').transitionFeatureMachine(
this.get('wizard.featureState'),
'CONTINUE',
this.get('mountModel').get('type')
);
this.advanceWizard();
this.get('flashMessages').success(
`The config for ${type} ${this.get('mountType')} method at ${path} was saved successfully.`
);

View File

@ -1,13 +1,14 @@
import Ember from 'ember';
import Component from '@ember/component';
import { set, get, computed } from '@ember/object';
const { get, set } = Ember;
export default Ember.Component.extend({
export default Component.extend({
config: null,
mounts: null,
// singleton mounts are not eligible for per-mount-filtering
singletonMountTypes: ['cubbyhole', 'system', 'token', 'identity', 'ns_system', 'ns_identity'],
singletonMountTypes: computed(function() {
return ['cubbyhole', 'system', 'token', 'identity', 'ns_system', 'ns_identity'];
}),
actions: {
addOrRemovePath(path, e) {

View File

@ -1,10 +1,11 @@
import Ember from 'ember';
const { Component, computed, inject } = Ember;
import { inject as service } from '@ember/service';
import { alias } from '@ember/object/computed';
import Component from '@ember/component';
import { computed } from '@ember/object';
export default Component.extend({
namespaceService: inject.service('namespace'),
currentNamespace: computed.alias('namespaceService.path'),
namespaceService: service('namespace'),
currentNamespace: alias('namespaceService.path'),
tagName: '',
//public api

View File

@ -1,17 +1,19 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { alias, gt } from '@ember/object/computed';
import Component from '@ember/component';
import { computed } from '@ember/object';
import keyUtils from 'vault/lib/key-utils';
import pathToTree from 'vault/lib/path-to-tree';
import { task, timeout } from 'ember-concurrency';
const { ancestorKeysForKey } = keyUtils;
const { Component, computed, inject } = Ember;
const DOT_REPLACEMENT = '☃';
const ANIMATION_DURATION = 250;
export default Component.extend({
tagName: '',
namespaceService: inject.service('namespace'),
auth: inject.service(),
namespaceService: service('namespace'),
auth: service(),
namespace: null,
init() {
@ -55,14 +57,14 @@ export default Component.extend({
this.set('lastMenuLeaves', leaves);
}).drop(),
isAnimating: computed.alias('setForAnimation.isRunning'),
isAnimating: alias('setForAnimation.isRunning'),
namespacePath: computed.alias('namespaceService.path'),
namespacePath: alias('namespaceService.path'),
// this is an array of namespace paths that the current user
// has access to
accessibleNamespaces: computed.alias('namespaceService.accessibleNamespaces'),
inRootNamespace: computed.alias('namespaceService.inRootNamespace'),
accessibleNamespaces: alias('namespaceService.accessibleNamespaces'),
inRootNamespace: alias('namespaceService.inRootNamespace'),
namespaceTree: computed('accessibleNamespaces', function() {
let nsList = this.get('accessibleNamespaces');
@ -124,8 +126,8 @@ export default Component.extend({
return leaves;
}),
currentLeaf: computed.alias('lastMenuLeaves.lastObject'),
canAccessMultipleNamespaces: computed.gt('accessibleNamespaces.length', 1),
currentLeaf: alias('lastMenuLeaves.lastObject'),
canAccessMultipleNamespaces: gt('accessibleNamespaces.length', 1),
isUserRootNamespace: computed('auth.authData.userRootNamespace', 'namespacePath', function() {
return this.get('auth.authData.userRootNamespace') === this.get('namespacePath');
}),

View File

@ -1,10 +1,11 @@
import Ember from 'ember';
const { Component, inject, computed } = Ember;
import { inject as service } from '@ember/service';
import { not } from '@ember/object/computed';
import Component from '@ember/component';
import { computed } from '@ember/object';
export default Component.extend({
namespace: inject.service(),
showMessage: computed.not('namespace.inRootNamespace'),
namespace: service(),
showMessage: not('namespace.inRootNamespace'),
//public API
noun: null,
mode: 'edit',

View File

@ -1,6 +1,6 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
'data-test-navheader': true,
tagName: 'header',
});

View File

@ -1,5 +1,5 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
});

View File

@ -1,5 +1,5 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
});

View File

@ -1,5 +1,5 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
});

View File

@ -1,4 +1,7 @@
import Ember from 'ember';
import { schedule, debounce } from '@ember/runloop';
import { observer } from '@ember/object';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import utils from 'vault/lib/key-utils';
import keys from 'vault/lib/keycodes';
import FocusOnInsertMixin from 'vault/mixins/focus-on-insert';
@ -22,7 +25,9 @@ const routeFor = function(type, mode) {
return useSuffix ? modeVal + '.' + typeVal : modeVal;
};
export default Ember.Component.extend(FocusOnInsertMixin, {
export default Component.extend(FocusOnInsertMixin, {
router: service(),
classNames: ['navigate-filter'],
// these get passed in from the outside
@ -38,18 +43,15 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
filterMatchesKey: null,
firstPartialMatch: null,
routing: Ember.inject.service('-routing'),
transitionToRoute: function() {
var router = this.get('routing.router');
router.transitionTo.apply(router, arguments);
this.get('router').transitionTo(...arguments);
},
shouldFocus: false,
focusFilter: Ember.observer('filter', function() {
focusFilter: observer('filter', function() {
if (!this.get('filter')) return;
Ember.run.schedule('afterRender', this, 'forceFocus');
schedule('afterRender', this, 'forceFocus');
}).on('didInsertElement'),
keyForNav(key) {
@ -164,7 +166,7 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
handleInput: function(event) {
var filter = event.target.value;
this.get('filterDidChange')(filter);
Ember.run.debounce(this, 'filterUpdated', filter, 200);
debounce(this, 'filterUpdated', filter, 200);
},
setFilterFocused: function(isFocused) {

View File

@ -1,12 +1,12 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { alias } from '@ember/object/computed';
import Component from '@ember/component';
const { computed, inject } = Ember;
export default Ember.Component.extend({
export default Component.extend({
// public
model: null,
tagName: '',
routing: inject.service('-routing'),
path: computed.alias('routing.router.currentURL'),
router: service(),
path: alias('router.currentURL'),
});

View File

@ -1,9 +1,9 @@
// THIS COMPONENT IS ONLY FOR EXTENDING
// You should use this component if you want to use outerHTML symantics
// in your components - this is the default for upcoming Glimmer components
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
});

View File

@ -1,5 +1,5 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
});

View File

@ -1,5 +1,5 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
});

View File

@ -1,5 +1,5 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
});

View File

@ -1,6 +1,6 @@
import Ember from 'ember';
import Component from '@ember/component';
export default Ember.Component.extend({
export default Component.extend({
tagName: '',
hasLevel: true,
});

View File

@ -1,9 +1,8 @@
import Ember from 'ember';
const { set } = Ember;
import Component from '@ember/component';
import { set } from '@ember/object';
const BASE_64_REGEX = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gi;
export default Ember.Component.extend({
export default Component.extend({
classNames: ['box', 'is-fullwidth', 'is-marginless', 'is-shadowless'],
key: null,
index: null,

Some files were not shown because too many files have changed in this diff Show More