-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#9 Add some user and session configuration.
- Loading branch information
Showing
31 changed files
with
869 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import BaseModel from './-base'; | ||
import DS from 'ember-data'; | ||
|
||
export default BaseModel.extend({ | ||
|
||
/** Attributes | ||
* ---------------------------------------------------------------------------------------------------------------- */ | ||
|
||
browser: DS.attr('string'), | ||
browserVersion: DS.attr('string'), | ||
device: DS.attr('string'), | ||
ipAddress: DS.attr('string'), | ||
platform: DS.attr('string'), | ||
platformVersion: DS.attr('string'), | ||
|
||
/** Relationships | ||
* ---------------------------------------------------------------------------------------------------------------- */ | ||
|
||
user: DS.belongsTo('user') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import BaseModel from './-base'; | ||
import DS from 'ember-data'; | ||
|
||
export default BaseModel.extend({ | ||
|
||
/** Attributes | ||
* ---------------------------------------------------------------------------------------------------------------- */ | ||
|
||
email: DS.attr('string'), | ||
|
||
/** Relationships | ||
* ---------------------------------------------------------------------------------------------------------------- */ | ||
|
||
roles: DS.hasMany('role'), | ||
sessions: DS.hasMany('session') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { hash } from 'rsvp'; | ||
import { get, set } from '@ember/object'; | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({ | ||
afterModel(resolvedModel) { | ||
set(resolvedModel, 'usersCount', get(resolvedModel, 'users.meta.record-count')); | ||
}, | ||
|
||
model() { | ||
return hash({ | ||
users: this.get('store').query('user', { | ||
sort: 'email' | ||
}) | ||
}) | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { get } from '@ember/object'; | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({ | ||
beforeModel() { | ||
const params = this.paramsFor('protected.configuration.users.user'); | ||
return this.get('store').query('user', { | ||
filter: { id: get(params, 'user_id') }, | ||
include: '' + | ||
'roles' + | ||
',sessions' + | ||
'' | ||
}) | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({}); |
20 changes: 20 additions & 0 deletions
20
app/routes/protected/configuration/users/user/sessions/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { hash } from 'rsvp'; | ||
import { get, set } from '@ember/object'; | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({ | ||
afterModel(resolvedModel) { | ||
set(resolvedModel, 'sessionsCount', get(resolvedModel, 'sessions.meta.record-count')); | ||
}, | ||
|
||
model() { | ||
const user = this.modelFor('protected.configuration.users.user'); | ||
return hash({ | ||
sessions: this.get('store').query('session', { | ||
filter: { user: user.get('id') }, | ||
sort: '' + | ||
'-created-at' | ||
}) | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
<section class="my-3"> | ||
<div class="container"> | ||
<div class="d-flex my-3"> | ||
<h1 class="flex-fill">Configuration</h1> | ||
<div class="align-self-center"> | ||
<div class="align-items-center d-flex my-3"> | ||
<h1 class="flex-fill h5"> | ||
Configuration | ||
</h1> | ||
<div class="align-self-center btn-group"> | ||
<button class="btn btn-outline-secondary" disabled="disabled" type="button"> | ||
{{fa-icon "question"}} | ||
</button> | ||
</div> | ||
</div> | ||
|
||
<div class="list-group"> | ||
{{#link-to "protected.configuration.roles.index" class="list-group-item"}} | ||
{{#link-to "protected.configuration.roles.index" class="list-group-item list-group-item-action"}} | ||
Roles | ||
{{/link-to}} | ||
{{#link-to "protected.configuration.users.index" class="list-group-item list-group-item-action"}} | ||
Users | ||
{{/link-to}} | ||
</div> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{outlet}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<section class="my-3"> | ||
<div class="container"> | ||
<div class="align-items-center d-flex my-3"> | ||
<h1 class="flex-fill h5"> | ||
{{#link-to "protected.configuration.index"}} | ||
Configuration | ||
{{/link-to}} | ||
{{fa-icon "caret-right" fixedWidth=true}} | ||
Users | ||
</h1> | ||
<div class="align-self-center btn-group"> | ||
<button class="btn btn-outline-secondary" disabled="disabled" type="button"> | ||
{{fa-icon "plus"}} | ||
</button> | ||
<button class="btn btn-outline-secondary" disabled="disabled" type="button"> | ||
{{fa-icon "question"}} | ||
</button> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<p class="small text-muted"> | ||
{{model.users.length}} | ||
of | ||
{{model.usersCount}} | ||
</p> | ||
</div> | ||
<div class="list-group"> | ||
{{#each model.users as |user|}} | ||
{{#link-to "protected.configuration.users.user.index" user.id | ||
class="align-items-center d-flex justify-content-between list-group-item list-group-item-action" | ||
}} | ||
{{user.email}} | ||
<small class="text-muted text-right"> | ||
{{date-short-llll user.updatedAt}} | ||
</small> | ||
{{/link-to}} | ||
{{else}} | ||
<div class="list-group-item"> | ||
<em>None</em> | ||
</div> | ||
{{/each}} | ||
</div> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<section class="my-3"> | ||
<div class="container"> | ||
<div class="align-items-center d-flex my-3"> | ||
<h1 class="flex-fill h5"> | ||
{{#link-to "protected.configuration.index"}} | ||
Configuration | ||
{{/link-to}} | ||
{{fa-icon "caret-right" fixedWidth=true}} | ||
{{#link-to "protected.configuration.users.index"}} | ||
Users | ||
{{/link-to}} | ||
{{fa-icon "caret-right" fixedWidth=true}} | ||
{{model.email}} | ||
</h1> | ||
<div class="align-self-center btn-group"> | ||
<button class="btn btn-outline-secondary" disabled="disabled" type="button"> | ||
{{fa-icon "question"}} | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
<section> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-sm-3 pt-2"> | ||
<div class="list-group"> | ||
{{#link-to "protected.configuration.users.user.index" class="list-group-item list-group-item-action"}} | ||
Summary | ||
{{/link-to}} | ||
{{#link-to "protected.configuration.users.user.sessions.index" | ||
class="align-items-center d-flex justify-content-between list-group-item list-group-item-action" | ||
}} | ||
Sessions | ||
<span class="badge badge-secondary badge-pill"> | ||
{{model.sessions.length}} | ||
</span> | ||
{{/link-to}} | ||
</div> | ||
</div> | ||
<div class="col-sm-9 pt-2"> | ||
{{outlet}} | ||
</div> | ||
</div> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{gravatar-image email=model.email}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{outlet}} |
Oops, something went wrong.