-
Notifications
You must be signed in to change notification settings - Fork 2k
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 #4254 from hashicorp/f-ui-ss-restart-tracking
UI: Server-side reschedule tracking
- Loading branch information
Showing
27 changed files
with
540 additions
and
12 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,20 @@ | ||
import Component from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default Component.extend({ | ||
store: service(), | ||
tagName: '', | ||
|
||
// When given a string, the component will fetch the allocation | ||
allocationId: null, | ||
|
||
// An allocation can also be provided directly | ||
allocation: computed('allocationId', function() { | ||
return this.get('store').findRecord('allocation', this.get('allocationId')); | ||
}), | ||
|
||
time: null, | ||
linkToAllocation: true, | ||
label: '', | ||
}); |
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 |
---|---|---|
|
@@ -23,4 +23,6 @@ export default Model.extend({ | |
job: belongsTo('job'), | ||
|
||
modifyIndex: attr('number'), | ||
|
||
waitUntil: attr('date'), | ||
}); |
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,16 @@ | ||
import Fragment from 'ember-data-model-fragments/fragment'; | ||
import attr from 'ember-data/attr'; | ||
import { fragmentOwner } from 'ember-data-model-fragments/attributes'; | ||
import shortUUIDProperty from '../utils/properties/short-uuid'; | ||
|
||
export default Fragment.extend({ | ||
allocation: fragmentOwner(), | ||
|
||
previousAllocationId: attr('string'), | ||
previousNodeId: attr('string'), | ||
time: attr('date'), | ||
delay: attr('string'), | ||
|
||
previousAllocationShortId: shortUUIDProperty('previousAllocationId'), | ||
previousNodeShortId: shortUUIDProperty('previousNodeShortId'), | ||
}); |
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,17 @@ | ||
import ApplicationSerializer from './application'; | ||
|
||
export default ApplicationSerializer.extend({ | ||
normalize(typeHash, hash) { | ||
// Time is in the form of nanoseconds since epoch, but JS dates | ||
// only understand time to the millisecond precision. So store | ||
// the time (precise to ms) as a date, and store the remaining ns | ||
// as a number to deal with when it comes up. | ||
hash.TimeNanos = hash.RescheduleTime % 1000000; | ||
hash.Time = Math.floor(hash.RescheduleTime / 1000000); | ||
|
||
hash.PreviousAllocationId = hash.PrevAllocID ? hash.PrevAllocID : null; | ||
hash.PreviousNodeId = hash.PrevNodeID ? hash.PrevNodeID : null; | ||
|
||
return this._super(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
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,46 @@ | ||
<li class="timeline-note"> | ||
{{#if label}} | ||
<strong data-test-reschedule-label>{{label}}</strong> | ||
{{/if}} | ||
{{moment-format time "MMMM D, YYYY HH:mm:ss"}} | ||
</li> | ||
<li class="timeline-object" data-test-allocation={{allocation.id}}> | ||
<div class="boxed-section"> | ||
{{#unless linkToAllocation}} | ||
<div class="boxed-section-head" data-test-row-heading> | ||
This Allocation | ||
</div> | ||
{{/unless}} | ||
<div class="boxed-section-body inline-definitions"> | ||
<div class="columns"> | ||
<div class="column is-centered is-minimum"> | ||
<span data-test-allocation-status class="tag {{allocation.statusClass}}"> | ||
{{allocation.clientStatus}} | ||
</span> | ||
</div> | ||
<div class="column"> | ||
<div class="boxed-section-row"> | ||
<span class="pair"> | ||
<span class="term">Allocation</span> | ||
{{#if linkToAllocation}} | ||
{{#link-to "allocations.allocation" allocation.id}} | ||
<code data-test-allocation-link>{{allocation.shortId}}</code> | ||
{{/link-to}} | ||
{{else}} | ||
<code data-test-allocation-link>{{allocation.shortId}}</code> | ||
{{/if}} | ||
</span> | ||
<span class="pair"> | ||
<span class="term">Client</span> | ||
<span> | ||
{{#link-to "clients.client" data-test-node-link allocation.node.id}} | ||
<code>{{allocation.node.id}}</code> | ||
{{/link-to}} | ||
</span> | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</li> |
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,29 @@ | ||
<ol class="timeline"> | ||
{{#if allocation.nextAllocation}} | ||
{{reschedule-event-row | ||
label="Next Allocation" | ||
allocation=allocation.nextAllocation | ||
time=allocation.nextAllocation.modifyTime}} | ||
{{/if}} | ||
{{#if allocation.hasStoppedRescheduling}} | ||
<li class="timeline-note" data-test-stop-warning> | ||
{{x-icon "warning" class="is-warning is-text"}} Nomad has stopped attempting to reschedule this allocation. | ||
</li> | ||
{{/if}} | ||
{{#if (and allocation.followUpEvaluation.waitUntil (not allocation.nextAllocation))}} | ||
<li class="timeline-note" data-test-attempt-notice> | ||
{{x-icon "clock" class="is-info is-text"}} Nomad will attempt to reschedule | ||
{{moment-from-now allocation.followUpEvaluation.waitUntil interval=1000}} | ||
</li> | ||
{{/if}} | ||
{{reschedule-event-row | ||
allocation=allocation | ||
linkToAllocation=false | ||
time=allocation.modifyTime}} | ||
|
||
{{#each (reverse allocation.rescheduleEvents) as |event|}} | ||
{{reschedule-event-row | ||
allocationId=event.previousAllocationId | ||
time=event.time}} | ||
{{/each}} | ||
</ol> |
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.