Skip to content

Commit

Permalink
adding categories for more apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Michail Yasonik committed Dec 20, 2019
1 parent fe54ec9 commit 8a82938
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/core/public/chrome/ui/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import {
import { HttpStart } from '../../../http';
import { ChromeHelpExtension } from '../../chrome_service';
import { ApplicationStart, InternalApplicationStart } from '../../../application/types';
import { NavLinkWrapper } from '../../nav_links/nav_link';

// Providing a buffer between the limit and the cut off index
// protects from truncating just the last couple (6) characters
Expand Down Expand Up @@ -191,6 +190,7 @@ const categoryIcon = {
};

function getGroupIcon(groupName: string) {
// @ts-ignore TODO@myasonik
return categoryIcon[groupName];
}

Expand Down Expand Up @@ -366,7 +366,8 @@ class HeaderUI extends Component<Props, State> {

public renderNavLinks() {
const isOSS = false; // TODO@myasonik
if (isOSS || this.state.navLinks.length < 7) {
const disableGroupedNavSetting = false; // TODO@myasonik
if (isOSS || disableGroupedNavSetting || this.state.navLinks.length < 7) {
return (
<EuiNavDrawer
ref={this.navDrawerRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export interface InjectedMetadataParams {
basePath: string;
serverName: string;
devMode: boolean;
category: AppCategory;
uiSettings: {
defaults: Record<string, UiSettingsParams>;
user?: Record<string, UserProvidedValues>;
Expand Down
2 changes: 2 additions & 0 deletions src/legacy/ui/ui_exports/ui_export_types/ui_apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function applySpecDefaults(spec, type, pluginSpec) {
linkToLastSubUrl = true,
listed = !hidden,
url = `/app/${id}`,
category,
} = spec;

if (spec.injectVars) {
Expand Down Expand Up @@ -61,6 +62,7 @@ function applySpecDefaults(spec, type, pluginSpec) {
linkToLastSubUrl,
listed,
url,
category,
};
}

Expand Down
8 changes: 8 additions & 0 deletions x-pack/legacy/plugins/canvas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import { mappings } from './server/mappings';
import { CANVAS_APP, CANVAS_TYPE, CUSTOM_ELEMENT_TYPE } from './common/lib';
import { migrations } from './migrations';

export const AppCategoryObj = {
analyze: 'analyze',
observability: 'observability',
security: 'security',
management: 'management',
};

export function canvas(kibana) {
return new kibana.Plugin({
id: CANVAS_APP,
Expand All @@ -23,6 +30,7 @@ export function canvas(kibana) {
icon: 'plugins/canvas/icon.svg',
euiIconType: 'canvasApp',
main: 'plugins/canvas/legacy_start',
category: AppCategoryObj.analyze,
},
interpreter: [
'plugins/canvas/browser_functions',
Expand Down
10 changes: 9 additions & 1 deletion x-pack/legacy/plugins/dashboard_mode/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@ import { createDashboardModeRequestInterceptor } from './server';

import { i18n } from '@kbn/i18n';

export const AppCategoryObj = {
analyze: 'analyze',
observability: 'observability',
security: 'security',
management: 'management',
};

// Copied largely from plugins/kibana/index.js. The dashboard viewer includes just the dashboard section of
// the standard kibana plugin. We don't want to include code for the other links (visualize, dev tools, etc)
// the standard kibana plugin. We don't want to include code for the other links (visualize, dev tools, etc)
// since it's view only, but we want the urls to be the same, so we are using largely the same setup.
export function dashboardMode(kibana) {
const kbnBaseUrl = '/app/kibana';
Expand Down Expand Up @@ -64,6 +71,7 @@ export function dashboardMode(kibana) {
}
),
icon: 'plugins/kibana/dashboard/assets/dashboard.svg',
category: AppCategoryObj.analyze,
},
],
},
Expand Down
8 changes: 8 additions & 0 deletions x-pack/legacy/plugins/graph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ import migrations from './migrations';
import mappings from './mappings.json';
import { LegacyPluginInitializer } from '../../../../src/legacy/plugin_discovery/types';

export const AppCategoryObj = {
analyze: 'analyze',
observability: 'observability',
security: 'security',
management: 'management',
};

export const graph: LegacyPluginInitializer = kibana => {
return new kibana.Plugin({
id: 'graph',
Expand All @@ -25,6 +32,7 @@ export const graph: LegacyPluginInitializer = kibana => {
icon: 'plugins/graph/icon.png',
euiIconType: 'graphApp',
main: 'plugins/graph/index',
category: AppCategoryObj.analyze,
},
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
mappings,
Expand Down
8 changes: 8 additions & 0 deletions x-pack/legacy/plugins/maps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ import _ from 'lodash';
import { MapPlugin } from './server/plugin';
import { APP_ID, APP_ICON, createMapPath, MAP_SAVED_OBJECT_TYPE } from './common/constants';

export const AppCategoryObj = {
analyze: 'analyze',
observability: 'observability',
security: 'security',
management: 'management',
};

export function maps(kibana) {
return new kibana.Plugin({
// task_manager could be required, but is only used for telemetry
Expand All @@ -30,6 +37,7 @@ export function maps(kibana) {
main: 'plugins/maps/legacy',
icon: 'plugins/maps/icon.svg',
euiIconType: APP_ICON,
category: AppCategoryObj.analyze,
},
injectDefaultVars(server) {
const serverConfig = server.config();
Expand Down
14 changes: 7 additions & 7 deletions x-pack/legacy/plugins/ml/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ interface MlServer extends Server {
addAppLinksToSampleDataset: () => {};
}

enum AppCategory {
analyze,
observability,
security,
management,
}
export const AppCategoryObj = {
analyze: 'analyze',
observability: 'observability',
security: 'security',
management: 'management',
};

export const ml = (kibana: any) => {
return new kibana.Plugin({
Expand All @@ -49,7 +49,7 @@ export const ml = (kibana: any) => {
icon: 'plugins/ml/application/ml.svg',
euiIconType: 'machineLearningApp',
main: 'plugins/ml/legacy',
category: AppCategory.management,
category: AppCategoryObj.management,
},
styleSheetPaths: resolve(__dirname, 'public/application/index.scss'),
hacks: ['plugins/ml/application/hacks/toggle_app_link_in_nav'],
Expand Down
8 changes: 8 additions & 0 deletions x-pack/legacy/plugins/siem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ import {
import { defaultIndexPattern } from './default_index_pattern';
import { initServerWithKibana } from './server/kibana.index';

export const AppCategoryObj = {
analyze: 'analyze',
observability: 'observability',
security: 'security',
management: 'management',
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const siem = (kibana: any) => {
return new kibana.Plugin({
Expand Down Expand Up @@ -60,6 +67,7 @@ export const siem = (kibana: any) => {
order: 9000,
title: APP_NAME,
url: `/app/${APP_ID}`,
// category: AppCategoryObj.security,
},
],
uiSettingDefaults: {
Expand Down
8 changes: 8 additions & 0 deletions x-pack/legacy/plugins/uptime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import { PluginInitializerContext } from 'src/core/server';
import { PLUGIN } from './common/constants';
import { KibanaServer, plugin } from './server';

export const AppCategoryObj = {
analyze: 'analyze',
observability: 'observability',
security: 'security',
management: 'management',
};

export const uptime = (kibana: any) =>
new kibana.Plugin({
configPrefix: 'xpack.uptime',
Expand All @@ -30,6 +37,7 @@ export const uptime = (kibana: any) =>
main: 'plugins/uptime/app',
order: 8900,
url: '/app/uptime#/',
category: AppCategoryObj.observability,
},
home: ['plugins/uptime/register_feature'],
},
Expand Down

0 comments on commit 8a82938

Please sign in to comment.