Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags 5 #71650

Closed
wants to merge 142 commits into from
Closed

Tags 5 #71650

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
0f7ddef
feat: 🎸 setup tags plugin
streamich Jun 28, 2020
61e756d
feat: 🎸 setup router
streamich Jun 29, 2020
e4bc297
feat: 🎸 setup browser part of tags plugin
streamich Jun 29, 2020
cce0ce0
Merge remote-tracking branch 'upstream/master' into tags
streamich Jun 29, 2020
710c157
feat: 🎸 improve tags saved object client
streamich Jun 29, 2020
3aa3328
feat: 🎸 add tag param validators
streamich Jun 29, 2020
f1d2c26
feat: 🎸 add .create() method to tags client
streamich Jun 29, 2020
e9fbe24
feat: 🎸 expose tag creation through HTTP
streamich Jun 29, 2020
6593c16
refactor: 💡 move TagsClient interface to /common folder
streamich Jun 29, 2020
a20af9e
Merge remote-tracking branch 'upstream/master' into tags
streamich Jun 29, 2020
34243fe
fix: 🐛 correctly setup create tag route
streamich Jun 29, 2020
8e657fd
test: 💍 add tag validator tests
streamich Jun 29, 2020
66bd133
fix: 🐛 allow no color
streamich Jun 29, 2020
e2b46b9
feat: 🎸 display tags in "Saved Objects" section of man app
streamich Jun 29, 2020
3f986b3
feat: 🎸 enable translations for tags plugin
streamich Jun 29, 2020
4499b75
feat: 🎸 set up Tags section in Kibana Management app
streamich Jun 29, 2020
eba702c
feat: 🎸 lazy load tags management section
streamich Jun 29, 2020
d54da0b
feat: 🎸 set up tags management section React context
streamich Jun 29, 2020
0844021
feat: 🎸 integrate routing and context into tags management app
streamich Jun 29, 2020
b11208e
feat: 🎸 add translations to landing page
streamich Jun 29, 2020
5958ad7
Merge remote-tracking branch 'upstream/master' into tags
streamich Jun 29, 2020
13b3e5a
feat: 🎸 add search table to landing page
streamich Jun 29, 2020
8bc126d
feat: 🎸 improve create new tag page
streamich Jun 29, 2020
e358de4
chore: 🤖 add Storybook to tags plugin
streamich Jun 29, 2020
a2f15db
feat: 🎸 add form to create new tag page
streamich Jun 29, 2020
2847b35
feat: 🎸 use breadcrumbs
streamich Jun 29, 2020
e21838a
feat: 🎸 add "Go back" buttom
streamich Jun 29, 2020
39d27fa
feat: 🎸 add TagsClient on frontend
streamich Jun 29, 2020
363da68
feat: 🎸 retrieve user in server TagsClient
streamich Jun 29, 2020
50b9932
feat: 🎸 create presentational new tag form
streamich Jun 29, 2020
55e408d
feat: 🎸 connect tag creation form to client
streamich Jun 29, 2020
d844b24
feat: 🎸 add React context for toasts service
streamich Jun 30, 2020
87a655c
feat: 🎸 use toats in tag create form
streamich Jun 30, 2020
04545b2
feat: 🎸 add translation
streamich Jun 30, 2020
d7cd154
Merge remote-tracking branch 'upstream/master' into tags
streamich Jun 30, 2020
e6b3a15
Merge remote-tracking branch 'origin/tags' into tags-2
streamich Jun 30, 2020
261400f
feat: 🎸 add tags.getAll() method and GET /api/tags/tags
streamich Jun 30, 2020
cae64cc
feat: 🎸 add tags service on frontend
streamich Jun 30, 2020
0593551
feat: 🎸 add <TagTable> component
streamich Jun 30, 2020
87c96d4
feat: 🎸 add tags state management
streamich Jun 30, 2020
bb7f44e
feat: 🎸 add create$ method to tag manager
streamich Jun 30, 2020
39511b3
feat: 🎸 autofocus create tag form and redirect back to list
streamich Jun 30, 2020
01e720d
feat: 🎸 add selectability to tags table and delete button
streamich Jun 30, 2020
fdba7d5
feat: 🎸 disable create tag form on loading
streamich Jun 30, 2020
bcb7f61
feat: 🎸 add ability to delete tags
streamich Jun 30, 2020
585cfed
feat: 🎸 improve tag table
streamich Jun 30, 2020
b80b50b
feat: 🎸 add tag attachment types
streamich Jun 30, 2020
e1d1011
feat: 🎸 add tag attachment client and saved object mappings
streamich Jun 30, 2020
2b8d3ec
feat: 🎸 expose tag attachment create route
streamich Jun 30, 2020
a04127a
Merge remote-tracking branch 'upstream/master' into tags-2
streamich Jul 1, 2020
b3c5d48
feat: 🎸 add tag attachments service on frontend
streamich Jul 1, 2020
0619ffd
feat: 🎸 add ability to view saved object JSON
streamich Jul 1, 2020
b0587c7
refactor: 💡 rename KRI to KID
streamich Jul 1, 2020
bc2e14b
feat: 🎸 improve tags client
streamich Jul 1, 2020
71db12e
feat: 🎸 expose tags CRUD API through HTTP
streamich Jul 1, 2020
d83d048
feat: 🎸 add latest tags client methods to frontend
streamich Jul 1, 2020
cf7bbd8
feat: 🎸 add KID parsing and formatting utilities
streamich Jul 1, 2020
e98f0be
test: 💍 add tests for KID parsing and formatting
streamich Jul 1, 2020
916adbb
feat: 🎸 add .getAttachedTags() method
streamich Jul 1, 2020
223e370
feat: 🎸 improve tag attachment client
streamich Jul 1, 2020
f092259
chore: 🤖 fix TypeScript errors
streamich Jul 1, 2020
dee4992
Merge remote-tracking branch 'upstream/master' into tags-2
streamich Jul 1, 2020
99bf0eb
feat: 🎸 add attachment deletion method
streamich Jul 1, 2020
d259902
Merge remote-tracking branch 'upstream/master' into tags-2
streamich Jul 2, 2020
8d0fb22
feat: 🎸 add tags_examples plugin
streamich Jul 2, 2020
6c23561
feat: 🎸 lazy load tags examples app and style page
streamich Jul 2, 2020
b5e9346
feat: 🎸 setup bfetch path for tag attachments
streamich Jul 2, 2020
c2598f3
feat: 🎸 add api route to bfetch
streamich Jul 2, 2020
62c9fb5
chore: 🤖 fix typescript errors
streamich Jul 2, 2020
785106d
feat: 🎸 add findResources() attachments method
streamich Jul 2, 2020
65df519
feat: 🎸 add findResources to frontend client
streamich Jul 2, 2020
cd5890b
feat: 🎸 add <Tag> component
streamich Jul 2, 2020
a15a9c1
feat: 🎸 add <TagList> component
streamich Jul 2, 2020
bf01ee8
feat: 🎸 memoize pure components
streamich Jul 2, 2020
3abea53
refactor: 💡 improve structure of TagsService
streamich Jul 2, 2020
aeb47d9
feat: 🎸 add context for tags service
streamich Jul 2, 2020
805216b
feat: 🎸 export <Tag> component from plugin contract
streamich Jul 2, 2020
9a6ef84
feat: 🎸 wire tags into example plugin
streamich Jul 2, 2020
4146f1b
feat: 🎸 connected connected <Tag> component to state manager
streamich Jul 2, 2020
7b42831
feat: 🎸 improve file structure of tag manager
streamich Jul 2, 2020
7e01b14
feat: 🎸 improve tag state management
streamich Jul 2, 2020
cc33df8
feat: 🎸 add <TagList> component
streamich Jul 2, 2020
a78a827
feat: 🎸 connect <TagList> component
streamich Jul 2, 2020
27fdac3
feat: 🎸 add connected <TagPicker> component
streamich Jul 2, 2020
85291b3
feat: 🎸 add <TagListEditable> component
streamich Jul 2, 2020
4a6c1a8
Merge remote-tracking branch 'upstream/master' into tags-2
streamich Jul 3, 2020
a2d6c6f
feat: 🎸 improve how Boom errors are presented
streamich Jul 3, 2020
61e785f
feat: 🎸 add <TagPickerForResource> component
streamich Jul 3, 2020
8be8776
feat: 🎸 add set attachmets server method
streamich Jul 3, 2020
33ff767
feat: 🎸 add tags set method to frontend client
streamich Jul 3, 2020
6f35e34
fix: 🐛 subscribe instead of tap
streamich Jul 3, 2020
b33ff7f
feat: 🎸 add tags to dashboards
streamich Jul 3, 2020
0ec46fe
feat: 🎸 add tags to dashboard listing page
streamich Jul 3, 2020
d9df4a1
feat: 🎸 add denormalized tags to Dashboard saved objects
streamich Jul 3, 2020
012bc0b
feat: 🎸 integrate tag picker into dashboard listing page
streamich Jul 3, 2020
2c2cbb8
feat: 🎸 integrate tags into dashboard listing filtering
streamich Jul 3, 2020
661b47b
Merge remote-tracking branch 'upstream/master' into tags-3
streamich Jul 3, 2020
156c90a
feat: 🎸 add management empty screen
streamich Jul 3, 2020
ee3e64e
feat: 🎸 improve create form look
streamich Jul 3, 2020
dc45dd8
feat: 🎸 sort saved object types
streamich Jul 3, 2020
23250dc
fix: 🐛 use tag icon
streamich Jul 3, 2020
2b783d0
feat: 🎸 improve creation form
streamich Jul 3, 2020
9fe5c88
Merge remote-tracking branch 'upstream/master' into tags-4
streamich Jul 4, 2020
5b0ade5
feat: 🎸 add key-value tag parsing ability
streamich Jul 4, 2020
2aa5e6c
feat: 🎸 parse tag to key-value on frontend
streamich Jul 4, 2020
2bbfdb3
feat: 🎸 improve tag creation form
streamich Jul 4, 2020
5b6605a
feat: 🎸 render Tags app stub
streamich Jul 4, 2020
39e0304
feat: 🎸 improve tags app
streamich Jul 4, 2020
8c6c631
Merge remote-tracking branch 'upstream/master' into tags-4
streamich Jul 5, 2020
a38d17d
feat: 🎸 create extensions plugin
streamich Jul 5, 2020
3c092cb
feat: 🎸 add tags to visualization page
streamich Jul 5, 2020
e5baa18
feat: 🎸 add tags to Visualize landing page
streamich Jul 5, 2020
fc7ccfa
feat: 🎸 add utility to install sample tags
streamich Jul 5, 2020
b7f55b0
feat: 🎸 add <TagPicker> to tags page and display better sidebar
streamich Jul 5, 2020
108c511
feat: 🎸 load search results on tags page
streamich Jul 5, 2020
e9c381d
feat: 🎸 add KID service
streamich Jul 5, 2020
0a327d4
feat: 🎸 use query search params to store tags
streamich Jul 5, 2020
5aefe71
feat: 🎸 improve KID <Card>
streamich Jul 5, 2020
6d50c79
feat: 🎸 implement KID providers for Dashboard and Visualization
streamich Jul 5, 2020
7aee88a
feat: 🎸 improve tags app layout
streamich Jul 5, 2020
a78cf11
fix: 🐛 don't fail on async visualization ID
streamich Jul 5, 2020
13dd3fe
feat: 🎸 sort tags in <TagPicker>
streamich Jul 5, 2020
f28034e
fix: 🐛 sort resource tags
streamich Jul 5, 2020
2f3332f
chore: 🤖 fix TypeScript errors
streamich Jul 5, 2020
f27d709
fix: 🐛 correctly align list of tags
streamich Jul 5, 2020
31565b0
feat: 🎸 make landing pages stretch 100%
streamich Jul 5, 2020
586d680
Merge remote-tracking branch 'upstream/master' into tags-4
streamich Jul 6, 2020
b4b7807
feat: 🎸 add references and namespaces to saved object preview
streamich Jul 6, 2020
466ee35
Merge remote-tracking branch 'upstream/master' into tags-4
streamich Jul 6, 2020
1109372
Merge remote-tracking branch 'upstream/master' into tags-4
streamich Jul 6, 2020
a650f5e
feat: 🎸 add UUID validator
streamich Jul 6, 2020
a054374
feat: 🎸 generate tag ID on frontend
streamich Jul 6, 2020
24188d5
feat: 🎸 optimistically create tags on frontend
streamich Jul 6, 2020
5d851fe
refactor: 💡 move tag create form out to global components
streamich Jul 6, 2020
2400620
feat: 🎸 add tag edit form
streamich Jul 6, 2020
4098a2d
refactor: 💡 rename tags provider
streamich Jul 6, 2020
9a5ba52
fix: 🐛 correct links to edit page
streamich Jul 6, 2020
93070c5
feat: 🎸 add optimistic updates to update form
streamich Jul 7, 2020
619eb02
fix: 🐛 improve tag update notification text
streamich Jul 7, 2020
9106f49
Merge remote-tracking branch 'upstream/master' into tags-4
streamich Jul 7, 2020
c0264c9
fix: 🐛 fix import error
streamich Jul 7, 2020
e37aa8a
feat: 🎸 improve examples plugin
streamich Jul 14, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ export const storybookAliases = {
embeddable: 'src/plugins/embeddable/scripts/storybook.js',
infra: 'x-pack/legacy/plugins/infra/scripts/storybook.js',
security_solution: 'x-pack/plugins/security_solution/scripts/storybook.js',
tags: 'x-pack/plugins/tags/scripts/storybook.js',
ui_actions_enhanced: 'x-pack/plugins/ui_actions_enhanced/scripts/storybook.js',
};
25 changes: 25 additions & 0 deletions src/plugins/bfetch/common/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export type ApiMethod<Payload = unknown, Result = unknown> = (payload: Payload) => Promise<Result>;

