[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.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import React, {PureComponent, MouseEvent} from 'react';
|
||||
|
||||
import Setting from './setting';
|
||||
import Setting, {Props as SettingsProps} from './setting';
|
||||
|
||||
export default class RemoveFileSetting extends Setting {
|
||||
static get propTypes() {
|
||||
return {
|
||||
id: PropTypes.string.isRequired,
|
||||
label: PropTypes.node.isRequired,
|
||||
helpText: PropTypes.node,
|
||||
removeButtonText: PropTypes.node.isRequired,
|
||||
removingText: PropTypes.node,
|
||||
fileName: PropTypes.string.isRequired,
|
||||
onSubmit: PropTypes.func.isRequired,
|
||||
disabled: PropTypes.bool,
|
||||
};
|
||||
}
|
||||
type Props = SettingsProps & {
|
||||
id: string;
|
||||
label: React.ReactNode;
|
||||
helptext?: React.ReactNode;
|
||||
removeButtonText: React.ReactNode;
|
||||
removingText?: React.ReactNode;
|
||||
fileName: string;
|
||||
onSubmit: (arg0: string, arg1: () => void) => void;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
type State = {
|
||||
removing: boolean;
|
||||
}
|
||||
|
||||
export default class RemoveFileSetting extends PureComponent<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
@@ -28,7 +29,7 @@ export default class RemoveFileSetting extends Setting {
|
||||
};
|
||||
}
|
||||
|
||||
handleRemove = (e) => {
|
||||
handleRemove = (e: MouseEvent<HTMLButtonElement>) => {
|
||||
e.preventDefault();
|
||||
|
||||
this.setState({removing: true});
|
||||
@@ -52,7 +53,6 @@ export default class RemoveFileSetting extends Setting {
|
||||
type='button'
|
||||
className='btn btn-danger'
|
||||
onClick={this.handleRemove}
|
||||
ref={this.removeButtonRef}
|
||||
disabled={this.props.disabled}
|
||||
>
|
||||
{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 JobsTable from 'components/admin_console/jobs';
|
||||
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 SaveButton from 'components/save_button';
|
||||
import FormError from 'components/form_error';
|
||||
|
||||
@@ -5,7 +5,7 @@ import React, {PureComponent} from 'react';
|
||||
|
||||
import SetByEnv from './set_by_env';
|
||||
|
||||
type Props = {
|
||||
export type Props = {
|
||||
inputId?: string;
|
||||
label: React.ReactNode;
|
||||
children: React.ReactNode;
|
||||
|
||||
Ссылка в новой задаче
Block a user