Skip to content

Commit

Permalink
Merge branch 'release/v5.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco (Valandur) committed Feb 23, 2019
2 parents d8e02f5 + 3a7d814 commit f6610b2
Show file tree
Hide file tree
Showing 65 changed files with 10,016 additions and 8,481 deletions.
10 changes: 10 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[main]
host = https://www.transifex.com

[adminpanel.main]
file_filter = src/locale/<lang>.json
minimum_perc = 0
source_file = src/locale/en.json
source_lang = en
type = KEYVALUEJSON

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-2018 Marco (Valandur)
Copyright (c) 2017-2019 Marco (Valandur)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9,077 changes: 5,169 additions & 3,908 deletions package-lock.json

Large diffs are not rendered by default.

103 changes: 51 additions & 52 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,71 +1,70 @@
{
"name": "webapi-admin-panel",
"version": "5.3.0",
"version": "5.4.0",
"homepage": ".",
"proxy": "http://localhost:8080/",
"devDependencies": {
"@types/chart.js": "2.7.27",
"@types/i18next": "8.4.3",
"@types/jest": "23.1.5",
"@types/jsoneditor": "5.5.2",
"@types/lodash": "4.14.111",
"@types/node": "10.5.2",
"@types/raven-for-redux": "1.1.0",
"@types/rc-slider": "8.2.3",
"@types/react": "16.4.6",
"@types/react-click-outside": "3.0.1",
"@types/react-dom": "16.0.6",
"@types/react-i18next": "7.6.1",
"@types/react-loadable": "5.4.0",
"@types/react-notification-system": "0.2.37",
"@types/react-redux": "6.0.4",
"@types/react-router": "4.0.28",
"@types/react-router-dom": "4.2.7",
"@types/react-router-redux": "5.0.15",
"@types/superagent": "3.8.2",
"file-loader": "1.1.11",
"gulp": "3.9.1",
"@types/chart.js": "2.7.45",
"@types/i18next": "12.1.0",
"@types/i18next-browser-languagedetector": "^2.0.2",
"@types/jest": "24.0.6",
"@types/jsoneditor": "5.19.0",
"@types/lodash": "4.14.121",
"@types/node": "11.9.4",
"@types/raven-for-redux": "1.1.1",
"@types/rc-slider": "8.6.2",
"@types/react": "16.8.3",
"@types/react-click-outside": "3.0.2",
"@types/react-dom": "16.8.2",
"@types/react-loadable": "5.5.0",
"@types/react-notification-system": "0.2.39",
"@types/react-redux": "7.0.1",
"@types/react-router": "4.4.4",
"@types/react-router-dom": "4.3.1",
"@types/superagent": "3.8.6",
"file-loader": "3.0.1",
"gulp": "4.0.0",
"gulp-concat": "2.6.1",
"gulp-sass": "4.0.1",
"typescript": "2.9.2"
"gulp-sass": "4.0.2",
"typescript": "3.3.3",
"typestrict": "^1.0.2"
},
"dependencies": {
"chart.js": "2.7.2",
"chart.js": "2.7.3",
"copy-to-clipboard": "3.0.8",
"history": "4.7.2",
"i18next": "11.3.6",
"i18next-browser-languagedetector": "2.2.0",
"jsoneditor": "5.18.0",
"konva": "2.1.7",
"lodash": "4.17.10",
"moment": "2.22.2",
"normalizr": "3.2.4",
"i18next": "15.0.4",
"i18next-browser-languagedetector": "3.0.1",
"jsoneditor": "5.29.0",
"konva": "2.6.0",
"lodash": "4.17.11",
"moment": "2.24.0",
"normalizr": "3.3.0",
"portable-fetch": "3.0.0",
"raven-for-redux": "1.3.1",
"raven-js": "3.26.3",
"rc-slider": "8.6.1",
"react": "16.4.1",
"raven-for-redux": "1.4.0",
"raven-js": "3.27.0",
"rc-slider": "8.6.5",
"react": "16.8.2",
"react-addons-css-transition-group": "15.6.2",
"react-addons-transition-group": "15.6.2",
"react-chartjs-2": "2.7.2",
"react-chartjs-2": "2.7.4",
"react-click-outside": "3.0.1",
"react-dom": "16.4.1",
"react-i18next": "7.8.0",
"react-konva": "1.7.9",
"react-loadable": "5.4.0",
"react-dom": "16.8.2",
"react-i18next": "10.1.2",
"react-konva": "16.8.2-0",
"react-loadable": "5.5.0",
"react-notification-system": "0.2.17",
"react-redux": "5.0.7",
"react-redux": "6.0.0",
"react-router-dom": "4.3.1",
"react-router-redux": "5.0.0-alpha.6",
"react-scripts-ts": "2.16.0",
"react-transition-group": "2.4.0",
"redux": "4.0.0",
"reselect": "3.0.1",
"semantic-ui-css": "2.3.3",
"semantic-ui-react": "0.82.0",
"source-map-explorer": "1.5.0",
"styled-components": "3.3.3",
"superagent": "3.8.3"
"react-scripts-ts": "3.1.0",
"react-transition-group": "2.5.3",
"redux": "4.0.1",
"reselect": "4.0.0",
"semantic-ui-css": "2.4.1",
"semantic-ui-react": "0.85.0",
"source-map-explorer": "1.7.0",
"styled-components": "4.1.3",
"superagent": "4.1.0"
},
"scripts": {
"start": "react-scripts-ts start",
Expand Down
25 changes: 19 additions & 6 deletions src/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { History } from 'history';
import { Action } from 'redux';
import { ResponseError } from 'superagent';

Expand Down Expand Up @@ -32,10 +33,12 @@ export enum TypeKeys {

export interface ServletsRequestAction extends Action {
type: TypeKeys.SERVLETS_REQUEST;
history: History;
}
export function requestServlets(): ServletsRequestAction {
export function requestServlets(history: History): ServletsRequestAction {
return {
type: TypeKeys.SERVLETS_REQUEST
type: TypeKeys.SERVLETS_REQUEST,
history
};
}

Expand Down Expand Up @@ -70,15 +73,18 @@ export function changeServer(server: Server): ChangeServerAction {

export interface LoginRequestAction extends Action {
type: TypeKeys.LOGIN_REQUEST;
history: History;
username: string;
password: string;
}
export function requestLogin(
history: History,
username: string,
password: string
): LoginRequestAction {
return {
type: TypeKeys.LOGIN_REQUEST,
history,
username,
password
};
Expand All @@ -102,10 +108,12 @@ export function respondLogin(

export interface LogoutRequestAction extends Action {
type: TypeKeys.LOGOUT_REQUEST;
history: History;
}
export function requestLogout(): LogoutRequestAction {
export function requestLogout(history: History): LogoutRequestAction {
return {
type: TypeKeys.LOGOUT_REQUEST
type: TypeKeys.LOGOUT_REQUEST,
history
};
}

Expand All @@ -115,24 +123,29 @@ export interface LogoutResponseAction extends Action {

export interface CheckUserRequestAction extends Action {
type: TypeKeys.CHECK_USER_REQUEST;
history: History;
}
export function requestCheckUser(): CheckUserRequestAction {
export function requestCheckUser(history: History): CheckUserRequestAction {
return {
type: TypeKeys.CHECK_USER_REQUEST
type: TypeKeys.CHECK_USER_REQUEST,
history
};
}

export interface CheckUserResponseAction extends Action {
type: TypeKeys.CHECK_USER_RESPONSE;
history: History;
ok: boolean;
data: PermissionStruct;
}
export function respondCheckUser(
history: History,
ok: boolean,
data: PermissionStruct
): CheckUserResponseAction {
return {
type: TypeKeys.CHECK_USER_RESPONSE,
history,
ok,
data
};
Expand Down
84 changes: 54 additions & 30 deletions src/components/Autosuggest/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ export interface AppProps {
name: string;
placeholder: string;
getSuggestions: (newValue: string) => Array<AutosuggestItem>;
onChange: (event: React.SyntheticEvent<HTMLElement>, newValue: AutosuggestChangeData) => void;
onChange: (
event: React.SyntheticEvent<HTMLElement>,
newValue: AutosuggestChangeData
) => void;
onKeyPress: (event: React.KeyboardEvent<HTMLInputElement>) => void;
}

Expand All @@ -18,79 +21,100 @@ interface AppState {
}

class Autosuggest extends React.Component<AppProps, AppState> {
private input: HTMLInputElement;

input: HTMLInputElement;

constructor(props: AppProps) {
public constructor(props: AppProps) {
super(props);

this.state = {
value: '',
suggestions: [],
suggestions: []
};
}

handleChange(event: React.ChangeEvent<HTMLInputElement>) {
private handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const newValue = event.target.value;

this.setState({
value: newValue,
suggestions: this.props.getSuggestions(newValue),
suggestions: this.props.getSuggestions(newValue)
});
this.props.onChange(event, {
id: this.props.id,
name: this.props.name,
value: newValue,
value: newValue
});
}
};

handleClick(event: React.MouseEvent<HTMLDivElement>, sugg: AutosuggestItem) {
this.setState({ value: sugg.value, suggestions: [] }, () => this.input.focus());
private handleClick(
event: React.MouseEvent<HTMLDivElement>,
sugg: AutosuggestItem
) {
this.setState({ value: sugg.value, suggestions: [] }, () =>
this.input.focus()
);

this.props.onChange(event, {
id: this.props.id,
name: this.props.name,
value: sugg.value,
value: sugg.value
});
}

handleFocus() {
private handleFocus = () => {
this.setState({
suggestions: this.props.getSuggestions(this.state.value),
suggestions: this.props.getSuggestions(this.state.value)
});
}
};

handleClickOutside() {
public handleClickOutside() {
this.setState({
suggestions: [],
suggestions: []
});
}

render() {
private setRef = (input: HTMLInputElement | null) => {
if (input !== null) {
this.input = input;
}
};

public render() {
return (
<div style={{ width: '100%', position: 'relative' }}>
<input
type="text"
placeholder={this.props.placeholder}
value={this.state.value}
style={{ width: '100%' }}
ref={input => { if (input !== null) { this.input = input; }}}
onFocus={() => this.handleFocus()}
onChange={e => this.handleChange(e)}
ref={this.setRef}
onFocus={this.handleFocus}
onChange={this.handleChange}
onKeyPress={this.props.onKeyPress}
/>
{ this.state.suggestions.length ?
<div className="autosuggest-list">
{this.state.suggestions.map((sugg, index) =>
<div key={index} onClick={event => this.handleClick(event, sugg)}>
{sugg.content}
</div>
)}
</div>
: null }
{this.renderSuggestions()}
</div>
);
}

private renderSuggestions() {
if (!this.state.suggestions.length) {
return null;
}

return (
<div className="autosuggest-list">{this.renderSuggestionItems()}</div>
);
}

private renderSuggestionItems() {
return this.state.suggestions.map((sugg, index) => (
// tslint:disable-next-line:jsx-no-lambda
<div key={index} onClick={event => this.handleClick(event, sugg)}>
{sugg.content}
</div>
));
}
}

export default enhanceWithClickOutside(Autosuggest);
Loading

0 comments on commit f6610b2

Please sign in to comment.