Skip to content

Commit

Permalink
UI/update UI deps (#11447)
Browse files Browse the repository at this point in the history
  • Loading branch information
hashishaw committed Apr 26, 2021
1 parent 39fd597 commit 69bd7e0
Show file tree
Hide file tree
Showing 47 changed files with 3,393 additions and 3,689 deletions.
3 changes: 3 additions & 0 deletions changelog/11447.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
ui: Update ember to latest LTS and upgrade UI dependencies
```
154 changes: 70 additions & 84 deletions ui/MODULE_REPORT.md
Original file line number Diff line number Diff line change
@@ -1,90 +1,6 @@
## Module Report
### Unknown Global

**Global**: `Ember.testing`

**Location**: `app/components/auth-jwt.js` at line 9

```js

/* eslint-disable ember/no-ember-testing-in-module-scope */
const WAIT_TIME = Ember.testing ? 0 : 500;
const ERROR_WINDOW_CLOSED =
'The provider window was closed before authentication was complete. Please click Sign In to try again.';
```

### Unknown Global

**Global**: `Ember.testing`

**Location**: `app/components/auth-jwt.js` at line 117

```js
exchangeOIDC: task(function*(event, oidcWindow) {
// in non-incognito mode we need to use a timeout because it takes time before oidcState is written to local storage.
let oidcState = Ember.testing
? event.storageArea.getItem('oidcState')
: (yield timeout(1000).then(() => event.storageArea.getItem('oidcState')));
```
### Unknown Global
**Global**: `Ember.testing`
**Location**: `app/routes/vault.js` at line 7
```js
import Ember from 'ember';
/* eslint-disable ember/no-ember-testing-in-module-scope */
const SPLASH_DELAY = Ember.testing ? 0 : 300;

export default Route.extend({
```
### Unknown Global
**Global**: `Ember.testing`
**Location**: `app/services/auth.js` at line 267
```js
checkShouldRenew: task(function*() {
while (true) {
if (Ember.testing) {
return;
}
```
### Unknown Global
**Global**: `Ember.testing`
**Location**: `lib/core/addon/components/ttl-form.js` at line 82
```js
this.set('time', parsedTime);
this.handleChange();
if (Ember.testing) {
return;
}
```
### Unknown Global
**Global**: `Ember.testing`
**Location**: `app/routes/vault/cluster.js` at line 78
```js
// when testing, the polling loop causes promises to never settle so acceptance tests hang
// to get around that, we just disable the poll in tests
if (Ember.testing) {
return;
}
```
### Unknown Global
**Global**: `Ember.onerror`

**Location**: `tests/helpers/wait-for-error.js` at line 5
Expand Down Expand Up @@ -222,3 +138,73 @@ export default function waitForError(opts) {
return logout.visit();
});
```
### Unknown Global
**Global**: `Ember.testing`
**Location**: `app/components/auth-jwt.js` at line 9
```js

/* eslint-disable ember/no-ember-testing-in-module-scope */
const WAIT_TIME = Ember.testing ? 0 : 500;
const ERROR_WINDOW_CLOSED =
'The provider window was closed before authentication was complete. Please click Sign In to try again.';
```
### Unknown Global
**Global**: `Ember.testing`
**Location**: `app/components/auth-jwt.js` at line 119
```js
exchangeOIDC: task(function*(event, oidcWindow) {
// in non-incognito mode we need to use a timeout because it takes time before oidcState is written to local storage.
let oidcState = Ember.testing
? event.storageArea.getItem('oidcState')
: yield timeout(1000).then(() => event.storageArea.getItem('oidcState'));
```
### Unknown Global
**Global**: `Ember.testing`
**Location**: `app/routes/vault.js` at line 7
```js
import Ember from 'ember';
/* eslint-disable ember/no-ember-testing-in-module-scope */
const SPLASH_DELAY = Ember.testing ? 0 : 300;

export default Route.extend({
```
### Unknown Global
**Global**: `Ember.testing`
**Location**: `app/services/auth.js` at line 267
```js
checkShouldRenew: task(function*() {
while (true) {
if (Ember.testing) {
return;
}
```
### Unknown Global
**Global**: `Ember.testing`
**Location**: `lib/core/addon/components/ttl-form.js` at line 82
```js
this.set('time', parsedTime);
this.handleChange();
if (Ember.testing) {
return;
}
```
4 changes: 2 additions & 2 deletions ui/app/adapters/auth-method.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import AdapterError from '@ember-data/adapter/error';
import { assign } from '@ember/polyfills';
import { get, set } from '@ember/object';
import { set } from '@ember/object';
import ApplicationAdapter from './application';
import { encodePath } from 'vault/utils/path-encoding-helpers';

Expand All @@ -16,7 +16,7 @@ export default ApplicationAdapter.extend({
},

findAll(store, type, sinceToken, snapshotRecordArray) {
let isUnauthenticated = get(snapshotRecordArray || {}, 'adapterOptions.unauthenticated');
let isUnauthenticated = snapshotRecordArray?.adapterOptions?.unauthenticated;
if (isUnauthenticated) {
let url = `/${this.urlPrefix()}/internal/ui/mounts`;
return this.ajax(url, 'GET', {
Expand Down
3 changes: 1 addition & 2 deletions ui/app/adapters/role-jwt.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import ApplicationAdapter from './application';
import { inject as service } from '@ember/service';
import { get } from '@ember/object';
import { encodePath } from 'vault/utils/path-encoding-helpers';

export default ApplicationAdapter.extend({
Expand All @@ -10,7 +9,7 @@ export default ApplicationAdapter.extend({
let [path, role] = JSON.parse(id);
path = encodePath(path);

let namespace = get(snapshot, 'adapterOptions.namespace');
let namespace = snapshot?.adapterOptions.namespace;
let url = `/v1/auth/${path}/oidc/auth_url`;
let redirect_uri = `${window.location.origin}${this.router.urlFor('vault.cluster.oidc-callback', {
auth_path: path,
Expand Down
16 changes: 7 additions & 9 deletions ui/app/components/auth-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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 { computed } from '@ember/object';
import { supportedAuthBackends } from 'vault/helpers/supported-auth-backends';
import { task } from 'ember-concurrency';
const BACKENDS = supportedAuthBackends();
Expand Down Expand Up @@ -101,7 +101,7 @@ export default Component.extend(DEFAULTS, {
let firstMethod = this.methodsToShow.firstObject;
if (!firstMethod) return;
// prefer backends with a path over those with a type
return get(firstMethod, 'path') || get(firstMethod, 'type');
return firstMethod.path || firstMethod.type;
},

resetDefaults() {
Expand Down Expand Up @@ -152,9 +152,7 @@ export default Component.extend(DEFAULTS, {
}),
methodsToShow: computed('methods', function() {
let methods = this.methods || [];
let shownMethods = methods.filter(m =>
BACKENDS.find(b => get(b, 'type').toLowerCase() === get(m, 'type').toLowerCase())
);
let shownMethods = methods.filter(m => BACKENDS.find(b => b.type.toLowerCase() === m.type.toLowerCase()));
return shownMethods.length ? shownMethods : BACKENDS;
}),

Expand Down Expand Up @@ -254,16 +252,16 @@ export default Component.extend(DEFAULTS, {
});
let backend = this.selectedAuthBackend || {};
let backendMeta = BACKENDS.find(
b => (get(b, 'type') || '').toLowerCase() === (get(backend, 'type') || '').toLowerCase()
b => (b.type || '').toLowerCase() === (backend.type || '').toLowerCase()
);
let attributes = get(backendMeta || {}, 'formAttributes') || [];
let attributes = (backendMeta || {}).formAttributes || [];

data = assign(data, this.getProperties(...attributes));
if (passedData) {
data = assign(data, passedData);
}
if (this.customPath || get(backend, 'id')) {
data.path = this.customPath || get(backend, 'id');
if (this.customPath || backend.id) {
data.path = this.customPath || backend.id;
}
return this.authenticate.unlinked().perform(backend.type, data);
},
Expand Down
6 changes: 3 additions & 3 deletions ui/app/components/control-group.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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 { computed } from '@ember/object';
import { task } from 'ember-concurrency';

export default Component.extend({
Expand Down Expand Up @@ -38,8 +38,8 @@ export default Component.extend({
if (this.currentUserIsRequesting) {
return 'You';
}
if (entity && get(entity, 'name')) {
return get(entity, 'name');
if (entity && entity.name) {
return entity.name;
}
return 'Someone';
}),
Expand Down
6 changes: 3 additions & 3 deletions ui/app/components/pricing-metrics-dates.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @param {number} [defaultSpan=12] - setting for default time between start and end input dates
* @param {number} [retentionMonths=24] - setting for the retention months, which informs valid dates to query by
*/
import { computed } from '@ember/object';
import { set, computed } from '@ember/object';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import {
Expand Down Expand Up @@ -140,8 +140,8 @@ export default Component.extend({
this.queryStart = format(initialStart, 'MM-yyyy');
}

this.start = format(initialStart, 'MM/yyyy');
this.end = format(initialEnd, 'MM/yyyy');
set(this, 'start', format(initialStart, 'MM/yyyy'));
set(this, 'end', format(initialEnd, 'MM/yyyy'));
},

actions: {
Expand Down
4 changes: 2 additions & 2 deletions ui/app/components/role-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { or } from '@ember/object/computed';
import { isBlank } from '@ember/utils';
import { task, waitForEvent } from 'ember-concurrency';
import Component from '@ember/component';
import { set, get } from '@ember/object';
import { set } from '@ember/object';
import FocusOnInsertMixin from 'vault/mixins/focus-on-insert';
import keys from 'vault/lib/keycodes';

Expand Down Expand Up @@ -68,7 +68,7 @@ export default Component.extend(FocusOnInsertMixin, {
persist(method, successCallback) {
const model = this.model;
return model[method]().then(() => {
if (!get(model, 'isError')) {
if (!model.isError) {
if (this.wizard.featureState === 'role') {
this.wizard.transitionFeatureMachine('role', 'CONTINUE', this.backendType);
}
Expand Down
4 changes: 2 additions & 2 deletions ui/app/components/transit-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { or } from '@ember/object/computed';
import { isBlank } from '@ember/utils';
import Component from '@ember/component';
import { task, waitForEvent } from 'ember-concurrency';
import { set, get } from '@ember/object';
import { set } from '@ember/object';

import FocusOnInsertMixin from 'vault/mixins/focus-on-insert';
import keys from 'vault/lib/keycodes';
Expand Down Expand Up @@ -54,7 +54,7 @@ export default Component.extend(FocusOnInsertMixin, {
persistKey(method, successCallback) {
const key = this.key;
return key[method]().then(() => {
if (!get(key, 'isError')) {
if (!key.isError) {
if (this.wizard.featureState === 'secret') {
this.wizard.transitionFeatureMachine('secret', 'CONTINUE');
} else {
Expand Down
6 changes: 3 additions & 3 deletions ui/app/components/transit-key-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default Component.extend(TRANSIT_PARAMS, {
this._super(...arguments);
// TODO figure out why get is needed here Ember Upgrade
// eslint-disable-next-line ember/no-get
if (get(this, 'selectedAction')) {
if (this.selectedAction) {
return;
}
// eslint-disable-next-line ember/no-get
Expand Down Expand Up @@ -102,8 +102,8 @@ export default Component.extend(TRANSIT_PARAMS, {
if (!model) {
return null;
}
const backend = get(model, 'backend') || get(model, 'id');
const id = get(model, 'id');
const backend = model.backend || model.id;
const id = model.id;

return {
backend,
Expand Down
4 changes: 2 additions & 2 deletions ui/app/controllers/vault/cluster/secrets/backend/sign.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { inject as service } from '@ember/service';
import Controller from '@ember/controller';
import { set, get } from '@ember/object';
import { set } from '@ember/object';

export default Controller.extend({
store: service(),
Expand Down Expand Up @@ -35,7 +35,7 @@ export default Controller.extend({
model.unloadRecord();
const newModel = this.store.createRecord('ssh-sign', {
role: roleModel,
id: `${get(roleModel, 'backend')}-${get(roleModel, 'name')}`,
id: `${roleModel.backend}-${roleModel.name}`,
});
this.set('model', newModel);
},
Expand Down
Loading

0 comments on commit 69bd7e0

Please sign in to comment.