Skip to content

Commit

Permalink
[ML] PR remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Oct 9, 2019
1 parent e1d7921 commit 0203bb4
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
14 changes: 8 additions & 6 deletions x-pack/legacy/plugins/ml/common/types/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@
*/

import { Datafeed, Job } from '../../public/jobs/new_job_new/common/job_creator/configs';
import { SavedObjectAttributes } from '../../../../../../target/types/core/server';

export interface ModuleJob {
id: string;
config: Partial<Job>;
}

export interface KibanaObjectConfig extends SavedObjectAttributes {
description: string;
title: string;
version: number;
}

export interface KibanaObject {
id: string;
title: string;
config: {
kibanaSavedObjectMeta: { searchSourceJSON: string };
description: string;
title: string;
version: number;
};
config: KibanaObjectConfig;
}

export interface KibanaObjects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface KibanaObjectItemProps {

export const KibanaObjects: FC<KibanaObjectItemProps> = memo(
({ objectType, kibanaObjects, isSaving }) => {
const kibanaObjectLabels: { [key: string]: string } = {
const kibanaObjectLabels: Record<string, string> = {
dashboard: i18n.translate('xpack.ml.newJob.simple.recognize.dashboardsLabel', {
defaultMessage: 'Dashboards',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ interface PageProps {
}

export enum SAVE_STATE {
NOT_SAVED = 'NOT_SAVED',
SAVING = 'SAVING',
SAVED = 'SAVED',
FAILED = 'FAILED',
PARTIAL_FAILURE = 'PARTIAL_FAILURE',
NOT_SAVED,
SAVING,
SAVED,
FAILED,
PARTIAL_FAILURE,
}

export const Page: FC<PageProps> = ({ moduleId, existingGroupIds }) => {
Expand All @@ -98,7 +98,7 @@ export const Page: FC<PageProps> = ({ moduleId, existingGroupIds }) => {
jobGroups: [] as string[],
});
const [jobs, setJobs] = useState<ModuleJobUI[]>([]);
const [kibanaObjects, setKibanaObjects] = useState<KibanaObjects>({} as KibanaObjects);
const [kibanaObjects, setKibanaObjects] = useState<KibanaObjects>({});
const [saveState, setSaveState] = useState<SAVE_STATE>(SAVE_STATE.NOT_SAVED);
const [resultsUrl, setResultsUrl] = useState<string>('');
const [validationResult, setValidationResult] = useState<any>({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import chrome from 'ui/chrome';
import { i18n } from '@kbn/i18n';
import { toastNotifications } from 'ui/notify';
import { IPrivate } from 'ui/private';
// @ts-ignore
import { mlJobService } from 'plugins/ml/services/job_service';
// @ts-ignore
import { ml } from 'plugins/ml/services/ml_api_service';
import { mlJobService } from '../../../services/job_service';
import { ml } from '../../../services/ml_api_service';

/**
* Checks whether the jobs in a data recognizer module have been created.
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/ml/public/services/job_service.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ExistingJobsAndGroups {

declare interface JobService {
currentJob: any;
createResultsUrlForJobs: () => string;
createResultsUrlForJobs: (jobs: any[], target: string) => string;
tempJobCloningObjects: {
job: any;
skipTimeRangeStep: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ declare interface Ml {
getDatafeedStats(obj: object): Promise<any>;
esSearch(obj: object): any;
getIndices(): Promise<EsIndex[]>;
dataRecognizerModuleJobsExist(obj: { moduleId: string }): Promise<any>;
getDataRecognizerModule(obj: { moduleId: string }): Promise<any>;
setupDataRecognizerConfig(obj: object): Promise<any>;
getTimeFieldRange(obj: object): Promise<GetTimeFieldRangeResponse>;
Expand Down

0 comments on commit 0203bb4

Please sign in to comment.