chore: 🤖 make proxy fields first-class attributes on session
This commit is contained in:
4 files changed
+48
-9
No files matched your search
@@ -1,10 +1,14 @@
|
||||
import GeneratedSessionModel from '../generated/models/session';
|
||||
import { computed } from '@ember/object';
|
||||
import { attr } from '@ember-data/model';
|
||||
|
||||
export default class SessionModel extends GeneratedSessionModel {
|
||||
|
||||
// =attributes
|
||||
|
||||
@attr('string', { readOnly: true }) proxy_address;
|
||||
@attr('number', { readOnly: true }) proxy_port;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
@@ -13,6 +17,17 @@ export default class SessionModel extends GeneratedSessionModel {
|
||||
return this.status?.match(/(active)|(pending)/i);
|
||||
}
|
||||
|
||||
/**
|
||||
* The full proxy address and port if address exists, otherwise null.
|
||||
* @type {?string}
|
||||
*/
|
||||
@computed('proxy_address', 'proxy_port')
|
||||
get proxy() {
|
||||
return this.proxy_address
|
||||
? `${this.proxy_address}:${this.proxy_port}`
|
||||
: null;
|
||||
}
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user