gui: Add one-off notifications that need to be acked
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3254
This commit is contained in:
committed by
Jakob Borg
parent
a8cd9d0154
commit
08b5a7908f
21
gui/default/syncthing/core/notificationDirective.js
Normal file
21
gui/default/syncthing/core/notificationDirective.js
Normal file
@@ -0,0 +1,21 @@
|
||||
angular.module('syncthing.core')
|
||||
.directive('notification', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: true,
|
||||
transclude: true,
|
||||
template: '<div class="row" ng-if="visible()"><div class="col-md-12" ng-transclude></div></div>',
|
||||
link: function (scope, elm, attrs) {
|
||||
scope.visible = function () {
|
||||
return scope.config.options.unackedNotificationIDs.indexOf(attrs.id) > -1;
|
||||
}
|
||||
scope.dismiss = function () {
|
||||
var idx = scope.config.options.unackedNotificationIDs.indexOf(attrs.id);
|
||||
if (idx > -1) {
|
||||
scope.config.options.unackedNotificationIDs.splice(idx, 1);
|
||||
scope.saveConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
16
gui/default/syncthing/core/notifications.html
Normal file
16
gui/default/syncthing/core/notifications.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!--
|
||||
<notification id='exampleNotification'>
|
||||
<div class="panel panel-warning">
|
||||
<div class="panel-heading"><h3 class="panel-title"><span class="fa fa-exclamation-circle"></span><span translate>Notice</span></h3></div>
|
||||
<div class="panel-body">
|
||||
<p translate>This is an example notification. ID of the notification should be appended to Options.UnackedNotificationIDs of the config.</p>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<button type="button" class="btn btn-sm btn-default pull-right" ng-click="dismiss()">
|
||||
<span class="fa fa-check"></span> <span translate>OK</span>
|
||||
</button>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</notification>
|
||||
-->
|
||||
Reference in New Issue
Block a user