mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-52823] Migration of "components/admin_console/custom_url_schemes_setting.jsx" and tests to typescript (#23468)
This commit is contained in:
@@ -36,7 +36,7 @@ import ExternalLink from 'components/external_link';
|
||||
|
||||
import OpenIdConvert from './openid_convert';
|
||||
import Audits from './audits';
|
||||
import CustomURLSchemesSetting from './custom_url_schemes_setting.jsx';
|
||||
import CustomURLSchemesSetting from './custom_url_schemes_setting';
|
||||
import CustomEnableDisableGuestAccountsSetting from './custom_enable_disable_guest_accounts_setting';
|
||||
import LicenseSettings from './license_settings';
|
||||
import PermissionSchemesSettings from './permission_schemes_settings';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import React, {ChangeEvent, PureComponent} from 'react';
|
||||
|
||||
import * as Utils from 'utils/utils';
|
||||
import {t} from 'utils/i18n';
|
||||
@@ -11,7 +11,20 @@ import LocalizedInput from 'components/localized_input/localized_input';
|
||||
|
||||
import Setting from './setting';
|
||||
|
||||
export default class CustomURLSchemesSetting extends React.PureComponent {
|
||||
type Props = {
|
||||
id: string;
|
||||
value: string[];
|
||||
onChange: (id: string, valueAsArray: string[]) => void;
|
||||
disabled: boolean;
|
||||
setByEnv: boolean;
|
||||
}
|
||||
|
||||
type State = {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export default class CustomURLSchemesSetting extends
|
||||
PureComponent<Props, State> {
|
||||
static get propTypes() {
|
||||
return {
|
||||
id: PropTypes.string.isRequired,
|
||||
@@ -22,7 +35,7 @@ export default class CustomURLSchemesSetting extends React.PureComponent {
|
||||
};
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
@@ -30,15 +43,15 @@ export default class CustomURLSchemesSetting extends React.PureComponent {
|
||||
};
|
||||
}
|
||||
|
||||
stringToArray = (str) => {
|
||||
stringToArray = (str: string): string[] => {
|
||||
return str.split(',').map((s) => s.trim()).filter(Boolean);
|
||||
};
|
||||
|
||||
arrayToString = (arr) => {
|
||||
arrayToString = (arr: string[]): string => {
|
||||
return arr.join(',');
|
||||
};
|
||||
|
||||
handleChange = (e) => {
|
||||
handleChange = (e: ChangeEvent<HTMLInputElement>): void => {
|
||||
const valueAsArray = this.stringToArray(e.target.value);
|
||||
|
||||
this.props.onChange(this.props.id, valueAsArray);
|
||||
Reference in New Issue
Block a user