5c18dc099f
* ui: Upgrade ember-data models to use native classes/decorators * ui: Update remaining ember-data imports * ui: Move ember-data Adapters to use native classes * ui: Upgrade serializers to native classes/decorators * ui: remove meta from roles, they never had it to start with
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
import Model, { attr } from '@ember-data/model';
|
|
import { computed } from '@ember/object';
|
|
import { MANAGEMENT_ID } from 'consul-ui/models/policy';
|
|
|
|
export const PRIMARY_KEY = 'uid';
|
|
export const SLUG_KEY = 'AccessorID';
|
|
|
|
export default class Token extends Model {
|
|
@attr('string') uid;
|
|
@attr('string') AccessorID;
|
|
|
|
@attr('string') Datacenter;
|
|
@attr('string') Namespace;
|
|
@attr('string') IDPName;
|
|
@attr('string') SecretID;
|
|
|
|
@attr('boolean') Legacy;
|
|
@attr('boolean') Local;
|
|
@attr('string', { defaultValue: () => '' }) Description;
|
|
@attr() meta; // {}
|
|
|
|
@attr({ defaultValue: () => [] }) Policies;
|
|
@attr({ defaultValue: () => [] }) Roles;
|
|
@attr({ defaultValue: () => [] }) ServiceIdentities;
|
|
@attr({ defaultValue: () => [] }) NodeIdentities;
|
|
@attr('date') CreateTime;
|
|
@attr('string') Hash;
|
|
@attr('number') CreateIndex;
|
|
@attr('number') ModifyIndex;
|
|
|
|
// Legacy
|
|
@attr('string') Type;
|
|
@attr('string', { defaultValue: () => '' }) Name;
|
|
@attr('string') Rules;
|
|
// End Legacy
|
|
|
|
@computed('Policies.[]')
|
|
get isGlobalManagement() {
|
|
return (this.Policies || []).find(item => item.ID === MANAGEMENT_ID);
|
|
}
|
|
}
|