@mwater/visualization 5.4.5 → 5.6.0
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/lib/MWaterContextComponent.d.ts +1 -1
- package/lib/MWaterContextComponent.js +1 -1
- package/lib/MWaterGlobalFiltersComponent.d.ts +2 -2
- package/lib/MWaterGlobalFiltersComponent.js +11 -20
- package/lib/MWaterLoaderComponent.d.ts +5 -14
- package/lib/MWaterLoaderComponent.js +2 -11
- package/lib/UndoStack.d.ts +2 -1
- package/lib/UndoStack.js +12 -6
- package/lib/dashboards/DashboardComponent.js +7 -5
- package/lib/dashboards/DashboardDesign.d.ts +1 -1
- package/lib/dashboards/LayoutOptionsComponent.js +18 -11
- package/lib/dashboards/ServerDashboardDataSource.d.ts +10 -1
- package/lib/dashboards/ServerDashboardDataSource.js +29 -10
- package/lib/dashboards/SettingsModalComponent.js +1 -1
- package/lib/dashboards/layoutOptions.d.ts +5 -1
- package/lib/datagrids/DatagridComponent.js +23 -3
- package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -3
- package/lib/datagrids/DatagridDesignerComponent.js +108 -120
- package/lib/datagrids/DatagridViewComponent.js +3 -2
- package/lib/datagrids/ExprCellComponent.d.ts +1 -0
- package/lib/datagrids/ExprCellComponent.js +22 -20
- package/lib/datagrids/OrderBysDesignerComponent.d.ts +7 -7
- package/lib/datagrids/OrderBysDesignerComponent.js +19 -28
- package/lib/index.css +45 -2
- package/lib/index.d.ts +5 -5
- package/lib/index.js +2 -3
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +8 -1
- package/lib/layouts/blocks/BlocksDisplayComponent.js +46 -4
- package/lib/maps/BufferLayer.d.ts +18 -0
- package/lib/maps/BufferLayer.js +36 -14
- package/lib/maps/BufferLayerDesign.d.ts +1 -1
- package/lib/maps/BufferLayerDesignerComponent.js +2 -2
- package/lib/maps/ChoroplethLayer.d.ts +18 -0
- package/lib/maps/ChoroplethLayer.js +46 -25
- package/lib/maps/ChoroplethLayerDesign.d.ts +7 -3
- package/lib/maps/ChoroplethLayerDesigner.d.ts +10 -22
- package/lib/maps/ChoroplethLayerDesigner.js +58 -89
- package/lib/maps/DirectMapDataSource.js +17 -10
- package/lib/maps/EditHoverOver.d.ts +4 -3
- package/lib/maps/EditHoverOver.js +64 -35
- package/lib/maps/HoverContent.d.ts +10 -5
- package/lib/maps/HoverContent.js +7 -36
- package/lib/maps/Layer.d.ts +37 -0
- package/lib/maps/Layer.js +30 -4
- package/lib/maps/LeafletMapComponent.js +10 -19
- package/lib/maps/MWaterServerLayer.d.ts +2 -2
- package/lib/maps/MWaterServerLayer.js +6 -6
- package/lib/maps/MapComponent.js +0 -1
- package/lib/maps/MapLayerDataSource.d.ts +9 -0
- package/lib/maps/MapUtils.d.ts +19 -1
- package/lib/maps/MapUtils.js +80 -1
- package/lib/maps/MarkersLayer.d.ts +18 -0
- package/lib/maps/MarkersLayer.js +42 -26
- package/lib/maps/MarkersLayerDesign.d.ts +1 -1
- package/lib/maps/MarkersLayerDesignerComponent.d.ts +12 -28
- package/lib/maps/MarkersLayerDesignerComponent.js +81 -111
- package/lib/maps/RasterMapViewComponent.js +1 -1
- package/lib/maps/ServerMapDataSource.d.ts +9 -0
- package/lib/maps/ServerMapDataSource.js +29 -10
- package/lib/maps/VectorMapViewComponent.js +7 -15
- package/lib/maps/maps.d.ts +4 -2
- package/lib/maps/symbols/font-awesome/asterisk.png +0 -0
- package/lib/maps/symbols/font-awesome/ban.png +0 -0
- package/lib/maps/symbols/font-awesome/beer.png +0 -0
- package/lib/maps/symbols/font-awesome/bell.png +0 -0
- package/lib/maps/symbols/font-awesome/bolt.png +0 -0
- package/lib/maps/symbols/font-awesome/building.png +0 -0
- package/lib/maps/symbols/font-awesome/bullseye.png +0 -0
- package/lib/maps/symbols/font-awesome/bus.png +0 -0
- package/lib/maps/symbols/font-awesome/caret-up.png +0 -0
- package/lib/maps/symbols/font-awesome/certificate.png +0 -0
- package/lib/maps/symbols/font-awesome/check-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/check.png +0 -0
- package/lib/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
- package/lib/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/symbols/font-awesome/cloud.png +0 -0
- package/lib/maps/symbols/font-awesome/comment.png +0 -0
- package/lib/maps/symbols/font-awesome/crosshairs.png +0 -0
- package/lib/maps/symbols/font-awesome/dot-circle-o.png +0 -0
- package/lib/maps/symbols/font-awesome/exclamation-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
- package/lib/maps/symbols/font-awesome/female.png +0 -0
- package/lib/maps/symbols/font-awesome/file.png +0 -0
- package/lib/maps/symbols/font-awesome/flag.png +0 -0
- package/lib/maps/symbols/font-awesome/flask.png +0 -0
- package/lib/maps/symbols/font-awesome/h-square.png +0 -0
- package/lib/maps/symbols/font-awesome/home.png +0 -0
- package/lib/maps/symbols/font-awesome/info-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/male.png +0 -0
- package/lib/maps/symbols/font-awesome/medkit.png +0 -0
- package/lib/maps/symbols/font-awesome/mobile.png +0 -0
- package/lib/maps/symbols/font-awesome/plus-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/plus-square.png +0 -0
- package/lib/maps/symbols/font-awesome/plus.png +0 -0
- package/lib/maps/symbols/font-awesome/square.png +0 -0
- package/lib/maps/symbols/font-awesome/star.png +0 -0
- package/lib/maps/symbols/font-awesome/thumbs-down.png +0 -0
- package/lib/maps/symbols/font-awesome/thumbs-up.png +0 -0
- package/lib/maps/symbols/font-awesome/ticket.png +0 -0
- package/lib/maps/symbols/font-awesome/times-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/times.png +0 -0
- package/lib/maps/symbols/font-awesome/tint.png +0 -0
- package/lib/maps/symbols/font-awesome/tree.png +0 -0
- package/lib/maps/symbols/font-awesome/university.png +0 -0
- package/lib/maps/symbols/font-awesome/usd.png +0 -0
- package/lib/maps/symbols/font-awesome/user.png +0 -0
- package/lib/maps/symbols/font-awesome/users.png +0 -0
- package/lib/maps/symbols/font-awesome/wheelchair.png +0 -0
- package/lib/maps/symbols/sdf-ize.sh +93 -0
- package/lib/maps/vectorMaps.d.ts +1 -0
- package/lib/maps/vectorMaps.js +20 -36
- package/lib/mwater_table_selection/FormsListComponent.d.ts +33 -0
- package/lib/mwater_table_selection/FormsListComponent.js +141 -0
- package/lib/mwater_table_selection/IndicatorsListComponent.d.ts +49 -0
- package/lib/mwater_table_selection/IndicatorsListComponent.js +251 -0
- package/lib/mwater_table_selection/IssuesListComponent.d.ts +29 -0
- package/lib/mwater_table_selection/IssuesListComponent.js +123 -0
- package/lib/mwater_table_selection/MWaterAccountingSystemListComponent.d.ts +20 -0
- package/lib/mwater_table_selection/MWaterAccountingSystemListComponent.js +157 -0
- package/lib/mwater_table_selection/MWaterAssetSystemsListComponent.d.ts +17 -0
- package/lib/mwater_table_selection/MWaterAssetSystemsListComponent.js +79 -0
- package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.d.ts +18 -0
- package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.js +80 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.d.ts +63 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.js +461 -0
- package/lib/mwater_table_selection/MWaterCustomTablesetListComponent.d.ts +17 -0
- package/lib/mwater_table_selection/MWaterCustomTablesetListComponent.js +94 -0
- package/lib/mwater_table_selection/MWaterMetricsTableListComponent.d.ts +17 -0
- package/lib/mwater_table_selection/MWaterMetricsTableListComponent.js +80 -0
- package/lib/mwater_table_selection/MWaterTableSelectComponent.d.ts +32 -0
- package/lib/mwater_table_selection/MWaterTableSelectComponent.js +163 -0
- package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.d.ts +19 -0
- package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.js +111 -0
- package/lib/quickfilter/QuickfiltersComponent.d.ts +3 -102
- package/lib/quickfilter/QuickfiltersComponent.js +53 -110
- package/lib/quickfilter/TextLiteralComponent.d.ts +23 -47
- package/lib/quickfilter/TextLiteralComponent.js +85 -82
- package/lib/widgets/MapWidget.js +4 -2
- package/lib/widgets/charts/Chart.d.ts +11 -0
- package/lib/widgets/charts/Chart.js +15 -0
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +1 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +27 -1
- package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +1 -1
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +1 -1
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +5 -12
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +43 -57
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +113 -110
- package/lib/widgets/charts/layered/LayeredChartUtils.d.ts +2 -1
- package/lib/widgets/charts/layered/LayeredChartUtils.js +0 -2
- package/lib/widgets/charts/pivot/PivotChart.d.ts +2 -0
- package/lib/widgets/charts/pivot/PivotChart.js +156 -0
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +5 -20
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +31 -61
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +4 -0
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +4 -2
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.d.ts +5 -44
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +38 -63
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +7 -68
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.js +58 -106
- package/lib/widgets/charts/table/TableChart.d.ts +2 -0
- package/lib/widgets/charts/table/TableChart.js +172 -1
- package/lib/widgets/charts/table/TableChartDesignerComponent.d.ts +7 -17
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +79 -95
- package/lib/widgets/charts/table/TableChartViewComponent.d.ts +1 -7
- package/lib/widgets/charts/table/TableChartViewComponent.js +19 -27
- package/lib/widgets/text/ExprItemEditorComponent.d.ts +3 -8
- package/lib/widgets/text/ExprItemEditorComponent.js +36 -33
- package/lib/widgets/text/ExprUpdateModalComponent.d.ts +1 -0
- package/package.json +4 -10
- package/src/MWaterContextComponent.tsx +2 -2
- package/src/{MWaterGlobalFiltersComponent.ts → MWaterGlobalFiltersComponent.tsx} +32 -33
- package/src/{MWaterLoaderComponent.ts → MWaterLoaderComponent.tsx} +18 -19
- package/src/UndoStack.ts +14 -6
- package/src/dashboards/DashboardComponent.tsx +7 -5
- package/src/dashboards/DashboardDesign.ts +1 -1
- package/src/dashboards/LayoutOptionsComponent.tsx +22 -10
- package/src/dashboards/ServerDashboardDataSource.ts +36 -13
- package/src/dashboards/SettingsModalComponent.tsx +1 -1
- package/src/dashboards/layoutOptions.tsx +5 -1
- package/src/datagrids/DatagridComponent.tsx +31 -3
- package/src/datagrids/DatagridDesignerComponent.tsx +241 -229
- package/src/datagrids/DatagridViewComponent.tsx +3 -2
- package/src/datagrids/ExprCellComponent.tsx +23 -20
- package/src/datagrids/OrderBysDesignerComponent.tsx +61 -70
- package/src/index.css +45 -2
- package/src/index.ts +5 -11
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +60 -5
- package/src/maps/BufferLayer.ts +48 -20
- package/src/maps/BufferLayerDesign.ts +1 -1
- package/src/maps/BufferLayerDesignerComponent.tsx +2 -1
- package/src/maps/ChoroplethLayer.ts +70 -39
- package/src/maps/ChoroplethLayerDesign.ts +6 -2
- package/src/maps/ChoroplethLayerDesigner.tsx +171 -167
- package/src/maps/DirectMapDataSource.ts +21 -13
- package/src/maps/EditHoverOver.tsx +98 -54
- package/src/maps/HoverContent.tsx +17 -48
- package/src/maps/Layer.ts +42 -4
- package/src/maps/LeafletMapComponent.tsx +10 -19
- package/src/maps/MWaterServerLayer.ts +6 -6
- package/src/maps/MapComponent.ts +0 -1
- package/src/maps/MapLayerDataSource.ts +8 -0
- package/src/maps/MapUtils.ts +82 -3
- package/src/maps/MarkersLayer.ts +54 -27
- package/src/maps/MarkersLayerDesign.ts +1 -1
- package/src/maps/MarkersLayerDesignerComponent.tsx +360 -0
- package/src/maps/RasterMapViewComponent.ts +1 -1
- package/src/maps/ServerMapDataSource.ts +35 -12
- package/src/maps/VectorMapViewComponent.tsx +8 -19
- package/src/maps/maps.ts +4 -2
- package/src/maps/symbols/font-awesome/asterisk.png +0 -0
- package/src/maps/symbols/font-awesome/ban.png +0 -0
- package/src/maps/symbols/font-awesome/beer.png +0 -0
- package/src/maps/symbols/font-awesome/bell.png +0 -0
- package/src/maps/symbols/font-awesome/bolt.png +0 -0
- package/src/maps/symbols/font-awesome/building.png +0 -0
- package/src/maps/symbols/font-awesome/bullseye.png +0 -0
- package/src/maps/symbols/font-awesome/bus.png +0 -0
- package/src/maps/symbols/font-awesome/caret-up.png +0 -0
- package/src/maps/symbols/font-awesome/certificate.png +0 -0
- package/src/maps/symbols/font-awesome/check-circle.png +0 -0
- package/src/maps/symbols/font-awesome/check.png +0 -0
- package/src/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
- package/src/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/symbols/font-awesome/cloud.png +0 -0
- package/src/maps/symbols/font-awesome/comment.png +0 -0
- package/src/maps/symbols/font-awesome/crosshairs.png +0 -0
- package/src/maps/symbols/font-awesome/dot-circle-o.png +0 -0
- package/src/maps/symbols/font-awesome/exclamation-circle.png +0 -0
- package/src/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
- package/src/maps/symbols/font-awesome/female.png +0 -0
- package/src/maps/symbols/font-awesome/file.png +0 -0
- package/src/maps/symbols/font-awesome/flag.png +0 -0
- package/src/maps/symbols/font-awesome/flask.png +0 -0
- package/src/maps/symbols/font-awesome/h-square.png +0 -0
- package/src/maps/symbols/font-awesome/home.png +0 -0
- package/src/maps/symbols/font-awesome/info-circle.png +0 -0
- package/src/maps/symbols/font-awesome/male.png +0 -0
- package/src/maps/symbols/font-awesome/medkit.png +0 -0
- package/src/maps/symbols/font-awesome/mobile.png +0 -0
- package/src/maps/symbols/font-awesome/plus-circle.png +0 -0
- package/src/maps/symbols/font-awesome/plus-square.png +0 -0
- package/src/maps/symbols/font-awesome/plus.png +0 -0
- package/src/maps/symbols/font-awesome/square.png +0 -0
- package/src/maps/symbols/font-awesome/star.png +0 -0
- package/src/maps/symbols/font-awesome/thumbs-down.png +0 -0
- package/src/maps/symbols/font-awesome/thumbs-up.png +0 -0
- package/src/maps/symbols/font-awesome/ticket.png +0 -0
- package/src/maps/symbols/font-awesome/times-circle.png +0 -0
- package/src/maps/symbols/font-awesome/times.png +0 -0
- package/src/maps/symbols/font-awesome/tint.png +0 -0
- package/src/maps/symbols/font-awesome/tree.png +0 -0
- package/src/maps/symbols/font-awesome/university.png +0 -0
- package/src/maps/symbols/font-awesome/usd.png +0 -0
- package/src/maps/symbols/font-awesome/user.png +0 -0
- package/src/maps/symbols/font-awesome/users.png +0 -0
- package/src/maps/symbols/font-awesome/wheelchair.png +0 -0
- package/src/maps/symbols/sdf-ize.sh +93 -0
- package/src/maps/vectorMaps.tsx +20 -44
- package/src/mwater_table_selection/FormsListComponent.tsx +188 -0
- package/src/mwater_table_selection/IndicatorsListComponent.tsx +411 -0
- package/src/mwater_table_selection/IssuesListComponent.tsx +167 -0
- package/src/mwater_table_selection/MWaterAccountingSystemListComponent.tsx +225 -0
- package/src/{MWaterAssetSystemsListComponent.tsx → mwater_table_selection/MWaterAssetSystemsListComponent.tsx} +2 -2
- package/src/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.tsx +111 -0
- package/src/mwater_table_selection/MWaterCompleteTableSelectComponent.tsx +713 -0
- package/src/{MWaterCustomTablesetListComponent.tsx → mwater_table_selection/MWaterCustomTablesetListComponent.tsx} +1 -1
- package/src/{MWaterMetricsTableListComponent.tsx → mwater_table_selection/MWaterMetricsTableListComponent.tsx} +1 -1
- package/src/{MWaterTableSelectComponent.tsx → mwater_table_selection/MWaterTableSelectComponent.tsx} +91 -90
- package/src/mwater_table_selection/MWaterWorkflowsSelectComponent.tsx +159 -0
- package/src/quickfilter/{QuickfiltersComponent.ts → QuickfiltersComponent.tsx} +165 -158
- package/src/quickfilter/TextLiteralComponent.tsx +197 -0
- package/src/widgets/MapWidget.tsx +9 -1
- package/src/widgets/charts/Chart.ts +17 -0
- package/src/widgets/charts/ChartWidgetComponent.tsx +36 -1
- package/src/widgets/charts/layered/LayeredChartDesign.ts +1 -1
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +23 -24
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +260 -211
- package/src/widgets/charts/layered/LayeredChartUtils.ts +7 -7
- package/src/widgets/charts/pivot/PivotChart.ts +191 -0
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +124 -129
- package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +4 -2
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +120 -149
- package/src/widgets/charts/pivot/SegmentDesignerComponent.tsx +178 -198
- package/src/widgets/charts/table/TableChart.ts +177 -1
- package/src/widgets/charts/table/TableChartDesignerComponent.tsx +422 -0
- package/src/widgets/charts/table/{TableChartViewComponent.ts → TableChartViewComponent.tsx} +65 -60
- package/src/widgets/text/ExprItemEditorComponent.tsx +83 -77
- package/src/widgets/text/ExprUpdateModalComponent.tsx +1 -0
- package/test/UndoStackTests.ts +52 -1
- package/.storybook/config.js +0 -7
- package/.storybook/head.html +0 -4
- package/.storybook/webpack.config.js +0 -15
- package/src/MWaterCompleteTableSelectComponent.tsx +0 -975
- package/src/maps/BingLayer.ts +0 -146
- package/src/maps/MarkersLayerDesignerComponent.ts +0 -374
- package/src/quickfilter/TextLiteralComponent.ts +0 -165
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +0 -441
- package/stories/UpdateableComponent.js +0 -29
- package/stories/consoles.js +0 -202
- package/stories/dashboards.js +0 -217
- package/stories/datagridDesign.js +0 -114
- package/stories/datagrids.js +0 -69
- package/stories/dates.js +0 -80
- package/stories/exprcomponent.js +0 -43
- package/stories/index.js +0 -18
- package/stories/leaflet.js +0 -59
- package/stories/maps.js +0 -24
- package/stories/pivotChart.js +0 -235
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MWaterAssetSystemsListComponent = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const expressions_1 = require("@mwater/expressions");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const react_2 = __importDefault(require("react"));
|
|
11
|
+
const UIComponents_1 = require("../UIComponents");
|
|
12
|
+
const bootstrap_1 = require("@mwater/react-library/lib/bootstrap");
|
|
13
|
+
/** Searchable list of asset system tables */
|
|
14
|
+
const MWaterAssetSystemsListComponent = (props) => {
|
|
15
|
+
const [systems, setSystems] = (0, react_1.useState)();
|
|
16
|
+
const [search, setSearch] = (0, react_1.useState)("");
|
|
17
|
+
const [extraTableNeeded, setExtraTableNeeded] = (0, react_1.useState)();
|
|
18
|
+
// Get list of all systems
|
|
19
|
+
(0, react_1.useEffect)(() => {
|
|
20
|
+
fetch(`${props.apiUrl}asset_systems?client=${props.client || ""}`)
|
|
21
|
+
.then((response) => response.json())
|
|
22
|
+
.then((body) => {
|
|
23
|
+
// Put included ones first
|
|
24
|
+
setSystems(lodash_1.default.sortByAll(body, [
|
|
25
|
+
(m) => (props.extraTables.some(t => t == `assets:${m.sid}`)) ? 0 : 1,
|
|
26
|
+
(m) => expressions_1.ExprUtils.localizeString(m.design.name, props.locale)
|
|
27
|
+
]));
|
|
28
|
+
});
|
|
29
|
+
}, []);
|
|
30
|
+
(0, react_1.useEffect)(() => {
|
|
31
|
+
if (extraTableNeeded && props.schema.getTable(extraTableNeeded)) {
|
|
32
|
+
props.onChange(extraTableNeeded);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const selectTable = (system) => {
|
|
36
|
+
const qualifiedTableId = `assets:${system.sid}`;
|
|
37
|
+
// If already included, select it
|
|
38
|
+
if (props.schema.getTable(qualifiedTableId)) {
|
|
39
|
+
props.onChange(qualifiedTableId);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Request extra tables as wildcard
|
|
43
|
+
setExtraTableNeeded(qualifiedTableId);
|
|
44
|
+
props.onExtraTableAdd(qualifiedTableId);
|
|
45
|
+
};
|
|
46
|
+
const handleRemove = (system) => {
|
|
47
|
+
// Remove from extra tables
|
|
48
|
+
const match = props.extraTables.find((t) => t == `assets:${system.sid}`);
|
|
49
|
+
if (match) {
|
|
50
|
+
if (confirm(T `Remove this table? Some widgets may not work correctly.`)) {
|
|
51
|
+
props.onChange(null);
|
|
52
|
+
props.onExtraTableRemove(match);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
if (!systems || extraTableNeeded) {
|
|
57
|
+
return (react_2.default.createElement("div", null,
|
|
58
|
+
react_2.default.createElement("i", { className: "fa fa-spin fa-spinner" }),
|
|
59
|
+
" ",
|
|
60
|
+
T `Loading...`));
|
|
61
|
+
}
|
|
62
|
+
const renderAssetSystems = () => {
|
|
63
|
+
const items = systems
|
|
64
|
+
.map((m) => {
|
|
65
|
+
const alreadyIncluded = props.extraTables.some((t) => t == `assets:${m.sid}`);
|
|
66
|
+
return {
|
|
67
|
+
name: expressions_1.ExprUtils.localizeString(m.design.name, props.locale) || "",
|
|
68
|
+
onClick: () => selectTable(m),
|
|
69
|
+
onRemove: alreadyIncluded ? handleRemove.bind(null, m) : undefined
|
|
70
|
+
};
|
|
71
|
+
})
|
|
72
|
+
.filter((item) => !search || !item.name.toLowerCase().includes(search.toLowerCase()));
|
|
73
|
+
return react_2.default.createElement(UIComponents_1.OptionListComponent, { items: items });
|
|
74
|
+
};
|
|
75
|
+
return (react_2.default.createElement("div", null,
|
|
76
|
+
react_2.default.createElement(bootstrap_1.TextInput, { value: search, onChange: setSearch, placeholder: T `Search...` }),
|
|
77
|
+
renderAssetSystems()));
|
|
78
|
+
};
|
|
79
|
+
exports.MWaterAssetSystemsListComponent = MWaterAssetSystemsListComponent;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Schema } from "@mwater/expressions";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface MWaterCalculatedDataSourcesListComponentProps {
|
|
4
|
+
apiUrl: string;
|
|
5
|
+
schema: Schema;
|
|
6
|
+
client?: string;
|
|
7
|
+
user?: string;
|
|
8
|
+
onChange: (tableId: string | null) => void;
|
|
9
|
+
extraTables: string[];
|
|
10
|
+
onExtraTableAdd: (tableId: string) => void;
|
|
11
|
+
onExtraTableRemove: (tableId: string) => void;
|
|
12
|
+
locale?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A list of calculated data sources that can be selected.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MWaterCalculatedDataSourcesListComponent: (props: MWaterCalculatedDataSourcesListComponentProps) => React.JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MWaterCalculatedDataSourcesListComponent = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const expressions_1 = require("@mwater/expressions");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const react_2 = __importDefault(require("react"));
|
|
11
|
+
const UIComponents_1 = require("../UIComponents");
|
|
12
|
+
const bootstrap_1 = require("@mwater/react-library/lib/bootstrap");
|
|
13
|
+
/**
|
|
14
|
+
* A list of calculated data sources that can be selected.
|
|
15
|
+
*/
|
|
16
|
+
const MWaterCalculatedDataSourcesListComponent = (props) => {
|
|
17
|
+
const [calculatedSources, setCalculatedSources] = (0, react_1.useState)();
|
|
18
|
+
const [search, setSearch] = (0, react_1.useState)("");
|
|
19
|
+
const [extraTableNeeded, setExtraTableNeeded] = (0, react_1.useState)();
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
fetch(`${props.apiUrl}calculated_data_sources?client=${props.client || ""}`)
|
|
22
|
+
.then((response) => response.json())
|
|
23
|
+
.then((body) => {
|
|
24
|
+
// Filter out calculated data sources that have never been calculated
|
|
25
|
+
const calculatedSources = body.filter((s) => s.last_calculated);
|
|
26
|
+
setCalculatedSources(lodash_1.default.sortByAll(calculatedSources, [
|
|
27
|
+
(s) => (props.extraTables.some((t) => t == `calculated:${s._sid}`) ? 0 : 1),
|
|
28
|
+
(s) => expressions_1.ExprUtils.localizeString(s.name, props.locale)
|
|
29
|
+
]));
|
|
30
|
+
});
|
|
31
|
+
}, []);
|
|
32
|
+
(0, react_1.useEffect)(() => {
|
|
33
|
+
if (extraTableNeeded && props.schema.getTable(extraTableNeeded)) {
|
|
34
|
+
props.onChange(extraTableNeeded);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const selectTable = (source) => {
|
|
38
|
+
const qualifiedTableId = `calculated:${source._sid}`;
|
|
39
|
+
if (props.schema.getTable(qualifiedTableId)) {
|
|
40
|
+
props.onChange(qualifiedTableId);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
setExtraTableNeeded(qualifiedTableId);
|
|
44
|
+
props.onExtraTableAdd(qualifiedTableId);
|
|
45
|
+
};
|
|
46
|
+
const handleRemove = (source) => {
|
|
47
|
+
const match = props.extraTables.find((t) => t == `calculated:${source._sid}`);
|
|
48
|
+
if (match) {
|
|
49
|
+
if (confirm(T `Remove this table? Some widgets may not work correctly.`)) {
|
|
50
|
+
props.onChange(null);
|
|
51
|
+
props.onExtraTableRemove(match);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
if (!calculatedSources || extraTableNeeded) {
|
|
56
|
+
return (react_2.default.createElement("div", null,
|
|
57
|
+
react_2.default.createElement("i", { className: "fa fa-spin fa-spinner" }),
|
|
58
|
+
" ",
|
|
59
|
+
T `Loading...`));
|
|
60
|
+
}
|
|
61
|
+
const renderCalculatedSources = () => {
|
|
62
|
+
const items = calculatedSources
|
|
63
|
+
.map((s) => {
|
|
64
|
+
const alreadyIncluded = props.extraTables.some((t) => t == `calculated:${s._sid}`);
|
|
65
|
+
return {
|
|
66
|
+
name: expressions_1.ExprUtils.localizeString(s.name, props.locale) || "",
|
|
67
|
+
desc: s.description ? expressions_1.ExprUtils.localizeString(s.description, props.locale) || "" : undefined,
|
|
68
|
+
onClick: () => selectTable(s),
|
|
69
|
+
onRemove: alreadyIncluded ? handleRemove.bind(null, s) : undefined
|
|
70
|
+
};
|
|
71
|
+
})
|
|
72
|
+
.filter((item) => !search || item.name.toLowerCase().includes(search.toLowerCase()));
|
|
73
|
+
return react_2.default.createElement(UIComponents_1.OptionListComponent, { items: items });
|
|
74
|
+
};
|
|
75
|
+
return (react_2.default.createElement("div", null,
|
|
76
|
+
react_2.default.createElement(bootstrap_1.TextInput, { value: search, onChange: setSearch, placeholder: T `Search...`, searchIcon: true }),
|
|
77
|
+
react_2.default.createElement("br", null),
|
|
78
|
+
renderCalculatedSources()));
|
|
79
|
+
};
|
|
80
|
+
exports.MWaterCalculatedDataSourcesListComponent = MWaterCalculatedDataSourcesListComponent;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Schema } from "@mwater/expressions";
|
|
3
|
+
interface MWaterCompleteTableSelectComponentProps {
|
|
4
|
+
/** Url to hit api */
|
|
5
|
+
apiUrl: string;
|
|
6
|
+
/** Optional client */
|
|
7
|
+
client?: string;
|
|
8
|
+
schema: Schema;
|
|
9
|
+
/** User id */
|
|
10
|
+
user?: string;
|
|
11
|
+
table?: string;
|
|
12
|
+
/** Called with table selected */
|
|
13
|
+
onChange: any;
|
|
14
|
+
extraTables: any;
|
|
15
|
+
onExtraTablesChange: any;
|
|
16
|
+
}
|
|
17
|
+
interface Category {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
icon: string;
|
|
22
|
+
render: () => JSX.Element;
|
|
23
|
+
}
|
|
24
|
+
/** Allows selection of a table. Card-based layout with categories */
|
|
25
|
+
export default class MWaterCompleteTableSelectComponent extends React.Component<MWaterCompleteTableSelectComponentProps, {
|
|
26
|
+
selectedCategory: string | null;
|
|
27
|
+
showLegacyAssets: boolean;
|
|
28
|
+
searchText: string;
|
|
29
|
+
}> {
|
|
30
|
+
constructor(props: MWaterCompleteTableSelectComponentProps);
|
|
31
|
+
handleExtraTableAdd: (tableId: any) => any;
|
|
32
|
+
handleExtraTableRemove: (tableId: any) => any;
|
|
33
|
+
handleCategorySelect: (categoryId: string) => void;
|
|
34
|
+
handleBackToCategories: () => void;
|
|
35
|
+
renderSites(): React.JSX.Element;
|
|
36
|
+
renderForms(): React.JSX.Element;
|
|
37
|
+
renderIndicators(): React.JSX.Element;
|
|
38
|
+
renderIssues(): React.JSX.Element;
|
|
39
|
+
renderWorkflows(): React.JSX.Element;
|
|
40
|
+
renderSweetSense(): React.JSX.Element;
|
|
41
|
+
renderTablesets(): React.JSX.Element;
|
|
42
|
+
renderMetrics(): React.JSX.Element;
|
|
43
|
+
renderAccountingSystems(): React.JSX.Element;
|
|
44
|
+
renderAssets(): React.JSX.Element;
|
|
45
|
+
renderLegacyAssets(): React.JSX.Element;
|
|
46
|
+
renderCalculated(): React.JSX.Element;
|
|
47
|
+
renderOther(): React.JSX.Element;
|
|
48
|
+
getSweetSenseTables(): import("@mwater/expressions").Table[];
|
|
49
|
+
/** Get all available categories */
|
|
50
|
+
getCategories(): Category[];
|
|
51
|
+
/** Render a single category card */
|
|
52
|
+
renderCategoryCard(category: Category): React.JSX.Element;
|
|
53
|
+
/** Get display name for an extra table (handles wildcards) */
|
|
54
|
+
getExtraTableDisplayName(tableId: string): string | null;
|
|
55
|
+
/** Render the currently included extra tables section */
|
|
56
|
+
renderExtraTables(): React.JSX.Element | null;
|
|
57
|
+
/** Render the landing page with all categories */
|
|
58
|
+
renderLandingPage(): React.JSX.Element;
|
|
59
|
+
/** Render a specific category view */
|
|
60
|
+
renderCategoryView(): React.JSX.Element | null;
|
|
61
|
+
render(): React.JSX.Element;
|
|
62
|
+
}
|
|
63
|
+
export {};
|