-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8551 from hashicorp/f-ui/scaling-observability
UI: Scaling observability
- Loading branch information
Showing
37 changed files
with
535 additions
and
23 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
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,7 @@ | ||
import WatchableNamespaceIDs from './watchable-namespace-ids'; | ||
|
||
export default class JobScaleAdapter extends WatchableNamespaceIDs { | ||
urlForFindRecord(id, type, hash) { | ||
return super.urlForFindRecord(id, 'job', hash, 'scale'); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,12 +1,7 @@ | ||
import Watchable from './watchable'; | ||
import WatchableNamespaceIDs from './watchable-namespace-ids'; | ||
|
||
export default class JobSummaryAdapter extends Watchable { | ||
export default class JobSummaryAdapter extends WatchableNamespaceIDs { | ||
urlForFindRecord(id, type, hash) { | ||
const [name, namespace] = JSON.parse(id); | ||
let url = super.urlForFindRecord(name, 'job', hash) + '/summary'; | ||
if (namespace && namespace !== 'default') { | ||
url += `?namespace=${namespace}`; | ||
} | ||
return url; | ||
return super.urlForFindRecord(id, 'job', hash, 'summary'); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Model from 'ember-data/model'; | ||
import { belongsTo } from 'ember-data/relationships'; | ||
import { fragmentArray } from 'ember-data-model-fragments/attributes'; | ||
import classic from 'ember-classic-decorator'; | ||
|
||
@classic | ||
export default class JobSummary extends Model { | ||
@belongsTo('job') job; | ||
|
||
@fragmentArray('task-group-scale') taskGroupScales; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { computed } from '@ember/object'; | ||
import Fragment from 'ember-data-model-fragments/fragment'; | ||
import attr from 'ember-data/attr'; | ||
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; | ||
|
||
@computed('count', function() { | ||
return this.count != null; | ||
}) | ||
hasCount; | ||
|
||
@computed('count', 'previousCount', function() { | ||
return this.count > this.previousCount; | ||
}) | ||
increased; | ||
|
||
@attr('date') time; | ||
@attr('number') timeNanos; | ||
|
||
@attr('string') message; | ||
@attr() meta; | ||
|
||
@computed('meta', function() { | ||
return Object.keys(this.meta).length > 0; | ||
}) | ||
hasMeta; | ||
} |
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,23 @@ | ||
import { computed } from '@ember/object'; | ||
import Fragment from 'ember-data-model-fragments/fragment'; | ||
import attr from 'ember-data/attr'; | ||
import { fragmentOwner, fragmentArray } from 'ember-data-model-fragments/attributes'; | ||
|
||
export default class TaskGroupScale extends Fragment { | ||
@fragmentOwner() jobScale; | ||
|
||
@attr('string') name; | ||
|
||
@attr('number') desired; | ||
@attr('number') placed; | ||
@attr('number') running; | ||
@attr('number') healthy; | ||
@attr('number') unhealthy; | ||
|
||
@fragmentArray('scale-event') events; | ||
|
||
@computed('events.length', function() { | ||
return this.events.length; | ||
}) | ||
isVisible; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { assign } from '@ember/polyfills'; | ||
import ApplicationSerializer from './application'; | ||
|
||
export default class JobScale extends ApplicationSerializer { | ||
normalize(modelClass, hash) { | ||
// Transform the map-based TaskGroups object into an array-based | ||
// TaskGroupScale fragment list | ||
hash.PlainJobId = hash.JobID; | ||
hash.ID = JSON.stringify([hash.JobID, hash.Namespace || 'default']); | ||
hash.JobID = hash.ID; | ||
|
||
const taskGroups = hash.TaskGroups || {}; | ||
hash.TaskGroupScales = Object.keys(taskGroups).map(key => { | ||
return assign(taskGroups[key], { Name: key }); | ||
}); | ||
|
||
return super.normalize(modelClass, hash); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import ApplicationSerializer from './application'; | ||
|
||
export default class ScaleEventSerializer extends ApplicationSerializer { | ||
normalize(typeHash, hash) { | ||
hash.TimeNanos = hash.Time % 1000000; | ||
hash.Time = Math.floor(hash.Time / 1000000); | ||
|
||
return super.normalize(typeHash, hash); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.json-viewer { | ||
&.has-fluid-height .CodeMirror-scroll { | ||
min-height: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<IvyCodemirror | ||
data-test-json-viewer | ||
@value={{this.jsonStr}} | ||
@options={{hash | ||
mode="javascript" | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{{#if this.isOpen}} | ||
<div data-test-accordion-body class="accordion-body"> | ||
<div data-test-accordion-body class="accordion-body {{if this.fullBleed "is-full-bleed"}}"> | ||
{{yield}} | ||
</div> | ||
{{/if}} |
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,35 @@ | ||
<ListAccordion data-test-scale-events @source={{@events}} @key="time" as |a|> | ||
<a.head @buttonLabel="details" @isExpandable={{a.item.hasMeta}} class="with-columns"> | ||
<div class="columns inline-definitions"> | ||
<div class="column is-3"> | ||
<span class="icon-field"> | ||
<span class="icon-container" title="{{if a.item.error "Error event"}}" data-test-error={{a.item.error}}> | ||
{{#if a.item.error}}{{x-icon "cancel-circle-fill" class="is-danger"}}{{/if}} | ||
</span> | ||
<span data-test-time title="{{format-ts a.item.time}}">{{format-month-ts a.item.time}}</span> | ||
</span> | ||
</div> | ||
<div class="column is-2"> | ||
{{#if a.item.hasCount}} | ||
<span data-test-count-icon | ||
class="tooltip" | ||
aria-label="Count {{if a.item.increased "increased" "decreased"}} to {{a.item.count}}" | ||
> | ||
{{#if a.item.increased}} | ||
{{x-icon "arrow-up" class="is-danger"}} | ||
{{else}} | ||
{{x-icon "arrow-down" class="is-primary"}} | ||
{{/if}} | ||
</span> | ||
<span data-test-count>{{a.item.count}}</span> | ||
{{/if}} | ||
</div> | ||
<div class="column" data-test-message> | ||
{{a.item.message}} | ||
</div> | ||
</div> | ||
</a.head> | ||
<a.body @fullBleed={{true}}> | ||
<JsonViewer @json={{a.item.meta}} @fluidHeight={{true}} /> | ||
</a.body> | ||
</ListAccordion> |
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
Oops, something went wrong.