[MM-52839]: Migrate "components/admin_console/remove_file_setting.jsx" to Typescript (#23565)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0468e772a9
Коммит
e4982908d6
@@ -1,26 +1,27 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
import PropTypes from 'prop-types';
|
import React, {PureComponent, MouseEvent} from 'react';
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
import Setting from './setting';
|
import Setting, {Props as SettingsProps} from './setting';
|
||||||
|
|
||||||
export default class RemoveFileSetting extends Setting {
|
type Props = SettingsProps & {
|
||||||
static get propTypes() {
|
id: string;
|
||||||
return {
|
label: React.ReactNode;
|
||||||
id: PropTypes.string.isRequired,
|
helptext?: React.ReactNode;
|
||||||
label: PropTypes.node.isRequired,
|
removeButtonText: React.ReactNode;
|
||||||
helpText: PropTypes.node,
|
removingText?: React.ReactNode;
|
||||||
removeButtonText: PropTypes.node.isRequired,
|
fileName: string;
|
||||||
removingText: PropTypes.node,
|
onSubmit: (arg0: string, arg1: () => void) => void;
|
||||||
fileName: PropTypes.string.isRequired,
|
disabled?: boolean;
|
||||||
onSubmit: PropTypes.func.isRequired,
|
}
|
||||||
disabled: PropTypes.bool,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(props) {
|
type State = {
|
||||||
|
removing: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class RemoveFileSetting extends PureComponent<Props, State> {
|
||||||
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
@@ -28,7 +29,7 @@ export default class RemoveFileSetting extends Setting {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
handleRemove = (e) => {
|
handleRemove = (e: MouseEvent<HTMLButtonElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
this.setState({removing: true});
|
this.setState({removing: true});
|
||||||
@@ -52,7 +53,6 @@ export default class RemoveFileSetting extends Setting {
|
|||||||
type='button'
|
type='button'
|
||||||
className='btn btn-danger'
|
className='btn btn-danger'
|
||||||
onClick={this.handleRemove}
|
onClick={this.handleRemove}
|
||||||
ref={this.removeButtonRef}
|
|
||||||
disabled={this.props.disabled}
|
disabled={this.props.disabled}
|
||||||
>
|
>
|
||||||
{this.state.removing && (
|
{this.state.removing && (
|
||||||
@@ -25,7 +25,7 @@ import UserAutocompleteSetting from 'components/admin_console/user_autocomplete_
|
|||||||
import SettingsGroup from 'components/admin_console/settings_group.jsx';
|
import SettingsGroup from 'components/admin_console/settings_group.jsx';
|
||||||
import JobsTable from 'components/admin_console/jobs';
|
import JobsTable from 'components/admin_console/jobs';
|
||||||
import FileUploadSetting from 'components/admin_console/file_upload_setting.jsx';
|
import FileUploadSetting from 'components/admin_console/file_upload_setting.jsx';
|
||||||
import RemoveFileSetting from 'components/admin_console/remove_file_setting.jsx';
|
import RemoveFileSetting from 'components/admin_console/remove_file_setting';
|
||||||
import SchemaText from 'components/admin_console/schema_text';
|
import SchemaText from 'components/admin_console/schema_text';
|
||||||
import SaveButton from 'components/save_button';
|
import SaveButton from 'components/save_button';
|
||||||
import FormError from 'components/form_error';
|
import FormError from 'components/form_error';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React, {PureComponent} from 'react';
|
|||||||
|
|
||||||
import SetByEnv from './set_by_env';
|
import SetByEnv from './set_by_env';
|
||||||
|
|
||||||
type Props = {
|
export type Props = {
|
||||||
inputId?: string;
|
inputId?: string;
|
||||||
label: React.ReactNode;
|
label: React.ReactNode;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user