Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
[Maps] replace angular serviceSettings service with EmsClient (elasti…
Browse files Browse the repository at this point in the history
…c#32725) (elastic#32731)

* [Maps] replace angular serviceSettings service with EmsClient

* clean up
  • Loading branch information
nreese authored Mar 8, 2019
1 parent 3bcbf1f commit 7b4ff2d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/maps/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import 'react-vis/dist/style.css';

import 'mapbox-gl/dist/mapbox-gl.css';

import 'ui/vis/map/service_settings';
import './angular/services/gis_map_saved_object_loader';
import './angular/map_controller';
import listingTemplate from './angular/listing_ng_wrapper.html';
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/maps/public/kibana_services.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { getRequestInspectorStats, getResponseInspectorStats } from 'ui/courier/
export const timeService = timefilter;
export let indexPatternService;
export let SearchSource;
export let emsServiceSettings;

export async function fetchSearchSourceAndRecordWithInspector({ searchSource, requestId, requestName, requestDesc, inspectorAdapters }) {
const inspectorRequest = inspectorAdapters.requests.start(
Expand Down Expand Up @@ -40,5 +39,4 @@ uiModules.get('app/maps').run(($injector) => {
indexPatternService = $injector.get('indexPatterns');
const Private = $injector.get('Private');
SearchSource = Private(SearchSourceProvider);
emsServiceSettings = $injector.get('serviceSettings');
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import { AbstractVectorSource } from '../vector_source';
import React from 'react';
import { GIS_API_PATH, EMS_FILE } from '../../../../../common/constants';
import { emsServiceSettings } from '../../../../kibana_services';
import { getEmsVectorFilesMeta } from '../../../../meta';
import { EMSFileCreateSourceEditor } from './create_source_editor';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -68,7 +67,14 @@ export class EMSFileSource extends AbstractVectorSource {
}

async getImmutableProperties() {
const emsLink = await emsServiceSettings.getEMSHotLink({ id: this._descriptor.id });
let emsLink;
try {
const emsVectorFileMeta = await this._getEmsVectorFileMeta();
emsLink = emsVectorFileMeta.emsLink;
} catch(error) {
// ignore error if EMS layer id could not be found
}

return [
{
label: getDataSourceLabel(),
Expand All @@ -79,7 +85,8 @@ export class EMSFileSource extends AbstractVectorSource {
defaultMessage: `Layer`,
}),
value: this._descriptor.id,
link: emsLink }
link: emsLink
}
];
}

Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/maps/server/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export function initRoutes(server, licenseUid) {
fields: fileLayer.getFieldsInLanguage(),
url: fileLayer.getDefaultFormatUrl(),
format: format, //legacy: format and meta are split up
meta: meta //legacy, format and meta are split up
meta: meta, //legacy, format and meta are split up,
emsLink: fileLayer.getEMSHotLink()
};
});

Expand Down

0 comments on commit 7b4ff2d

Please sign in to comment.