Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzers UI #14599

Merged
merged 55 commits into from
Aug 28, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
51947bd
React-specific rules.
Jul 29, 2021
4fed1a4
Analyzers view.
Jul 29, 2021
56098ae
Modal component for React.
Aug 3, 2021
ab43a1f
Analyzer delete functional, +notifications.
Aug 3, 2021
25d8214
Stable render of modal children, +AddAnalyzer form stub.
Aug 4, 2021
096edab
Fixed broken modal re-open.
Aug 4, 2021
948c778
Delimiter form ready.
Aug 4, 2021
54f70fd
All forms ready.
Aug 5, 2021
34a0965
Removed 'Tree' mode.
Aug 5, 2021
1c4a1a7
Analyzer create functional.
Aug 5, 2021
ff01ffd
Fixed stopwords/stopwordsPath mixup.
Aug 6, 2021
51f1d9e
'Create Analyzer' form schema validation.
Aug 6, 2021
20fd739
Added missing fields to Text and N-Gram analyzer forms.
Aug 6, 2021
7480efb
Added support for copying existing analyzer to form state.
Aug 6, 2021
12657f5
Implemented view analyzer details.
Aug 6, 2021
1b59221
Merge branch 'devel' into feature/analyzers-web-ui
Aug 6, 2021
579ceb1
UX improvements.
Aug 11, 2021
76a054d
Fixed analyzer selection.
Aug 11, 2021
6f08080
Added UI for AQL and GeoJSON analyzers.
Aug 11, 2021
2522e13
Added UI for GeoPoint analyzer.
Aug 11, 2021
59e9fef
Improved validation, +dispatcher to manage state, +form cache.
Aug 13, 2021
4993c08
Changed button styles to match theme.
Aug 16, 2021
dfb74ef
Removed 'pointer' cursor on text field labels.
Aug 16, 2021
d3b031a
Added help links to locale and delimiter inputs.
Aug 16, 2021
3aef7a6
Added help text to delimiter field.
Aug 16, 2021
4f8e791
Fix bug that caused crash in case of pre-selected analyzer being dele…
Aug 16, 2021
8dfe282
Merge branch 'devel' into feature/analyzers-web-ui
Aug 17, 2021
1eb0122
Fixed parsing and UI for latitude/longitude elements.
Aug 17, 2021
4638c23
Reusable form and grid components based on Pure.css.
Aug 18, 2021
ccb8391
View mode now provides both JSON and (disabled) form views.
Aug 18, 2021
769dd2e
Using relative field paths to support embeddable forms.
Aug 19, 2021
f89e3af
Normalized accent input, +made all inputs location agnostic.
Aug 19, 2021
81f9fab
Pipeline Analyzer form functional.
Aug 20, 2021
31ba630
Switched to simple text display for code view.
Aug 20, 2021
70ec839
Use text cursor for code view mode.
Aug 20, 2021
1226635
Merge branch 'devel' into feature/analyzers-web-ui
Aug 20, 2021
bf701cd
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
KVS85 Aug 20, 2021
08e4442
Added UIs for Stopwords, Collation and Segmentation Analyzers.
Aug 21, 2021
aabcff5
Merge remote-tracking branch 'origin/feature/analyzers-web-ui' into f…
Aug 21, 2021
7b50eb0
Fixed DB base URL evaluation.
Aug 21, 2021
e82d84e
Switched to Pure.css-based grid components.
Aug 21, 2021
147020d
Allow rw access when server is running in non-authenticated mode.
Aug 21, 2021
eddc653
Fixed radio button rendering.
Aug 21, 2021
c1d82b2
Minor UI improvements.
Aug 21, 2021
e63f202
Fixed modal height issues, +fixed JSON form double scrollbar.
Aug 22, 2021
66e302b
Maximized modal height for view mode.
Aug 22, 2021
a531327
Minor UI improvements.
Aug 22, 2021
b1454db
Fixed null values for blank numeric inputs.
Aug 24, 2021
d496528
UI improvements.
Aug 24, 2021
5906f75
Slightly improved responsive grid.
Aug 24, 2021
a5eb6b4
Reusing FormState as action button prop.
Aug 25, 2021
ad24a3c
Stricter type restrictions.
Aug 25, 2021
ad3cdfb
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
KVS85 Aug 27, 2021
1256e50
Rebuild UI
KVS85 Aug 27, 2021
4dbfe7e
Update CHANGELOG
KVS85 Aug 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions js/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@
],
"parserOptions": {
"sourceType": "module"
},
"env": {
"es6": true,
"browser": true
},
"settings": {
"react": {
"version": "detect"
}
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ div.jsoneditor-tree table.jsoneditor-tree {
}

div.jsoneditor-tree div.jsoneditor-tree-inner {
padding-bottom: 300px;
padding-bottom: 0;
}

div.jsoneditor-outer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
'replication': 'replication',
'replication/applier/:endpoint/:database': 'applier',
'collections': 'collections',
'analyzers': 'analyzers',
'new': 'newCollection',
'login': 'login',
'collection/:colid/documents/:pageid': 'documents',
Expand Down Expand Up @@ -319,6 +320,13 @@

},

