github.com/hernad/nomad@v1.6.112/ui/app/models/scale-event.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import { computed } from '@ember/object';
     7  import Fragment from 'ember-data-model-fragments/fragment';
     8  import { attr } from '@ember-data/model';
     9  import { fragmentOwner } from 'ember-data-model-fragments/attributes';
    10  
    11  export default class ScaleEvent extends Fragment {
    12    @fragmentOwner() taskGroupScale;
    13  
    14    @attr('number') count;
    15    @attr('number') previousCount;
    16    @attr('boolean') error;
    17    @attr('string') evalId;
    18  
    19    @computed('count', function () {
    20      return this.count != null;
    21    })
    22    hasCount;
    23  
    24    @computed('count', 'previousCount', function () {
    25      return this.count > this.previousCount;
    26    })
    27    increased;
    28  
    29    @attr('date') time;
    30    @attr('number') timeNanos;
    31  
    32    @attr('string') message;
    33    @attr() meta;
    34  
    35    @computed('meta', function () {
    36      return Object.keys(this.meta).length > 0;
    37    })
    38    hasMeta;
    39  
    40    // Since scale events don't have proper IDs, this UID is a compromise
    41    @computed('time', 'timeNanos', 'message', function () {
    42      return `${+this.time}${this.timeNanos}_${this.message}`;
    43    })
    44    uid;
    45  }