[UI] Cleanup

This commit is contained in:
Oleg Shuralev 2020-01-19 17:45:04 +03:00
parent 82d81dd847
commit c327908493
No known key found for this signature in database
GPG key ID: 0459DF80E1A2FD1B
45 changed files with 43 additions and 41 deletions

View file

@ -4,7 +4,7 @@ import {
} from 'redux/reducers/clusters/thunks'; } from 'redux/reducers/clusters/thunks';
import App from './App'; import App from './App';
import { getIsClusterListFetched } from 'redux/reducers/clusters/selectors'; import { getIsClusterListFetched } from 'redux/reducers/clusters/selectors';
import { RootState } from 'types'; import { RootState } from 'lib/interfaces';
const mapStateToProps = (state: RootState) => ({ const mapStateToProps = (state: RootState) => ({
isClusterListFetched: getIsClusterListFetched(state), isClusterListFetched: getIsClusterListFetched(state),

View file

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { ClusterId, BrokerMetrics, ZooKeeperStatus } from 'types'; import { ClusterId, BrokerMetrics, ZooKeeperStatus } from 'lib/interfaces';
import useInterval from 'lib/hooks/useInterval'; import useInterval from 'lib/hooks/useInterval';
import formatBytes from 'lib/utils/formatBytes'; import formatBytes from 'lib/utils/formatBytes';
import cx from 'classnames'; import cx from 'classnames';

View file

@ -5,7 +5,7 @@ import {
} from 'redux/reducers/brokers/thunks'; } from 'redux/reducers/brokers/thunks';
import Brokers from './Brokers'; import Brokers from './Brokers';
import * as brokerSelectors from 'redux/reducers/brokers/selectors'; import * as brokerSelectors from 'redux/reducers/brokers/selectors';
import { RootState, ClusterId } from 'types'; import { RootState, ClusterId } from 'lib/interfaces';
import { RouteComponentProps } from 'react-router-dom'; import { RouteComponentProps } from 'react-router-dom';
interface RouteProps { interface RouteProps {

View file

@ -1,5 +1,5 @@
import React, { CSSProperties } from 'react'; import React, { CSSProperties } from 'react';
import { Cluster } from 'types'; import { Cluster } from 'lib/interfaces';
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
import { clusterBrokersPath, clusterTopicsPath } from 'lib/paths'; import { clusterBrokersPath, clusterTopicsPath } from 'lib/paths';

View file

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Cluster } from 'types'; import { Cluster } from 'lib/interfaces';
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
import cx from 'classnames'; import cx from 'classnames';
import ClusterMenu from './ClusterMenu'; import ClusterMenu from './ClusterMenu';

View file

@ -1,7 +1,7 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Nav from './Nav'; import Nav from './Nav';
import { getIsClusterListFetched, getClusterList } from 'redux/reducers/clusters/selectors'; import { getIsClusterListFetched, getClusterList } from 'redux/reducers/clusters/selectors';
import { RootState } from 'types'; import { RootState } from 'lib/interfaces';
const mapStateToProps = (state: RootState) => ({ const mapStateToProps = (state: RootState) => ({
isClusterListFetched: getIsClusterListFetched(state), isClusterListFetched: getIsClusterListFetched(state),

View file

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { ClusterId, Topic, TopicDetails, TopicName } from 'types'; import { ClusterId, Topic, TopicDetails, TopicName } from 'lib/interfaces';
import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb'; import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb';
import { NavLink, Switch, Route } from 'react-router-dom'; import { NavLink, Switch, Route } from 'react-router-dom';
import { clusterTopicsPath, clusterTopicSettingsPath, clusterTopicPath, clusterTopicMessagesPath } from 'lib/paths'; import { clusterTopicsPath, clusterTopicSettingsPath, clusterTopicPath, clusterTopicMessagesPath } from 'lib/paths';

View file

@ -1,6 +1,6 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Details from './Details'; import Details from './Details';
import { RootState } from 'types'; import { RootState } from 'lib/interfaces';
import { withRouter, RouteComponentProps } from 'react-router-dom'; import { withRouter, RouteComponentProps } from 'react-router-dom';
interface RouteProps { interface RouteProps {

View file

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { ClusterId, TopicName } from 'types'; import { ClusterId, TopicName } from 'lib/interfaces';
interface Props { interface Props {
clusterId: ClusterId; clusterId: ClusterId;

View file

@ -1,6 +1,6 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Messages from './Messages'; import Messages from './Messages';
import { RootState } from 'types'; import { RootState } from 'lib/interfaces';
import { withRouter, RouteComponentProps } from 'react-router-dom'; import { withRouter, RouteComponentProps } from 'react-router-dom';
interface RouteProps { interface RouteProps {

View file

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { ClusterId, Topic, TopicDetails, TopicName } from 'types'; import { ClusterId, Topic, TopicDetails, TopicName } from 'lib/interfaces';
import MetricsWrapper from 'components/common/Dashboard/MetricsWrapper'; import MetricsWrapper from 'components/common/Dashboard/MetricsWrapper';
import Indicator from 'components/common/Dashboard/Indicator'; import Indicator from 'components/common/Dashboard/Indicator';

View file

@ -3,7 +3,7 @@ import {
fetchTopicDetails, fetchTopicDetails,
} from 'redux/reducers/topics/thunks'; } from 'redux/reducers/topics/thunks';
import Overview from './Overview'; import Overview from './Overview';
import { RootState, TopicName, ClusterId } from 'types'; import { RootState, TopicName, ClusterId } from 'lib/interfaces';
import { getTopicByName, getIsTopicDetailsFetched } from 'redux/reducers/topics/selectors'; import { getTopicByName, getIsTopicDetailsFetched } from 'redux/reducers/topics/selectors';
import { withRouter, RouteComponentProps } from 'react-router-dom'; import { withRouter, RouteComponentProps } from 'react-router-dom';

View file

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { ClusterId, TopicName, TopicConfig } from 'types'; import { ClusterId, TopicName, TopicConfig } from 'lib/interfaces';
interface Props { interface Props {
clusterId: ClusterId; clusterId: ClusterId;

View file

@ -1,5 +1,5 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { RootState, ClusterId, TopicName } from 'types'; import { RootState, ClusterId, TopicName } from 'lib/interfaces';
import { withRouter, RouteComponentProps } from 'react-router-dom'; import { withRouter, RouteComponentProps } from 'react-router-dom';
import { import {
fetchTopicConfig, fetchTopicConfig,

View file

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { TopicWithDetailedInfo, ClusterId } from 'types'; import { TopicWithDetailedInfo, ClusterId } from 'lib/interfaces';
import ListItem from './ListItem'; import ListItem from './ListItem';
import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb'; import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb';
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';

View file

@ -1,5 +1,5 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { RootState } from 'types'; import { RootState } from 'lib/interfaces';
import { getTopicList, getExternalTopicList } from 'redux/reducers/topics/selectors'; import { getTopicList, getExternalTopicList } from 'redux/reducers/topics/selectors';
import List from './List'; import List from './List';
import { withRouter, RouteComponentProps } from 'react-router-dom'; import { withRouter, RouteComponentProps } from 'react-router-dom';

View file

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import cx from 'classnames'; import cx from 'classnames';
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
import { TopicWithDetailedInfo } from 'types'; import { TopicWithDetailedInfo } from 'lib/interfaces';
const ListItem: React.FC<TopicWithDetailedInfo> = ({ const ListItem: React.FC<TopicWithDetailedInfo> = ({
name, name,

View file

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { ClusterId, CleanupPolicy, TopicFormData, TopicName } from 'types'; import { ClusterId, CleanupPolicy, TopicFormData, TopicName } from 'lib/interfaces';
import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb'; import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb';
import { clusterTopicsPath } from 'lib/paths'; import { clusterTopicsPath } from 'lib/paths';
import { useForm, ErrorMessage } from 'react-hook-form'; import { useForm, ErrorMessage } from 'react-hook-form';

View file

@ -1,5 +1,5 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { RootState, ClusterId, TopicFormData, TopicName, Action } from 'types'; import { RootState, ClusterId, TopicFormData, TopicName, Action } from 'lib/interfaces';
import New from './New'; import New from './New';
import { withRouter, RouteComponentProps } from 'react-router-dom'; import { withRouter, RouteComponentProps } from 'react-router-dom';
import { createTopic } from 'redux/reducers/topics/thunks'; import { createTopic } from 'redux/reducers/topics/thunks';

View file

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { ClusterId } from 'types'; import { ClusterId } from 'lib/interfaces';
import { import {
Switch, Switch,
Route, Route,

View file

@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import { fetchTopicList } from 'redux/reducers/topics/thunks'; import { fetchTopicList } from 'redux/reducers/topics/thunks';
import Topics from './Topics'; import Topics from './Topics';
import { getIsTopicListFetched } from 'redux/reducers/topics/selectors'; import { getIsTopicListFetched } from 'redux/reducers/topics/selectors';
import { RootState, ClusterId } from 'types'; import { RootState, ClusterId } from 'lib/interfaces';
import { RouteComponentProps } from 'react-router-dom'; import { RouteComponentProps } from 'react-router-dom';
interface RouteProps { interface RouteProps {

View file

@ -2,7 +2,7 @@ import {
Broker, Broker,
ClusterId, ClusterId,
BrokerMetrics, BrokerMetrics,
} from 'types'; } from 'lib/interfaces';
import { import {
BASE_URL, BASE_URL,
BASE_PARAMS, BASE_PARAMS,

View file

@ -1,6 +1,6 @@
import { import {
Cluster, Cluster,
} from 'types'; } from 'lib/interfaces';
import { import {
BASE_URL, BASE_URL,
BASE_PARAMS, BASE_PARAMS,

View file

@ -5,7 +5,7 @@ import {
TopicDetails, TopicDetails,
TopicConfig, TopicConfig,
TopicFormData, TopicFormData,
} from 'types'; } from 'lib/interfaces';
import { import {
BASE_URL, BASE_URL,
BASE_PARAMS, BASE_PARAMS,

View file

@ -13,4 +13,6 @@ export interface Cluster {
brokerCount: number; brokerCount: number;
onlinePartitionCount: number; onlinePartitionCount: number;
topicCount: number; topicCount: number;
bytesInPerSec: number;
bytesOutPerSec: number;
} }

View file

@ -1,4 +1,4 @@
import { FetchStatus } from "types"; import { FetchStatus } from 'lib/interfaces';
export interface LoaderState { export interface LoaderState {
[key: string]: FetchStatus; [key: string]: FetchStatus;

View file

@ -1,4 +1,4 @@
import { ClusterId, TopicName } from "types"; import { ClusterId, TopicName } from 'lib/interfaces';
const clusterPath = (clusterId: ClusterId) => `/clusters/${clusterId}`; const clusterPath = (clusterId: ClusterId) => `/clusters/${clusterId}`;

View file

@ -1,6 +1,6 @@
import { createAsyncAction} from 'typesafe-actions'; import { createAsyncAction} from 'typesafe-actions';
import ActionType from './actionType'; import ActionType from './actionType';
import { Broker, BrokerMetrics } from 'types'; import { Broker, BrokerMetrics } from 'lib/interfaces';
export const fetchBrokersAction = createAsyncAction( export const fetchBrokersAction = createAsyncAction(
ActionType.GET_BROKERS__REQUEST, ActionType.GET_BROKERS__REQUEST,

View file

@ -1,4 +1,4 @@
import { Action, BrokersState, ZooKeeperStatus, BrokerMetrics } from 'types'; import { Action, BrokersState, ZooKeeperStatus, BrokerMetrics } from 'lib/interfaces';
import actionType from 'redux/reducers/actionType'; import actionType from 'redux/reducers/actionType';
export const initialState: BrokersState = { export const initialState: BrokersState = {

View file

@ -1,5 +1,5 @@
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { RootState, FetchStatus, BrokersState } from 'types'; import { RootState, FetchStatus, BrokersState } from 'lib/interfaces';
import { createFetchingSelector } from 'redux/reducers/loader/selectors'; import { createFetchingSelector } from 'redux/reducers/loader/selectors';
const brokersState = ({ brokers }: RootState): BrokersState => brokers; const brokersState = ({ brokers }: RootState): BrokersState => brokers;

View file

@ -3,7 +3,7 @@ import {
fetchBrokersAction, fetchBrokersAction,
fetchBrokerMetricsAction, fetchBrokerMetricsAction,
} from './actions'; } from './actions';
import { PromiseThunk, ClusterId } from 'types'; import { PromiseThunk, ClusterId } from 'lib/interfaces';
export const fetchBrokers = (clusterId: ClusterId): PromiseThunk<void> => async (dispatch) => { export const fetchBrokers = (clusterId: ClusterId): PromiseThunk<void> => async (dispatch) => {

View file

@ -1,6 +1,6 @@
import { createAsyncAction} from 'typesafe-actions'; import { createAsyncAction} from 'typesafe-actions';
import ActionType from './actionType'; import ActionType from './actionType';
import { Cluster } from 'types'; import { Cluster } from 'lib/interfaces';
export const fetchClusterListAction = createAsyncAction( export const fetchClusterListAction = createAsyncAction(
ActionType.GET_CLUSTERS__REQUEST, ActionType.GET_CLUSTERS__REQUEST,

View file

@ -1,4 +1,4 @@
import { Cluster, Action } from 'types'; import { Cluster, Action } from 'lib/interfaces';
import actionType from 'redux/reducers/actionType'; import actionType from 'redux/reducers/actionType';
export const initialState: Cluster[] = []; export const initialState: Cluster[] = [];

View file

@ -1,5 +1,5 @@
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { Cluster, RootState, FetchStatus } from 'types'; import { Cluster, RootState, FetchStatus } from 'lib/interfaces';
import { createFetchingSelector } from 'redux/reducers/loader/selectors'; import { createFetchingSelector } from 'redux/reducers/loader/selectors';
const clustersState = ({ clusters }: RootState): Cluster[] => clusters; const clustersState = ({ clusters }: RootState): Cluster[] => clusters;

View file

@ -4,7 +4,7 @@ import {
import { import {
fetchClusterListAction, fetchClusterListAction,
} from './actions'; } from './actions';
import { Cluster, PromiseThunk } from 'types'; import { Cluster, PromiseThunk } from 'lib/interfaces';
export const fetchClustersList = (): PromiseThunk<void> => async (dispatch) => { export const fetchClustersList = (): PromiseThunk<void> => async (dispatch) => {
dispatch(fetchClusterListAction.request()); dispatch(fetchClusterListAction.request());

View file

@ -3,7 +3,7 @@ import topics from './topics/reducer';
import clusters from './clusters/reducer'; import clusters from './clusters/reducer';
import brokers from './brokers/reducer'; import brokers from './brokers/reducer';
import loader from './loader/reducer'; import loader from './loader/reducer';
import { RootState } from 'types'; import { RootState } from 'lib/interfaces';
export default combineReducers<RootState>({ export default combineReducers<RootState>({
topics, topics,

View file

@ -1,4 +1,4 @@
import { FetchStatus, Action, LoaderState } from 'types'; import { FetchStatus, Action, LoaderState } from 'lib/interfaces';
export const initialState: LoaderState = {}; export const initialState: LoaderState = {};

View file

@ -1,4 +1,4 @@
import { RootState, FetchStatus } from 'types'; import { RootState, FetchStatus } from 'lib/interfaces';
export const createFetchingSelector = (action: string) => export const createFetchingSelector = (action: string) =>
(state: RootState) => (state.loader[action] || FetchStatus.notFetched); (state: RootState) => (state.loader[action] || FetchStatus.notFetched);

View file

@ -1,6 +1,6 @@
import { createAsyncAction} from 'typesafe-actions'; import { createAsyncAction} from 'typesafe-actions';
import ActionType from './actionType'; import ActionType from './actionType';
import { Topic, TopicDetails, TopicName, TopicConfig} from 'types'; import { Topic, TopicDetails, TopicName, TopicConfig} from 'lib/interfaces';
export const fetchTopicListAction = createAsyncAction( export const fetchTopicListAction = createAsyncAction(
ActionType.GET_TOPICS__REQUEST, ActionType.GET_TOPICS__REQUEST,

View file

@ -1,4 +1,4 @@
import { Action, TopicsState, Topic } from 'types'; import { Action, TopicsState, Topic } from 'lib/interfaces';
import actionType from 'redux/reducers/actionType'; import actionType from 'redux/reducers/actionType';
export const initialState: TopicsState = { export const initialState: TopicsState = {

View file

@ -1,5 +1,5 @@
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { RootState, TopicName, FetchStatus, TopicsState } from 'types'; import { RootState, TopicName, FetchStatus, TopicsState } from 'lib/interfaces';
import { createFetchingSelector } from 'redux/reducers/loader/selectors'; import { createFetchingSelector } from 'redux/reducers/loader/selectors';
const topicsState = ({ topics }: RootState): TopicsState => topics; const topicsState = ({ topics }: RootState): TopicsState => topics;

View file

@ -10,7 +10,7 @@ import {
fetchTopicConfigAction, fetchTopicConfigAction,
createTopicAction, createTopicAction,
} from './actions'; } from './actions';
import { PromiseThunk, ClusterId, TopicName, TopicFormData } from 'types'; import { PromiseThunk, ClusterId, TopicName, TopicFormData } from 'lib/interfaces';
export const fetchTopicList = (clusterId: ClusterId): PromiseThunk<void> => async (dispatch) => { export const fetchTopicList = (clusterId: ClusterId): PromiseThunk<void> => async (dispatch) => {
dispatch(fetchTopicListAction.request()); dispatch(fetchTopicListAction.request());