Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Add error toast for non-admin user. Rename Kibana Notebook to Notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuali925 committed Oct 22, 2020
1 parent ead4cfb commit 135975b
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 16 deletions.
3 changes: 2 additions & 1 deletion common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
import { RefObject } from 'react';

export const PLUGIN_ID = 'opendistro-notebooks-kibana';
export const PLUGIN_NAME = 'Kibana Notebooks';
export const PLUGIN_NAME = 'Notebooks';
export const API_PREFIX = '/api/notebooks';
export const SELECTED_BACKEND = 'DEFAULT'; // ZEPPELIN || DEFAULT
export const DATE_FORMAT = 'MM/DD/YYYY hh:mm A';
export const FETCH_SIZE = 1000;
export const CREATE_NOTE_MESSAGE = 'Enter a name to describe the purpose of this notebook.';
export const DOCUMENTATION_URL = 'https://opendistro.github.io/for-elasticsearch-docs/docs/kibana/notebooks/';

export const zeppelinURL = 'http://localhost:8080';

Expand Down
10 changes: 7 additions & 3 deletions public/components/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import { DashboardStart } from '../../../../src/plugins/dashboard/public';

import { Notebook } from './notebook';
import { onDownload } from './helpers/download_json';
import { API_PREFIX } from '../../common';
import { API_PREFIX, DOCUMENTATION_URL } from '../../common';
import { NoteTable } from './note_table';
import { HashRouter } from 'react-router-dom';
import { Switch, Route } from 'react-router';
import { EuiGlobalToastList } from '@elastic/eui';
import { EuiGlobalToastList, EuiLink } from '@elastic/eui';
import { Toast } from '@elastic/eui/src/components/toast/global_toast_list';

/*
Expand Down Expand Up @@ -107,7 +107,11 @@ export class Main extends React.Component<MainProps, MainState> {
this.setToast(`Notebook "${newNoteName}" successfully created!`);
window.location.assign(`${this.props.basename}#${res.body}`);
})
.catch((err) => this.setToast('Issue in creating a notebook ' + err.body.message, 'danger'));
.catch((err) => {
this.setToast('Please ask your administrator to enable Notebooks for you.', 'danger',
<EuiLink href={DOCUMENTATION_URL} target="_blank">Documentation</EuiLink>);
console.error(err);
});
};

// Renames an existing notebook
Expand Down
4 changes: 2 additions & 2 deletions public/components/note_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import _ from 'lodash';
import moment from 'moment';
import React, { useEffect, useState, ReactElement } from 'react';
import { ChromeBreadcrumb } from '../../../../src/core/public';
import { CREATE_NOTE_MESSAGE, DATE_FORMAT } from '../../common';
import { CREATE_NOTE_MESSAGE, DATE_FORMAT, DOCUMENTATION_URL } from '../../common';
import { getCustomModal, DeleteNotebookModal } from './helpers/modal_containers';
import { NotebookType } from './main';

Expand Down Expand Up @@ -251,7 +251,7 @@ export function NoteTable(props: NoteTableProps) {
<EuiSpacer size='s' />
<EuiText size="s" color="subdued">
Use Notebooks to interactively and collaboratively develop rich reports backed by live data. A notebook is a document made up of paragraphs that can combine markdown and visualizations with support for multi-timelines so that users can easily tell a story. Notebooks can be developed, shared and refreshed directly from Kibana to foster data driven exploration and collaboration among Elasticsearch users and their stakeholders. Common use cases for notebooks includes creating postmortem reports, designing run books, building live infrastructure reports, or even documentation.{' '}
<EuiLink external={true} href="https://opendistro.github.io/for-elasticsearch-docs/docs/notebooks/" target="blank">Learn more</EuiLink>
<EuiLink external={true} href={DOCUMENTATION_URL} target="blank">Learn more</EuiLink>
</EuiText>
</EuiPageContentHeaderSection>
<EuiPageContentHeaderSection>
Expand Down
8 changes: 4 additions & 4 deletions target/public/.kbn-optimizer-cache
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"/Users/lijshu/Projects/7.9.1/kibana-workbench/packages/kbn-optimizer/target/worker/entry_point_creator.js": 1603134193348.825,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/packages/kbn-optimizer/target/worker/postcss.config.js": 1603134193349.5967,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/packages/kbn-ui-shared-deps/public_path_module_creator.js": 1601496201781.9238,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/common/index.ts": 1603207759427.4893,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/common/index.ts": 1603387125822.607,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/kibana.json": 1603207759546.7344,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/node_modules/@babel/runtime/package.json": 1602805273988,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/node_modules/@nteract/markdown/package.json": 1603207826322,
Expand Down Expand Up @@ -160,9 +160,9 @@
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/public/components/helpers/modal_containers.tsx": 1603207759557.5562,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/public/components/helpers/panel_wrapper.tsx": 1603207759557.9634,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/public/components/helpers/zeppelin_parser.tsx": 1603207759558.3633,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/public/components/main.tsx": 1603207759558.8887,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/public/components/note_table.tsx": 1603207759559.397,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/public/components/notebook.tsx": 1603207759559.9482,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/public/components/main.tsx": 1603387228445.4724,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/public/components/note_table.tsx": 1603387186864.1145,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/public/components/notebook.tsx": 1603382739071.433,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/public/components/paragraph_components/para_input.tsx": 1603207759560.5256,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/public/components/paragraph_components/para_output.tsx": 1603207759560.9277,
"/Users/lijshu/Projects/7.9.1/kibana-workbench/plugins/kibana-notebooks/public/components/paragraph_components/paragraphs.tsx": 1603207759561.3457,
Expand Down
10 changes: 8 additions & 2 deletions target/public/1.plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion target/public/1.plugin.js.map

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions target/public/opendistro-notebooks-kibana.plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion target/public/opendistro-notebooks-kibana.plugin.js.map

Large diffs are not rendered by default.

0 comments on commit 135975b

Please sign in to comment.