diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php index 200bf61b15..799b674608 100644 --- a/lib/scm/gitlab.class.php +++ b/lib/scm/gitlab.class.php @@ -549,10 +549,11 @@ class gitlab * @param string $version * @param int $count * @param string $branch + * @param bool $getFile * @access public * @return array */ - public function getCommits($version = '', $count = 0, $branch = '') + public function getCommits($version = '', $count = 0, $branch = '', $getFile = false) { if(!scm::checkRevision($version)) return array(); $api = "commits"; @@ -620,7 +621,7 @@ class gitlab $log->time = date('Y-m-d H:i:s', strtotime($commit->created_at)); $commits[$commit->id] = $log; - $files[$commit->id] = $this->getFilesByCommit($log->revision); + if($getFile) $files[$commit->id] = $this->getFilesByCommit($log->revision); } return array('commits' => $commits, 'files' => $files); @@ -653,10 +654,12 @@ class gitlab * @param string $fromRevision * @param string $toRevision * @param int $perPage + * @param int $page + * @param bool $getUrl * @access public * @return array */ - public function getCommitsByPath($path, $fromRevision = '', $toRevision = '', $perPage = 0) + public function getCommitsByPath($path, $fromRevision = '', $toRevision = '', $perPage = 0, $page = 1, $getUrl = false) { $path = ltrim($path, DIRECTORY_SEPARATOR); $api = "commits"; @@ -683,6 +686,18 @@ class gitlab if($until) $param->until = $until; if($perPage) $param->per_page = $perPage; + if($page) $param->page = $page; + + if($getUrl) + { + $params = (array) $param; + $params['private_token'] = $this->token; + $params['per_page'] = isset($params['per_page']) ? $params['per_page'] : 100; + + $api = ltrim($api, '/'); + $api = $this->root . $api . '?' . http_build_query($params); + return $api; + } return $this->fetch($api, $param); } @@ -736,10 +751,11 @@ class gitlab * * @param string $path * @param bool $recursive + * @param bool $loop * @access public * @return mixed */ - public function tree($path, $recursive = 1) + public function tree($path, $recursive = 1, $loop = false) { $api = "tree"; @@ -747,17 +763,20 @@ class gitlab $params['path'] = ltrim($path, '/'); $params['ref'] = $this->branch; $params['recursive'] = (int) $recursive; - return $this->fetch($api, $params); + return $this->fetch($api, $params, $loop, $loop ? true : false); } /** * Fetch data from gitlab api. * * @param string $api + * @param array $params + * @param bool $needToLoop + * @param bool $multi * @access public * @return mixed */ - public function fetch($api, $params = array(), $needToLoop = false) + public function fetch($api, $params = array(), $needToLoop = false, $multi = false) { $params = (array) $params; $params['private_token'] = $this->token; @@ -768,19 +787,49 @@ class gitlab if($needToLoop) { $allResults = array(); - for($page = 1; true; $page++) + if($multi) { - $results = json_decode(commonModel::http($api . "&page={$page}")); - if(!is_array($results)) break; - if(!empty($results)) $allResults = array_merge($allResults, $results); - if(count($results) < 100) break; + $results = commonModel::httpWithHeader($api . "&page=1"); + if(empty($results['header']['X-Total-Pages'])) return array(); + + $totalPages = $results['header']['X-Total-Pages']; + if($totalPages == 1) + { + $allResults = json_decode($results['body']); + } + else + { + $requests = array(); + for($page = 1; $page <= $totalPages; $page++) + { + $requests[$page]['url'] = $api . "&page={$page}"; + } + + $results = requests::request_multiple($requests, array('timeout' => 60)); + foreach($results as $result) + { + if(empty($result->body)) continue; + $data = json_decode($result->body); + $allResults = array_merge($allResults, $data); + } + } + } + else + { + for($page = 1; true; $page++) + { + $results = json_decode(commonModel::http($api . "&page={$page}", null, array(), array(), 'data', 'POST', 30, true, false)); + if(!is_array($results)) break; + if(!empty($results)) $allResults = array_merge($allResults, $results); + if(count($results) < 100) break; + } } return $allResults; } else { - list($response, $httpCode) = commonModel::http($api, null, array(), array(), 'data', 'Post', 30, true); + list($response, $httpCode) = commonModel::http($api, null, array(), array(), 'data', 'POST', 30, true, false); if(!empty(commonModel::$requestErrors)) { commonModel::$requestErrors = array(); @@ -828,12 +877,15 @@ class gitlab $parsedLog->time = date('Y-m-d H:i:s', strtotime($commit->committed_date)); $parsedLog->comment = $commit->message; $parsedLog->change = array(); - foreach($commit->diffs as $diff) + if(!empty($commit->diffs)) { - $parsedLog->change[$diff->path] = array(); - $parsedLog->change[$diff->path]['action'] = $diff->action; - $parsedLog->change[$diff->path]['kind'] = $diff->type; - $parsedLog->change[$diff->path]['oldPath'] = $diff->oldPath; + foreach($commit->diffs as $diff) + { + $parsedLog->change[$diff->path] = array(); + $parsedLog->change[$diff->path]['action'] = $diff->action; + $parsedLog->change[$diff->path]['kind'] = $diff->type; + $parsedLog->change[$diff->path]['oldPath'] = $diff->oldPath; + } } $parsedLogs[] = $parsedLog; } diff --git a/module/admin/model.php b/module/admin/model.php index e2b8302278..7253ab5c88 100755 --- a/module/admin/model.php +++ b/module/admin/model.php @@ -320,6 +320,11 @@ class adminModel extends model { $menu['disabled'] = true; if(!isset($menu['link'])) $menu['link'] = ''; + if($menuKey == 'company') + { + $dept = $this->dao->select('id')->from(TABLE_DEPT)->fetch(); + if($dept and common::hasPriv('company', 'browse')) $menu['link'] = helper::createLink('company', 'browse'); + } /* Set links to authorized navigation. */ if(isset($menu['subMenu'])) @@ -338,7 +343,15 @@ class adminModel extends model $this->loadModel('mail'); if(!$this->config->mail->turnon and !$this->session->mailConfig) $subMenu['link'] = $this->lang->mail->common . '|mail|detect|'; } - if($menuKey == 'dev' and $subMenuKey == 'editor' and !empty($this->config->global->editor)) $subMenu['link'] = $this->lang->editor->common . '|editor|index|'; + if($menuKey == 'dev' and $subMenuKey == 'editor') + { + if(!empty($this->config->global->editor)) $subMenu['link'] = $this->lang->editor->common . '|editor|index|'; + if(empty($this->config->global->editor) and !$this->app->user->admin) + { + unset($menu['subMenu']['editor']); + continue; + } + } $link = array(); if(isset($menu['tabMenu'][$subMenuKey])) diff --git a/module/api/css/debug.css b/module/api/css/debug.css index 499d2aeb67..7c06a70fba 100644 --- a/module/api/css/debug.css +++ b/module/api/css/debug.css @@ -1,3 +1,10 @@ -body {padding-bottom: 0px; background-color: #fff;} +::-webkit-scrollbar {width: 10px; height: 10px;} +::-webkit-scrollbar-button {width: 0; height: 0;} +::-webkit-scrollbar-thumb:vertical {min-height: 28px; background-color: rgba(0, 0, 0, 0.2); background-clip: padding-box; border-radius: 2px; -webkit-box-shadow: inset 1px 1px 0 rgb(0 0 0 / 10%), inset 0 -1px 0 rgb(0 0 0 / 7%);} +::-webkit-scrollbar-track:hover {background-color:rgba(0,0,0,.05);-webkit-box-shadow:inset 1px 0 0 rgba(0,0,0,.1);} +::-webkit-scrollbar-thumb:hover{background-color:rgba(0,0,0,.4);} + +body.m-api-debug {padding-bottom: 0px; background-color: #fff;} #api p {margin: 5px 0 2px 0;} .c-name {width: 80px;} +.m-api-debug .main-header {padding: 10px 20px;} diff --git a/module/api/lang/de.php b/module/api/lang/de.php index efc65af19e..94f35208ae 100644 --- a/module/api/lang/de.php +++ b/module/api/lang/de.php @@ -215,3 +215,4 @@ $lang->api_lib_release->version = 'Version'; $lang->api->error = new stdclass(); $lang->api->error->onlySelect = 'Das SQL Interface erlaubt nur SELECT Abfragen.'; $lang->api->error->disabled = 'For security reasons, this feature is disabled. You can go to the config directory and modify the configuration item %s to open this function.'; +$lang->api->error->notInput = 'Debugging is not supported temporarily due to field parameter type restrictions'; diff --git a/module/api/lang/en.php b/module/api/lang/en.php index 9ade64dd07..75daf52e85 100644 --- a/module/api/lang/en.php +++ b/module/api/lang/en.php @@ -215,3 +215,4 @@ $lang->api_lib_release->version = 'Version'; $lang->api->error = new stdclass(); $lang->api->error->onlySelect = 'SQL API only allows SELECT query.'; $lang->api->error->disabled = 'For security reasons, this feature is disabled. Go to the config directory and modify the configuration item %s to enable it.'; +$lang->api->error->notInput = 'Debugging is not supported temporarily due to field parameter type restrictions'; diff --git a/module/api/lang/fr.php b/module/api/lang/fr.php index 140be832f2..52e2fdfa2f 100644 --- a/module/api/lang/fr.php +++ b/module/api/lang/fr.php @@ -215,3 +215,4 @@ $lang->api_lib_release->version = 'Version'; $lang->api->error = new stdclass(); $lang->api->error->onlySelect = 'Cette interface SQL ne supporte que les requêtes SELECT.'; $lang->api->error->disabled = 'For security reasons, this feature is disabled. You can go to the config directory and modify the configuration item %s to open this function.'; +$lang->api->error->notInput = 'Debugging is not supported temporarily due to field parameter type restrictions'; diff --git a/module/api/lang/zh-cn.php b/module/api/lang/zh-cn.php index 204f2906a8..7fe50f7740 100755 --- a/module/api/lang/zh-cn.php +++ b/module/api/lang/zh-cn.php @@ -215,3 +215,4 @@ $lang->api_lib_release->version = '版本'; $lang->api->error = new stdclass(); $lang->api->error->onlySelect = 'SQL查询接口只允许SELECT查询'; $lang->api->error->disabled = '因为安全原因,该功能被禁用。可以到config目录,修改配置项 %s,打开此功能。'; +$lang->api->error->notInput = '因字段参数类型限制,暂不支持调试'; diff --git a/module/api/view/debug.html.php b/module/api/view/debug.html.php index 777335d948..27c4361f28 100644 --- a/module/api/view/debug.html.php +++ b/module/api/view/debug.html.php @@ -20,7 +20,11 @@ parameters as $param):?> name?> + isOptional() or is_string($param->getDefaultValue())):?> name", $param->isOptional() ? $param->getDefaultValue() : '', "class='form-control'")?> + + api->error->notInput . html::hidden("$param->name", '', "class='form-control'")?> + diff --git a/module/block/view/executionblock.html.php b/module/block/view/executionblock.html.php index 6bb6811063..aa1d3d527e 100644 --- a/module/block/view/executionblock.html.php +++ b/module/block/view/executionblock.html.php @@ -45,7 +45,7 @@ $viewLink = $this->createLink('execution', 'task', 'executionID=' . $execution->id); ?> > - name, '', "title='$execution->name'");?> + name, '', "title='$execution->name' class='text-primary'");?> end;?> diff --git a/module/build/js/create.js b/module/build/js/create.js index 0626390b86..83002b4ade 100644 --- a/module/build/js/create.js +++ b/module/build/js/create.js @@ -49,6 +49,8 @@ $().ready(function() } }); $('#product').change(); + + $('[data-toggle="popover"]').popover(); }); /** diff --git a/module/build/view/create.html.php b/module/build/view/create.html.php index 021e030358..d664903546 100644 --- a/module/build/view/create.html.php +++ b/module/build/view/create.html.php @@ -60,7 +60,9 @@ build->builds;?> build->placeholder->multipleSelect}'");?> - build->notice->autoRelation;?> + + + build->name;?> diff --git a/module/common/lang/de.php b/module/common/lang/de.php index ca5edacdbc..dc90592156 100644 --- a/module/common/lang/de.php +++ b/module/common/lang/de.php @@ -209,6 +209,7 @@ $lang->stage->type = 'Stage Type'; $lang->stage->list = 'Stage List'; $lang->stage->percent = 'Workload Ratio'; $lang->execution->list = "{$lang->executionCommon} List"; +$lang->execution->CFD = "Cumulative Flow Diagrams"; $lang->kanban->common = 'Kanban'; $lang->backup->common = 'Backup'; $lang->action->trash = 'Recycle'; @@ -339,7 +340,7 @@ $lang->searchObjects['caselib'] = 'Case Library'; $lang->searchObjects['testreport'] = 'Test-Bericht'; $lang->searchObjects['program'] = 'Program'; $lang->searchObjects['project'] = $lang->projectCommon; -$lang->searchObjects['execution'] = $lang->executionCommon; +$lang->searchObjects['execution'] = $lang->execution->common; $lang->searchObjects['user'] = 'User'; $lang->searchTips = ''; @@ -363,7 +364,7 @@ $lang->visionList['lite'] = 'Operation Management Interface'; $lang->createObjects['todo'] = 'Todo'; $lang->createObjects['effort'] = 'Effort'; $lang->createObjects['bug'] = 'Bug'; -$lang->createObjects['story'] = 'Story'; +$lang->createObjects['story'] = $lang->SRCommon; $lang->createObjects['task'] = 'Task'; $lang->createObjects['testcase'] = 'Case'; $lang->createObjects['execution'] = $lang->execution->common; diff --git a/module/common/lang/en.php b/module/common/lang/en.php index 0249557bfc..aa59a98f81 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -209,6 +209,7 @@ $lang->stage->type = 'Stage Type'; $lang->stage->list = 'Stage List'; $lang->stage->percent = 'Workload Ratio'; $lang->execution->list = "{$lang->executionCommon} List"; +$lang->execution->CFD = "Cumulative Flow Diagrams"; $lang->kanban->common = 'Kanban'; $lang->backup->common = 'Backup'; $lang->action->trash = 'Recycle'; @@ -339,7 +340,7 @@ $lang->searchObjects['caselib'] = 'Case Library'; $lang->searchObjects['testreport'] = 'Test Report'; $lang->searchObjects['program'] = 'Program'; $lang->searchObjects['project'] = $lang->projectCommon; -$lang->searchObjects['execution'] = $lang->executionCommon; +$lang->searchObjects['execution'] = $lang->execution->common; $lang->searchObjects['user'] = 'User'; $lang->searchTips = 'ID (ctrl+g)'; @@ -363,7 +364,7 @@ $lang->visionList['lite'] = 'Operation Management Interface'; $lang->createObjects['todo'] = 'Todo'; $lang->createObjects['effort'] = 'Effort'; $lang->createObjects['bug'] = 'Bug'; -$lang->createObjects['story'] = 'Story'; +$lang->createObjects['story'] = $lang->SRCommon; $lang->createObjects['task'] = 'Task'; $lang->createObjects['testcase'] = 'Case'; $lang->createObjects['execution'] = $lang->execution->common; diff --git a/module/common/lang/fr.php b/module/common/lang/fr.php index 9a3446dae2..050b2d9794 100644 --- a/module/common/lang/fr.php +++ b/module/common/lang/fr.php @@ -209,6 +209,7 @@ $lang->stage->type = 'Stage Type'; $lang->stage->list = 'Stage List'; $lang->stage->percent = 'Workload Ratio'; $lang->execution->list = "{$lang->executionCommon} List"; +$lang->execution->CFD = "Cumulative Flow Diagrams"; $lang->kanban->common = 'Kanban'; $lang->backup->common = 'Backup'; $lang->action->trash = 'Recycle'; @@ -339,7 +340,7 @@ $lang->searchObjects['caselib'] = 'Case Library'; $lang->searchObjects['testreport'] = 'CR de Test'; $lang->searchObjects['program'] = 'Program'; $lang->searchObjects['project'] = $lang->projectCommon; -$lang->searchObjects['execution'] = $lang->executionCommon; +$lang->searchObjects['execution'] = $lang->execution->common; $lang->searchObjects['user'] = 'User'; $lang->searchTips = ''; @@ -363,7 +364,7 @@ $lang->visionList['lite'] = 'Operation Management Interface'; $lang->createObjects['todo'] = 'Todo'; $lang->createObjects['effort'] = 'Effort'; $lang->createObjects['bug'] = 'Bug'; -$lang->createObjects['story'] = 'Story'; +$lang->createObjects['story'] = $lang->SRCommon; $lang->createObjects['task'] = 'Task'; $lang->createObjects['testcase'] = 'Case'; $lang->createObjects['execution'] = $lang->execution->common; diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index 35a2ae034c..c9904f160c 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -418,6 +418,7 @@ $lang->project->noMultiple->scrum->menu->settings = $lang->scrum->menu->settin $lang->project->noMultiple->kanban = new stdclass(); $lang->project->noMultiple->kanban->menu = new stdclass(); $lang->project->noMultiple->kanban->menu->kanban = array('link' => "{$lang->kanban->common}|execution|kanban|executionID=%s"); +$lang->project->noMultiple->kanban->menu->CFD = array('link' => "{$lang->execution->CFD}|execution|cfd|executionID=%s"); $lang->project->noMultiple->kanban->menu->build = $lang->kanbanProject->menu->build; $lang->project->noMultiple->kanban->menu->settings = $lang->kanbanProject->menu->settings; @@ -438,8 +439,9 @@ $lang->project->noMultiple->scrum->menuOrder[50] = 'dynamic'; $lang->project->noMultiple->scrum->menuOrder[55] = 'settings'; $lang->project->noMultiple->kanban->menuOrder[5] = 'kanban'; -$lang->project->noMultiple->kanban->menuOrder[10] = 'build'; -$lang->project->noMultiple->kanban->menuOrder[15] = 'settings'; +$lang->project->noMultiple->kanban->menuOrder[10] = 'CFD'; +$lang->project->noMultiple->kanban->menuOrder[15] = 'build'; +$lang->project->noMultiple->kanban->menuOrder[20] = 'settings'; /* QA menu.*/ $lang->qa->menu = new stdclass(); diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 31ab2b399f..d9e6fa4d38 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -209,6 +209,7 @@ $lang->stage->type = '阶段类型'; $lang->stage->list = '阶段列表'; $lang->stage->percent = '工作量占比'; $lang->execution->list = "{$lang->executionCommon}列表"; +$lang->execution->CFD = "累积流图"; $lang->kanban->common = '看板'; $lang->backup->common = '备份'; $lang->action->trash = '回收站'; @@ -339,7 +340,7 @@ $lang->searchObjects['caselib'] = '用例库'; $lang->searchObjects['testreport'] = '测试报告'; $lang->searchObjects['program'] = '项目集'; $lang->searchObjects['project'] = $lang->projectCommon; -$lang->searchObjects['execution'] = $lang->executionCommon; +$lang->searchObjects['execution'] = $lang->execution->common; $lang->searchObjects['user'] = '用户'; $lang->searchTips = '编号(ctrl+g)'; @@ -363,10 +364,10 @@ $lang->visionList['lite'] = '运营管理界面'; $lang->createObjects['todo'] = '待办'; $lang->createObjects['effort'] = '日志'; $lang->createObjects['bug'] = 'Bug'; -$lang->createObjects['story'] = '需求'; +$lang->createObjects['story'] = $lang->SRCommon; $lang->createObjects['task'] = '任务'; $lang->createObjects['testcase'] = '用例'; -$lang->createObjects['execution'] = '执行'; +$lang->createObjects['execution'] = $lang->execution->common; $lang->createObjects['project'] = $lang->projectCommon; $lang->createObjects['product'] = $lang->productCommon; $lang->createObjects['program'] = '项目集'; diff --git a/module/common/model.php b/module/common/model.php index 0d9ffa989f..f895006831 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -912,7 +912,7 @@ class commonModel extends model $btnTitle = isset($lang->db->custom['common']['mainNav'][$tab]) ? $lang->db->custom['common']['mainNav'][$tab] : $lang->$tab->common; $commonKey = $tab . 'Common'; - if(isset($lang->$commonKey)) $btnTitle = $lang->$commonKey; + if(isset($lang->$commonKey) and $tab != 'execution') $btnTitle = $lang->$commonKey; $link = helper::createLink($currentModule, $currentMethod); $className = $tab == 'devops' ? 'btn num' : 'btn'; @@ -3181,18 +3181,21 @@ EOD; curl_close($curl); - $logFile = $app->getLogRoot() . 'saas.'. date('Ymd') . '.log.php'; - if(!file_exists($logFile)) file_put_contents($logFile, ''); - - $fh = @fopen($logFile, 'a'); - if($fh) + if($app->config->debug) { - fwrite($fh, date('Ymd H:i:s') . ": " . $app->getURI() . "\n"); - fwrite($fh, "url: " . $url . "\n"); - if(!empty($data)) fwrite($fh, "data: " . print_r($data, true) . "\n"); - fwrite($fh, "results:" . print_r($response, true) . "\n"); - if(!empty($errors)) fwrite($fh, "errors: " . $errors . "\n"); - fclose($fh); + $logFile = $app->getLogRoot() . 'saas.'. date('Ymd') . '.log.php'; + if(!file_exists($logFile)) file_put_contents($logFile, ''); + + $fh = @fopen($logFile, 'a'); + if($fh) + { + fwrite($fh, date('Ymd H:i:s') . ": " . $app->getURI() . "\n"); + fwrite($fh, "url: " . $url . "\n"); + if(!empty($data)) fwrite($fh, "data: " . print_r($data, true) . "\n"); + fwrite($fh, "results:" . print_r($response, true) . "\n"); + if(!empty($errors)) fwrite($fh, "errors: " . $errors . "\n"); + fclose($fh); + } } if($errors) commonModel::$requestErrors[] = $errors; @@ -3211,11 +3214,12 @@ EOD; * @param string $method POST|PATCH|PUT * @param int $timeout * @param bool $httpCode + * @param bool $log * @static * @access public * @return string */ - public static function http($url, $data = null, $options = array(), $headers = array(), $dataType = 'data', $method = 'POST', $timeout = 30, $httpCode = false) + public static function http($url, $data = null, $options = array(), $headers = array(), $dataType = 'data', $method = 'POST', $timeout = 30, $httpCode = false, $log = true) { global $lang, $app; if(!extension_loaded('curl')) @@ -3265,18 +3269,21 @@ EOD; if($httpCode) $httpCode = curl_getinfo($curl,CURLINFO_HTTP_CODE); curl_close($curl); - $logFile = $app->getLogRoot() . 'saas.'. date('Ymd') . '.log.php'; - if(!file_exists($logFile)) file_put_contents($logFile, ''); - - $fh = @fopen($logFile, 'a'); - if($fh) + if($log or $app->config->debug) { - fwrite($fh, date('Ymd H:i:s') . ": " . $app->getURI() . "\n"); - fwrite($fh, "url: " . $url . "\n"); - if(!empty($data)) fwrite($fh, "data: " . print_r($data, true) . "\n"); - fwrite($fh, "results:" . print_r($response, true) . "\n"); - if(!empty($errors)) fwrite($fh, "errors: " . $errors . "\n"); - fclose($fh); + $logFile = $app->getLogRoot() . 'saas.'. date('Ymd') . '.log.php'; + if(!file_exists($logFile)) file_put_contents($logFile, ''); + + $fh = @fopen($logFile, 'a'); + if($fh) + { + fwrite($fh, date('Ymd H:i:s') . ": " . $app->getURI() . "\n"); + fwrite($fh, "url: " . $url . "\n"); + if(!empty($data)) fwrite($fh, "data: " . print_r($data, true) . "\n"); + fwrite($fh, "results:" . print_r($response, true) . "\n"); + if(!empty($errors)) fwrite($fh, "errors: " . $errors . "\n"); + fclose($fh); + } } if($errors) commonModel::$requestErrors[] = $errors; diff --git a/module/compile/model.php b/module/compile/model.php index ba7b64cf8e..619de7cf6b 100644 --- a/module/compile/model.php +++ b/module/compile/model.php @@ -129,7 +129,14 @@ class compileModel extends model $url = new stdclass(); $url->userPWD = "$jenkinsUser:$jenkinsPassword"; - $url->url = sprintf('%s/job/%s/buildWithParameters/api/json', $jenkinsServer, $jenkins->pipeline); + if(strpos($jenkins->pipeline, '/job/') !== false) + { + $url->url = sprintf('%s%sbuildWithParameters/api/json', $jenkinsServer, $jenkins->pipeline); + } + else + { + $url->url = sprintf('%s/job/%s/buildWithParameters/api/json', $jenkinsServer, $jenkins->pipeline); + } return $url; } @@ -261,7 +268,14 @@ class compileModel extends model $jenkinsPassword = $jenkins->token ? $jenkins->token : base64_decode($jenkins->password); /* Get build list by API. */ - $url = sprintf('%s/job/%s/api/json?tree=builds[id,number,result,queueId,timestamp]', $jenkins->url, $job->pipeline); + if(strpos($job->pipeline, '/job/') !== false) + { + $url = sprintf('%s%sapi/json?tree=builds[id,number,result,queueId,timestamp]', $jenkins->url, $job->pipeline); + } + else + { + $url = sprintf('%s/job/%s/api/json?tree=builds[id,number,result,queueId,timestamp]', $jenkins->url, $job->pipeline); + } $response = common::http($url, '', array(CURLOPT_USERPWD => "$jenkinsUser:$jenkinsPassword")); if(!$response) return false; diff --git a/module/dev/control.php b/module/dev/control.php index a88a92a0ff..6499731156 100644 --- a/module/dev/control.php +++ b/module/dev/control.php @@ -28,7 +28,7 @@ class dev extends control $this->view->tab = 'api'; $this->view->selectedModule = $module; $this->view->apis = $module ? $this->dev->getAPIs($module) : array(); - $this->view->modules = $this->dev->getModules(); + $this->view->moduleTree = $this->dev->getTree($module, 'module'); $this->display(); } @@ -45,7 +45,7 @@ class dev extends control $this->view->position[] = html::a(inlink('api'), $this->lang->dev->common); $this->view->position[] = $this->lang->dev->db; - $this->view->tables = $this->dev->getTables(); + $this->view->tableTree = $this->dev->getTree($table, 'table'); $this->view->selectedTable = $table; $this->view->tab = 'db'; $this->view->fields = $table ? $this->dev->getFields($table) : array(); diff --git a/module/dev/css/api.css b/module/dev/css/api.css index e69de29bb2..31e4460e2b 100644 --- a/module/dev/css/api.css +++ b/module/dev/css/api.css @@ -0,0 +1,9 @@ +#sidebar .module-tree, #mainContent .module-content {overflow-y: auto;} +#mainContent .module-col {padding: 0;} +#mainContent .module-content {padding: 10px; padding-right: 0; margin-right: 0;} + +/* module-tree. */ +#moduleTree.tree ul {margin-bottom: 0;} +#moduleTree .active {background-color: #fff;} +#menuTree > li.has-list > ul > li {padding-left: 10px;} +#menuTree > li.has-list > ul > li.has-list {padding-left: 15px;} diff --git a/module/dev/css/common.css b/module/dev/css/common.css index d566f45dc2..ed8b1e2b9c 100644 --- a/module/dev/css/common.css +++ b/module/dev/css/common.css @@ -1,2 +1,3 @@ #sidebar .modulegroup {font-weight:bold; padding-top: 8px; border-top: 1px solid #ddd;} #sidebar .active {background-color: #e9f2fb; color: #006af1;} +#sidebar .cell a {white-space: nowrap;} diff --git a/module/dev/css/db.css b/module/dev/css/db.css new file mode 100644 index 0000000000..6708343afd --- /dev/null +++ b/module/dev/css/db.css @@ -0,0 +1,9 @@ +#sidebar .module-tree, #mainContent .module-content {overflow-y: auto;} +#mainContent .module-col {padding: 0;} +#mainContent .module-content {padding: 10px; padding-right: 0; margin-right: 0;} + +/* module-tree. */ +#tableTree.tree ul {margin-bottom: 0;} +#tableTree .active {background-color: #fff;} +#tableTree > li.has-list > ul > li {padding-left: 10px;} +#tableTree > li.has-list > ul > li.has-list {padding-left: 15px;} diff --git a/module/dev/css/langitem.css b/module/dev/css/langitem.css index 0feb0d824b..ba24381ece 100644 --- a/module/dev/css/langitem.css +++ b/module/dev/css/langitem.css @@ -26,8 +26,8 @@ .form-item-content {padding-left: 44px;} .form-item-content > .form-item {gap: 64px; height: 56px; align-items: center; position: relative; width: 500px;} .form-item-content > .form-item.w-expand {width: 700px;} -.form-item-content > .form-item > .label {flex: 0 0 160px; padding-left: 40px; background: #F8F8F8; display: flex; align-items: center; color: currentColor;} -.form-item-content > .form-item > .input-group {margin-left: 20px; width:200px; height:32px;} +.form-item-content > .form-item > .label {flex: 0 0 160px; padding-left: 40px; background: #F8F8F8; display: flex; align-items: center; color: currentColor; font-size: 13px;} +.form-item-content > .form-item > .input-group {margin-left: 20px; width:180px; height:32px;} .form-item-content > .form-item > .input-group > .input-group-addon {flex: 1 1 30%;} .form-item-content > .form-item > .input-control > input {margin-left: 40px;} .form-item-content > .form-item.active .icon {display: unset;} diff --git a/module/dev/js/api.js b/module/dev/js/api.js new file mode 100644 index 0000000000..16f1439eb8 --- /dev/null +++ b/module/dev/js/api.js @@ -0,0 +1,45 @@ +$(function() +{ + initModuleTree(); + setHeight(); + $(window).resize(setHeight); +}); + +/** + * Set pane height. + * + * @access public + * @return void + */ +function setHeight() +{ + var paneHeight = $(window).height() - 90; + $('#sidebar .module-tree,#mainContent .module-content').css('height', paneHeight); +} + +/** + * Init module tree by zui. + * + * @access public + * @return void + */ +function initModuleTree() +{ + $('#moduleTree').tree( + { + data: moduleTree, + initialState: 'active', + itemCreator: function($li, item) + { + $li.append('' + item.title + ''); + if (item.active) $li.addClass('active open in'); + } + }); + + $('#moduleTree').on('click', 'a', function(e) + { + var target = $(e.target); + if (target.attr('data-has-children') === 'true') return; + self.location.href = createLink('dev', 'api', 'module=' + target.attr('data-module')); + }) +} diff --git a/module/dev/js/db.js b/module/dev/js/db.js new file mode 100644 index 0000000000..dbf1b65a14 --- /dev/null +++ b/module/dev/js/db.js @@ -0,0 +1,45 @@ +$(function() +{ + initTableTree(); + setHeight(); + $(window).resize(setHeight); +}); + +/** + * Set pane height. + * + * @access public + * @return void + */ +function setHeight() +{ + var paneHeight = $(window).height() - 90; + $('#sidebar .module-tree,#mainContent .module-content').css('height', paneHeight); +} + +/** + * Init table tree by zui. + * + * @access public + * @return void + */ +function initTableTree() +{ + $('#tableTree').tree( + { + data: tableTree, + initialState: 'active', + itemCreator: function($li, item) + { + $li.append('' + item.title + ''); + if (item.active) $li.addClass('active open in'); + } + }); + + $('#tableTree').on('click', 'a', function(e) + { + var target = $(e.target); + if (target.attr('data-has-children') === 'true') return; + self.location.href = createLink('dev', 'db', 'module=' + target.attr('data-module')); + }) +} diff --git a/module/dev/lang/de.php b/module/dev/lang/de.php index ff90bc3a20..e815c1b72d 100644 --- a/module/dev/lang/de.php +++ b/module/dev/lang/de.php @@ -38,6 +38,9 @@ $lang->dev->fields['type'] = 'Typ'; $lang->dev->fields['length'] = 'Länge'; $lang->dev->fields['null'] = 'Null'; +$lang->dev->switchList['1'] = 'On'; +$lang->dev->switchList['0'] = 'Off'; + $lang->dev->tableList = array(); $lang->dev->tableList['action'] = 'Aktion'; $lang->dev->tableList['bug'] = 'Bug'; @@ -166,6 +169,14 @@ $lang->dev->tableList['client'] = 'Client Version Update'; $lang->dev->tableList['conference'] = 'Conference'; $lang->dev->tableList['integration'] = 'Integration'; $lang->dev->tableList['license'] = 'License'; +$lang->dev->tableList['zanode'] = 'ZAnode'; +$lang->dev->tableList['dashboard'] = 'Dashboard'; +$lang->dev->tableList['screen'] = 'Screen'; +$lang->dev->tableList['zahost'] = 'ZAhost'; +$lang->dev->tableList['approval'] = 'Approval'; +$lang->dev->tableList['approvalflow'] = 'Approval Flow'; +$lang->dev->tableList['chart'] = 'Chart'; +$lang->dev->tableList['dataset'] = 'Dataset'; $lang->dev->groupList['my'] = 'Dashboard'; $lang->dev->groupList['program'] = 'Program'; @@ -202,4 +213,4 @@ $lang->dev->projectMenu['waterfall'] = "Waterfall / Waterfall + {$lang->proj $lang->dev->projectMenu['kanbanProject'] = "Kanban {$lang->projectCommon}"; if($config->vision == 'lite') $lang->dev->projectMenu['kanbanProject'] = $lang->projectCommon; -$this->lang->dev->replaceLable['project-execution'] = "{$lang->executionCommon} / Stage"; +if($config->vision == 'rnd') $this->lang->dev->replaceLable['project-execution'] = "{$lang->executionCommon} / Stage"; diff --git a/module/dev/lang/en.php b/module/dev/lang/en.php index 024a0761ce..ac7deabf7e 100644 --- a/module/dev/lang/en.php +++ b/module/dev/lang/en.php @@ -38,6 +38,9 @@ $lang->dev->fields['type'] = 'Type'; $lang->dev->fields['length'] = 'Length'; $lang->dev->fields['null'] = 'Null'; +$lang->dev->switchList['1'] = 'On'; +$lang->dev->switchList['0'] = 'Off'; + $lang->dev->tableList = array(); $lang->dev->tableList['action'] = 'Action'; $lang->dev->tableList['bug'] = 'Bug'; @@ -166,6 +169,14 @@ $lang->dev->tableList['client'] = 'Client Version Update'; $lang->dev->tableList['conference'] = 'Conference'; $lang->dev->tableList['integration'] = 'Integration'; $lang->dev->tableList['license'] = 'License'; +$lang->dev->tableList['zanode'] = 'ZAnode'; +$lang->dev->tableList['dashboard'] = 'Dashboard'; +$lang->dev->tableList['screen'] = 'Screen'; +$lang->dev->tableList['zahost'] = 'ZAhost'; +$lang->dev->tableList['approval'] = 'Approval'; +$lang->dev->tableList['approvalflow'] = 'Approval Flow'; +$lang->dev->tableList['chart'] = 'Chart'; +$lang->dev->tableList['dataset'] = 'Dataset'; $lang->dev->groupList['my'] = 'Dashboard'; $lang->dev->groupList['program'] = 'Program'; @@ -202,4 +213,4 @@ $lang->dev->projectMenu['waterfall'] = "Waterfall / Waterfall + {$lang->proj $lang->dev->projectMenu['kanbanProject'] = "Kanban {$lang->projectCommon}"; if($config->vision == 'lite') $lang->dev->projectMenu['kanbanProject'] = $lang->projectCommon; -$this->lang->dev->replaceLable['project-execution'] = "{$lang->executionCommon} / Stage"; +if($config->vision == 'rnd') $this->lang->dev->replaceLable['project-execution'] = "{$lang->executionCommon} / Stage"; diff --git a/module/dev/lang/fr.php b/module/dev/lang/fr.php index 024a0761ce..ac7deabf7e 100644 --- a/module/dev/lang/fr.php +++ b/module/dev/lang/fr.php @@ -38,6 +38,9 @@ $lang->dev->fields['type'] = 'Type'; $lang->dev->fields['length'] = 'Length'; $lang->dev->fields['null'] = 'Null'; +$lang->dev->switchList['1'] = 'On'; +$lang->dev->switchList['0'] = 'Off'; + $lang->dev->tableList = array(); $lang->dev->tableList['action'] = 'Action'; $lang->dev->tableList['bug'] = 'Bug'; @@ -166,6 +169,14 @@ $lang->dev->tableList['client'] = 'Client Version Update'; $lang->dev->tableList['conference'] = 'Conference'; $lang->dev->tableList['integration'] = 'Integration'; $lang->dev->tableList['license'] = 'License'; +$lang->dev->tableList['zanode'] = 'ZAnode'; +$lang->dev->tableList['dashboard'] = 'Dashboard'; +$lang->dev->tableList['screen'] = 'Screen'; +$lang->dev->tableList['zahost'] = 'ZAhost'; +$lang->dev->tableList['approval'] = 'Approval'; +$lang->dev->tableList['approvalflow'] = 'Approval Flow'; +$lang->dev->tableList['chart'] = 'Chart'; +$lang->dev->tableList['dataset'] = 'Dataset'; $lang->dev->groupList['my'] = 'Dashboard'; $lang->dev->groupList['program'] = 'Program'; @@ -202,4 +213,4 @@ $lang->dev->projectMenu['waterfall'] = "Waterfall / Waterfall + {$lang->proj $lang->dev->projectMenu['kanbanProject'] = "Kanban {$lang->projectCommon}"; if($config->vision == 'lite') $lang->dev->projectMenu['kanbanProject'] = $lang->projectCommon; -$this->lang->dev->replaceLable['project-execution'] = "{$lang->executionCommon} / Stage"; +if($config->vision == 'rnd') $this->lang->dev->replaceLable['project-execution'] = "{$lang->executionCommon} / Stage"; diff --git a/module/dev/lang/zh-cn.php b/module/dev/lang/zh-cn.php index 890f5b8bcb..0e5e117fd5 100644 --- a/module/dev/lang/zh-cn.php +++ b/module/dev/lang/zh-cn.php @@ -169,6 +169,14 @@ $lang->dev->tableList['client'] = '客户端版本更新'; $lang->dev->tableList['conference'] = '音视频'; $lang->dev->tableList['integration'] = '集成'; $lang->dev->tableList['license'] = '授权'; +$lang->dev->tableList['zanode'] = '执行节点'; +$lang->dev->tableList['dashboard'] = '仪表盘'; +$lang->dev->tableList['screen'] = '大屏'; +$lang->dev->tableList['zahost'] = '宿主机'; +$lang->dev->tableList['approval'] = '审批'; +$lang->dev->tableList['approvalflow'] = '审批流'; +$lang->dev->tableList['chart'] = '图表'; +$lang->dev->tableList['dataset'] = '数据集'; $lang->dev->groupList['my'] = '我的地盘'; $lang->dev->groupList['program'] = '项目集'; @@ -205,4 +213,4 @@ $lang->dev->projectMenu['waterfall'] = "瀑布 / 融合瀑布{$lang->project $lang->dev->projectMenu['kanbanProject'] = "看板{$lang->projectCommon}"; if($config->vision == 'lite') $lang->dev->projectMenu['kanbanProject'] = $lang->projectCommon; -$this->lang->dev->replaceLable['project-execution'] = "{$lang->executionCommon} / 阶段"; +if($config->vision == 'rnd') $this->lang->dev->replaceLable['project-execution'] = "{$lang->executionCommon} / 阶段"; diff --git a/module/dev/model.php b/module/dev/model.php index 0a6d869234..e2706de62f 100644 --- a/module/dev/model.php +++ b/module/dev/model.php @@ -536,13 +536,13 @@ class devModel extends model break; } - foreach($customeds as $type => $customed) + foreach($customeds as $customType => $customed) { if(is_array($customed)) { foreach($customed as $row) { - $langKey = $type == 'featureBar' ? "featureBar-{$method}_" : $row->section . '_'; + $langKey = $customType == 'featureBar' ? "featureBar-{$method}_" : $row->section . '_'; $rowKey = $row->key; $customedLangs[$langKey . $rowKey] = $row->value; } @@ -820,6 +820,16 @@ class devModel extends model if(!in_array($type, $this->config->dev->navTypes)) return $menuTree; $mainNav = $type == 'second' ? $this->lang->mainNav : array(); + if($this->config->vision != 'open' and $type == 'second') + { + $flowNav = $this->dao->select('module')->from(TABLE_WORKFLOW) + ->where('buildin')->eq(0) + ->andWhere('vision')->eq($this->config->vision) + ->andWhere('navigator')->in('primary,secondary') + ->fetchPairs(); + foreach($flowNav as $nav) unset($mainNav->$nav); + } + if($type != 'second') { /* Set main nav list. */ @@ -1062,4 +1072,44 @@ class devModel extends model $menu->children = array(); return $menu; } + + /** + * Get tree by type. + * + * @param string $currentObject + * @param string $type module|table + * @access public + * @return array + */ + public function getTree($currentObject, $type) + { + $tree = array(); + if(!in_array($type, array('module', 'table'))) return $tree; + + $objects = $type == 'module' ? $this->getModules() : $this->getTables(); + $groupList = array_merge($this->lang->dev->groupList, $this->lang->dev->endGroupList); + foreach($groupList as $moduleKey => $moduleName) + { + if(empty($objects[$moduleKey])) continue; + + $module = new stdclass(); + $module->key = $moduleKey; + $module->title = $moduleName; + $module->active = 0; + $module->children = array(); + foreach($objects[$moduleKey] as $objectKey => $objectName) + { + $defaultValue = $type == 'module' ? $objectName : ''; + $object = new stdclass(); + $object->key = $objectName; + $object->title = zget($this->lang->dev->tableList, $objectKey, $defaultValue); + $object->active = $objectName == $currentObject ? 1 : 0; + if($object->active) $module->active = 1; + + $module->children[] = $object; + } + $tree[] = $module; + } + return $tree; + } } diff --git a/module/dev/view/api.html.php b/module/dev/view/api.html.php index 914b930f84..5099cc18d5 100644 --- a/module/dev/view/api.html.php +++ b/module/dev/view/api.html.php @@ -1,110 +1,90 @@ +