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

Introducing transforms #16

Merged
merged 103 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
e949468
Reduce duplicate code in Rollup Pages (#167)
jayeshathila Apr 13, 2021
067f348
Initial commit to introduce transforms
thalurur Apr 20, 2021
eac5e44
Adding transform models and client service
thalurur Apr 20, 2021
96c3d03
Adding changes to get transform page
thalurur Apr 21, 2021
897c73f
Initial draft commit for CreateTransform UI
lobdelle Apr 27, 2021
7bd315b
adding transform service routes and backend connection
thalurur Apr 27, 2021
568c139
Update step2 title
Apr 27, 2021
479c332
Add DefineTransform component panel
Apr 27, 2021
71bb636
Add full screen button
Apr 27, 2021
f941b1e
Adding working GetTransform page
thalurur Apr 28, 2021
ccdf228
Adding edit/details pages for transforms
thalurur Apr 29, 2021
a6ea779
Add text
Apr 29, 2021
2b63449
Pass sourceIndex as string to step2
Apr 29, 2021
fedddb4
Initial draft commit for CreateTransform UI
lobdelle Apr 27, 2021
3820a54
Add dependency to rollupService to get mappings
Apr 29, 2021
42ace95
Added execution interval to Schedule page
lobdelle Apr 29, 2021
bc53c2d
Merge remote-tracking branch 'eric/transforms-create' into transform-…
Apr 29, 2021
1ce781d
Data grid showing up with empty data
Apr 29, 2021
9664bf6
Update DefineTransforms.tsx
Apr 29, 2021
7f0111d
Able to show fields on step 2
Apr 29, 2021
e00a1ea
Update CreateTransformStep2.tsx
Apr 29, 2021
7ca3e40
Add pagination
Apr 29, 2021
621582a
Attempt to search sample data
Apr 30, 2021
a7e78bc
Update DefineTransforms.tsx
Apr 30, 2021
8f6eb8a
Update DefineTransforms.tsx
Apr 30, 2021
769e2fe
Update DefineTransforms.tsx
Apr 30, 2021
95daa89
Getting search response
Apr 30, 2021
6725203
Showing correct total number
Apr 30, 2021
81462cd
Able to reach data at certain field, but still need to finish render …
Apr 30, 2021
4757865
Able to show first 10 data
May 1, 2021
6fd8f5d
Update renderCellValue
May 1, 2021
16fefd3
Add popover options
May 2, 2021
e374f19
Able to create transform with group by histogram
May 2, 2021
1aa12cd
Able to create transform job with group by date histogram
May 3, 2021
e569287
Get Transforms Page, Edit Transform page, Transform Details page (#168)
thalurur May 3, 2021
c6fdeab
Enabling github workflows for develpoment branches
thalurur May 3, 2021
21f965e
Flip date histogram and terms object
May 3, 2021
ec9cf23
Able to add aggregations
May 3, 2021
8efbcb0
Merge changes related to define transform
May 3, 2021
b862436
Merging changes related to Create Transforms, Added incomplete Source…
lobdelle May 4, 2021
95d0850
Show only 5 columns initially
May 4, 2021
df88372
Remove debug logs
May 4, 2021
cf1a1ce
Hide unused toolbar options
May 4, 2021
5dac71b
Replace parent element of createTransform from form to div
May 4, 2021
701f821
Modify create transform to avoid sending request early
May 4, 2021
1d2f4d1
Merge branch 'development-transform' into transform-create-step2
May 4, 2021
9805fcf
Add data filter component draft
May 4, 2021
9637425
Hide add data filter
May 4, 2021
a9afa33
Merge branch 'development-transform' into transform-create-step2
May 4, 2021
1d2e970
Show keyword fields
May 4, 2021
130161c
Update Group selection and aggregation title
May 4, 2021
7c10d60
Update DefineTransforms.tsx
May 4, 2021
7b1e104
Added group and aggregation to display on create transform review page
lobdelle May 4, 2021
67a6dfd
Showing keyword field preview on step 2 of create
May 4, 2021
05ab2a2
Added Specify schedule Review panel
lobdelle May 6, 2021
b246f29
Add source index filter
May 6, 2021
c6c9585
Merge branch 'development-transform' into transform-create-step2
May 6, 2021
0b73e56
Completed basic implementation of Source Index Filter custom editor
lobdelle May 10, 2021
2cb2439
Merge branch 'development-transform' into transform-create-step2
May 11, 2021
e2b8668
Partially functioning preview API
May 11, 2021
7f11e50
Update empty state condition
May 11, 2021
a5c1261
Clean up previewColumns when updating
May 11, 2021
9dfc1f5
Update CreateTransformForm.tsx
May 11, 2021
b6069f9
Preview columns showing up
May 11, 2021
eaf6e06
Able to show preview
May 12, 2021
e4f32dd
Set maximum of sample data to 200
May 12, 2021
1d9fb25
Add pagination to preview
May 12, 2021
ed05b25
Add error toast to preview
May 12, 2021
62c1510
Add preview table
May 12, 2021
b70bfbe
Bug fix for aggregations
May 12, 2021
ed42aad
Merge branch 'transform-create-step2' into development-transform
May 12, 2021
ff06e28
Rearranged data fields on Transform details page, formatted Enable date
lobdelle May 12, 2021
356d2b1
Merge branch 'development-transform' of github.com:opendistro-for-ela…
lobdelle May 12, 2021
2a363a3
Decouple preview transform table from define transform
May 12, 2021
9de68eb
Added Indices section to Edit Transform page
lobdelle May 13, 2021
87c6e5f
Added display indices to Edit Transform page
lobdelle May 14, 2021
7c9114c
Showing preview table on details page
May 14, 2021
616bb19
Merge branch 'transform-detail-table' into development-transform
May 14, 2021
65ed41e
Support percentile on preview table
May 14, 2021
40f61a9
Update define transform options menu
May 14, 2021
f58272e
Remove scripted metrics menu
May 14, 2021
1288646
Modify button display, text, and number of data sample size
May 18, 2021
0272380
Refactored UX based on feedback and to better align with mockups. (#172)
AWSHurneyt May 19, 2021
ac6083e
Review aggregate and group on Create Transform now matches mock (#174)
lobdelle May 19, 2021
dc4b18f
Removed cron expression schedule option, reformatted popovers, and ch…
AWSHurneyt May 19, 2021
449089f
Support of deleting transform definition (#175)
annie3431 May 19, 2021
3753323
Tables on create transform review page (#176)
annie3431 May 19, 2021
1116ef9
Updated Pages per Execution helptext and spacing (#177)
lobdelle May 20, 2021
fde5db4
Refactored transform job status icons, and implemented error modal fo…
AWSHurneyt May 20, 2021
824ed48
Text modification and parse date fields on create step 2 (#179)
annie3431 May 20, 2021
d7e2b5d
Modify filter definition text from add to edit
May 20, 2021
2877ad8
Refactored padding around tables, wrapped job names in quotation mark…
AWSHurneyt May 21, 2021
693fb8b
Fixed change source index warning conditional and added padding (#180)
lobdelle May 21, 2021
4386652
Changed clear source index filter to empty string instead of curly br…
lobdelle May 21, 2021
c0738f2
Modify components on create transform step 2 (#183)
annie3431 May 21, 2021
ddaf57b
Modify paddings
May 21, 2021
32c0c59
Modify source filter help text
May 21, 2021
01f669b
Merge branch 'main' into development-transforms
May 22, 2021
566901e
Depending on OpenSearchDashboards
thalurur May 22, 2021
ffbb413
Code cleanup removing unused imports and props
lobdelle May 21, 2021
d1b67ff
Tweaks to details page, delete flow, aggregations in review create
lobdelle May 25, 2021
8dd131e
Correcting license and some imports
thalurur May 25, 2021
71a7401
Cleanup unused code
thalurur May 25, 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
1 change: 1 addition & 0 deletions .github/workflows/cypress-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- main
- development-*

jobs:
tests:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/unit-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- main
- development-*

jobs:
tests:
Expand Down
81 changes: 81 additions & 0 deletions models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ export interface DocumentRollup {
metadata: any;
}

export interface DocumentTransform {
_id: string;
_seqNo: number;
_primaryTerm: number;
transform: Transform;
metadata: any;
}

// TODO: Fill out when needed
// TODO: separate a frontend Policy from backendPolicy
export interface Policy {
Expand Down Expand Up @@ -136,6 +144,44 @@ export interface RollupMetadata {
};
}

export interface Transform {
description: string;
groups: RollupDimensionItem[];
enabled: boolean;
enabled_at: number | null;
updated_at: number;
metadata_id: string | null;
aggregations: Map<String, any>;
page_size: number;
schedule: IntervalSchedule | CronSchedule;
schema_version: number;
source_index: string;
target_index: string;
roles: String[];
data_selection_query: Map<String, any>;
}

export interface TransformMetadata {
metadata_id: string;
transform_metadata: {
id: string;
seq_no: number;
primary_term: number;
transform_id: string;
after_key: Map<string, any> | null;
last_updated_at: number;
status: string;
failure_reason: string | null;
stats: {
pages_processed: number | null;
documents_processed: number | null;
documents_indexed: number | null;
index_time_in_millis: number | null;
search_time_in_millis: number | null;
};
};
}

export interface IntervalSchedule {
interval: {
startTime: number | null;
Expand Down Expand Up @@ -215,3 +261,38 @@ export interface RollupMetricItem {
}
];
}

export type TransformGroupItem = DateHistogramItem | TermsItem | HistogramItem;

export enum GROUP_TYPES {
histogram = "histogram",
dateHistogram = "date_histogram",
terms = "terms",
}

export interface TransformAggItem {
type: TRANSFORM_AGG_TYPE;
name: string;
item: any | DateHistogramItem | TermsItem | HistogramItem;
percents?: number[];
sum?: { field: string };
max?: { field: string };
min?: { field: string };
avg?: { field: string };
value_count?: { field: string };
percentiles?: { field: string; percents: number[] };
scripted_metric?: object;
}

export enum TRANSFORM_AGG_TYPE {
sum = "sum",
max = "max",
min = "min",
avg = "avg",
value_count = "value_count",
percentiles = "percentiles",
scripted_metric = "scripted_metric",
terms = "terms",
histogram = "histogram",
date_histogram = "date_histogram",
}
5 changes: 3 additions & 2 deletions public/index_management_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { CoreStart, AppMountParameters } from "opensearch-dashboards/public";
import React from "react";
import ReactDOM from "react-dom";
import { HashRouter as Router, Route } from "react-router-dom";
import { IndexService, ManagedIndexService, PolicyService, RollupService, ServicesContext } from "./services";
import { IndexService, ManagedIndexService, PolicyService, RollupService, TransformService, ServicesContext } from "./services";
import { DarkModeContext } from "./components/DarkMode";
import Main from "./pages/Main";
import { CoreServicesContext } from "./components/core_services";
Expand All @@ -40,7 +40,8 @@ export function renderApp(coreStart: CoreStart, params: AppMountParameters) {
const managedIndexService = new ManagedIndexService(http);
const policyService = new PolicyService(http);
const rollupService = new RollupService(http);
const services = { indexService, managedIndexService, policyService, rollupService };
const transformService = new TransformService(http);
const services = { indexService, managedIndexService, policyService, rollupService, transformService };

const isDarkMode = coreStart.uiSettings.get("theme:darkMode") || false;

Expand Down
3 changes: 2 additions & 1 deletion public/models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
* permissions and limitations under the License.
*/

import { IndexService, ManagedIndexService, PolicyService, RollupService } from "../services";
import { IndexService, ManagedIndexService, PolicyService, RollupService, TransformService } from "../services";

export interface BrowserServices {
indexService: IndexService;
managedIndexService: ManagedIndexService;
policyService: PolicyService;
rollupService: RollupService;
transformService: TransformService;
}
182 changes: 182 additions & 0 deletions public/pages/Commons/BaseAggregationAndMetricSettings.tsx
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>
);
}
Loading