From b83b5050e041b1295ddda2e57e70a0f8f7b48c69 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:04:00 +0800 Subject: [PATCH 01/18] perf: Update variable form API endpoint URL (#1188) Co-authored-by: wangruidong <940853815@qq.com> --- .../send-command-with-variable-dialog.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/elements/content/send-command-with-variable-dialog/send-command-with-variable-dialog.component.ts b/src/app/elements/content/send-command-with-variable-dialog/send-command-with-variable-dialog.component.ts index 91754a55..bc55f8da 100644 --- a/src/app/elements/content/send-command-with-variable-dialog/send-command-with-variable-dialog.component.ts +++ b/src/app/elements/content/send-command-with-variable-dialog/send-command-with-variable-dialog.component.ts @@ -19,7 +19,7 @@ export class ElementSendCommandWithVariableDialogComponent implements OnInit { } async getVariableFormMeta() { const adhoc = this.data.command.id - const url=`/api/v1/ops/variable/form_data/?t=${new Date().getTime()}&adhoc=${adhoc}` + const url=`/api/v1/ops/variables/form-data/?t=${new Date().getTime()}&adhoc=${adhoc}` const res: any = await this._http.options(url).toPromise(); this.formConfig = res.actions.GET; this.command = this.data.command; From 8035aa123560d4e58b6f867ce7fde41a3a03e21f Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Mon, 25 Nov 2024 14:52:54 +0800 Subject: [PATCH 02/18] perf: Add viewAssetOnlineSessionInfo conf --- .../connect/connect-dialog/connect-dialog.component.html | 2 +- .../connect/connect-dialog/connect-dialog.component.ts | 5 +++++ src/app/model.ts | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/elements/connect/connect-dialog/connect-dialog.component.html b/src/app/elements/connect/connect-dialog/connect-dialog.component.html index 426e7d91..534140ad 100644 --- a/src/app/elements/connect/connect-dialog/connect-dialog.component.html +++ b/src/app/elements/connect/connect-dialog/connect-dialog.component.html @@ -73,7 +73,7 @@

{{ "Connect" | translate }} - {{ asset.name | truncatechars:30 }}

type="submit" > {{ "CONNECT"| translate }} - + ({{ 'Current online' | translate }}: {{ onlineNum === null ? '- ' : onlineNum }}) diff --git a/src/app/elements/connect/connect-dialog/connect-dialog.component.ts b/src/app/elements/connect/connect-dialog/connect-dialog.component.ts index e519b286..0e7d0542 100644 --- a/src/app/elements/connect/connect-dialog/connect-dialog.component.ts +++ b/src/app/elements/connect/connect-dialog/connect-dialog.component.ts @@ -25,6 +25,7 @@ export class ElementConnectDialogComponent implements OnInit { public accountSelected: Account = null; public connectOption: Object; public outputData: ConnectData = new ConnectData(); + public viewAssetOnlineSessionInfo: boolean = true; public manualAuthInfo: AuthInfo = new AuthInfo(); public connectMethod: ConnectMethod = new ConnectMethod('Null', '', 'null', 'null'); public preConnectData: ConnectData = new ConnectData(); @@ -92,6 +93,7 @@ export class ElementConnectDialogComponent implements OnInit { this.connectMethod = connectMethods[0]; } } + this.viewAssetOnlineSessionInfo = this._settingSvc.globalSetting.VIEW_ASSET_ONLINE_SESSION_INFO } onProtocolChange(protocol) { @@ -100,6 +102,9 @@ export class ElementConnectDialogComponent implements OnInit { } getOnlineNum() { + if (!this.viewAssetOnlineSessionInfo) { + return; + } if (this.protocol.name !== 'rdp') { return; } diff --git a/src/app/model.ts b/src/app/model.ts index add34bd3..d1235339 100644 --- a/src/app/model.ts +++ b/src/app/model.ts @@ -265,6 +265,7 @@ export class GlobalSetting { TERMINAL_GRAPHICAL_RESOLUTION: string; CONNECTION_TOKEN_REUSABLE: boolean; CHAT_AI_ENABLED: boolean; + VIEW_ASSET_ONLINE_SESSION_INFO: boolean; } export class Setting { From a22b06dfcf4dcfd20afcee55c4a82913766cb282 Mon Sep 17 00:00:00 2001 From: Bai Date: Tue, 3 Dec 2024 16:19:52 +0800 Subject: [PATCH 03/18] perf: languages settings --- src/app/elements/nav/nav.component.ts | 53 ++++++++++----------------- src/app/model.ts | 3 +- src/app/services/i18n.ts | 44 +++------------------- 3 files changed, 26 insertions(+), 74 deletions(-) diff --git a/src/app/elements/nav/nav.component.ts b/src/app/elements/nav/nav.component.ts index e638bb22..f81ce5ef 100644 --- a/src/app/elements/nav/nav.component.ts +++ b/src/app/elements/nav/nav.component.ts @@ -46,10 +46,6 @@ export class ElementNavComponent implements OnInit { this.viewIds = this._viewSrv.viewIds; } - refreshNav() { - this.navs = this.getNav(); - } - getNav() { return [ { @@ -97,36 +93,7 @@ export class ElementNavComponent implements OnInit { { id: 'Language', name: 'Language', - children: [ - { - id: 'English', - click: () => { - this._i18n.use('en'); - }, - name: 'English' - }, - { - id: 'Chinese', - click: () => { - this._i18n.use('zh'); - }, - name: '中文' - }, - { - id: 'Chinese-hant', - click: () => { - this._i18n.use('zh_hant'); - }, - name: '中文(繁體)' - }, - { - id: 'Japanese', - click: () => { - this._i18n.use('ja'); - }, - name: '日本語' - } - ] + children: this.getLanguageOptions(), }, { id: 'Setting', @@ -232,6 +199,24 @@ export class ElementNavComponent implements OnInit { ]; } + getLanguageOptions() { + let langOptions = [] + this._settingSvc.afterInited().then((state) => { + const languages = this._settingSvc.globalSetting.LANGUAGES; + for (const langObj of languages) { + langOptions.push({ + id: langObj.code, + click: () => { + this._i18n.use(langObj.code); + }, + name: langObj.name + }) + } + }) + return langOptions + + } + onJumpUi() { window.open('/ui/', '_blank'); } diff --git a/src/app/model.ts b/src/app/model.ts index d1235339..f52dd951 100644 --- a/src/app/model.ts +++ b/src/app/model.ts @@ -99,7 +99,7 @@ export class ConnectEvt { export class Nav { id: string; name: string; - children?: Array