mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-52832] : Migrate "components/admin_console/cluster_table.jsx" to Typescript (#23471)
This commit is contained in:
parent
0e31ecbbe8
commit
abcfa8cce8
@ -1,46 +1,52 @@
|
|||||||
// 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, {CSSProperties} from 'react';
|
||||||
import React from 'react';
|
|
||||||
import {FormattedMessage} from 'react-intl';
|
import {FormattedMessage} from 'react-intl';
|
||||||
|
|
||||||
import * as Utils from 'utils/utils';
|
import * as Utils from 'utils/utils';
|
||||||
import statusGreen from 'images/status_green.png';
|
import statusGreen from 'images/status_green.png';
|
||||||
import statusYellow from 'images/status_yellow.png';
|
import statusYellow from 'images/status_yellow.png';
|
||||||
import ReloadIcon from 'components/widgets/icons/fa_reload_icon';
|
import ReloadIcon from 'components/widgets/icons/fa_reload_icon';
|
||||||
import WarningIcon from 'components/widgets/icons/fa_warning_icon';
|
import WarningIcon from 'components/widgets/icons/fa_warning_icon';
|
||||||
|
|
||||||
export default class ClusterTable extends React.PureComponent {
|
type Props = {
|
||||||
static propTypes = {
|
clusterInfos: Array<{
|
||||||
clusterInfos: PropTypes.array.isRequired,
|
version: string;
|
||||||
reload: PropTypes.func.isRequired,
|
config_hash: string;
|
||||||
};
|
hostname: string;
|
||||||
|
ipaddress: string;
|
||||||
|
}>;
|
||||||
|
reload: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
type Style = {
|
||||||
|
clusterTable: CSSProperties;
|
||||||
|
clusterCell: CSSProperties;
|
||||||
|
warning: CSSProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class ClusterTable extends React.PureComponent<Props> {
|
||||||
render() {
|
render() {
|
||||||
var versionMismatch = (
|
let versionMismatch = (
|
||||||
<img
|
<img
|
||||||
alt='version mismatch'
|
alt='version mismatch'
|
||||||
className='cluster-status'
|
className='cluster-status'
|
||||||
src={statusGreen}
|
src={statusGreen}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
let configMismatch = (
|
||||||
var configMismatch = (
|
|
||||||
<img
|
<img
|
||||||
alt='config mismatch'
|
alt='config mismatch'
|
||||||
className='cluster-status'
|
className='cluster-status'
|
||||||
src={statusGreen}
|
src={statusGreen}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
let versionMismatchWarning = (
|
||||||
var versionMismatchWarning = (
|
|
||||||
<div/>
|
<div/>
|
||||||
);
|
);
|
||||||
|
let version = '';
|
||||||
var version = '';
|
let configHash = '';
|
||||||
var configHash = '';
|
let singleItem = false;
|
||||||
var singleItem = false;
|
|
||||||
|
|
||||||
if (this.props.clusterInfos.length) {
|
if (this.props.clusterInfos.length) {
|
||||||
version = this.props.clusterInfos[0].version;
|
version = this.props.clusterInfos[0].version;
|
||||||
@ -84,8 +90,8 @@ export default class ClusterTable extends React.PureComponent {
|
|||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
var items = this.props.clusterInfos.map((clusterInfo) => {
|
const items = this.props.clusterInfos.map((clusterInfo) => {
|
||||||
var status = null;
|
let status = null;
|
||||||
|
|
||||||
if (clusterInfo.hostname === '') {
|
if (clusterInfo.hostname === '') {
|
||||||
clusterInfo.hostname = Utils.localizeMessage('admin.cluster.unknown', 'unknown');
|
clusterInfo.hostname = Utils.localizeMessage('admin.cluster.unknown', 'unknown');
|
||||||
@ -191,7 +197,8 @@ export default class ClusterTable extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const style = {
|
const style: Style = {
|
||||||
clusterTable: {margin: 10, marginBottom: 30},
|
clusterTable: {margin: 10, marginBottom: 30},
|
||||||
clusterCell: {whiteSpace: 'nowrap'},
|
clusterCell: {whiteSpace: 'nowrap'},
|
||||||
|
warning: {marginBottom: 10},
|
||||||
};
|
};
|
@ -6,7 +6,7 @@ import React from 'react';
|
|||||||
import {getClusterStatus} from 'actions/admin_actions.jsx';
|
import {getClusterStatus} from 'actions/admin_actions.jsx';
|
||||||
import LoadingScreen from '../loading_screen';
|
import LoadingScreen from '../loading_screen';
|
||||||
|
|
||||||
import ClusterTable from './cluster_table.jsx';
|
import ClusterTable from './cluster_table';
|
||||||
|
|
||||||
export default class ClusterTableContainer extends React.PureComponent {
|
export default class ClusterTableContainer extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
Loading…
Reference in New Issue
Block a user