-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Basic dropdown styles * Some cleanup * delog * Default nomad hover state styles * Component separation-of-concerns and acceptance tests for auth dropdown * lintfix
- Loading branch information
1 parent
75736b6
commit a50d93d
Showing
7 changed files
with
143 additions
and
7 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,24 @@ | ||
{{#if this.token.selfToken}} | ||
<PowerSelect | ||
data-test-header-profile-dropdown | ||
{{keyboard-shortcut menuLevel=true pattern=(array "g" "p") }} | ||
@options={{this.profileOptions}} | ||
@onChange={{action (queue | ||
(fn (mut this.profileSelection)) | ||
this.profileSelection.action | ||
)}} | ||
@dropdownClass="dropdown-options" | ||
@matchTriggerWidth={{false}} | ||
@selected={{get this.profileSelection "key"}} | ||
class="profile-dropdown navbar-item" | ||
as |option|> | ||
<span class="ember-power-select-prefix">Profile</span> | ||
<span class="dropdown-label" data-test-dropdown-option={{option.key}}>{{option.label}}</span> | ||
</PowerSelect> | ||
{{else}} | ||
<LinkTo data-test-header-signin-link @route="settings.tokens" class="navbar-item" {{keyboard-shortcut menuLevel=true pattern=(array "g" "p") }}> | ||
Sign In | ||
</LinkTo> | ||
{{/if}} | ||
|
||
{{yield}} |
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,36 @@ | ||
// @ts-check | ||
|
||
import Component from '@glimmer/component'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default class ProfileNavbarItemComponent extends Component { | ||
@service token; | ||
@service router; | ||
@service store; | ||
|
||
profileOptions = [ | ||
{ | ||
label: 'Authorization', | ||
key: 'authorization', | ||
action: () => { | ||
this.router.transitionTo('settings.tokens'); | ||
}, | ||
}, | ||
{ | ||
label: 'Sign Out', | ||
key: 'sign-out', | ||
action: () => { | ||
this.token.setProperties({ | ||
secret: undefined, | ||
}); | ||
|
||
// Clear out all data to ensure only data the anonymous token is privileged to see is shown | ||
this.store.unloadAll(); | ||
this.token.reset(); | ||
this.router.transitionTo('jobs.index'); | ||
}, | ||
}, | ||
]; | ||
|
||
profileSelection = this.profileOptions[0]; | ||
} |
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