analyzers: function () {
this.checkUser();

this.init.then(() => ReactDOM.render(React.createElement(window.AnalyzersReactView),
document.getElementById('content')));
},

cluster: function () {
this.checkUser();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<li class="navbar-spacer big"></li>
<!-- <li id="dbSelect" class="dropdown databases-menu disabled"></li> -->
<li class="collections-menu"><a id="collections" class="tab" href="#collections"><i class="fa fa-folder"></i>Collections</a></li>
<li class="analyzers-menu"><a id="analyzers" class="tab" href="#analyzers"><i class="fa fa-cog"></i>Analyzers</a></li>
adityamukho marked this conversation as resolved.
Show resolved Hide resolved
<li class="views-menu"><a id="views" class="tab" href="#views"><i class="fa fa-eye"></i>Views</a></li>
<li class="queries-menu"><a id="queries" class="tab" href="#queries"><i class="fa fa-bolt"></i>Queries</a></li>
<li class="graphs-menu"><a id="graphs" class="tab" href="#graphs"><i class="fa fa-sitemap"></i>Graphs</a></li>
Expand All @@ -20,7 +21,7 @@
<% } %>
<% if (currentDB.get('isSystem')) { %>
<% if (!readOnly) { %>
<li class="users-menu"><a id="users" class="tab" href="#manage"><i class="fa fa-users"></i>Users</a></li>
<li class="users-menu"><a id="users" class="tab" href="#users"><i class="fa fa-users"></i>Users</a></li>
<% } %>
<% } %>
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@

resize: function () {
// set menu sizes - responsive
var height = $(window).height() - $('.subMenuEntries').first().height();
$('#navigationBar').css('min-height', height);
$('#navigationBar').css('height', height);
const height = $(window).height() - $('.subMenuEntries').first().height();
const navBar = $('#navigationBar');
navBar.css('min-height', height);
navBar.css('height', height);
},

