-
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.
System Batch UI, Client Status Bar Chart and Client Tab page view (#1…
- Loading branch information
1 parent
c50b751
commit 0564f9f
Showing
48 changed files
with
2,112 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
printWidth: 100 | ||
singleQuote: true | ||
trailingComma: es5 | ||
{ | ||
"printWidth": 100, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"overrides": [ | ||
{ | ||
"files": "*.hbs", | ||
"options": { | ||
"singleQuote": false | ||
} | ||
} | ||
] | ||
} |
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,120 @@ | ||
import { computed } from '@ember/object'; | ||
import DistributionBar from './distribution-bar'; | ||
import classic from 'ember-classic-decorator'; | ||
|
||
@classic | ||
export default class JobClientStatusBar extends DistributionBar { | ||
layoutName = 'components/distribution-bar'; | ||
|
||
'data-test-job-client-status-bar' = true; | ||
job = null; | ||
jobClientStatus = null; | ||
|
||
@computed('job.namespace', 'jobClientStatus.byStatus') | ||
get data() { | ||
const { | ||
queued, | ||
starting, | ||
running, | ||
complete, | ||
degraded, | ||
failed, | ||
lost, | ||
notScheduled, | ||
} = this.jobClientStatus.byStatus; | ||
|
||
return [ | ||
{ | ||
label: 'Queued', | ||
value: queued.length, | ||
className: 'queued', | ||
legendLink: { | ||
queryParams: { | ||
status: JSON.stringify(['queued']), | ||
namespace: this.job.namespace.get('id'), | ||
}, | ||
}, | ||
}, | ||
{ | ||
label: 'Starting', | ||
value: starting.length, | ||
className: 'starting', | ||
legendLink: { | ||
queryParams: { | ||
status: JSON.stringify(['starting']), | ||
namespace: this.job.namespace.get('id'), | ||
}, | ||
}, | ||
layers: 2, | ||
}, | ||
{ | ||
label: 'Running', | ||
value: running.length, | ||
className: 'running', | ||
legendLink: { | ||
queryParams: { | ||
status: JSON.stringify(['running']), | ||
namespace: this.job.namespace.get('id'), | ||
}, | ||
}, | ||
}, | ||
{ | ||
label: 'Complete', | ||
value: complete.length, | ||
className: 'complete', | ||
legendLink: { | ||
queryParams: { | ||
status: JSON.stringify(['complete']), | ||
namespace: this.job.namespace.get('id'), | ||
}, | ||
}, | ||
}, | ||
{ | ||
label: 'Degraded', | ||
value: degraded.length, | ||
className: 'degraded', | ||
legendLink: { | ||
queryParams: { | ||
status: JSON.stringify(['degraded']), | ||
namespace: this.job.namespace.get('id'), | ||
}, | ||
}, | ||
help: 'Some allocations for this job were not successfull or did not run.', | ||
}, | ||
{ | ||
label: 'Failed', | ||
value: failed.length, | ||
className: 'failed', | ||
legendLink: { | ||
queryParams: { | ||
status: JSON.stringify(['failed']), | ||
namespace: this.job.namespace.get('id'), | ||
}, | ||
}, | ||
}, | ||
{ | ||
label: 'Lost', | ||
value: lost.length, | ||
className: 'lost', | ||
legendLink: { | ||
queryParams: { | ||
status: JSON.stringify(['lost']), | ||
namespace: this.job.namespace.get('id'), | ||
}, | ||
}, | ||
}, | ||
{ | ||
label: 'Not Scheduled', | ||
value: notScheduled.length, | ||
className: 'not-scheduled', | ||
legendLink: { | ||
queryParams: { | ||
status: JSON.stringify(['notScheduled']), | ||
namespace: this.job.namespace.get('id'), | ||
}, | ||
}, | ||
help: 'No allocations for this job were scheduled into these clients.', | ||
}, | ||
]; | ||
} | ||
} |
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,89 @@ | ||
import EmberObject from '@ember/object'; | ||
import Component from '@glimmer/component'; | ||
|
||
export default class ClientRow extends Component { | ||
// Attribute set in the template as @onClick. | ||
onClick() {} | ||
|
||
get row() { | ||
return this.args.row.model; | ||
} | ||
|
||
get shouldDisplayAllocationSummary() { | ||
return this.args.row.model.jobStatus !== 'notScheduled'; | ||
} | ||
|
||
get allocationSummaryPlaceholder() { | ||
switch (this.args.row.model.jobStatus) { | ||
case 'notScheduled': | ||
return 'Not Scheduled'; | ||
default: | ||
return ''; | ||
} | ||
} | ||
|
||
get humanizedJobStatus() { | ||
switch (this.args.row.model.jobStatus) { | ||
case 'notScheduled': | ||
return 'not scheduled'; | ||
default: | ||
return this.args.row.model.jobStatus; | ||
} | ||
} | ||
|
||
get jobStatusClass() { | ||
switch (this.args.row.model.jobStatus) { | ||
case 'notScheduled': | ||
return 'not-scheduled'; | ||
default: | ||
return this.args.row.model.jobStatus; | ||
} | ||
} | ||
|
||
get allocationContainer() { | ||
const statusSummary = { | ||
queuedAllocs: 0, | ||
completeAllocs: 0, | ||
failedAllocs: 0, | ||
runningAllocs: 0, | ||
startingAllocs: 0, | ||
lostAllocs: 0, | ||
}; | ||
|
||
switch (this.args.row.model.jobStatus) { | ||
case 'notSchedule': | ||
break; | ||
case 'queued': | ||
statusSummary.queuedAllocs = this.args.row.model.allocations.length; | ||
break; | ||
case 'starting': | ||
statusSummary.startingAllocs = this.args.row.model.allocations.length; | ||
break; | ||
default: | ||
for (const alloc of this.args.row.model.allocations) { | ||
switch (alloc.clientStatus) { | ||
case 'running': | ||
statusSummary.runningAllocs++; | ||
break; | ||
case 'lost': | ||
statusSummary.lostAllocs++; | ||
break; | ||
case 'failed': | ||
statusSummary.failedAllocs++; | ||
break; | ||
case 'complete': | ||
statusSummary.completeAllocs++; | ||
break; | ||
case 'starting': | ||
statusSummary.startingAllocs++; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
const Allocations = EmberObject.extend({ | ||
...statusSummary, | ||
}); | ||
return Allocations.create(); | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
ui/app/components/job-page/parts/job-client-status-summary.js
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,28 @@ | ||
import Component from '@ember/component'; | ||
import { action, computed } from '@ember/object'; | ||
import { classNames } from '@ember-decorators/component'; | ||
import classic from 'ember-classic-decorator'; | ||
|
||
@classic | ||
@classNames('boxed-section') | ||
export default class JobClientStatusSummary extends Component { | ||
job = null; | ||
jobClientStatus = null; | ||
gotoClients() {} | ||
|
||
@computed | ||
get isExpanded() { | ||
const storageValue = window.localStorage.nomadExpandJobClientStatusSummary; | ||
return storageValue != null ? JSON.parse(storageValue) : true; | ||
} | ||
|
||
@action | ||
onSliceClick(slice) { | ||
this.gotoClients([slice.className.camelize()]); | ||
} | ||
|
||
persist(item, isOpen) { | ||
window.localStorage.nomadExpandJobClientStatusSummary = isOpen; | ||
this.notifyPropertyChange('isExpanded'); | ||
} | ||
} |
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,15 @@ | ||
import AbstractJobPage from './abstract'; | ||
import classic from 'ember-classic-decorator'; | ||
import { inject as service } from '@ember/service'; | ||
import jobClientStatus from 'nomad-ui/utils/properties/job-client-status'; | ||
|
||
@classic | ||
export default class Sysbatch extends AbstractJobPage { | ||
@service store; | ||
|
||
@jobClientStatus('nodes', 'job') jobClientStatus; | ||
|
||
get nodes() { | ||
return this.store.peekAll('node'); | ||
} | ||
} |
Oops, something went wrong.