chore: 🤖 List groups under /groups page

This commit is contained in:
Susmitha Girumala committed 2020-06-24 17:07:32 -04:00
1 parent 17057fcb18
commit 98c7d003a0
12 files changed
+131 -2

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
import ApplicationAdapter from './application';
import ScopeAdapterMixin from '../mixins/scope-adapter';
export default class GroupAdapter extends ApplicationAdapter.extend(
ScopeAdapterMixin
) {
// =attributes
/**
* Group is scoped to org only, for now.
* @type {boolean}
*/
includeProject = false;
}
+1
View File
@@ -0,0 +1 @@
export { default } from 'api/adapters/group';
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Adapter | group', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let adapter = this.owner.lookup('adapter:group');
assert.ok(adapter);
});
});
+9
View File
@@ -1,4 +1,13 @@
import Route from '@ember/routing/route';
export default class OrgsOrgGroupsRoute extends Route {
// =methods
/**
* Returns all roles from store.
* @return {Promise[RoleModel]}
*/
model() {
return this.store.findAll('group');
}
}
+1 -1
View File
@@ -1,3 +1,3 @@
import Route from '@ember/routing/route';
export default class OrgsOrgRolesIndexRoute extends Route { }
export default class OrgsOrgRolesIndexRoute extends Route {}
@@ -1 +1,59 @@
{{outlet}}
<Rose::Layout::Page as |page|>
<page.header>
<h2>{{t "resources.groups"}}</h2>
</page.header>
<page.actions>
{{#if @model}}
<Rose::LinkButton @route="orgs.org.groups.new" @style="primary">{{t 'titles.new'}}</Rose::LinkButton>
{{/if}}
</page.actions>
<page.body>
{{#if @model}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.cell>{{t 'form.label.name'}}</row.cell>
<row.cell>{{t 'form.label.description'}}</row.cell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model as |group|}}
<body.row as |row|>
<row.cell>
<LinkTo
@route="orgs.org.groups.group"
@model={{group}}
>
{{group.name}}
</LinkTo>
</row.cell>
<row.cell>{{group.description}}</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
{{else}}
<Rose::Layout::Centered>
<Rose::Message @title={{t 'titles.groups-welcome'}} as |message|>
<message.description>
{{t 'descriptions.groups-welcome'}}
</message.description>
<message.link @route="orgs.org.groups.new">
<Rose::Icon @name="plus-circle-outline" />
{{t 'titles.new'}}
</message.link>
</Rose::Message>
</Rose::Layout::Centered>
{{/if}}
</page.body>
</Rose::Layout::Page>
+7
View File
@@ -47,6 +47,13 @@ export default function() {
this.patch('/orgs/:org_id/roles/:id');
this.del('/orgs/:org_id/roles/:id');
// group
this.get('/orgs/:org_id/groups');
this.post('/orgs/:org_id/groups');
this.get('/orgs/:org_id/groups/:id');
this.patch('/orgs/:org_id/groups/:id');
this.del('/orgs/:org_id/groups/:id');
// Other resources
// host-catalog
+3
View File
@@ -0,0 +1,3 @@
import factory from '../generated/factories/group';
export default factory.extend();
@@ -0,0 +1,16 @@
import { Factory } from 'ember-cli-mirage';
import { random, date } from 'faker';
/**
* GeneratedGroupModelFactory
* Group contains all fields related to a Group resource
*/
export default Factory.extend({
name: () => random.words(),
description: () => random.words(),
created_time: () => date.recent(),
updated_time: () => date.recent(),
disabled: () => random.boolean(),
});
+2
View File
@@ -15,6 +15,8 @@ export default function(server) {
// IAM
// Roles
server.createList('role', 5);
// Groups
server.createList('group', 5);
// Other resources
+5
View File
@@ -0,0 +1,5 @@
import ApplicationSerializer from './application';
export default ApplicationSerializer.extend({
modelName: 'group'
});
+2
View File
@@ -23,12 +23,14 @@ titles:
projects-welcome: Welcome to Projects
host-catalogs-welcome: Welcome to Host Catalogs
roles-welcome: Welcome to Roles
groups-welcome: Welcome to Groups
descriptions:
host-catalogs: Overview of collections of hosts and host sets.
empty-set: There are no items to display yet. You may be able to add items or try back later.
projects-welcome: Projects allow you to create and manage host catalogs. To start, create a project.
host-catalogs-welcome: Host catalogs allow you to configure to collect and create hosts and host sets. To start, create a host catalog.
roles-welcome: Roles are collections of capabilities that can be granted to user and/or groups.
groups-welcome: Groups are collections of users.
states:
info: Info
success: Success