From eec9f13e0385bc8fe2fca912bf37971216b79a5a Mon Sep 17 00:00:00 2001 From: ingvord Date: Sun, 17 Mar 2019 11:41:39 +0300 Subject: [PATCH] Progress --- controllers/platform/ui/ui_controller.js | 14 ++++++++++++++ resources/constants.js | 1 + resources/platform/defaults.js | 3 ++- resources/webix_widgets/import.js | 1 + resources/webix_widgets/terminal_view.js | 22 ++++++++++++++++++++++ resources/webix_widgets/toolbar.js | 5 ++--- 6 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 resources/webix_widgets/terminal_view.js diff --git a/controllers/platform/ui/ui_controller.js b/controllers/platform/ui/ui_controller.js index 53faa991..df5063c7 100644 --- a/controllers/platform/ui/ui_controller.js +++ b/controllers/platform/ui/ui_controller.js @@ -74,6 +74,20 @@ TangoWebappPlatform.UIController = class extends MVC.Controller { return $$('scripting_console'); } + /** + * Opens terminal tab + * + */ + openTerminalTab() { + if($$('terminal') === undefined){ + $$("main-tabview").addView( + TangoWebapp.ui.newTerminalViewTab() + ); + } + $$('terminal').show(); + + return $$('terminal'); + } /** * * @param {TangoHost} tango_host diff --git a/resources/constants.js b/resources/constants.js index 294e25ed..b695cebc 100644 --- a/resources/constants.js +++ b/resources/constants.js @@ -18,6 +18,7 @@ TangoWebappPlatform.consts = { TANGO_PORT: /*@*/TANGO_PORT/*@*/, VERSION:/*@*/VERSION/*@*/, USER_CONTEXT_URL:/*@*/USER_CONTEXT_URL/*@*/, + TERMINAL_URL:/*@*/TERMINAL_URL/*@*/, NAME_COLUMN_WIDTH: 250, TABS_DELIMITER_HEIGHT: 3, DATABASE: 'sys/database/2', diff --git a/resources/platform/defaults.js b/resources/platform/defaults.js index 22dbbd18..122d5775 100644 --- a/resources/platform/defaults.js +++ b/resources/platform/defaults.js @@ -5,4 +5,5 @@ REST_API_VERSION = "rc4"; TANGO_HOST = "localhost"; TANGO_PORT = 10000; VERSION = "development"; -USER_CONTEXT_URL = MVC.mvc_root + "/../apps/platform/user_context.jsp"; \ No newline at end of file +USER_CONTEXT_URL = MVC.mvc_root + "/../apps/platform/user_context.jsp"; +TERMINAL_URL = 'http://ec2-35-156-104-8.eu-central-1.compute.amazonaws.com:8010/index.html'; \ No newline at end of file diff --git a/resources/webix_widgets/import.js b/resources/webix_widgets/import.js index 4f45eafc..33723078 100644 --- a/resources/webix_widgets/import.js +++ b/resources/webix_widgets/import.js @@ -21,4 +21,5 @@ import "./attrs_monitor_toolbar.js" import "./attrs_monitor_view.js"; import "./device_monitor_view.js"; import "./scripting_console.js"; +import "./terminal_view.js"; diff --git a/resources/webix_widgets/terminal_view.js b/resources/webix_widgets/terminal_view.js new file mode 100644 index 00000000..b3f03bff --- /dev/null +++ b/resources/webix_widgets/terminal_view.js @@ -0,0 +1,22 @@ +/** + * + * @author Igor Khokhriakov + * @since 5/1/18 + */ +(function(){ + TangoWebapp.ui.newTerminalView = function(config){ + return webix.extend({ + view: 'iframe', + src: TangoWebappPlatform.consts.TERMINAL_URL + }, config) + }; + + TangoWebapp.ui.newTerminalViewTab = function(){ + return { + header: " Terminal", + close: true, + borderless: true, + body: TangoWebapp.ui.newTerminalView({id: 'terminal'}) + } + } +})(); diff --git a/resources/webix_widgets/toolbar.js b/resources/webix_widgets/toolbar.js index e36c7d22..bd93e744 100644 --- a/resources/webix_widgets/toolbar.js +++ b/resources/webix_widgets/toolbar.js @@ -37,8 +37,7 @@ view: "list", data: [ {id: "toolsScripting", value: "Scripting"}, - //TODO uncomment after terminal has been merged - // {id: "toolsTerminal", value: "Terminal"} + {id: "toolsTerminal", value: "Terminal"} ], autoheight: true, borderless: true, @@ -48,7 +47,7 @@ PlatformApi.PlatformUIController().openScriptingTab(); } if (id === "toolsTerminal") { - webix.message("Submenu click: " + id); + PlatformApi.PlatformUIController().openTerminalTab(); } $$("toolsMenu").hide(); }