Skip to content

Commit

Permalink
Revert back to save panel
Browse files Browse the repository at this point in the history
- Get rid of `clone`
- Get rid of rename
  • Loading branch information
stacey-gammon committed Mar 23, 2017
1 parent a89ce34 commit cfb3372
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 15 deletions.
8 changes: 6 additions & 2 deletions src/core_plugins/kibana/public/dashboard/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,

$scope.$listen(timefilter, 'fetch', $scope.refresh);

// Defined below, only placed here to avoid used before defined warning (and there is a circular reference).
let changeViewMode = null;

$scope.save = function () {
// Make sure to save the latest query, even if 'enter' hasn't been hit.
dashboardState.updateFilters(queryFilter);
Expand All @@ -191,10 +194,11 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
notify.info(`Saved Dashboard as "${dash.title}"`);
if (dash.id !== $routeParams.id) {
kbnUrl.change(
`${DashboardConstants.EXISTING_DASHBOARD_URL}?${DashboardConstants.VIEW_MODE_PARAM}=${DashboardViewMode.EDIT}`,
`${DashboardConstants.EXISTING_DASHBOARD_URL}`,
{ id: dash.id });
} else {
docTitle.change(dash.lastSavedTitle);
changeViewMode(DashboardViewMode.VIEW);
}
}
}).catch(notify.fatal);
Expand Down Expand Up @@ -233,7 +237,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
// changeViewMode uses navActions, and navActions uses changeViewMode.
const navActions = {};

const changeViewMode = (newMode) => {
changeViewMode = (newMode) => {
const isPageRefresh = newMode === dashboardState.getViewMode();
const leavingEditMode = !isPageRefresh && newMode === DashboardViewMode.VIEW;

Expand Down
13 changes: 0 additions & 13 deletions src/core_plugins/kibana/public/dashboard/top_nav/options.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
<form role="form">
<div class="kuiLocalDropdownTitle">Options</div>

<div class="form-group">
<label>
<input
type="checkbox"
ng-model="model.timeRestore"
ng-checked="model.timeRestore"
data-test-subj="storeTimeWithDashboard"
>
Store time with {{opts.displayName}}
<kbn-info placement="bottom" info="Change the time filter to the currently selected time each time this dashboard is loaded"></kbn-info>
</label>
</div>

<div class="input-group">
<label>
<input
Expand Down
33 changes: 33 additions & 0 deletions src/core_plugins/kibana/public/dashboard/top_nav/save.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<form
role="form"
ng-submit="opts.save()"
>
<div class="kuiLocalDropdownTitle">Save {{opts.displayName}}</div>
<input
class="kuiLocalDropdownInput"
id="dashboardTitle"
type="text"
ng-model="model.title"
placeholder="Dashboard title"
input-focus="select"
>

<saved-object-save-as-check-box saved-object="opts.dashboard"></saved-object-save-as-check-box>

<div class="form-group">
<label>
<input
type="checkbox"
ng-model="model.timeRestore"
ng-checked="model.timeRestore"
data-test-subj="storeTimeWithDashboard"
>
Store time with {{opts.displayName}}
<kbn-info placement="bottom" info="Change the time filter to the currently selected time each time this dashboard is loaded"></kbn-info>
</label>
</div>

<button type="submit" ng-disabled="!model.title" class="btn btn-primary" aria-label="Save dashboard">
Save
</button>
</form>

0 comments on commit cfb3372

Please sign in to comment.