Module plugins.web.UpdateAction

Expand source code
from modules.base.Instances import *
from modules.base.Configuration import *

@configuration
class UpdateActionConfiguration(ActionConfiguration):
    '''Configuration settings for the Update Action'''

    @validator('platform')
    def check_platform(cls, v):
        platform_name = "web"
        if v != platform_name:
            raise ValueError("wrong script platform: " + platform_name + ", is: " + v)
        return v    


class UpdateActionState(BaseState):
    '''Represents the state of the Update Action'''

    topic: str = ""
    '''Last updated topic'''

    payload: str = ""
    '''Last payload'''


class UpdateAction(BaseAction):
    '''Write a given {{{payload}}} into the table row {{topic}}.'''

    from plugins.web.Platform import Platform

    def __init__(self, parent: Platform, config: UpdateActionConfiguration) -> None:
        super().__init__(parent, config)
        self.platform = parent
        self.state = UpdateActionState()

    def invoke(self, call_stack: CallStack):
        self.state.topic = str(call_stack.get("{{topic}}"))
        self.state.payload = str(call_stack.get("{{{payload}}}"))
        
        self.platform.update(self.state.topic, self.state.payload)

        super().invoke(call_stack.with_element(self))

Classes

class UpdateAction (parent: Platform, config: UpdateActionConfiguration)

Write a given {{{payload}}} into the table row {{topic}}.

Expand source code
class UpdateAction(BaseAction):
    '''Write a given {{{payload}}} into the table row {{topic}}.'''

    from plugins.web.Platform import Platform

    def __init__(self, parent: Platform, config: UpdateActionConfiguration) -> None:
        super().__init__(parent, config)
        self.platform = parent
        self.state = UpdateActionState()

    def invoke(self, call_stack: CallStack):
        self.state.topic = str(call_stack.get("{{topic}}"))
        self.state.payload = str(call_stack.get("{{{payload}}}"))
        
        self.platform.update(self.state.topic, self.state.payload)

        super().invoke(call_stack.with_element(self))

Ancestors

Class variables

var Platform

Web Dashboard based on pywebio.

Inherited members

class UpdateActionConfiguration (**data: Any)

Configuration settings for the Update Action

YAML configuration

Expand source code
@configuration
class UpdateActionConfiguration(ActionConfiguration):
    '''Configuration settings for the Update Action'''

    @validator('platform')
    def check_platform(cls, v):
        platform_name = "web"
        if v != platform_name:
            raise ValueError("wrong script platform: " + platform_name + ", is: " + v)
        return v    

Ancestors

Static methods

def check_platform(v)
Expand source code
@validator('platform')
def check_platform(cls, v):
    platform_name = "web"
    if v != platform_name:
        raise ValueError("wrong script platform: " + platform_name + ", is: " + v)
    return v    

Inherited members

class UpdateActionState

Represents the state of the Update Action

Expand source code
class UpdateActionState(BaseState):
    '''Represents the state of the Update Action'''

    topic: str = ""
    '''Last updated topic'''

    payload: str = ""
    '''Last payload'''

Ancestors

Class variables

var payload : str

Last payload

var topic : str

Last updated topic