Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
117 changes: 117 additions & 0 deletions web-console/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions web-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
"ts-jest": "^23.10.5",
"ts-loader": "^5.3.3",
"ts-node": "^8.0.2",
"tslint": "^5.14.0",
"tslint-loader": "^3.5.4",
"tslint-react": "^3.6.0",
"typescript": "^3.2.4",
"webpack": "^4.29.0",
"webpack-cli": "^3.2.1",
Expand Down
41 changes: 34 additions & 7 deletions web-console/script/create-sql-function-doc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,35 @@ writefile='lib/sql-function-doc.ts'

> "$writefile"

echo -e "// This file is auto generated and should not be modified\n" > "$writefile"
echo -e 'export const SQLFunctionDoc: any[] = [' >> "$writefile"
cat > "$writefile" <<- EOM
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*/

// This file is auto generated and should not be modified

export interface FunctionDescription {
syntax: string;
description: string;
}

/* tslint:disable */
export const SQLFunctionDoc: FunctionDescription[] = [
EOM

isFunction=false

Expand All @@ -39,12 +66,12 @@ while read -r line; do
description=$(echo $line | grep -o '`|.*.|')
description=${description//\"/\'}
description=${description:2:${#description}-4}
echo -e " {" >> "$writefile"
echo -e " syntax: \"$syntax\"," >> "$writefile"
echo -e " description: \"$description\"" >> "$writefile"
echo -e " }," >> "$writefile"
echo -e " {" >> "$writefile"
echo -e " syntax: \"$syntax\"," >> "$writefile"
echo -e " description: \"$description\"" >> "$writefile"
echo -e " }," >> "$writefile"
fi
fi
done < "$readfile"

echo -e ']' >> "$writefile"
echo -e '];' >> "$writefile"
25 changes: 25 additions & 0 deletions web-console/src/bootstrap/a-shim-for-react-props.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*/

// Trick blueprint 1.0.1 into accepting React 16 as React 15.
// This is broken into its own file to make linting and import sorting easy
// This file "a" to make sure it is imported before console-application in entry.ts

// tslint:disable
import * as React from 'react';
(React as any).PropTypes = require('prop-types');
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
* limitations under the License.
*/


import { Button } from "@blueprintjs/core";
import * as React from 'react';
import { Filter, ReactTableDefaults } from "react-table";
import { Button } from "@blueprintjs/core";

import { Loader } from '../components/loader';
import { countBy, makeTextFilter } from '../utils';

Expand Down
19 changes: 9 additions & 10 deletions web-console/src/components/auto-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
* limitations under the License.
*/

import { resolveSrv } from 'dns';
import * as React from 'react';
import axios from 'axios';
import { InputGroup } from "@blueprintjs/core";
import { HTMLSelect, FormGroup, NumericInput, TagInput } from "../components/filler";
import * as React from 'react';

import { FormGroup, HTMLSelect, NumericInput, TagInput } from "../components/filler";

interface Field {
name: string;
Expand All @@ -31,8 +30,8 @@ interface Field {

export interface AutoFormProps<T> extends React.Props<any> {
fields: Field[];
model: T | null,
onChange: (newValue: T) => void
model: T | null;
onChange: (newValue: T) => void;
}

export interface AutoFormState<T> {
Expand All @@ -48,7 +47,7 @@ export class AutoForm<T> extends React.Component<AutoFormProps<T>, AutoFormState
constructor(props: AutoFormProps<T>) {
super(props);
this.state = {
}
};
}

private renderNumberInput(field: Field): JSX.Element {
Expand Down Expand Up @@ -97,7 +96,7 @@ export class AutoForm<T> extends React.Component<AutoFormProps<T>, AutoFormState
>
<option value="True">True</option>
<option value="False">False</option>
</HTMLSelect>
</HTMLSelect>;
}

private renderStringArrayInput(field: Field): JSX.Element {
Expand Down Expand Up @@ -127,14 +126,14 @@ export class AutoForm<T> extends React.Component<AutoFormProps<T>, AutoFormState
const label = field.label || AutoForm.makeLabelName(field.name);
return <FormGroup label={label} key={field.name}>
{this.renderFieldInput(field)}
</FormGroup>
</FormGroup>;
}

render() {
const { fields, model } = this.props;

return <div className="auto-form">
{model && fields.map(field => this.renderField(field))}
</div>
</div>;
}
}
25 changes: 12 additions & 13 deletions web-console/src/components/filler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
*/

import { Button } from '@blueprintjs/core';
import * as React from 'react';
import classNames from 'classnames';
import './filler.scss';
import * as React from 'react';

import './filler.scss';

export const IconNames = {
ERROR: "error" as "error",
Expand Down Expand Up @@ -103,16 +103,15 @@ export class FormGroup extends React.Component<{ className?: string, label?: str
render() {
const { className, label, children } = this.props;
return <div className={classNames("form-group", className)}>
{ label ? <Label>{label}</Label> : null }
{label ? <Label>{label}</Label> : null}
{children}
</div>;
}
}


export const Alignment = {
LEFT: "left" as "left",
RIGHT: "right" as "right",
RIGHT: "right" as "right"
};
export type Alignment = typeof Alignment[keyof typeof Alignment];

Expand Down Expand Up @@ -166,28 +165,28 @@ export interface NumericInputProps {
min?: number;
max?: number;
stepSize?: number;
majorStepSize?: number
majorStepSize?: number;
}

export class NumericInput extends React.Component<NumericInputProps, { stringValue: string }> {

static defaultProps = {
stepSize: 1,
majorStepSize: 10
}
};

constructor(props: NumericInputProps) {
super(props);
this.state = {
stringValue: typeof props.value === 'number' ? String(props.value) : ''
}
};
}

private constrain(n: number): number {
const { min, max } = this.props;
if (typeof min === 'number') n = Math.max(n, min);
if (typeof max === 'number') n = Math.min(n, max);
return n
return n;
}

private handleChange = (e: any) => {
Expand Down Expand Up @@ -236,13 +235,13 @@ export class TagInput extends React.Component<TagInputProps, { stringValue: stri
super(props);
this.state = {
stringValue: Array.isArray(props.values) ? props.values.join(', ') : ''
}
};
}

handleChange = (e: any) => {
let stringValue = e.target.value;
let newValues = stringValue.split(',').map((v: string) => v.trim());
let newValuesFiltered = newValues.filter(Boolean);
const stringValue = e.target.value;
const newValues = stringValue.split(',').map((v: string) => v.trim());
const newValuesFiltered = newValues.filter(Boolean);
this.setState({
stringValue: newValues.length === newValuesFiltered.length ? newValues.join(', ') : stringValue
});
Expand Down
Loading