From ee2fed7a28ecd0c3ccd5fab95cfeb84cb5367737 Mon Sep 17 00:00:00 2001
From: tanghucheng
Date: Tue, 6 Dec 2022 13:40:26 +0800
Subject: [PATCH] * Finish task #79050.
---
config/zentaopms.php | 2 ++
db/update17.8.sql | 17 ++++++++++++++---
db/zentao.sql | 12 ++++++++++++
module/zahost/css/browse.css | 2 ++
module/zahost/js/browse.js | 5 +++++
module/zahost/lang/de.php | 1 +
module/zahost/lang/en.php | 3 ++-
module/zahost/lang/fr.php | 5 +++--
module/zahost/lang/zh-cn.php | 1 +
module/zahost/model.php | 1 +
module/zahost/view/browse.html.php | 8 ++++----
www/theme/default/style.css | 3 +++
12 files changed, 50 insertions(+), 10 deletions(-)
create mode 100644 module/zahost/js/browse.js
diff --git a/config/zentaopms.php b/config/zentaopms.php
index 92b9eee1a2..dfb7e9736c 100644
--- a/config/zentaopms.php
+++ b/config/zentaopms.php
@@ -255,6 +255,7 @@ define('TABLE_TESTRESULT', '`' . $config->db->prefix . 'testresult`');
define('TABLE_USERTPL', '`' . $config->db->prefix . 'usertpl`');
define('TABLE_ZAHOST', '`' . $config->db->prefix . 'host`');
define('TABLE_IMAGE', '`' . $config->db->prefix . 'image`');
+define('TABLE_AUTOMATION', '`' . $config->db->prefix . 'automation`');
if(!defined('TABLE_ASSET')) define('TABLE_ASSET', '`' . $config->db->prefix . 'asset`');
@@ -399,6 +400,7 @@ $config->objectTables['stage'] = TABLE_STAGE;
$config->objectTables['apistruct'] = TABLE_APISTRUCT;
$config->objectTables['repo'] = TABLE_REPO;
$config->objectTables['zahost'] = TABLE_ZAHOST;
+$config->objectTables['automation'] = TABLE_AUTOMATION;
$config->newFeatures = array('introduction', 'tutorial', 'youngBlueTheme', 'visions');
$config->disabledFeatures = '';
diff --git a/db/update17.8.sql b/db/update17.8.sql
index 2fde0707b4..7417536463 100644
--- a/db/update17.8.sql
+++ b/db/update17.8.sql
@@ -7,7 +7,7 @@ ALTER TABLE `zt_release` CHANGE `branch` `branch` varchar(255) NOT NULL;
ALTER TABLE `zt_release` CHANGE `build` `build` varchar(255) NOT NULL;
ALTER TABLE `zt_release` ADD `shadow` mediumint(8) unsigned NOT NULL DEFAULT '0' AFTER `branch`;
-ALTER TABLE `zt_host`
+ALTER TABLE `zt_host`
DROP COLUMN `cabinet`,
DROP COLUMN `cpuRate`,
DROP COLUMN `diskType`,
@@ -56,7 +56,7 @@ CHANGE COLUMN `privateIP` `intranet` varchar(128) NOT NULL AFTER `cpuCores`,
CHANGE COLUMN `publicIP` `extranet` varchar(128) NOT NULL AFTER `intranet`;
UPDATE zt_host h,
-zt_asset a
+zt_asset a
SET h.`name` = a.`name`,
h.`createdBy` = a.`createdBy`,
h.`createdDate` = a.`createdDate`,
@@ -66,7 +66,7 @@ h.`group` = a.`group`,
h.`type` = a.`type`,
h.`deleted` = a.`deleted`
WHERE
- h.`assetID` = a.`id`;
+h.`assetID` = a.`id`;
ALTER TABLE `zt_host` DROP COLUMN `assetID`;
@@ -96,6 +96,17 @@ CREATE TABLE `zt_image` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE `zt_automation` (
+ `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+ `node` int(11) unsigned NOT NULL DEFAULT 0,
+ `product` int(11) unsigned NOT NULL DEFAULT 0,
+ `path` varchar(255) NOT NULL DEFAULT '',
+ `shell` mediumtext NOT NULL,
+ `createdBy` varchar(30) NOT NULL,
+ `createdDate` datetime NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
CREATE OR REPLACE VIEW `ztv_normalproduct` AS SELECT * FROM `zt_product` WHERE `shadow` = 0;
REPLACE INTO `zt_report` (`code`, `name`, `module`, `sql`, `vars`, `langs`, `params`, `step`, `desc`, `addedBy`, `addedDate`) VALUES
diff --git a/db/zentao.sql b/db/zentao.sql
index db2b031c2a..dba039914b 100755
--- a/db/zentao.sql
+++ b/db/zentao.sql
@@ -7313,6 +7313,18 @@ CREATE TABLE `zt_image` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+-- DROP TABLE IF EXISTS `zt_automation`;
+CREATE TABLE `zt_automation` (
+ `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+ `node` int(11) unsigned NOT NULL DEFAULT 0,
+ `product` int(11) unsigned NOT NULL DEFAULT 0,
+ `path` varchar(255) NOT NULL DEFAULT '',
+ `shell` mediumtext NOT NULL,
+ `createdBy` varchar(30) NOT NULL,
+ `createdDate` datetime NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
-- DROP TABLE IF EXISTS `zt_service`;
CREATE TABLE IF NOT EXISTS `zt_service` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
diff --git a/module/zahost/css/browse.css b/module/zahost/css/browse.css
index f1eb7f176d..420038798f 100644
--- a/module/zahost/css/browse.css
+++ b/module/zahost/css/browse.css
@@ -1,3 +1,5 @@
.c-ip {width: 100px;}
.c-memory, .c-diskSize, .c-status, .c-cpuCores, .c-software, .c-instanceNum {width: 90px;}
.c-datetime {width: 150px;}
+.status-wait {color: #f00;}
+.c-actions {overflow: visible!important;}
diff --git a/module/zahost/js/browse.js b/module/zahost/js/browse.js
new file mode 100644
index 0000000000..5d89e31a64
--- /dev/null
+++ b/module/zahost/js/browse.js
@@ -0,0 +1,5 @@
+$('#hostList tr[data-status="wait"]').hover(function(){
+ $(this).find('.inithost').tooltip('toggle');
+},function(){
+ $(this).find('.inithost').tooltip('hide');
+});
diff --git a/module/zahost/lang/de.php b/module/zahost/lang/de.php
index a4d17173c8..fc227bf9d1 100644
--- a/module/zahost/lang/de.php
+++ b/module/zahost/lang/de.php
@@ -96,6 +96,7 @@ $lang->zahost->image->cancelDownloadSuccess = 'Successed to cancel image task';
$lang->zahost->empty = 'No Host';
+$lang->zahost->statusList['wait'] = 'Wait';
$lang->zahost->statusList['ready'] = 'Ready';
$lang->zahost->statusList['online'] = 'Online';
diff --git a/module/zahost/lang/en.php b/module/zahost/lang/en.php
index 9b92434673..fc227bf9d1 100644
--- a/module/zahost/lang/en.php
+++ b/module/zahost/lang/en.php
@@ -88,7 +88,7 @@ $lang->zahost->image->statusList['inprogress'] = 'Inprogress';
$lang->zahost->image->statusList['completed'] = 'Completed';
$lang->zahost->image->statusList['failed'] = 'Failed';
-$lang->zahost->image->imageEmpty = 'No Image';
+$lang->zahost->image->imageEmpty = 'No Image';
$lang->zahost->image->downloadImageFail = 'Failed to create image task';
$lang->zahost->image->downloadImageSuccess = 'Successed to create image task';
$lang->zahost->image->cancelDownloadFail = 'Failed to cancel image task';
@@ -96,6 +96,7 @@ $lang->zahost->image->cancelDownloadSuccess = 'Successed to cancel image task';
$lang->zahost->empty = 'No Host';
+$lang->zahost->statusList['wait'] = 'Wait';
$lang->zahost->statusList['ready'] = 'Ready';
$lang->zahost->statusList['online'] = 'Online';
diff --git a/module/zahost/lang/fr.php b/module/zahost/lang/fr.php
index 685998032f..9ba75488a1 100644
--- a/module/zahost/lang/fr.php
+++ b/module/zahost/lang/fr.php
@@ -6,12 +6,12 @@ $lang->zahost->create = 'Add Host';
$lang->zahost->view = 'Host View';
$lang->zahost->init = 'Init Host';
$lang->zahost->edit = 'Éditer';
+$lang->zahost->editAction = 'Edit Host';
+$lang->zahost->delete = 'Delete';
$lang->zahost->cancel = "Cancel";
$lang->zahost->editAction = 'Éditer Hôte';
$lang->zahost->delete = 'Supprimer';
$lang->zahost->deleteAction = 'Supprimer Hôte';
-$lang->zahost->byQuery = 'Recherche';
-$lang->zahost->all = 'Tous les hôtes';
$lang->zahost->browseNode = 'ZAnode Browse';
$lang->zahost->deleted = "Deleted";
@@ -96,6 +96,7 @@ $lang->zahost->image->cancelDownloadSuccess = 'Successed to cancel image task';
$lang->zahost->empty = 'No Host';
+$lang->zahost->statusList['wait'] = 'Wait';
$lang->zahost->statusList['ready'] = 'Ready';
$lang->zahost->statusList['online'] = 'Online';
diff --git a/module/zahost/lang/zh-cn.php b/module/zahost/lang/zh-cn.php
index d36d674776..9820af7c99 100644
--- a/module/zahost/lang/zh-cn.php
+++ b/module/zahost/lang/zh-cn.php
@@ -96,6 +96,7 @@ $lang->zahost->image->cancelDownloadSuccess = '取消下载镜像任务成功';
$lang->zahost->empty = '暂时没有宿主机';
+$lang->zahost->statusList['wait'] = '待初始化';
$lang->zahost->statusList['ready'] = '准备中';
$lang->zahost->statusList['online'] = '已上架';
diff --git a/module/zahost/model.php b/module/zahost/model.php
index 57f54f07ac..184dbccce5 100644
--- a/module/zahost/model.php
+++ b/module/zahost/model.php
@@ -37,6 +37,7 @@ class zahostModel extends model
$this->dao->table = 'zahost';
$hostInfo->type = 'zahost';
+ $hostInfo->status = 'wait';
$hostInfo->createdBy = $this->app->user->account;
$hostInfo->createdDate = helper::now();
$hostInfo->secret = md5($hostInfo->name . time());
diff --git a/module/zahost/view/browse.html.php b/module/zahost/view/browse.html.php
index 8194399bc7..940afefddb 100644
--- a/module/zahost/view/browse.html.php
+++ b/module/zahost/view/browse.html.php
@@ -38,7 +38,7 @@
-
+
recTotal}&recPerPage={$pager->recPerPage}";?>
@@ -57,7 +57,7 @@
-
+
| hostID);?> |
inlink('view', "id=$host->hostID"), $host->name, '', "");?> |
zahost->zaHostTypeList, $host->hostType);?> |
@@ -66,7 +66,7 @@
memory . $lang->zahost->unitList['GB'];?> |
diskSize . $lang->zahost->unitList['GB'];?> |
vsoft;?> |
- host->statusList, $host->status);?> |
+ host->statusList, $host->status);?> |
heartbeat) ? '' : $host->heartbeat;?> |
hostID]) ? '' : 'disabled';?>
@@ -74,7 +74,7 @@
hostID}", $host, 'list');?>
createLink('zahost', 'delete', "hostID={$host->id}"), '', 'hiddenwin', "title='$title' class='btn $disabled'");;?>
hostID}", $host, 'list', 'file', '', 'iframe', true, "data-width='60%'", $lang->zahost->image->list);?>
- hostID}", $host, 'list', 'info', '', '', false, '', $lang->zahost->initHost->title);?>
+ hostID}", $host, 'list', 'info', '', ' inithost', false, "data-placement='bottom'", $lang->zahost->initHost->title);?>
|
diff --git a/www/theme/default/style.css b/www/theme/default/style.css
index 39a049cd7c..393e1a1e03 100644
--- a/www/theme/default/style.css
+++ b/www/theme/default/style.css
@@ -231,3 +231,6 @@ tbody tr td.c-actions .dividing-line {width: 1px; height: 16px; display: inline-
.btn.disabled {pointer-events: auto;}
.btn.disabled i {color: #313c52;}
+
+/* Unset style for qa qa-automation-menu. */
+.qa-automation-menu > a:focus, .qa-automation-menu > a:hover {background: unset!important; cursor: default;}