Skip to content

Commit

Permalink
technical debt
Browse files Browse the repository at this point in the history
  • Loading branch information
e154 committed Oct 22, 2023
1 parent 1cc04d1 commit d6169c1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion static_source/admin/src/views/Automation/Actions/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ const tableRowClassName = (data) => {
const callAction = async (action: ApiAction) => {
if (!action?.id) return;
await api.v1.developerToolsServiceTaskCallAction({id: action.id})
await api.v1.developerToolsServiceCallAction({id: action.id})
.catch(() => {
})
.finally(() => {
Expand Down
4 changes: 1 addition & 3 deletions static_source/admin/src/views/Automation/Tasks/edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const exportTask = async () => {
const callAction = async (name: string) => {
// todo: fix
await api.v1.developerToolsServiceTaskCallAction({ id: taskId.value || 0, name: name })
await api.v1.developerToolsServiceCallAction({ id: taskId.value || 0, name: name })
.catch(() => {
})
.finally(() => {
Expand Down Expand Up @@ -181,8 +181,6 @@ useEmitt({
}
})
fetch()
</script>
Expand Down
4 changes: 2 additions & 2 deletions static_source/admin/src/views/Automation/Triggers/edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const {t} = useI18n()
const writeRef = ref<ComponentRef<typeof Form>>()
const loading = ref(true)
const triggerId = computed(() => route.params.id as number);
const triggerId = computed(() => +route.params.id);
const currentRow = ref<Nullable<ApiTrigger>>(null)
const fetch = async () => {
Expand Down Expand Up @@ -123,7 +123,7 @@ fetch()

<div style="text-align: right">

<ElButton type="success" @click="callTrigger()" :disabled="!row?.isLoaded">
<ElButton type="success" @click="callTrigger()">
{{ t('main.call') }}
</ElButton>

Expand Down
5 changes: 5 additions & 0 deletions system/supervisor/base_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ func NewBaseActor(entity *m.Entity,
log.Error(err.Error())
}
}
go func() {
if _ , err = scriptEngine.Engine().AssertFunction("init"); err != nil {
log.Error(err.Error())
}
}()
actor.ScriptEngines = append(actor.ScriptEngines, scriptEngine)
}
}
Expand Down
2 changes: 1 addition & 1 deletion system/supervisor/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (e *supervisor) handlerSystemScripts(_ string, event interface{}) {
func (e *supervisor) bindScripts() {
e.scriptService.PushFunctions("GetEntity", GetEntityBind(e))
e.scriptService.PushFunctions("EntitySetState", SetStateBind(e))
e.scriptService.PushFunctions("EntitySetStateName", SetStateBind(e))
e.scriptService.PushFunctions("EntitySetStateName", SetStateNameBind(e))
e.scriptService.PushFunctions("EntityGetState", GetStateBind(e))
e.scriptService.PushFunctions("EntitySetAttributes", SetAttributesBind(e))
e.scriptService.PushFunctions("EntityGetAttributes", GetAttributesBind(e))
Expand Down
3 changes: 2 additions & 1 deletion system/supervisor/supervisor_bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func SetStateBind(manager Supervisor) func(entityId string, params EntityStatePa
func SetStateNameBind(manager Supervisor) func(entityId, stateName string) {
return func(entityId, stateName string) {
_ = manager.SetState(common.EntityId(entityId), EntityStateParams{
NewState: common.String(stateName),
NewState: common.String(stateName),
StorageSave: true,
})
}
}
Expand Down

0 comments on commit d6169c1

Please sign in to comment.