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

Eui sharing top nav #21997

Merged
merged 33 commits into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7878c0c
just getting the popover to open and start laying out the context menu
nreese Aug 7, 2018
b2660fe
pass getUnhashableStates to ShareMenu
nreese Aug 8, 2018
8a84489
generate original and snapshot ids
nreese Aug 10, 2018
8216b6e
move state into ShareUrlContent
nreese Aug 10, 2018
d871e10
start working on form
nreese Aug 10, 2018
adacc96
use radio group
nreese Aug 10, 2018
d8c7dc7
add input for creating short URL
nreese Aug 13, 2018
f30edf3
display URL in alert until copy functionallity gets migrated to EUI
nreese Aug 13, 2018
fccaa2a
allowEmbed prop
nreese Aug 13, 2018
82650e7
replace share directive with showShareContextMenu
nreese Aug 14, 2018
b480e99
fix button styling
nreese Aug 14, 2018
113f036
add jest test for share_context_menu
nreese Aug 14, 2018
61775d7
merge with master
nreese Aug 15, 2018
89f590b
use EuiCopy to copy URL, add jest test for ShareUrlContent component
nreese Aug 15, 2018
23fe41d
clean up
nreese Aug 15, 2018
d98c2fa
display short URL create error message in form instead of with toast
nreese Aug 15, 2018
8cf0a6e
switch option order so disbaled option can not be first
nreese Aug 15, 2018
f11e80e
fix discover share functional tests
nreese Aug 15, 2018
5b5abc1
add functions required by reporting
nreese Aug 16, 2018
5b28a5d
Merge branch 'master' of https://github.com/elastic/kibana into euiSh…
nreese Aug 16, 2018
7273294
Merge branch 'master' of https://github.com/elastic/kibana into euiSh…
nreese Aug 21, 2018
ed6ae2a
typescript
nreese Aug 21, 2018
d2725e6
remove empty file
nreese Aug 21, 2018
d53bf1f
fix typescript compile error
nreese Aug 21, 2018
97dfe0a
Merge branch 'master' of https://github.com/elastic/kibana into euiSh…
nreese Aug 22, 2018
b7d9553
move import so jest tests work
nreese Aug 22, 2018
aa4f0e2
fix Failed prop type: The proptextToCopyis marked as required inEuiCo…
nreese Aug 22, 2018
214a4e0
move shortUrl out of react state and into Component object
nreese Aug 22, 2018
6c825bb
getUnhashableStates type from any[] to object[]
nreese Aug 22, 2018
187e296
add comment about type change once EUI issue is solved
nreese Aug 22, 2018
c3985f7
Merge branch 'master' of https://github.com/elastic/kibana into euiSh…
nreese Aug 28, 2018
7ef83c4
add functional test for saved object URL sharing
nreese Aug 28, 2018
0f5e391
remove commit
nreese Aug 28, 2018
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
18 changes: 13 additions & 5 deletions src/core_plugins/kibana/public/dashboard/dashboard_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ import { showCloneModal } from './top_nav/show_clone_modal';
import { showSaveModal } from './top_nav/show_save_modal';
import { showAddPanel } from './top_nav/show_add_panel';
import { showOptionsPopover } from './top_nav/show_options_popover';
import { showShareContextMenu } from 'ui/share';
import { migrateLegacyQuery } from 'ui/utils/migrateLegacyQuery';
import * as filterActions from 'ui/doc_table/actions/filter';
import { FilterManagerProvider } from 'ui/filter_manager';
import { EmbeddableFactoriesRegistryProvider } from 'ui/embeddable/embeddable_factories_registry';
import { DashboardPanelActionsRegistryProvider } from 'ui/dashboard_panel_actions/dashboard_panel_actions_registry';
import { VisTypesRegistryProvider } from 'ui/registry/vis_types';
import { timefilter } from 'ui/timefilter';
import { getUnhashableStatesProvider } from 'ui/state_management/state_hashing';

import { DashboardViewportProvider } from './viewport/dashboard_viewport_provider';

