Skip to content

Commit

Permalink
feat: 支持配置资产连接默认打开方式
Browse files Browse the repository at this point in the history
  • Loading branch information
feng626 committed Mar 8, 2024
1 parent 1da4565 commit d1b5673
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/app/elements/asset-tree/asset-tree.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export class ElementAssetTreeComponent implements OnInit {
isShowRMenu = false;
rightClickSelectNode: any;
isLoadTreeAsync: boolean;
isOpenNewWindow: boolean;
filterAssetCancel$: Subject<boolean> = new Subject();
favoriteAssets = [];
searchValue = '';
Expand Down Expand Up @@ -221,6 +222,8 @@ export class ElementAssetTreeComponent implements OnInit {
this.currentOrgID = this._cookie.get('X-JMS-LUNA-ORG') || this._cookie.get('X-JMS-ORG');
this._settingSvc.afterInited().then((state) => {
this.isLoadTreeAsync = this._settingSvc.isLoadTreeAsync();
this.isOpenNewWindow = this._settingSvc.isOpenNewWindow();

if (state) {
if (!this._settingSvc.hasXPack() && this.currentOrgID === SYSTEM_ORG_ID) {
this.currentOrgID = DEFAULT_ORG_ID;
Expand Down Expand Up @@ -255,7 +258,11 @@ export class ElementAssetTreeComponent implements OnInit {
this._dialog.open(DisabledAssetsDialogComponent, config);
return;
}
this.connectAsset(treeNode).then();
if (this.isOpenNewWindow) {
connectOnNewPage(treeNode, 'auto');
} else {
this.connectAsset(treeNode).then();
}
}

onAssetTreeCheck(event, treeId) {
Expand Down
3 changes: 2 additions & 1 deletion src/app/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ export class Setting {
sqlClient = '1';

basic = {
is_async_asset_tree: false
is_async_asset_tree: false,
connect_default_open_method: 'new'
};
graphics = {
rdp_resolution: 'Auto',
Expand Down
6 changes: 6 additions & 0 deletions src/app/services/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class SettingService {
settingKey = 'LunaSetting';
public initialized$ = new BehaviorSubject<boolean>(false);
public isLoadTreeAsync$ = new BehaviorSubject<boolean>(true);
public isOpenNewWindow$ = new BehaviorSubject<boolean>(false);
public appletConnectMethod$ = new BehaviorSubject<string>('');
public keyboardLayout$ = new BehaviorSubject<string>('');
public isDirectNavigation$ = new BehaviorSubject<boolean>(false);
Expand Down Expand Up @@ -127,6 +128,11 @@ export class SettingService {
return this.setting.basic.is_async_asset_tree;
}

isOpenNewWindow() {
return this.setting.basic.connect_default_open_method === 'new';
}


setAppletConnectMethod() {
this.appletConnectMethod$.next(this.setting.graphics.applet_connection_method);
}
Expand Down

0 comments on commit d1b5673

Please sign in to comment.