refresh allarmi e animazioni allarmi

This commit is contained in:
Paolo Possanzini
2018-02-09 16:27:08 +01:00
parent 7a7879428f
commit 5aef1201ad
6 changed files with 38 additions and 17 deletions
+6 -6
View File
File diff suppressed because one or more lines are too long
+14 -5
View File
@@ -4,6 +4,7 @@ import { Watch } from "vue-property-decorator";
import { AppModel, AlarmModel } from "src/store";
import { alarmItem, alarmDetail } from "./alarms";
import moment from "moment";
import { Hub } from "src/services/hub";
@Component({ name: "alarms-list", components: { alarmItem, alarmDetail } })
@@ -43,11 +44,14 @@ export default class alarmsList extends Vue {
@Watch("opened")
openchanged(n) {
if (this.alarms.length == 1) {
this.currentAlarm = this.alarms[0];
} else {
this.currentAlarm = null;
}
if (!this.$store.state.alarms.opened)
setTimeout(() => {
if (this.alarms.length == 1) {
this.currentAlarm = this.alarms[0];
} else {
this.currentAlarm = null;
}
}, 200);
}
public selectAlarm(alarm: AlarmModel) {
@@ -69,6 +73,11 @@ export default class alarmsList extends Vue {
public get serviceOpened(): boolean {
return this.$store.state.alarms.serviceOpened;
}
public refresh() {
Hub.Current.RefreshAllAlarms();
}
}
enum ribbonStatusEnum {
+2 -2
View File
@@ -3,7 +3,7 @@
<div id="alarm-list" :class="{expanded: ribbonStatus>1,
alarm: (!currentAlarm && ribbonStatus == 3) || (currentAlarm && currentAlarm.type =='alarm'), working: ribbonStatus == 1,
warning: (!currentAlarm && ribbonStatus == 2) || (currentAlarm && currentAlarm.type =='warning'), opened: opened}">
<div class="content scrollable" :class="{collapsed: currentAlarm}">
<div class="content scrollable" :class="{collapsed: currentAlarm, animated: opened}">
<alarm-item :title="alarm.title"
:type="alarm.type"
:source="alarm.source"
@@ -16,7 +16,7 @@
{{'alarms_btn_history_show' | localize("Vedi storico allarmi")}}
</button>
<button class="btn btn-success">
<button class="btn btn-success" @click="refresh()">
{{'alarms_refresh_all' | localize("Refresh all")}}
</button>
</div>
@@ -33,7 +33,7 @@
<button class="btn" @click="close()">
{{'alarm_detail_btn_ask_help' | localize("Chiedi Aiuto")}}
</button>
<button class="btn btn-success" @click="close()">
<button class="btn btn-success" @click="refresh()">
{{'alarm_detail_btn_refresh' | localize("Refresh")}}
</button>
</div>
@@ -64,6 +64,9 @@ export default {
methods: {
close() {
this.$emit("close-detail");
},
refresh(){
Hub.Current.RefreshAlarm(this.alarm.Id);
}
}
};
+11 -3
View File
@@ -35,6 +35,7 @@ export class Hub {
return Hub._current;
}
public get InternalSignalRChannel(): any { return this._hub; }
private _hub: any;
constructor() {
@@ -58,8 +59,8 @@ export class Hub {
appModelActions.CheckLogoff(store, e.id);
}
private static functionalityData(status){
console.debug(status);
private static functionalityData(status) {
console.debug(status);
}
private static manageProcesses(status: signalr_process.DTOProcessDataModel) {
@@ -127,7 +128,6 @@ export class Hub {
alarmsModelActions.checkRemove(store, tempList.map(i => i.guid));
}
private managePowerCallbacks(power: signalr_alarms.powerMessage) {
console.debug(power);
// Receiving messages so NC is connected
@@ -150,6 +150,14 @@ export class Hub {
this._hub.server.putPowerOnData(id);
}
public RefreshAlarm(id: string) {
this._hub.server.RefreshAlarm(id);
}
public RefreshAllAlarms(){
this._hub.server.RefreshAllAlarms();
}
public Hello() {
this._hub.server.hello();
}
+1
View File
@@ -1,5 +1,6 @@
import { UUID } from "src/_base/utils";
import { signalr_alarms } from "src/@types/signalr.alarms";
import { Hub } from "src/services/hub";
export interface AlarmsModel {
alarms: Array<AlarmModel>,