diff --git a/.travis.yml b/.travis.yml
index 045f3d8d1..27c725f94 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -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:
diff --git a/ui/.editorconfig b/ui/.editorconfig
index 219985c22..e37fb8f67 100644
--- a/ui/.editorconfig
+++ b/ui/.editorconfig
@@ -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
diff --git a/ui/.eslintignore b/ui/.eslintignore
new file mode 100644
index 000000000..6437276cc
--- /dev/null
+++ b/ui/.eslintignore
@@ -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
diff --git a/ui/.eslintrc.js b/ui/.eslintrc.js
index f8549e8bb..ea6c16123 100644
--- a/ui/.eslintrc.js
+++ b/ui/.eslintrc.js
@@ -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,
+ },
+ },
+ ],
};
diff --git a/ui/.gitignore b/ui/.gitignore
index 8fa39a63c..29c9bc65a 100644
--- a/ui/.gitignore
+++ b/ui/.gitignore
@@ -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
diff --git a/ui/.template-lintrc.js b/ui/.template-lintrc.js
new file mode 100644
index 000000000..dede57c2c
--- /dev/null
+++ b/ui/.template-lintrc.js
@@ -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,
+ },
+};
diff --git a/ui/.travis.yml b/ui/.travis.yml
deleted file mode 100644
index d98801699..000000000
--- a/ui/.travis.yml
+++ /dev/null
@@ -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
diff --git a/ui/README.md b/ui/README.md
index 36e562dd1..97ba60b37 100644
--- a/ui/README.md
+++ b/ui/README.md
@@ -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.
diff --git a/ui/app/adapters/application.js b/ui/app/adapters/application.js
index eec635537..caa4d1f77 100644
--- a/ui/app/adapters/application.js
+++ b/ui/app/adapters/application.js
@@ -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',
diff --git a/ui/app/adapters/auth-method.js b/ui/app/adapters/auth-method.js
index 5f36329df..759d3a96b 100644
--- a/ui/app/adapters/auth-method.js
+++ b/ui/app/adapters/auth-method.js
@@ -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 }),
};
});
},
diff --git a/ui/app/adapters/capabilities.js b/ui/app/adapters/capabilities.js
index ffdc51aae..f966cb544 100644
--- a/ui/app/adapters/capabilities.js
+++ b/ui/app/adapters/capabilities.js
@@ -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;
});
diff --git a/ui/app/adapters/cluster.js b/ui/app/adapters/cluster.js
index 97d2f2105..ac5ff7bd3 100644
--- a/ui/app/adapters/cluster.js
+++ b/ui/app/adapters/cluster.js
@@ -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() {
diff --git a/ui/app/adapters/pki-ca-certificate.js b/ui/app/adapters/pki-ca-certificate.js
index f9910220a..187631f69 100644
--- a/ui/app/adapters/pki-ca-certificate.js
+++ b/ui/app/adapters/pki-ca-certificate.js
@@ -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;
diff --git a/ui/app/adapters/pki-certificate.js b/ui/app/adapters/pki-certificate.js
index 8ec9553b2..942d2610b 100644
--- a/ui/app/adapters/pki-certificate.js
+++ b/ui/app/adapters/pki-certificate.js
@@ -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);
});
},
});
diff --git a/ui/app/adapters/pki-config.js b/ui/app/adapters/pki-config.js
index 86ae8ae6c..c6bc8abf4 100644
--- a/ui/app/adapters/pki-config.js
+++ b/ui/app/adapters/pki-config.js
@@ -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) {
diff --git a/ui/app/adapters/pki.js b/ui/app/adapters/pki.js
index bcebb8273..7972bfd16 100644
--- a/ui/app/adapters/pki.js
+++ b/ui/app/adapters/pki.js
@@ -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) {
diff --git a/ui/app/adapters/policy.js b/ui/app/adapters/policy.js
index 5846e31d9..7d86987b1 100644
--- a/ui/app/adapters/policy.js
+++ b/ui/app/adapters/policy.js
@@ -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 }),
};
});
},
diff --git a/ui/app/adapters/role-aws.js b/ui/app/adapters/role-aws.js
index 67f50ef77..cd3b330bf 100644
--- a/ui/app/adapters/role-aws.js
+++ b/ui/app/adapters/role-aws.js
@@ -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);
});
},
diff --git a/ui/app/adapters/role-pki.js b/ui/app/adapters/role-pki.js
index 67f50ef77..cd3b330bf 100644
--- a/ui/app/adapters/role-pki.js
+++ b/ui/app/adapters/role-pki.js
@@ -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);
});
},
diff --git a/ui/app/adapters/role-ssh.js b/ui/app/adapters/role-ssh.js
index 6f33ec4d3..c41c3f40b 100644
--- a/ui/app/adapters/role-ssh.js
+++ b/ui/app/adapters/role-ssh.js
@@ -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);
}
}
});
diff --git a/ui/app/adapters/secret-engine.js b/ui/app/adapters/secret-engine.js
index 9f4021931..229015474 100644
--- a/ui/app/adapters/secret-engine.js
+++ b/ui/app/adapters/secret-engine.js
@@ -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 }),
};
});
},
diff --git a/ui/app/adapters/secret-v2.js b/ui/app/adapters/secret-v2.js
index 158ccb6d2..d76fb2438 100644
--- a/ui/app/adapters/secret-v2.js
+++ b/ui/app/adapters/secret-v2.js
@@ -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;
diff --git a/ui/app/adapters/secret.js b/ui/app/adapters/secret.js
index 82e652817..30721e95f 100644
--- a/ui/app/adapters/secret.js
+++ b/ui/app/adapters/secret.js
@@ -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;
}
diff --git a/ui/app/adapters/ssh.js b/ui/app/adapters/ssh.js
index d275a43e6..5c3784ab6 100644
--- a/ui/app/adapters/ssh.js
+++ b/ui/app/adapters/ssh.js
@@ -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) {
diff --git a/ui/app/adapters/transit-key.js b/ui/app/adapters/transit-key.js
index 520595300..876c0096a 100644
--- a/ui/app/adapters/transit-key.js
+++ b/ui/app/adapters/transit-key.js
@@ -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;
diff --git a/ui/app/app.js b/ui/app/app.js
index dde117785..7d6bae3ce 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -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,
diff --git a/ui/app/components/auth-config-form/config.js b/ui/app/components/auth-config-form/config.js
index 8dee9b840..31fd4ac0b 100644
--- a/ui/app/components/auth-config-form/config.js
+++ b/ui/app/components/auth-config-form/config.js
@@ -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 {
diff --git a/ui/app/components/auth-form.js b/ui/app/components/auth-form.js
index 7f9fcb5a2..ff2164030 100644
--- a/ui/app/components/auth-form.js
+++ b/ui/app/components/auth-form.js
@@ -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)
+ );
},
},
});
diff --git a/ui/app/components/auth-info.js b/ui/app/components/auth-info.js
index 50e9b3c49..d9127feac 100644
--- a/ui/app/components/auth-info.js
+++ b/ui/app/components/auth-info.js
@@ -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');
+ });
},
},
});
diff --git a/ui/app/components/b64-toggle.js b/ui/app/components/b64-toggle.js
index a84995e84..6013f266d 100644
--- a/ui/app/components/b64-toggle.js
+++ b/ui/app/components/b64-toggle.js
@@ -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;
}),
diff --git a/ui/app/components/config-pki-ca.js b/ui/app/components/config-pki-ca.js
index 6eed7d2da..7c4c63e86 100644
--- a/ui/app/components/config-pki-ca.js
+++ b/ui/app/components/config-pki-ca.js
@@ -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);
});
diff --git a/ui/app/components/config-pki.js b/ui/app/components/config-pki.js
index dd3a2165b..e0893994f 100644
--- a/ui/app/components/config-pki.js
+++ b/ui/app/components/config-pki.js
@@ -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);
});
diff --git a/ui/app/components/confirm-action.js b/ui/app/components/confirm-action.js
index d3532584d..f36c613fc 100644
--- a/ui/app/components/confirm-action.js
+++ b/ui/app/components/confirm-action.js
@@ -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`
diff --git a/ui/app/components/console/command-input.js b/ui/app/components/console/command-input.js
index 3e9d59a5e..228122fe6 100644
--- a/ui/app/components/console/command-input.js
+++ b/ui/app/components/console/command-input.js
@@ -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() {},
diff --git a/ui/app/components/console/log-command.js b/ui/app/components/console/log-command.js
index 6e705e676..557064773 100644
--- a/ui/app/components/console/log-command.js
+++ b/ui/app/components/console/log-command.js
@@ -1,3 +1,3 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({});
+export default Component.extend({});
diff --git a/ui/app/components/console/log-error.js b/ui/app/components/console/log-error.js
index 6e705e676..557064773 100644
--- a/ui/app/components/console/log-error.js
+++ b/ui/app/components/console/log-error.js
@@ -1,3 +1,3 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({});
+export default Component.extend({});
diff --git a/ui/app/components/console/log-help.js b/ui/app/components/console/log-help.js
index 6e705e676..557064773 100644
--- a/ui/app/components/console/log-help.js
+++ b/ui/app/components/console/log-help.js
@@ -1,3 +1,3 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({});
+export default Component.extend({});
diff --git a/ui/app/components/console/log-json.js b/ui/app/components/console/log-json.js
index 2d97144cd..2eef304e8 100644
--- a/ui/app/components/console/log-json.js
+++ b/ui/app/components/console/log-json.js
@@ -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',
});
diff --git a/ui/app/components/console/log-list.js b/ui/app/components/console/log-list.js
index fcca15f27..8da580793 100644
--- a/ui/app/components/console/log-list.js
+++ b/ui/app/components/console/log-list.js
@@ -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;
diff --git a/ui/app/components/console/log-object.js b/ui/app/components/console/log-object.js
index 275f1edb7..d59ed8e9b 100644
--- a/ui/app/components/console/log-object.js
+++ b/ui/app/components/console/log-object.js
@@ -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);
},
});
}),
diff --git a/ui/app/components/console/log-success.js b/ui/app/components/console/log-success.js
index 6e705e676..557064773 100644
--- a/ui/app/components/console/log-success.js
+++ b/ui/app/components/console/log-success.js
@@ -1,3 +1,3 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({});
+export default Component.extend({});
diff --git a/ui/app/components/console/log-text.js b/ui/app/components/console/log-text.js
index b51ce621b..227e2c872 100644
--- a/ui/app/components/console/log-text.js
+++ b/ui/app/components/console/log-text.js
@@ -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',
});
diff --git a/ui/app/components/console/output-log.js b/ui/app/components/console/output-log.js
index a4c209e24..b5f686448 100644
--- a/ui/app/components/console/output-log.js
+++ b/ui/app/components/console/output-log.js
@@ -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,
});
diff --git a/ui/app/components/console/ui-panel.js b/ui/app/components/console/ui-panel.js
index 11fb41397..11487462b 100644
--- a/ui/app/components/console/ui-panel.js
+++ b/ui/app/components/console/ui-panel.js
@@ -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', '');
diff --git a/ui/app/components/control-group-success.js b/ui/app/components/control-group-success.js
index 797d5a250..d5659e619 100644
--- a/ui/app/components/control-group-success.js
+++ b/ui/app/components/control-group-success.js
@@ -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,
diff --git a/ui/app/components/control-group.js b/ui/app/components/control-group.js
index 785c413bb..0e20bdaec 100644
--- a/ui/app/components/control-group.js
+++ b/ui/app/components/control-group.js
@@ -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');
diff --git a/ui/app/components/doc-link.js b/ui/app/components/doc-link.js
index 6a2a90887..2bc9bb163 100644
--- a/ui/app/components/doc-link.js
+++ b/ui/app/components/doc-link.js
@@ -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'],
diff --git a/ui/app/components/download-button.js b/ui/app/components/download-button.js
index 4ba0c338e..46ce12198 100644
--- a/ui/app/components/download-button.js
+++ b/ui/app/components/download-button.js
@@ -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',
diff --git a/ui/app/components/edit-form.js b/ui/app/components/edit-form.js
index caf7f76f4..eb0950bd8 100644
--- a/ui/app/components/edit-form.js
+++ b/ui/app/components/edit-form.js
@@ -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,
diff --git a/ui/app/components/edition-badge.js b/ui/app/components/edition-badge.js
index a7b6146b8..025f657be 100644
--- a/ui/app/components/edition-badge.js
+++ b/ui/app/components/edition-badge.js
@@ -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'];
diff --git a/ui/app/components/flash-message.js b/ui/app/components/flash-message.js
index 02753442d..30379488d 100644
--- a/ui/app/components/flash-message.js
+++ b/ui/app/components/flash-message.js
@@ -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
diff --git a/ui/app/components/flex-table-column.js b/ui/app/components/flex-table-column.js
index 8c57d221e..361dd21b6 100644
--- a/ui/app/components/flex-table-column.js
+++ b/ui/app/components/flex-table-column.js
@@ -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,
diff --git a/ui/app/components/form-field-groups.js b/ui/app/components/form-field-groups.js
index 86c32730d..29341dcdb 100644
--- a/ui/app/components/form-field-groups.js
+++ b/ui/app/components/form-field-groups.js
@@ -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: '',
/*
diff --git a/ui/app/components/form-field.js b/ui/app/components/form-field.js
index b37dc6810..893862069 100644
--- a/ui/app/components/form-field.js
+++ b/ui/app/components/form-field.js
@@ -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: {
diff --git a/ui/app/components/generate-credentials.js b/ui/app/components/generate-credentials.js
index d6851ad94..159d7350b 100644
--- a/ui/app/components/generate-credentials.js
+++ b/ui/app/components/generate-credentials.js
@@ -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')
);
}
})
diff --git a/ui/app/components/home-link.js b/ui/app/components/home-link.js
index 98d8964f5..1322d3a31 100644
--- a/ui/app/components/home-link.js
+++ b/ui/app/components/home-link.js
@@ -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: '',
diff --git a/ui/app/components/hover-copy-button.js b/ui/app/components/hover-copy-button.js
index 52c59f2f3..8c4f08ee3 100644
--- a/ui/app/components/hover-copy-button.js
+++ b/ui/app/components/hover-copy-button.js
@@ -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,
diff --git a/ui/app/components/i-con.js b/ui/app/components/i-con.js
index cc82e8f51..e57f1fe44 100644
--- a/ui/app/components/i-con.js
+++ b/ui/app/components/i-con.js
@@ -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)}`;
}),
});
diff --git a/ui/app/components/identity/_popup-base.js b/ui/app/components/identity/_popup-base.js
index c74803ade..eaf8f0be9 100644
--- a/ui/app/components/identity/_popup-base.js
+++ b/ui/app/components/identity/_popup-base.js
@@ -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';
diff --git a/ui/app/components/identity/edit-form.js b/ui/app/components/identity/edit-form.js
index 59e6173b5..0890486b9 100644
--- a/ui/app/components/identity/edit-form.js
+++ b/ui/app/components/identity/edit-form.js
@@ -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,
diff --git a/ui/app/components/identity/item-details.js b/ui/app/components/identity/item-details.js
index fc06e9746..929668288 100644
--- a/ui/app/components/identity/item-details.js
+++ b/ui/app/components/identity/item-details.js
@@ -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) {
diff --git a/ui/app/components/identity/lookup-input.js b/ui/app/components/identity/lookup-input.js
index 9dbc9cb16..2e83204a6 100644
--- a/ui/app/components/identity/lookup-input.js
+++ b/ui/app/components/identity/lookup-input.js
@@ -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}".`);
}
diff --git a/ui/app/components/identity/popup-members.js b/ui/app/components/identity/popup-members.js
index 6c096916f..560a4b1ce 100644
--- a/ui/app/components/identity/popup-members.js
+++ b/ui/app/components/identity/popup-members.js
@@ -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);
diff --git a/ui/app/components/identity/popup-policy.js b/ui/app/components/identity/popup-policy.js
index b626b23c2..303081850 100644
--- a/ui/app/components/identity/popup-policy.js
+++ b/ui/app/components/identity/popup-policy.js
@@ -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);
}),
diff --git a/ui/app/components/info-table-row.js b/ui/app/components/info-table-row.js
index 0c12595f1..1be591196 100644
--- a/ui/app/components/info-table-row.js
+++ b/ui/app/components/info-table-row.js
@@ -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';
}),
});
diff --git a/ui/app/components/info-tooltip.js b/ui/app/components/info-tooltip.js
index f7e144d45..f39f4bc58 100644
--- a/ui/app/components/info-tooltip.js
+++ b/ui/app/components/info-tooltip.js
@@ -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'],
diff --git a/ui/app/components/json-editor.js b/ui/app/components/json-editor.js
index df1285fda..62de07dc6 100644
--- a/ui/app/components/json-editor.js
+++ b/ui/app/components/json-editor.js
@@ -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
diff --git a/ui/app/components/key-value-header.js b/ui/app/components/key-value-header.js
index 998c72240..24498e99a 100644
--- a/ui/app/components/key-value-header.js
+++ b/ui/app/components/key-value-header.js
@@ -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');
diff --git a/ui/app/components/key-version-select.js b/ui/app/components/key-version-select.js
index e3ac4fb5c..479865264 100644
--- a/ui/app/components/key-version-select.js
+++ b/ui/app/components/key-version-select.js
@@ -1,5 +1,5 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({
+export default Component.extend({
tagName: '',
});
diff --git a/ui/app/components/kv-object-editor.js b/ui/app/components/kv-object-editor.js
index 0603998ea..07333cca3 100644
--- a/ui/app/components/kv-object-editor.js
+++ b/ui/app/components/kv-object-editor.js
@@ -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);
diff --git a/ui/app/components/link-to.js b/ui/app/components/link-to.js
index 872a2ffac..3e2893a15 100644
--- a/ui/app/components/link-to.js
+++ b/ui/app/components/link-to.js
@@ -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;
diff --git a/ui/app/components/linked-block.js b/ui/app/components/linked-block.js
index cdbaa6c09..d9b459ba8 100644
--- a/ui/app/components/linked-block.js
+++ b/ui/app/components/linked-block.js
@@ -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);
}
},
});
diff --git a/ui/app/components/list-item.js b/ui/app/components/list-item.js
index c5d85896f..e4f1f0c0f 100644
--- a/ui/app/components/list-item.js
+++ b/ui/app/components/list-item.js
@@ -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,
diff --git a/ui/app/components/list-item/content.js b/ui/app/components/list-item/content.js
index e3ac4fb5c..479865264 100644
--- a/ui/app/components/list-item/content.js
+++ b/ui/app/components/list-item/content.js
@@ -1,5 +1,5 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({
+export default Component.extend({
tagName: '',
});
diff --git a/ui/app/components/list-item/popup-menu.js b/ui/app/components/list-item/popup-menu.js
index e3ac4fb5c..479865264 100644
--- a/ui/app/components/list-item/popup-menu.js
+++ b/ui/app/components/list-item/popup-menu.js
@@ -1,5 +1,5 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({
+export default Component.extend({
tagName: '',
});
diff --git a/ui/app/components/list-pagination.js b/ui/app/components/list-pagination.js
index 163a253b9..d973566c1 100644
--- a/ui/app/components/list-pagination.js
+++ b/ui/app/components/list-pagination.js
@@ -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');
diff --git a/ui/app/components/list-view.js b/ui/app/components/list-view.js
index ca6784fdf..47b6c92ea 100644
--- a/ui/app/components/list-view.js
+++ b/ui/app/components/list-view.js
@@ -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',
diff --git a/ui/app/components/logo-splash.js b/ui/app/components/logo-splash.js
index 48e3f15c1..0e2733fac 100644
--- a/ui/app/components/logo-splash.js
+++ b/ui/app/components/logo-splash.js
@@ -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(),
});
diff --git a/ui/app/components/masked-input.js b/ui/app/components/masked-input.js
index 66e38e916..6e47fc8c0 100644
--- a/ui/app/components/masked-input.js
+++ b/ui/app/components/masked-input.js
@@ -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();
+ },
+ },
});
diff --git a/ui/app/components/menu-sidebar.js b/ui/app/components/menu-sidebar.js
index 0382ad413..819ff0a81 100644
--- a/ui/app/components/menu-sidebar.js
+++ b/ui/app/components/menu-sidebar.js
@@ -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,
diff --git a/ui/app/components/message-error.js b/ui/app/components/message-error.js
index 9c5fc7c5d..6003dce9f 100644
--- a/ui/app/components/message-error.js
+++ b/ui/app/components/message-error.js
@@ -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() {
diff --git a/ui/app/components/message-in-page.js b/ui/app/components/message-in-page.js
index 736739ab3..e5e5c59c7 100644
--- a/ui/app/components/message-in-page.js
+++ b/ui/app/components/message-in-page.js
@@ -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,
diff --git a/ui/app/components/mount-accessor-select.js b/ui/app/components/mount-accessor-select.js
index bdd5d7c97..ea4c9a704 100644
--- a/ui/app/components/mount-accessor-select.js
+++ b/ui/app/components/mount-accessor-select.js
@@ -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
diff --git a/ui/app/components/mount-backend-form.js b/ui/app/components/mount-backend-form.js
index 54de0825b..6427bd509 100644
--- a/ui/app/components/mount-backend-form.js
+++ b/ui/app/components/mount-backend-form.js
@@ -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.`
);
diff --git a/ui/app/components/mount-filter-config-list.js b/ui/app/components/mount-filter-config-list.js
index d05f7ac4e..ceb86ef03 100644
--- a/ui/app/components/mount-filter-config-list.js
+++ b/ui/app/components/mount-filter-config-list.js
@@ -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) {
diff --git a/ui/app/components/namespace-link.js b/ui/app/components/namespace-link.js
index adad03d1c..d078d4f96 100644
--- a/ui/app/components/namespace-link.js
+++ b/ui/app/components/namespace-link.js
@@ -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
diff --git a/ui/app/components/namespace-picker.js b/ui/app/components/namespace-picker.js
index da8721dfa..e448d1371 100644
--- a/ui/app/components/namespace-picker.js
+++ b/ui/app/components/namespace-picker.js
@@ -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');
}),
diff --git a/ui/app/components/namespace-reminder.js b/ui/app/components/namespace-reminder.js
index 7659d9b62..464f4b6c6 100644
--- a/ui/app/components/namespace-reminder.js
+++ b/ui/app/components/namespace-reminder.js
@@ -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',
diff --git a/ui/app/components/nav-header.js b/ui/app/components/nav-header.js
index f36a904a1..15a4ae2f5 100644
--- a/ui/app/components/nav-header.js
+++ b/ui/app/components/nav-header.js
@@ -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',
});
diff --git a/ui/app/components/nav-header/home.js b/ui/app/components/nav-header/home.js
index e3ac4fb5c..479865264 100644
--- a/ui/app/components/nav-header/home.js
+++ b/ui/app/components/nav-header/home.js
@@ -1,5 +1,5 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({
+export default Component.extend({
tagName: '',
});
diff --git a/ui/app/components/nav-header/items.js b/ui/app/components/nav-header/items.js
index e3ac4fb5c..479865264 100644
--- a/ui/app/components/nav-header/items.js
+++ b/ui/app/components/nav-header/items.js
@@ -1,5 +1,5 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({
+export default Component.extend({
tagName: '',
});
diff --git a/ui/app/components/nav-header/main.js b/ui/app/components/nav-header/main.js
index e3ac4fb5c..479865264 100644
--- a/ui/app/components/nav-header/main.js
+++ b/ui/app/components/nav-header/main.js
@@ -1,5 +1,5 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({
+export default Component.extend({
tagName: '',
});
diff --git a/ui/app/components/navigate-input.js b/ui/app/components/navigate-input.js
index f56c22750..f642b6d1b 100644
--- a/ui/app/components/navigate-input.js
+++ b/ui/app/components/navigate-input.js
@@ -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) {
diff --git a/ui/app/components/not-found.js b/ui/app/components/not-found.js
index 5d76dd583..9304562f6 100644
--- a/ui/app/components/not-found.js
+++ b/ui/app/components/not-found.js
@@ -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'),
});
diff --git a/ui/app/components/outer-html.js b/ui/app/components/outer-html.js
index f071ff551..096229835 100644
--- a/ui/app/components/outer-html.js
+++ b/ui/app/components/outer-html.js
@@ -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: '',
});
diff --git a/ui/app/components/page-header-level-left.js b/ui/app/components/page-header-level-left.js
index e3ac4fb5c..479865264 100644
--- a/ui/app/components/page-header-level-left.js
+++ b/ui/app/components/page-header-level-left.js
@@ -1,5 +1,5 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({
+export default Component.extend({
tagName: '',
});
diff --git a/ui/app/components/page-header-level-right.js b/ui/app/components/page-header-level-right.js
index e3ac4fb5c..479865264 100644
--- a/ui/app/components/page-header-level-right.js
+++ b/ui/app/components/page-header-level-right.js
@@ -1,5 +1,5 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({
+export default Component.extend({
tagName: '',
});
diff --git a/ui/app/components/page-header-top.js b/ui/app/components/page-header-top.js
index e3ac4fb5c..479865264 100644
--- a/ui/app/components/page-header-top.js
+++ b/ui/app/components/page-header-top.js
@@ -1,5 +1,5 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({
+export default Component.extend({
tagName: '',
});
diff --git a/ui/app/components/page-header.js b/ui/app/components/page-header.js
index 0c8a391ee..9a92d1667 100644
--- a/ui/app/components/page-header.js
+++ b/ui/app/components/page-header.js
@@ -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,
});
diff --git a/ui/app/components/pgp-file.js b/ui/app/components/pgp-file.js
index 43735afce..a8e1d1c55 100644
--- a/ui/app/components/pgp-file.js
+++ b/ui/app/components/pgp-file.js
@@ -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,
diff --git a/ui/app/components/pgp-list.js b/ui/app/components/pgp-list.js
index b8aed1c78..cd14a91c7 100644
--- a/ui/app/components/pgp-list.js
+++ b/ui/app/components/pgp-list.js
@@ -1,8 +1,9 @@
-import Ember from 'ember';
+import { computed } from '@ember/object';
+import Component from '@ember/component';
-export default Ember.Component.extend({
+export default Component.extend({
onDataUpdate: () => {},
- listData: Ember.computed('listLength', function() {
+ listData: computed('listLength', function() {
let num = this.get('listLength');
if (num) {
num = parseInt(num, 10);
diff --git a/ui/app/components/pki-cert-popup.js b/ui/app/components/pki-cert-popup.js
index 64faaeb59..6f4da8d1e 100644
--- a/ui/app/components/pki-cert-popup.js
+++ b/ui/app/components/pki-cert-popup.js
@@ -1,6 +1,6 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({
+export default Component.extend({
/*
* @public
* @param DS.Model
diff --git a/ui/app/components/popup-menu.js b/ui/app/components/popup-menu.js
index ced037466..3f263270c 100644
--- a/ui/app/components/popup-menu.js
+++ b/ui/app/components/popup-menu.js
@@ -1,5 +1,5 @@
-import Ember from 'ember';
+import Component from '@ember/component';
-export default Ember.Component.extend({
+export default Component.extend({
tagName: 'span',
});
diff --git a/ui/app/components/radial-progress.js b/ui/app/components/radial-progress.js
index 4ad0d8ddb..4c70f641d 100644
--- a/ui/app/components/radial-progress.js
+++ b/ui/app/components/radial-progress.js
@@ -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({
'data-test-radial-progress': true,
tagName: 'svg',
classNames: 'radial-progress',
diff --git a/ui/app/components/replication-actions.js b/ui/app/components/replication-actions.js
index 2e1b22a90..f71640057 100644
--- a/ui/app/components/replication-actions.js
+++ b/ui/app/components/replication-actions.js
@@ -1,8 +1,8 @@
-import Ember from 'ember';
+import { alias } from '@ember/object/computed';
+import Component from '@ember/component';
+import { computed } from '@ember/object';
import ReplicationActions from 'vault/mixins/replication-actions';
-const { computed } = Ember;
-
const DEFAULTS = {
token: null,
primary_api_addr: null,
@@ -12,7 +12,7 @@ const DEFAULTS = {
replicationMode: null,
};
-export default Ember.Component.extend(ReplicationActions, DEFAULTS, {
+export default Component.extend(ReplicationActions, DEFAULTS, {
replicationMode: null,
selectedAction: null,
tagName: 'form',
@@ -22,7 +22,7 @@ export default Ember.Component.extend(ReplicationActions, DEFAULTS, {
},
model: null,
- cluster: computed.alias('model'),
+ cluster: alias('model'),
loading: false,
onSubmit: null,
diff --git a/ui/app/components/replication-mode-summary.js b/ui/app/components/replication-mode-summary.js
index 8c5510437..cd7716b8e 100644
--- a/ui/app/components/replication-mode-summary.js
+++ b/ui/app/components/replication-mode-summary.js
@@ -1,5 +1,7 @@
-import Ember from 'ember';
-const { computed, get, getProperties, Component, inject } = Ember;
+import { inject as service } from '@ember/service';
+import { equal } from '@ember/object/computed';
+import { getProperties, get, computed } from '@ember/object';
+import Component from '@ember/component';
const replicationAttr = function(attr) {
return computed('mode', `cluster.{dr,performance}.${attr}`, function() {
@@ -8,13 +10,13 @@ const replicationAttr = function(attr) {
});
};
export default Component.extend({
- version: inject.service(),
- router: inject.service(),
- namespace: inject.service(),
+ version: service(),
+ router: service(),
+ namespace: service(),
classNameBindings: ['isMenu::box', 'isMenu::level'],
attributeBindings: ['href', 'target'],
display: 'banner',
- isMenu: computed.equal('display', 'menu'),
+ isMenu: equal('display', 'menu'),
href: computed('display', 'mode', 'replicationEnabled', 'version.hasPerfReplication', function() {
const display = this.get('display');
const mode = this.get('mode');
@@ -37,9 +39,9 @@ export default Component.extend({
return null;
}),
internalLink: false,
- isPerformance: computed.equal('mode', 'performance'),
+ isPerformance: equal('mode', 'performance'),
replicationEnabled: replicationAttr('replicationEnabled'),
- replicationUnsupported: computed.equal('cluster.mode', 'unsupported'),
+ replicationUnsupported: equal('cluster.mode', 'unsupported'),
replicationDisabled: replicationAttr('replicationDisabled'),
syncProgressPercent: replicationAttr('syncProgressPercent'),
syncProgress: replicationAttr('syncProgress'),
diff --git a/ui/app/components/replication-secondaries.js b/ui/app/components/replication-secondaries.js
index c13704b15..c1f862976 100644
--- a/ui/app/components/replication-secondaries.js
+++ b/ui/app/components/replication-secondaries.js
@@ -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({
cluster: null,
replicationMode: null,
secondaries: null,
diff --git a/ui/app/components/replication-summary.js b/ui/app/components/replication-summary.js
index 3e68265e7..745722a6d 100644
--- a/ui/app/components/replication-summary.js
+++ b/ui/app/components/replication-summary.js
@@ -1,8 +1,10 @@
-import Ember from 'ember';
+import { inject as service } from '@ember/service';
+import { alias } from '@ember/object/computed';
+import { get, computed } from '@ember/object';
+import Component from '@ember/component';
import decodeConfigFromJWT from 'vault/utils/decode-config-from-jwt';
import ReplicationActions from 'vault/mixins/replication-actions';
-
-const { computed, get, Component, inject } = Ember;
+import { task } from 'ember-concurrency';
const DEFAULTS = {
mode: 'primary',
@@ -18,8 +20,8 @@ const DEFAULTS = {
};
export default Component.extend(ReplicationActions, DEFAULTS, {
- wizard: inject.service(),
- version: inject.service(),
+ wizard: service(),
+ version: service(),
didReceiveAttrs() {
this._super(...arguments);
const initialReplicationMode = this.get('initialReplicationMode');
@@ -31,7 +33,7 @@ export default Component.extend(ReplicationActions, DEFAULTS, {
initialReplicationMode: null,
cluster: null,
- replicationAttrs: computed.alias('cluster.replicationAttrs'),
+ replicationAttrs: alias('cluster.replicationAttrs'),
tokenIncludesAPIAddr: computed('token', function() {
const config = decodeConfigFromJWT(get(this, 'token'));
@@ -64,14 +66,15 @@ export default Component.extend(ReplicationActions, DEFAULTS, {
this.setProperties(DEFAULTS);
},
+ submit: task(function*() {
+ yield this.submitHandler(...arguments);
+ let wizard = this.get('wizard');
+ wizard.transitionFeatureMachine(wizard.get('featureState'), 'ENABLEREPLICATION');
+ }),
+
actions: {
onSubmit(/*action, mode, data, event*/) {
- let promise = this.submitHandler(...arguments);
- let wizard = this.get('wizard');
- promise.then(() => {
- wizard.transitionFeatureMachine(wizard.get('featureState'), 'ENABLEREPLICATION');
- });
- return promise;
+ this.get('submit').perform(...arguments);
},
clear() {
diff --git a/ui/app/components/role-aws-edit.js b/ui/app/components/role-aws-edit.js
index 4021ce46b..d7e570434 100644
--- a/ui/app/components/role-aws-edit.js
+++ b/ui/app/components/role-aws-edit.js
@@ -1,7 +1,6 @@
+import { isBlank } from '@ember/utils';
+import { set, get } from '@ember/object';
import RoleEdit from './role-edit';
-import Ember from 'ember';
-
-const { get, set } = Ember;
const SHOW_ROUTE = 'vault.cluster.secrets.backend.show';
export default RoleEdit.extend({
@@ -12,7 +11,7 @@ export default RoleEdit.extend({
const modelId = this.get('model.id');
// prevent from submitting if there's no key
// maybe do something fancier later
- if (type === 'create' && Ember.isBlank(modelId)) {
+ if (type === 'create' && isBlank(modelId)) {
return;
}
diff --git a/ui/app/components/role-edit.js b/ui/app/components/role-edit.js
index dd179d685..929127644 100644
--- a/ui/app/components/role-edit.js
+++ b/ui/app/components/role-edit.js
@@ -1,20 +1,25 @@
-import Ember from 'ember';
+import { inject as service } from '@ember/service';
+import { or } from '@ember/object/computed';
+import { isBlank } from '@ember/utils';
+import $ from 'jquery';
+import Component from '@ember/component';
+import { set, get } from '@ember/object';
import FocusOnInsertMixin from 'vault/mixins/focus-on-insert';
import keys from 'vault/lib/keycodes';
-const { get, set, computed, inject } = Ember;
const LIST_ROOT_ROUTE = 'vault.cluster.secrets.backend.list-root';
const SHOW_ROUTE = 'vault.cluster.secrets.backend.show';
-export default Ember.Component.extend(FocusOnInsertMixin, {
+export default Component.extend(FocusOnInsertMixin, {
+ router: service(),
+ wizard: service(),
+
mode: null,
emptyData: '{\n}',
- onDataChange: () => {},
- refresh: 'refresh',
+ onDataChange() {},
+ onRefresh() {},
model: null,
- routing: inject.service('-routing'),
- wizard: inject.service(),
- requestInFlight: computed.or('model.isLoading', 'model.isReloading', 'model.isSaving'),
+ requestInFlight: or('model.isLoading', 'model.isReloading', 'model.isSaving'),
didReceiveAttrs() {
this._super(...arguments);
@@ -37,26 +42,24 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
}
},
+ didInsertElement() {
+ this._super(...arguments);
+ $(document).on('keyup.keyEdit', this.onEscape.bind(this));
+ },
+
willDestroyElement() {
+ this._super(...arguments);
const model = this.get('model');
if (get(model, 'isError')) {
model.rollbackAttributes();
}
+ $(document).off('keyup.keyEdit');
},
transitionToRoute() {
- const router = this.get('routing.router');
- router.transitionTo.apply(router, arguments);
+ this.get('router').transitionTo(...arguments);
},
- bindKeys: Ember.on('didInsertElement', function() {
- Ember.$(document).on('keyup.keyEdit', this.onEscape.bind(this));
- }),
-
- unbindKeys: Ember.on('willDestroyElement', function() {
- Ember.$(document).off('keyup.keyEdit');
- }),
-
onEscape(e) {
if (e.keyCode !== keys.ESC || this.get('mode') !== 'show') {
return;
@@ -71,7 +74,7 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
persist(method, successCallback) {
const model = get(this, 'model');
return model[method]().then(() => {
- if (!Ember.get(model, 'isError')) {
+ if (!get(model, 'isError')) {
if (this.get('wizard.featureState') === 'role') {
this.get('wizard').transitionFeatureMachine('role', 'CONTINUE', this.get('backendType'));
}
@@ -99,7 +102,7 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
const modelId = this.get('model.id');
// prevent from submitting if there's no key
// maybe do something fancier later
- if (type === 'create' && Ember.isBlank(modelId)) {
+ if (type === 'create' && isBlank(modelId)) {
return;
}
@@ -118,7 +121,7 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
},
refresh() {
- this.sendAction('refresh');
+ this.get('onRefresh')();
},
delete() {
diff --git a/ui/app/components/secret-edit.js b/ui/app/components/secret-edit.js
index 8d673dc7b..cfa3b5d65 100644
--- a/ui/app/components/secret-edit.js
+++ b/ui/app/components/secret-edit.js
@@ -1,4 +1,9 @@
-import Ember from 'ember';
+import { or } from '@ember/object/computed';
+import { isBlank, isNone } from '@ember/utils';
+import $ from 'jquery';
+import { inject as service } from '@ember/service';
+import Component from '@ember/component';
+import { computed, get } from '@ember/object';
import FocusOnInsertMixin from 'vault/mixins/focus-on-insert';
import keys from 'vault/lib/keycodes';
import KVObject from 'vault/lib/kv-object';
@@ -6,9 +11,11 @@ import KVObject from 'vault/lib/kv-object';
const LIST_ROUTE = 'vault.cluster.secrets.backend.list';
const LIST_ROOT_ROUTE = 'vault.cluster.secrets.backend.list-root';
const SHOW_ROUTE = 'vault.cluster.secrets.backend.show';
-const { get, computed, inject } = Ember;
-export default Ember.Component.extend(FocusOnInsertMixin, {
+export default Component.extend(FocusOnInsertMixin, {
+ wizard: service(),
+ router: service(),
+
// a key model
key: null,
@@ -22,7 +29,9 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
secretData: null,
// called with a bool indicating if there's been a change in the secretData
- onDataChange: () => {},
+ onDataChange() {},
+ onRefresh() {},
+ onToggleAdvancedEdit() {},
// did user request advanced mode
preferAdvancedEdit: false,
@@ -36,8 +45,6 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
hasLintError: false,
- wizard: inject.service(),
-
init() {
this._super(...arguments);
const secrets = this.get('key.secretData');
@@ -58,24 +65,29 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
}
},
+ didInsertElement() {
+ this._super(...arguments);
+ $(document).on('keyup.keyEdit', this.onEscape.bind(this));
+ },
+
willDestroyElement() {
+ this._super(...arguments);
const key = this.get('key');
if (get(key, 'isError') && !key.isDestroyed) {
key.rollbackAttributes();
}
+ $(document).off('keyup.keyEdit');
},
- partialName: Ember.computed('mode', function() {
+ partialName: computed('mode', function() {
return `partials/secret-form-${this.get('mode')}`;
}),
- routing: Ember.inject.service('-routing'),
+ showPrefix: or('key.initialParentKey', 'key.parentKey'),
- showPrefix: computed.or('key.initialParentKey', 'key.parentKey'),
+ requestInFlight: or('key.isLoading', 'key.isReloading', 'key.isSaving'),
- requestInFlight: computed.or('key.isLoading', 'key.isReloading', 'key.isSaving'),
-
- buttonDisabled: computed.or(
+ buttonDisabled: or(
'requestInFlight',
'key.isFolder',
'key.isError',
@@ -111,18 +123,9 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
}),
transitionToRoute() {
- const router = this.get('routing.router');
- router.transitionTo.apply(router, arguments);
+ this.get('router').transitionTo(...arguments);
},
- bindKeys: Ember.on('didInsertElement', function() {
- Ember.$(document).on('keyup.keyEdit', this.onEscape.bind(this));
- }),
-
- unbindKeys: Ember.on('willDestroyElement', function() {
- Ember.$(document).off('keyup.keyEdit');
- }),
-
onEscape(e) {
if (e.keyCode !== keys.ESC || this.get('mode') !== 'show') {
return;
@@ -152,7 +155,7 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
}
return model[method]().then(() => {
- if (!Ember.get(model, 'isError')) {
+ if (!get(model, 'isError')) {
if (this.get('wizard.featureState') === 'secret') {
this.get('wizard').transitionFeatureMachine('secret', 'CONTINUE');
}
@@ -192,7 +195,7 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
// prevent from submitting if there's no key
// maybe do something fancier later
- if (type === 'create' && Ember.isBlank(this.get('key.id'))) {
+ if (type === 'create' && isBlank(this.get('key.id'))) {
return;
}
@@ -213,12 +216,12 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
},
refresh() {
- this.attrs.onRefresh();
+ this.get('onRefresh')();
},
addRow() {
const data = this.get('secretData');
- if (Ember.isNone(data.findBy('name', ''))) {
+ if (isNone(data.findBy('name', ''))) {
data.pushObject({ name: '', value: '' });
this.set('codemirrorString', data.toJSONString(true));
}
@@ -229,7 +232,7 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
deleteRow(name) {
const data = this.get('secretData');
const item = data.findBy('name', name);
- if (Ember.isBlank(item.name)) {
+ if (isBlank(item.name)) {
return;
}
data.removeObject(item);
@@ -240,7 +243,7 @@ export default Ember.Component.extend(FocusOnInsertMixin, {
},
toggleAdvanced(bool) {
- this.sendAction('toggleAdvancedEdit', bool);
+ this.get('onToggleAdvancedEdit')(bool);
},
codemirrorUpdated(val, codemirror) {
diff --git a/ui/app/components/secret-form-header.js b/ui/app/components/secret-form-header.js
index 1a20cb820..d8b27ca6e 100644
--- a/ui/app/components/secret-form-header.js
+++ b/ui/app/components/secret-form-header.js
@@ -1,13 +1,14 @@
-import Ember from 'ember';
+import { alias } from '@ember/object/computed';
+import Component from '@ember/component';
import hbs from 'htmlbars-inline-precompile';
-export default Ember.Component.extend({
+export default Component.extend({
key: null,
mode: null,
path: null,
actionClass: null,
- title: Ember.computed.alias('key.keyWithoutParent'),
+ title: alias('key.keyWithoutParent'),
layout: hbs`