mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* Replace icons in dashboard and settings * Replace icons in alerting * Update batch of icons * Implement icons accross various files * Style updates * Search: Fix recent and starred icons * Update styling and details * Replace new icon created by unicons * Fix e2e test, styling * Minor styling updates Co-authored-by: Clarity-89 <homes89@ukr.net>
66 lines
1.6 KiB
TypeScript
66 lines
1.6 KiB
TypeScript
import coreModule from 'app/core/core_module';
|
|
|
|
const template = `
|
|
<div class="modal-body">
|
|
<div class="modal-header">
|
|
<h2 class="modal-header-title">
|
|
<icon name="'exclamation-triangle'" size="'lg'"></icon>
|
|
<span class="p-l-1">Unsaved changes</span>
|
|
</h2>
|
|
|
|
<a class="modal-header-close" ng-click="ctrl.dismiss();">
|
|
<icon name="'times'"></icon>
|
|
</a>
|
|
</div>
|
|
|
|
<div class="modal-content text-center">
|
|
|
|
<div class="confirm-modal-text">
|
|
Do you want to save your changes?
|
|
</div>
|
|
|
|
<div class="confirm-modal-buttons">
|
|
<save-dashboard-button dashboard="ctrl.unsavedChangesSrv.tracker.current" onSaveSuccess="ctrl.onSaveSuccess" >Save</save-dashboard-button>
|
|
<button type="button" class="btn btn-danger" ng-click="ctrl.discard()">Discard</button>
|
|
<button type="button" class="btn btn-inverse" ng-click="ctrl.dismiss()">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`;
|
|
|
|
export class UnsavedChangesModalCtrl {
|
|
clone: any;
|
|
dismiss: () => void;
|
|
|
|
/** @ngInject */
|
|
constructor(private unsavedChangesSrv: any) {}
|
|
|
|
discard() {
|
|
this.dismiss();
|
|
this.unsavedChangesSrv.tracker.discardChanges();
|
|
}
|
|
|
|
save() {
|
|
this.dismiss();
|
|
this.unsavedChangesSrv.tracker.saveChanges();
|
|
}
|
|
|
|
onSaveSuccess = () => {
|
|
this.dismiss();
|
|
this.unsavedChangesSrv.tracker.onSaveSuccess();
|
|
};
|
|
}
|
|
|
|
export function unsavedChangesModalDirective() {
|
|
return {
|
|
restrict: 'E',
|
|
template: template,
|
|
controller: UnsavedChangesModalCtrl,
|
|
bindToController: true,
|
|
controllerAs: 'ctrl',
|
|
scope: { dismiss: '&' },
|
|
};
|
|
}
|
|
|
|
coreModule.directive('unsavedChangesModal', unsavedChangesModalDirective);
|