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:
parent
d161d79b67
commit
5ad8c8136a
|
@ -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}"]`)}`
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue