github.com/hernad/nomad@v1.6.112/ui/app/components/profile-navbar-item.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  // @ts-check
     7  
     8  import Component from '@glimmer/component';
     9  import { inject as service } from '@ember/service';
    10  
    11  export default class ProfileNavbarItemComponent extends Component {
    12    @service token;
    13    @service router;
    14    @service store;
    15  
    16    profileOptions = [
    17      {
    18        label: 'Authorization',
    19        key: 'authorization',
    20        action: () => {
    21          this.router.transitionTo('settings.tokens');
    22        },
    23      },
    24      {
    25        label: 'Sign Out',
    26        key: 'sign-out',
    27        action: () => {
    28          this.token.setProperties({
    29            secret: undefined,
    30          });
    31  
    32          // Clear out all data to ensure only data the anonymous token is privileged to see is shown
    33          this.store.unloadAll();
    34          this.token.reset();
    35          this.router.transitionTo('jobs.index');
    36        },
    37      },
    38    ];
    39  
    40    profileSelection = this.profileOptions[0];
    41  }