79 lines
2.5 KiB
Go
79 lines
2.5 KiB
Go
/*
|
|
* Copyright (c) 2025 Beijing Hardman Automation Equipment Co., LTD. All rights reserved.
|
|
*
|
|
* Project: adapter
|
|
* File: message.go
|
|
* Last: 2025-04-15 16:59:49
|
|
* Author: wangcheng@bj-hardman.com
|
|
*/
|
|
|
|
package sse
|
|
|
|
// ToastType 'success' | 'warning' | 'error' | 'info' | 'default'
|
|
type ToastType string
|
|
|
|
const (
|
|
ToastTypeSuccess ToastType = "success"
|
|
ToastTypeWarning ToastType = "warning"
|
|
ToastTypeError ToastType = "error"
|
|
ToastTypeInfo ToastType = "info"
|
|
ToastTypeDefault ToastType = "default"
|
|
)
|
|
|
|
type ToastMessage struct {
|
|
Type ToastType `json:"type,omitempty"`
|
|
Content string `json:"content"`
|
|
Duration int `json:"duration,omitempty"` // 单位: 毫秒 默认:
|
|
ShowClose bool `json:"showClose,omitempty"`
|
|
}
|
|
|
|
type NoticeType string
|
|
|
|
const (
|
|
NoticeTypeSuccess NoticeType = "success"
|
|
NoticeTypeWarning NoticeType = "warning"
|
|
NoticeTypeError NoticeType = "error"
|
|
NoticeTypeInfo NoticeType = "info"
|
|
NoticeTypeDefault NoticeType = "default"
|
|
)
|
|
|
|
// NoticePosition 'top' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'
|
|
type NoticePosition string
|
|
|
|
const (
|
|
NoticePositionTop NoticePosition = "top"
|
|
NoticePositionBottom NoticePosition = "bottom"
|
|
NoticePositionTopLeft NoticePosition = "topLeft"
|
|
NoticePositionTopRight NoticePosition = "topRight"
|
|
NoticePositionBottomLeft NoticePosition = "bottomLeft"
|
|
NoticePositionBottomRight NoticePosition = "bottomRight"
|
|
)
|
|
|
|
type NoticeMessage struct {
|
|
Type NoticeType `json:"type,omitempty"`
|
|
Title string `json:"title"`
|
|
Content string `json:"content"`
|
|
Duration int `json:"duration,omitempty"` // 单位: 毫秒 默认: 3000 -1表示无限长
|
|
Position NoticePosition `json:"position,omitempty"`
|
|
}
|
|
|
|
// Progress event types for real-time task progress推送
|
|
const (
|
|
EventTaskStarted = "task_started"
|
|
EventTaskStepStarted = "task_step_started"
|
|
EventTaskStepCompleted = "task_step_completed"
|
|
EventTaskStepSkipped = "task_step_skipped"
|
|
EventTaskStepFailed = "task_step_failed"
|
|
EventTaskPaused = "task_paused"
|
|
EventTaskResumed = "task_resumed"
|
|
EventTaskError = "task_error"
|
|
EventTaskFinished = "task_finished"
|
|
EventTaskCancelled = "task_cancelled"
|
|
EventMachineComplete = "machine_complete"
|
|
EventWashComplete = "wash_complete"
|
|
EventDeburComplete = "debur_complete"
|
|
EventCleaningComplete = "cleaning_complete"
|
|
EventTempStationUpdate = "temp_station_update"
|
|
EventDockDataUpdate = "dock_data_update"
|
|
)
|