mirror of
				https://github.com/avatao-content/test-tutorial-framework
				synced 2025-11-04 06:12:54 +00:00 
			
		
		
		
	Configure frontend on 'frontend.ready' event
This commit is contained in:
		@@ -1,4 +1,5 @@
 | 
				
			|||||||
import logging
 | 
					import logging
 | 
				
			||||||
 | 
					from os.path import dirname, realpath, join
 | 
				
			||||||
from functools import partial
 | 
					from functools import partial
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from tornado.ioloop import IOLoop
 | 
					from tornado.ioloop import IOLoop
 | 
				
			||||||
@@ -7,7 +8,8 @@ from tfw.fsm import YamlFSM
 | 
				
			|||||||
from tfw.event_handlers import FSMAwareEventHandler
 | 
					from tfw.event_handlers import FSMAwareEventHandler
 | 
				
			||||||
from tfw.components.ide import IdeHandler, DeployHandler
 | 
					from tfw.components.ide import IdeHandler, DeployHandler
 | 
				
			||||||
from tfw.components.terminal import TerminalHandler
 | 
					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.process_management import ProcessHandler, ProcessLogHandler
 | 
				
			||||||
from tfw.components.fsm import FSMHandler
 | 
					from tfw.components.fsm import FSMHandler
 | 
				
			||||||
from tfw.main import EventHandlerFactory, setup_logger, setup_signal_handlers
 | 
					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
 | 
					from custom_handlers import CenatorHandler, TestCommandsHandler, messageFSMStepsHandler
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LOG = logging.getLogger(__name__)
 | 
					LOG = logging.getLogger(__name__)
 | 
				
			||||||
 | 
					here = dirname(realpath(__file__))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def main():
 | 
					def main():
 | 
				
			||||||
    # pylint: disable=unused-variable
 | 
					    # pylint: disable=unused-variable,too-many-locals
 | 
				
			||||||
    setup_logger(__file__)
 | 
					    setup_logger(__file__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    eh_factory = EventHandlerFactory()
 | 
					    eh_factory = EventHandlerFactory()
 | 
				
			||||||
@@ -58,9 +61,13 @@ def main():
 | 
				
			|||||||
    # Proxies frontend API calls to frontend
 | 
					    # Proxies frontend API calls to frontend
 | 
				
			||||||
    frontendproxy_eh = eh_factory.build(FrontendProxyHandler())
 | 
					    frontendproxy_eh = eh_factory.build(FrontendProxyHandler())
 | 
				
			||||||
    # Initiates first FSM step
 | 
					    # Initiates first FSM step
 | 
				
			||||||
    ready = FrontendReadyHandler('step_1')
 | 
					    frontendready = FrontendReadyHandler('step_1')
 | 
				
			||||||
    ready_eh = eh_factory.build(ready)
 | 
					    frontendready_eh = eh_factory.build(frontendready)
 | 
				
			||||||
    ready.stop = ready_eh.stop
 | 
					    frontendready.stop = frontendready_eh.stop
 | 
				
			||||||
 | 
					    # Configures frontend
 | 
				
			||||||
 | 
					    frontendconfig_eh = eh_factory.build(
 | 
				
			||||||
 | 
					        FrontendConfigHandler(join(here, 'frontend_config.yaml'))
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    # Manages message queues
 | 
					    # Manages message queues
 | 
				
			||||||
    messagequeue_eh = eh_factory.build(MessageQueueHandler(25))
 | 
					    messagequeue_eh = eh_factory.build(MessageQueueHandler(25))
 | 
				
			||||||
    # Writes live logs to console on frontend
 | 
					    # Writes live logs to console on frontend
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										27
									
								
								solvable/src/frontend_config.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								solvable/src/frontend_config.yaml
									
									
									
									
									
										Normal 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
 | 
				
			||||||
		Reference in New Issue
	
	Block a user