chore(core-app): remove closeConnection nav type

This commit is contained in:
Wroud
2020-09-11 00:04:11 +03:00
parent aef2ff4985
commit c4e437c3bf
3 changed files with 23 additions and 29 deletions
@@ -28,7 +28,6 @@ import { NodeManagerUtils } from './NodeManagerUtils';
export enum NavigationType {
open,
closeConnection
}
export interface NavNodeKey {
@@ -272,7 +271,7 @@ export class NavNodeManagerService extends Bootstrap {
let name: string | undefined;
let icon: string | undefined;
if (NodeManagerUtils.isDatabaseObject(nodeId) && data.type !== NavigationType.closeConnection) {
if (NodeManagerUtils.isDatabaseObject(nodeId)) {
const node = await this.loadNode({ nodeId, parentId });
name = node.name;
@@ -61,9 +61,6 @@ export class DataViewerTabService {
trySwitchPage,
} = await contexts.getContext(this.objectViewerTabService.objectViewerTabContext);
if (nodeInfo.type === NavigationType.closeConnection) {
return;
}
const node = await this.navNodeManagerService.loadNode(nodeInfo);
if (!this.navNodeManagerService.isNodeHasData(node)) {
@@ -62,7 +62,7 @@ export class ObjectViewerTabService {
});
}
registerTabHandler() {
registerTabHandler(): void {
this.navNodeManagerService.navigator.addHandler(this.navigationHandler.bind(this));
this.connectionInfoResource.onItemAdd.subscribe(this.updateConnectionInfoTabs.bind(this));
this.navNodeManagerService.navNodeInfoResource.onItemAdd.subscribe(this.updateTabs.bind(this));
@@ -76,31 +76,29 @@ export class ObjectViewerTabService {
const tabInfo = await contexts.getContext(this.navigationTabsService.navigationTabContext);
const nodeInfo = await contexts.getContext(this.navNodeManagerService.navigationNavNodeContext);
if (data.type !== NavigationType.closeConnection) {
// check if tab already exist for object
const tab = this.navigationTabsService.findTab(
isObjectViewerTab(tab => tab.handlerState.objectId === nodeInfo.nodeId)
);
const tab = this.navigationTabsService.findTab(
isObjectViewerTab(tab => tab.handlerState.objectId === nodeInfo.nodeId)
);
if (tab) {
tab.handlerState.tabIcon = nodeInfo.icon;
tab.handlerState.tabTitle = nodeInfo.name;
tabInfo.registerTab(tab);
} else {
tabInfo.openNewTab<IObjectViewerTabState>({
handlerId: objectViewerTabHandlerKey,
handlerState: {
objectId: nodeInfo.nodeId,
parentId: nodeInfo.parentId,
parents: await nodeInfo.getParents(),
folderId: nodeInfo.folderId,
pageId: '',
pagesState: new Map(),
tabIcon: nodeInfo.icon,
tabTitle: nodeInfo.name,
},
});
}
if (tab) {
tab.handlerState.tabIcon = nodeInfo.icon;
tab.handlerState.tabTitle = nodeInfo.name;
tabInfo.registerTab(tab);
} else {
tabInfo.openNewTab<IObjectViewerTabState>({
handlerId: objectViewerTabHandlerKey,
handlerState: {
objectId: nodeInfo.nodeId,
parentId: nodeInfo.parentId,
parents: await nodeInfo.getParents(),
folderId: nodeInfo.folderId,
pageId: '',
pagesState: new Map(),
tabIcon: nodeInfo.icon,
tabTitle: nodeInfo.name,
},
});
}
const getPage = () => {
if (!tabInfo.tab) {