Skip to content

Commit

Permalink
[Automation] ISTANBUL PRESET PATH is not working fine with constructo…
Browse files Browse the repository at this point in the history
…r(private foo) (elastic#42683)
  • Loading branch information
alexwizp committed Aug 9, 2019
1 parent 0af7e33 commit 4e0bf3f
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class VisualizeEmbeddableFactory extends EmbeddableFactory<
VisualizationAttributes
> {
public readonly type = VISUALIZE_EMBEDDABLE_TYPE;
private readonly visTypes: VisTypesRegistry;

static async createVisualizeEmbeddableFactory(): Promise<VisualizeEmbeddableFactory> {
const $injector = await chrome.dangerouslyGetActiveInjector();
Expand All @@ -88,32 +89,31 @@ export class VisualizeEmbeddableFactory extends EmbeddableFactory<
return new VisualizeEmbeddableFactory(visTypes);
}

constructor(private visTypes: VisTypesRegistry) {
constructor(visTypes: VisTypesRegistry) {
super({
savedObjectMetaData: {
name: i18n.translate('kbn.visualize.savedObjectName', { defaultMessage: 'Visualization' }),
type: 'visualization',
getIconForSavedObject: savedObject => {
if (!this.visTypes) {
if (!visTypes) {
return 'visualizeApp';
}
return (
this.visTypes.byName[JSON.parse(savedObject.attributes.visState).type].icon ||
'visualizeApp'
visTypes.byName[JSON.parse(savedObject.attributes.visState).type].icon || 'visualizeApp'
);
},
getTooltipForSavedObject: savedObject => {
if (!this.visTypes) {
if (!visTypes) {
return '';
}
return `${savedObject.attributes.title} (${this.visTypes.byName[JSON.parse(savedObject.attributes.visState).type].title})`;
return `${savedObject.attributes.title} (${visTypes.byName[JSON.parse(savedObject.attributes.visState).type].title})`;
},
showSavedObject: savedObject => {
if (!this.visTypes) {
if (!visTypes) {
return false;
}
const typeName: string = JSON.parse(savedObject.attributes.visState).type;
const visType = this.visTypes.byName[typeName];
const visType = visTypes.byName[typeName];
if (!visType) {
return false;
}
Expand All @@ -124,6 +124,8 @@ export class VisualizeEmbeddableFactory extends EmbeddableFactory<
},
},
});

this.visTypes = visTypes;
}

public isEditable() {
Expand Down

0 comments on commit 4e0bf3f

Please sign in to comment.