-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI: Preemptions #5594
UI: Preemptions #5594
Changes from all commits
cf1d4a3
c456c5e
384a0e5
dca386c
a33b105
7ae2081
400deae
4752950
4c773a1
d4ae0a2
c7e1598
5aa938e
d092723
4166a71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import Model from 'ember-data/model'; | ||
import attr from 'ember-data/attr'; | ||
import { fragmentArray } from 'ember-data-model-fragments/attributes'; | ||
import { hasMany } from 'ember-data/relationships'; | ||
|
||
export default Model.extend({ | ||
diff: attr(), | ||
failedTGAllocs: fragmentArray('placement-failure', { defaultValue: () => [] }), | ||
preemptions: hasMany('allocation'), | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({ | ||
setupController(controller, model) { | ||
// Suppress the preemptedByAllocation fetch error in the event it's a 404 | ||
if (model) { | ||
const setPreempter = () => controller.set('preempter', model.preemptedByAllocation); | ||
model.preemptedByAllocation.then(setPreempter, setPreempter); | ||
} | ||
|
||
return this._super(...arguments); | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { assign } from '@ember/polyfills'; | ||
import ApplicationSerializer from './application'; | ||
import { get } from '@ember/object'; | ||
|
||
export default ApplicationSerializer.extend({ | ||
normalize(typeHash, hash) { | ||
const failures = hash.FailedTGAllocs || {}; | ||
hash.FailedTGAllocs = Object.keys(failures).map(key => { | ||
return assign({ Name: key }, failures[key] || {}); | ||
}); | ||
hash.PreemptionIDs = (get(hash, 'Annotations.PreemptedAllocs') || []).mapBy('ID'); | ||
return this._super(...arguments); | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,6 @@ | |
|
||
&.is-right { | ||
margin-left: $gutter-width; | ||
overflow-x: auto; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean to include this here? Would this mean you can't pan on mobile anymore? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did mean to include this. It was causing the icon tooltip to be clipped on the left side where it goes out of the bounds of the page-column. As for panning on mobile, good question. I just checked and it appears to still work. |
||
} | ||
|
||
@media #{$mq-hidden-gutter} { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if this boolean casting would be done by the
attr('boolean')
in the model?Also I had a quick scan over the docs here:
https://www.nomadproject.io/docs/internals/scheduling/preemption.html#preemptedbyallocid
Does
hash.PreemptedByAllocationID
==PreemptedByAllocID
? (Allocation vs Alloc). Thinking it could be something wrong in the docs, thought I'd mention just incase?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The boolean casting is probably taken care of by the
boolean
transformer, yes, but I'm not sure I want to rely on a transformer for it.Yes, the docs are wrong in this case. Here's the go struct to confirm: https://github.com/hashicorp/nomad/blob/master/nomad/structs/structs.go#L7261-L7267