Merge pull request #382 from hashicorp/chore-code-quality

Chore code quality - ICU-886
This commit is contained in:
Susmitha Girumala authored and GitHub committed 2020-11-16 16:13:52 -05:00
commit 3c71e7e7ce
216 files changed
+1193 -918

No files matched your search

+12 -12
View File
@@ -19,18 +19,18 @@
"build": "yarn build:ui:core",
"build:ui:core": "cd ui/core && yarn build",
"build:ui:desktop": "cd ui/desktop && yarn build",
"lint": "yarn lint:addons:api && yarn lint:addons:auth && yarn lint:addons:rose && yarn lint:ui:core",
"lint:addons:api": "echo \"\n\nlint: addons/api\n\" && cd addons/api && yarn lint",
"lint:addons:auth": "echo \"\n\nlint: addons/auth\n\" && cd addons/auth && yarn lint",
"lint:addons:rose": "echo \"\n\nlint: addons/rose\n\" && cd addons/rose && yarn lint",
"lint:ui:core": "echo \"\n\nlint: ui/core\n\" && cd ui/core && yarn lint",
"lint:ui:desktop": "echo \"\n\nlint: ui/desktop\n\" && cd ui/desktop && yarn lint",
"test": "yarn test:addons:api && yarn test:addons:auth && yarn test:addons:rose && yarn test:ui:core",
"test:addons:api": "echo \"\n\ntest: addons/api\n\" && cd addons/api && yarn test",
"test:addons:auth": "echo \"\n\ntest: addons/auth\n\" && cd addons/auth && yarn test",
"test:addons:rose": "echo \"\n\ntest: addons/rose\n\" && cd addons/rose && yarn test",
"test:ui:core": "echo \"\n\ntest: ui/core\n\" && cd ui/core && yarn test",
"test:ui:desktop": "echo \"\n\ntest: ui/desktop\n\" && cd ui/desktop && yarn test",
"lint": "npm-run-all lint:*",
"lint:addons-api": "cd addons/api && yarn lint",
"lint:addons-auth": "cd addons/auth && yarn lint",
"lint:addons-rose": "cd addons/rose && yarn lint",
"lint:ui-core": "cd ui/core && yarn lint",
"lint:ui-desktop": "cd ui/desktop && yarn lint",
"test": "npm-run-all test:*",
"test:addons-api": "cd addons/api && yarn test",
"test:addons-auth": "cd addons/auth && yarn test",
"test:addons-rose": "cd addons/rose && yarn test",
"test:ui-core": "cd ui/core && yarn test",
"test:ui-desktop": "cd ui/desktop && yarn test",
"compliance:audit": "bash ./scripts/yarn-audit.sh",
"precommit": "yarn compliance:licenses && yarn compliance:audit && yarn lint && yarn test",
"commit": "git-cz",
-2
View File
@@ -2,10 +2,8 @@ import BreadCrumbsComponent from 'ember-breadcrumbs/components/bread-crumbs';
import { inject as service } from '@ember/service';
export default class crumbs extends BreadCrumbsComponent {
// =services
@service session;
@service scope;
}
+1 -2
View File
@@ -54,8 +54,7 @@ export default class ErrorMessageComponent extends MessageComponent {
@computed('args.status')
get messageCode() {
let messageCode = this.args.status;
if(!statuses.includes(messageCode)) messageCode = 'unknown';
if (!statuses.includes(messageCode)) messageCode = 'unknown';
return messageCode;
}
}
@@ -5,7 +5,6 @@ import { action } from '@ember/object';
import { run } from '@ember/runloop';
export default class FormAccountPasswordChangePasswordIndexComponent extends Component {
// =properties
/**
@@ -69,5 +68,4 @@ export default class FormAccountPasswordChangePasswordIndexComponent extends Com
this.resetPasswords();
fn();
}
}
@@ -15,7 +15,7 @@ export default class FormRoleGrantsComponent extends Component {
*/
@computed('args.model.grant_strings.[]')
get grants() {
return this.args.model.grant_strings.map(value => ({ value }));
return this.args.model.grant_strings.map((value) => ({ value }));
}
/**
@@ -23,7 +23,7 @@ export default class FormRoleGrantsComponent extends Component {
*/
@computed('grants.@each.value')
get grantStrings() {
return this.grants.map(obj => obj.value);
return this.grants.map((obj) => obj.value);
}
/**
+4 -2
View File
@@ -10,7 +10,9 @@ export default class FormRoleGrantsComponent extends Component {
*/
@computed('args.model.{store,grant_scope_id}')
get selectedGrantScope() {
return this.args.model.store
.peekRecord('scope', this.args.model.grant_scope_id);
return this.args.model.store.peekRecord(
'scope',
this.args.model.grant_scope_id
);
}
}
@@ -8,7 +8,6 @@ import { action } from '@ember/object';
* action. Useful for rendering confirm modals and awaiting user action.
*/
export default class PendingConfirmationsComponent extends Component {
// =services
@service confirm;
@@ -36,5 +35,4 @@ export default class PendingConfirmationsComponent extends Component {
confirmation.dismiss();
return confirmation;
}
}
@@ -11,7 +11,6 @@ export default class ScopesScopeAuthenticateController extends Controller {
return [
...this.model.scopes.filter((scope) => scope.id === 'global'),
...this.model.scopes.filter((scope) => scope.id !== 'global'),
]
];
}
}
+9 -6
View File
@@ -13,11 +13,14 @@ export function confirm(confirmationTextKey) {
const confirmService = owner.lookup('service:confirm');
const intl = owner.lookup('service:intl');
const text = intl.t(confirmationTextKey);
return confirmService.confirm(text)
// If user confirmed, execute the decorated method
.then(() => method.apply(this, arguments))
// If the user denied, gracefully handle promise rejection with no-op
.catch((e) => e);
return (
confirmService
.confirm(text)
// If user confirmed, execute the decorated method
.then(() => method.apply(this, arguments))
// If the user denied, gracefully handle promise rejection with no-op
.catch((e) => e)
);
};
}
};
}
+7 -7
View File
@@ -14,9 +14,10 @@ export function notifySuccess(notification) {
const owner = getOwner(this);
const notifyService = owner.lookup('service:notify');
const intlService = owner.lookup('service:intl');
const candidateKey = (typeof notification === 'function')
? notification.apply(this, arguments)
: notification;
const candidateKey =
typeof notification === 'function'
? notification.apply(this, arguments)
: notification;
// As of now, we only use translated strings for notifications,
// but this code would support both translated and arbitrary strings.
// const text = intlService.exists(candidateKey)
@@ -27,7 +28,7 @@ export function notifySuccess(notification) {
notifyService.success(text);
return value;
};
}
};
}
/**
@@ -43,7 +44,7 @@ export function notifySuccess(notification) {
* @param {object} options
* @param {object} options.catch - defaults to false
*/
export function notifyError(notification, options={ catch: false }) {
export function notifyError(notification, options = { catch: false }) {
return function (_target, _propertyKey, desc) {
const method = desc.value;
desc.value = async function () {
@@ -53,7 +54,6 @@ export function notifyError(notification, options={ catch: false }) {
try {
return await method.apply(this, arguments);
} catch (error) {
// As of now all error notifications pass a function, but this code
// could support either a function or a string.
// const candidateKey = (typeof notification === 'function')
@@ -77,5 +77,5 @@ export function notifyError(notification, options={ catch: false }) {
}
}
};
}
};
}
+1 -1
View File
@@ -14,7 +14,7 @@ export default {
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
hour12: false
hour12: false,
},
hhmmss: {
hour: 'numeric',
+6 -3
View File
@@ -2,15 +2,18 @@ import { helper } from '@ember/component/helper';
import { assert } from '@ember/debug';
import config from '../config/environment';
export default helper(function docUrl(params/*, hash*/) {
export default helper(function docUrl(params /*, hash*/) {
const baseURL = config.documentation.baseURL;
const docKey = params[0] || '';
const configuredPath = config.documentation.topics[docKey];
if (docKey) {
assert(`
assert(
`
Documentation for "${docKey}" could not be found. Please ensure that
this key exists under "documentation" in your app config.
`, configuredPath);
`,
configuredPath
);
}
const path = configuredPath || '';
return `${baseURL}${path}`;
+3 -2
View File
@@ -1,7 +1,8 @@
import { helper } from '@ember/component/helper';
export default helper(function formatDateIsoHuman(params/*, hash*/) {
return params[0].toISOString()
export default helper(function formatDateIsoHuman(params /*, hash*/) {
return params[0]
.toISOString()
.replace('T', ' ')
.replace(/\.\d*Z/, '');
});
+1 -1
View File
@@ -1,5 +1,5 @@
import { helper } from '@ember/component/helper';
export default helper(function formatDateIso(params/*, hash*/) {
export default helper(function formatDateIso(params /*, hash*/) {
return params[0].toISOString();
});
-2
View File
@@ -6,7 +6,6 @@ import { inject as service } from '@ember/service';
* service's `isLoading` attribute.
*/
export default class extends Helper {
// =services
@service loading;
@@ -20,5 +19,4 @@ export default class extends Helper {
compute() {
return this.loading.isLoading;
}
}
+12 -12
View File
@@ -13,7 +13,7 @@ Router.map(function () {
this.route('method', { path: ':auth_method_id' });
});
this.route('scopes', function() {});
this.route('scopes', function () {});
this.route('edit');
this.route('new');
@@ -54,26 +54,26 @@ Router.map(function () {
this.route('new');
});
this.route('sessions', function() {});
this.route('sessions', function () {});
this.route('targets', function() {
this.route('target', { path: ':target_id' }, function() {
this.route('host-sets', function() {});
this.route('targets', function () {
this.route('target', { path: ':target_id' }, function () {
this.route('host-sets', function () {});
this.route('add-host-sets');
});
this.route('new');
});
this.route('host-catalogs', function() {
this.route('host-catalogs', function () {
this.route('new');
this.route('host-catalog', { path: ':host_catalog_id' }, function() {
this.route('hosts', function() {
this.route('host-catalog', { path: ':host_catalog_id' }, function () {
this.route('hosts', function () {
this.route('new');
this.route('host', { path: ':host_id' }, function() {});
this.route('host', { path: ':host_id' }, function () {});
});
this.route('host-sets', function() {
this.route('host-sets', function () {
this.route('new');
this.route('host-set', { path: ':host_set_id' }, function() {
this.route('host-set', { path: ':host_set_id' }, function () {
this.route('hosts');
this.route('add-hosts');
this.route('create-and-add-host');
@@ -84,7 +84,7 @@ Router.map(function () {
});
});
this.route('account', function() {
this.route('account', function () {
this.route('change-password');
});
});
-2
View File
@@ -2,7 +2,6 @@ import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class AccountRoute extends Route {
// =services
@service session;
@@ -15,5 +14,4 @@ export default class AccountRoute extends Route {
beforeModel() {
if (!this.session.isAuthenticated) this.transitionTo('index');
}
}
@@ -7,7 +7,6 @@ import { notifySuccess, notifyError } from '../../decorators/notify';
* The change password flow is associated only with password-type auth methods.
*/
export default class AccountChangePasswordRoute extends Route {
// =services
@service session;
@@ -53,5 +52,4 @@ export default class AccountChangePasswordRoute extends Route {
cancel() {
this.replaceWith('index');
}
}
+2 -2
View File
@@ -127,7 +127,8 @@ export default class ApplicationRoute extends Route.extend(
@action
toggleTheme(theme) {
const rootElementSelector = getOwner(this).rootElement;
const rootEl = getOwner(this).lookup('service:-document')
const rootEl = getOwner(this)
.lookup('service:-document')
.querySelector(rootElementSelector);
this.session.set('data.theme', theme);
switch (theme) {
@@ -144,5 +145,4 @@ export default class ApplicationRoute extends Route.extend(
rootEl.classList.remove('rose-theme-light');
}
}
}
+5 -2
View File
@@ -50,7 +50,8 @@ export default class ScopesScopeRoute extends Route {
async afterModel(model) {
// First, load orgs and, if necessary, projects
let orgs, projects;
orgs = await this.store.query('scope', { scope_id: 'global' })
orgs = await this.store
.query('scope', { scope_id: 'global' })
.catch(() => A([]));
if (model.isProject) {
projects = await this.store.query('scope', { scope_id: model.scopeID });
@@ -113,7 +114,9 @@ export default class ScopesScopeRoute extends Route {
@action
@loading
@notifyError(({ message }) => message)
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
@notifySuccess(({ isNew }) =>
isNew ? 'notifications.create-success' : 'notifications.save-success'
)
async save(scope) {
const { isNew } = scope;
await scope.save();
@@ -49,7 +49,9 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
@action
@loading
@notifyError(({ message }) => message)
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
@notifySuccess(({ isNew }) =>
isNew ? 'notifications.create-success' : 'notifications.save-success'
)
async save(authMethod) {
await authMethod.save();
await this.transitionTo(
@@ -45,7 +45,9 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
@action
@loading
@notifyError(({ message }) => message)
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
@notifySuccess(({ isNew }) =>
isNew ? 'notifications.create-success' : 'notifications.save-success'
)
async save(account, password) {
const { isNew } = account;
const adapterOptions = {};
@@ -2,7 +2,10 @@ import Route from '@ember/routing/route';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import loading from 'ember-loading/decorator';
import { notifySuccess, notifyError } from '../../../../../../../decorators/notify';
import {
notifySuccess,
notifyError,
} from '../../../../../../../decorators/notify';
export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSettingsRoute extends Route {
// =services
@@ -22,7 +22,7 @@ export default class ScopesScopeAuthenticateRoute extends Route {
const { id: scope_id } = this.modelFor('scopes.scope');
return hash({
scope: this.modelFor('scopes.scope'),
scopes: this.modelFor('scopes').filter(scope => scope.isOrg),
scopes: this.modelFor('scopes').filter((scope) => scope.isOrg),
authMethods: this.store.query('auth-method', { scope_id }),
// for integration testing:
-1
View File
@@ -2,7 +2,6 @@ import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ScopesScopeEditRoute extends Route {
// =services
@service session;
+3 -1
View File
@@ -49,7 +49,9 @@ export default class ScopesScopeGroupsRoute extends Route {
@action
@loading
@notifyError(({ message }) => message)
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
@notifySuccess(({ isNew }) =>
isNew ? 'notifications.create-success' : 'notifications.save-success'
)
async save(group) {
await group.save();
await this.transitionTo('scopes.scope.groups.group', group);
@@ -51,7 +51,9 @@ export default class ScopesScopeHostCatalogsRoute extends Route {
@action
@loading
@notifyError(({ message }) => message)
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
@notifySuccess(({ isNew }) =>
isNew ? 'notifications.create-success' : 'notifications.save-success'
)
async save(hostCatalog) {
await hostCatalog.save();
await this.transitionTo(
@@ -23,31 +23,22 @@ export default class ScopesScopeHostCatalogsHostCatalogRoute extends Route {
renderTemplate(controller, model) {
super.renderTemplate(...arguments);
this.render(
'scopes/scope/host-catalogs/host-catalog/-header',
{
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render('scopes/scope/host-catalogs/host-catalog/-header', {
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
model: model,
});
this.render(
'scopes/scope/host-catalogs/host-catalog/-navigation',
{
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'navigation',
model: model,
}
);
this.render('scopes/scope/host-catalogs/host-catalog/-navigation', {
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'navigation',
model: model,
});
this.render(
'scopes/scope/host-catalogs/host-catalog/-actions',
{
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'actions',
model: model,
}
);
this.render('scopes/scope/host-catalogs/host-catalog/-actions', {
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'actions',
model: model,
});
}
}
@@ -35,9 +35,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Rou
const { isNew } = hostSet;
hostSet.rollbackAttributes();
if (isNew)
this.transitionTo(
'scopes.scope.host-catalogs.host-catalog.host-sets'
);
this.transitionTo('scopes.scope.host-catalogs.host-catalog.host-sets');
}
/**
@@ -48,7 +46,9 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Rou
@action
@loading
@notifyError(({ message }) => message)
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
@notifySuccess(({ isNew }) =>
isNew ? 'notifications.create-success' : 'notifications.save-success'
)
async save(hostSet) {
await hostSet.save();
await this.transitionTo(
@@ -69,8 +69,6 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Rou
@notifySuccess('notifications.delete-success')
async deleteHostSet(hostSet) {
await hostSet.destroyRecord();
await this.replaceWith(
'scopes.scope.host-catalogs.host-catalog.host-sets'
);
await this.replaceWith('scopes.scope.host-catalogs.host-catalog.host-sets');
}
}
@@ -3,7 +3,10 @@ import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { hash } from 'rsvp';
import loading from 'ember-loading/decorator';
import { notifySuccess, notifyError } from '../../../../../../../decorators/notify';
import {
notifySuccess,
notifyError,
} from '../../../../../../../decorators/notify';
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetAddHostsRoute extends Route {
// =services
@@ -2,7 +2,10 @@ import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import loading from 'ember-loading/decorator';
import { notifySuccess, notifyError } from '../../../../../../../decorators/notify';
import {
notifySuccess,
notifyError,
} from '../../../../../../../decorators/notify';
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndAddHostRoute extends Route {
// =services
@@ -65,7 +68,9 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndA
@notifyError(({ message }) => message, { catch: true })
@notifySuccess('notifications.add-success')
async save(host) {
const hostSet = this.modelFor('scopes.scope.host-catalogs.host-catalog.host-sets.host-set');
const hostSet = this.modelFor(
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set'
);
await host.save();
await hostSet.addHost(host.id);
await this.replaceWith(
@@ -4,7 +4,10 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import loading from 'ember-loading/decorator';
import { confirm } from '../../../../../../../decorators/confirm';
import { notifySuccess, notifyError } from '../../../../../../../decorators/notify';
import {
notifySuccess,
notifyError,
} from '../../../../../../../decorators/notify';
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsRoute extends Route {
// =services
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetIndexRoute extends Route {
}
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetIndexRoute extends Route {}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeHostCatalogsHostCatalogHostSetsIndexRoute extends Route {
}
export default class ScopesScopeHostCatalogsHostCatalogHostSetsIndexRoute extends Route {}
@@ -35,9 +35,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route
const { isNew } = host;
host.rollbackAttributes();
if (isNew)
this.transitionTo(
'scopes.scope.host-catalogs.host-catalog.hosts'
);
this.transitionTo('scopes.scope.host-catalogs.host-catalog.hosts');
}
/**
@@ -48,7 +46,9 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route
@action
@loading
@notifyError(({ message }) => message)
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
@notifySuccess(({ isNew }) =>
isNew ? 'notifications.create-success' : 'notifications.save-success'
)
async save(host) {
await host.save();
await this.transitionTo(
@@ -69,9 +69,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route
@notifySuccess('notifications.delete-success')
async deleteHost(host) {
await host.destroyRecord();
await this.replaceWith(
'scopes.scope.host-catalogs.host-catalog.hosts'
);
await this.replaceWith('scopes.scope.host-catalogs.host-catalog.hosts');
this.refresh();
}
}
@@ -22,14 +22,11 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsHostRoute extends Ro
renderTemplate(controller, model) {
super.renderTemplate(...arguments);
this.render(
'scopes/scope/host-catalogs/host-catalog/hosts/host/-header',
{
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render('scopes/scope/host-catalogs/host-catalog/hosts/host/-header', {
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
model: model,
});
this.render(
'scopes/scope/host-catalogs/host-catalog/hosts/host/-navigation',
@@ -40,13 +37,10 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsHostRoute extends Ro
}
);
this.render(
'scopes/scope/host-catalogs/host-catalog/hosts/host/-actions',
{
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'actions',
model: model,
}
);
this.render('scopes/scope/host-catalogs/host-catalog/hosts/host/-actions', {
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'actions',
model: model,
});
}
}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeHostCatalogsHostCatalogHostsHostIndexRoute extends Route {
}
export default class ScopesScopeHostCatalogsHostCatalogHostsHostIndexRoute extends Route {}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeHostCatalogsHostCatalogHostsIndexRoute extends Route {
}
export default class ScopesScopeHostCatalogsHostCatalogHostsIndexRoute extends Route {}
@@ -27,14 +27,11 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsNewRoute extends Rou
renderTemplate(controller, model) {
super.renderTemplate(...arguments);
this.render(
'scopes/scope/host-catalogs/host-catalog/hosts/new/-header',
{
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render('scopes/scope/host-catalogs/host-catalog/hosts/new/-header', {
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
model: model,
});
this.render('_empty', {
into: 'scopes/scope/host-catalogs/host-catalog',
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeHostCatalogsIndexRoute extends Route {
}
export default class ScopesScopeHostCatalogsIndexRoute extends Route {}
-1
View File
@@ -2,7 +2,6 @@ import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ScopesScopeNewRoute extends Route {
// =services
@service session;
+3 -1
View File
@@ -49,7 +49,9 @@ export default class ScopesScopeRolesRoute extends Route {
@action
@loading
@notifyError(({ message }) => message)
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
@notifySuccess(({ isNew }) =>
isNew ? 'notifications.create-success' : 'notifications.save-success'
)
async save(role) {
await role.save();
await this.transitionTo('scopes.scope.roles.role', role);
@@ -1,22 +1,24 @@
import Route from '@ember/routing/route';
export default class ScopesScopeRolesRoleIndexRoute extends Route {
/**
* Load the role's scope and sub scopes into a hierarchical data structure.
* @param {Model} model
*/
async afterModel(model) {
const defaultScope = await this.store.findRecord('scope', model.scopeID);
const subScopes = (await this.store.query('scope', { scope_id: defaultScope.id }))
.map(scope => ({
model: scope,
subScopes: this.store.query('scope', { scope_id: scope.id })
}));
const grantScopes = [{
model: defaultScope,
subScopes
}];
const subScopes = (
await this.store.query('scope', { scope_id: defaultScope.id })
).map((scope) => ({
model: scope,
subScopes: this.store.query('scope', { scope_id: scope.id }),
}));
const grantScopes = [
{
model: defaultScope,
subScopes,
},
];
this.set('grantScopes', grantScopes);
}
@@ -28,5 +30,4 @@ export default class ScopesScopeRolesRoleIndexRoute extends Route {
super.setupController(...arguments);
controller.set('grantScopes', this.grantScopes);
}
}
@@ -75,5 +75,4 @@ export default class ScopesScopeRolesRolePrincipalsRoute extends Route {
await role.removePrincipal(principal.id);
this.refresh();
}
}
+4 -3
View File
@@ -29,12 +29,13 @@ export default class ScopesScopeScopesRoute extends Route {
const parentScope = !currentScope.isGlobal
? await this.store.findRecord('scope', currentScope.scopeID)
: null;
const subScopes =
await this.store.query('scope', { scope_id: currentScope.id });
const subScopes = await this.store.query('scope', {
scope_id: currentScope.id,
});
return {
currentScope,
parentScope,
subScopes
subScopes,
};
}
}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeScopesIndexRoute extends Route {
}
export default class ScopesScopeScopesIndexRoute extends Route {}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeSessionsIndexRoute extends Route {
}
export default class ScopesScopeSessionsIndexRoute extends Route {}
+3 -1
View File
@@ -51,7 +51,9 @@ export default class ScopesScopeTargetsRoute extends Route {
@action
@loading
@notifyError(({ message }) => message)
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
@notifySuccess(({ isNew }) =>
isNew ? 'notifications.create-success' : 'notifications.save-success'
)
async save(target) {
await target.save();
await this.transitionTo('scopes.scope.targets.target', target);
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeTargetsIndexRoute extends Route {
}
export default class ScopesScopeTargetsIndexRoute extends Route {}
@@ -25,9 +25,7 @@ export default class ScopesScopeTargetsTargetAddHostSetsRoute extends Route {
* @return {{target: TargetModel, hostCatalogs: [HostCatalogModel], hostSets: [HostSetModel]}}
*/
async model() {
const target = this.modelFor(
'scopes.scope.targets.target'
);
const target = this.modelFor('scopes.scope.targets.target');
const { id: scope_id } = this.modelFor('scopes.scope');
const hostCatalogs = await this.store.query('host-catalog', { scope_id });
await all(
@@ -50,13 +48,10 @@ export default class ScopesScopeTargetsTargetAddHostSetsRoute extends Route {
renderTemplate() {
super.renderTemplate(...arguments);
this.render(
'scopes/scope/targets/target/add-host-sets/-header',
{
into: 'scopes/scope/targets/target',
outlet: 'header',
}
);
this.render('scopes/scope/targets/target/add-host-sets/-header', {
into: 'scopes/scope/targets/target',
outlet: 'header',
});
this.render('-empty', {
into: 'scopes/scope/targets/target',
@@ -77,9 +72,7 @@ export default class ScopesScopeTargetsTargetAddHostSetsRoute extends Route {
@notifySuccess('notifications.add-success')
async save(target, hostSetIDs) {
await target.addHostSets(hostSetIDs);
this.replaceWith(
'scopes.scope.targets.target.host-sets'
);
this.replaceWith('scopes.scope.targets.target.host-sets');
}
/**
@@ -20,9 +20,7 @@ export default class ScopesScopeTargetsTargetHostSetsRoute extends Route {
* @return {Promise{[HostSetModel, HostCatalogModel]}}
*/
beforeModel() {
const { scopeID, host_sets } = this.modelFor(
'scopes.scope.targets.target'
);
const { scopeID, host_sets } = this.modelFor('scopes.scope.targets.target');
const promises = host_sets.map(
({ host_set_id, host_catalog_id: hostCatalogID }) =>
hash({
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeTargetsTargetIndexRoute extends Route {
}
export default class ScopesScopeTargetsTargetIndexRoute extends Route {}
+3 -1
View File
@@ -50,7 +50,9 @@ export default class ScopesScopeUsersRoute extends Route {
@action
@loading
@notifyError(({ message }) => message)
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
@notifySuccess(({ isNew }) =>
isNew ? 'notifications.create-success' : 'notifications.save-success'
)
async save(user) {
await user.save();
await this.transitionTo('scopes.scope.users.user', user);
+1 -5
View File
@@ -15,7 +15,6 @@ import config from '../config/environment';
* const confirmation = confirmationService.confirm('Text', { type: 'discard' });
*/
export default class ConfirmationsService extends Service {
// =attributes
/**
@@ -54,7 +53,6 @@ export default class ConfirmationsService extends Service {
return resolve();
}
}
}
/**
@@ -84,7 +82,6 @@ export default class ConfirmationsService extends Service {
* .finally(() => { }); // do something
*/
class Confirmation {
// =properties
/**
@@ -101,7 +98,7 @@ class Confirmation {
* @param {String} type An optional type annotation for convenience.
* Has no effect on confirmation.
*/
constructor(text, options={}) {
constructor(text, options = {}) {
this.text = text;
this.options = options;
this.#deferred = defer();
@@ -146,5 +143,4 @@ class Confirmation {
finally() {
return this.#deferred.promise.finally(...arguments);
}
}
-2
View File
@@ -6,7 +6,6 @@ import { tracked } from '@glimmer/tracking';
* the currently active scope or scopes.
*/
export default class ScopeService extends Service {
// =attributes
/**
@@ -18,5 +17,4 @@ export default class ScopeService extends Service {
* @type {ScopeModel}
*/
@tracked project;
}
+3 -3
View File
@@ -44,8 +44,8 @@
}
.rose-dropdown {
$iconWidth: sizing.rems(m) + sizing.rems(s);
$indent: $iconWidth + sizing.rems(xs);
$icon-width: sizing.rems(m) + sizing.rems(s);
$indent: $icon-width + sizing.rems(xs);
.rose-form-radio-label {
display: flex;
@@ -63,7 +63,7 @@
.indent-label-2 {
.rose-form-radio-label {
padding-left: $indent + $iconWidth;
padding-left: $indent + $icon-width;
}
}
@@ -1,4 +1,4 @@
{{title (t "actions.change-password")}}
{{page-title (t "actions.change-password")}}
<Rose::Layout::Sidebar as |sidebarLayout|>
<sidebarLayout.body>
+1 -2
View File
@@ -1,5 +1,4 @@
<HeadLayout />
{{title (app-name)}}
{{page-title (app-name)}}
<Rose::Layout::Global as |layout|>
+6 -6
View File
@@ -1,13 +1,13 @@
{{#if @model.isOrg}}
{{title (t "resources.org.title_plural") }}
{{title @model.displayName}}
{{page-title (t "resources.org.title_plural") }}
{{page-title @model.displayName}}
{{/if}}
{{#if @model.isProject}}
{{title (t "resources.org.title_plural") }}
{{title this.scopes.selectedOrg.displayName}}
{{title (t "resources.project.title_plural") }}
{{title @model.displayName}}
{{page-title (t "resources.org.title_plural") }}
{{page-title this.scopes.selectedOrg.displayName}}
{{page-title (t "resources.project.title_plural") }}
{{page-title @model.displayName}}
{{/if}}
<Rose::Layout::Sidebar as |sidebarLayout|>
@@ -1,3 +1,3 @@
{{title (t "resources.auth-method.title_plural")}}
{{page-title (t "resources.auth-method.title_plural")}}
{{outlet}}
@@ -1,4 +1,4 @@
{{title @model.displayName}}
{{page-title @model.displayName}}
<Rose::Layout::Page as |page|>
@@ -1,3 +1,3 @@
{{title (t 'resources.account.title_plural')}}
{{page-title (t 'resources.account.title_plural')}}
{{outlet}}
@@ -1,3 +1,3 @@
{{title @model.displayName}}
{{page-title @model.displayName}}
{{outlet}}
@@ -1,4 +1,4 @@
{{title (t 'actions.set-password')}}
{{page-title (t 'actions.set-password')}}
<Form::Account::Password::SetPassword
@model={{@model}}
@@ -1,4 +1,4 @@
{{title (t "titles.new")}}
{{page-title (t "titles.new")}}
<Rose::Layout::Page as |page|>
<page.header>
@@ -16,4 +16,4 @@
@cancel={{route-action "cancel" @model}}
/>
</page.body>
</Rose::Layout::Page>
</Rose::Layout::Page>
@@ -1,4 +1,4 @@
{{title (t "actions.authenticate")}}
{{page-title (t "actions.authenticate")}}
<Rose::Layout::Centered>
<Rose::Layout::Page as |page|>
+1 -1
View File
@@ -1,4 +1,4 @@
{{title (t "errors.generic.title") }}
{{page-title (t "errors.generic.title") }}
<Rose::Layout::Centered>
{{#each @model.errors as |error|}}
@@ -1,3 +1,3 @@
{{title (t "resources.group.title_plural")}}
{{page-title (t "resources.group.title_plural")}}
{{outlet}}
@@ -1,4 +1,4 @@
{{title @model.displayName}}
{{page-title @model.displayName}}
<Rose::Layout::Page as |page|>
@@ -1,4 +1,4 @@
{{title (t "resources.group.messages.add-members.title")}}
{{page-title (t "resources.group.messages.add-members.title")}}
<Form::Group::AddMembers
@model={{@model.group}}
@@ -1,4 +1,4 @@
{{title (t 'resources.group.messages.members.title')}}
{{page-title (t 'resources.group.messages.members.title')}}
{{#if @model.members}}
@@ -1,4 +1,4 @@
{{title (t 'titles.new')}}
{{page-title (t 'titles.new')}}
<Rose::Layout::Page as |page|>
@@ -1,3 +1,3 @@
{{title (t "resources.host-catalog.title_plural")}}
{{page-title (t "resources.host-catalog.title_plural")}}
{{outlet}}
@@ -1,4 +1,4 @@
{{title @model.displayName}}
{{page-title @model.displayName}}
<Rose::Layout::Page as |page|>
@@ -1,3 +1,3 @@
{{title (t "resources.host-set.title_plural")}}
{{page-title (t "resources.host-set.title_plural")}}
{{outlet}}
@@ -1,3 +1,3 @@
{{title @model.displayName}}
{{page-title @model.displayName}}
{{outlet}}
@@ -1,4 +1,4 @@
{{title (t "resources.host-set.actions.add-hosts")}}
{{page-title (t "resources.host-set.actions.add-hosts")}}
<Form::HostSet::AddHosts
@model={{@model.hostSet}}
@@ -1,4 +1,4 @@
{{title (t 'resources.host-set.actions.create-and-add-host')}}
{{page-title (t 'resources.host-set.actions.create-and-add-host')}}
<Form::Host
@model={{@model}}
@@ -1,4 +1,4 @@
{{title (t "resources.host.title_plural")}}
{{page-title (t "resources.host.title_plural")}}
{{#if @model.hosts}}
@@ -1,4 +1,4 @@
{{title (t 'titles.new')}}
{{page-title (t 'titles.new')}}
<Form::HostSet
@model={{@model}}
@@ -1,3 +1,3 @@
{{title (t "resources.host.title_plural")}}
{{page-title (t "resources.host.title_plural")}}
{{outlet}}
@@ -1,3 +1,3 @@
{{title @model.displayName}}
{{page-title @model.displayName}}
{{outlet}}
@@ -1,4 +1,4 @@
{{title (t 'titles.new')}}
{{page-title (t 'titles.new')}}
<Form::Host
@model={{@model}}
@@ -1,4 +1,4 @@
{{title (t 'titles.new')}}
{{page-title (t 'titles.new')}}
<Rose::Layout::Page as |page|>
+1 -1
View File
@@ -1,4 +1,4 @@
{{title (t 'titles.new')}}
{{page-title (t 'titles.new')}}
<Rose::Layout::Page as |page|>
+1 -1
View File
@@ -1,3 +1,3 @@
{{title (t "resources.role.title_plural")}}
{{page-title (t "resources.role.title_plural")}}
{{outlet}}
@@ -1,4 +1,4 @@
{{title (t 'titles.new')}}
{{page-title (t 'titles.new')}}
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
@@ -1,4 +1,4 @@
{{title @model.displayName}}
{{page-title @model.displayName}}
<Rose::Layout::Page as |page|>
@@ -1,4 +1,4 @@
{{title (t "resources.role.principal.actions.add-principals")}}
{{page-title (t "resources.role.principal.actions.add-principals")}}
<Form::Role::AddPrincipals
@model={{@model.role}}
@@ -1,4 +1,4 @@
{{title (t 'resources.role.grant.title_plural')}}
{{page-title (t 'resources.role.grant.title_plural')}}
<Form::Role::Grants
@model={{@model}}
@@ -1,4 +1,4 @@
{{title (t 'resources.role.principal.title_plural')}}
{{page-title (t 'resources.role.principal.title_plural')}}
{{#if @model.principals}}
@@ -64,4 +64,4 @@
</Rose::Message>
</Rose::Layout::Centered>
{{/if}}
{{/if}}
@@ -1,9 +1,9 @@
{{#if @model.currentScope.isGlobal}}
{{title (t "resources.org.title_plural") }}
{{page-title (t "resources.org.title_plural") }}
{{/if}}
{{#if @model.currentScope.isOrg}}
{{title (t "resources.project.title_plural") }}
{{page-title (t "resources.project.title_plural") }}
{{/if}}
{{outlet}}
@@ -1,3 +1,3 @@
{{title (t "resources.session.title_plural")}}
{{page-title (t "resources.session.title_plural")}}
{{outlet}}
@@ -1,3 +1,3 @@
{{title (t "resources.target.title_plural")}}
{{page-title (t "resources.target.title_plural")}}
{{outlet}}
@@ -1,4 +1,4 @@
{{title (t 'titles.new')}}
{{page-title (t 'titles.new')}}
<Rose::Layout::Page as |page|>
@@ -1,4 +1,4 @@
{{title @model.displayName}}
{{page-title @model.displayName}}
<Rose::Layout::Page as |page|>
@@ -1,4 +1,4 @@
{{title (t 'resources.target.actions.add-host-sets')}}
{{page-title (t 'resources.target.actions.add-host-sets')}}
{{#if @model.hostSets}}
<Form::Target::AddHostSets
@@ -1,4 +1,4 @@
{{title (t "resources.host-set.title_plural")}}
{{page-title (t "resources.host-set.title_plural")}}
{{#if @model.hostSets}}
+1 -1
View File
@@ -1,3 +1,3 @@
{{title (t "resources.user.title_plural")}}
{{page-title (t "resources.user.title_plural")}}
{{outlet}}
@@ -1,4 +1,4 @@
{{title (t 'titles.new')}}
{{page-title (t 'titles.new')}}
<Rose::Layout::Page as |page|>
Loaded 100 of 216 files, more files were not shown because too many files have changed in this diff. Show more