export interface ApiMethodRequest<Payload = unknown> {
name: string;
payload: Payload;
}
1 change: 1 addition & 0 deletions src/plugins/bfetch/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ export * from './util';
export * from './streaming';
export * from './buffer';
export * from './batch';
export * from './api';
2 changes: 2 additions & 0 deletions src/plugins/bfetch/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const createSetupContract = (): Setup => {
const setupContract: Setup = {
fetchStreaming: jest.fn(),
batchedFunction: jest.fn(),
createApi: jest.fn(),
};
return setupContract;
};
Expand All @@ -36,6 +37,7 @@ const createStartContract = (): Start => {
const startContract: Start = {
fetchStreaming: jest.fn(),
batchedFunction: jest.fn(),
createApi: jest.fn(),
};

return startContract;
Expand Down
15 changes: 14 additions & 1 deletion src/plugins/bfetch/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
*/

import { CoreStart, PluginInitializerContext, CoreSetup, Plugin } from 'src/core/public';
import { Ensure } from '@kbn/utility-types';
import { fetchStreaming as fetchStreamingStatic, FetchStreamingParams } from './streaming';
import { removeLeadingSlash } from '../common';
import { removeLeadingSlash, ApiMethod } from '../common';
import {
createStreamingBatchedFunction,
BatchedFunc,
Expand All @@ -37,6 +38,12 @@ export interface BfetchPublicContract {
batchedFunction: <Payload, Result extends object>(
params: StreamingBatchedFunctionParams<Payload, Result>
) => BatchedFunc<Payload, Result>;
createApi: <Api extends object>(
url: string
) => <K extends keyof Api>(
name: K,
payload: Parameters<Ensure<Api[K], ApiMethod>>[0]
) => ReturnType<Ensure<Api[K], ApiMethod>>;
}

export type BfetchPublicSetup = BfetchPublicContract;
Expand All @@ -61,9 +68,15 @@ export class BfetchPublicPlugin
const fetchStreaming = this.fetchStreaming(version, basePath);
const batchedFunction = this.batchedFunction(fetchStreaming);

const createApi: BfetchPublicContract['createApi'] = ((url: string) => {
const fn = batchedFunction({ url });
return async (name, payload) => await fn({ name, payload } as unknown);
}) as BfetchPublicContract['createApi'];

this.contract = {
fetchStreaming,
batchedFunction,
createApi,
};

return this.contract;
Expand Down
1 change: 1 addition & 0 deletions src/plugins/bfetch/server/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const createSetupContract = (): Setup => {
addBatchProcessingRoute: jest.fn(),
addStreamingResponseRoute: jest.fn(),
createStreamingRequestHandler: jest.fn(),
createApiRoute: jest.fn(),
};
return setupContract;
};
Expand Down
56 changes: 49 additions & 7 deletions src/plugins/bfetch/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
KibanaRequest,
RouteMethod,
RequestHandler,
RequestHandlerContext,
} from 'src/core/server';
import { schema } from '@kbn/config-schema';
import { Subject } from 'rxjs';
Expand All @@ -39,6 +40,7 @@ import {
} from '../common';
import { StreamingRequestHandler } from './types';
import { createNDJSONStream } from './streaming';
import { ApiMethod, ApiMethodRequest } from '../common';

