forked from opensearch-project/index-management
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introducing transforms (opensearch-project#16)
- Loading branch information
Showing
93 changed files
with
7,044 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ on: | |
push: | ||
branches: | ||
- main | ||
- development-* | ||
|
||
jobs: | ||
tests: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ on: | |
push: | ||
branches: | ||
- main | ||
- development-* | ||
|
||
jobs: | ||
tests: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
182 changes: 182 additions & 0 deletions
182
public/pages/Commons/BaseAggregationAndMetricSettings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
import React, { Fragment } from "react"; | ||
|
||
import { EuiFlexItem, EuiText, EuiBasicTable, EuiTableFieldDataColumnType, EuiPanel, EuiFlexGroup, EuiIcon } from "@elastic/eui"; | ||
|
||
import { DimensionItem, MetricItem } from "../../../models/interfaces"; | ||
|
||
export const AGGREGATION_AND_METRIC_SETTINGS = "Aggregation and metrics settings"; | ||
|
||
export interface BaseAggregationAndMetricsState { | ||
from: number; | ||
size: number; | ||
sortField: string; | ||
sortDirection: string; | ||
dimensionFrom: number; | ||
dimensionSize: number; | ||
dimensionSortField: string; | ||
dimensionSortDirection: string; | ||
} | ||
|
||
export const BaseAggregationColumns: Readonly<EuiTableFieldDataColumnType<DimensionItem>>[] = [ | ||
{ | ||
field: "sequence", | ||
name: "Sequence", | ||
sortable: true, | ||
align: "left", | ||
dataType: "number", | ||
}, | ||
{ | ||
field: "field.label", | ||
name: "Field name", | ||
align: "left", | ||
}, | ||
{ | ||
field: "aggregationMethod", | ||
name: "Aggregation method", | ||
align: "left", | ||
}, | ||
{ | ||
field: "interval", | ||
name: "Interval", | ||
dataType: "number", | ||
align: "left", | ||
render: (interval: null | number) => { | ||
if (interval == null) return "-"; | ||
else return `${interval}`; | ||
}, | ||
}, | ||
]; | ||
|
||
export const BaseMetricsColumns: Readonly<EuiTableFieldDataColumnType<MetricItem>>[] = [ | ||
{ | ||
field: "source_field", | ||
name: "Field Name", | ||
}, | ||
{ | ||
field: "min", | ||
name: "Min", | ||
align: "center", | ||
render: (min: boolean) => min && <EuiIcon type="check" />, | ||
}, | ||
{ | ||
field: "max", | ||
name: "Max", | ||
align: "center", | ||
render: (max: boolean) => max && <EuiIcon type="check" />, | ||
}, | ||
{ | ||
field: "sum", | ||
name: "Sum", | ||
align: "center", | ||
render: (sum: boolean) => sum && <EuiIcon type="check" />, | ||
}, | ||
{ | ||
field: "avg", | ||
name: "Avg", | ||
align: "center", | ||
render: (avg: boolean) => avg && <EuiIcon type="check" />, | ||
}, | ||
{ | ||
field: "value_count", | ||
name: "Value count", | ||
align: "center", | ||
render: (value_count: boolean) => value_count && <EuiIcon type="check" />, | ||
}, | ||
]; | ||
|
||
export function sequenceTableComponents(selectedDimensionField, items, columns, pagination, sorting, onChange) { | ||
if (selectedDimensionField.length == 0) { | ||
return ( | ||
<EuiText> | ||
<dd>No fields added for aggregation</dd> | ||
</EuiText> | ||
); | ||
} | ||
|
||
return ( | ||
<Fragment> | ||
<EuiPanel> | ||
<EuiBasicTable | ||
items={items} | ||
rowHeader="sequence" | ||
columns={columns} | ||
tableLayout="auto" | ||
noItemsMessage="No fields added for aggregations" | ||
pagination={pagination} | ||
sorting={sorting} | ||
onChange={onChange} | ||
/> | ||
</EuiPanel> | ||
</Fragment> | ||
); | ||
} | ||
|
||
export function additionalMetricsComponent(selectedMetrics) { | ||
return ( | ||
<EuiFlexGroup gutterSize="xs"> | ||
<EuiFlexItem grow={false}> | ||
<EuiText> | ||
<h3>Additional metrics</h3> | ||
</EuiText> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiText color="subdued" textAlign="left"> | ||
<h3>{`(${selectedMetrics.length})`}</h3> | ||
</EuiText> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
} | ||
|
||
export function sourceFieldComponents(selectedMetrics, items, columns, pagination, sorting, onChange) { | ||
if (selectedMetrics.length == 0) { | ||
return ( | ||
<EuiText> | ||
<dd>No fields added for metrics</dd> | ||
</EuiText> | ||
); | ||
} | ||
|
||
return ( | ||
<Fragment> | ||
<EuiPanel> | ||
<EuiBasicTable | ||
items={items} | ||
rowHeader="source_field" | ||
columns={columns} | ||
tableLayout="auto" | ||
pagination={pagination} | ||
sorting={sorting} | ||
onChange={onChange} | ||
noItemsMessage="No fields added for metrics" | ||
/> | ||
</EuiPanel> | ||
</Fragment> | ||
); | ||
} |
Oops, something went wrong.