diff --git a/api/v1/entries/hostheartbeat.php b/api/v1/entries/hostheartbeat.php index 48feb62d14..1d54b4c9c2 100644 --- a/api/v1/entries/hostheartbeat.php +++ b/api/v1/entries/hostheartbeat.php @@ -84,6 +84,19 @@ class hostHeartbeatEntry extends baseEntry if($heartbeat > 0) $vmData['heartbeat'] = date("Y-m-d H:i:s", $heartbeat); $this->dao->update(TABLE_ZAHOST)->data($vmData)->where('mac')->eq($vm->macAddress)->exec(); + + if($vm->status == 'running') + { + $node = $this->loadModel('zanode')->getNodeByMac($vm->macAddress); + if(!empty($node)) + { + $snaps = $this->loadModel('zanode')->getSnapshotList($node->id); + if(empty($snaps)) + { + if($vm->status == 'running') $this->loadModel('zanode')->createDefaultSnapshot($node->id); + } + } + } } } diff --git a/api/v1/entries/hostsubmit.php b/api/v1/entries/hostsubmit.php index 0dd5a83f05..9aea53faf2 100644 --- a/api/v1/entries/hostsubmit.php +++ b/api/v1/entries/hostsubmit.php @@ -40,13 +40,21 @@ class hostSubmitEntry extends baseEntry if(!$id) return $this->sendError(400, 'Secret error.'); - $imageInfo = $this->dao->select('`status`,`from`')->from(TABLE_IMAGE) + $imageInfo = $this->dao->select('`status`,`from`', 'name')->from(TABLE_IMAGE) ->where('id')->eq($task) ->fetch(); if(empty($imageInfo)) return $this->sendSuccess(200, 'success'); if($imageInfo->from == 'snapshot' && $imageInfo->status == 'restoring') { - $image->status = $image->status == 'completed' ? 'restore_completed' : 'restore_failed'; + if(in_array($image->status, array('failed', 'completed'))) $image->status = $image->status == 'completed' ? 'restore_completed' : 'restore_failed'; + } + else if($imageInfo->from == 'snapshot' && $imageInfo->status == 'creating') + { + if($image->status == 'failed') + { + $this->dao->delete()->from(TABLE_IMAGE)->where("id")->eq($task)->exec(); + return $this->sendSuccess(200, 'success'); + } } $this->dao->update(TABLE_IMAGE)->data($image)->where("id")->eq($task)->exec(); diff --git a/config/zentaopms.php b/config/zentaopms.php index 68b7f8b1b8..25efb84a38 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -406,6 +406,7 @@ $config->objectTables['apistruct'] = TABLE_APISTRUCT; $config->objectTables['repo'] = TABLE_REPO; $config->objectTables['dataview'] = TABLE_DATAVIEW; $config->objectTables['zahost'] = TABLE_ZAHOST; +$config->objectTables['zanode'] = TABLE_ZAHOST; $config->objectTables['automation'] = TABLE_AUTOMATION; $config->objectTables['stepResult'] = TABLE_TESTRUN; diff --git a/db/zentao.sql b/db/zentao.sql index f085f5801c..3848051d2e 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -6385,14 +6385,7 @@ REPLACE INTO `zt_lang` (`lang`, `module`, `section`, `key`, `value`, `system`) V ('zh-cn', 'custom', 'URSRList', '3', '{\"SRName\":\"\\u8f6f\\u9700\",\"URName\":\"\\u7528\\u9700\"}', '1'),('zh-cn', 'custom', 'URSRList', '4', '{\"SRName\":\"\\u6545\\u4e8b\",\"URName\":\"\\u53f2\\u8bd7\"}', '1'), ('zh-cn', 'custom', 'URSRList', '5', '{\"SRName\":\"\\u9700\\u6c42\",\"URName\":\"\\u7528\\u6237\\u9700\\u6c42\"}', '1'), ('en', 'custom', 'URSRList', '1', '{\"SRName\":\"Story\",\"URName\":\"Epic\"}', '0'), -('en', 'custom', 'URSRList', '2', '{\"SRName\":\"Software Requirement\",\"URName\":\"User Requirement\"}', '0'), -('all','stage','typeList','request','需求', '1'), -('all','stage','typeList','design','设计', '1'), -('all','stage','typeList','dev','开发', '1'), -('all','stage','typeList','qa','测试', '1'), -('all','stage','typeList','release','发布', '1'), -('all','stage','typeList','review','总结评审','1'), -('all','stage','typeList','other','其他','1'); +('en', 'custom', 'URSRList', '2', '{\"SRName\":\"Software Requirement\",\"URName\":\"User Requirement\"}', '0'); REPLACE INTO `zt_stage` (`name`,`percent`,`type`,`projectType`,`createdBy`,`createdDate`,`editedBy`,`editedDate`,`deleted`) VALUES ('需求','10','request','waterfall','admin','2020-02-08 21:08:30','admin','2020-02-12 13:50:27','0'), diff --git a/module/action/model.php b/module/action/model.php index 30ddc77468..6a346ac118 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -938,6 +938,8 @@ class actionModel extends model } else { + if($actionType == 'restoredsnapshot' && in_array($action->objectType, array('vm', 'zanode')) && $value == 'defaultSnap') $value = $this->lang->$objectType->snapshot->defaultSnapName; + $desc = str_replace('$' . $key, $value, $desc); } } diff --git a/module/admin/config.php b/module/admin/config.php index e72cfcd223..c7b91cdd5b 100755 --- a/module/admin/config.php +++ b/module/admin/config.php @@ -8,7 +8,7 @@ if(!isset($config->safe)) $config->safe = new stdclass(); if(!isset($config->safe->weak)) $config->safe->weak = '123456,password,12345,12345678,qwerty,123456789,1234,1234567,abc123,111111,123123'; $config->admin->menuGroup['system'] = array('custom|mode', 'backup', 'cron', 'action|trash', 'admin|xuanxuan', 'setting|xuanxuan', 'admin|license', 'admin|checkweak', 'admin|resetpwdsetting', 'admin|safe', 'custom|timezone', 'search|buildindex', 'admin|tableengine', 'ldap', 'custom|libreoffice', 'conference', 'client'); -$config->admin->menuGroup['user'] = array('dept', 'company', 'user', 'group'); +$config->admin->menuGroup['company'] = array('dept', 'company', 'user', 'group', 'tutorial'); $config->admin->menuGroup['switch'] = array('admin|setmodule'); $config->admin->menuGroup['model'] = array('auditcl', 'stage', 'design', 'cmcl', 'reviewcl', 'custom|required', 'custom|set', 'custom|flow', 'custom|code', 'custom|estimate', 'custom|hours', 'subject', 'process', 'activity', 'zoutput', 'classify', 'holiday', 'reviewsetting'); $config->admin->menuGroup['feature'] = array('custom|set', 'custom|product', 'custom|execution', 'custom|required', 'custom|kanban', 'approvalflow', 'measurement', 'meetingroom', 'custom|browsestoryconcept', 'custom|kanban', 'sqlbuilder', 'report'); @@ -72,10 +72,10 @@ $config->admin->extAPIURL = $config->admin->apiSite . 'extension-apiGetExte $config->admin->patchAPIURL = $config->admin->apiSite . 'extension-apiGetExtensions-bymodule-MTIxOA==-0-100-1.json'; $config->admin->downloadAPIURL = $config->admin->apiSite . 'download.json'; $config->admin->videoAPIURL = $config->admin->apiSite . 'publicclass.json'; -$config->admin->liteMenuList = array('system', 'user', 'feature', 'message', 'extension', 'dev'); +$config->admin->liteMenuList = array('system', 'company', 'feature', 'message', 'extension', 'dev'); $config->admin->helpURL['system'] = 'https://www.zentao.net/book/zentaopms/538.html'; -$config->admin->helpURL['user'] = 'https://www.zentao.net/book/zentaopms/38.html'; +$config->admin->helpURL['company'] = 'https://www.zentao.net/book/zentaopms/38.html'; $config->admin->helpURL['switch'] = 'https://www.zentao.net/book/zentaopms/38.html'; $config->admin->helpURL['model'] = 'https://www.zentao.net/book/zentaopms/533.html'; $config->admin->helpURL['feature'] = 'https://www.zentao.net/book/zentaopms/38.html'; diff --git a/module/admin/css/index.css b/module/admin/css/index.css index 22a1937b2f..b183d634b4 100755 --- a/module/admin/css/index.css +++ b/module/admin/css/index.css @@ -41,7 +41,9 @@ .settings-list > .setting-box > button.btn {padding: 5px 10px; height: 100%; width: 100%; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; white-space: unset; text-align: unset; border: 1px solid rgba(227, 228, 233, 0.6)} .settings-list > .setting-box > .btn:hover {background: unset;} .settings-list > .setting-box > .btn[disabled] {cursor: not-allowed; pointer-events: unset;} -.settings-list > .setting-box > .btn[disabled] > a {pointer-events: none;} +.settings-list > .setting-box > .btn[disabled] > a, +.settings-list > .setting-box > .btn[disabled] a.setting-help, +.settings-list > .setting-box > .btn[disabled] p.setting-desc {pointer-events: none;} .settings-list > .setting-box > .btn > h4 {padding-right: 5px;} .settings-list > .setting-box > .btn > h4 > div {gap: 3px;} .settings-list > .setting-box > .btn > h4 > img {padding-right: 8px; padding-bottom: 3px; width: 32px; height: 27px;} diff --git a/module/admin/lang/de.php b/module/admin/lang/de.php index 18acddc1f7..5c6bcca384 100755 --- a/module/admin/lang/de.php +++ b/module/admin/lang/de.php @@ -186,6 +186,7 @@ $lang->admin->updateDynamics = 'Dynamics'; $lang->admin->updatePatch = 'Patch'; $lang->admin->upgradeRecommend = 'Recommend Upgrade'; $lang->admin->zentaoUsed = 'You have used ZenTao'; +$lang->admin->noPriv = 'You have no permission to visit this block.'; $lang->admin->openTag = 'ZenTao Opensource '; $lang->admin->bizTag = 'ZenTao Biz '; diff --git a/module/admin/lang/en.php b/module/admin/lang/en.php index 88bcf84189..c8b6d77d65 100755 --- a/module/admin/lang/en.php +++ b/module/admin/lang/en.php @@ -186,6 +186,7 @@ $lang->admin->updateDynamics = 'Dynamics'; $lang->admin->updatePatch = 'Patch'; $lang->admin->upgradeRecommend = 'Recommend Upgrade'; $lang->admin->zentaoUsed = 'You have used ZenTao'; +$lang->admin->noPriv = 'You have no permission to visit this block.'; $lang->admin->openTag = 'ZenTao Opensource '; $lang->admin->bizTag = 'ZenTao Biz '; diff --git a/module/admin/lang/fr.php b/module/admin/lang/fr.php index 2039c78d4c..2f94760702 100755 --- a/module/admin/lang/fr.php +++ b/module/admin/lang/fr.php @@ -186,6 +186,7 @@ $lang->admin->updateDynamics = 'Dynamics'; $lang->admin->updatePatch = 'Patch'; $lang->admin->upgradeRecommend = 'Recommend Upgrade'; $lang->admin->zentaoUsed = 'You have used ZenTao'; +$lang->admin->noPriv = 'You have no permission to visit this block.'; $lang->admin->openTag = 'ZenTao Opensource '; $lang->admin->bizTag = 'ZenTao Biz '; diff --git a/module/admin/lang/menu.php b/module/admin/lang/menu.php index d7e25fd518..401cb564e8 100644 --- a/module/admin/lang/menu.php +++ b/module/admin/lang/menu.php @@ -10,9 +10,9 @@ $lang->admin->menuList->switch['desc'] = $lang->admin->menuSetting['switch']['d $lang->admin->menuList->switch['link'] = 'admin|setmodule'; $lang->admin->menuList->switch['order'] = 10; -$lang->admin->menuList->user['name'] = $lang->admin->menuSetting['user']['name']; -$lang->admin->menuList->user['desc'] = $lang->admin->menuSetting['user']['desc']; -$lang->admin->menuList->user['order'] = 15; +$lang->admin->menuList->company['name'] = $lang->admin->menuSetting['user']['name']; +$lang->admin->menuList->company['desc'] = $lang->admin->menuSetting['user']['desc']; +$lang->admin->menuList->company['order'] = 15; $lang->admin->menuList->model['name'] = $lang->admin->menuSetting['model']['name']; $lang->admin->menuList->model['desc'] = $lang->admin->menuSetting['model']['desc']; @@ -64,13 +64,13 @@ $lang->admin->menuList->system['menuOrder']['50'] = 'tableengine'; $lang->admin->menuList->system['dividerMenu'] = ',safe,'; -$lang->admin->menuList->user['subMenu']['dept'] = array('link' => "{$lang->dept->common}|dept|browse|", 'subModule' => 'dept'); -$lang->admin->menuList->user['subMenu']['user'] = array('link' => "{$lang->user->common}|company|browse|", 'subModule' => 'user'); -$lang->admin->menuList->user['subMenu']['group'] = array('link' => "{$lang->priv}|group|browse|", 'subModule' => 'group'); +$lang->admin->menuList->company['subMenu']['dept'] = array('link' => "{$lang->dept->common}|dept|browse|", 'subModule' => 'dept'); +$lang->admin->menuList->company['subMenu']['browseUser'] = array('link' => "{$lang->user->common}|company|browse|", 'subModule' => 'user,tutorial'); +$lang->admin->menuList->company['subMenu']['group'] = array('link' => "{$lang->priv}|group|browse|", 'subModule' => 'group'); -$lang->admin->menuList->user['menuOrder']['5'] = 'dept'; -$lang->admin->menuList->user['menuOrder']['10'] = 'user'; -$lang->admin->menuList->user['menuOrder']['15'] = 'group'; +$lang->admin->menuList->company['menuOrder']['5'] = 'dept'; +$lang->admin->menuList->company['menuOrder']['10'] = 'browseUser'; +$lang->admin->menuList->company['menuOrder']['15'] = 'group'; $lang->admin->menuList->model['subMenu']['common'] = array('link' => "{$lang->globalSetting}|custom|required|module=project", 'subModule' => 'custom,subject,holiday,stage', 'exclude' => 'stage-browse,stage-plusbrowse,stage-create,stage-edit,stage-batchcreate'); $lang->admin->menuList->model['subMenu']['scrum'] = array('link' => "{$lang->scrumModel}|auditcl|scrumbrowse|", 'subModule' => 'auditcl'); @@ -85,21 +85,22 @@ $lang->admin->menuList->model['menuOrder']['20'] = 'agileplus'; $lang->admin->menuList->model['menuOrder']['25'] = 'waterfallplus'; $lang->admin->menuList->model['tabMenu']['common']['project'] = array('link' => "{$lang->project->common}|custom|required|module=project", 'alias' => 'set', 'exclude' => 'custom', 'links' => array('custom|set|module=project&field=unitList')); -$lang->admin->menuList->model['tabMenu']['common']['stage'] = array('link' => "{$lang->stage->type}|stage|settype|", 'subModule' => 'stage', 'links' => array('stage|browse|')); +if(helper::hasFeature('waterfall') or helper::hasFeature('waterfallplus')) $lang->admin->menuList->model['tabMenu']['common']['stage'] = array('link' => "{$lang->stage->type}|stage|settype|", 'subModule' => 'stage', 'links' => array('stage|browse|')); $lang->admin->menuList->model['tabMenu']['common']['build'] = array('link' => "{$lang->build->common}|custom|required|module=build", 'alias' => 'set', 'exclude' => 'custom'); $lang->admin->menuList->model['tabMenu']['common']['flow'] = array('link' => "{$lang->custom->flow}|custom|flow|", 'divider' => true); $lang->admin->menuList->model['tabMenu']['common']['code'] = array('link' => "{$lang->code}|custom|code|"); $lang->admin->menuList->model['tabMenu']['common']['hours'] = array('link' => "{$lang->workingHour}|custom|hours|", 'subModule' => 'holiday', 'links' => array('holiday|browse|', 'custom|hours')); -$lang->admin->menuList->model['tabMenu']['waterfall']['stage'] = array('link' => "{$lang->stage->list}|stage|browse|", 'subModule' => 'stage', 'exclude' => 'stage-plusbrowse'); -$lang->admin->menuList->model['tabMenu']['waterfallplus']['stage'] = array('link' => "{$lang->stage->list}|stage|plusbrowse|", 'subModule' => 'stage', 'exclude' => 'stage-browse'); +if(helper::hasFeature('waterfall')) $lang->admin->menuList->model['tabMenu']['waterfall']['stage'] = array('link' => "{$lang->stage->list}|stage|browse|", 'subModule' => 'stage', 'exclude' => 'stage-plusbrowse'); +if(helper::hasFeature('waterfallplus')) $lang->admin->menuList->model['tabMenu']['waterfallplus']['stage'] = array('link' => "{$lang->stage->list}|stage|plusbrowse|", 'subModule' => 'stage', 'exclude' => 'stage-browse'); + $lang->admin->menuList->model['tabMenu']['menuOrder']['common']['5'] = 'project'; -$lang->admin->menuList->model['tabMenu']['menuOrder']['common']['7'] = 'stage'; +if(helper::hasFeature('waterfall') or helper::hasFeature('waterfallplus')) $lang->admin->menuList->model['tabMenu']['menuOrder']['common']['7'] = 'stage'; $lang->admin->menuList->model['tabMenu']['menuOrder']['common']['10'] = 'build'; $lang->admin->menuList->model['tabMenu']['menuOrder']['common']['35'] = 'flow'; $lang->admin->menuList->model['tabMenu']['menuOrder']['common']['40'] = 'code'; $lang->admin->menuList->model['tabMenu']['menuOrder']['common']['45'] = 'hours'; -$lang->admin->menuList->model['tabMenu']['menuOrder']['waterfall']['5'] = 'stage'; -$lang->admin->menuList->model['tabMenu']['menuOrder']['waterfallplus']['5'] = 'stage'; +if(helper::hasFeature('waterfall')) $lang->admin->menuList->model['tabMenu']['menuOrder']['waterfall']['5'] = 'stage'; +if(helper::hasFeature('waterfallplus')) $lang->admin->menuList->model['tabMenu']['menuOrder']['waterfallplus']['5'] = 'stage'; $lang->admin->menuList->feature['subMenu']['my'] = array('link' => "{$lang->my->common}|custom|set|module=todo&field=priList", 'exclude' => 'set,required'); $lang->admin->menuList->feature['subMenu']['product'] = array('link' => "{$lang->productCommon}|custom|required|module=product", 'exclude' => 'set,required', 'alias' => 'browsestoryconcept,product'); diff --git a/module/admin/lang/zh-cn.php b/module/admin/lang/zh-cn.php index c9ba4e745a..df3202c773 100755 --- a/module/admin/lang/zh-cn.php +++ b/module/admin/lang/zh-cn.php @@ -186,6 +186,7 @@ $lang->admin->updateDynamics = '更新动态'; $lang->admin->updatePatch = '补丁更新'; $lang->admin->upgradeRecommend = '推荐升级'; $lang->admin->zentaoUsed = '您已使用禅道'; +$lang->admin->noPriv = '您没有访问该区块的权限。'; $lang->admin->openTag = '禅道'; $lang->admin->bizTag = '禅道企业版'; diff --git a/module/admin/view/index.html.php b/module/admin/view/index.html.php index f2b812c35d..5728a5c8c9 100755 --- a/module/admin/view/index.html.php +++ b/module/admin/view/index.html.php @@ -19,7 +19,7 @@
admin->menuList as $menuKey => $menu):?> vision == 'lite' and !in_array($menuKey, $config->admin->liteMenuList)) continue;?> -
+
admin->noPriv}";?> data-id="">