I suppose maintaining some rule(s) to write alerts into a JSON array stored into an item would work, as well as dismissing alerts.
On the HABPanel side, there is a way to replace dashboard headers by custom widgets in recent snapshots, so you could develop a widget like this:
<h2>{{ngModel.name}}
<!-- replace the counters below by actual values (items updated with server rules?) and add
ng-ifs to display the labels only if necessary... -->
<small style="margin: 5px; position: absolute;">
<div class="label label-danger">1</div>
<div class="label label-info">2</div>
</small>
</h2>
<!-- replace the inner array by e.g. $eval(itemState('Alerts')) where Alerts contains a JSON object
example: ng-repeat="alertlist in [$eval(itemState('Alerts'))]".
This is to recompute the evaluation every time the item is changed while avoiding infinite digests -->
<div style="margin-top: 10px" ng-repeat="alertlist in [
[
{ id: 123, type: 'info', message: 'The doorbell rang 3 times while you were away.' },
{ id: 456, type: 'info', message: 'Trash is due tomorrow morning.' },
{ id: 789, type: 'danger', message: 'The alarm was triggered on 30.10.2017 21:25!' }
]
]">
<div uib-alert ng-repeat="alert in alertlist"
type="{{alert.type}}" close="sendCmd('CloseAlert', alert.id)">{{alert.message}}</div>
<!-- you will need to implement a rule removing the corresponding object from the JSON array
in the Alerts item when CloseAlert receives a command -->
</div>
and use it as the header (you would have to configure all dashboards with this widget as the header), it will look like this:
I’m not familiar enough with Xtext to help you develop the server-side JSON manipulation, but maybe you could use JavaScript in a script action of the new rules engine like I did for parsing intents from Snips…
Good luck!