[ML] Data recognizer UI improvements (#18804)

* [ML] Data recognizer UI improvements

* rolling back accidental change
This commit is contained in:
James Gowdy 2018-05-04 14:02:43 +01:00 committed by GitHub
parent 511a6b0904
commit ed7f6983f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 25 deletions

View file

@ -118,11 +118,7 @@ module
jobLabel: '',
jobGroups: [],
jobs: [],
kibanaObjects: {
dashboard: [],
search: [],
visualization: []
},
kibanaObjects: {},
start: 0,
end: 0,
query,
@ -137,9 +133,7 @@ module
$scope.overallState = SAVE_STATE.NOT_SAVED;
$scope.formConfig.jobs = [];
$scope.formConfig.filters = [];
$scope.formConfig.kibanaObjects.dashboard = [];
$scope.formConfig.kibanaObjects.search = [];
$scope.formConfig.kibanaObjects.visualization = [];
$scope.formConfig.kibanaObjects = {};
loadJobConfigs();
};
@ -188,14 +182,14 @@ module
// populate the kibana saved objects
if (resp.kibana) {
_.each(resp.kibana, (obj, key) => {
obj.forEach((o) => {
$scope.formConfig.kibanaObjects[key].push({
$scope.formConfig.kibanaObjects[key] = obj.map((o) => {
return {
id: o.id,
title: o.title,
saveState: SAVE_STATE.NOT_SAVED,
config: o.config,
exists: false
});
};
});
});
// check to see if any of the saved objects already exist.

View file

@ -105,6 +105,10 @@ export class DataRecognizer {
}
async searchForFields(moduleConfig, indexPattern) {
if (moduleConfig.query === undefined) {
return false;
}
const index = indexPattern;
const size = 0;
const body = {
@ -158,21 +162,23 @@ export class DataRecognizer {
}));
// load all of the kibana saved objects
const kKeys = Object.keys(manifestJSON.kibana);
await Promise.all(kKeys.map(async (key) => {
kibana[key] = [];
await Promise.all(manifestJSON.kibana[key].map(async (obj) => {
const kConfig = await this.readFile(`${this.modulesDir}/${dirName}/${KIBANA_DIR}/${key}/${obj.file}`);
// use the file name for the id
const kId = obj.file.replace('.json', '');
const config = JSON.parse(kConfig);
kibana[key].push({
id: kId,
title: config.title,
config
});
if (manifestJSON.kibana !== undefined) {
const kKeys = Object.keys(manifestJSON.kibana);
await Promise.all(kKeys.map(async (key) => {
kibana[key] = [];
await Promise.all(manifestJSON.kibana[key].map(async (obj) => {
const kConfig = await this.readFile(`${this.modulesDir}/${dirName}/${KIBANA_DIR}/${key}/${obj.file}`);
// use the file name for the id
const kId = obj.file.replace('.json', '');
const config = JSON.parse(kConfig);
kibana[key].push({
id: kId,
title: config.title,
config
});
}));
}));
}));
}
return {
jobs,