mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +01:00
use reflow to migrate from flow to typescript
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { RemoveEntryOfTableButton, LabelWithHelpIcon } from "@scm-manager/ui-components";
|
||||
import React from 'react';
|
||||
import {
|
||||
RemoveEntryOfTableButton,
|
||||
LabelWithHelpIcon,
|
||||
} from '@scm-manager/ui-components';
|
||||
|
||||
type Props = {
|
||||
items: string[],
|
||||
label: string,
|
||||
removeLabel: string,
|
||||
onRemove: (string[], string) => void,
|
||||
disabled: boolean,
|
||||
helpText: string
|
||||
items: string[];
|
||||
label: string;
|
||||
removeLabel: string;
|
||||
onRemove: (p1: string[], p2: string) => void;
|
||||
disabled: boolean;
|
||||
helpText: string;
|
||||
};
|
||||
|
||||
class ArrayConfigTable extends React.Component<Props> {
|
||||
@@ -16,7 +18,7 @@ class ArrayConfigTable extends React.Component<Props> {
|
||||
const { label, disabled, removeLabel, items, helpText } = this.props;
|
||||
return (
|
||||
<div>
|
||||
<LabelWithHelpIcon label={label} helpText={helpText}/>
|
||||
<LabelWithHelpIcon label={label} helpText={helpText} />
|
||||
<table className="table is-hoverable is-fullwidth">
|
||||
<tbody>
|
||||
{items.map(item => {
|
||||
@@ -1,35 +0,0 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import ArrayConfigTable from "./ArrayConfigTable";
|
||||
|
||||
type Props = {
|
||||
proxyExcludes: string[],
|
||||
t: string => string,
|
||||
onChange: (boolean, any, string) => void,
|
||||
disabled: boolean
|
||||
};
|
||||
|
||||
type State = {};
|
||||
|
||||
class ProxyExcludesTable extends React.Component<Props, State> {
|
||||
render() {
|
||||
const { proxyExcludes, disabled, t } = this.props;
|
||||
return (
|
||||
<ArrayConfigTable
|
||||
items={proxyExcludes}
|
||||
label={t("proxy-settings.proxy-excludes")}
|
||||
removeLabel={t("proxy-settings.remove-proxy-exclude-button")}
|
||||
onRemove={this.removeEntry}
|
||||
disabled={disabled}
|
||||
helpText={t("help.proxyExcludesHelpText")}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
removeEntry = (newExcludes: string[]) => {
|
||||
this.props.onChange(true, newExcludes, "proxyExcludes");
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("config")(ProxyExcludesTable);
|
||||
@@ -0,0 +1,34 @@
|
||||
import React from 'react';
|
||||
import { translate } from 'react-i18next';
|
||||
import ArrayConfigTable from './ArrayConfigTable';
|
||||
|
||||
type Props = {
|
||||
proxyExcludes: string[];
|
||||
t: (p: string) => string;
|
||||
onChange: (p1: boolean, p2: any, p3: string) => void;
|
||||
disabled: boolean;
|
||||
};
|
||||
|
||||
type State = {};
|
||||
|
||||
class ProxyExcludesTable extends React.Component<Props, State> {
|
||||
render() {
|
||||
const { proxyExcludes, disabled, t } = this.props;
|
||||
return (
|
||||
<ArrayConfigTable
|
||||
items={proxyExcludes}
|
||||
label={t('proxy-settings.proxy-excludes')}
|
||||
removeLabel={t('proxy-settings.remove-proxy-exclude-button')}
|
||||
onRemove={this.removeEntry}
|
||||
disabled={disabled}
|
||||
helpText={t('help.proxyExcludesHelpText')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
removeEntry = (newExcludes: string[]) => {
|
||||
this.props.onChange(true, newExcludes, 'proxyExcludes');
|
||||
};
|
||||
}
|
||||
|
||||
export default translate('config')(ProxyExcludesTable);
|
||||
Reference in New Issue
Block a user