Merge pull request #355 from hashicorp/refactor-scope-awareness

Refactor scope awareness
This commit is contained in:
Susmitha Girumala authored and GitHub committed 2020-11-02 17:09:29 -05:00
commit 72ff964975
287 files changed
+2980 -3523

No files matched your search

+34 -12
View File
@@ -1,15 +1,37 @@
{{#if this.breadCrumbs}}
<Rose::Nav::Breadcrumbs as |crumbs|>
{{#each this.breadCrumbs as |crumb|}}
{{#if crumb.model}}
<crumbs.link @route={{crumb.path}} @model={{crumb.model}}>
{{crumb.label}}
<Rose::Nav::Breadcrumbs as |crumbs|>
{{#if this.scope.org}}
{{#unless this.scope.org.isGlobal}}
{{#if this.session.data.authenticated.isGlobal}}
<crumbs.link @route="scopes.scope.scopes" @model="global">
{{t "resources.org.title_plural"}}
</crumbs.link>
{{else}}
<crumbs.link @route={{crumb.path}}>
{{crumb.label}}
<crumbs.link @route="scopes.scope.edit" @model={{this.scope.org.id}}>
{{this.scope.org.displayName}}
</crumbs.link>
{{/if}}
{{/each}}
</Rose::Nav::Breadcrumbs>
{{/if}}
{{/unless}}
{{/if}}
{{#if this.scope.project}}
<crumbs.link @route="scopes.scope.scopes" @model={{this.scope.org.id}}>
{{t "resources.project.title_plural"}}
</crumbs.link>
<crumbs.link @route="scopes.scope.edit" @model={{this.scope.project.id}}>
{{this.scope.project.displayName}}
</crumbs.link>
{{/if}}
{{#each this.breadCrumbs as |crumb|}}
{{#if crumb.model}}
<crumbs.link @route={{crumb.path}} @model={{crumb.model}}>
{{crumb.label}}
</crumbs.link>
{{else}}
<crumbs.link @route={{crumb.path}}>
{{crumb.label}}
</crumbs.link>
{{/if}}
{{/each}}
</Rose::Nav::Breadcrumbs>
+11
View File
@@ -0,0 +1,11 @@
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;
}
@@ -47,7 +47,7 @@
<message.description>
{{t "resources.host-set.host.messages.add-none.description"}}
</message.description>
<message.link @route="scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts">
<message.link @route="scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts">
<Rose::Icon @name="chevron-left" />
{{t "actions.back"}}
</message.link>
@@ -1,82 +0,0 @@
<Rose::Form
@onSubmit={{@submit}}
@cancel={{@cancel}}
@disabled={{@model.host.isSaving}}
@error={{@model.host.errors.base}}
as |form|
>
<form.input
@value={{@model.hostSet.displayName}}
@label={{t "form.host_set.label"}}
readonly={{true}}
@disabled={{true}} />
<form.input
@value={{@model.host.type}}
@label={{t "form.type.label"}}
readonly={{true}}
@disabled={{true}} />
<form.input
@name="name"
@type="name"
@value={{@model.host.name}}
@label={{t "form.name.label"}}
@error={{@model.host.errors.name}}
@helperText={{t "form.name.help"}}
readonly={{false}}
as |field|>
{{#if @model.host.errors.name}}
<field.errors as |errors|>
{{#each @model.host.errors.name as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.input>
<form.textarea
@name="description"
@type="description"
@value={{@model.host.description}}
@label={{t "form.description.label"}}
@error={{@model.host.errors.description}}
@helperText={{t "form.description.help"}}
disabled={{@model.host.isSaving}}
readonly={{false}}
as |field|>
{{#if @model.host.errors.description}}
<field.errors as |errors|>
{{#each @model.host.errors.description as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.textarea>
<form.input
@name="address"
@type="text"
@value={{@model.host.attributes.address}}
@label={{t "form.address.label"}}
@error={{@model.host.errors.name}}
@helperText={{t "form.address.help"}}
readonly={{false}}
as |field|>
{{#if @model.host.errors.name}}
<field.errors as |errors|>
{{#each @model.host.errors.name as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.input>
<form.actions
@disabled={{if @model.host.cannotSave @model.host.cannotSave}}
@enableEditText={{t "actions.edit-form"}}
@submitText={{t "actions.save"}}
@cancelText={{t "actions.cancel"}} />
</Rose::Form>
@@ -1,53 +0,0 @@
<Rose::Form
@onSubmit={{@submit}}
@cancel={{@cancel}}
@disabled={{@model.isSaving}}
@error={{@model.errors.base}}
@showEditToggle={{if @model.isNew false true}}
as |form|
>
<form.input
@name="name"
@type="name"
@value={{@model.name}}
@label={{t "form.name.label"}}
@helperText={{t "form.name.help"}}
@error={{@model.errors.name}}
readonly={{false}}
as |field|>
{{#if @model.errors.name}}
<field.errors as |errors|>
{{#each @model.errors.name as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.input>
<form.textarea
@name="description"
@type="description"
@value={{@model.description}}
@label={{t "form.description.label"}}
@helperText={{t "form.description.help"}}
@error={{@model.errors.description}}
disabled={{@model.isSaving}}
readonly={{false}}
as |field|>
{{#if @model.errors.description}}
<field.errors as |errors|>
{{#each @model.errors.description as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.textarea>
<form.actions
@disabled={{if @model.cannotSave @model.cannotSave}}
@enableEditText={{t "actions.edit-form"}}
@submitText={{t "actions.save"}}
@cancelText={{t "actions.cancel"}} />
</Rose::Form>
@@ -51,7 +51,7 @@
<message.description>
{{t "resources.target.host-set.messages.none.description"}}
</message.description>
<message.link @route="scopes.scope.projects.project.targets.target.host-sets">
<message.link @route="scopes.scope.targets.target.host-sets">
<Rose::Icon @name="chevron-left" />
{{t "actions.back"}}
</message.link>
@@ -0,0 +1,18 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSetPasswordController extends Controller {
// =services
@service intl;
// =attributes
/**
* Translated users breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('actions.set-password');
}
}
@@ -1,7 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeOrgsController extends Controller {
export default class ScopesScopeGroupsGroupMembersController extends Controller {
// =services
@service intl;
@@ -9,9 +9,10 @@ export default class ScopesScopeOrgsController extends Controller {
// =attributes
/**
* Translated users breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('resources.org.title_plural');
return this.intl.t('resources.group.messages.members.title');
}
}
@@ -1,7 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsController extends Controller {
export default class ScopesScopeHostCatalogsController extends Controller {
// =services
@service intl;
@@ -9,6 +9,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsController extends Co
// =attributes
/**
* Translated roles breadcrumb
* @type {string}
*/
get breadCrumb() {
@@ -1,9 +1,10 @@
import Controller from '@ember/controller';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogController extends Controller {
export default class ScopesScopeHostCatalogsHostCatalogController extends Controller {
// =attributes
/**
* A role breadcrumb
* @type {string}
*/
get breadCrumb() {
@@ -1,7 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsController extends Controller {
export default class ScopesScopeHostCatalogsHostCatalogHostSetsController extends Controller {
// =services
@service intl;
@@ -9,7 +9,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsCo
// =attributes
/**
* Host sets breadcrumb
* Translated roles breadcrumb
* @type {string}
*/
get breadCrumb() {
@@ -1,10 +1,10 @@
import Controller from '@ember/controller';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostController extends Controller {
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetController extends Controller {
// =attributes
/**
* Host breadcrumb
* A role breadcrumb
* @type {string}
*/
get breadCrumb() {
@@ -0,0 +1,18 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetAddHostsController extends Controller {
// =services
@service intl;
// =attributes
/**
* Translated roles breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('resources.host-set.actions.add-hosts');
}
}
@@ -0,0 +1,18 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndAddHostController extends Controller {
// =services
@service intl;
// =attributes
/**
* Translated roles breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('resources.host-set.actions.create-and-add-host');
}
}
@@ -0,0 +1,18 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsController extends Controller {
// =services
@service intl;
// =attributes
/**
* Translated roles breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('resources.host.title_plural');
}
}
@@ -1,7 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsController extends Controller {
export default class ScopesScopeHostCatalogsHostCatalogHostsController extends Controller {
// =services
@service intl;
@@ -9,7 +9,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsContr
// =attributes
/**
* Hosts breadcrumb
* Translated roles breadcrumb
* @type {string}
*/
get breadCrumb() {
@@ -1,10 +1,10 @@
import Controller from '@ember/controller';
export default class ScopesScopeProjectsProjectTargetsTargetController extends Controller {
export default class ScopesScopeHostCatalogsHostCatalogHostsHostController extends Controller {
// =attributes
/**
* A target breadcrumb
* A role breadcrumb
* @type {string}
*/
get breadCrumb() {
@@ -1,13 +0,0 @@
import Controller from '@ember/controller';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetController extends Controller {
// =attributes
/**
* Host set breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.model.displayName;
}
}
@@ -1,18 +0,0 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetCreateHostController extends Controller {
// =services
@service intl;
// =attributes
/**
* Translated new host set breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('resources.host-set.actions.create-host');
}
}
@@ -1,18 +0,0 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNewController extends Controller {
// =services
@service intl;
// =attributes
/**
* Translated new host set breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('titles.new');
}
}
@@ -1,18 +0,0 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewController extends Controller {
// =services
@service intl;
// =attributes
/**
* Translated new host breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('titles.new');
}
}
@@ -1,18 +0,0 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectHostCatalogsNewController extends Controller {
// =services
@service intl;
// =attributes
/**
* Translated new role breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('titles.new');
}
}
@@ -1,18 +0,0 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectTargetsNewController extends Controller {
// =services
@service intl;
// =attributes
/**
* Translated new target breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('titles.new');
}
}
@@ -1,7 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsNewController extends Controller {
export default class ScopesScopeRolesRoleGrantsController extends Controller {
// =services
@service intl;
@@ -9,9 +9,10 @@ export default class ScopesScopeProjectsNewController extends Controller {
// =attributes
/**
* Translated users breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('titles.new');
return this.intl.t('resources.role.grant.title_plural');
}
}
@@ -1,7 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeOrgsNewController extends Controller {
export default class ScopesScopeRolesRolePrincipalsController extends Controller {
// =services
@service intl;
@@ -9,9 +9,10 @@ export default class ScopesScopeOrgsNewController extends Controller {
// =attributes
/**
* Translated users breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('titles.new');
return this.intl.t('resources.role.principal.title_plural');
}
}
@@ -0,0 +1,27 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
export default class ScopesScopeScopesController extends Controller {
// =services
@service intl;
// =attributes
/**
* @type {string}
*/
@computed('model.currentScope.{isGlobal,isOrg}')
get breadCrumb() {
if (this.model.currentScope.isGlobal) {
return this.intl.t('resources.org.title_plural');
}
/* istanbul ignore else */
if (this.model.currentScope.isOrg) {
return this.intl.t('resources.project.title_plural');
}
/* istanbul ignore next */
return null;
}
}
@@ -1,8 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectSessionsController extends Controller {
export default class ScopesScopeSessionsController extends Controller {
// =services
@service intl;
@@ -10,10 +9,10 @@ export default class ScopesScopeProjectsProjectSessionsController extends Contro
// =attributes
/**
* Translated roles breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('resources.session.title_plural');
}
}
@@ -1,7 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectTargetsController extends Controller {
export default class ScopesScopeTargetsController extends Controller {
// =services
@service intl;
@@ -9,7 +9,7 @@ export default class ScopesScopeProjectsProjectTargetsController extends Control
// =attributes
/**
* Targets breadcrumb
* Translated roles breadcrumb
* @type {string}
*/
get breadCrumb() {
@@ -1,9 +1,10 @@
import Controller from '@ember/controller';
export default class ScopesScopeProjectsProjectController extends Controller {
export default class ScopesScopeTargetsTargetController extends Controller {
// =attributes
/**
* An user breadcrumb
* @type {string}
*/
get breadCrumb() {
@@ -1,7 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsController extends Controller {
export default class ScopesScopeTargetsTargetAddHostSetsController extends Controller {
// =services
@service intl;
@@ -9,6 +9,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsControlle
// =attributes
/**
* Translated roles breadcrumb
* @type {string}
*/
get breadCrumb() {
@@ -1,7 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsProjectTargetsTargetHostSetsController extends Controller {
export default class ScopesScopeTargetsTargetHostSetsController extends Controller {
// =services
@service intl;
@@ -9,7 +9,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetHostSetsController e
// =attributes
/**
* Host sets breadcrumb
* Translated roles breadcrumb
* @type {string}
*/
get breadCrumb() {
@@ -1,7 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsController extends Controller {
export default class ScopesScopeUsersUserAccountsController extends Controller {
// =services
@service intl;
@@ -9,9 +9,10 @@ export default class ScopesScopeProjectsController extends Controller {
// =attributes
/**
* Translated users breadcrumb
* @type {string}
*/
get breadCrumb() {
return this.intl.t('resources.project.title_plural');
return this.intl.t('resources.account.title_plural');
}
}
+31 -44
View File
@@ -13,50 +13,9 @@ Router.map(function () {
this.route('method', { path: ':auth_method_id' });
});
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('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('create-host');
});
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('add-host-sets');
});
this.route('new');
});
this.route('sessions', function() {});
});
this.route('new');
});
this.route('scopes', function() {});
this.route('edit');
this.route('new');
this.route('users', function () {
this.route('user', { path: ':user_id' }, function () {
@@ -94,6 +53,34 @@ Router.map(function () {
});
this.route('new');
});
this.route('sessions', 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('new');
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-sets', function() {
this.route('new');
this.route('host-set', { path: ':host_set_id' }, function() {
this.route('hosts');
this.route('add-hosts');
this.route('create-and-add-host');
});
});
});
});
});
});
+83 -13
View File
@@ -1,10 +1,17 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { A } from '@ember/array';
import { action } from '@ember/object';
import loading from 'ember-loading/decorator';
import { confirm } from '../../decorators/confirm';
import { notifySuccess, notifyError } from '../../decorators/notify';
export default class ScopesScopeRoute extends Route {
// =services
@service intl;
@service session;
@service scope;
// =methods
@@ -25,6 +32,7 @@ export default class ScopesScopeRoute extends Route {
return this.store.findRecord('scope', id).catch(() => {
const maybeExistingScope = this.store.peekRecord('scope', id);
const scopeOptions = { id, type };
/* istanbul ignore else */
if (type === 'global') {
scopeOptions.name = this.intl.t('titles.global');
}
@@ -35,14 +43,39 @@ export default class ScopesScopeRoute extends Route {
}
/**
* Adds the set of all org scopes to the controller, which is used by the
* scope navigation template.
* Load all scopes within the current scope context. Always attempt to load
* org scopes. Only attempt to load project scopes if the current scope is
* a project. These are used for scope navigation.
*/
async afterModel(model) {
// First, load orgs and, if necessary, projects
let orgs, projects;
orgs = await this.store.query('scope', { scope_id: 'global' })
.catch(() => A([]));
if (model.isProject) {
projects = await this.store.query('scope', { scope_id: model.scopeID });
}
// Then pull out the "selected" scopes, if relevant
let selectedOrg, selectedProject;
if (model.isGlobal || model.isOrg) selectedOrg = model;
if (model.isProject) {
selectedProject = model;
selectedOrg = this.store.peekRecord('scope', model.scopeID);
}
// Update the scope service with the current scope(s);
this.scope.org = selectedOrg;
this.scope.project = selectedProject;
this.scopes = { orgs, projects, selectedOrg, selectedProject };
}
/**
* Adds the scopes hash to the controller context (see `afterModel`).
* @param {Controller} controller
*/
setupController(controller) {
super.setupController(...arguments);
const orgScopes = this.modelFor('scopes').filterBy('isOrg', true);
controller.setProperties({ orgScopes });
const scopes = this.scopes;
controller.setProperties({ scopes });
}
/**
@@ -51,19 +84,56 @@ export default class ScopesScopeRoute extends Route {
* @param {object} controller
* @param {object} model
*/
renderTemplate(controller, model) {
renderTemplate() {
super.renderTemplate(...arguments);
this.render('scopes/scope/-header-nav', {
into: 'application',
outlet: 'header-nav',
model: model,
});
this.render('scopes/scope/-sidebar', {
into: 'scopes/scope',
outlet: 'sidebar',
model: model,
});
}
// =actions
/**
* Rollback changes on scope.
* @param {Model} scope
*/
@action
cancel(scope) {
const { isNew } = scope;
scope.rollbackAttributes();
if (isNew) this.transitionTo('scopes.scope');
}
/**
* Handle save scope.
* @param {Model} scope
* @param {Event} e
*/
@action
@loading
@notifyError(({ message }) => message)
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
async save(scope) {
const { isNew } = scope;
await scope.save();
await this.transitionTo('scopes.scope.edit', scope);
if (isNew) this.refresh();
}
/**
* Deletes the scope and redirects to index.
* @param {Model} scope
*/
@action
@loading
@confirm('questions.delete-confirm')
@notifyError(({ message }) => message, { catch: true })
@notifySuccess('notifications.delete-success')
async delete(scope) {
const { scopeID } = scope;
await scope.destroyRecord();
await this.replaceWith('scopes.scope.scopes', scopeID);
//this.refresh();
}
}
@@ -10,14 +10,7 @@ export default class ScopesScopeAuthenticateRoute extends Route {
// =methods
beforeModel() {
if (this.session.isAuthenticated) {
const scope = this.modelFor('scopes.scope');
if (scope.isGlobal) {
this.transitionTo('scopes.scope.orgs');
} else {
this.transitionTo('scopes.scope.projects');
}
}
if (this.session.isAuthenticated) this.transitionTo('scopes.scope.index');
}
/**
@@ -29,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'),
scopes: this.modelFor('scopes').filter(scope => scope.isOrg),
authMethods: this.store.query('auth-method', { scope_id }),
// for integration testing:
@@ -53,11 +53,7 @@ export default class ScopesScopeAuthenticateMethodRoute extends Route {
requestCookies,
{ scope, authMethod }
);
if (scope.isGlobal) {
this.transitionTo('scopes.scope.orgs');
} else {
this.transitionTo('scopes.scope.projects');
}
this.transitionTo('index');
} catch (e) {
const errorMessage = this.intl.t('errors.authentication-failed.title');
this.notify.error(errorMessage, { closeAfter: null });
+18
View File
@@ -0,0 +1,18 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ScopesScopeEditRoute extends Route {
// =services
@service session;
// =methods
/**
* If arriving here unauthenticated, redirect to index for further processing.
*/
beforeModel() {
if (!this.session.isAuthenticated) this.transitionTo('index');
}
}
@@ -2,37 +2,45 @@ 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 { confirm } from '../../../../../decorators/confirm';
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
import { confirm } from '../../../decorators/confirm';
import { notifySuccess, notifyError } from '../../../decorators/notify';
export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route {
export default class ScopesScopeHostCatalogsRoute extends Route {
// =services
@service intl;
@service notify;
@service session;
// =methods
/**
* If arriving here unauthenticated, redirect to index for further processing.
*/
beforeModel() {
if (!this.session.isAuthenticated) this.transitionTo('index');
}
/**
* Loads all host catalogs under the current scope.
* @return {Promise{[HostCatalogModel]}}
*/
async model() {
const { id: scope_id } = this.modelFor('scopes.scope.projects.project');
const { id: scope_id } = this.modelFor('scopes.scope');
return this.store.query('host-catalog', { scope_id });
}
// =actions
/**
* Rollback changes on project.
* Rollback changes on host catalog.
* @param {HostCatalogModel} hostCatalog
*/
@action
cancel(hostCatalog) {
const { isNew } = hostCatalog;
hostCatalog.rollbackAttributes();
if (isNew) this.transitionTo('scopes.scope.projects.project.host-catalogs');
if (isNew) this.transitionTo('scopes.scope.host-catalogs');
}
/**
@@ -47,7 +55,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route {
async save(hostCatalog) {
await hostCatalog.save();
await this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog',
'scopes.scope.host-catalogs.host-catalog',
hostCatalog
);
this.refresh();
@@ -64,7 +72,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route {
@notifySuccess('notifications.delete-success')
async delete(hostCatalog) {
await hostCatalog.destroyRecord();
await this.replaceWith('scopes.scope.projects.project.host-catalogs');
await this.replaceWith('scopes.scope.host-catalogs');
this.refresh();
}
}
@@ -1,6 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute extends Route {
export default class ScopesScopeHostCatalogsHostCatalogRoute extends Route {
// =methods
/**
@@ -14,7 +14,8 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute exte
}
/**
* Renders the host-catalog specific templates for header, navigation, and actions page sections.
* Renders the host-catalog specific templates for header, navigation,
* and actions page sections.
* @override
* @param {object} controller
* @param {object} model
@@ -23,27 +24,27 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute exte
super.renderTemplate(...arguments);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/-header',
'scopes/scope/host-catalogs/host-catalog/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/-navigation',
'scopes/scope/host-catalogs/host-catalog/-navigation',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'navigation',
model: model,
}
);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/-actions',
'scopes/scope/host-catalogs/host-catalog/-actions',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'actions',
model: model,
}
@@ -2,10 +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 { confirm } from '../../../../../../../decorators/confirm';
import { notifySuccess, notifyError } from '../../../../../../../decorators/notify';
import { confirm } from '../../../../../decorators/confirm';
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRoute extends Route {
export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Route {
// =services
@service intl;
@@ -19,7 +19,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo
*/
model() {
const { id: host_catalog_id } = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
'scopes.scope.host-catalogs.host-catalog'
);
return this.store.query('host-set', { host_catalog_id });
}
@@ -36,7 +36,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo
hostSet.rollbackAttributes();
if (isNew)
this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets'
'scopes.scope.host-catalogs.host-catalog.host-sets'
);
}
@@ -52,7 +52,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo
async save(hostSet) {
await hostSet.save();
await this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set',
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set',
hostSet
);
this.refresh();
@@ -70,7 +70,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo
async deleteHostSet(hostSet) {
await hostSet.destroyRecord();
await this.replaceWith(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets'
'scopes.scope.host-catalogs.host-catalog.host-sets'
);
}
}
@@ -1,10 +1,10 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetRoute extends Route {
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetRoute extends Route {
// =methods
/**
* Load a host-set using current host-catalog and it's parent project scope.
* Load a host-set using current host-catalog and its parent scope.
* @param {object} params
* @param {string} params.host_set_id
* @return {HostSetModel}
@@ -23,27 +23,27 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
super.renderTemplate(...arguments);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-header',
'scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-navigation',
'scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-navigation',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'navigation',
model: model,
}
);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-actions',
'scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-actions',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'actions',
model: model,
}
@@ -3,9 +3,9 @@ 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 ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetAddHostsRoute extends Route {
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetAddHostsRoute extends Route {
// =services
@service intl;
@@ -26,11 +26,11 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
*/
async model() {
const { id: host_catalog_id } = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
'scopes.scope.host-catalogs.host-catalog'
);
return hash({
hostSet: this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set'
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set'
),
hosts: this.store.query('host', { host_catalog_id }),
});
@@ -45,20 +45,20 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
super.renderTemplate(...arguments);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts/-header',
'scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
}
);
this.render('-empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'navigation',
});
this.render('-empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'actions',
});
}
@@ -76,7 +76,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
async addHosts(hostSet, hostIDs) {
await hostSet.addHosts(hostIDs);
await this.replaceWith(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts'
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts'
);
}
@@ -86,7 +86,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
@action
cancel() {
this.replaceWith(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts'
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts'
);
}
}
@@ -1,11 +1,10 @@
import Route from '@ember/routing/route';
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 ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetCreateHostRoute extends Route {
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndAddHostRoute extends Route {
// =services
@service intl;
@@ -19,22 +18,17 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
*/
async model() {
const { id: host_catalog_id } = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
'scopes.scope.host-catalogs.host-catalog'
);
return hash({
hostSet: this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set'
),
host: this.store.createRecord('host', {
type: 'static',
host_catalog_id,
}),
return this.store.createRecord('host', {
type: 'static',
host_catalog_id,
});
}
/**
* Renders the create-host-specific header template.
* Renders the create host-specific header template.
* Empties the actions and navigation outlets and renders a custom empty header.
* @override
*/
@@ -42,20 +36,20 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
super.renderTemplate(...arguments);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host/-header',
'scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
}
);
this.render('-empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'navigation',
});
this.render('-empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'actions',
});
}
@@ -70,11 +64,12 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
@loading
@notifyError(({ message }) => message, { catch: true })
@notifySuccess('notifications.add-success')
async save(model) {
await model.host.save();
await model.hostSet.addHost(model.host.id);
async save(host) {
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(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts'
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts'
);
}
@@ -84,7 +79,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
@action
cancel() {
this.replaceWith(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts'
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts'
);
}
}
@@ -3,10 +3,10 @@ import { hash, all } from 'rsvp';
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 { confirm } from '../../../../../../../decorators/confirm';
import { notifySuccess, notifyError } from '../../../../../../../decorators/notify';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetHostsRoute extends Route {
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsRoute extends Route {
// =services
@service intl;
@@ -20,7 +20,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
*/
async model() {
const hostSet = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set'
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set'
);
return hash({
hostSet,
@@ -43,9 +43,9 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
@notifyError(({ message }) => message, { catch: true })
@notifySuccess('notifications.remove-success')
async removeHost(hostSet, host) {
const scopeID = this.modelFor('scopes.scope.projects.project').id;
const scopeID = this.modelFor('scopes.scope').id;
const hostCatalogID = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
'scopes.scope.host-catalogs.host-catalog'
).id;
await hostSet.removeHost(host.id, {
adapterOptions: { scopeID, hostCatalogID },
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetIndexRoute extends Route {
}
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeHostCatalogsHostCatalogHostSetsIndexRoute extends Route {
}
@@ -1,6 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNewRoute extends Route {
export default class ScopesScopeHostCatalogsHostCatalogHostSetsNewRoute extends Route {
// =methods
/**
@@ -9,7 +9,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNe
*/
model() {
const { id: host_catalog_id } = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
'scopes.scope.host-catalogs.host-catalog'
);
return this.store.createRecord('host-set', {
type: 'static',
@@ -27,22 +27,22 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNe
super.renderTemplate(...arguments);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-header',
'scopes/scope/host-catalogs/host-catalog/host-sets/new/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render('_empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'navigation',
model: model,
});
this.render('_empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'actions',
model: model,
});
@@ -2,10 +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 { confirm } from '../../../../../../../decorators/confirm';
import { notifySuccess, notifyError } from '../../../../../../../decorators/notify';
import { confirm } from '../../../../../decorators/confirm';
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute extends Route {
export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route {
// =services
@service intl;
@@ -14,12 +14,12 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute
// =methods
/**
* Loads all hosts under the current host catalog and it's parent project scope.
* Loads all hosts under the current host catalog and it's parent scope.
* @return {Promise{[HostModel]}}
*/
model() {
const { id: host_catalog_id } = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
'scopes.scope.host-catalogs.host-catalog'
);
return this.store.query('host', { host_catalog_id });
}
@@ -36,7 +36,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute
host.rollbackAttributes();
if (isNew)
this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog.hosts'
'scopes.scope.host-catalogs.host-catalog.hosts'
);
}
@@ -52,7 +52,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute
async save(host) {
await host.save();
await this.transitionTo(
'scopes.scope.projects.project.host-catalogs.host-catalog.hosts.host',
'scopes.scope.host-catalogs.host-catalog.hosts.host',
host
);
this.refresh();
@@ -70,7 +70,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute
async deleteHost(host) {
await host.destroyRecord();
await this.replaceWith(
'scopes.scope.projects.project.host-catalogs.host-catalog.hosts'
'scopes.scope.host-catalogs.host-catalog.hosts'
);
this.refresh();
}
@@ -1,10 +1,10 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostRoute extends Route {
export default class ScopesScopeHostCatalogsHostCatalogHostsHostRoute extends Route {
// =methods
/**
* Load a host using current host-catalog and it's parent project scope.
* Load a host using current host-catalog and it's parent scope.
* @param {object} params
* @param {string} params.host_id
* @return {HostModel}
@@ -23,27 +23,27 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostR
super.renderTemplate(...arguments);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-header',
'scopes/scope/host-catalogs/host-catalog/hosts/host/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-navigation',
'scopes/scope/host-catalogs/host-catalog/hosts/host/-navigation',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'navigation',
model: model,
}
);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-actions',
'scopes/scope/host-catalogs/host-catalog/hosts/host/-actions',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'actions',
model: model,
}
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeHostCatalogsHostCatalogHostsHostIndexRoute extends Route {
}
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeHostCatalogsHostCatalogHostsIndexRoute extends Route {
}
@@ -1,6 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewRoute extends Route {
export default class ScopesScopeHostCatalogsHostCatalogHostsNewRoute extends Route {
// =methods
/**
@@ -9,7 +9,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewRo
*/
model() {
const { id: host_catalog_id } = this.modelFor(
'scopes.scope.projects.project.host-catalogs.host-catalog'
'scopes.scope.host-catalogs.host-catalog'
);
return this.store.createRecord('host', {
type: 'static',
@@ -18,7 +18,8 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewRo
}
/**
* Renders new host specific templates for header, navigation, and action page sections.
* Renders new host specific templates for header, navigation,
* and action page sections.
* @override
* @param {object} controller
* @param {object} model
@@ -27,22 +28,22 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewRo
super.renderTemplate(...arguments);
this.render(
'scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new/-header',
'scopes/scope/host-catalogs/host-catalog/hosts/new/-header',
{
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'header',
model: model,
}
);
this.render('_empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'navigation',
model: model,
});
this.render('_empty', {
into: 'scopes/scope/projects/project/host-catalogs/host-catalog',
into: 'scopes/scope/host-catalogs/host-catalog',
outlet: 'actions',
model: model,
});
@@ -0,0 +1,3 @@
import Route from '@ember/routing/route';
export default class ScopesScopeHostCatalogsHostCatalogIndexRoute extends Route {}
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeHostCatalogsIndexRoute extends Route {
}
@@ -1,14 +1,14 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsNewRoute extends Route {
export default class ScopesScopeHostCatalogsNewRoute extends Route {
// =methods
/**
* Creates a new unsaved host catalog belonging to the current project scope.
* Creates a new unsaved host catalog belonging to the current scope.
* @return {HostCatalogModel}
*/
model() {
const scopeModel = this.modelFor('scopes.scope.projects.project');
const scopeModel = this.modelFor('scopes.scope');
return this.store.createRecord('host-catalog', {
type: 'static',
scopeModel,
+15 -2
View File
@@ -1,12 +1,25 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ScopesScopeIndexRoute extends Route {
// =services
@service session;
// =methods
/**
* Redirects to scopes/scope/authenticate for further processing.
* If already authenticated, redirects to scopes/scope/scopes to display
* list of sub scopes.
*/
redirect() {
this.transitionTo('scopes.scope.authenticate');
redirect(model) {
if (!this.session.isAuthenticated) {
this.transitionTo('scopes.scope.authenticate');
} else if (model.isProject) {
this.transitionTo('scopes.scope.edit');
} else {
this.transitionTo('scopes.scope.scopes');
}
}
}
+31
View File
@@ -0,0 +1,31 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ScopesScopeNewRoute extends Route {
// =services
@service session;
// =methods
/**
* If arriving here unauthenticated, redirect to index for further processing.
*/
beforeModel() {
if (!this.session.isAuthenticated) this.transitionTo('index');
}
/**
* Creates a new unsaved scope belonging to the current scope.
* @return {ScopeModel}
*/
model() {
const { id: scopeID, isOrg } = this.modelFor('scopes.scope');
// NOTE: if the current scope is an org, we create a project, otherwise
// it must be global and we create an org. Boundary does not support
// scopes under a project, so such a case is ignored.
const type = isOrg ? 'project' : 'org';
return this.store.createRecord('scope', { type, scopeID });
}
}
-60
View File
@@ -1,60 +0,0 @@
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';
export default class ScopesScopeOrgsRoute extends Route {
// =services
@service intl;
@service notify;
@service session;
// =methods
/**
* If arriving here unauthenticated or from a non-global scope,
* redirect to index for further processing.
*/
beforeModel() {
if (!this.session.isAuthenticated) this.transitionTo('index');
const scope = this.modelFor('scopes.scope');
if(!scope.isGlobal) this.transitionTo('index');
}
/**
* Loads all scopes under the global scope.
* @return {Promise{[ScopeModel]}}
*/
async model() {
return this.store.query('scope', { scope_id: 'global' });
}
// =actions
/**
* Rollback changes on org.
* @param {ScopeModel} org
*/
@action
cancel(org) {
org.rollbackAttributes();
this.transitionTo('scopes.scope.orgs');
}
/**
* Handle save org.
* @param {ScopeModel} org
* @param {Event} e
*/
@action
@loading
@notifyError(({ message }) => message, { catch: true })
@notifySuccess('notifications.create-success')
async save(org) {
await org.save();
await this.transitionTo('scopes.scope.projects', org);
this.refresh();
}
}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeOrgsIndexRoute extends Route {}
@@ -1,16 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeOrgsNewRoute extends Route {
// =methods
/**
* Creates a new unsaved org scope belonging to the global scope.
* @return {ScopeModel}
*/
model() {
return this.store.createRecord('scope', {
type: 'org',
scopeID: 'global',
});
}
}
@@ -1,90 +0,0 @@
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 { confirm } from '../../../decorators/confirm';
import { notifySuccess, notifyError } from '../../../decorators/notify';
export default class ScopesScopeProjectsRoute extends Route {
// =services
@service intl;
@service notify;
@service session;
@service confirm;
// =methods
/**
* If arriving here unauthenticated, redirect to index for further processing.
*/
beforeModel() {
if (!this.session.isAuthenticated) this.transitionTo('index');
}
/**
* Loads all scopes under the current scope.
* @return {Promise{[ScopeModel]}}
*/
async model() {
const { id: scope_id } = this.modelFor('scopes.scope');
return this.store.query('scope', { scope_id });
}
/**
* If arriving here within a verifiable project scope, redirect to its
* parent, which is necessarily an org, in order to list projects.
*
* TODO: this conditional redirect based on the scope type is probably
* necessary for many routes directly under scope, so we may want
* to move this into a mixin.
* @param {ScopeModel}
*/
redirect() {
const { isProject, scopeID } = this.modelFor('scopes.scope');
if (isProject) this.transitionTo('scopes.scope.projects', scopeID);
}
// =actions
/**
* Rollback changes on project.
* @param {ProjectModel} project
*/
@action
cancel(project) {
const { isNew } = project;
project.rollbackAttributes();
if (isNew) this.transitionTo('scopes.scope.projects');
}
/**
* Handle save project.
* @param {ProjectModel} project
* @param {Event} e
*/
@action
@loading
@notifyError(({ message }) => message)
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
async save(project) {
await project.save();
await this.transitionTo('scopes.scope.projects.project', project);
this.refresh();
}
/**
* Deletes the project and redirects to index.
* @param {ProjectModel} project
*/
@action
@loading
@confirm('questions.delete-confirm')
@notifyError(({ message }) => message, { catch: true })
@notifySuccess('notifications.delete-success')
async delete(project) {
await project.destroyRecord();
await this.replaceWith('scopes.scope.projects');
this.refresh();
}
}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsIndexRoute extends Route {}
@@ -1,17 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsNewRoute extends Route {
// =methods
/**
* Creates a new unsaved project scope belonging to the current org scope.
* @return {ScopeModel}
*/
model() {
const { id } = this.modelFor('scopes.scope');
return this.store.createRecord('scope', {
type: 'project',
scopeID: id,
});
}
}
@@ -1,31 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectRoute extends Route {
// =methods
/**
* Loads a scope by ID (ostensibly a project scope).
* @param {object} params
* @param {string} params.project_id
* @return {ScopeModel}
*/
model({ project_id }) {
return this.store.findRecord('scope', project_id);
}
/**
* Renders the project-specific sidebar template.
* @override
* @param {object} controller
* @param {object} model
*/
renderTemplate(controller, model) {
super.renderTemplate(...arguments);
this.render('scopes/scope/projects/project/-sidebar', {
into: 'scopes/scope',
outlet: 'sidebar',
model: model,
});
}
}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetIndexRoute extends Route {}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsIndexRoute extends Route {}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostIndexRoute extends Route {}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsIndexRoute extends Route {}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogIndexRoute extends Route {}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectHostCatalogsIndexRoute extends Route {}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectIndexRoute extends Route {}
@@ -1,4 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectSessionsIndexRoute extends Route {
}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsIndexRoute extends Route {}
@@ -1,17 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsNewRoute extends Route {
// =methods
/**
* Creates a new unsaved target in current project scope.
* @return {TargetModel}
*/
model() {
const scopeModel = this.modelFor('scopes.scope.projects.project');
return this.store.createRecord('target', {
type: 'tcp',
scopeModel,
});
}
}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsTargetHostSetsHostSetRoute extends Route {}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsTargetHostSetsIndexRoute extends Route {}
@@ -1,3 +0,0 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsTargetIndexRoute extends Route {}
+40
View File
@@ -0,0 +1,40 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
/**
* The scopes route lists subscopes under the currently active scope.
* For the global scope, the listed scopes are orgs.
* For org scopes, the listed scopes are projects.
*/
export default class ScopesScopeScopesRoute extends Route {
// =services
@service session;
// =methods
/**
* If arriving here unauthenticated, redirect to index for further processing.
*/
beforeModel() {
if (!this.session.isAuthenticated) this.transitionTo('index');
}
/**
* Loads sub scopes for the current scope.
* @return {Promise
*/
async model() {
const currentScope = this.modelFor('scopes.scope');
const parentScope = !currentScope.isGlobal
? await this.store.findRecord('scope', currentScope.scopeID)
: null;
const subScopes =
await this.store.query('scope', { scope_id: currentScope.id });
return {
currentScope,
parentScope,
subScopes
};
}
}
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeScopesIndexRoute extends Route {
}
@@ -4,17 +4,18 @@ import { action } from '@ember/object';
import { all, hash } from 'rsvp';
import { task, timeout } from 'ember-concurrency';
import { A } from '@ember/array';
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
import config from '../../../../../config/environment';
import { notifySuccess, notifyError } from '../../../decorators/notify';
import config from '../../../config/environment';
const POLL_TIMEOUT_SECONDS = config.sessionPollingTimeoutSeconds;
export default class ScopesScopeProjectsProjectSessionsRoute extends Route {
export default class ScopesScopeSessionsRoute extends Route {
// =services
@service intl;
@service notify;
@service session;
// =attributes
@@ -37,13 +38,20 @@ export default class ScopesScopeProjectsProjectSessionsRoute extends Route {
// =methods
/**
* If arriving here unauthenticated, redirect to index for further processing.
*/
beforeModel() {
if (!this.session.isAuthenticated) this.transitionTo('index');
}
/**
* Loads all sessions under the current scope and encapsulates them into
* an array of objects containing their associated users and targets.
* @return {Promise{[{session: SessionModel, user: UserModel, target: TargetModel}]}}
*/
async model() {
const { id: scope_id } = this.modelFor('scopes.scope.projects.project');
const { id: scope_id } = this.modelFor('scopes.scope');
const sessions = await this.store.query('session', { scope_id });
const sessionAggregates = await all(
sessions.map(session => hash({
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeSessionsIndexRoute extends Route {
}
@@ -2,23 +2,31 @@ 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 { confirm } from '../../../../../decorators/confirm';
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
import { confirm } from '../../../decorators/confirm';
import { notifySuccess, notifyError } from '../../../decorators/notify';
export default class ScopesScopeProjectsProjectTargetsRoute extends Route {
export default class ScopesScopeTargetsRoute extends Route {
// =services
@service intl;
@service notify;
@service session;
// =methods
/**
* Loads all targets under current project scope.
* If arriving here unauthenticated, redirect to index for further processing.
*/
beforeModel() {
if (!this.session.isAuthenticated) this.transitionTo('index');
}
/**
* Loads all targets under current scope.
* @return {Promise{[TargetModel]}}
*/
async model() {
const { id: scope_id } = this.modelFor('scopes.scope.projects.project');
const { id: scope_id } = this.modelFor('scopes.scope');
return this.store.query('target', { scope_id });
}
@@ -32,7 +40,7 @@ export default class ScopesScopeProjectsProjectTargetsRoute extends Route {
cancel(target) {
const { isNew } = target;
target.rollbackAttributes();
if (isNew) this.transitionTo('scopes.scope.projects.project.targets');
if (isNew) this.transitionTo('scopes.scope.targets');
}
/**
@@ -46,7 +54,7 @@ export default class ScopesScopeProjectsProjectTargetsRoute extends Route {
@notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success')
async save(target) {
await target.save();
await this.transitionTo('scopes.scope.projects.project.targets.target', target);
await this.transitionTo('scopes.scope.targets.target', target);
this.refresh();
}
@@ -61,7 +69,7 @@ export default class ScopesScopeProjectsProjectTargetsRoute extends Route {
@notifySuccess('notifications.delete-success')
async delete(target) {
await target.destroyRecord();
await this.replaceWith('scopes.scope.projects.project.targets');
await this.replaceWith('scopes.scope.targets');
this.refresh();
}
}
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeTargetsIndexRoute extends Route {
}
@@ -0,0 +1,17 @@
import Route from '@ember/routing/route';
export default class ScopesScopeTargetsNewRoute extends Route {
// =methods
/**
* Creates a new unsaved target in current scope.
* @return {TargetModel}
*/
model() {
const scopeModel = this.modelFor('scopes.scope');
return this.store.createRecord('target', {
type: 'tcp',
scopeModel,
});
}
}
@@ -1,6 +1,6 @@
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsProjectTargetsTargetRoute extends Route {
export default class ScopesScopeTargetsTargetRoute extends Route {
// =methods
/**
@@ -21,18 +21,18 @@ export default class ScopesScopeProjectsProjectTargetsTargetRoute extends Route
renderTemplate() {
super.renderTemplate(...arguments);
this.render('scopes/scope/projects/project/targets/target/-header', {
into: 'scopes/scope/projects/project/targets/target',
this.render('scopes/scope/targets/target/-header', {
into: 'scopes/scope/targets/target',
outlet: 'header',
});
this.render('scopes/scope/projects/project/targets/target/-navigation', {
into: 'scopes/scope/projects/project/targets/target',
this.render('scopes/scope/targets/target/-navigation', {
into: 'scopes/scope/targets/target',
outlet: 'navigation',
});
this.render('scopes/scope/projects/project/targets/target/-actions', {
into: 'scopes/scope/projects/project/targets/target',
this.render('scopes/scope/targets/target/-actions', {
into: 'scopes/scope/targets/target',
outlet: 'actions',
});
}
@@ -3,9 +3,9 @@ import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { all } from 'rsvp';
import loading from 'ember-loading/decorator';
import { notifySuccess, notifyError } from '../../../../../../../decorators/notify';
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute extends Route {
export default class ScopesScopeTargetsTargetAddHostSetsRoute extends Route {
// =services
@service intl;
@@ -26,9 +26,9 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute ext
*/
async model() {
const target = this.modelFor(
'scopes.scope.projects.project.targets.target'
'scopes.scope.targets.target'
);
const { id: scope_id } = this.modelFor('scopes.scope.projects.project');
const { id: scope_id } = this.modelFor('scopes.scope');
const hostCatalogs = await this.store.query('host-catalog', { scope_id });
await all(
hostCatalogs.map(({ id: host_catalog_id }) =>
@@ -51,20 +51,20 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute ext
super.renderTemplate(...arguments);
this.render(
'scopes/scope/projects/project/targets/target/add-host-sets/-header',
'scopes/scope/targets/target/add-host-sets/-header',
{
into: 'scopes/scope/projects/project/targets/target',
into: 'scopes/scope/targets/target',
outlet: 'header',
}
);
this.render('-empty', {
into: 'scopes/scope/projects/project/targets/target',
into: 'scopes/scope/targets/target',
outlet: 'navigation',
});
this.render('-empty', {
into: 'scopes/scope/projects/project/targets/target',
into: 'scopes/scope/targets/target',
outlet: 'actions',
});
}
@@ -78,7 +78,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute ext
async save(target, hostSetIDs) {
await target.addHostSets(hostSetIDs);
this.replaceWith(
'scopes.scope.projects.project.targets.target.host-sets'
'scopes.scope.targets.target.host-sets'
);
}
@@ -87,6 +87,6 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute ext
*/
@action
cancel() {
this.replaceWith('scopes.scope.projects.project.targets.target.host-sets');
this.replaceWith('scopes.scope.targets.target.host-sets');
}
}
@@ -3,10 +3,10 @@ import { all, hash } from 'rsvp';
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 { confirm } from '../../../../../decorators/confirm';
import { notifySuccess, notifyError } from '../../../../../decorators/notify';
export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extends Route {
export default class ScopesScopeTargetsTargetHostSetsRoute extends Route {
// =services
@service intl;
@@ -21,7 +21,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extend
*/
beforeModel() {
const { scopeID, host_sets } = this.modelFor(
'scopes.scope.projects.project.targets.target'
'scopes.scope.targets.target'
);
const promises = host_sets.map(
({ host_set_id, host_catalog_id: hostCatalogID }) =>
@@ -45,7 +45,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extend
* @return {TargetModel}
*/
model() {
return this.modelFor('scopes.scope.projects.project.targets.target');
return this.modelFor('scopes.scope.targets.target');
}
// =actions
@@ -0,0 +1,4 @@
import Route from '@ember/routing/route';
export default class ScopesScopeTargetsTargetIndexRoute extends Route {
}
+22
View File
@@ -0,0 +1,22 @@
import Service from '@ember/service';
import { tracked } from '@glimmer/tracking';
/**
* This simple non-functional service is used to retain references to
* the currently active scope or scopes.
*/
export default class ScopeService extends Service {
// =attributes
/**
* @type {ScopeModel}
*/
@tracked org;
/**
* @type {ScopeModel}
*/
@tracked project;
}
+125 -3
View File
@@ -1,3 +1,15 @@
{{#if @model.isOrg}}
{{title (t "resources.org.title_plural") }}
{{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}}
{{/if}}
<Rose::Layout::Sidebar as |sidebarLayout|>
{{#if this.session.isAuthenticated}}
@@ -5,7 +17,7 @@
{{#if @model.isGlobal}}
<Rose::Nav::Sidebar @title={{t "titles.general"}} as |nav|>
<nav.link @route="scopes.scope.orgs">
<nav.link @route="scopes.scope.scopes">
<Rose::Icon
@name="app-icons/org"
@size="medium" />
@@ -16,7 +28,15 @@
{{#if @model.isOrg}}
<Rose::Nav::Sidebar @title={{t "titles.general"}} as |nav|>
<nav.link @route="scopes.scope.projects">
{{#if this.session.data.authenticated.isGlobal}}
<nav.link @route="scopes.scope.scopes" @model="global">
<Rose::Icon
@name="app-icons/org"
@size="medium" />
{{t "resources.org.title_plural"}}
</nav.link>
{{/if}}
<nav.link @route="scopes.scope.scopes">
<Rose::Icon
@name="app-icons/project"
@size="medium" />
@@ -25,7 +45,109 @@
</Rose::Nav::Sidebar>
{{/if}}
{{outlet "sidebar"}}
{{#if @model.isProject}}
<Rose::Nav::Sidebar @title={{t "titles.general"}} as |nav|>
{{#if this.session.data.authenticated.isGlobal}}
<nav.link @route="scopes.scope.scopes" @model="global">
<Rose::Icon
@name="app-icons/org"
@size="medium" />
{{t "resources.org.title_plural"}}
</nav.link>
{{/if}}
<nav.link @route="scopes.scope.scopes" @model={{@model.scopeID}}>
<Rose::Icon
@name="app-icons/project"
@size="medium" />
{{t "resources.project.title_plural"}}
</nav.link>
</Rose::Nav::Sidebar>
{{!-- TODO: after scope awareness refactor, update groups and roles
to support project scopes --}}
{{!--
<Rose::Nav::Sidebar @title={{t "titles.iam"}} as |nav|>
<nav.link @route="scopes.scope.groups">
<Rose::Icon
@name="app-icons/group"
@size="medium" />
{{t "resources.group.title_plural"}}
</nav.link>
<nav.link @route="scopes.scope.roles">
<Rose::Icon
@name="app-icons/roles"
@size="medium" />
{{t "resources.role.title_plural"}}
</nav.link>
</Rose::Nav::Sidebar>
--}}
<Rose::Nav::Sidebar @title={{t "titles.resources"}} as |nav|>
<nav.link @route="scopes.scope.sessions">
<Rose::Icon
@name="app-icons/action-session"
@size="medium" />
{{t "resources.session.title_plural"}}
</nav.link>
<nav.link @route="scopes.scope.targets">
<Rose::Icon
@name="app-icons/target"
@size="medium" />
{{t "resources.target.title_plural"}}
</nav.link>
<nav.link @route="scopes.scope.host-catalogs">
<Rose::Icon
@name="app-icons/host-catalogs"
@size="medium" />
{{t "resources.host-catalog.title_plural"}}
</nav.link>
</Rose::Nav::Sidebar>
{{/if}}
{{#unless @model.isProject}}
<Rose::Nav::Sidebar @title={{t "titles.iam"}} as |nav|>
<nav.link @route="scopes.scope.users">
<Rose::Icon
@name="app-icons/users"
@size="medium" />
{{t "resources.user.title_plural"}}
</nav.link>
<nav.link @route="scopes.scope.groups">
<Rose::Icon
@name="app-icons/group"
@size="medium" />
{{t "resources.group.title_plural"}}
</nav.link>
<nav.link @route="scopes.scope.roles">
<Rose::Icon
@name="app-icons/roles"
@size="medium" />
{{t "resources.role.title_plural"}}
</nav.link>
<nav.link @route="scopes.scope.auth-methods">
<Rose::Icon
@name="app-icons/auth-method"
@size="medium" />
{{t "resources.auth-method.title_plural"}}
</nav.link>
</Rose::Nav::Sidebar>
{{/unless}}
{{#if @model.isOrg}}
{{#if this.session.data.authenticated.isGlobal}}
<Rose::Nav::Sidebar @title={{t "titles.settings"}} as |nav|>
<nav.link @route="scopes.scope.edit">
{{t "resources.org.messages.settings.title"}}
</nav.link>
</Rose::Nav::Sidebar>
{{/if}}
{{/if}}
{{#if @model.isProject}}
<Rose::Nav::Sidebar @title={{t "titles.settings"}} as |nav|>
<nav.link @route="scopes.scope.edit">
{{t "resources.project.messages.settings.title"}}
</nav.link>
</Rose::Nav::Sidebar>
{{/if}}
</sidebarLayout.sidebar>
{{/if}}
@@ -1,5 +1,5 @@
<Rose::Dropdown
@text={{this.model.displayName}}
@text={{this.scopes.selectedOrg.displayName}}
@icon="app-icons/org" as |dropdown|
>
{{#if this.session.data.authenticated.isGlobal}}
@@ -7,14 +7,23 @@
{{t "titles.global"}}
</dropdown.link>
<dropdown.separator />
{{#each this.orgScopes as |scope|}}
{{/if}}
{{#each this.scopes.orgs as |scope|}}
<dropdown.link @route="scopes.scope" @model={{scope.id}}>
{{scope.displayName}}
</dropdown.link>
{{/each}}
</Rose::Dropdown>
{{#if this.scopes.selectedProject}}
<Rose::Dropdown
@text={{this.scopes.selectedProject.displayName}}
@icon="app-icons/project" as |dropdown|
>
{{#each this.scopes.projects as |scope|}}
<dropdown.link @route="scopes.scope" @model={{scope.id}}>
{{scope.displayName}}
</dropdown.link>
{{/each}}
{{else}}
<dropdown.link @route="scopes.scope" @model={{this.model.id}}>
{{this.model.displayName}}
</dropdown.link>
{{/if}}
</Rose::Dropdown>
</Rose::Dropdown>
{{/if}}
@@ -14,6 +14,9 @@
@text={{t "actions.choose-different-org"}}
@icon="user-organization"
as |dropdown|>
<dropdown.link @route="scopes.scope.authenticate" @model="global">
{{t "titles.global"}}
</dropdown.link>
{{#each this.sortedScopes as |scope|}}
<dropdown.link @route="scopes.scope.authenticate" @model={{scope.id}}>
{{scope.displayName}}
@@ -5,11 +5,20 @@
</page.breadcrumbs>
<page.header>
<h2>
{{t "resources.project.title"}}
<DocLink @doc="project" @iconSize="large" />
</h2>
<p>{{t "resources.project.description"}}</p>
{{#if @model.isOrg}}
<h2>
{{t "resources.org.title"}}
<DocLink @doc="org" @iconSize="large" />
</h2>
<p>{{t "resources.org.description"}}</p>
{{/if}}
{{#if @model.isProject}}
<h2>
{{t "resources.project.title"}}
<DocLink @doc="project" @iconSize="large" />
</h2>
<p>{{t "resources.project.description"}}</p>
{{/if}}
<Copyable
@text={{@model.id}}
@buttonText={{t "actions.copy-to-clipboard"}}
@@ -21,7 +30,7 @@
<page.navigation>
<Rose::Nav::Tabs as |nav|>
<nav.link @route='scopes.scope.projects.project'>
<nav.link @route='scopes.scope'>
{{t 'titles.details'}}
</nav.link>
</Rose::Nav::Tabs>
@@ -40,7 +49,7 @@
</page.actions>
<page.body>
<Form::Project
<Form::Scope
@model={{@model}}
@submit={{route-action "save" @model}}
@cancel={{route-action "cancel" @model}}
@@ -1,12 +1,12 @@
<Rose::Dropdown @text="{{t 'actions.manage'}}" @dropdownRight={{true}} as |dropdown|>
<dropdown.link
@route="scopes.scope.projects.project.host-catalogs.host-catalog.hosts.new"
@route="scopes.scope.host-catalogs.host-catalog.hosts.new"
@model={{@model}}
>
{{t "resources.host.actions.create"}}
</dropdown.link>
<dropdown.link
@route="scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.new"
@route="scopes.scope.host-catalogs.host-catalog.host-sets.new"
@model={{@model}}
>
{{t "resources.host-set.actions.create"}}
@@ -0,0 +1,11 @@
<Rose::Nav::Tabs as |nav|>
<nav.link @route='scopes.scope.host-catalogs.host-catalog.index'>
{{t 'titles.details'}}
</nav.link>
<nav.link @route='scopes.scope.host-catalogs.host-catalog.hosts'>
{{t 'resources.host.title_plural'}}
</nav.link>
<nav.link @route='scopes.scope.host-catalogs.host-catalog.host-sets'>
{{t 'resources.host-set.title_plural'}}
</nav.link>
</Rose::Nav::Tabs>
@@ -1,3 +1,3 @@
{{title (t "resources.host-set.title_plural")}}
{{outlet}}
{{outlet}}
Loaded 100 of 287 files, more files were not shown because too many files have changed in this diff. Show more