2023-04-10 15:36:59 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2020-07-28 04:26:17 +00:00
|
|
|
import { computed } from '@ember/object';
|
2020-07-24 04:39:50 +00:00
|
|
|
import Fragment from 'ember-data-model-fragments/fragment';
|
2021-02-17 21:01:44 +00:00
|
|
|
import { attr } from '@ember-data/model';
|
2020-07-24 04:39:50 +00:00
|
|
|
import { fragmentOwner } from 'ember-data-model-fragments/attributes';
|
|
|
|
|
|
|
|
export default class ScaleEvent extends Fragment {
|
|
|
|
@fragmentOwner() taskGroupScale;
|
|
|
|
|
|
|
|
@attr('number') count;
|
|
|
|
@attr('number') previousCount;
|
|
|
|
@attr('boolean') error;
|
|
|
|
@attr('string') evalId;
|
|
|
|
|
2021-12-28 14:45:20 +00:00
|
|
|
@computed('count', function () {
|
2020-07-28 18:03:47 +00:00
|
|
|
return this.count != null;
|
|
|
|
})
|
|
|
|
hasCount;
|
|
|
|
|
2021-12-28 14:45:20 +00:00
|
|
|
@computed('count', 'previousCount', function () {
|
2020-07-28 04:26:17 +00:00
|
|
|
return this.count > this.previousCount;
|
|
|
|
})
|
|
|
|
increased;
|
|
|
|
|
2020-07-24 04:39:50 +00:00
|
|
|
@attr('date') time;
|
|
|
|
@attr('number') timeNanos;
|
|
|
|
|
|
|
|
@attr('string') message;
|
|
|
|
@attr() meta;
|
2020-07-28 04:26:17 +00:00
|
|
|
|
2021-12-28 14:45:20 +00:00
|
|
|
@computed('meta', function () {
|
2020-07-28 04:26:17 +00:00
|
|
|
return Object.keys(this.meta).length > 0;
|
|
|
|
})
|
|
|
|
hasMeta;
|
2020-08-05 18:55:17 +00:00
|
|
|
|
|
|
|
// Since scale events don't have proper IDs, this UID is a compromise
|
2021-12-28 14:45:20 +00:00
|
|
|
@computed('time', 'timeNanos', 'message', function () {
|
2020-08-05 18:55:17 +00:00
|
|
|
return `${+this.time}${this.timeNanos}_${this.message}`;
|
|
|
|
})
|
|
|
|
uid;
|
2020-07-24 04:39:50 +00:00
|
|
|
}
|