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

display search bar in embedded iframes #8947

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/core_plugins/kibana/public/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<form
data-transclude-slot="bottomRow"
class="fullWidth"
ng-show="chrome.getVisible()"
ng-show="chrome.getShowSearch()"
role="form"
name="queryInput"
ng-submit="filterResults()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<!-- Search. -->
<div
data-transclude-slot="bottomRow"
ng-show="chrome.getVisible()"
ng-show="chrome.getShowSearch()"
class="fullWidth"
>
<!-- Block searching if the Visualization is linked to a Saved Search. -->
Expand Down
17 changes: 17 additions & 0 deletions src/ui/public/chrome/api/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,21 @@ module.exports = function (chrome, internals) {
if (_.isUndefined(internals.visible)) return def;
return internals.visible;
};

/**
* @param {boolean} showSearch - should the chrome Search Bar be displayed
* @return {chrome}
*/
chrome.setShowSearch = function (showSearch) {
internals.showSearch = Boolean(showSearch);
return chrome;
};

/**
* @return {boolean} - Show Search Bar state of the chrome
*/
chrome.getShowSearch = function () {
if (_.isUndefined(internals.showSearch)) return true;
return internals.showSearch;
};
};
3 changes: 3 additions & 0 deletions src/ui/public/chrome/directives/kbn_chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export default function (chrome, internals) {

// are we showing the embedded version of the chrome?
internals.setVisibleDefault(!$location.search().embed);
if ($location.search().embed) {
chrome.setShowSearch($location.search().showSearch);
}

// listen for route changes, propogate to tabs
const onRouteChange = function () {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/kbn_top_nav/kbn_top_nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
data-test-subj="top-nav"
>
<!-- Top row -->
<div class="localNavRow">
<div class="localNavRow" ng-show="!kbnTopNav.isEmbedded()">
<!-- Top left corner slot, e.g. breadcrumbs, title. -->
<div
class="localNavRow__section"
Expand Down
6 changes: 5 additions & 1 deletion src/ui/public/kbn_top_nav/kbn_top_nav_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export default function ($compile) {
}

isVisible() {
return chrome.getVisible();
return chrome.getVisible() || chrome.getShowSearch();
}

isEmbedded() {
return !chrome.getVisible();
}

addItems(rawOpts) {
Expand Down
4 changes: 3 additions & 1 deletion src/ui/public/share/directives/share.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ app.directive('share', function (Private) {
}

this.makeUrlEmbeddable = url => {
const embedQueryParam = '?embed=true';
let embedQueryParam = '?embed=true';
if (this.showSearch) embedQueryParam += '&showSearch=true';
const urlHasQueryString = url.indexOf('?') !== -1;
if (urlHasQueryString) {
return url.replace('?', `${embedQueryParam}&`);
Expand Down Expand Up @@ -115,6 +116,7 @@ app.directive('share', function (Private) {
shortSnapshotIframe: false,
};
};
this.updateUrls = updateUrls;

// When the URL changes, update the links in the UI.
$scope.$watch(() => $location.absUrl(), () => {
Expand Down
14 changes: 14 additions & 0 deletions src/ui/public/share/views/share.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
</div>
</div>

<div>
<label>
<input type="checkbox" ng-model="share.showSearch" name="showSearch" ng-change="share.updateUrls()">
Show Search Bar
</label>
</div>

<!-- Input -->
<input
id="originalIframeUrl"
Expand Down Expand Up @@ -125,6 +132,13 @@
</div>
</div>

<div>
<label>
<input type="checkbox" ng-model="share.showSearch" name="showSearch" ng-change="share.updateUrls()">
Show Search Bar
</label>
</div>

<!-- Input -->
<input
id="snapshotIframeUrl"
Expand Down