// eslint-disable-next-line
export interface BfetchServerSetupDependencies {}
Expand All @@ -54,12 +56,20 @@ export interface BatchProcessingRouteParams<BatchItemData, BatchItemResult> {
export interface BfetchServerSetup {
addBatchProcessingRoute: <BatchItemData extends object, BatchItemResult extends object>(
path: string,
handler: (request: KibanaRequest) => BatchProcessingRouteParams<BatchItemData, BatchItemResult>
handler: (
request: KibanaRequest,
context: RequestHandlerContext
) => BatchProcessingRouteParams<BatchItemData, BatchItemResult>
) => void;

addStreamingResponseRoute: <Payload, Response>(
path: string,
params: (request: KibanaRequest) => StreamingResponseHandler<Payload, Response>
params: (
request: KibanaRequest,
context: RequestHandlerContext
) => StreamingResponseHandler<Payload, Response>
) => void;

/**
* Create a streaming request handler to be able to use an Observable to return chunked content to the client.
* This is meant to be used with the `fetchStreaming` API of the `bfetch` client-side plugin.
Expand All @@ -83,14 +93,31 @@ export interface BfetchServerSetup {
* return results$;
* })
* )}
*
* ```
*
* @param streamHandler
*/
createStreamingRequestHandler: <Response, P, Q, B, Method extends RouteMethod = any>(
streamHandler: StreamingRequestHandler<Response, P, Q, B, Method>
) => RequestHandler<P, Q, B, Method>;

/**
* Creates a batch processing route that can route between a map of API methods.
*
* @example
* ```ts
* plugins.bfetch.createApiRoute('/calculator', {
* add: async ({a, b}) => ({ result: a + b }),
* subtract: async ({a, b}) => ({ result: a - b }),
* multiply: async ({a, b}) => ({ result: a * b }),
* divide: async ({a, b}) => ({ result: a / b }),
* });
* ```
*
* @param path
* @param api
*/
createApiRoute: (path: string, api: Record<string, ApiMethod<object, object>>) => void;
}

// eslint-disable-next-line
Expand Down Expand Up @@ -119,10 +146,22 @@ export class BfetchServerPlugin
const addBatchProcessingRoute = this.addBatchProcessingRoute(addStreamingResponseRoute);
const createStreamingRequestHandler = this.createStreamingRequestHandler({ logger });

const createApiRoute: BfetchServerSetup['createApiRoute'] = (path, api) => {
addBatchProcessingRoute(path, (request) => ({
onBatchItem: async ({ name, payload }: ApiMethodRequest<object>) => {
if (typeof name !== 'string') throw new Error('Api method name should be a string.');
if (!api.hasOwnProperty(name))
throw new Error(`Api method [name = ${name}] does not exist.`);
return await api[name](payload);
},
}));
};

return {
addBatchProcessingRoute,
addStreamingResponseRoute,
createStreamingRequestHandler,
createApiRoute,
};
}