navigateBySelect: function () {
Expand Down Expand Up @@ -199,6 +200,13 @@
active: false
}
],
analyzers: [
{
name: 'Add / View Analyzers',
route: 'analyzers',
active: true
}
],
queries: [
{
name: 'Editor',
Expand Down
2 changes: 2 additions & 0 deletions js/apps/system/_admin/aardvark/APP/react/non_ts_libs.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
declare module 'styled-css-grid';
declare module 'sigma';
declare module 'picomodal';
declare module 'jsoneditor-react';
11 changes: 9 additions & 2 deletions js/apps/system/_admin/aardvark/APP/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"version": "3.0.0",
"private": true,
"dependencies": {
"arangojs": "^6.14.1",
"@types/lodash": "^4.14.172",
"ajv": "^8.6.2",
"arangojs": "^7.5.0",
"axios": "^0.18.0",
"backbone": "^1.3.3",
"bfj": "6.1.1",
Expand All @@ -24,13 +26,17 @@
"jquery": "^3.5.1",
"jquery-ui": "^1.12.1",
"jsoneditor": "^5.26.3",
"jsoneditor-react": "1.0.1",
"lodash": "^4.17.21",
"marked": "^0.7.0",
"memory-fs": "^0.5.0",
"mini-css-extract-plugin": "0.4.3",
"minimatch": "^3.0.4",
"node-sass": "^6.0.0",
"noty": "^3.2.0-beta",
"nvd3": "^1.8.6",
"parse-prometheus-text-format": "^1.1.1",
"picomodal": "^3.0.0",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "3.0.0",
"postcss-preset-env": "6.0.6",
Expand All @@ -49,6 +55,7 @@
"styled-components": "^4.4.1",
"styled-css-grid": "^1.1.1",
"styled-icons": "^6.3.0",
"swr": "^0.5.6",
"tippy.js": "^2.6.0",
"typeahead.js": "^0.11.1",
"underscore": "^1.10.2",
Expand Down Expand Up @@ -109,7 +116,7 @@
"pnp-webpack-plugin": "1.1.0",
"react-dev-utils": "^6.1.1",
"terser-webpack-plugin": "^3.0.6",
"typescript": "^3.9.5",
"typescript": "^4.3.5",
"webpack": "^4.43.0",
"webpack-concat-plugin": "^3.0.0",
"webpack-dev-server": "^3.11.0",
Expand Down
3 changes: 2 additions & 1 deletion js/apps/system/_admin/aardvark/APP/react/src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'jsoneditor-react/es/editor.min.css';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';

// import Overview from './views/shards/overview';
const jsoneditor = require('jsoneditor');
const d3 = require('d3');
require('nvd3');
Expand All @@ -12,6 +12,7 @@ window.parsePrometheusTextFormat = parsePrometheusTextFormat;

// import new react views
require('./views/shards/ShardsReactView');
adityamukho marked this conversation as resolved.
Show resolved Hide resolved
adityamukho marked this conversation as resolved.
Show resolved Hide resolved
require('./views/analyzers/AnalyzersReactView');

// old libraries
const jQuery = require('jquery');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { ReactNode, useEffect, useRef } from "react";
import { createPortal, render, unmountComponentAtNode } from "react-dom";
import picoModal from 'picomodal';
import { uniqueId } from 'lodash';

interface ModalProps {
show: boolean;
children?: ReactNode;
setShow: (show: boolean) => void;
}

function renderChildren (children: ReactNode, contentDivId: string) {
const contentDiv = document.getElementById(contentDivId) as HTMLElement;

render(createPortal(children, contentDiv, contentDivId), contentDiv);
}

const Modal = ({ show, setShow, children }: ModalProps) => {
const contentDivId = useRef(uniqueId('modal-content-'));
const modal = useRef(picoModal({
content: `<div id='${contentDivId.current}'></div>`,
closeButton: false
})
.afterCreate(() => {
renderChildren(children, contentDivId.current); // First render of children.
})
.afterClose(() => {
setShow(false);
}));

useEffect(() => {
if (modal.current.isVisible()) {
renderChildren(children, contentDivId.current); // Re-render children on any child update. Important!
}
}, [children]);

useEffect(() => {
if (show) {
modal.current.show();
} else {
modal.current.close();
}
}, [show]);

useEffect(() => {
return () => {
try {
// eslint-disable-next-line react-hooks/exhaustive-deps
unmountComponentAtNode(document.getElementById(contentDivId.current) as HTMLElement);
// eslint-disable-next-line react-hooks/exhaustive-deps
modal.current.destroy();
} catch (e) {
}
};
}, []);

return null;
};

export default Modal;
export { default as ModalFooter } from './ModalFooter';
export { default as ModalHeader } from './ModalHeader';
export { default as ModalBody } from './ModalBody';
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { ReactNode } from "react";

interface ModalBodyProps {
children?: ReactNode;
}

const ModalBody = ({ children }: ModalBodyProps) =>
<div className="modal-body" style={{
maxHeight: '90vh',
overflowX: 'hidden',
minWidth: '50vw'
}}>
{children}
</div>;

export default ModalBody;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React, { ReactNode } from "react";

interface ModalFooterProps {
children?: ReactNode;
}

const ModalFooter = ({ children }: ModalFooterProps) =>
<>
<hr style={{ marginTop: 0 }}/>
<div className="modal-footer">
{children}
</div>
</>;

export default ModalFooter;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { ReactNode } from "react";

interface ModalHeaderProps {
adityamukho marked this conversation as resolved.
Show resolved Hide resolved
title: string;
children?: ReactNode;
}

const ModalHeader = ({ title, children }: ModalHeaderProps) =>
<>
<div className="modal-header">
<div className={'pure-g'}>
<div className={'pure-u-8-24 pure-u-md-8-24 pure-u-lg-8-24 pure-u-xl-8-24'}>
<span className="arangoHeader">{title}</span>
</div>
<div className={'pure-u-16-24 pure-u-md-16-24 pure-u-lg-16-24 pure-u-xl-16-24'}>
{children}
</div>
</div>
</div>
<hr style={{ marginBottom: 0 }}/>
</>;

export default ModalHeader;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Database } from 'arangojs';
import useSWR from 'swr';
import { memoize } from 'lodash';

declare var frontendConfig: { [key: string]: any };

export const getDB = memoize((db: string) => new Database({
url: frontendConfig.basePath,
databaseName: db
}));

export const getRouteForDB = memoize((db: string, route: string) => getDB(db).route(route),
(db: string, route: string) => `${db}/${route}`);

export const getApiRouteForCurrentDB = () => getRouteForDB(frontendConfig.db, '_api');

type ApiMethod = 'get' | 'put' | 'post' | 'delete';

export const useAPIFetch = (path: string | null, method: ApiMethod = 'get', body?: any) => useSWR(path, () => {
const route = getApiRouteForCurrentDB();

return route[method](path as string, body);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { ChangeEvent } from "react";

export const getChangeHandler = (setter: (value: string) => void) => {
return (event: ChangeEvent<HTMLInputElement | HTMLSelectElement>) => {
setter(event.currentTarget.value);
};
};
Loading