Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# This is a combination of 8 commits.
# This is the 1st commit message: Add admin UI for GitHub events # This is the commit message #2: Reorder UI, add navigation, add pagination # This is the commit message #3: Add admin navigation link # This is the commit message #4: Fix eslint # This is the commit message #5: Add beginning of tests # This is the commit message #6: Rename test and add currentRouteName assertion # This is the commit message #7: Add pagination helper function and get acceptance test passing # This is the commit message #8: Clean up paginate logic
- Loading branch information
Showing
28 changed files
with
482 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Controller from '@ember/controller'; | ||
|
||
export default Controller.extend({ | ||
queryParams: ['page', 'size'], | ||
page: 1, | ||
size: 20 | ||
}); |
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,25 @@ | ||
import Mixin from '@ember/object/mixin'; | ||
import { get, set } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
const NOT_AN_ADMIN = "You're not authorized to view this page."; | ||
|
||
export default Mixin.create({ | ||
currentUser: service(), | ||
flashMessages: service(), | ||
session: service(), | ||
|
||
beforeModel(transition) { | ||
let session = get(this, 'session'); | ||
let isAuthenticated = get(session, 'isAuthenticated'); | ||
let isAdmin = get(this, 'currentUser.user.admin'); | ||
|
||
if (isAuthenticated && isAdmin) { | ||
return this._super(...arguments); | ||
} else { | ||
set(session, 'attemptedTransition', transition); | ||
get(this, 'flashMessages').danger(NOT_AN_ADMIN); | ||
return this.transitionTo('login'); | ||
} | ||
} | ||
}); |
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,19 @@ | ||
import Model from 'ember-data/model'; | ||
import attr from 'ember-data/attr'; | ||
import { computed, get } from '@ember/object'; | ||
|
||
export default Model.extend({ | ||
action: attr(), | ||
eventType: attr(), | ||
failureReason: attr(), | ||
githubDeliveryId: attr(), | ||
insertedAt: attr('date'), | ||
payload: attr(), | ||
status: attr(), | ||
updatedAt: attr('date'), | ||
|
||
prettyPayload: computed('payload', function() { | ||
let payload = get(this, 'payload'); | ||
return JSON.stringify(payload, null, 2); | ||
}) | ||
}); |
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,5 @@ | ||
import Route from '@ember/routing/route'; | ||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; | ||
import AdminRouteMixin from 'code-corps-ember/mixins/admin-route-mixin'; | ||
|
||
export default Route.extend(AuthenticatedRouteMixin, AdminRouteMixin, { }); |
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,7 @@ | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({ | ||
model(params) { | ||
return this.store.find('github-event', params.id); | ||
} | ||
}); |
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,21 @@ | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({ | ||
model(params) { | ||
return this.store.query('github-event', { | ||
page: { | ||
page: params.page, | ||
'page-size': params.size | ||
} | ||
}); | ||
}, | ||
|
||
queryParams: { | ||
page: { | ||
refreshModel: true | ||
}, | ||
size: { | ||
refreshModel: true | ||
} | ||
} | ||
}); |
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
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,99 @@ | ||
.admin-main { | ||
@include span-columns(10); | ||
} | ||
|
||
.admin-sidebar { | ||
@include span-columns(2); | ||
display: flex; | ||
|
||
ul { | ||
flex: 1; | ||
} | ||
|
||
li { | ||
width: 100%; | ||
|
||
a { | ||
align-items: center; | ||
color: #333; | ||
display: flex; | ||
font-weight: 600; | ||
padding: 0.5em 0; | ||
|
||
&.active, &:hover { | ||
color: $blue; | ||
fill: $blue; | ||
transition: none; | ||
} | ||
} | ||
|
||
span { | ||
display: inline-flex; | ||
padding-right: 7px; | ||
} | ||
} | ||
} | ||
|
||
.log-rows { | ||
display: table; | ||
width: 100%; | ||
} | ||
|
||
.log-row { | ||
color: #525f7f; | ||
display: table-row; | ||
font-size: $body-font-size-normal; | ||
position: relative; | ||
|
||
code { | ||
background: none; | ||
font-size: $body-font-size-small; | ||
|
||
&.errored { | ||
background: $red; | ||
color: white; | ||
padding: 2px 4px; | ||
} | ||
} | ||
|
||
&--header { | ||
background: #F6F9FC; | ||
color: $gray--darkest; | ||
font-size: $body-font-size-small; | ||
font-weight: 700; | ||
text-transform: uppercase; | ||
} | ||
|
||
&:hover { | ||
color: $gray--darkest; | ||
} | ||
|
||
&:last-child { | ||
.log-cell { | ||
border-bottom: 1px solid $border-gray; | ||
} | ||
} | ||
} | ||
|
||
.log-cell { | ||
border-top: 1px solid $border-gray; | ||
display: table-cell; | ||
line-height: 22px; | ||
padding: 9px 14px; | ||
position: relative; | ||
vertical-align: top; | ||
white-space: nowrap; | ||
|
||
&:last-child { | ||
text-align: right; | ||
} | ||
|
||
&--shrink { | ||
width: 1px; | ||
} | ||
} | ||
|
||
.log-pagination { | ||
margin: 1em 0; | ||
text-align: right; | ||
} |
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,21 @@ | ||
<div class="container"> | ||
<div class="admin-sidebar"> | ||
<ul> | ||
<li> | ||
{{#link-to "admin.index"}} | ||
{{svg/sprite-icon icon="user-48" style="solid-dark-gray"}} | ||
<span>Admin</span> | ||
{{/link-to}} | ||
</li> | ||
<li> | ||
{{#link-to "admin.github-events"}} | ||
{{svg/sprite-icon icon="github-48" style="solid-dark-gray"}} | ||
<span>GitHub Events</span> | ||
{{/link-to}} | ||
</li> | ||
</ul> | ||
</div> | ||
<div class="admin-main"> | ||
{{outlet}} | ||
</div> | ||
</div> |
Oops, something went wrong.