Expand All @@ -147,7 +186,7 @@ export class BfetchServerPlugin
},
},
async (context, request, response) => {
const handlerInstance = handler(request);
const handlerInstance = handler(request, context);
const data = request.body;
return response.ok({
headers: streamingHeaders,
Expand Down Expand Up @@ -181,13 +220,16 @@ export class BfetchServerPlugin
E extends ErrorLike = ErrorLike
>(
path: string,
handler: (request: KibanaRequest) => BatchProcessingRouteParams<BatchItemData, BatchItemResult>
handler: (
request: KibanaRequest,
context: RequestHandlerContext
) => BatchProcessingRouteParams<BatchItemData, BatchItemResult>
) => {
addStreamingResponseRoute<
BatchRequestData<BatchItemData>,
BatchResponseItem<BatchItemResult, E>
>(path, (request) => {
const handlerInstance = handler(request);
>(path, (request, context) => {
const handlerInstance = handler(request, context);
return {
getResponseStream: ({ batch }) => {
const subject = new Subject<BatchResponseItem<BatchItemResult, E>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ beforeEach(async () => {
overlays: coreStart.overlays,
savedObjectMetaData: {} as any,
uiActions: {} as any,
getRenderBeforeDashboard: () => () => null,
};
const input = getSampleDashboardInput({
panels: {
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/dashboard/public/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ import { SavedObjectLoader, SavedObjectsStart } from '../../../saved_objects/pub
import 'angular-sanitize';
// required for ngRoute
import 'angular-route';
import { DashboardContainer } from './embeddable';
import { TagPickerType } from '../plugin';

export interface RenderDeps {
pluginInitializerContext: PluginInitializerContext;
Expand Down Expand Up @@ -74,6 +76,9 @@ export interface RenderDeps {
scopedHistory: () => ScopedHistory;
savedObjects: SavedObjectsStart;
restorePreviousUrl: () => void;
renderBeforeDashboard: (dashboard: DashboardContainer) => React.ReactNode;
renderTags: (kid: string) => React.ReactNode;
getTagPicker: () => TagPickerType;
}

let angularModuleInstance: IModule | null = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export interface DashboardContainerOptions {
SavedObjectFinder: React.ComponentType<any>;
ExitFullScreenButton: React.ComponentType<any>;
uiActions: UiActionsStart;
getRenderBeforeDashboard: () => (dashboard: DashboardContainer) => React.ReactNode;
}

export type DashboardReactContextValue = KibanaReactContextValue<DashboardContainerOptions>;
Expand All @@ -115,6 +116,7 @@ export class DashboardContainer extends Container<InheritedChildInput, Dashboard
options.embeddable.getEmbeddableFactory,
parent
);

this.embeddablePanel = options.embeddable.getEmbeddablePanel(stateTransfer);
}

Expand Down Expand Up @@ -188,6 +190,7 @@ export class DashboardContainer extends Container<InheritedChildInput, Dashboard
ReactDOM.render(
<I18nProvider>
<KibanaContextProvider services={this.options}>
{this.options.getRenderBeforeDashboard()(this)}
<DashboardViewport
renderEmpty={this.renderEmpty}
container={this}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ interface StartServices {
SavedObjectFinder: React.ComponentType<any>;
ExitFullScreenButton: React.ComponentType<any>;
uiActions: UiActionsStart;
getRenderBeforeDashboard: () => (dashboard: DashboardContainer) => React.ReactNode;
}

export type DashboardContainerFactory = EmbeddableFactory<
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/dashboard/public/application/legacy_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export function initDashboardApp(app, deps) {
app.directive('dashboardListing', function (reactDirective) {
return reactDirective(DashboardListing, [
['core', { watchDepth: 'reference' }],
['renderTags', { watchDepth: 'reference' }],
['tagPicker', { watchDepth: 'reference' }],
['createItem', { watchDepth: 'reference' }],
['getViewUrl', { watchDepth: 'reference' }],
['editItem', { watchDepth: 'reference' }],
Expand Down Expand Up @@ -138,6 +140,12 @@ export function initDashboardApp(app, deps) {
addHelpMenuToAppChrome(deps.chrome, deps.core.docLinks);
$scope.core = deps.core;

$scope.renderTags = (data) => {
const kid = `kid:::so:saved_objects/dashboard/${data.id}`;
return deps.renderTags(kid);
};
$scope.tagPicker = deps.getTagPicker();

$scope.$on('$destroy', () => {
stopSyncingQueryServiceStateWithUrl();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class DashboardListing extends React.Component {
return (
<I18nProvider>
<TableListView
TagPicker={this.props.tagPicker}
headingId="dashboardListingHeading"
createItem={this.props.hideWriteControls ? null : this.props.createItem}
findItems={this.props.findItems}
Expand Down Expand Up @@ -174,13 +175,22 @@ export class DashboardListing extends React.Component {
dataType: 'string',
sortable: true,
},
{
name: 'Tags',
sortable: false,
render: (data) => {
return this.props.renderTags(data);
},
},
];
return tableColumns;
}
}

DashboardListing.propTypes = {
renderTags: PropTypes.func.isRequired,
createItem: PropTypes.func.isRequired,
tagPicker: PropTypes.func.isRequired,
findItems: PropTypes.func.isRequired,
deleteItems: PropTypes.func.isRequired,
editItem: PropTypes.func.isRequired,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<dashboard-listing
core="core"
create-item="create"
render-tags="renderTags"
tag-picker="tagPicker"
get-view-url="getViewUrl"
edit-item="editItem"
find-items="find"
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dashboard/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export {
} from './application';
export { DashboardConstants, createDashboardEditUrl } from './dashboard_constants';

export { DashboardStart, DashboardUrlGenerator } from './plugin';
export { DashboardSetup, DashboardStart, DashboardUrlGenerator } from './plugin';
export { DASHBOARD_APP_URL_GENERATOR, createDashboardUrlGenerator } from './url_generator';
export { addEmbeddableToDashboardUrl } from './url_utils/url_helper';
export { SavedObjectDashboard } from './saved_dashboards';
Expand Down
Loading