refactor: 💡 update how proxy-url determins default proxy info (#1869)

This commit is contained in:
Cameron Perera authored and Zhihe Li committed 2023-09-22 18:58:14 -04:00
1 parent a831bd06a5
commit 8f043e8cf5
3 files changed
+8 -15

No files matched your search

@@ -7,15 +7,13 @@ import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { TYPE_TARGET_SSH } from 'api/models/target';
export default class SessionProxyUrlComponent extends Component {
@service intl;
@tracked selectedValue =
this.args.targetType === TYPE_TARGET_SSH
? this.intl.t('resources.session.proxy-url.ssh')
: this.intl.t('resources.session.proxy-url.address-port');
@tracked selectedValue = this.args.isSSHTarget
? this.intl.t('resources.session.proxy-url.ssh')
: this.intl.t('resources.session.proxy-url.address-port');
get isAddressAndPort() {
return (
@@ -28,7 +28,7 @@
<Session::ProxyUrl
@proxyAddress={{@model.proxy_address}}
@proxyPort={{@model.proxy_port}}
@targetType={{@model.target.type}}
@isSSHTarget={{@model.target.isSSH}}
/>
{{/if}}
<Rose::Layout::BodyContent as |bc|>
@@ -8,7 +8,6 @@ import { setupRenderingTest } from 'desktop/tests/helpers';
import { render, click } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { setupIntl } from 'ember-intl/test-support';
import { TYPE_TARGET_TCP, TYPE_TARGET_SSH } from 'api/models/target';
module('Integration | Component | session/proxy-url', function (hooks) {
setupRenderingTest(hooks);
@@ -18,14 +17,13 @@ module('Integration | Component | session/proxy-url', function (hooks) {
assert.expect(2);
this.set('proxyAddress', 'http://localhost');
this.set('proxyPort', '1234');
this.set('targetType', TYPE_TARGET_TCP);
await render(
hbs`
<Session::ProxyUrl
@proxyAddress={{this.proxyAddress}}
@proxyPort={{this.proxyPort}}
@targetType={{this.targetType}}
@isSSHTarget={{false}}
/>
`
);
@@ -38,14 +36,13 @@ module('Integration | Component | session/proxy-url', function (hooks) {
assert.expect(2);
this.set('proxyAddress', 'http://localhost');
this.set('proxyPort', '1234');
this.set('targetType', TYPE_TARGET_TCP);
await render(
hbs`
<Session::ProxyUrl
@proxyAddress={{this.proxyAddress}}
@proxyPort={{this.proxyPort}}
@targetType={{this.targetType}}
@isSSHTarget={{false}}
/>
`
);
@@ -62,14 +59,13 @@ module('Integration | Component | session/proxy-url', function (hooks) {
assert.expect(2);
this.set('proxyAddress', 'http://localhost');
this.set('proxyPort', '1234');
this.set('targetType', TYPE_TARGET_TCP);
await render(
hbs`
<Session::ProxyUrl
@proxyAddress={{this.proxyAddress}}
@proxyPort={{this.proxyPort}}
@targetType={{this.targetType}}
@isSSHTarget={{false}}
/>
`
);
@@ -82,14 +78,13 @@ module('Integration | Component | session/proxy-url', function (hooks) {
assert.expect(2);
this.set('proxyAddress', 'http://localhost');
this.set('proxyPort', '1234');
this.set('targetType', TYPE_TARGET_SSH);
await render(
hbs`
<Session::ProxyUrl
@proxyAddress={{this.proxyAddress}}
@proxyPort={{this.proxyPort}}
@targetType={{this.targetType}}
@isSSHTarget={{true}}
/>
`
);