Configure frontend on 'frontend.ready' event

This commit is contained in:
Kristóf Tóth 2019-08-30 17:38:27 +02:00
parent 8c2cd7e44e
commit e016fc0a24
2 changed files with 39 additions and 5 deletions

View File

@ -1,4 +1,5 @@
import logging
from os.path import dirname, realpath, join
from functools import partial
from tornado.ioloop import IOLoop
@ -7,7 +8,8 @@ from tfw.fsm import YamlFSM
from tfw.event_handlers import FSMAwareEventHandler
from tfw.components.ide import IdeHandler, DeployHandler
from tfw.components.terminal import TerminalHandler
from tfw.components.frontend import FrontendProxyHandler, FrontendReadyHandler, ConsoleLogsHandler, MessageQueueHandler
from tfw.components.frontend import FrontendProxyHandler, FrontendReadyHandler
from tfw.components.frontend import ConsoleLogsHandler, MessageQueueHandler, FrontendConfigHandler
from tfw.components.process_management import ProcessHandler, ProcessLogHandler
from tfw.components.fsm import FSMHandler
from tfw.main import EventHandlerFactory, setup_logger, setup_signal_handlers
@ -16,11 +18,12 @@ from tfw.config import TFWENV, TAOENV
from custom_handlers import CenatorHandler, TestCommandsHandler, messageFSMStepsHandler
LOG = logging.getLogger(__name__)
here = dirname(realpath(__file__))
def main():
# pylint: disable=unused-variable
# pylint: disable=unused-variable,too-many-locals
setup_logger(__file__)
eh_factory = EventHandlerFactory()
@ -58,9 +61,13 @@ def main():
# Proxies frontend API calls to frontend
frontendproxy_eh = eh_factory.build(FrontendProxyHandler())
# Initiates first FSM step
ready = FrontendReadyHandler('step_1')
ready_eh = eh_factory.build(ready)
ready.stop = ready_eh.stop
frontendready = FrontendReadyHandler('step_1')
frontendready_eh = eh_factory.build(frontendready)
frontendready.stop = frontendready_eh.stop
# Configures frontend
frontendconfig_eh = eh_factory.build(
FrontendConfigHandler(join(here, 'frontend_config.yaml'))
)
# Manages message queues
messagequeue_eh = eh_factory.build(MessageQueueHandler(25))
# Writes live logs to console on frontend

View File

@ -0,0 +1,27 @@
dashboard:
layout: terminal-ide-web
hideMessages: false
iframeUrl: /webservice
showUrlBar: false
terminalMenuItem: terminal
reloadIframeOnDeploy: false
enabledLayouts:
- terminal-ide-web
- terminal-ide-vertical
- terminal-web
- ide-web-vertical
- terminal-ide-horizontal
- terminal-only
- ide-only
- web-only
ide:
autoSaveInterval: 444
showDeployButton: true
deployButtonText:
TODEPLOY: Deploy
DEPLOYED: Deployed
DEPLOYING: Reloading app...
FAILED: Deployment failed
site:
askReloadSite: false
documentTitle: Avatao Tutorials