fix(core-app): CB-898 children limit for all nodes in app

This commit is contained in:
Naumov Alexey
2021-04-01 18:00:49 +03:00
parent d89097b2fe
commit 1cd93bee58
3 changed files with 14 additions and 11 deletions
@@ -14,7 +14,8 @@ const defaultSettings = {
'app.logViewer.maxLogRecords': 1000,
'app.logViewer.logBatchSize': 2000,
'app.logViewer.maxFailedRequests': 3,
'app.navigationTree.childrenLimit': 500,
// temporary limit for all nodes children in app
'app.childrenLimit': 500,
};
export type CoreSettings = typeof defaultSettings;
@@ -6,7 +6,7 @@
* you may not use this file except in compliance with the License.
*/
import { action, computed, makeObservable } from 'mobx';
import { action, makeObservable } from 'mobx';
import { ConnectionAuthService } from '@cloudbeaver/core-connections';
import { injectable } from '@cloudbeaver/core-di';
@@ -39,10 +39,6 @@ export class NavigationTreeService {
readonly navigationTreeMetadata: MetadataMap<string, INavigationNodeMetadata>;
readonly nodeSelectionTask: IExecutor<INavigationNodeSelectionData>;
get childrenLimit(): number {
return this.coreSettingsService.settings.getValue('app.navigationTree.childrenLimit');
}
constructor(
private navNodeManagerService: NavNodeManagerService,
private notificationService: NotificationService,
@@ -53,7 +49,6 @@ export class NavigationTreeService {
private navNodeInfoResource: NavNodeInfoResource
) {
makeObservable<NavigationTreeService, 'unselectAll'>(this, {
childrenLimit: computed,
unselectAll: action,
});
@@ -80,7 +75,7 @@ export class NavigationTreeService {
const children = this.navTreeResource.get(id);
if (children) {
return children.slice(0, this.childrenLimit);
return children.slice(0, this.navTreeResource.childrenLimit);
}
return children;
@@ -6,7 +6,7 @@
* you may not use this file except in compliance with the License.
*/
import { action, makeObservable } from 'mobx';
import { action, computed, makeObservable } from 'mobx';
import { injectable } from '@cloudbeaver/core-di';
import {
@@ -22,6 +22,7 @@ import {
} from '@cloudbeaver/core-sdk';
import { MetadataMap } from '@cloudbeaver/core-utils';
import { CoreSettingsService } from '../../CoreSettingsService';
import { NavNodeInfoResource } from './NavNodeInfoResource';
// TODO: so much dirty
@@ -39,13 +40,19 @@ interface INodeMetadata extends ICachedMapResourceMetadata {
export class NavTreeResource extends CachedMapResource<string, string[]> {
protected metadata: MetadataMap<string, INodeMetadata>;
get childrenLimit(): number {
return this.coreSettingsService.settings.getValue('app.childrenLimit');
}
constructor(
private graphQLService: GraphQLService,
private navNodeInfoResource: NavNodeInfoResource
private navNodeInfoResource: NavNodeInfoResource,
private coreSettingsService: CoreSettingsService,
) {
super();
makeObservable(this, {
childrenLimit: computed,
setDetails: action,
});
@@ -242,6 +249,6 @@ export class NavTreeResource extends CachedMapResource<string, string[]> {
withDetails: metadata.withDetails,
});
return { navNodeChildren, navNodeInfo, parentPath };
return { navNodeChildren: navNodeChildren.slice(0, this.childrenLimit), navNodeInfo, parentPath };
}
}