Commit 1598f9274edc3e94459f85d989a92da06ee9fd70

Authored by ww
1 parent 55550f58

perf: alarm notify set off layre duration

@@ -44,3 +44,6 @@ VITE_CONTENT_SECURITY_POLICY = false @@ -44,3 +44,6 @@ VITE_CONTENT_SECURITY_POLICY = false
44 44
45 # Alarm Notify Polling Interval Time 45 # Alarm Notify Polling Interval Time
46 VITE_ALARM_NOTIFY_POLLING_INTERVAL_TIME = 5000 46 VITE_ALARM_NOTIFY_POLLING_INTERVAL_TIME = 5000
  47 +
  48 +# Alarm Notify Auto Close Time
  49 +VITE_ALARM_NOTIFY_DURATION = 5000
@@ -45,3 +45,6 @@ VITE_CONTENT_SECURITY_POLICY = false @@ -45,3 +45,6 @@ VITE_CONTENT_SECURITY_POLICY = false
45 45
46 # Alarm Notify Polling Interval Time 46 # Alarm Notify Polling Interval Time
47 VITE_ALARM_NOTIFY_POLLING_INTERVAL_TIME = 60000 47 VITE_ALARM_NOTIFY_POLLING_INTERVAL_TIME = 60000
  48 +
  49 +# Alarm Notify Auto Close Time
  50 +VITE_ALARM_NOTIFY_DURATION = 5000
@@ -9,12 +9,14 @@ interface UseAlarmNotifyParams { @@ -9,12 +9,14 @@ interface UseAlarmNotifyParams {
9 alarmNotifyStatus?: AlarmStatus; 9 alarmNotifyStatus?: AlarmStatus;
10 interval?: number; 10 interval?: number;
11 color?: string; 11 color?: string;
  12 + duration?: number;
12 } 13 }
13 14
14 export function useAlarmNotify(params: UseAlarmNotifyParams = {}) { 15 export function useAlarmNotify(params: UseAlarmNotifyParams = {}) {
15 const { 16 const {
16 alarmNotifyStatus = AlarmStatus.ACTIVE_UN_ACK, 17 alarmNotifyStatus = AlarmStatus.ACTIVE_UN_ACK,
17 interval = import.meta.env.VITE_ALARM_NOTIFY_POLLING_INTERVAL_TIME, 18 interval = import.meta.env.VITE_ALARM_NOTIFY_POLLING_INTERVAL_TIME,
  19 + duration = import.meta.env.VITE_ALARM_NOTIFY_DURATION,
18 color = 'orange', 20 color = 'orange',
19 } = params; 21 } = params;
20 const alarmNotifyStatusMean = AlarmStatusMean[alarmNotifyStatus]; 22 const alarmNotifyStatusMean = AlarmStatusMean[alarmNotifyStatus];
@@ -43,7 +45,7 @@ export function useAlarmNotify(params: UseAlarmNotifyParams = {}) { @@ -43,7 +45,7 @@ export function useAlarmNotify(params: UseAlarmNotifyParams = {}) {
43 console.log('enter'); 45 console.log('enter');
44 notification.open({ 46 notification.open({
45 message: '设备告警', 47 message: '设备告警',
46 - duration: null, 48 + duration,
47 key, 49 key,
48 description: h('div', {}, [ 50 description: h('div', {}, [
49 h('div', { style: { marginRight: '5px' } }, [ 51 h('div', { style: { marginRight: '5px' } }, [
@@ -73,6 +73,7 @@ declare global { @@ -73,6 +73,7 @@ declare global {
73 VITE_GENERATE_UI: string; 73 VITE_GENERATE_UI: string;
74 VITE_CONTENT_SECURITY_POLICY: boolean; 74 VITE_CONTENT_SECURITY_POLICY: boolean;
75 VITE_ALARM_NOTIFY_POLLING_INTERVAL_TIME: number; 75 VITE_ALARM_NOTIFY_POLLING_INTERVAL_TIME: number;
  76 + VITE_ALARM_NOTIFY_DURATION: number;
76 } 77 }
77 78
78 declare function parseInt(s: string | number, radix?: number): number; 79 declare function parseInt(s: string | number, radix?: number): number;