Skip to content

Commit

Permalink
Add TODOs
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
  • Loading branch information
ohltyler committed Dec 22, 2022
1 parent 5204f3d commit c48d422
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
6 changes: 1 addition & 5 deletions src/plugins/vis_augmenter/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ export function plugin(initializerContext: PluginInitializerContext) {
}
export { VisAugmenterSetup, VisAugmenterStart };

export {
SavedAugmentVisLoader,
createSavedAugmentVisLoader,
createAugmentVisSavedObject,
} from './saved_augment_vis';
export * from './saved_augment_vis';

export { ISavedAugmentVis, VisLayerExpressionFn, AugmentVisSavedObject } from './types';
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export function createSavedAugmentVisClass(services: SavedObjectOpenSearchDashbo
version: 1,
},
});
// TODO: determine if this saved obj should be visible in saved_obj_management plugin.
// if not, we can set showInRecentlyAccessed to false and not persist any edit URL
// probably set to false since this saved obj should be hidden by default
this.showInRecentlyAccessed = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@ import {
} from '../../../saved_objects/public';
import { createSavedAugmentVisClass } from './_saved_augment_vis';

// currently visualizations have a 'vis_types' plugin that maintains all of the
// different vis types. in the saved vis loader, those types are then imported here,
// such that if a type returned by the client isn't in the list, the request is
// rejected. essentially just post-processing of the returned obj. We may do something
// same for the vis integration augment fn types, since we will have a set list
// of eligible augment fn types for plugins to choose from, when creating their saved objs.
//
// for now, and until it's determined where this code will live (separate plugin, within
// dashboards, etc.), we will not enforce the fn types.
// TODO: determine if there should be added enforcement on the augment fn types, and reject
// saved objs that don't have a valid one. Currently, visualizations does something similar
// in the saved vis loader.

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface SavedObjectOpenSearchDashboardsServicesWithAugmentVis
Expand All @@ -30,9 +24,9 @@ export function createSavedAugmentVisLoader(
const { savedObjectsClient } = services;

class SavedObjectLoaderAugmentVis extends SavedObjectLoader {
// this is doing a lightweight version of injectReferences
// essentially we want to inject the saved object id/type
// by fetching the saved object reference and parsing out the id/type
// TODO: below fn is extracting the id & type from the source. Is this needed
// when we already have inject/extract reference fns?
// need to confirm if this codepath is different than the ones using the reference fns
mapHitSource = (source: Record<string, any>, id: string) => {
source.id = id;
source.savedObjectId = get(source, 'savedObjectReference.id', '');
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/vis_augmenter/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export interface ISavedAugmentVis {
description?: string;
pluginResourceId: string;
savedObjectName?: string;
// TODO: we may be able to remove savedObjectType field now that it's always assumed
// it will be a visualization
savedObjectType?: string;
savedObjectId?: string;
visLayerExpressionFn: VisLayerExpressionFn;
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16566,6 +16566,11 @@ strip-json-comments@3.1.1, strip-json-comments@^3.0.1, strip-json-comments@^3.1.
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==

strip-json-comments@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=

strong-log-transformer@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/strong-log-transformer/-/strong-log-transformer-2.1.0.tgz#0f5ed78d325e0421ac6f90f7f10e691d6ae3ae10"
Expand Down

0 comments on commit c48d422

Please sign in to comment.