Expand Down Expand Up @@ -83,6 +85,7 @@ app.directive('dashboardApp', function ($injector) {
const docTitle = Private(DocTitleProvider);
const embeddableFactories = Private(EmbeddableFactoriesRegistryProvider);
const panelActionsRegistry = Private(DashboardPanelActionsRegistryProvider);
const getUnhashableStates = Private(getUnhashableStatesProvider);

panelActionsStore.initializeFromRegistry(panelActionsRegistry);

Expand Down Expand Up @@ -399,6 +402,16 @@ app.directive('dashboardApp', function ($injector) {
},
});
};
navActions[TopNavIds.SHARE] = (menuItem, navController, anchorElement) => {
showShareContextMenu({
anchorElement,
allowEmbed: true,
getUnhashableStates,
objectId: dash.id,
objectType: 'dashboard',
});
};

updateViewMode(dashboardStateManager.getViewMode());

// update root source when filters update
Expand Down Expand Up @@ -438,11 +451,6 @@ app.directive('dashboardApp', function ($injector) {
kbnUrl.removeParam(DashboardConstants.ADD_VISUALIZATION_TO_DASHBOARD_MODE_PARAM);
kbnUrl.removeParam(DashboardConstants.NEW_VISUALIZATION_ID_PARAM);
}

// TODO remove opts once share has been converted to react
$scope.opts = {
dashboard: dash, // used in share.html
};
}
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function getTopNavConfig(dashboardMode, actions, hideWriteControls) {
]
: [
getFullScreenConfig(actions[TopNavIds.FULL_SCREEN]),
getShareConfig(),
getShareConfig(actions[TopNavIds.SHARE]),
getCloneConfig(actions[TopNavIds.CLONE]),
getEditConfig(actions[TopNavIds.ENTER_EDIT_MODE])
]
Expand All @@ -49,7 +49,7 @@ export function getTopNavConfig(dashboardMode, actions, hideWriteControls) {
getViewConfig(actions[TopNavIds.EXIT_EDIT_MODE]),
getAddConfig(actions[TopNavIds.ADD]),
getOptionsConfig(actions[TopNavIds.OPTIONS]),
getShareConfig()];
getShareConfig(actions[TopNavIds.SHARE])];
default:
return [];
}
Expand Down Expand Up @@ -127,12 +127,12 @@ function getAddConfig(action) {
/**
* @returns {kbnTopNavConfig}
*/
function getShareConfig() {
function getShareConfig(action) {
return {
key: TopNavIds.SHARE,
description: 'Share Dashboard',
testId: 'dashboardShareButton',
template: require('plugins/kibana/dashboard/top_nav/share.html')
testId: 'shareTopNavButton',
run: action,
};
}

Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions src/core_plugins/kibana/public/dashboard/top_nav/share.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

import './options_popover.less';
import React from 'react';
import ReactDOM from 'react-dom';

Expand Down Expand Up @@ -55,7 +54,7 @@ export function showOptionsPopover({
document.body.appendChild(container);
const element = (
<EuiWrappingPopover
className="dashOptionsPopover"
className="navbar__popover"
id="popover"
button={anchorElement}
isOpen={true}
Expand Down
24 changes: 17 additions & 7 deletions src/core_plugins/kibana/public/discover/controllers/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import 'ui/filters/moment';
import 'ui/index_patterns';
import 'ui/state_management/app_state';
import { timefilter } from 'ui/timefilter';
import 'ui/share';
import 'ui/query_bar';
import { hasSearchStategyForIndexPattern, isDefaultTypeIndexPattern } from 'ui/courier';
import { toastNotifications } from 'ui/notify';
Expand All @@ -54,6 +53,8 @@ import { recentlyAccessed } from 'ui/persisted_log';
import { getDocLink } from 'ui/documentation_links';
import '../components/fetch_error';
import { getPainlessError } from './get_painless_error';
import { showShareContextMenu } from 'ui/share';
import { getUnhashableStatesProvider } from 'ui/state_management/state_hashing';

const app = uiModules.get('apps/discover', [
'kibana/notify',
Expand Down Expand Up @@ -157,6 +158,7 @@ function discoverController(
const notify = new Notifier({
location: 'Discover'
});
const getUnhashableStates = Private(getUnhashableStatesProvider);

$scope.getDocLink = getDocLink;
$scope.intervalOptions = intervalOptions;
Expand All @@ -167,6 +169,10 @@ function discoverController(
return interval.val !== 'custom';
};

// the saved savedSearch
const savedSearch = $route.current.locals.savedSearch;
$scope.$on('$destroy', savedSearch.destroy);

$scope.topNavMenu = [{
key: 'new',
description: 'New Search',
Expand All @@ -185,14 +191,18 @@ function discoverController(
}, {
key: 'share',
description: 'Share Search',
template: require('plugins/kibana/discover/partials/share_search.html'),
testId: 'discoverShareButton',
testId: 'shareTopNavButton',
run: (menuItem, navController, anchorElement) => {
showShareContextMenu({
anchorElement,
allowEmbed: false,
getUnhashableStates,
objectId: savedSearch.id,
objectType: 'search',
});
}
}];

// the saved savedSearch
const savedSearch = $route.current.locals.savedSearch;
$scope.$on('$destroy', savedSearch.destroy);

// the actual courier.SearchSource
$scope.searchSource = savedSearch.searchSource;
$scope.indexPattern = resolveIndexPatternLoading();
Expand Down

This file was deleted.

18 changes: 14 additions & 4 deletions src/core_plugins/kibana/public/visualize/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import './visualization_editor';
import 'ui/vis/editors/default/sidebar';
import 'ui/visualize';
import 'ui/collapsible_sidebar';
import 'ui/share';
import 'ui/query_bar';
import chrome from 'ui/chrome';
import angular from 'angular';
Expand All @@ -43,6 +42,8 @@ import { migrateLegacyQuery } from 'ui/utils/migrateLegacyQuery';
import { recentlyAccessed } from 'ui/persisted_log';
import { timefilter } from 'ui/timefilter';
import { getVisualizeLoader } from '../../../../../ui/public/visualize/loader';
import { showShareContextMenu } from 'ui/share';
import { getUnhashableStatesProvider } from 'ui/state_management/state_hashing';

uiRoutes
.when(VisualizeConstants.CREATE_PATH, {
Expand Down Expand Up @@ -115,6 +116,7 @@ function VisEditor(
) {
const docTitle = Private(DocTitleProvider);
const queryFilter = Private(FilterBarQueryFilterProvider);
const getUnhashableStates = Private(getUnhashableStatesProvider);

const notify = new Notifier({
location: 'Visualization Editor'
Expand Down Expand Up @@ -156,8 +158,16 @@ function VisEditor(
}, {
key: 'share',
description: 'Share Visualization',
template: require('plugins/kibana/visualize/editor/panels/share.html'),
testId: 'visualizeShareButton',
testId: 'shareTopNavButton',
run: (menuItem, navController, anchorElement) => {
showShareContextMenu({
anchorElement,
allowEmbed: true,
getUnhashableStates,
objectId: savedVis.id,
objectType: 'visualization',
});
}
}, {
key: 'inspect',
description: 'Open Inspector for visualization',
Expand Down Expand Up @@ -251,7 +261,7 @@ function VisEditor(
$scope.isAddToDashMode = () => addToDashMode;

$scope.timeRange = timefilter.getTime();
$scope.opts = _.pick($scope, 'doSave', 'savedVis', 'shareData', 'isAddToDashMode');
$scope.opts = _.pick($scope, 'doSave', 'savedVis', 'isAddToDashMode');

stateMonitor = stateMonitorFactory.create($state, stateDefaults);
stateMonitor.ignoreProps([ 'vis.listeners' ]).onChange((status) => {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should only render permalink panel when there are no other panels 1`] = `
<EuiContextMenu
initialPanelId={1}
panels={
Array [
Object {
"content": <ShareUrlContent
getUnhashableStates={[Function]}
objectId={undefined}
objectType="dashboard"
/>,
"id": 1,
"title": "Permalink",
},
]
}
/>
`;

exports[`should render context menu panel when there are more than one panel 1`] = `
<EuiContextMenu
initialPanelId={3}
panels={
Array [
Object {
"content": <ShareUrlContent
getUnhashableStates={[Function]}
objectId={undefined}
objectType="dashboard"
/>,
"id": 1,
"title": "Permalink",
},
Object {
"content": <ShareUrlContent
getUnhashableStates={[Function]}
isEmbedded={true}
objectId={undefined}
objectType="dashboard"
/>,
"id": 2,
"title": "Embed Code",
},
Object {
"id": 3,
"items": Array [
Object {
"icon": "console",
"name": "Embed code",
"panel": 2,
},
Object {
"icon": "link",
"name": "Permalinks",
"panel": 1,
},
],
"title": "Share this dashboard",
},
]
}
/>
`;
Loading