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