open-nomad/ui/app/components/exec/open-button.js
Buck Doyle 674da96a59
UI: add exec terminal (#6697)
This connects Xterm.js to a Nomad exec websocket so people
can interact on clients via live sessions. There are buttons on
job, allocation, task group, and task detail pages that open a
popup that lets them edit their shell command and start a
session.

More is to come, as recorded in issues.
2020-03-24 18:22:16 -05:00

37 lines
775 B
JavaScript

import Component from '@ember/component';
import { inject as service } from '@ember/service';
import generateExecUrl from 'nomad-ui/utils/generate-exec-url';
import openExecUrl from 'nomad-ui/utils/open-exec-url';
export default Component.extend({
tagName: '',
router: service(),
actions: {
open() {
openExecUrl(this.generateUrl());
},
},
generateUrl() {
let urlSegments = {
job: this.job.get('name'),
};
if (this.taskGroup) {
urlSegments.taskGroup = this.taskGroup.get('name');
}
if (this.task) {
urlSegments.task = this.task.get('name');
}
if (this.allocation) {
urlSegments.allocation = this.allocation.get('shortId');
}
return generateExecUrl(this.router, urlSegments);
},
});