mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 19:05:42 +03:00
Fix exec not working for another region (#10539)
This conditionally includes a region query parameter when opening the exec socket.
This commit is contained in:
committed by
GitHub
parent
7aa18b6063
commit
f75ceead7a
@@ -1,8 +1,11 @@
|
||||
import Service from '@ember/service';
|
||||
import config from 'nomad-ui/config/environment';
|
||||
import { getOwner } from '@ember/application';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class SocketsService extends Service {
|
||||
@service system;
|
||||
|
||||
getTaskStateSocket(taskState, command) {
|
||||
const mirageEnabled =
|
||||
config.environment !== 'production' &&
|
||||
@@ -27,10 +30,12 @@ export default class SocketsService extends Service {
|
||||
const applicationAdapter = getOwner(this).lookup('adapter:application');
|
||||
const prefix = `${applicationAdapter.host ||
|
||||
window.location.host}/${applicationAdapter.urlPrefix()}`;
|
||||
const region = this.system.activeRegion;
|
||||
|
||||
return new WebSocket(
|
||||
`${protocol}//${prefix}/client/allocation/${taskState.allocation.id}` +
|
||||
`/exec?task=${taskState.name}&tty=true&ws_handshake=true` +
|
||||
(region ? `®ion=${region}` : '') +
|
||||
`&command=${encodeURIComponent(`["${command}"]`)}`
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user