Skip to content

Commit

Permalink
address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stacey-gammon committed Nov 22, 2016
1 parent 07901bd commit 41441bf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
role="form"
ng-submit="opts.save()"
>
<div class="localDropdownTitle">Save Dashboard</div>
<div class="localDropdownTitle">Save {{opts.dashboard.getDisplayName()}}</div>
<input
class="localDropdownInput"
id="dashboardTitle"
Expand All @@ -18,7 +18,7 @@
<label>
<input type="checkbox" ng-model="opts.dashboard.timeRestore" ng-checked="opts.dashboard.timeRestore">
Store time with {{opts.dashboard.getDisplayName()}}
<kbn-info info="Change the time filter to the currently selected time each time this dashboard is loaded"></kbn-info>
<kbn-info placement="bottom" info="Change the time filter to the currently selected time each time this dashboard is loaded"></kbn-info>
</label>
</div>

Expand Down
18 changes: 6 additions & 12 deletions src/ui/public/courier/saved_object/saved_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function SavedObjectFactory(es, kbnIndex, Promise, Private, Notif
const type = config.type;

self.getDisplayName = function () {
return type.charAt(0).toUpperCase() + type.slice(1);
return type;
};

// Create a notifier for sending alerts
Expand Down Expand Up @@ -239,16 +239,6 @@ export default function SavedObjectFactory(es, kbnIndex, Promise, Private, Notif
return body;
};

/**
* Checks the id of the instance. If it is not set, creates a uuid for it.
*/
self.ensureId = function () {
this.id = this.id || uuid.v1();

// ensure that the docSource has the current id
docSource.id(self.id);
};

/**
* Returns true if the object's original title has been changed. New objects return false.
* @return {boolean}
Expand All @@ -273,7 +263,11 @@ export default function SavedObjectFactory(es, kbnIndex, Promise, Private, Notif
if (this.copyOnSave) {
self.id = null;
}
self.ensureId();

// Create a unique id for this object if it doesn't have one already.
this.id = this.id || uuid.v1();
// ensure that the docSource has the current id
docSource.id(self.id);

let source = self.serialize();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div ng-hide="!savedObject.id">
<div ng-hide="!savedObject.isTitleChanged() || savedObject.copyOnSave" class="localDropdownWarning">
Note, saving a {{savedObject.getDisplayName()}} with a new name will no longer automatically create a copy.
</div>
<label>
<input type="checkbox" ng-model="savedObject.copyOnSave" ng-checked="savedObject.copyOnSave">
Save as a new {{savedObject.getDisplayName()}}
</label>
</div>
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
import uiModules from 'ui/modules';
import saveObjectSaveAsCheckboxTemplate from './saved_object_save_as_checkbox.html';

uiModules
.get('kibana')
.directive('savedObjectSaveAsCheckBox', function () {
return {
restrict: 'E',
template: `
<div class="form-group" ng-hide="!savedObject.id">
<div ng-hide="!savedObject.isTitleChanged() || savedObject.copyOnSave" class="localDropdownWarning">
Note, saving a {{savedObject.getDisplayName()}} with a new name will no longer automatically create a copy.
</div>
<label>
<input type="checkbox" ng-model="savedObject.copyOnSave" ng-checked="savedObject.copyOnSave">
Save as a new {{savedObject.getDisplayName()}}
</label>
</div>`,
template: saveObjectSaveAsCheckboxTemplate,
scope: {
savedObject: '='
}
Expand Down

0 comments on commit 41441bf

Please sign in to comment.