Improve typing of bindClientFunc/Improve Redux types part 2 (#25915)

* Improve typing of bindClientFunc

* Slight logic changes

* Remove unused import
Этот коммит содержится в:
Harrison Healey
2024-01-17 13:06:46 -05:00
коммит произвёл GitHub
родитель ce8cf7e8db
Коммит 584c2e766c
25 изменённых файлов: 341 добавлений и 336 удалений

Просмотреть файл

@@ -7,7 +7,7 @@ import FormData from 'form-data';
import {PreferenceType} from '@mattermost/types/preferences';
import {SystemSetting} from '@mattermost/types/general';
import {ClusterInfo, AnalyticsRow, SchemaMigration, LogFilter} from '@mattermost/types/admin';
import {ClusterInfo, AnalyticsRow, SchemaMigration, LogFilterQuery} from '@mattermost/types/admin';
import type {AppBinding, AppCallRequest, AppCallResponse} from '@mattermost/types/apps';
import {Audit} from '@mattermost/types/audits';
import {UserAutocomplete, AutocompleteSuggestion} from '@mattermost/types/autocomplete';
@@ -95,7 +95,7 @@ import {
OutgoingWebhook,
SubmitDialogResponse,
} from '@mattermost/types/integrations';
import {Job} from '@mattermost/types/jobs';
import {Job, JobTypeBase} from '@mattermost/types/jobs';
import {MfaSecret} from '@mattermost/types/mfa';
import {
ClientPluginManifest,
@@ -3001,7 +3001,7 @@ export default class Client4 {
);
};
createJob = (job: Job) => {
createJob = (job: JobTypeBase) => {
return this.doFetch<Job>(
`${this.getJobsRoute()}`,
{method: 'post', body: JSON.stringify(job)},
@@ -3017,7 +3017,7 @@ export default class Client4 {
// Admin Routes
getLogs = (logFilter: LogFilter) => {
getLogs = (logFilter: LogFilterQuery) => {
return this.doFetch<string[]>(
`${this.getBaseRoute()}/logs/query`,
{method: 'post', body: JSON.stringify(logFilter)},
@@ -3073,7 +3073,7 @@ export default class Client4 {
);
};
testEmail = (config: AdminConfig) => {
testEmail = (config?: AdminConfig) => {
return this.doFetch<StatusOK>(
`${this.getBaseRoute()}/email/test`,
{method: 'post', body: JSON.stringify(config)},
@@ -3087,7 +3087,7 @@ export default class Client4 {
);
};
testS3Connection = (config: ClientConfig) => {
testS3Connection = (config?: AdminConfig) => {
return this.doFetch<StatusOK>(
`${this.getBaseRoute()}/file/s3_test`,
{method: 'post', body: JSON.stringify(config)},
@@ -3303,7 +3303,7 @@ export default class Client4 {
);
};
testElasticsearch = (config: ClientConfig) => {
testElasticsearch = (config?: AdminConfig) => {
return this.doFetch<StatusOK>(
`${this.getBaseRoute()}/elasticsearch/test`,
{method: 'post', body: JSON.stringify(config)},
@@ -3776,7 +3776,7 @@ export default class Client4 {
// Bot Routes
createBot = (bot: Bot) => {
createBot = (bot: Partial<Bot>) => {
return this.doFetch<Bot>(
`${this.getBotsRoute()}`,
{method: 'post', body: JSON.stringify(bot)},

Просмотреть файл

@@ -41,6 +41,13 @@ export type LogFilter = {
dateTo: LogDateTo;
}
export type LogFilterQuery = {
server_names: LogServerNames;
log_levels: LogLevels;
date_from: LogDateFrom;
date_to: LogDateTo;
}
export type AdminState = {
logs: LogObject[];
plainLogs: string[];