|
@@ -41,6 +41,8 @@ type oliveTinAPI struct {
|
|
|
// We use a map for efficient membership and deletion; ordering is not required.
|
|
// We use a map for efficient membership and deletion; ordering is not required.
|
|
|
streamingClients map[*streamingClient]struct{}
|
|
streamingClients map[*streamingClient]struct{}
|
|
|
streamingClientsMutex sync.RWMutex
|
|
streamingClientsMutex sync.RWMutex
|
|
|
|
|
+
|
|
|
|
|
+ entityListenerRegistered bool
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const maxEventStreamClients = 16
|
|
const maxEventStreamClients = 16
|
|
@@ -1733,10 +1735,12 @@ func entityListFields(data any, properties []config.EntityProperty) map[string]s
|
|
|
return nil
|
|
return nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ dataMap, _ := data.(map[string]any)
|
|
|
displayFieldKey := entities.DisplayNameFieldKey(data)
|
|
displayFieldKey := entities.DisplayNameFieldKey(data)
|
|
|
fields := make(map[string]string, len(properties))
|
|
fields := make(map[string]string, len(properties))
|
|
|
for _, property := range properties {
|
|
for _, property := range properties {
|
|
|
- if entityPropertyIsDisplayName(property.Name, displayFieldKey) {
|
|
|
|
|
|
|
+ actualKey := entityDataPropertyKey(dataMap, property.Name)
|
|
|
|
|
+ if entityFieldIsSelectedDisplayName(actualKey, displayFieldKey) {
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
|
fields[property.Name] = entityPropertyValue(data, property.Name)
|
|
fields[property.Name] = entityPropertyValue(data, property.Name)
|
|
@@ -1745,6 +1749,25 @@ func entityListFields(data any, properties []config.EntityProperty) map[string]s
|
|
|
return fields
|
|
return fields
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func entityDataPropertyKey(dataMap map[string]any, propertyName string) string {
|
|
|
|
|
+ if dataMap == nil {
|
|
|
|
|
+ return propertyName
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if _, found := dataMap[propertyName]; found {
|
|
|
|
|
+ return propertyName
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ propertyNameLower := strings.ToLower(propertyName)
|
|
|
|
|
+ for key := range dataMap {
|
|
|
|
|
+ if strings.ToLower(key) == propertyNameLower {
|
|
|
|
|
+ return key
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return propertyName
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func entityPropertyValue(data any, propertyName string) string {
|
|
func entityPropertyValue(data any, propertyName string) string {
|
|
|
dataMap, ok := data.(map[string]any)
|
|
dataMap, ok := data.(map[string]any)
|
|
|
if !ok {
|
|
if !ok {
|
|
@@ -1810,10 +1833,6 @@ func entityFieldIsSelectedDisplayName(fieldName, displayFieldKey string) bool {
|
|
|
return displayFieldKey != "" && fieldName == displayFieldKey
|
|
return displayFieldKey != "" && fieldName == displayFieldKey
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func entityPropertyIsDisplayName(propertyName, displayFieldKey string) bool {
|
|
|
|
|
- return displayFieldKey != "" && strings.EqualFold(propertyName, displayFieldKey)
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func (api *oliveTinAPI) RestartAction(ctx ctx.Context, req *connect.Request[apiv1.RestartActionRequest]) (*connect.Response[apiv1.StartActionResponse], error) {
|
|
func (api *oliveTinAPI) RestartAction(ctx ctx.Context, req *connect.Request[apiv1.RestartActionRequest]) (*connect.Response[apiv1.StartActionResponse], error) {
|
|
|
execReqLogEntry, err := api.restartActionLogEntry(req.Msg.ExecutionTrackingId)
|
|
execReqLogEntry, err := api.restartActionLogEntry(req.Msg.ExecutionTrackingId)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -1871,6 +1890,11 @@ var (
|
|
|
// Call this before background goroutines that may trigger RebuildActionMap.
|
|
// Call this before background goroutines that may trigger RebuildActionMap.
|
|
|
func RegisterExecutorListener(ex *executor.Executor) {
|
|
func RegisterExecutorListener(ex *executor.Executor) {
|
|
|
server := ensureExecutorListener(ex)
|
|
server := ensureExecutorListener(ex)
|
|
|
|
|
+ if server.entityListenerRegistered {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ server.entityListenerRegistered = true
|
|
|
entities.AddListener(server.onEntityChanged)
|
|
entities.AddListener(server.onEntityChanged)
|
|
|
}
|
|
}
|
|
|
|
|
|