* Zanode pages.

This commit is contained in:
zenggang
2023-11-01 02:47:52 +00:00
parent ec79641dbe
commit 4fde63260f
6 changed files with 210 additions and 10 deletions
+8 -8
View File
@@ -45,48 +45,48 @@ $config->zanode->dtable->fieldList['actions']['list']['getVNC']['icon'] = 'rem
$config->zanode->dtable->fieldList['actions']['list']['getVNC']['hint'] = $lang->zanode->getVNC;
$config->zanode->dtable->fieldList['actions']['list']['getVNC']['text'] = $lang->zanode->getVNC;
$config->zanode->dtable->fieldList['actions']['list']['getVNC']['target'] = '_blank';
$config->zanode->dtable->fieldList['actions']['list']['getVNC']['url'] = array('module' => 'zanode', 'method' => 'getVNC', 'params' => 'id={id}');
$config->zanode->dtable->fieldList['actions']['list']['getVNC']['url'] = helper::createLink('zanode', 'getVNC', 'id={id}');
$config->zanode->dtable->fieldList['actions']['list']['resume']['icon'] = 'resume';
$config->zanode->dtable->fieldList['actions']['list']['resume']['hint'] = $lang->zanode->resume;
$config->zanode->dtable->fieldList['actions']['list']['resume']['text'] = $lang->zanode->resumeNode;
$config->zanode->dtable->fieldList['actions']['list']['resume']['url'] = array('module' => 'zanode', 'method' => 'resume', 'params' => 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['resume']['url'] = helper::createLink('zanode', 'resume', 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['resume']['className'] = 'ajax-submit';
$config->zanode->dtable->fieldList['actions']['list']['suspend']['icon'] = 'moon';
$config->zanode->dtable->fieldList['actions']['list']['suspend']['hint'] = $lang->zanode->suspend;
$config->zanode->dtable->fieldList['actions']['list']['suspend']['text'] = $lang->zanode->suspendNode;
$config->zanode->dtable->fieldList['actions']['list']['suspend']['url'] = array('module' => 'zanode', 'method' => 'suspend', 'params' => 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['suspend']['url'] = helper::createLink('zanode', 'suspend', 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['suspend']['className'] = 'ajax-submit';
$config->zanode->dtable->fieldList['actions']['list']['start']['icon'] = 'play';
$config->zanode->dtable->fieldList['actions']['list']['start']['hint'] = $lang->zanode->boot;
$config->zanode->dtable->fieldList['actions']['list']['start']['text'] = $lang->zanode->bootNode;
$config->zanode->dtable->fieldList['actions']['list']['start']['url'] = array('module' => 'zanode', 'method' => 'start', 'params' => 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['start']['url'] = helper::createLink('zanode', 'start', 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['start']['className'] = 'ajax-submit';
$config->zanode->dtable->fieldList['actions']['list']['close']['icon'] = 'off';
$config->zanode->dtable->fieldList['actions']['list']['close']['hint'] = $lang->zanode->shutdown;
$config->zanode->dtable->fieldList['actions']['list']['close']['text'] = $lang->zanode->shutdownNode;
$config->zanode->dtable->fieldList['actions']['list']['close']['url'] = array('module' => 'zanode', 'method' => 'close', 'params' => 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['close']['url'] = helper::createLink('zanode', 'close', 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['close']['className'] = 'ajax-submit';
$config->zanode->dtable->fieldList['actions']['list']['reboot']['icon'] = 'restart';
$config->zanode->dtable->fieldList['actions']['list']['reboot']['hint'] = $lang->zanode->reboot;
$config->zanode->dtable->fieldList['actions']['list']['reboot']['text'] = $lang->zanode->rebootNode;
$config->zanode->dtable->fieldList['actions']['list']['reboot']['url'] = array('module' => 'zanode', 'method' => 'reboot', 'params' => 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['reboot']['url'] = helper::createLink('zanode', 'reboot', 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['reboot']['className'] = 'ajax-submit';
$config->zanode->dtable->fieldList['actions']['list']['createSnapshot']['icon'] = "plus";
$config->zanode->dtable->fieldList['actions']['list']['createSnapshot']['hint'] = $lang->zanode->createSnapshot;
$config->zanode->dtable->fieldList['actions']['list']['createSnapshot']['text'] = $lang->zanode->createSnapshot;
$config->zanode->dtable->fieldList['actions']['list']['createSnapshot']['url'] = array('module' => 'zanode', 'method' => 'createSnapshot', 'params' => 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['createSnapshot']['url'] = helper::createLink('zanode', 'createSnapshot', 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['createSnapshot']['data-toggle'] = 'modal';
$config->zanode->dtable->fieldList['actions']['list']['createSnapshot']['className'] = 'create-snapshot';
$config->zanode->dtable->fieldList['actions']['list']['edit']['icon'] = 'edit';
$config->zanode->dtable->fieldList['actions']['list']['edit']['hint'] = $lang->zanode->edit;
$config->zanode->dtable->fieldList['actions']['list']['edit']['url'] = array('module' => 'zanode', 'method' => 'edit', 'params' => 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['edit']['url'] = helper::createLink('zanode', 'edit', 'zanodeID={id}');
$config->zanode->dtable->fieldList['actions']['list']['createImage']['icon'] = 'export';
$config->zanode->dtable->fieldList['actions']['list']['createImage']['hint'] = $lang->zanode->createImage;
+5 -2
View File
@@ -1,5 +1,8 @@
window.afterRender = function()
{
$('.editSnapshot').attr('onclick', "window.parent.editSnapshot('" + $('.editSnapshot').attr('href') + "')");
$('.editSnapshot').attr('href', '###');
$('.editSnapshot').each(function()
{
$(this).attr('onclick', "window.parent.editSnapshot('" + $(this).attr('href') + "')");
$(this).attr('href', '###');
});
}
+59
View File
@@ -0,0 +1,59 @@
if(task)
{
var setProgress = self.setInterval("getTaskProgress()", 1500);
$(function()
{
var href = $('.success-text').find('a').attr('href');
href = href.replace('?onlybody=yes', '');
$('.success-text').find('a').attr('href', href);
})
window.getTaskProgress = function()
{
var url = $.createLink('zanode', 'ajaxGetTaskStatus', 'nodeID=' + nodeID + '&taskID=' + taskID + '&type=exportVm');
$.get(url, function(data)
{
var rate = data.rate;
var status = data.status;
if(rate == 1 || status == 'completed') rate = 1;
if(status == 'inprogress' && rate >= 1) rate = 0.97;
if(status == 'pending')
{
$('.status-title').text(zanodeLang.pending)
}
else
{
$('.status-title').text(zanodeLang.createImaging)
}
$('.rate').css('width', rate*100 + '%');
if(rate == 1 || (status != 'inprogress' && status != 'created' && status != 'pending'))
{
updateStatus(data);
clearInterval(setProgress);
}
}, 'json');
}
window.updateStatus = function(data)
{
var url = $.createLink('zanode', 'ajaxUpdateImage', 'taskID=' + taskID)
var postData = {"status":data.status, "path":data.path}
$.post(url, postData, function(result)
{
if(data.status == 'completed')
{
$('.success-text').removeClass('hidden');
$('.status-title').text('')
}
else
{
$('.status-title').text(zanodeLang.createImageFail)
}
}, 'json');
}
}
+76
View File
@@ -0,0 +1,76 @@
<?php
declare(strict_types=1);
/**
* The createimage view file of zanode 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 Zeng Gang<zenggang@easycorp.ltd>
* @package mr
* @link https://www.zentao.net
*/
namespace zin;
jsVar('task', $task);
jsVar('taskID', $task->task);
jsVar('nodeID', $node->id);
jsVar('zanodeLang', $lang->zanode);
$link = helper::createLink('zanode', 'create', "hostID={$node->parent}");
$link = str_replace('onlybody=yes', '', $link);
$link = trim($link, '?');
if($task) modalHeader(set::title($lang->zanode->createImage));
!$task ? formPanel
(
in_array($node->status, array('shutdown', 'shutoff')) ? null : set::ajax(array('beforeSubmit' => jsRaw("() => zui.Modal.confirm('{$lang->zanode->createImageNotice}')"))),
set::id('createImageForm'),
set::title($lang->zanode->createImage),
formGroup
(
set::name('name'),
set::label($lang->zanode->imageName),
),
formGroup
(
set::name('desc'),
set::label($lang->zanode->desc),
set::control('editor'),
)
) : h::div
(
h::h5
(
setClass('text-center status-title'),
$lang->zanode->pending
),
div
(
setClass('progress'),
div
(
setClass('progress-bar primary'),
setStyle('width', $task->rate),
),
),
h6
(
setClass('text-center success-text hidden'),
$lang->zanode->createImageSuccess,
h::a
(
setStyle('color', '#2e7fff'),
set::target('_parent'),
set::href($link),
$lang->zanode->createImageButton,
),
),
h6
(
setClass('text-center fail hidden'),
$lang->zanode->createImageFail
),
);
render();
+30
View File
@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
/**
* The createsnapshot view file of zanode 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 Zeng Gang<zenggang@easycorp.ltd>
* @package zanode
* @link https://www.zentao.net
*/
namespace zin;
formPanel
(
set::title($lang->zanode->createSnapshot),
formGroup
(
set::name('name'),
set::label($lang->zanode->snapshotName)
),
formGroup
(
set::name('desc'),
set::label($lang->zanode->desc),
set::control('textarea'),
),
);
render();
+32
View File
@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
/**
* The editsnapshot view file of zanode 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 Zeng Gang<zenggang@easycorp.ltd>
* @package zanode
* @link https://www.zentao.net
*/
namespace zin;
formPanel
(
set::title($lang->zanode->editSnapshot),
formGroup
(
set::name('name'),
set::label($lang->zanode->snapshotName),
set::value($snapshot->localName ? $snapshot->localName : $snapshot->name)
),
formGroup
(
set::name('desc'),
set::label($lang->zanode->desc),
set::control('textarea'),
set::value($snapshot->desc)
),
);
render();