Fix linter (#452)
This commit is contained in:
parent
98fcc90c6b
commit
b60ff8acf6
14 changed files with 465 additions and 473 deletions
|
@ -18,9 +18,8 @@ const mapStateToProps = (state: RootState) => ({
|
|||
isFetching: getIsSchemaListFetching(state),
|
||||
schemas: getSchemaList(state),
|
||||
globalSchemaCompatibilityLevel: getGlobalSchemaCompatibilityLevel(state),
|
||||
isGlobalSchemaCompatibilityLevelFetched: getGlobalSchemaCompatibilityLevelFetched(
|
||||
state
|
||||
),
|
||||
isGlobalSchemaCompatibilityLevelFetched:
|
||||
getGlobalSchemaCompatibilityLevelFetched(state),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = {
|
||||
|
|
|
@ -23,10 +23,8 @@ const ListItem: React.FC<ListItemProps> = ({
|
|||
clusterName,
|
||||
clearTopicMessages,
|
||||
}) => {
|
||||
const [
|
||||
isDeleteTopicConfirmationVisible,
|
||||
setDeleteTopicConfirmationVisible,
|
||||
] = React.useState(false);
|
||||
const [isDeleteTopicConfirmationVisible, setDeleteTopicConfirmationVisible] =
|
||||
React.useState(false);
|
||||
|
||||
const outOfSyncReplicas = React.useMemo(() => {
|
||||
if (partitions === undefined || partitions.length === 0) {
|
||||
|
|
|
@ -33,10 +33,8 @@ const Details: React.FC<Props> = ({
|
|||
}) => {
|
||||
const history = useHistory();
|
||||
const { isReadOnly } = React.useContext(ClusterContext);
|
||||
const [
|
||||
isDeleteTopicConfirmationVisible,
|
||||
setDeleteTopicConfirmationVisible,
|
||||
] = React.useState(false);
|
||||
const [isDeleteTopicConfirmationVisible, setDeleteTopicConfirmationVisible] =
|
||||
React.useState(false);
|
||||
const deleteTopicHandler = React.useCallback(() => {
|
||||
deleteTopic(clusterName, topicName);
|
||||
history.push(clusterTopicsPath(clusterName));
|
||||
|
|
|
@ -50,9 +50,8 @@ const Messages: React.FC<Props> = ({
|
|||
fetchTopicMessages,
|
||||
}) => {
|
||||
const [searchQuery, setSearchQuery] = React.useState<string>('');
|
||||
const [searchTimestamp, setSearchTimestamp] = React.useState<Date | null>(
|
||||
null
|
||||
);
|
||||
const [searchTimestamp, setSearchTimestamp] =
|
||||
React.useState<Date | null>(null);
|
||||
const [filterProps, setFilterProps] = React.useState<FilterProps[]>([]);
|
||||
const [selectedSeekType, setSelectedSeekType] = React.useState<SeekType>(
|
||||
SeekType.OFFSET
|
||||
|
|
|
@ -39,9 +39,8 @@ const CustomParamSelect: React.FC<CustomParamSelectProps> = ({
|
|||
return valid || 'Custom Parameter must be unique';
|
||||
};
|
||||
|
||||
const onChange = (inputName: string) => (
|
||||
event: React.ChangeEvent<HTMLSelectElement>
|
||||
) => {
|
||||
const onChange =
|
||||
(inputName: string) => (event: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
trigger(inputName);
|
||||
onNameChange(index, event.target.value);
|
||||
};
|
||||
|
|
|
@ -35,10 +35,8 @@ const CustomParams: React.FC<Props> = ({ isSubmitting, config }) => {
|
|||
)
|
||||
: {};
|
||||
|
||||
const [
|
||||
formCustomParams,
|
||||
setFormCustomParams,
|
||||
] = React.useState<TopicFormCustomParams>({
|
||||
const [formCustomParams, setFormCustomParams] =
|
||||
React.useState<TopicFormCustomParams>({
|
||||
byIndex,
|
||||
allIndexes: Object.keys(byIndex),
|
||||
});
|
||||
|
|
|
@ -235,9 +235,8 @@ export const updateConnectorConfigAction = createAsyncAction(
|
|||
'PATCH_CONNECTOR_CONFIG__FAILURE'
|
||||
)<undefined, { connector: Connector }, { alert?: FailurePayload }>();
|
||||
|
||||
export const setTopicsSearchAction = createAction(
|
||||
'SET_TOPICS_SEARCH'
|
||||
)<string>();
|
||||
export const setTopicsSearchAction =
|
||||
createAction('SET_TOPICS_SEARCH')<string>();
|
||||
|
||||
export const setTopicsOrderByAction = createAction(
|
||||
'SET_TOPICS_ORDER_BY'
|
||||
|
|
|
@ -6,9 +6,9 @@ import * as actions from 'redux/actions/actions';
|
|||
const apiClientConf = new Configuration(BASE_PARAMS);
|
||||
export const brokersApiClient = new BrokersApi(apiClientConf);
|
||||
|
||||
export const fetchBrokers = (
|
||||
clusterName: ClusterName
|
||||
): PromiseThunkResult => async (dispatch) => {
|
||||
export const fetchBrokers =
|
||||
(clusterName: ClusterName): PromiseThunkResult =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.fetchBrokersAction.request());
|
||||
try {
|
||||
const payload = await brokersApiClient.getBrokers({ clusterName });
|
||||
|
@ -16,12 +16,11 @@ export const fetchBrokers = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchBrokersAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchBrokerMetrics = (
|
||||
clusterName: ClusterName,
|
||||
brokerId: BrokerId
|
||||
): PromiseThunkResult => async (dispatch) => {
|
||||
export const fetchBrokerMetrics =
|
||||
(clusterName: ClusterName, brokerId: BrokerId): PromiseThunkResult =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.fetchBrokerMetricsAction.request());
|
||||
try {
|
||||
const payload = await brokersApiClient.getBrokersMetrics({
|
||||
|
@ -32,4 +31,4 @@ export const fetchBrokerMetrics = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchBrokerMetricsAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -16,9 +16,9 @@ export const fetchClustersList = (): PromiseThunkResult => async (dispatch) => {
|
|||
}
|
||||
};
|
||||
|
||||
export const fetchClusterStats = (
|
||||
clusterName: ClusterName
|
||||
): PromiseThunkResult => async (dispatch) => {
|
||||
export const fetchClusterStats =
|
||||
(clusterName: ClusterName): PromiseThunkResult =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.fetchClusterStatsAction.request());
|
||||
try {
|
||||
const payload = await clustersApiClient.getClusterStats({ clusterName });
|
||||
|
@ -26,11 +26,11 @@ export const fetchClusterStats = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchClusterStatsAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchClusterMetrics = (
|
||||
clusterName: ClusterName
|
||||
): PromiseThunkResult => async (dispatch) => {
|
||||
export const fetchClusterMetrics =
|
||||
(clusterName: ClusterName): PromiseThunkResult =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.fetchClusterMetricsAction.request());
|
||||
try {
|
||||
const payload = await clustersApiClient.getClusterMetrics({
|
||||
|
@ -40,4 +40,4 @@ export const fetchClusterMetrics = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchClusterMetricsAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -10,9 +10,9 @@ import * as actions from 'redux/actions/actions';
|
|||
const apiClientConf = new Configuration(BASE_PARAMS);
|
||||
export const consumerGroupsApiClient = new ConsumerGroupsApi(apiClientConf);
|
||||
|
||||
export const fetchConsumerGroupsList = (
|
||||
clusterName: ClusterName
|
||||
): PromiseThunkResult => async (dispatch) => {
|
||||
export const fetchConsumerGroupsList =
|
||||
(clusterName: ClusterName): PromiseThunkResult =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.fetchConsumerGroupsAction.request());
|
||||
try {
|
||||
const consumerGroups = await consumerGroupsApiClient.getConsumerGroups({
|
||||
|
@ -22,20 +22,21 @@ export const fetchConsumerGroupsList = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchConsumerGroupsAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchConsumerGroupDetails = (
|
||||
export const fetchConsumerGroupDetails =
|
||||
(
|
||||
clusterName: ClusterName,
|
||||
consumerGroupID: ConsumerGroupID
|
||||
): PromiseThunkResult => async (dispatch) => {
|
||||
): PromiseThunkResult =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.fetchConsumerGroupDetailsAction.request());
|
||||
try {
|
||||
const consumerGroupDetails = await consumerGroupsApiClient.getConsumerGroup(
|
||||
{
|
||||
const consumerGroupDetails =
|
||||
await consumerGroupsApiClient.getConsumerGroup({
|
||||
clusterName,
|
||||
id: consumerGroupID,
|
||||
}
|
||||
);
|
||||
});
|
||||
dispatch(
|
||||
actions.fetchConsumerGroupDetailsAction.success({
|
||||
consumerGroupID,
|
||||
|
@ -45,4 +46,4 @@ export const fetchConsumerGroupDetails = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchConsumerGroupDetailsAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -20,9 +20,9 @@ import { isEqual } from 'lodash';
|
|||
const apiClientConf = new Configuration(BASE_PARAMS);
|
||||
export const schemasApiClient = new SchemasApi(apiClientConf);
|
||||
|
||||
export const fetchSchemasByClusterName = (
|
||||
clusterName: ClusterName
|
||||
): PromiseThunkResult<void> => async (dispatch) => {
|
||||
export const fetchSchemasByClusterName =
|
||||
(clusterName: ClusterName): PromiseThunkResult<void> =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.fetchSchemasByClusterNameAction.request());
|
||||
try {
|
||||
const schemas = await schemasApiClient.getSchemas({ clusterName });
|
||||
|
@ -30,12 +30,11 @@ export const fetchSchemasByClusterName = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchSchemasByClusterNameAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchSchemaVersions = (
|
||||
clusterName: ClusterName,
|
||||
subject: SchemaName
|
||||
): PromiseThunkResult<void> => async (dispatch) => {
|
||||
export const fetchSchemaVersions =
|
||||
(clusterName: ClusterName, subject: SchemaName): PromiseThunkResult<void> =>
|
||||
async (dispatch) => {
|
||||
if (!subject) return;
|
||||
dispatch(actions.fetchSchemaVersionsAction.request());
|
||||
try {
|
||||
|
@ -47,11 +46,11 @@ export const fetchSchemaVersions = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchSchemaVersionsAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchGlobalSchemaCompatibilityLevel = (
|
||||
clusterName: ClusterName
|
||||
): PromiseThunkResult<void> => async (dispatch) => {
|
||||
export const fetchGlobalSchemaCompatibilityLevel =
|
||||
(clusterName: ClusterName): PromiseThunkResult<void> =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.fetchGlobalSchemaCompatibilityLevelAction.request());
|
||||
try {
|
||||
const result = await schemasApiClient.getGlobalSchemaCompatibilityLevel({
|
||||
|
@ -65,12 +64,14 @@ export const fetchGlobalSchemaCompatibilityLevel = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchGlobalSchemaCompatibilityLevelAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const updateGlobalSchemaCompatibilityLevel = (
|
||||
export const updateGlobalSchemaCompatibilityLevel =
|
||||
(
|
||||
clusterName: ClusterName,
|
||||
compatibilityLevel: CompatibilityLevelCompatibilityEnum
|
||||
): PromiseThunkResult<void> => async (dispatch) => {
|
||||
): PromiseThunkResult<void> =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.updateGlobalSchemaCompatibilityLevelAction.request());
|
||||
try {
|
||||
await schemasApiClient.updateGlobalSchemaCompatibilityLevel({
|
||||
|
@ -85,12 +86,14 @@ export const updateGlobalSchemaCompatibilityLevel = (
|
|||
} catch (e) {
|
||||
dispatch(actions.updateGlobalSchemaCompatibilityLevelAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const createSchema = (
|
||||
export const createSchema =
|
||||
(
|
||||
clusterName: ClusterName,
|
||||
newSchemaSubject: NewSchemaSubject
|
||||
): PromiseThunkResult => async (dispatch) => {
|
||||
): PromiseThunkResult =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.createSchemaAction.request());
|
||||
try {
|
||||
const schema: SchemaSubject = await schemasApiClient.createNewSchema({
|
||||
|
@ -108,16 +111,18 @@ export const createSchema = (
|
|||
dispatch(actions.createSchemaAction.failure({ alert }));
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const updateSchema = (
|
||||
export const updateSchema =
|
||||
(
|
||||
latestSchema: SchemaSubject,
|
||||
newSchema: string,
|
||||
newSchemaType: SchemaType,
|
||||
newCompatibilityLevel: CompatibilityLevelCompatibilityEnum,
|
||||
clusterName: string,
|
||||
subject: string
|
||||
): PromiseThunkResult => async (dispatch) => {
|
||||
): PromiseThunkResult =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.updateSchemaAction.request());
|
||||
try {
|
||||
let schema: SchemaSubject = latestSchema;
|
||||
|
@ -155,11 +160,10 @@ export const updateSchema = (
|
|||
dispatch(actions.updateSchemaAction.failure({ alert }));
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
export const deleteSchema = (
|
||||
clusterName: ClusterName,
|
||||
subject: string
|
||||
): PromiseThunkResult => async (dispatch) => {
|
||||
};
|
||||
export const deleteSchema =
|
||||
(clusterName: ClusterName, subject: string): PromiseThunkResult =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.deleteSchemaAction.request());
|
||||
try {
|
||||
await schemasApiClient.deleteSchema({
|
||||
|
@ -176,4 +180,4 @@ export const deleteSchema = (
|
|||
};
|
||||
dispatch(actions.deleteSchemaAction.failure({ alert }));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -36,9 +36,9 @@ export interface FetchTopicsListParams {
|
|||
orderBy?: TopicColumnsToSort;
|
||||
}
|
||||
|
||||
export const fetchTopicsList = (
|
||||
params: FetchTopicsListParams
|
||||
): PromiseThunkResult => async (dispatch, getState) => {
|
||||
export const fetchTopicsList =
|
||||
(params: FetchTopicsListParams): PromiseThunkResult =>
|
||||
async (dispatch, getState) => {
|
||||
dispatch(actions.fetchTopicsListAction.request());
|
||||
try {
|
||||
const { topics, pageCount } = await topicsApiClient.getTopics(params);
|
||||
|
@ -65,13 +65,15 @@ export const fetchTopicsList = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchTopicsListAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchTopicMessages = (
|
||||
export const fetchTopicMessages =
|
||||
(
|
||||
clusterName: ClusterName,
|
||||
topicName: TopicName,
|
||||
queryParams: Partial<TopicMessageQueryParams>
|
||||
): PromiseThunkResult => async (dispatch) => {
|
||||
): PromiseThunkResult =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.fetchTopicMessagesAction.request());
|
||||
try {
|
||||
const messages = await messagesApiClient.getTopicMessages({
|
||||
|
@ -83,13 +85,15 @@ export const fetchTopicMessages = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchTopicMessagesAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const clearTopicMessages = (
|
||||
export const clearTopicMessages =
|
||||
(
|
||||
clusterName: ClusterName,
|
||||
topicName: TopicName,
|
||||
partitions?: number[]
|
||||
): PromiseThunkResult => async (dispatch) => {
|
||||
): PromiseThunkResult =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.clearMessagesTopicAction.request());
|
||||
try {
|
||||
await messagesApiClient.deleteTopicMessages({
|
||||
|
@ -107,12 +111,11 @@ export const clearTopicMessages = (
|
|||
};
|
||||
dispatch(actions.clearMessagesTopicAction.failure({ alert }));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchTopicDetails = (
|
||||
clusterName: ClusterName,
|
||||
topicName: TopicName
|
||||
): PromiseThunkResult => async (dispatch, getState) => {
|
||||
export const fetchTopicDetails =
|
||||
(clusterName: ClusterName, topicName: TopicName): PromiseThunkResult =>
|
||||
async (dispatch, getState) => {
|
||||
dispatch(actions.fetchTopicDetailsAction.request());
|
||||
try {
|
||||
const topicDetails = await topicsApiClient.getTopicDetails({
|
||||
|
@ -134,12 +137,11 @@ export const fetchTopicDetails = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchTopicDetailsAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchTopicConfig = (
|
||||
clusterName: ClusterName,
|
||||
topicName: TopicName
|
||||
): PromiseThunkResult => async (dispatch, getState) => {
|
||||
export const fetchTopicConfig =
|
||||
(clusterName: ClusterName, topicName: TopicName): PromiseThunkResult =>
|
||||
async (dispatch, getState) => {
|
||||
dispatch(actions.fetchTopicConfigAction.request());
|
||||
try {
|
||||
const config = await topicsApiClient.getTopicConfigs({
|
||||
|
@ -165,7 +167,7 @@ export const fetchTopicConfig = (
|
|||
} catch (e) {
|
||||
dispatch(actions.fetchTopicConfigAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const formatTopicCreation = (form: TopicFormDataRaw): TopicCreation => {
|
||||
const {
|
||||
|
@ -233,10 +235,9 @@ const formatTopicUpdate = (form: TopicFormDataRaw): TopicUpdate => {
|
|||
};
|
||||
};
|
||||
|
||||
export const createTopic = (
|
||||
clusterName: ClusterName,
|
||||
form: TopicFormDataRaw
|
||||
): PromiseThunkResult => async (dispatch, getState) => {
|
||||
export const createTopic =
|
||||
(clusterName: ClusterName, form: TopicFormDataRaw): PromiseThunkResult =>
|
||||
async (dispatch, getState) => {
|
||||
dispatch(actions.createTopicAction.request());
|
||||
try {
|
||||
const topic: Topic = await topicsApiClient.createTopic({
|
||||
|
@ -266,13 +267,15 @@ export const createTopic = (
|
|||
};
|
||||
dispatch(actions.createTopicAction.failure({ alert }));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const updateTopic = (
|
||||
export const updateTopic =
|
||||
(
|
||||
clusterName: ClusterName,
|
||||
topicName: TopicName,
|
||||
form: TopicFormDataRaw
|
||||
): PromiseThunkResult => async (dispatch, getState) => {
|
||||
): PromiseThunkResult =>
|
||||
async (dispatch, getState) => {
|
||||
dispatch(actions.updateTopicAction.request());
|
||||
try {
|
||||
const topic: Topic = await topicsApiClient.updateTopic({
|
||||
|
@ -297,12 +300,11 @@ export const updateTopic = (
|
|||
} catch (e) {
|
||||
dispatch(actions.updateTopicAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const deleteTopic = (
|
||||
clusterName: ClusterName,
|
||||
topicName: TopicName
|
||||
): PromiseThunkResult => async (dispatch) => {
|
||||
export const deleteTopic =
|
||||
(clusterName: ClusterName, topicName: TopicName): PromiseThunkResult =>
|
||||
async (dispatch) => {
|
||||
dispatch(actions.deleteTopicAction.request());
|
||||
try {
|
||||
await topicsApiClient.deleteTopic({
|
||||
|
@ -313,4 +315,4 @@ export const deleteTopic = (
|
|||
} catch (e) {
|
||||
dispatch(actions.deleteTopicAction.failure());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -18,12 +18,10 @@ export const getTopicListTotalPages = (state: RootState) =>
|
|||
topicsState(state).totalPages;
|
||||
|
||||
const getTopicListFetchingStatus = createFetchingSelector('GET_TOPICS');
|
||||
const getTopicDetailsFetchingStatus = createFetchingSelector(
|
||||
'GET_TOPIC_DETAILS'
|
||||
);
|
||||
const getTopicMessagesFetchingStatus = createFetchingSelector(
|
||||
'GET_TOPIC_MESSAGES'
|
||||
);
|
||||
const getTopicDetailsFetchingStatus =
|
||||
createFetchingSelector('GET_TOPIC_DETAILS');
|
||||
const getTopicMessagesFetchingStatus =
|
||||
createFetchingSelector('GET_TOPIC_MESSAGES');
|
||||
const getTopicConfigFetchingStatus = createFetchingSelector('GET_TOPIC_CONFIG');
|
||||
const getTopicCreationStatus = createFetchingSelector('POST_TOPIC');
|
||||
const getTopicUpdateStatus = createFetchingSelector('PATCH_TOPIC');
|
||||
|
|
|
@ -6,9 +6,7 @@ import { RootState, Action } from 'redux/interfaces';
|
|||
const middlewares: Array<Middleware> = [thunk];
|
||||
type DispatchExts = ThunkDispatch<RootState, undefined, Action>;
|
||||
|
||||
const mockStoreCreator: MockStoreCreator<
|
||||
RootState,
|
||||
DispatchExts
|
||||
> = configureMockStore<RootState, DispatchExts>(middlewares);
|
||||
const mockStoreCreator: MockStoreCreator<RootState, DispatchExts> =
|
||||
configureMockStore<RootState, DispatchExts>(middlewares);
|
||||
|
||||
export default mockStoreCreator();
|
||||
|
|
Loading…
Add table
Reference in a new issue