Skip to content

Commit

Permalink
Fix syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewvc committed Dec 19, 2019
1 parent 3947cac commit 8247b21
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

import { UMSavedObjectsAdapter } from './types';
import uptimeIndexPattern from './heartbeat_index_pattern.json';
import { uptimeSourceConfigurationSavedObjectType, uptimeSourceConfigurationSavedObjectId, defaultSourceConfiguration } from '../../sources';
import {
uptimeSourceConfigurationSavedObjectType,
uptimeSourceConfigurationSavedObjectId,
defaultSourceSettings,
} from '../../sources';

export const savedObjectsAdapter: UMSavedObjectsAdapter = {
getUptimeIndexPattern: async client => {
Expand All @@ -25,12 +29,12 @@ export const savedObjectsAdapter: UMSavedObjectsAdapter = {
},
getUptimeSourceSettings: async client => {
try {
return await client.get(uptimeSourceConfigurationSavedObjectType, uptimeSourceConfigurationSavedObjectId)
} catch (e) {
return await client.create(
return await client.get(
uptimeSourceConfigurationSavedObjectType,
defaultSourceConfiguration,
)
uptimeSourceConfigurationSavedObjectId
);
} catch (e) {
return await client.create(uptimeSourceConfigurationSavedObjectType, defaultSourceSettings);
}
}
},
};
8 changes: 7 additions & 1 deletion x-pack/legacy/plugins/uptime/server/lib/sources/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
export * from './saved_object_mappings';
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export * from './saved_object_mappings';

0 comments on commit 8247b21

Please sign in to comment.