style: format ui/core

This commit is contained in:
Susmitha Girumala committed 2020-09-16 14:33:04 -04:00
1 parent e3366998c5
commit f4daaa45a9
165 files changed
+1075 -785

No files matched your search

+7 -8
View File
@@ -50,12 +50,11 @@ export default class PasswordAuthenticator extends BasePasswordAuthenticator {
* @override
*/
authenticate() {
return super.authenticate(...arguments)
.then(data => {
const token = data?.token;
if (token) this.addTokenToAuthorization(token);
return data;
});
return super.authenticate(...arguments).then((data) => {
const token = data?.token;
if (token) this.addTokenToAuthorization(token);
return data;
});
}
/**
@@ -78,8 +77,8 @@ export default class PasswordAuthenticator extends BasePasswordAuthenticator {
* @param {string} token
*/
addTokenToAuthorization(token) {
const adapterPrototype =
this.store.adapterFor('application').constructor.prototype;
const adapterPrototype = this.store.adapterFor('application').constructor
.prototype;
const headers = adapterPrototype?.headers;
if (!headers) adapterPrototype.headers = {};
adapterPrototype.headers.Authorization = null;
@@ -4,7 +4,6 @@ import { action } from '@ember/object';
import { next } from '@ember/runloop';
export default class FormAccountPasswordIndexComponent extends Component {
// =properties
/**
@@ -5,7 +5,6 @@ import { action } from '@ember/object';
import { next } from '@ember/runloop';
export default class FormAccountPasswordSetPasswordIndexComponent extends Component {
// =properties
/**
@@ -54,5 +53,4 @@ export default class FormAccountPasswordSetPasswordIndexComponent extends Compon
this.resetPassword();
fn();
}
}
@@ -3,7 +3,6 @@ import { computed, action } from '@ember/object';
import { A } from '@ember/array';
export default class FormGroupAddMembersComponent extends Component {
// =properties
/**
@@ -38,5 +37,4 @@ export default class FormGroupAddMembersComponent extends Component {
submit(fn) {
fn(this.selectedMemberIDs);
}
}
@@ -3,7 +3,6 @@ import { computed, action } from '@ember/object';
import { A } from '@ember/array';
export default class FormHostSetAddHostsIndexComponent extends Component {
// =properties
/**
@@ -28,7 +27,7 @@ export default class FormHostSetAddHostsIndexComponent extends Component {
*/
@computed('args.{model,hosts}')
get filteredHosts() {
const currentHostIDs = this.args.model.host_ids.map(host => host.value);
const currentHostIDs = this.args.model.host_ids.map((host) => host.value);
return this.args.hosts.filter(({ id }) => !currentHostIDs.includes(id));
}
@@ -2,7 +2,6 @@ import Component from '@glimmer/component';
import { computed } from '@ember/object';
export default class FormHostSetHostsComponent extends Component {
// =attributes
/**
@@ -14,10 +13,9 @@ export default class FormHostSetHostsComponent extends Component {
@computed('args.{hosts.[],model.host_ids.[]}')
get options() {
const { hosts, model: hostSet } = this.args;
return hosts.map(host => ({
return hosts.map((host) => ({
host,
selected: Boolean(hostSet.host_ids.findBy('value', host.id))
selected: Boolean(hostSet.host_ids.findBy('value', host.id)),
}));
}
}
@@ -3,8 +3,6 @@ import { computed, action } from '@ember/object';
import { A } from '@ember/array';
export default class FormRoleAddPrincipalsIndexComponent extends Component {
// =properties
/**
@@ -31,10 +29,16 @@ export default class FormRoleAddPrincipalsIndexComponent extends Component {
@computed('args.{model,users,groups}')
get filteredPrincipals() {
// Retrieve principal IDs assigned to current role
const currentPrincipalIDs = this.args.model.principals.map(principal => principal.principal_id);
const currentPrincipalIDs = this.args.model.principals.map(
(principal) => principal.principal_id
);
// Retrieve principal IDs not assigned to current role
const unassignedUsers = this.args.users.filter(({ id }) => !currentPrincipalIDs.includes(id));
const unassignedGroups = this.args.groups.filter(({ id }) => !currentPrincipalIDs.includes(id));
const unassignedUsers = this.args.users.filter(
({ id }) => !currentPrincipalIDs.includes(id)
);
const unassignedGroups = this.args.groups.filter(
({ id }) => !currentPrincipalIDs.includes(id)
);
return [...unassignedUsers, ...unassignedGroups];
}
@@ -53,5 +57,4 @@ export default class FormRoleAddPrincipalsIndexComponent extends Component {
submit(fn) {
fn(this.selectedPrincipalIDs);
}
}
@@ -3,7 +3,6 @@ import { tracked } from '@glimmer/tracking';
import { computed, action } from '@ember/object';
export default class FormRoleGrantsComponent extends Component {
// =attributes
/**
@@ -3,7 +3,6 @@ import { computed, action } from '@ember/object';
import { A } from '@ember/array';
export default class FormTargetAddHostSetsComponent extends Component {
// =properties
/**
@@ -19,10 +18,12 @@ export default class FormTargetAddHostSetsComponent extends Component {
@computed('args.{hostSets.[],model.host_sets.[]}')
get filteredHostSets() {
// Get IDs for host sets already added to the current target
const alreadyAddedHostSetIDs = this.args.model.host_sets
.map(({ host_set_id }) => host_set_id);
const notAddedHostSets = this.args.hostSets
.filter(({ id }) => !alreadyAddedHostSetIDs.includes(id));
const alreadyAddedHostSetIDs = this.args.model.host_sets.map(
({ host_set_id }) => host_set_id
);
const notAddedHostSets = this.args.hostSets.filter(
({ id }) => !alreadyAddedHostSetIDs.includes(id)
);
return notAddedHostSets;
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeAuthMethodsAuthMethodAccountsController extends Controller {
// =services
@service intl;
@@ -16,5 +15,4 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsController extends
get breadCrumb() {
return this.intl.t('resources.accounts');
}
}
@@ -1,7 +1,6 @@
import Controller from '@ember/controller';
export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountController extends Controller {
// =attributes
/**
@@ -11,5 +10,4 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountController e
get breadCrumb() {
return this.model.displayName;
}
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeAuthMethodsAuthMethodAccountsNewController extends Controller {
// =services
@service intl;
@@ -16,5 +15,4 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsNewController exten
get breadCrumb() {
return this.intl.t('titles.new');
}
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { sort } from '@ember/object/computed';
export default class ScopesScopeAuthenticateController extends Controller {
// =attributes
/**
@@ -17,5 +16,4 @@ export default class ScopesScopeAuthenticateController extends Controller {
return 0;
})
sortedScopes;
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeGroupsGroupAddMembersController extends Controller {
// =services
@service intl;
@@ -16,5 +15,4 @@ export default class ScopesScopeGroupsGroupAddMembersController extends Controll
get breadCrumb() {
return this.intl.t('actions.add-members');
}
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsController extends Controller {
// =services
@service intl;
@@ -15,5 +14,4 @@ export default class ScopesScopeProjectsProjectHostCatalogsController extends Co
get breadCrumb() {
return this.intl.t('resources.host-catalogs');
}
}
@@ -1,7 +1,6 @@
import Controller from '@ember/controller';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogController extends Controller {
// =attributes
/**
@@ -10,5 +9,4 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogController
get breadCrumb() {
return this.model.displayName;
}
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsController extends Controller {
// =services
@service intl;
@@ -16,5 +15,4 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsCo
get breadCrumb() {
return this.intl.t('resources.host-sets');
}
}
@@ -1,7 +1,6 @@
import Controller from '@ember/controller';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetController extends Controller {
// =attributes
/**
@@ -11,5 +10,4 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
get breadCrumb() {
return this.model.displayName;
}
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNewController extends Controller {
// =services
@service intl;
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsController extends Controller {
// =services
@service intl;
@@ -16,5 +15,4 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsContr
get breadCrumb() {
return this.intl.t('resources.hosts');
}
}
@@ -1,7 +1,6 @@
import Controller from '@ember/controller';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostController extends Controller {
// =attributes
/**
@@ -11,5 +10,4 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostC
get breadCrumb() {
return this.model.displayName;
}
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewController extends Controller {
// =services
@service intl;
@@ -16,5 +15,4 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewCo
get breadCrumb() {
return this.intl.t('titles.new');
}
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsNewController extends Controller {
// =services
@service intl;
@@ -16,5 +15,4 @@ export default class ScopesScopeProjectsProjectHostCatalogsNewController extends
get breadCrumb() {
return this.intl.t('titles.new');
}
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectTargetsController extends Controller {
// =services
@service intl;
@@ -16,5 +15,4 @@ export default class ScopesScopeProjectsProjectTargetsController extends Control
get breadCrumb() {
return this.intl.t('resources.targets');
}
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectTargetsNewController extends Controller {
// =services
@service intl;
@@ -16,5 +15,4 @@ export default class ScopesScopeProjectsProjectTargetsNewController extends Cont
get breadCrumb() {
return this.intl.t('titles.new');
}
}
@@ -1,7 +1,6 @@
import Controller from '@ember/controller';
export default class ScopesScopeProjectsProjectTargetsTargetController extends Controller {
// =attributes
/**
@@ -11,5 +10,4 @@ export default class ScopesScopeProjectsProjectTargetsTargetController extends C
get breadCrumb() {
return this.model.displayName;
}
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsController extends Controller {
// =services
@service intl;
@@ -15,5 +14,4 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsControlle
get breadCrumb() {
return this.intl.t('actions.add-host-sets');
}
}
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectTargetsTargetHostSetsController extends Controller {
// =services
@service intl;
@@ -2,7 +2,6 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeRolesRoleAddPrincipalsController extends Controller {
// =services
@service intl;
@@ -16,5 +15,4 @@ export default class ScopesScopeRolesRoleAddPrincipalsController extends Control
get breadCrumb() {
return this.intl.t('actions.add-principals');
}
}
+32 -26
View File
@@ -9,37 +9,44 @@ export default class Router extends EmberRouter {
Router.map(function () {
this.route('scopes', function () {
this.route('scope', { path: ':scope_id' }, function () {
this.route('authenticate', function () {
this.route('method', { path: ':auth_method_id' });
});
this.route('orgs', function() {
this.route('orgs', function () {
this.route('new');
});
this.route('projects', function() {
this.route('project', { path: ':project_id' }, function() {
this.route('host-catalogs', function() {
this.route('projects', function () {
this.route('project', { path: ':project_id' }, function () {
this.route('host-catalogs', function () {
this.route('new');
this.route('host-catalog', { path: ':host_catalog_id' }, function() {
this.route('host-sets', function() {
this.route('host-set', { path: ':host_set_id' }, function() {
this.route('hosts');
this.route('add-hosts');
this.route(
'host-catalog',
{ path: ':host_catalog_id' },
function () {
this.route('host-sets', function () {
this.route('host-set', { path: ':host_set_id' }, function () {
this.route('hosts');
this.route('add-hosts');
});
this.route('new');
});
this.route('new');
});
this.route('hosts', function() {
this.route('host', { path: ':host_id' }, function() {});
this.route('new');
});
});
this.route('hosts', function () {
this.route('host', { path: ':host_id' }, function () {});
this.route('new');
});
}
);
});
this.route('targets', function() {
this.route('target', { path: ':target_id' }, function() {
this.route('host-sets', function() {
this.route('host-set', { path: ':host_set_id'}, function() {});
this.route('targets', function () {
this.route('target', { path: ':target_id' }, function () {
this.route('host-sets', function () {
this.route(
'host-set',
{ path: ':host_set_id' },
function () {}
);
});
this.route('add-host-sets');
});
@@ -71,10 +78,10 @@ Router.map(function () {
this.route('new');
});
this.route('auth-methods', function() {
this.route('auth-method', { path: ':auth_method_id' }, function() {
this.route('accounts', function() {
this.route('account', { path: ':account_id' }, function() {
this.route('auth-methods', function () {
this.route('auth-method', { path: ':auth_method_id' }, function () {
this.route('accounts', function () {
this.route('account', { path: ':account_id' }, function () {
this.route('set-password');
});
this.route('new');
@@ -82,7 +89,6 @@ Router.map(function () {
});
this.route('new');
});
});
});
});
+3 -4
View File
@@ -2,7 +2,6 @@ import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ScopesScopeRoute extends Route {
// =services
@service intl;
@@ -29,9 +28,9 @@ export default class ScopesScopeRoute extends Route {
if (type === 'global') {
scopeOptions.name = this.intl.t('titles.global');
}
return maybeExistingScope ||
this.store.createRecord('scope', scopeOptions);
return (
maybeExistingScope || this.store.createRecord('scope', scopeOptions)
);
});
}
}
@@ -48,8 +48,10 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
const { isNew } = authMethod;
try {
await authMethod.save();
await this
.transitionTo('scopes.scope.auth-methods.auth-method', authMethod);
await this.transitionTo(
'scopes.scope.auth-methods.auth-method',
authMethod
);
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
@@ -3,7 +3,6 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route {
// =services
@service intl;
@@ -16,8 +15,9 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
* @return {Promise{[AccountModel]}}
*/
model() {
const { id: auth_method_id } =
this.modelFor('scopes.scope.auth-methods.auth-method');
const { id: auth_method_id } = this.modelFor(
'scopes.scope.auth-methods.auth-method'
);
return this.store.query('account', { auth_method_id });
}
@@ -31,7 +31,8 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
cancel(account) {
const { isNew } = account;
account.rollbackAttributes();
if (isNew) this.transitionTo('scopes.scope.auth-methods.auth-method.accounts');
if (isNew)
this.transitionTo('scopes.scope.auth-methods.auth-method.accounts');
}
/**
@@ -42,10 +43,15 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
async save(account, password) {
const { isNew } = account;
const adapterOptions = {};
if(isNew) { adapterOptions.password = password; }
if (isNew) {
adapterOptions.password = password;
}
try {
await account.save({ adapterOptions });
await this.transitionTo('scopes.scope.auth-methods.auth-method.accounts.account', account);
await this.transitionTo(
'scopes.scope.auth-methods.auth-method.accounts.account',
account
);
this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
@@ -1,7 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountRoute extends Route {
// =methods
/**
@@ -21,20 +20,28 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountRoute extend
renderTemplate() {
super.renderTemplate(...arguments);
this.render('scopes/scope/auth-methods/auth-method/accounts/account/-header', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'header'
});
this.render(
'scopes/scope/auth-methods/auth-method/accounts/account/-header',
{
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'header',
}
);
this.render('scopes/scope/auth-methods/auth-method/accounts/account/-actions', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'actions'
});
this.render(
'scopes/scope/auth-methods/auth-method/accounts/account/-actions',
{
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'actions',
}
);
this.render('scopes/scope/auth-methods/auth-method/accounts/account/-navigation', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'navigation'
});
this.render(
'scopes/scope/auth-methods/auth-method/accounts/account/-navigation',
{
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'navigation',
}
);
}
}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountIndexRoute extends Route {
}
export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountIndexRoute extends Route {}
@@ -3,7 +3,6 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSettingsRoute extends Route {
// =services
@service intl;
@@ -17,10 +16,13 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSettingsRout
*/
renderTemplate() {
super.renderTemplate(...arguments);
this.render('scopes/scope/auth-methods/auth-method/accounts/account/set-password/-header', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'header'
});
this.render(
'scopes/scope/auth-methods/auth-method/accounts/account/set-password/-header',
{
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'header',
}
);
}
// =actions
@@ -34,10 +36,10 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSettingsRout
async setPassword(account, password) {
try {
await account.setPassword(password);
await this.replaceWith('scopes.scope.auth-methods.auth-method.accounts.account.set-password');
this.notify.success(
this.intl.t('notify.save-success')
await this.replaceWith(
'scopes.scope.auth-methods.auth-method.accounts.account.set-password'
);
this.notify.success(this.intl.t('notify.save-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -49,6 +51,8 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSettingsRout
*/
@action
cancel() {
this.replaceWith('scopes.scope.auth-methods.auth-method.accounts.account.set-password');
this.replaceWith(
'scopes.scope.auth-methods.auth-method.accounts.account.set-password'
);
}
}
@@ -1,7 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeAuthMethodsAuthMethodAccountsNewRoute extends Route {
// =methods
/**
@@ -9,11 +8,12 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsNewRoute extends Ro
* @return {AccountModel}
*/
model() {
const { id: auth_method_id } =
this.modelFor('scopes.scope.auth-methods.auth-method');
const { id: auth_method_id } = this.modelFor(
'scopes.scope.auth-methods.auth-method'
);
return this.store.createRecord('account', {
type: 'password',
auth_method_id
auth_method_id,
});
}
@@ -26,18 +26,17 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsNewRoute extends Ro
this.render('scopes/scope/auth-methods/auth-method/accounts/new/-header', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'header'
outlet: 'header',
});
this.render('_empty', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'actions'
outlet: 'actions',
});
this.render('_empty', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'navigation'
outlet: 'navigation',
});
}
}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeAuthMethodsAuthMethodIndexRoute extends Route {
}
export default class ScopesScopeAuthMethodsAuthMethodIndexRoute extends Route {}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeAuthMethodsIndexRoute extends Route {
}
export default class ScopesScopeAuthMethodsIndexRoute extends Route {}
@@ -1,7 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeAuthMethodsNewRoute extends Route {
// =methods
/**
@@ -12,8 +11,7 @@ export default class ScopesScopeAuthMethodsNewRoute extends Route {
const scopeModel = this.modelFor('scopes.scope');
return this.store.createRecord('auth-method', {
scopeModel,
type: 'password'
type: 'password',
});
}
}
@@ -1,7 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeGroupsGroupRoute extends Route {
// =methods
/**
@@ -23,17 +22,17 @@ export default class ScopesScopeGroupsGroupRoute extends Route {
this.render('scopes/scope/groups/group/-header', {
into: 'scopes/scope/groups/group',
outlet: 'header'
outlet: 'header',
});
this.render('scopes/scope/groups/group/-actions', {
into: 'scopes/scope/groups/group',
outlet: 'actions'
outlet: 'actions',
});
this.render('scopes/scope/groups/group/-navigation', {
into: 'scopes/scope/groups/group',
outlet: 'navigation'
outlet: 'navigation',
});
}
}
@@ -4,7 +4,6 @@ import { action } from '@ember/object';
import { hash } from 'rsvp';
export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
// =services
@service intl;
@@ -28,7 +27,7 @@ export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
const { scopeID: scope_id } = group;
return hash({
group: this.modelFor('scopes.scope.groups.group'),
users: this.store.query('user', { scope_id })
users: this.store.query('user', { scope_id }),
});
}
@@ -41,17 +40,17 @@ export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
this.render('scopes/scope/groups/group/add-members/-header', {
into: 'scopes/scope/groups/group',
outlet: 'header'
outlet: 'header',
});
this.render('-empty', {
into: 'scopes/scope/groups/group',
outlet: 'actions'
outlet: 'actions',
});
this.render('-empty', {
into: 'scopes/scope/groups/group',
outlet: 'navigation'
outlet: 'navigation',
});
}
@@ -82,5 +81,4 @@ export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
cancel() {
this.replaceWith('scopes.scope.groups.group.members');
}
}
@@ -4,7 +4,6 @@ import { inject as service } from '@ember/service';
import { hash, all } from 'rsvp';
export default class ScopesScopeGroupsGroupMembersRoute extends Route {
// =services
@service intl;
@@ -21,9 +20,11 @@ export default class ScopesScopeGroupsGroupMembersRoute extends Route {
const group = this.modelFor('scopes.scope.groups.group');
return hash({
group,
members: all(group.member_ids.map(id =>
this.store.findRecord('user', id, { adapterOptions: { scopeID } })
))
members: all(
group.member_ids.map((id) =>
this.store.findRecord('user', id, { adapterOptions: { scopeID } })
)
),
});
}
@@ -45,5 +46,4 @@ export default class ScopesScopeGroupsGroupMembersRoute extends Route {
this.notify.error(error.message, { closeAfter: null });
}
}
}
-2
View File
@@ -3,7 +3,6 @@ import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class ScopesScopeOrgsRoute extends Route {
// =services
@service intl;
@@ -60,5 +59,4 @@ export default class ScopesScopeOrgsRoute extends Route {
this.notify.error(error.message, { closeAfter: null });
}
}
}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeOrgsIndexRoute extends Route {
}
export default class ScopesScopeOrgsIndexRoute extends Route {}
@@ -1,7 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeOrgsNewRoute extends Route {
// =methods
/**
@@ -14,5 +13,4 @@ export default class ScopesScopeOrgsNewRoute extends Route {
scopeID: 'global',
});
}
}
@@ -25,7 +25,7 @@ export default class ScopesScopeProjectsProjectRoute extends Route {
this.render('scopes/scope/projects/project/_sidebar', {
into: 'scopes/scope',
outlet: 'sidebar',
model: model
model: model,
});
}
}
@@ -3,7 +3,6 @@ import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route {
// =services
@service intl;
@@ -11,7 +10,6 @@ export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route {
// =methods
/**
* Loads all host catalogs under the current scope.
* @return {Promise{[HostCatalogModel]}}
@@ -48,7 +46,10 @@ export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route {
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
);
this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog', hostCatalog);
this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog',
hostCatalog
);
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -71,5 +72,4 @@ export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route {
this.notify.error(error.message, { closeAfter: null });
}
}
}
@@ -1,7 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute extends Route {
// =methods
/**
@@ -23,22 +22,31 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute exte
renderTemplate(controller, model) {
super.renderTemplate(...arguments);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/-header', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
model: model
});
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/-navigation', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'navigation',
model: model
});
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/-navigation',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'navigation',
model: model,
}
);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/-actions', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'actions',
model: model
});
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/-actions',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'actions',
model: model,
}
);
}
}
@@ -15,8 +15,9 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo
* @return {Promise{[HostSetModel]}}
*/
model() {
const { id: host_catalog_id } =
this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog');
const { id: host_catalog_id } = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
);
return this.store.query('host-set', { host_catalog_id });
}
@@ -30,7 +31,10 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo
cancel(hostSet) {
const { isNew } = hostSet;
hostSet.rollbackAttributes();
if (isNew) this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.host-sets');
if (isNew)
this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets'
);
}
/**
@@ -43,7 +47,10 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo
try {
const { isNew } = hostSet;
await hostSet.save();
await this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set', hostSet);
await this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set',
hostSet
);
await this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
@@ -63,7 +70,9 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo
try {
await hostSet.destroyRecord();
this.notify.success(this.intl.t('notify.delete-success'));
this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.host-sets');
this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets'
);
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -22,22 +22,31 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
renderTemplate(controller, model) {
super.renderTemplate(...arguments);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/-header', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
model: model
});
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/-navigation', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'navigation',
model: model
});
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/-navigation',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'navigation',
model: model,
}
);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/-actions', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'actions',
model: model
});
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/-actions',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'actions',
model: model,
}
);
}
}
@@ -4,7 +4,6 @@ import { action } from '@ember/object';
import { hash } from 'rsvp';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetAddHostsRoute extends Route {
// =services
@service intl;
@@ -24,10 +23,14 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
* @return {Promise{HostSetModel,[HostModel]}}
*/
async model() {
const { id: host_catalog_id } = this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog');
const { id: host_catalog_id } = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
);
return hash({
hostSet: this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set'),
hosts: this.store.query('host', { host_catalog_id })
hostSet: this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set'
),
hosts: this.store.query('host', { host_catalog_id }),
});
}
@@ -39,10 +42,13 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
renderTemplate() {
super.renderTemplate(...arguments);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts/-header', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
});
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
}
);
this.render('-empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
@@ -84,10 +90,10 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
async addHosts(hostSet, hostIDs) {
try {
await hostSet.addHosts(hostIDs);
await this.replaceWith('scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts');
this.notify.success(
this.intl.t('notify.save-success')
await this.replaceWith(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts'
);
this.notify.success(this.intl.t('notify.save-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -99,6 +105,8 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
*/
@action
cancel() {
this.replaceWith('scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts');
this.replaceWith(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts'
);
}
}
@@ -4,7 +4,6 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetHostsRoute extends Route {
// =services
@service intl;
@@ -17,12 +16,16 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
* @return {Promise{HostSetModel,[HostModel]}}
*/
async model() {
const hostSet = this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set');
const hostSet = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set'
);
return hash({
hostSet,
hosts: all(hostSet.host_ids.map(host =>
this.store.findRecord('host', host.value, { reload: true })
))
hosts: all(
hostSet.host_ids.map((host) =>
this.store.findRecord('host', host.value, { reload: true })
)
),
});
}
@@ -35,8 +38,12 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
async removeHost(hostSet, host) {
try {
const scopeID = this.modelFor('scopes.scope.projects.project').id;
const hostCatalogID = this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog').id;
await hostSet.removeHost(host.id, { adapterOptions : { scopeID, hostCatalogID } });
const hostCatalogID = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
).id;
await hostSet.removeHost(host.id, {
adapterOptions: { scopeID, hostCatalogID },
});
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
} catch (error) {
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetIndexRoute extends Route {
}
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetIndexRoute extends Route {}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsIndexRoute extends Route {
}
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsIndexRoute extends Route {}
@@ -1,7 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNewRoute extends Route {
// =methods
/**
@@ -9,11 +8,12 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNe
* @return {HostSetModel}
*/
model() {
const { id: host_catalog_id } =
this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog');
const { id: host_catalog_id } = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
);
return this.store.createRecord('host-set', {
type: 'static',
host_catalog_id
host_catalog_id,
});
}
@@ -26,22 +26,25 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNe
renderTemplate(controller, model) {
super.renderTemplate(...arguments);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-header', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
model: model
});
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render('_empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'navigation',
model: model
model: model,
});
this.render('_empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'actions',
model: model
model: model,
});
}
}
@@ -15,8 +15,9 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute
* @return {Promise{[HostModel]}}
*/
model() {
const { id: host_catalog_id } =
this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog');
const { id: host_catalog_id } = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
);
return this.store.query('host', { host_catalog_id });
}
@@ -30,7 +31,10 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute
cancel(host) {
const { isNew } = host;
host.rollbackAttributes();
if (isNew) this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.hosts');
if (isNew)
this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog.hosts'
);
}
/**
@@ -43,7 +47,10 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute
try {
const { isNew } = host;
await host.save();
await this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.hosts.host', host);
await this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog.hosts.host',
host
);
await this.refresh();
this.notify.success(
this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success')
@@ -64,7 +71,9 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute
await host.destroyRecord();
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.hosts');
this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog.hosts'
);
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
@@ -22,22 +22,31 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostR
renderTemplate(controller, model) {
super.renderTemplate(...arguments);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/hosts/-header', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
model: model
});
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/hosts/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/hosts/-navigation', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'navigation',
model: model
});
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/hosts/-navigation',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'navigation',
model: model,
}
);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/hosts/-actions', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'actions',
model: model
});
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/hosts/-actions',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'actions',
model: model,
}
);
}
}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostIndexRoute extends Route {
}
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostIndexRoute extends Route {}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsIndexRoute extends Route {
}
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsIndexRoute extends Route {}
@@ -1,7 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewRoute extends Route {
// =methods
/**
@@ -9,11 +8,12 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewRo
* @return {HostModel}
*/
model() {
const { id: host_catalog_id } =
this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog');
const { id: host_catalog_id } = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
);
return this.store.createRecord('host', {
type: 'static',
host_catalog_id
host_catalog_id,
});
}
@@ -26,22 +26,25 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewRo
renderTemplate(controller, model) {
super.renderTemplate(...arguments);
this.render('scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new/-header', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
model: model
});
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render('_empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'navigation',
model: model
model: model,
});
this.render('_empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
outlet: 'actions',
model: model
model: model,
});
}
}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogIndexRoute extends Route {
}
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogIndexRoute extends Route {}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsIndexRoute extends Route {
}
export default class ScopesScopeProjectsProjectHostCatalogsIndexRoute extends Route {}
@@ -1,7 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsNewRoute extends Route {
// =methods
/**
@@ -12,8 +11,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsNewRoute extends Rout
const scopeModel = this.modelFor('scopes.scope.projects.project');
return this.store.createRecord('host-catalog', {
type: 'static',
scopeModel
scopeModel,
});
}
}
@@ -3,7 +3,6 @@ import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class ScopesScopeProjectsProjectTargetsRoute extends Route {
// =services
@service intl;
@@ -70,5 +69,4 @@ export default class ScopesScopeProjectsProjectTargetsRoute extends Route {
this.notify.error(error.message, { closeAfter: null });
}
}
}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsIndexRoute extends Route {
}
export default class ScopesScopeProjectsProjectTargetsIndexRoute extends Route {}
@@ -1,7 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsNewRoute extends Route {
// =methods
/**
@@ -12,8 +11,7 @@ export default class ScopesScopeProjectsProjectTargetsNewRoute extends Route {
const scopeModel = this.modelFor('scopes.scope.projects.project');
return this.store.createRecord('target', {
type: 'tcp',
scopeModel
scopeModel,
});
}
}
@@ -1,7 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsTargetRoute extends Route {
// =methods
/**
@@ -37,5 +36,4 @@ export default class ScopesScopeProjectsProjectTargetsTargetRoute extends Route
outlet: 'actions',
});
}
}
@@ -4,7 +4,6 @@ import { action } from '@ember/object';
import { all } from 'rsvp';
export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute extends Route {
// =services
@service intl;
@@ -24,18 +23,21 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute ext
* @return {{target: TargetModel, hostCatalogs: [HostCatalogModel], hostSets: [HostSetModel]}}
*/
async model() {
const target =
this.modelFor('scopes.scope.projects.project.targets.target');
const target = this.modelFor(
'scopes.scope.projects.project.targets.target'
);
const { id: scope_id } = this.modelFor('scopes.scope.projects.project');
const hostCatalogs = await this.store.query('host-catalog', { scope_id });
await all(hostCatalogs.map(({ id: host_catalog_id }) =>
this.store.query('host-set', { host_catalog_id })
));
await all(
hostCatalogs.map(({ id: host_catalog_id }) =>
this.store.query('host-set', { host_catalog_id })
)
);
const hostSets = this.store.peekAll('host-set');
return {
target,
hostCatalogs,
hostSets
hostSets,
};
}
@@ -46,10 +48,13 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute ext
renderTemplate() {
super.renderTemplate(...arguments);
this.render('scopes/scope/projects/project/targets/target/add-host-sets/-header', {
into: 'scopes/scope/projects/project/targets/target',
outlet: 'header',
});
this.render(
'scopes/scope/projects/project/targets/target/add-host-sets/-header',
{
into: 'scopes/scope/projects/project/targets/target',
outlet: 'header',
}
);
this.render('-empty', {
into: 'scopes/scope/projects/project/targets/target',
@@ -68,7 +73,9 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute ext
async save(target, hostSetIDs) {
try {
await target.addHostSets(hostSetIDs);
this.replaceWith('scopes.scope.projects.project.targets.target.host-sets');
this.replaceWith(
'scopes.scope.projects.project.targets.target.host-sets'
);
this.notify.success(this.intl.t('notify.save-success'));
} catch (error) {
// TODO: replace with translated strings
@@ -3,7 +3,6 @@ import { all, hash } from 'rsvp';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extends Route {
// =services
@@ -18,26 +17,23 @@ export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extend
* @return {Promise{[HostSetModel, HostCatalogModel]}}
*/
beforeModel() {
const { scopeID, host_sets } =
this.modelFor('scopes.scope.projects.project.targets.target');
const promises = host_sets
.map(({ host_set_id, host_catalog_id: hostCatalogID }) =>
const { scopeID, host_sets } = this.modelFor(
'scopes.scope.projects.project.targets.target'
);
const promises = host_sets.map(
({ host_set_id, host_catalog_id: hostCatalogID }) =>
hash({
// TODO: multiple host sets may belong to the same catalog,
// resulting in the catalog being loaded multiple times.
// An improvement would be to find the unique set of catalogs first.
hostCatalog: this.store.findRecord(
'host-catalog',
hostCatalogID,
{ adapterOptions: { scopeID } }
),
hostSet: this.store.findRecord(
'host-set',
host_set_id,
{ adapterOptions: { scopeID, hostCatalogID } }
)
hostCatalog: this.store.findRecord('host-catalog', hostCatalogID, {
adapterOptions: { scopeID },
}),
hostSet: this.store.findRecord('host-set', host_set_id, {
adapterOptions: { scopeID, hostCatalogID },
}),
})
);
);
return all(promises);
}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsTargetHostSetsHostSetRoute extends Route {
}
export default class ScopesScopeProjectsProjectTargetsTargetHostSetsHostSetRoute extends Route {}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsTargetHostSetsIndexRoute extends Route {
}
export default class ScopesScopeProjectsProjectTargetsTargetHostSetsIndexRoute extends Route {}
@@ -1,4 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsTargetIndexRoute extends Route {
}
export default class ScopesScopeProjectsProjectTargetsTargetIndexRoute extends Route {}
@@ -4,7 +4,6 @@ import { action } from '@ember/object';
import { hash } from 'rsvp';
export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
// =services
@service intl;
@@ -22,7 +21,7 @@ export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
return hash({
role,
users: this.store.query('user', { scope_id }),
groups: this.store.query('group', { scope_id })
groups: this.store.query('group', { scope_id }),
});
}
@@ -76,5 +75,4 @@ export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
cancel() {
this.replaceWith('scopes.scope.roles.role.principals');
}
}
@@ -3,7 +3,6 @@ import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class ScopesScopeRolesRoleGrantsRoute extends Route {
// =services
@service intl;
@@ -42,13 +41,10 @@ export default class ScopesScopeRolesRoleGrantsRoute extends Route {
async save(role) {
try {
await role.saveGrants();
this.notify.success(
this.intl.t('notify.save-success')
);
this.notify.success(this.intl.t('notify.save-success'));
} catch (error) {
// TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
}
}
}
@@ -4,12 +4,10 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class ScopesScopeRolesRolePrincipalsRoute extends Route {
// =services
@service intl;
@service notify;
// =methods
/**
@@ -23,19 +21,19 @@ export default class ScopesScopeRolesRolePrincipalsRoute extends Route {
const users = role.principals
.filterBy('type', 'user')
.map(({ principal_id }) =>
this.store.findRecord('user', principal_id, { adapterOptions })
.then(model => ({
this.store
.findRecord('user', principal_id, { adapterOptions })
.then((model) => ({
type: 'user',
model
model,
}))
);
const groups = role.principals
.filterBy('type', 'group')
.map(({ principal_id }) =>
this.store.findRecord('group', principal_id)
.then(model => ({
this.store.findRecord('group', principal_id).then((model) => ({
type: 'group',
model
model,
}))
);
return all(users.concat(groups));
+4 -4
View File
@@ -61,19 +61,19 @@
.ember-notify-show {
-webkit-animation-duration: 500ms;
-webkit-animation-name: ember-notify-show;
-webkit-animation-timing-function: cubic-bezier(.175, .885, .32, 1.275);
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
animation-duration: 500ms;
animation-name: ember-notify-show;
animation-timing-function: cubic-bezier(.175, .885, .32, 1.275);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.ember-notify-hide {
-webkit-animation-duration: 250ms;
-webkit-animation-name: ember-notify-hide;
-webkit-animation-timing-function: cubic-bezier(.6, -.28, .735, .045);
-webkit-animation-timing-function: cubic-bezier(0.6, -0.28, 0.735, 0.045);
animation-duration: 250ms;
animation-name: ember-notify-hide;
animation-timing-function: cubic-bezier(.6, -.28, .735, .045);
animation-timing-function: cubic-bezier(0.6, -0.28, 0.735, 0.045);
&:hover {
-moz-animation-play-state: paused;
@@ -1,5 +1,13 @@
import { module, test } from 'qunit';
import { visit, currentURL, fillIn, click, find, findAll, setupOnerror } from '@ember/test-helpers';
import {
visit,
currentURL,
fillIn,
click,
find,
findAll,
setupOnerror,
} from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
@@ -45,7 +53,9 @@ module('Acceptance | authentication', function (hooks) {
'withChildren'
);
scope = { id: orgScope.id, type: orgScope.type };
globalAuthMethod = this.server.create('auth-method', { scope: globalScope });
globalAuthMethod = this.server.create('auth-method', {
scope: globalScope,
});
authMethod = this.server.create('auth-method', { scope: orgScope });
orgScopeID = orgScope.id;
globalAuthMethodID = globalAuthMethod.id;
@@ -69,7 +79,7 @@ module('Acceptance | authentication', function (hooks) {
test('visiting auth methods authenticate route when there no methods shows a message', async function (assert) {
assert.expect(2);
authMethod.destroy()
authMethod.destroy();
await visit(authenticateURL);
await a11yAudit();
assert.equal(currentURL(), authenticateURL);
@@ -127,7 +137,9 @@ module('Acceptance | authentication', function (hooks) {
test('visiting index or scopes routes while already authenticated with global redirects to orgs', async function (assert) {
assert.expect(4);
authenticateSession({ scope: { id: globalScope.id, type: globalScope.type } });
authenticateSession({
scope: { id: globalScope.id, type: globalScope.type },
});
await visit(indexURL);
assert.equal(currentURL(), orgsURL);
await visit(scopesURL);
@@ -169,7 +181,9 @@ module('Acceptance | authentication', function (hooks) {
// Open header utilities dropdown
await click('.rose-header-utilities .rose-dropdown summary');
// Find and click on last element in dropdown - should be deauthenticate button
const menu = findAll('.rose-header-utilities .rose-dropdown .rose-dropdown-content button');
const menu = findAll(
'.rose-header-utilities .rose-dropdown .rose-dropdown-content button'
);
await click(menu[menu.length - 1]);
assert.notOk(currentSession().isAuthenticated);
assert.equal(currentURL(), authMethodGlobalAuthenticateURL);
@@ -177,12 +191,20 @@ module('Acceptance | authentication', function (hooks) {
test('401 responses result in deauthentication', async function (assert) {
assert.expect(2);
authenticateSession({ scope: { id: globalScope.id, type: globalScope.type } });
authenticateSession({
scope: { id: globalScope.id, type: globalScope.type },
});
await visit(orgsURL);
assert.ok(currentSession().isAuthenticated, 'Session begins authenticated, before encountering 401');
assert.ok(
currentSession().isAuthenticated,
'Session begins authenticated, before encountering 401'
);
this.server.get('/scopes', () => new Response(401));
setupOnerror(() => {
assert.notOk(currentSession().isAuthenticated, 'Session is unauthenticated, after encountering 401');
assert.notOk(
currentSession().isAuthenticated,
'Session is unauthenticated, after encountering 401'
);
});
await visit(projectsURL);
});
@@ -45,7 +45,9 @@ module('Acceptance | breadcrumbs', function (hooks) {
user = this.server.create('user', { scope: orgScope });
role = this.server.create('role', { scope: orgScope });
group = this.server.create('group', { scope: orgScope });
hostCatalog = this.server.create('host-catalog', { scope: getProjectScope() });
hostCatalog = this.server.create('host-catalog', {
scope: getProjectScope(),
});
projectsURL = `/scopes/${orgScope.id}/projects`;
newProjectURL = `${projectsURL}/new`;
+2 -3
View File
@@ -30,7 +30,7 @@ module('Acceptance | groups', function (hooks) {
);
const group = this.server.create('group', {
scope: orgScope
scope: orgScope,
});
groupsURL = `/scopes/${orgScope.id}/groups`;
@@ -219,7 +219,7 @@ module('Acceptance | groups', function (hooks) {
assert.expect(0);
});
test('can delete members', async function(assert) {
test('can delete members', async function (assert) {
assert.expect(0);
});
@@ -230,5 +230,4 @@ module('Acceptance | groups', function (hooks) {
test('select and cancel members to add', async function (assert) {
assert.expect(0);
});
});
+12 -10
View File
@@ -19,9 +19,9 @@ module('Acceptance | host catalogs', function (hooks) {
scopes: {
global: null,
org: null,
project: null
project: null,
},
hostCatalog: null
hostCatalog: null,
};
const urls = {
orgScope: null,
@@ -29,20 +29,22 @@ module('Acceptance | host catalogs', function (hooks) {
project: null,
hostCatalogs: null,
newHostCatalog: null,
hostCatalog: null
hostCatalog: null,
};
hooks.beforeEach(function () {
// Setup Mirage mock resources for this test
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', { type: 'org',
scope: { id: 'global', type: 'global' }
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
});
instances.scopes.project = this.server.create('scope', { type: 'project',
scope: { id: instances.scopes.org.id, type: 'org' }
instances.scopes.project = this.server.create('scope', {
type: 'project',
scope: { id: instances.scopes.org.id, type: 'org' },
});
instances.hostCatalog = this.server.create('host-catalog', {
scope: instances.scopes.project
scope: instances.scopes.project,
});
// Generate route URLs for resources
@@ -99,7 +101,7 @@ module('Acceptance | host catalogs', function (hooks) {
assert.notEqual(this.server.db.hostCatalogs[0].name, 'Test Name');
});
test('can create host catalog and save changes', async function(assert) {
test('can create host catalog and save changes', async function (assert) {
assert.expect(1);
const hostCatalogsCount = this.server.db.hostCatalogs.length;
authenticateSession({});
@@ -109,7 +111,7 @@ module('Acceptance | host catalogs', function (hooks) {
assert.equal(this.server.db.hostCatalogs.length, hostCatalogsCount + 1);
});
test('can create host catalog and cancel changes', async function(assert) {
test('can create host catalog and cancel changes', async function (assert) {
assert.expect(1);
const hostCatalogsCount = this.server.db.hostCatalogs.length;
authenticateSession({});
@@ -70,5 +70,4 @@ module('Acceptance | host sets', function (hooks) {
test('can cancel add/remove host associations to a host set', async function (assert) {
assert.expect(0);
});
});
+5 -6
View File
@@ -4,12 +4,11 @@ import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
//import a11yAudit from 'ember-a11y-testing/test-support/audit';
//import { Response } from 'miragejs';
import {
//authenticateSession,
// These are left here intentionally for future reference.
//currentSession,
//invalidateSession,
} from 'ember-simple-auth/test-support';
import //authenticateSession,
// These are left here intentionally for future reference.
//currentSession,
//invalidateSession,
'ember-simple-auth/test-support';
module('Acceptance | org', function (hooks) {
setupApplicationTest(hooks);
+3 -3
View File
@@ -30,7 +30,7 @@ module('Acceptance | roles', function (hooks) {
);
const role = this.server.create('role', {
scope: orgScope
scope: orgScope,
});
rolesURL = `/scopes/${orgScope.id}/roles`;
@@ -219,7 +219,7 @@ module('Acceptance | roles', function (hooks) {
assert.expect(0);
});
test('principal can be removed from a role', async function(assert) {
test('principal can be removed from a role', async function (assert) {
assert.expect(0);
});
@@ -239,7 +239,7 @@ module('Acceptance | roles', function (hooks) {
assert.expect(0);
});
test('can delete a principal', async function(assert) {
test('can delete a principal', async function (assert) {
assert.expect(0);
});
+2 -2
View File
@@ -63,10 +63,10 @@ module('Acceptance | targets', function (hooks) {
assert.expect(0);
});
test('can delete a host sets', async function(assert) {
test('can delete a host sets', async function (assert) {
assert.expect(0);
});
test('select and save host sets to add', async function (assert) {
assert.expect(0);
});
+1 -1
View File
@@ -30,7 +30,7 @@ module('Acceptance | users', function (hooks) {
);
const user = this.server.create('user', {
scope: orgScope
scope: orgScope,
});
usersURL = `/scopes/${orgScope.id}/users`;
@@ -3,7 +3,7 @@ import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/account/index', function(hooks) {
module('Integration | Component | form/account/index', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
@@ -20,5 +20,4 @@ module('Integration | Component | form/account/index', function(hooks) {
assert.ok(find('form'));
});
});
@@ -3,7 +3,7 @@ import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/account/password', function(hooks) {
module('Integration | Component | form/account/password', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
@@ -20,5 +20,4 @@ module('Integration | Component | form/account/password', function(hooks) {
assert.ok(find('form'));
});
});
@@ -3,21 +3,24 @@ import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/account/password/set-password', function(hooks) {
setupRenderingTest(hooks);
module(
'Integration | Component | form/account/password/set-password',
function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
this.submit = () => {};
this.cancel = () => {};
this.model = { type: 'password' };
test('it renders', async function (assert) {
this.submit = () => {};
this.cancel = () => {};
this.model = { type: 'password' };
await render(hbs`
await render(hbs`
<Form::Account::Password::SetPassword
@model={{this.model}}
@submit={{this.submit}}
@cancel={{this.cancel}}
/>`);
assert.ok(find('form'));
});
});
assert.ok(find('form'));
});
}
);
@@ -3,7 +3,7 @@ import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/host-set', function(hooks) {
module('Integration | Component | form/host-set', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
@@ -3,10 +3,10 @@ import { setupRenderingTest } from 'ember-qunit';
// import { render } from '@ember/test-helpers';
// import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/host-set/add-hosts', function(hooks) {
module('Integration | Component | form/host-set/add-hosts', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
test('it renders', async function (assert) {
assert.expect(0);
});
});
});
@@ -3,7 +3,7 @@ import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/host-set/hosts', function(hooks) {
module('Integration | Component | form/host-set/hosts', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
@@ -3,10 +3,10 @@ import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/host', function(hooks) {
module('Integration | Component | form/host', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
test('it renders', async function (assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
this.submit = () => {};
@@ -3,7 +3,7 @@ import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/org', function(hooks) {
module('Integration | Component | form/org', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
@@ -3,10 +3,10 @@ import { setupRenderingTest } from 'ember-qunit';
// import { render } from '@ember/test-helpers';
// import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/role/add-principals', function(hooks) {
module('Integration | Component | form/role/add-principals', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
test('it renders', async function (assert) {
assert.expect(0);
});
});
@@ -3,10 +3,10 @@ import { setupRenderingTest } from 'ember-qunit';
// import { render } from '@ember/test-helpers';
// import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | form/target/add-host-sets', function(hooks) {
module('Integration | Component | form/target/add-host-sets', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
test('it renders', async function (assert) {
assert.expect(0);
});
});
@@ -36,11 +36,10 @@ module('Unit | Authenticator | password', function (hooks) {
const authMethod = { id: 'paum_1234' };
this.server.create('scope', { id: 'global', type: 'global' });
this.server.create('auth-method', { id: authMethod.id, scopeId: 'global' });
await authenticator.authenticate(
creds,
null,
{ scope, authMethod }
await authenticator.authenticate(creds, null, { scope, authMethod });
assert.equal(
applicationAdapter.headers.Authorization,
'Bearer thetokenstring'
);
assert.equal(applicationAdapter.headers.Authorization, 'Bearer thetokenstring');
});
});
@@ -1,11 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/auth-methods', function(hooks) {
module('Unit | Controller | scopes/scope/auth-methods', function (hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
test('it exists', function (assert) {
let controller = this.owner.lookup('controller:scopes/scope/auth-methods');
assert.ok(controller);
});
@@ -1,12 +1,16 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/auth-methods/auth-method', function(hooks) {
module('Unit | Controller | scopes/scope/auth-methods/auth-method', function (
hooks
) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:scopes/scope/auth-methods/auth-method');
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/auth-methods/auth-method'
);
assert.ok(controller);
});
});
@@ -1,12 +1,17 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/auth-methods/auth-method/accounts', function(hooks) {
setupTest(hooks);
module(
'Unit | Controller | scopes/scope/auth-methods/auth-method/accounts',
function (hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:scopes/scope/auth-methods/auth-method/accounts');
assert.ok(controller);
});
});
// Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/auth-methods/auth-method/accounts'
);
assert.ok(controller);
});
}
);
Loaded 100 of 165 files, more files were not shown because too many files have changed in this diff. Show more