datajunction-ui 0.0.1-a48 → 0.0.1-a49.dev2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/app/components/QueryInfo.jsx +96 -1
- package/src/app/icons/LoadingIcon.jsx +1 -1
- package/src/app/pages/NodePage/DimensionFilter.jsx +86 -0
- package/src/app/pages/NodePage/LinkDimensionPopover.jsx +13 -5
- package/src/app/pages/NodePage/NodeColumnTab.jsx +5 -3
- package/src/app/pages/NodePage/NodeHistory.jsx +11 -0
- package/src/app/pages/NodePage/NodeValidateTab.jsx +367 -0
- package/src/app/pages/NodePage/__tests__/DimensionFilter.test.jsx +74 -0
- package/src/app/pages/NodePage/__tests__/LinkDimensionPopover.test.jsx +0 -4
- package/src/app/pages/NodePage/__tests__/NodePage.test.jsx +88 -6
- package/src/app/pages/NodePage/index.jsx +6 -7
- package/src/app/services/DJService.js +58 -7
- package/src/app/services/__tests__/DJService.test.jsx +62 -0
- package/src/mocks/mockNodes.jsx +63 -0
- package/src/styles/index.css +149 -0
- package/src/app/pages/NodePage/NodeSQLTab.jsx +0 -82
package/src/styles/index.css
CHANGED
|
@@ -51,6 +51,7 @@ button.nav-link {
|
|
|
51
51
|
font: inherit;
|
|
52
52
|
cursor: pointer;
|
|
53
53
|
outline: inherit;
|
|
54
|
+
width: max-content;
|
|
54
55
|
}
|
|
55
56
|
code {
|
|
56
57
|
font-family: Consolas, source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
@@ -1318,4 +1319,152 @@ pre {
|
|
|
1318
1319
|
.td {
|
|
1319
1320
|
display: table-cell;
|
|
1320
1321
|
padding: 8px;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
.operator {
|
|
1325
|
+
background-color: #efefef;
|
|
1326
|
+
border-radius: 2px;
|
|
1327
|
+
border-style: none;
|
|
1328
|
+
padding: 0.4rem;
|
|
1329
|
+
font-family: Lato, "sans-serif";
|
|
1330
|
+
font-size: 110%;
|
|
1331
|
+
border-right: 16px solid transparent;
|
|
1332
|
+
margin-left: 0.4rem;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
.backfills summary::marker,
|
|
1336
|
+
.backfills summary::-webkit-details-marker{
|
|
1337
|
+
display : none;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
.backfills summary:focus{
|
|
1341
|
+
outline : none;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
.backfills summary:focus-visible{
|
|
1345
|
+
outline : 1px dotted #000;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
.backfills summary::before{
|
|
1349
|
+
z-index : 1;
|
|
1350
|
+
/*background : #696 url('expand-collapse.svg') 0 0;*/
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
.backfills details[open] > summary::before{
|
|
1354
|
+
background-position : calc(-2 * var(--radius)) 0;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
.backfills_header {
|
|
1358
|
+
font-size: 16px;
|
|
1359
|
+
margin-left: 18px;
|
|
1360
|
+
border-left: 2px solid #ddd;
|
|
1361
|
+
padding-left: 40px;
|
|
1362
|
+
margin-bottom: 10px;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
.tr {
|
|
1366
|
+
display: inline-flex;
|
|
1367
|
+
}
|
|
1368
|
+
.tr li {
|
|
1369
|
+
padding-right: 10px;
|
|
1370
|
+
}
|
|
1371
|
+
.td {
|
|
1372
|
+
display: table-cell;
|
|
1373
|
+
padding: 8px;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
table {
|
|
1377
|
+
width: 100%;
|
|
1378
|
+
height: min-content;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
.queryrunner-filters {
|
|
1382
|
+
background-color: #fff;
|
|
1383
|
+
padding-right: 20px;
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
.tooltip {
|
|
1387
|
+
position: relative;
|
|
1388
|
+
display: inline-block;
|
|
1389
|
+
border-bottom: 1px dotted black;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
.tooltip .tooltiptext {
|
|
1393
|
+
visibility: hidden;
|
|
1394
|
+
width: 120px;
|
|
1395
|
+
background-color: #555;
|
|
1396
|
+
color: #fff;
|
|
1397
|
+
text-align: center;
|
|
1398
|
+
border-radius: 6px;
|
|
1399
|
+
padding: 15px;
|
|
1400
|
+
position: absolute;
|
|
1401
|
+
z-index: 1;
|
|
1402
|
+
|
|
1403
|
+
top: -5px;
|
|
1404
|
+
left: 125%;
|
|
1405
|
+
/*bottom: 125%;*/
|
|
1406
|
+
/*left: 50%;*/
|
|
1407
|
+
margin-left: -60px;
|
|
1408
|
+
opacity: 0;
|
|
1409
|
+
transition: opacity 0.3s;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
.tooltip .tooltiptext::after {
|
|
1413
|
+
content: "";
|
|
1414
|
+
position: absolute;
|
|
1415
|
+
top: 100%;
|
|
1416
|
+
left: 50%;
|
|
1417
|
+
margin-left: -5px;
|
|
1418
|
+
border-width: 5px;
|
|
1419
|
+
border-style: solid;
|
|
1420
|
+
border-color: #555 transparent transparent transparent;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
.tooltip:hover .tooltiptext {
|
|
1424
|
+
visibility: visible;
|
|
1425
|
+
opacity: 1;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
.queryrunner {
|
|
1429
|
+
display: grid;
|
|
1430
|
+
grid-template-columns: 300px 1fr;
|
|
1431
|
+
grid-template-rows: 250px 1fr;
|
|
1432
|
+
gap: 20px;
|
|
1433
|
+
grid-template-areas:
|
|
1434
|
+
"left righttop"
|
|
1435
|
+
"left rightbottom";
|
|
1436
|
+
margin-top: 1rem;
|
|
1437
|
+
}
|
|
1438
|
+
.left { grid-area: left; }
|
|
1439
|
+
.righttop { grid-area: righttop; }
|
|
1440
|
+
.rightbottom { grid-area: rightbottom; }
|
|
1441
|
+
|
|
1442
|
+
.queryrunner-query pre {
|
|
1443
|
+
border-radius: 0;
|
|
1444
|
+
margin-top: 0;
|
|
1445
|
+
margin-bottom: 0;
|
|
1446
|
+
padding: 1rem !important;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
.tab-item {
|
|
1450
|
+
align-items: center;
|
|
1451
|
+
background: #0000;
|
|
1452
|
+
border: 0;
|
|
1453
|
+
cursor: pointer;
|
|
1454
|
+
margin: 0 32px 0 0;
|
|
1455
|
+
outline: none;
|
|
1456
|
+
padding: 12px 0;
|
|
1457
|
+
text-transform: uppercase;
|
|
1458
|
+
user-select: none;
|
|
1459
|
+
width: fit-content !important;
|
|
1460
|
+
}
|
|
1461
|
+
.query-info {
|
|
1462
|
+
list-style-type: none;
|
|
1463
|
+
padding-bottom: 10px;
|
|
1464
|
+
}
|
|
1465
|
+
.query-info label {
|
|
1466
|
+
margin-left: -10px;
|
|
1467
|
+
}
|
|
1468
|
+
.active {
|
|
1469
|
+
border-bottom: 2px solid #007acc;
|
|
1321
1470
|
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { useContext, useEffect, useState } from 'react';
|
|
2
|
-
import Select from 'react-select';
|
|
3
|
-
import DJClientContext from '../../providers/djclient';
|
|
4
|
-
import { Light as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
5
|
-
import { foundation } from 'react-syntax-highlighter/src/styles/hljs';
|
|
6
|
-
|
|
7
|
-
const NodeSQLTab = djNode => {
|
|
8
|
-
const djClient = useContext(DJClientContext).DataJunctionAPI;
|
|
9
|
-
const [query, setQuery] = useState('');
|
|
10
|
-
|
|
11
|
-
const [selection, setSelection] = useState({
|
|
12
|
-
dimensions: [],
|
|
13
|
-
filters: [],
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const fetchData = async () => {
|
|
18
|
-
const query = await djClient.sql(djNode.djNode.name, selection);
|
|
19
|
-
setQuery(query.sql);
|
|
20
|
-
};
|
|
21
|
-
fetchData().catch(console.error);
|
|
22
|
-
}, [djClient, djNode.djNode.name, selection]);
|
|
23
|
-
const dimensionsList = djNode.djNode.dimensions
|
|
24
|
-
? djNode.djNode.dimensions.map(dim => ({
|
|
25
|
-
value: dim.name,
|
|
26
|
-
label: dim.name + ` (${dim.type})`,
|
|
27
|
-
}))
|
|
28
|
-
: [''];
|
|
29
|
-
|
|
30
|
-
const handleSubmit = event => {
|
|
31
|
-
event.preventDefault();
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const handleChange = event => {
|
|
35
|
-
setSelection({ filters: [], dimensions: event.map(dim => dim.value) });
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<form
|
|
40
|
-
id="retrieve-sql"
|
|
41
|
-
name="retrieve-sql"
|
|
42
|
-
onSubmit={handleSubmit.bind(this)}
|
|
43
|
-
>
|
|
44
|
-
<div>
|
|
45
|
-
<h4>Group By</h4>
|
|
46
|
-
<Select
|
|
47
|
-
name="dimensions"
|
|
48
|
-
options={dimensionsList}
|
|
49
|
-
isMulti
|
|
50
|
-
isClearable
|
|
51
|
-
onChange={handleChange}
|
|
52
|
-
/>
|
|
53
|
-
{/*<h4>Filters</h4>*/}
|
|
54
|
-
{/*<Select*/}
|
|
55
|
-
{/* name="filter_name"*/}
|
|
56
|
-
{/* options={dimensionsList}*/}
|
|
57
|
-
{/* className="filters_attribute"*/}
|
|
58
|
-
{/*/>*/}
|
|
59
|
-
{/*<Select*/}
|
|
60
|
-
{/* name="filter_operator"*/}
|
|
61
|
-
{/* options={options}*/}
|
|
62
|
-
{/* className="filters_attribute"*/}
|
|
63
|
-
{/*/>*/}
|
|
64
|
-
{/*<textarea name="filter_value" className="filters_attribute" />*/}
|
|
65
|
-
|
|
66
|
-
<div
|
|
67
|
-
style={{
|
|
68
|
-
width: window.innerWidth * 0.8,
|
|
69
|
-
marginTop: '2rem',
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
<h6 className="mb-0 w-100">Query</h6>
|
|
73
|
-
<SyntaxHighlighter language="sql" style={foundation}>
|
|
74
|
-
{query}
|
|
75
|
-
</SyntaxHighlighter>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
</form>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export default NodeSQLTab;
|