mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed linter errors after eslint upgrade.
This commit is contained in:
parent
43449be18c
commit
140494454a
@ -38,7 +38,7 @@ export default class PrivilegeRoleSchema extends BaseUISchema {
|
||||
|
||||
updateSupportedPrivs = (updatedPrivs) => {
|
||||
this.supportedPrivs = updatedPrivs;
|
||||
}
|
||||
};
|
||||
get baseFields() {
|
||||
let obj = this;
|
||||
|
||||
|
@ -24,8 +24,8 @@ import clsx from 'clsx';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
// Some predefined constants used to calculate image location and its border
|
||||
let pWIDTH = 100.;
|
||||
let pHEIGHT = 100.;
|
||||
let pWIDTH = 100;
|
||||
let pHEIGHT = 100;
|
||||
let IMAGE_WIDTH = 50;
|
||||
let IMAGE_HEIGHT = 50;
|
||||
let ARROW_WIDTH = 10,
|
||||
|
@ -27,8 +27,8 @@ const useStyles = makeStyles((theme)=>({
|
||||
}));
|
||||
|
||||
// Some predefined constants used to calculate image location and its border
|
||||
let pWIDTH = 100.;
|
||||
let pHEIGHT = 100.;
|
||||
let pWIDTH = 100;
|
||||
let pHEIGHT = 100;
|
||||
let offsetX = 200,
|
||||
offsetY = 60;
|
||||
let xMargin = 25,
|
||||
|
@ -78,12 +78,12 @@ export default function StreamingChart({xRange=75, data, options}) {
|
||||
},
|
||||
series: [
|
||||
{},
|
||||
...data.datasets?.map((datum)=>({
|
||||
...(data.datasets?.map((datum)=>({
|
||||
label: datum.label,
|
||||
stroke: datum.borderColor,
|
||||
width: options.lineBorderWidth ?? 1,
|
||||
points: { show: options.showDataPoints ?? false, size: datum.pointHitRadius*2 }
|
||||
}))
|
||||
}))??{})
|
||||
],
|
||||
scales: {
|
||||
x: {
|
||||
@ -116,11 +116,11 @@ export default function StreamingChart({xRange=75, data, options}) {
|
||||
|
||||
const initialState = [
|
||||
Array.from(new Array(xRange).keys()),
|
||||
...data.datasets?.map((d)=>{
|
||||
...(data.datasets?.map((d)=>{
|
||||
let ret = [...d.data];
|
||||
ret.reverse();
|
||||
return ret;
|
||||
}),
|
||||
})??{}),
|
||||
];
|
||||
|
||||
chartRef.current?.setScale('x', {min: data.datasets[0]?.data?.length-xRange, max: data.datasets[0]?.data?.length-1});
|
||||
|
@ -32,147 +32,147 @@ export class FileTreeItem extends React.Component<IItemRendererXProps & IItemRen
|
||||
return null;
|
||||
}
|
||||
|
||||
// ensure this syncs up with what goes in CSS, (em, px, % etc.) and what ultimately renders on the page
|
||||
public static readonly renderHeight: number = 24
|
||||
private static readonly itemIdToRefMap: Map<number, HTMLDivElement> = new Map()
|
||||
private static readonly refToItemIdMap: Map<number, HTMLDivElement> = new Map()
|
||||
private fileTreeEvent: IFileTreeXTriggerEvents
|
||||
// ensure this syncs up with what goes in CSS, (em, px, % etc.) and what ultimately renders on the page
|
||||
public static readonly renderHeight: number = 24;
|
||||
private static readonly itemIdToRefMap: Map<number, HTMLDivElement> = new Map();
|
||||
private static readonly refToItemIdMap: Map<number, HTMLDivElement> = new Map();
|
||||
private fileTreeEvent: IFileTreeXTriggerEvents;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
// used to apply decoration changes, you're welcome to use setState or other mechanisms as you see fit
|
||||
this.forceUpdate = this.forceUpdate.bind(this);
|
||||
}
|
||||
constructor(props) {
|
||||
super(props);
|
||||
// used to apply decoration changes, you're welcome to use setState or other mechanisms as you see fit
|
||||
this.forceUpdate = this.forceUpdate.bind(this);
|
||||
}
|
||||
|
||||
public render() {
|
||||
const { item, itemType, decorations } = this.props;
|
||||
public render() {
|
||||
const { item, itemType, decorations } = this.props;
|
||||
|
||||
const isRenamePrompt = itemType === ItemType.RenamePrompt;
|
||||
const isNewPrompt = itemType === ItemType.NewDirectoryPrompt || itemType === ItemType.NewFilePrompt;
|
||||
const isDirExpanded = itemType === ItemType.Directory
|
||||
? (item as Directory).expanded
|
||||
: itemType === ItemType.RenamePrompt && (item as RenamePromptHandle).target.type === FileType.Directory
|
||||
? ((item as RenamePromptHandle).target as Directory).expanded
|
||||
: false;
|
||||
const isRenamePrompt = itemType === ItemType.RenamePrompt;
|
||||
const isNewPrompt = itemType === ItemType.NewDirectoryPrompt || itemType === ItemType.NewFilePrompt;
|
||||
const isDirExpanded = itemType === ItemType.Directory
|
||||
? (item as Directory).expanded
|
||||
: itemType === ItemType.RenamePrompt && (item as RenamePromptHandle).target.type === FileType.Directory
|
||||
? ((item as RenamePromptHandle).target as Directory).expanded
|
||||
: false;
|
||||
|
||||
const fileOrDir =
|
||||
const fileOrDir =
|
||||
(itemType === ItemType.File ||
|
||||
itemType === ItemType.NewFilePrompt ||
|
||||
(itemType === ItemType.RenamePrompt && (item as RenamePromptHandle).target.constructor === FileEntry))
|
||||
? 'file'
|
||||
: 'directory';
|
||||
|
||||
if (this.props.item.parent && this.props.item.parent.path) {
|
||||
this.props.item.resolvedPathCache = this.props.item.parent.path + '/' + this.props.item._metadata.data.id;
|
||||
}
|
||||
|
||||
const itemChildren = item.children && item.children.length > 0 && item._metadata.data._type.indexOf('coll-') !== -1 ? '(' + item.children.length + ')' : '';
|
||||
const extraClasses = item._metadata.data.extraClasses ? item._metadata.data.extraClasses.join(' ') : '';
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn('file-entry', {
|
||||
renaming: isRenamePrompt,
|
||||
prompt: isRenamePrompt || isNewPrompt,
|
||||
new: isNewPrompt,
|
||||
}, fileOrDir, decorations ? decorations.classlist : null, `depth-${item.depth}`, extraClasses)}
|
||||
data-depth={item.depth}
|
||||
onContextMenu={this.handleContextMenu}
|
||||
onClick={this.handleClick}
|
||||
onDoubleClick={this.handleDoubleClick}
|
||||
onDragStart={this.handleDragStartItem}
|
||||
// required for rendering context menus when opened through context menu button on keyboard
|
||||
ref={this.handleDivRef}
|
||||
draggable={true}>
|
||||
|
||||
{!isNewPrompt && fileOrDir === 'directory' ?
|
||||
<i className={cn('directory-toggle', isDirExpanded ? 'open' : '')} />
|
||||
: null
|
||||
}
|
||||
|
||||
<span className='file-label'>
|
||||
{
|
||||
item._metadata && item._metadata.data.icon ?
|
||||
<i className={cn('file-icon', item._metadata && item._metadata.data.icon ? item._metadata.data.icon : fileOrDir)} /> : null
|
||||
}
|
||||
<span className='file-name'>
|
||||
{ _.unescape(this.props.item.getMetadata('data')._label)}
|
||||
<span className='children-count'>{itemChildren}</span>
|
||||
</span>
|
||||
|
||||
</span>
|
||||
</div>);
|
||||
}
|
||||
|
||||
public componentDidMount() {
|
||||
this.events = this.props.events;
|
||||
if (this.props.item.parent && this.props.item.parent.path) {
|
||||
this.props.item.resolvedPathCache = this.props.item.parent.path + '/' + this.props.item._metadata.data.id;
|
||||
if (this.props.decorations) {
|
||||
this.props.decorations.addChangeListener(this.forceUpdate);
|
||||
}
|
||||
this.setActiveFile(this.props.item);
|
||||
}
|
||||
|
||||
private setActiveFile = async (FileOrDir): Promise<void> => {
|
||||
this.props.changeDirectoryCount(FileOrDir.parent);
|
||||
if(FileOrDir._loaded !== true) {
|
||||
this.events.dispatch(FileTreeXEvent.onTreeEvents, window.event, 'added', FileOrDir);
|
||||
}
|
||||
FileOrDir._loaded = true;
|
||||
}
|
||||
const itemChildren = item.children && item.children.length > 0 && item._metadata.data._type.indexOf('coll-') !== -1 ? '(' + item.children.length + ')' : '';
|
||||
const extraClasses = item._metadata.data.extraClasses ? item._metadata.data.extraClasses.join(' ') : '';
|
||||
|
||||
public componentWillUnmount() {
|
||||
if (this.props.decorations) {
|
||||
this.props.decorations.removeChangeListener(this.forceUpdate);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<div
|
||||
className={cn('file-entry', {
|
||||
renaming: isRenamePrompt,
|
||||
prompt: isRenamePrompt || isNewPrompt,
|
||||
new: isNewPrompt,
|
||||
}, fileOrDir, decorations ? decorations.classlist : null, `depth-${item.depth}`, extraClasses)}
|
||||
data-depth={item.depth}
|
||||
onContextMenu={this.handleContextMenu}
|
||||
onClick={this.handleClick}
|
||||
onDoubleClick={this.handleDoubleClick}
|
||||
onDragStart={this.handleDragStartItem}
|
||||
// required for rendering context menus when opened through context menu button on keyboard
|
||||
ref={this.handleDivRef}
|
||||
draggable={true}>
|
||||
|
||||
public componentDidUpdate(prevProps: IItemRendererXProps) {
|
||||
if (prevProps.decorations) {
|
||||
prevProps.decorations.removeChangeListener(this.forceUpdate);
|
||||
}
|
||||
if (this.props.decorations) {
|
||||
this.props.decorations.addChangeListener(this.forceUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
private handleDivRef = (r: HTMLDivElement) => {
|
||||
if (r === null) {
|
||||
FileTreeItem.itemIdToRefMap.delete(this.props.item.id);
|
||||
} else {
|
||||
FileTreeItem.itemIdToRefMap.set(this.props.item.id, r);
|
||||
FileTreeItem.refToItemIdMap.set(r, this.props.item);
|
||||
}
|
||||
}
|
||||
|
||||
private handleContextMenu = (ev: React.MouseEvent) => {
|
||||
const { item, itemType, onContextMenu } = this.props;
|
||||
if (itemType === ItemType.File || itemType === ItemType.Directory) {
|
||||
onContextMenu(ev, item as FileOrDir);
|
||||
}
|
||||
}
|
||||
|
||||
private handleClick = (ev: React.MouseEvent) => {
|
||||
const { item, itemType, onClick } = this.props;
|
||||
if (itemType === ItemType.File || itemType === ItemType.Directory) {
|
||||
onClick(ev, item as FileEntry, itemType);
|
||||
}
|
||||
}
|
||||
|
||||
private handleDoubleClick = (ev: React.MouseEvent) => {
|
||||
const { item, itemType, onDoubleClick } = this.props;
|
||||
if (itemType === ItemType.File || itemType === ItemType.Directory) {
|
||||
onDoubleClick(ev, item as FileEntry, itemType);
|
||||
}
|
||||
}
|
||||
|
||||
private handleDragStartItem = (e: React.DragEvent) => {
|
||||
const { item, itemType, events } = this.props;
|
||||
if (itemType === ItemType.File || itemType === ItemType.Directory) {
|
||||
const ref = FileTreeItem.itemIdToRefMap.get(item.id);
|
||||
if (ref) {
|
||||
events.dispatch(FileTreeXEvent.onTreeEvents, e, 'dragstart', item);
|
||||
{!isNewPrompt && fileOrDir === 'directory' ?
|
||||
<i className={cn('directory-toggle', isDirExpanded ? 'open' : '')} />
|
||||
: null
|
||||
}
|
||||
|
||||
<span className='file-label'>
|
||||
{
|
||||
item._metadata && item._metadata.data.icon ?
|
||||
<i className={cn('file-icon', item._metadata && item._metadata.data.icon ? item._metadata.data.icon : fileOrDir)} /> : null
|
||||
}
|
||||
<span className='file-name'>
|
||||
{ _.unescape(this.props.item.getMetadata('data')._label)}
|
||||
<span className='children-count'>{itemChildren}</span>
|
||||
</span>
|
||||
|
||||
</span>
|
||||
</div>);
|
||||
}
|
||||
|
||||
public componentDidMount() {
|
||||
this.events = this.props.events;
|
||||
this.props.item.resolvedPathCache = this.props.item.parent.path + '/' + this.props.item._metadata.data.id;
|
||||
if (this.props.decorations) {
|
||||
this.props.decorations.addChangeListener(this.forceUpdate);
|
||||
}
|
||||
this.setActiveFile(this.props.item);
|
||||
}
|
||||
|
||||
private setActiveFile = async (FileOrDir): Promise<void> => {
|
||||
this.props.changeDirectoryCount(FileOrDir.parent);
|
||||
if(FileOrDir._loaded !== true) {
|
||||
this.events.dispatch(FileTreeXEvent.onTreeEvents, window.event, 'added', FileOrDir);
|
||||
}
|
||||
FileOrDir._loaded = true;
|
||||
};
|
||||
|
||||
public componentWillUnmount() {
|
||||
if (this.props.decorations) {
|
||||
this.props.decorations.removeChangeListener(this.forceUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
public componentDidUpdate(prevProps: IItemRendererXProps) {
|
||||
if (prevProps.decorations) {
|
||||
prevProps.decorations.removeChangeListener(this.forceUpdate);
|
||||
}
|
||||
if (this.props.decorations) {
|
||||
this.props.decorations.addChangeListener(this.forceUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
private handleDivRef = (r: HTMLDivElement) => {
|
||||
if (r === null) {
|
||||
FileTreeItem.itemIdToRefMap.delete(this.props.item.id);
|
||||
} else {
|
||||
FileTreeItem.itemIdToRefMap.set(this.props.item.id, r);
|
||||
FileTreeItem.refToItemIdMap.set(r, this.props.item);
|
||||
}
|
||||
};
|
||||
|
||||
private handleContextMenu = (ev: React.MouseEvent) => {
|
||||
const { item, itemType, onContextMenu } = this.props;
|
||||
if (itemType === ItemType.File || itemType === ItemType.Directory) {
|
||||
onContextMenu(ev, item as FileOrDir);
|
||||
}
|
||||
};
|
||||
|
||||
private handleClick = (ev: React.MouseEvent) => {
|
||||
const { item, itemType, onClick } = this.props;
|
||||
if (itemType === ItemType.File || itemType === ItemType.Directory) {
|
||||
onClick(ev, item as FileEntry, itemType);
|
||||
}
|
||||
};
|
||||
|
||||
private handleDoubleClick = (ev: React.MouseEvent) => {
|
||||
const { item, itemType, onDoubleClick } = this.props;
|
||||
if (itemType === ItemType.File || itemType === ItemType.Directory) {
|
||||
onDoubleClick(ev, item as FileEntry, itemType);
|
||||
}
|
||||
};
|
||||
|
||||
private handleDragStartItem = (e: React.DragEvent) => {
|
||||
const { item, itemType, events } = this.props;
|
||||
if (itemType === ItemType.File || itemType === ItemType.Directory) {
|
||||
const ref = FileTreeItem.itemIdToRefMap.get(item.id);
|
||||
if (ref) {
|
||||
events.dispatch(FileTreeXEvent.onTreeEvents, e, 'dragstart', item);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,9 +2,9 @@ import { TreeModel, IBasicFileSystemHost, Root } from 'react-aspen';
|
||||
import { DecorationsManager } from 'aspen-decorations';
|
||||
|
||||
export class TreeModelX extends TreeModel {
|
||||
public readonly decorations: DecorationsManager
|
||||
constructor(host: IBasicFileSystemHost, mountPath: string) {
|
||||
super(host, mountPath);
|
||||
this.decorations = new DecorationsManager(this.root as Root);
|
||||
}
|
||||
public readonly decorations: DecorationsManager;
|
||||
constructor(host: IBasicFileSystemHost, mountPath: string) {
|
||||
super(host, mountPath);
|
||||
this.decorations = new DecorationsManager(this.root as Root);
|
||||
}
|
||||
}
|
||||
|
@ -2,128 +2,128 @@ import { FileEntry, Directory, FileType } from 'react-aspen';
|
||||
import { IFileTreeXHandle } from '../types';
|
||||
|
||||
export class KeyboardHotkeys {
|
||||
private hotkeyActions = {
|
||||
'ArrowUp': () => this.jumpToPrevItem(),
|
||||
'ArrowDown': () => this.jumpToNextItem(),
|
||||
'ArrowRight': () => this.expandOrJumpToFirstChild(),
|
||||
'ArrowLeft': () => this.collapseOrJumpToFirstParent(),
|
||||
'Space': () => this.toggleDirectoryExpand(),
|
||||
'Enter': () => this.selectFileOrToggleDirState(),
|
||||
'Home': () => this.jumpToFirstItem(),
|
||||
'End': () => this.jumpToLastItem(),
|
||||
'Escape': () => this.resetSteppedOrSelectedItem(),
|
||||
private hotkeyActions = {
|
||||
'ArrowUp': () => this.jumpToPrevItem(),
|
||||
'ArrowDown': () => this.jumpToNextItem(),
|
||||
'ArrowRight': () => this.expandOrJumpToFirstChild(),
|
||||
'ArrowLeft': () => this.collapseOrJumpToFirstParent(),
|
||||
'Space': () => this.toggleDirectoryExpand(),
|
||||
'Enter': () => this.selectFileOrToggleDirState(),
|
||||
'Home': () => this.jumpToFirstItem(),
|
||||
'End': () => this.jumpToLastItem(),
|
||||
'Escape': () => this.resetSteppedOrSelectedItem(),
|
||||
};
|
||||
|
||||
constructor(private readonly fileTreeX: IFileTreeXHandle) { }
|
||||
|
||||
public handleKeyDown = (ev: React.KeyboardEvent) => {
|
||||
if (!this.fileTreeX.hasDirectFocus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
constructor(private readonly fileTreeX: IFileTreeXHandle) { }
|
||||
|
||||
public handleKeyDown = (ev: React.KeyboardEvent) => {
|
||||
if (!this.fileTreeX.hasDirectFocus()) {
|
||||
return false;
|
||||
}
|
||||
const { code } = ev.nativeEvent;
|
||||
if (code in this.hotkeyActions) {
|
||||
ev.preventDefault();
|
||||
this.hotkeyActions[code]();
|
||||
return true;
|
||||
}
|
||||
const { code } = ev.nativeEvent;
|
||||
if (code in this.hotkeyActions) {
|
||||
ev.preventDefault();
|
||||
this.hotkeyActions[code]();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
private jumpToFirstItem = (): void => {
|
||||
const { root } = this.fileTreeX.getModel();
|
||||
this.fileTreeX.setActiveFile(root.getFileEntryAtIndex(0), true);
|
||||
}
|
||||
private jumpToFirstItem = (): void => {
|
||||
const { root } = this.fileTreeX.getModel();
|
||||
this.fileTreeX.setActiveFile(root.getFileEntryAtIndex(0), true);
|
||||
};
|
||||
|
||||
private jumpToLastItem = (): void => {
|
||||
const { root } = this.fileTreeX.getModel();
|
||||
this.fileTreeX.setActiveFile(root.getFileEntryAtIndex(root.branchSize - 1), true);
|
||||
}
|
||||
private jumpToLastItem = (): void => {
|
||||
const { root } = this.fileTreeX.getModel();
|
||||
this.fileTreeX.setActiveFile(root.getFileEntryAtIndex(root.branchSize - 1), true);
|
||||
};
|
||||
|
||||
private jumpToNextItem = (): void => {
|
||||
const { root } = this.fileTreeX.getModel();
|
||||
let currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (!currentPseudoActive) {
|
||||
const selectedFile = this.fileTreeX.getActiveFile();
|
||||
if (selectedFile) {
|
||||
currentPseudoActive = selectedFile;
|
||||
} else {
|
||||
return this.jumpToFirstItem();
|
||||
}
|
||||
}
|
||||
const idx = root.getIndexAtFileEntry(currentPseudoActive);
|
||||
if (idx + 1 > root.branchSize) {
|
||||
private jumpToNextItem = (): void => {
|
||||
const { root } = this.fileTreeX.getModel();
|
||||
let currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (!currentPseudoActive) {
|
||||
const selectedFile = this.fileTreeX.getActiveFile();
|
||||
if (selectedFile) {
|
||||
currentPseudoActive = selectedFile;
|
||||
} else {
|
||||
return this.jumpToFirstItem();
|
||||
} else if (idx > -1) {
|
||||
this.fileTreeX.setActiveFile(root.getFileEntryAtIndex(idx + 1), true);
|
||||
}
|
||||
}
|
||||
const idx = root.getIndexAtFileEntry(currentPseudoActive);
|
||||
if (idx + 1 > root.branchSize) {
|
||||
return this.jumpToFirstItem();
|
||||
} else if (idx > -1) {
|
||||
this.fileTreeX.setActiveFile(root.getFileEntryAtIndex(idx + 1), true);
|
||||
}
|
||||
};
|
||||
|
||||
private jumpToPrevItem = (): void => {
|
||||
const { root } = this.fileTreeX.getModel();
|
||||
let currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (!currentPseudoActive) {
|
||||
const selectedFile = this.fileTreeX.getActiveFile();
|
||||
if (selectedFile) {
|
||||
currentPseudoActive = selectedFile;
|
||||
} else {
|
||||
return this.jumpToLastItem();
|
||||
}
|
||||
}
|
||||
const idx = root.getIndexAtFileEntry(currentPseudoActive);
|
||||
if (idx - 1 < 0) {
|
||||
private jumpToPrevItem = (): void => {
|
||||
const { root } = this.fileTreeX.getModel();
|
||||
let currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (!currentPseudoActive) {
|
||||
const selectedFile = this.fileTreeX.getActiveFile();
|
||||
if (selectedFile) {
|
||||
currentPseudoActive = selectedFile;
|
||||
} else {
|
||||
return this.jumpToLastItem();
|
||||
} else if (idx > -1) {
|
||||
this.fileTreeX.setActiveFile(root.getFileEntryAtIndex(idx - 1), true);
|
||||
}
|
||||
}
|
||||
const idx = root.getIndexAtFileEntry(currentPseudoActive);
|
||||
if (idx - 1 < 0) {
|
||||
return this.jumpToLastItem();
|
||||
} else if (idx > -1) {
|
||||
this.fileTreeX.setActiveFile(root.getFileEntryAtIndex(idx - 1), true);
|
||||
}
|
||||
};
|
||||
|
||||
private expandOrJumpToFirstChild(): void {
|
||||
const currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (currentPseudoActive && currentPseudoActive.type === FileType.Directory) {
|
||||
if ((currentPseudoActive as Directory).expanded) {
|
||||
return this.jumpToNextItem();
|
||||
} else {
|
||||
this.fileTreeX.openDirectory(currentPseudoActive as Directory);
|
||||
}
|
||||
private expandOrJumpToFirstChild(): void {
|
||||
const currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (currentPseudoActive && currentPseudoActive.type === FileType.Directory) {
|
||||
if ((currentPseudoActive as Directory).expanded) {
|
||||
return this.jumpToNextItem();
|
||||
} else {
|
||||
this.fileTreeX.openDirectory(currentPseudoActive as Directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private collapseOrJumpToFirstParent(): void {
|
||||
const currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (currentPseudoActive) {
|
||||
if (currentPseudoActive.type === FileType.Directory && (currentPseudoActive as Directory).expanded) {
|
||||
return this.fileTreeX.closeDirectory(currentPseudoActive as Directory);
|
||||
}
|
||||
this.fileTreeX.setActiveFile(currentPseudoActive.parent, true);
|
||||
private collapseOrJumpToFirstParent(): void {
|
||||
const currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (currentPseudoActive) {
|
||||
if (currentPseudoActive.type === FileType.Directory && (currentPseudoActive as Directory).expanded) {
|
||||
return this.fileTreeX.closeDirectory(currentPseudoActive as Directory);
|
||||
}
|
||||
this.fileTreeX.setActiveFile(currentPseudoActive.parent, true);
|
||||
}
|
||||
}
|
||||
|
||||
private selectFileOrToggleDirState = (): void => {
|
||||
const currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (!currentPseudoActive) { return; }
|
||||
if (currentPseudoActive.type === FileType.Directory) {
|
||||
this.fileTreeX.toggleDirectory(currentPseudoActive as Directory);
|
||||
} else if (currentPseudoActive.type === FileType.File) {
|
||||
this.fileTreeX.setActiveFile(currentPseudoActive as FileEntry, true);
|
||||
}
|
||||
private selectFileOrToggleDirState = (): void => {
|
||||
const currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (!currentPseudoActive) { return; }
|
||||
if (currentPseudoActive.type === FileType.Directory) {
|
||||
this.fileTreeX.toggleDirectory(currentPseudoActive as Directory);
|
||||
} else if (currentPseudoActive.type === FileType.File) {
|
||||
this.fileTreeX.setActiveFile(currentPseudoActive as FileEntry, true);
|
||||
}
|
||||
};
|
||||
|
||||
private toggleDirectoryExpand = (): void => {
|
||||
const currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (!currentPseudoActive) { return; }
|
||||
if (currentPseudoActive.type === FileType.Directory) {
|
||||
this.fileTreeX.toggleDirectory(currentPseudoActive as Directory);
|
||||
}
|
||||
private toggleDirectoryExpand = (): void => {
|
||||
const currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (!currentPseudoActive) { return; }
|
||||
if (currentPseudoActive.type === FileType.Directory) {
|
||||
this.fileTreeX.toggleDirectory(currentPseudoActive as Directory);
|
||||
}
|
||||
};
|
||||
|
||||
private resetSteppedOrSelectedItem = (): void => {
|
||||
const currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (currentPseudoActive) {
|
||||
return this.resetSteppedItem();
|
||||
}
|
||||
this.fileTreeX.setActiveFile(null);
|
||||
private resetSteppedOrSelectedItem = (): void => {
|
||||
const currentPseudoActive = this.fileTreeX.getActiveFile();
|
||||
if (currentPseudoActive) {
|
||||
return this.resetSteppedItem();
|
||||
}
|
||||
this.fileTreeX.setActiveFile(null);
|
||||
};
|
||||
|
||||
private resetSteppedItem = () => {
|
||||
this.fileTreeX.setActiveFile(null);
|
||||
}
|
||||
private resetSteppedItem = () => {
|
||||
this.fileTreeX.setActiveFile(null);
|
||||
};
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ export class ManagePreferenceTreeNodes {
|
||||
this.tree = {};
|
||||
this.tree[_root] = { name: 'root', type: FileType.Directory, metadata: node };
|
||||
res();
|
||||
})
|
||||
});
|
||||
|
||||
public updateNode = (_path, _data) => new Promise((res) => {
|
||||
const item = this.findNode(_path);
|
||||
@ -34,7 +34,7 @@ export class ManagePreferenceTreeNodes {
|
||||
item.metadata.data = _data;
|
||||
}
|
||||
res(true);
|
||||
})
|
||||
});
|
||||
|
||||
public removeNode = async (_path) => {
|
||||
const item = this.findNode(_path);
|
||||
@ -68,7 +68,7 @@ export class ManagePreferenceTreeNodes {
|
||||
if (tmpParentNode !== null && tmpParentNode !== undefined) tmpParentNode.children.push(treeNode);
|
||||
|
||||
res(treeNode);
|
||||
})
|
||||
});
|
||||
|
||||
public readNode = (_path: string) => new Promise<string[]>((res, rej) => {
|
||||
const temp_tree_path = _path,
|
||||
@ -112,12 +112,12 @@ export class ManagePreferenceTreeNodes {
|
||||
self.returnChildrens(node, res);
|
||||
}
|
||||
loadData();
|
||||
})
|
||||
});
|
||||
|
||||
public returnChildrens = (node: any, res: any) =>{
|
||||
if (node?.children.length > 0) return res(node.children);
|
||||
else return res(null);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@ export class ManageTreeNodes {
|
||||
this.tree = {};
|
||||
this.tree[_root] = {name: 'root', type: FileType.Directory, metadata: node};
|
||||
res();
|
||||
})
|
||||
});
|
||||
|
||||
public updateNode = (_path, _data) => new Promise((res) => {
|
||||
const item = this.findNode(_path);
|
||||
@ -36,7 +36,7 @@ export class ManageTreeNodes {
|
||||
item.metadata.data = _data;
|
||||
}
|
||||
res(true);
|
||||
})
|
||||
});
|
||||
|
||||
public removeNode = async (_path) => {
|
||||
const item = this.findNode(_path);
|
||||
@ -69,7 +69,7 @@ export class ManageTreeNodes {
|
||||
if (tmpParentNode !== null && tmpParentNode !== undefined) tmpParentNode.children.push(treeNode);
|
||||
|
||||
res(treeNode);
|
||||
})
|
||||
});
|
||||
|
||||
public readNode = (_path: string) => new Promise<string[]>((res, rej) => {
|
||||
let temp_tree_path = _path;
|
||||
@ -152,7 +152,7 @@ export class ManageTreeNodes {
|
||||
|
||||
}
|
||||
loadData();
|
||||
})
|
||||
});
|
||||
|
||||
public generate_url = (path: string) => {
|
||||
let _path = path;
|
||||
@ -176,7 +176,7 @@ export class ManageTreeNodes {
|
||||
if(_partitions.length > 0) _parent_path[0] = _partitions[_partitions.length-1];
|
||||
|
||||
return _parent_path.reverse().join('/');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
@ -311,7 +311,7 @@ class TableNodeWidgetRaw extends React.Component {
|
||||
toggleShowDetails = (e) => {
|
||||
e.preventDefault();
|
||||
this.setState((prevState)=>({show_details: !prevState.show_details}));
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
let tableData = this.props.node.getData() || {};
|
||||
|
@ -591,7 +591,7 @@ export class ResultSetUtils {
|
||||
/* If the raw row objects are available, use to them identify null values */
|
||||
copiedRowsObjects = JSON.parse(localStorage.getItem('copied-rows'));
|
||||
} catch {/* Suppress the error */}
|
||||
for(const [recIdx, rec] of result?.entries()) {
|
||||
for(const [recIdx, rec] of result?.entries()??[]) {
|
||||
// Convert 2darray to dict.
|
||||
let rowObj = {};
|
||||
for(const col of columns) {
|
||||
|
Loading…
Reference in New Issue
Block a user