From 0c41283757a571334eddadece7d5e5024854e668 Mon Sep 17 00:00:00 2001 From: Mert Tumer Date: Tue, 26 May 2020 12:45:02 +0300 Subject: Built-In CODE Server status message on first load Signed-off-by: Mert Tumer --- src/document.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/document.js b/src/document.js index e2f5f69e..0fe8fb17 100644 --- a/src/document.js +++ b/src/document.js @@ -18,8 +18,25 @@ const PostMessages = new PostMessageService({ loolframe: () => document.getElementById('loleafletframe').contentWindow }) -const showLoadingIndicator = () => document.getElementById('loadingContainer').classList.add('icon-loading') -const hideLoadingIndicator = () => document.getElementById('loadingContainer').classList.remove('icon-loading') +const showLoadingIndicator = () => { + if (OC.appswebroots.richdocumentscode && Config.get('urlsrc').indexOf('proxy.php') >= 0) { + var url = Config.get('urlsrc').substr(0, Config.get('urlsrc').indexOf('proxy.php') + 'proxy.php'.length) + $.get(url + '?status').done(function(val) { + if (val && val.status && val.status === 'starting') { + document.getElementById('proxyLoadingIcon').classList.add('icon-loading-small') + document.getElementById('proxyLoadingMessage').textContent = t('richdocuments', 'Built-in CODE Server is starting up shortly, please wait.') + } + }) + } else { + document.getElementById('loadingContainer').classList.add('icon-loading') + } +} + +const hideLoadingIndicator = () => { + document.getElementById('loadingContainer').classList.remove('icon-loading') + document.getElementById('proxyLoadingIcon').classList.remove('icon-loading-small') + document.getElementById('proxyLoadingMessage').textContent = '' +} showLoadingIndicator() @@ -219,7 +236,7 @@ const documentsMain = { const message = { 'MessageId': 'App_LoadingStatus', 'Values': { 'Status': 'Timeout' } } editorInitListener({ data: JSON.stringify(message), parsed: message }) } - }, 15000) + }, 45000) }) $('#loleafletframe').load(function() { -- cgit v1.2.3