@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,411 @@
|
|
|
1
|
+
import _ from "lodash"
|
|
2
|
+
import $ from "jquery"
|
|
3
|
+
import React from "react"
|
|
4
|
+
import querystring from "querystring"
|
|
5
|
+
import * as uiComponents from "../UIComponents"
|
|
6
|
+
import { ExprUtils, Schema } from "@mwater/expressions"
|
|
7
|
+
import ModalPopupComponent from "@mwater/react-library/lib/ModalPopupComponent"
|
|
8
|
+
|
|
9
|
+
export interface IndicatorsListComponentProps {
|
|
10
|
+
/** Url to hit api */
|
|
11
|
+
apiUrl: string
|
|
12
|
+
/** Optional client */
|
|
13
|
+
client?: string
|
|
14
|
+
schema: Schema
|
|
15
|
+
/** User id */
|
|
16
|
+
user?: string
|
|
17
|
+
/** Called with table selected */
|
|
18
|
+
onChange: any
|
|
19
|
+
extraTables: any
|
|
20
|
+
onExtraTableAdd: any
|
|
21
|
+
onExtraTableRemove: any
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface IndicatorsListComponentState {
|
|
25
|
+
error?: any
|
|
26
|
+
search: any
|
|
27
|
+
indicators: any[] | null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Searchable list of indicators
|
|
31
|
+
export class IndicatorsListComponent extends React.Component<IndicatorsListComponentProps, IndicatorsListComponentState> {
|
|
32
|
+
addIndicatorConfirmPopup: AddIndicatorConfirmPopupComponent | null
|
|
33
|
+
|
|
34
|
+
constructor(props: IndicatorsListComponentProps) {
|
|
35
|
+
super(props)
|
|
36
|
+
this.state = {
|
|
37
|
+
indicators: null,
|
|
38
|
+
search: ""
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
componentDidMount() {
|
|
43
|
+
// Get names and basic of forms
|
|
44
|
+
const query: any = {}
|
|
45
|
+
query.fields = JSON.stringify({ "design.name": 1, "design.desc": 1, "design.recommended": 1, deprecated: 1, "design.category": 1, "design.subcategory": 1, "design.code": 1, "design.organization": 1 })
|
|
46
|
+
query.client = this.props.client
|
|
47
|
+
|
|
48
|
+
// Get list of all indicator names
|
|
49
|
+
return $.getJSON(this.props.apiUrl + "indicators?" + querystring.stringify(query), (indicators: any[]) => {
|
|
50
|
+
// Remove deprecated
|
|
51
|
+
indicators = _.filter(indicators, (indicator) => !indicator.deprecated)
|
|
52
|
+
|
|
53
|
+
// Sort by name
|
|
54
|
+
indicators = _.sortByOrder(
|
|
55
|
+
indicators,
|
|
56
|
+
[
|
|
57
|
+
(indicator: any) => ((this.props.extraTables || []).includes("indicator_values:" + indicator._id) ? 0 : 1),
|
|
58
|
+
(indicator: any) => (indicator.design.recommended ? 0 : 1),
|
|
59
|
+
(indicator: any) => ExprUtils.localizeString(indicator.design.name, T.locale)
|
|
60
|
+
],
|
|
61
|
+
["asc", "asc", "asc"]
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
return this.setState({
|
|
65
|
+
indicators: indicators
|
|
66
|
+
})
|
|
67
|
+
}).fail((xhr: any) => {
|
|
68
|
+
return this.setState({ error: xhr.responseText })
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
handleTableRemove = (table: any) => {
|
|
73
|
+
if (
|
|
74
|
+
confirm(
|
|
75
|
+
T`Remove ${ExprUtils.localizeString(
|
|
76
|
+
table.name,
|
|
77
|
+
T.locale
|
|
78
|
+
)}? Any widgets that depend on it will no longer work properly.`
|
|
79
|
+
)
|
|
80
|
+
) {
|
|
81
|
+
return this.props.onExtraTableRemove(table.id)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
searchRef = (comp: any) => {
|
|
86
|
+
// Focus
|
|
87
|
+
if (comp) {
|
|
88
|
+
return comp.focus()
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
handleSelect = (tableId: any) => {
|
|
93
|
+
// Add table if not present
|
|
94
|
+
if (!this.props.schema.getTable(tableId)) {
|
|
95
|
+
this.props.onExtraTableAdd(tableId)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
this.addIndicatorConfirmPopup!.show(tableId)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
handleOpenIndicator = (id: string) => {
|
|
102
|
+
this.handleSelect("indicator_values:" + id)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Render a simplified version of IndicatorListComponent from mwater-portal
|
|
106
|
+
renderIndicatorList(indicators: any[], searchText: string) {
|
|
107
|
+
// Filter indicators based on search text
|
|
108
|
+
let filteredIndicators = indicators
|
|
109
|
+
if (searchText) {
|
|
110
|
+
const searchTerms = searchText.toLowerCase().split(" ")
|
|
111
|
+
filteredIndicators = indicators.filter(indicator => {
|
|
112
|
+
const searchFields = [
|
|
113
|
+
ExprUtils.localizeString(indicator.design.name, T.locale),
|
|
114
|
+
indicator.design.code,
|
|
115
|
+
indicator.design.organization,
|
|
116
|
+
indicator.design.category,
|
|
117
|
+
indicator.design.subcategory
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
return searchTerms.every(term =>
|
|
121
|
+
searchFields.some(field =>
|
|
122
|
+
field && field.toLowerCase().includes(term)
|
|
123
|
+
)
|
|
124
|
+
)
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Split into recommended and all indicators
|
|
129
|
+
const recommendedIndicators = filteredIndicators.filter(indicator => indicator.design.recommended)
|
|
130
|
+
const otherIndicators = filteredIndicators.filter(indicator => !indicator.design.recommended)
|
|
131
|
+
|
|
132
|
+
// Group by category
|
|
133
|
+
const groupByCategory = (indicators: any[]) => {
|
|
134
|
+
const categories: Record<string, any[]> = {}
|
|
135
|
+
|
|
136
|
+
indicators.forEach(indicator => {
|
|
137
|
+
const category = indicator.design.category || T`Uncategorized`
|
|
138
|
+
if (!categories[category]) {
|
|
139
|
+
categories[category] = []
|
|
140
|
+
}
|
|
141
|
+
categories[category].push(indicator)
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
return categories
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const recommendedByCategory = groupByCategory(recommendedIndicators)
|
|
148
|
+
const otherByCategory = groupByCategory(otherIndicators)
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<div>
|
|
152
|
+
{recommendedIndicators.length > 0 && (
|
|
153
|
+
<div>
|
|
154
|
+
<h4>{T`Recommended Indicators`}</h4>
|
|
155
|
+
{_.map(recommendedByCategory, (categoryIndicators, category) => (
|
|
156
|
+
<div key={category}>
|
|
157
|
+
<h5>{category}</h5>
|
|
158
|
+
<table className="table table-hover">
|
|
159
|
+
<tbody>
|
|
160
|
+
{_.map(categoryIndicators, indicator => (
|
|
161
|
+
<tr key={indicator._id} onClick={() => this.handleOpenIndicator(indicator._id)}>
|
|
162
|
+
<td>
|
|
163
|
+
<IndicatorListItemComponent
|
|
164
|
+
indicator={indicator}
|
|
165
|
+
onClick={() => this.handleOpenIndicator(indicator._id)}
|
|
166
|
+
/>
|
|
167
|
+
</td>
|
|
168
|
+
</tr>
|
|
169
|
+
))}
|
|
170
|
+
</tbody>
|
|
171
|
+
</table>
|
|
172
|
+
</div>
|
|
173
|
+
))}
|
|
174
|
+
</div>
|
|
175
|
+
)}
|
|
176
|
+
|
|
177
|
+
<h4>{T`All Indicators`}</h4>
|
|
178
|
+
{_.map(otherByCategory, (categoryIndicators, category) => (
|
|
179
|
+
<div key={category}>
|
|
180
|
+
<h5>{category}</h5>
|
|
181
|
+
<table className="table table-hover">
|
|
182
|
+
<tbody>
|
|
183
|
+
{_.map(categoryIndicators, indicator => (
|
|
184
|
+
<tr key={indicator._id} onClick={() => this.handleOpenIndicator(indicator._id)}>
|
|
185
|
+
<td>
|
|
186
|
+
<IndicatorListItemComponent
|
|
187
|
+
indicator={indicator}
|
|
188
|
+
onClick={() => this.handleOpenIndicator(indicator._id)}
|
|
189
|
+
/>
|
|
190
|
+
</td>
|
|
191
|
+
</tr>
|
|
192
|
+
))}
|
|
193
|
+
</tbody>
|
|
194
|
+
</table>
|
|
195
|
+
</div>
|
|
196
|
+
))}
|
|
197
|
+
</div>
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
render() {
|
|
202
|
+
if (this.state.error) {
|
|
203
|
+
return <div className="alert alert-danger">{this.state.error}</div>
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
let tables = _.filter(
|
|
207
|
+
this.props.schema.getTables(),
|
|
208
|
+
(table) => table.id.match(/^indicator_values:/) && !table.deprecated
|
|
209
|
+
)
|
|
210
|
+
tables = _.sortBy(tables, (t) => t.name.en)
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<div>
|
|
214
|
+
<AddIndicatorConfirmPopupComponent
|
|
215
|
+
schema={this.props.schema}
|
|
216
|
+
onChange={this.props.onChange}
|
|
217
|
+
onExtraTableAdd={this.props.onExtraTableAdd}
|
|
218
|
+
ref={(c: AddIndicatorConfirmPopupComponent | null) => {
|
|
219
|
+
this.addIndicatorConfirmPopup = c
|
|
220
|
+
}}
|
|
221
|
+
/>
|
|
222
|
+
|
|
223
|
+
<label>{T`Included Indicators:`}</label>
|
|
224
|
+
{tables.length > 0 ? (
|
|
225
|
+
<uiComponents.OptionListComponent
|
|
226
|
+
items={_.map(tables, (table) => ({
|
|
227
|
+
name: ExprUtils.localizeString(table.name, T.locale),
|
|
228
|
+
desc: ExprUtils.localizeString(table.desc, T.locale),
|
|
229
|
+
onClick: () => this.handleSelect(table.id),
|
|
230
|
+
onRemove: () => this.handleTableRemove(table)
|
|
231
|
+
}))}
|
|
232
|
+
/>
|
|
233
|
+
) : (
|
|
234
|
+
<div>{T`None`}</div>
|
|
235
|
+
)}
|
|
236
|
+
|
|
237
|
+
<br />
|
|
238
|
+
|
|
239
|
+
<label>{T`All Indicators:`}</label>
|
|
240
|
+
{!this.state.indicators || this.state.indicators.length === 0 ? (
|
|
241
|
+
<div className="alert alert-info">
|
|
242
|
+
<i className="fa fa-spinner fa-spin" />
|
|
243
|
+
{"\u00A0" + T`Loading...`}
|
|
244
|
+
</div>
|
|
245
|
+
) : (
|
|
246
|
+
<>
|
|
247
|
+
<input
|
|
248
|
+
type="text"
|
|
249
|
+
className="form-control form-control-sm"
|
|
250
|
+
placeholder={T`Search...`}
|
|
251
|
+
key="search"
|
|
252
|
+
ref={this.searchRef}
|
|
253
|
+
style={{ maxWidth: "20em", marginBottom: 10 }}
|
|
254
|
+
value={this.state.search}
|
|
255
|
+
onChange={(ev: any) => this.setState({ search: ev.target.value })}
|
|
256
|
+
/>
|
|
257
|
+
|
|
258
|
+
{this.renderIndicatorList(this.state.indicators, this.state.search)}
|
|
259
|
+
</>
|
|
260
|
+
)}
|
|
261
|
+
</div>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
interface AddIndicatorConfirmPopupComponentProps {
|
|
268
|
+
schema: Schema
|
|
269
|
+
/** Called with table selected */
|
|
270
|
+
onChange: any
|
|
271
|
+
onExtraTableAdd: any
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
interface AddIndicatorConfirmPopupComponentState {
|
|
275
|
+
indicatorTable: any
|
|
276
|
+
visible: any
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
class AddIndicatorConfirmPopupComponent extends React.Component<
|
|
280
|
+
AddIndicatorConfirmPopupComponentProps,
|
|
281
|
+
AddIndicatorConfirmPopupComponentState
|
|
282
|
+
> {
|
|
283
|
+
constructor(props: any) {
|
|
284
|
+
super(props)
|
|
285
|
+
this.state = {
|
|
286
|
+
visible: false,
|
|
287
|
+
indicatorTable: null
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
show(indicatorTable: any) {
|
|
292
|
+
return this.setState({ visible: true, indicatorTable })
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
renderContents() {
|
|
296
|
+
// Show loading if table not loaded
|
|
297
|
+
if (!this.props.schema.getTable(this.state.indicatorTable)) {
|
|
298
|
+
return (
|
|
299
|
+
<div className="alert alert-info">
|
|
300
|
+
<i className="fa fa-spinner fa-spin" />
|
|
301
|
+
{T`Loading...`}
|
|
302
|
+
</div>
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Find entity links
|
|
307
|
+
const entityColumns = _.filter(this.props.schema.getColumns(this.state.indicatorTable), (col) =>
|
|
308
|
+
col.join?.toTable?.match(/^entities\./)
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
return (
|
|
312
|
+
<div>
|
|
313
|
+
<p>
|
|
314
|
+
{T`In general, it is better to get indicator values from the related site. Please select the site
|
|
315
|
+
below, then find the indicator values in the 'Related Indicators' section. Or click on 'Use Raw Indicator' if you
|
|
316
|
+
are certain that you want to use the raw indicator table`}
|
|
317
|
+
</p>
|
|
318
|
+
|
|
319
|
+
<uiComponents.OptionListComponent
|
|
320
|
+
items={_.map(entityColumns, (entityColumn) => ({
|
|
321
|
+
name: ExprUtils.localizeString(entityColumn.name, T.locale),
|
|
322
|
+
desc: ExprUtils.localizeString(entityColumn.desc, T.locale),
|
|
323
|
+
onClick: () => {
|
|
324
|
+
// Select table
|
|
325
|
+
this.props.onChange(entityColumn.join!.toTable)
|
|
326
|
+
return this.setState({ visible: false })
|
|
327
|
+
}
|
|
328
|
+
}))}
|
|
329
|
+
/>
|
|
330
|
+
|
|
331
|
+
<br />
|
|
332
|
+
|
|
333
|
+
<div>
|
|
334
|
+
<a className="link-plain" onClick={this.props.onChange.bind(null, this.state.indicatorTable)}>
|
|
335
|
+
{T`Use Raw Indicator`}
|
|
336
|
+
</a>
|
|
337
|
+
</div>
|
|
338
|
+
</div>
|
|
339
|
+
)
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
render() {
|
|
343
|
+
if (!this.state.visible) {
|
|
344
|
+
return null
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return (
|
|
348
|
+
<ModalPopupComponent
|
|
349
|
+
showCloseX={true}
|
|
350
|
+
onClose={() => this.setState({ visible: false })}
|
|
351
|
+
header={T`Add Indicator`}
|
|
352
|
+
>
|
|
353
|
+
{this.renderContents()}
|
|
354
|
+
</ModalPopupComponent>
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// Single indicator item in a list
|
|
360
|
+
// Local port of the class found in mwater-portal
|
|
361
|
+
class IndicatorListItemComponent extends React.Component<{
|
|
362
|
+
indicator: any
|
|
363
|
+
onClick: any
|
|
364
|
+
}> {
|
|
365
|
+
|
|
366
|
+
renderIcon() {
|
|
367
|
+
switch (this.props.indicator.type) {
|
|
368
|
+
case "expression":
|
|
369
|
+
// R 'i', className: "text-muted fa fa-fw fa-calculator"
|
|
370
|
+
return null
|
|
371
|
+
case "response":
|
|
372
|
+
// R 'i', className: "text-muted fa fa-fw fa-list-alt"
|
|
373
|
+
return null
|
|
374
|
+
case "set":
|
|
375
|
+
return (
|
|
376
|
+
<span className="fa-stack" style={{ paddingRight: 6 }}>
|
|
377
|
+
<i className="fa fa-th-list fa-stack-1x text-muted" />
|
|
378
|
+
<i className="fa fa-circle fa-stack-1x" style={{ color: "white", paddingLeft: 15 }} />
|
|
379
|
+
<i className="fa fa-check-circle fa-stack-1x text-primary" style={{ paddingLeft: 15 }} />
|
|
380
|
+
</span>
|
|
381
|
+
)
|
|
382
|
+
}
|
|
383
|
+
return null
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
render() {
|
|
387
|
+
return (
|
|
388
|
+
<div onClick={this.props.onClick} style={{ cursor: "pointer" }}>
|
|
389
|
+
<div key="name" style={{ fontWeight: "bold" }}>
|
|
390
|
+
{this.renderIcon()}
|
|
391
|
+
{ExprUtils.localizeString(this.props.indicator.design.name, T.locale)}
|
|
392
|
+
{this.props.indicator.design.code ? ` (${this.props.indicator.design.code})` : undefined}
|
|
393
|
+
{this.props.indicator.design.organization ? (
|
|
394
|
+
<span className="text-muted"> {T`by ${this.props.indicator.design.organization}`}</span>
|
|
395
|
+
) : undefined}
|
|
396
|
+
</div>
|
|
397
|
+
|
|
398
|
+
<div key="desc" className="text-muted">
|
|
399
|
+
{ExprUtils.localizeString(this.props.indicator.design.desc, T.locale)}
|
|
400
|
+
{this.props.indicator.design.category
|
|
401
|
+
? [
|
|
402
|
+
` (${this.props.indicator.design.category}`,
|
|
403
|
+
this.props.indicator.design.subcategory ? `/${this.props.indicator.design.subcategory}` : undefined,
|
|
404
|
+
`)`
|
|
405
|
+
]
|
|
406
|
+
: undefined}
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
)
|
|
410
|
+
}
|
|
411
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import _ from "lodash"
|
|
2
|
+
import $ from "jquery"
|
|
3
|
+
import React from "react"
|
|
4
|
+
import querystring from "querystring"
|
|
5
|
+
import * as uiComponents from "../UIComponents"
|
|
6
|
+
import { ExprUtils, Schema } from "@mwater/expressions"
|
|
7
|
+
|
|
8
|
+
interface IssuesListComponentProps {
|
|
9
|
+
/** Url to hit api */
|
|
10
|
+
apiUrl: string
|
|
11
|
+
/** Optional client */
|
|
12
|
+
client?: string
|
|
13
|
+
schema: Schema
|
|
14
|
+
/** User id */
|
|
15
|
+
user?: string
|
|
16
|
+
/** Called with table selected */
|
|
17
|
+
onChange: any
|
|
18
|
+
extraTables: any
|
|
19
|
+
onExtraTableAdd: any
|
|
20
|
+
onExtraTableRemove: any
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface IssuesListComponentState {
|
|
24
|
+
error?: any
|
|
25
|
+
search: any
|
|
26
|
+
issueTypes: any[] | null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Searchable list of issue types
|
|
30
|
+
export class IssuesListComponent extends React.Component<IssuesListComponentProps, IssuesListComponentState> {
|
|
31
|
+
constructor(props: any) {
|
|
32
|
+
super(props)
|
|
33
|
+
this.state = {
|
|
34
|
+
issueTypes: null,
|
|
35
|
+
search: ""
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
componentDidMount() {
|
|
40
|
+
// Get names and basic of issueTypes
|
|
41
|
+
const query: any = {}
|
|
42
|
+
query.fields = JSON.stringify({ name: 1, desc: 1, roles: 1, created: 1, modified: 1 })
|
|
43
|
+
query.client = this.props.client
|
|
44
|
+
|
|
45
|
+
// Get list of all issueType names
|
|
46
|
+
return $.getJSON(this.props.apiUrl + "issue_types?" + querystring.stringify(query), (issueTypes: any[]) => {
|
|
47
|
+
// Sort by modified.on desc but first by user
|
|
48
|
+
issueTypes = _.sortByOrder(
|
|
49
|
+
issueTypes,
|
|
50
|
+
[
|
|
51
|
+
(issueType) => ((this.props.extraTables || []).includes("issues:" + issueType._id) ? 0 : 1),
|
|
52
|
+
(issueType) => (issueType.created.by === this.props.user ? 0 : 1),
|
|
53
|
+
(issueType) => ExprUtils.localizeString(issueType.name, T.locale)
|
|
54
|
+
],
|
|
55
|
+
["asc", "asc", "asc"]
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
return this.setState({
|
|
59
|
+
issueTypes: _.map(issueTypes, (issueType) => ({
|
|
60
|
+
id: issueType._id,
|
|
61
|
+
name: ExprUtils.localizeString(issueType.name, T.locale),
|
|
62
|
+
desc: ExprUtils.localizeString(issueType.desc, T.locale)
|
|
63
|
+
}))
|
|
64
|
+
})
|
|
65
|
+
}).fail((xhr: any) => {
|
|
66
|
+
return this.setState({ error: xhr.responseText })
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
handleTableRemove = (table: any) => {
|
|
71
|
+
if (
|
|
72
|
+
confirm(
|
|
73
|
+
T`Remove ${ExprUtils.localizeString(
|
|
74
|
+
table.name,
|
|
75
|
+
T.locale
|
|
76
|
+
)}? Any widgets that depend on it will no longer work properly.`
|
|
77
|
+
)
|
|
78
|
+
) {
|
|
79
|
+
return this.props.onExtraTableRemove(table.id)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
searchRef = (comp: any) => {
|
|
84
|
+
// Focus
|
|
85
|
+
if (comp) {
|
|
86
|
+
return comp.focus()
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
render() {
|
|
91
|
+
let issueTypes
|
|
92
|
+
if (this.state.error) {
|
|
93
|
+
return <div className="alert alert-danger">{this.state.error}</div>
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Filter issueTypes
|
|
97
|
+
if (this.state.search) {
|
|
98
|
+
const escapeRegExp = (s: any) => s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")
|
|
99
|
+
|
|
100
|
+
const searchStringRegExp = new RegExp(escapeRegExp(this.state.search), "i")
|
|
101
|
+
|
|
102
|
+
issueTypes = _.filter(this.state.issueTypes || [], (issueType) => issueType.name.match(searchStringRegExp))
|
|
103
|
+
} else {
|
|
104
|
+
;({ issueTypes } = this.state)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Remove if already included
|
|
108
|
+
issueTypes = _.filter(issueTypes || [], (f) => !(this.props.extraTables || []).includes(`issues:${f.id}`))
|
|
109
|
+
|
|
110
|
+
let tables = _.filter(
|
|
111
|
+
this.props.schema.getTables(),
|
|
112
|
+
(table) => (table.id.match(/^issues:/) || table.id.match(/^issue_events:/)) && !table.deprecated
|
|
113
|
+
)
|
|
114
|
+
tables = _.sortBy(tables, (t) => t.name.en)
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<div>
|
|
118
|
+
<label>{T`Included Issues:`}</label>
|
|
119
|
+
{tables.length > 0 ? (
|
|
120
|
+
<uiComponents.OptionListComponent
|
|
121
|
+
items={_.map(tables, (table) => {
|
|
122
|
+
return {
|
|
123
|
+
name: ExprUtils.localizeString(table.name, T.locale),
|
|
124
|
+
desc: ExprUtils.localizeString(table.desc, T.locale),
|
|
125
|
+
onClick: this.props.onChange.bind(null, table.id),
|
|
126
|
+
onRemove: this.handleTableRemove.bind(null, table)
|
|
127
|
+
}
|
|
128
|
+
})}
|
|
129
|
+
/>
|
|
130
|
+
) : (
|
|
131
|
+
<div>{T`None`}</div>
|
|
132
|
+
)}
|
|
133
|
+
|
|
134
|
+
<br />
|
|
135
|
+
|
|
136
|
+
<label>{T`All Issues:`}</label>
|
|
137
|
+
{!this.state.issueTypes || this.state.issueTypes.length === 0 ? (
|
|
138
|
+
<div className="alert alert-info">
|
|
139
|
+
<i className="fa fa-spinner fa-spin" />
|
|
140
|
+
{T`Loading...`}
|
|
141
|
+
</div>
|
|
142
|
+
) : (
|
|
143
|
+
<>
|
|
144
|
+
<input
|
|
145
|
+
type="text"
|
|
146
|
+
className="form-control form-control-sm"
|
|
147
|
+
placeholder={T`Search...`}
|
|
148
|
+
key="search"
|
|
149
|
+
ref={this.searchRef}
|
|
150
|
+
style={{ maxWidth: "20em", marginBottom: 10 }}
|
|
151
|
+
value={this.state.search}
|
|
152
|
+
onChange={(ev: any) => this.setState({ search: ev.target.value })}
|
|
153
|
+
/>
|
|
154
|
+
|
|
155
|
+
<uiComponents.OptionListComponent
|
|
156
|
+
items={_.map(issueTypes, (issueType) => ({
|
|
157
|
+
name: issueType.name,
|
|
158
|
+
desc: issueType.desc,
|
|
159
|
+
onClick: this.props.onChange.bind(null, "issues:" + issueType.id)
|
|
160
|
+
}))}
|
|
161
|
+
/>
|
|
162
|
+
</>
|
|
163
|
+
)}
|
|
164
|
+
</div>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
}
|