+ Add install progress page for devops.
This commit is contained in:
@@ -21,7 +21,7 @@ class install extends control
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if(!$this->app->installing) helper::end();
|
||||
if(!$this->app->installing && $this->app->tab != 'devops') helper::end();
|
||||
|
||||
$this->app->loadLang('user');
|
||||
$this->app->loadLang('admin');
|
||||
@@ -553,7 +553,7 @@ class install extends control
|
||||
$this->loadModel('solution')->uninstall($solutionID);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
$this->send(array('result' => 'success', 'message' => '', 'locate' => $this->inLink('index')));
|
||||
$this->send(array('result' => 'success', 'message' => '', 'load' => $this->inLink('index')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
div.cell { padding: 20px;}
|
||||
.progress-arrow {display: inline-block; margin-top: -40px; font-size: 100px; font-weight: 900; vertical-align: bottom; color: #cccccc;}
|
||||
.step {display: inline-block; padding: 10px;}
|
||||
.step-no {border-radius: 50%; padding: 5px 20px; font-size: 30px; display: inline-block; color: #ffffff; background-color: #cccccc;}
|
||||
.step-title{padding: 10px; font-size: 20px;}
|
||||
.progress-arrow.active {color: #3daf45;}
|
||||
.step-no.active {background-color: #3daf45;}
|
||||
span.loading {padding: 10px 20px; line-height: 40px;}
|
||||
|
||||
#terminal {width: 800px; margin: 0 auto 10px;}
|
||||
|
||||
.install-progress .modal-body {padding: 0.75rem 1.25rem;}
|
||||
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* 获取应用安装进度。
|
||||
* Get solution install progress.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function getInstallProgress()
|
||||
{
|
||||
$.get($.createLink('install', 'ajaxProgress', 'id='+ solutionID)).done(function(response)
|
||||
{
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
var installed = true;
|
||||
for(var index in res.data)
|
||||
{
|
||||
var cloudApp = res.data[index];
|
||||
if(cloudApp.status == 'waiting')
|
||||
{
|
||||
$('.arrow.app-' + cloudApp.id).removeClass('active');
|
||||
$('.step.app-' + cloudApp.id + ' .step-no').removeClass('active');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.arrow.app-' + cloudApp.id).addClass('active');
|
||||
$('.step.app-' + cloudApp.id + ' .step-no').addClass('active');
|
||||
}
|
||||
|
||||
if(cloudApp.status == 'installing' || cloudApp.status == 'installed')
|
||||
{
|
||||
$('#' + cloudApp.alias + '-status').text(installLabel);
|
||||
}
|
||||
|
||||
if(cloudApp.status == 'configured')
|
||||
{
|
||||
$('#' + cloudApp.alias + '-status').text(configLabel);
|
||||
}
|
||||
|
||||
if(cloudApp.status != 'installed' && cloudApp.status != 'configured')
|
||||
{
|
||||
installed = false;
|
||||
}
|
||||
|
||||
if(cloudApp.status == 'error')
|
||||
{
|
||||
$('.error-message').text(res.message);
|
||||
$('.progress.loading').hide();
|
||||
}
|
||||
if(res.logs.hasOwnProperty(cloudApp.chart))
|
||||
{
|
||||
if(!shownLogs.hasOwnProperty(cloudApp.chart)) shownLogs[cloudApp.chart] = [];
|
||||
|
||||
var logs = res.logs[cloudApp.chart]
|
||||
for(var j in logs)
|
||||
{
|
||||
if(shownLogs[cloudApp.chart].indexOf(logs[j].content) == -1)
|
||||
{
|
||||
term.write(logs[j].content + '\n');
|
||||
shownLogs[cloudApp.chart].push(logs[j].content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(installed)
|
||||
{
|
||||
$('.progress-message').text(notices.installationSuccess);
|
||||
if(!isModal) loadPage($.createLink('install', 'step6'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#retryInstallBtn').removeClass('hidden');
|
||||
$('#skipInstallBtn').removeClass('primary');
|
||||
$('#skipInstallBtn').text(skipLang);
|
||||
$('#cancelInstallBtn').addClass('hidden');
|
||||
|
||||
var errMessage = res.message;
|
||||
if(res.message instanceof Array) errMessage = res.message.join('<br/>');
|
||||
if(res.message instanceof Object) errMessage = Object.values(res.message).join('<br/>');
|
||||
|
||||
$('.error-message').text(errMessage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.retryInstall = function()
|
||||
{
|
||||
$('#retryInstallBtn').attr('disabled', true);
|
||||
|
||||
zui.Modal.confirm(notices.confirmReinstall).then((result) =>
|
||||
{
|
||||
$('#retryInstallBtn').removeAttr('disabled');
|
||||
if(!result) return;
|
||||
|
||||
$('#retryInstallBtn').addClass('hidden');
|
||||
$('#skipInstallBtn').text(backgroundLang);
|
||||
$('#skipInstallBtn').addClass('primary');
|
||||
$('#cancelInstallBtn').removeClass('hidden');
|
||||
$('.error-message').text('');
|
||||
$.get($.createLink('install', 'ajaxInstall', 'id=' + solutionID));
|
||||
});
|
||||
}
|
||||
|
||||
window.cancelInstall = function()
|
||||
{
|
||||
$('#cancelInstallBtn').attr('disabled', true);
|
||||
|
||||
zui.Modal.confirm(notices.cancelInstall).then((result) =>
|
||||
{
|
||||
$('#cancelInstallBtn').removeAttr('disabled');
|
||||
if(!result) return;
|
||||
|
||||
toggleLoading('#mainContent', true);
|
||||
$.ajaxSubmit({
|
||||
url: $.createLink('install', 'ajaxUninstall', 'id=' + solutionID),
|
||||
onComplete: function(response)
|
||||
{
|
||||
toggleLoading('#mainContent', false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(function()
|
||||
{
|
||||
term = new Terminal({convertEol: true, rows: 20});
|
||||
term.open(document.getElementById('terminal'));
|
||||
|
||||
if(startInstall === 'true') $.get($.createLink('install', 'ajaxInstall', 'id=' + solutionID));
|
||||
|
||||
setInterval(getInstallProgress, 4000);
|
||||
});
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The progress view file of install module of ZenTaoPMS.
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Yanyi Cao <caoyanyi@easycorp.ltd>
|
||||
* @package install
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
if(!helper::isAjaxRequest('modal'))
|
||||
{
|
||||
set::zui(true);
|
||||
|
||||
h::importCss($app->getWebRoot() . 'js/xterm/xterm.css');
|
||||
h::importJs($app->getWebRoot() . 'js/xterm/xterm.js');
|
||||
}
|
||||
|
||||
$appList = array();
|
||||
$components = json_decode($solution->components);
|
||||
$order = 0;
|
||||
foreach($components as $category => $cloudApp)
|
||||
{
|
||||
$active = (isset($cloudApp->status) && $cloudApp->status !='waiting') ? 'active' : '';
|
||||
if($order > 0) $appList[] = span(setClass("progress-arrow app-{$cloudApp->id} {$active}"), '→');
|
||||
$order ++;
|
||||
|
||||
$appList[] = div
|
||||
(
|
||||
setClass("step app-{$cloudApp->id} $active"),
|
||||
div(setClass("step-no {$active}"), $order),
|
||||
div
|
||||
(
|
||||
setClass('step-title'),
|
||||
span(setID("{$cloudApp->alias}-status")),
|
||||
$cloudApp->alias
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
jsVar('shownLogs', array());
|
||||
jsVar('startInstall', $install);
|
||||
jsVar('solutionID ', $solution->id);
|
||||
jsVar('notices', $lang->solution->notices);
|
||||
jsVar('installLabel', $lang->solution->install);
|
||||
jsVar('configLabel', $lang->solution->config);
|
||||
jsVar('skipLang', $lang->install->solution->skip);
|
||||
jsVar('backgroundLang', $lang->solution->background);
|
||||
jsVar('isModal', helper::isAjaxRequest('modal'));
|
||||
div
|
||||
(
|
||||
set::id('main'),
|
||||
div
|
||||
(
|
||||
set::id('mainContent'),
|
||||
set('data-loading', $lang->solution->notices->uninstallingSolution),
|
||||
formPanel
|
||||
(
|
||||
setClass('bg-canvas m-auto mw-auto'),
|
||||
helper::isAjaxRequest('modal') ? null : set::title($lang->install->solution->progress),
|
||||
div
|
||||
(
|
||||
setID('terminal'),
|
||||
div(setClass('article-h2 pb-2'), $lang->install->solution->log)
|
||||
),
|
||||
div
|
||||
(
|
||||
setClass('text-center app-list flex justify-center items-center'),
|
||||
$appList
|
||||
),
|
||||
div(setClass('error-message text-warning text-center')),
|
||||
set::actions(helper::isAjaxRequest('modal') ? '' : array(
|
||||
array(
|
||||
'text' => $lang->solution->background,
|
||||
'href' => createLink('install', 'step6'),
|
||||
'id' => 'skipInstallBtn',
|
||||
'class' => 'btn primary',
|
||||
),
|
||||
array(
|
||||
'text' => $lang->solution->retryInstall,
|
||||
'id' => 'retryInstallBtn',
|
||||
'class' => 'btn primary hidden',
|
||||
'onclick' => 'retryInstall(this)'
|
||||
),
|
||||
array(
|
||||
'text' => $lang->solution->cancelInstall,
|
||||
'id' => 'cancelInstallBtn',
|
||||
'class' => 'btn',
|
||||
'onclick' => 'cancelInstall(this)'
|
||||
),
|
||||
))
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if(!helper::isAjaxRequest('modal')) render('pagebase');
|
||||
@@ -0,0 +1,191 @@
|
||||
/**
|
||||
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
||||
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
||||
* https://github.com/chjj/term.js
|
||||
* @license MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* Originally forked from (with the author's permission):
|
||||
* Fabrice Bellard's javascript vt100 for jslinux:
|
||||
* http://bellard.org/jslinux/
|
||||
* Copyright (c) 2011 Fabrice Bellard
|
||||
* The original design remains. The terminal itself
|
||||
* has been extended to include xterm CSI codes, among
|
||||
* other features.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default styles for xterm.js
|
||||
*/
|
||||
|
||||
.xterm {
|
||||
cursor: text;
|
||||
position: relative;
|
||||
user-select: none;
|
||||
-ms-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
|
||||
.xterm.focus,
|
||||
.xterm:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.xterm .xterm-helpers {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
/**
|
||||
* The z-index of the helpers must be higher than the canvases in order for
|
||||
* IMEs to appear on top.
|
||||
*/
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.xterm .xterm-helper-textarea {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
/* Move textarea out of the screen to the far left, so that the cursor is not visible */
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
left: -9999em;
|
||||
top: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
z-index: -5;
|
||||
/** Prevent wrapping so the IME appears against the textarea at the correct position */
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.xterm .composition-view {
|
||||
/* TODO: Composition position got messed up somewhere */
|
||||
background: #000;
|
||||
color: #FFF;
|
||||
display: none;
|
||||
position: absolute;
|
||||
white-space: nowrap;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.xterm .composition-view.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.xterm .xterm-viewport {
|
||||
/* On OS X this is required in order for the scroll bar to appear fully opaque */
|
||||
background-color: #000;
|
||||
overflow-y: scroll;
|
||||
cursor: default;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.xterm .xterm-screen {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.xterm .xterm-screen canvas {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.xterm .xterm-scroll-area {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.xterm-char-measure-element {
|
||||
display: inline-block;
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -9999em;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.xterm.enable-mouse-events {
|
||||
/* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.xterm.xterm-cursor-pointer,
|
||||
.xterm .xterm-cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.xterm.column-select.focus {
|
||||
/* Column selection mode */
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
.xterm .xterm-accessibility,
|
||||
.xterm .xterm-message {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 10;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.xterm .live-region {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.xterm-dim {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.xterm-underline-1 { text-decoration: underline; }
|
||||
.xterm-underline-2 { text-decoration: double underline; }
|
||||
.xterm-underline-3 { text-decoration: wavy underline; }
|
||||
.xterm-underline-4 { text-decoration: dotted underline; }
|
||||
.xterm-underline-5 { text-decoration: dashed underline; }
|
||||
|
||||
.xterm-strikethrough {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.xterm-screen .xterm-decoration-container .xterm-decoration {
|
||||
z-index: 6;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.xterm-decoration-overview-ruler {
|
||||
z-index: 7;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.xterm-decoration-top {
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user