diff --git a/lib/zin/wg/dtable/v1.php b/lib/zin/wg/dtable/v1.php index 86d102a5f0..6fa4f4d152 100644 --- a/lib/zin/wg/dtable/v1.php +++ b/lib/zin/wg/dtable/v1.php @@ -145,7 +145,10 @@ class dtable extends wg else if(!empty($setting['module']) && !empty($setting['method'])) { if(!hasPriv($setting['module'], $setting['method'])) return ''; - return createLink($setting['module'], $setting['method'], zget($setting, 'params', ''), '', !empty($setting['onlybody'])); + $url = createLink($setting['module'], $setting['method'], zget($setting, 'params', ''), '', !empty($setting['onlybody'])); + if(empty($setting['target'])) return $url; + + return array('url' => $url, 'target' => $setting['target']); } return $setting; } diff --git a/module/instance/zen.php b/module/instance/zen.php new file mode 100644 index 0000000000..aeff34d95b --- /dev/null +++ b/module/instance/zen.php @@ -0,0 +1,71 @@ + + * @package instance + * @link https://www.zentao.net + */ +class instanceZen extends instance +{ + /** + * 自动保存devops应用授权信息。 + * Auto save auth info of devops. + * + * @param object $instance + * @access protected + * @return void + */ + protected function saveAuthInfo(object $instance): void + { + if(empty($this->config->instance->devopsApps[$instance->appID])) return; + + $url = 'https://' . $instance->domain; + $pipeline = $this->loadModel('pipeline')->getByUrl($url); + if(!empty($pipeline)) return; + + $tempMappings = $this->loadModel('cne')->getSettingsMapping($instance); + if(empty($tempMappings)) return; + + + $pipeline = new stdclass(); + $instance->type = $this->config->instance->devopsApps[$instance->appID]; + $pipeline->type = $instance->type; + $pipeline->private = md5(strval(rand(10,113450))); + $pipeline->createdBy = 'system'; + $pipeline->createdDate = helper::now(); + $pipeline->url = $url; + $pipeline->name = $this->generatePipelineName($instance); + $pipeline->token = zget($tempMappings, 'admin_token', ''); + $pipeline->account = zget($tempMappings, 'admin_username', ''); + $pipeline->password = zget($tempMappings, 'admin_password', ''); + $pipeline->token = zget($tempMappings, 'admin_token', ''); + + $this->pipeline->create($pipeline); + } + + /** + * 自动保存devops应用授权信息。 + * Auto save auth info of devops. + * + * @param object $instance + * @access protected + * @return string + */ + protected function generatePipelineName(object $instance): string + { + $name = $instance->name; + $type = $instance->type; + if(empty($this->loadModel('pipeline')->getByNameAndType($name, $type))) return $name; + if(empty($this->loadModel('pipeline')->getByNameAndType($name . '-' . $instance->appVersion, $type))) return $name . '-' . $instance->appVersion; + + for($times = 1; $times < 5; $times ++) + { + if(empty($this->loadModel('pipeline')->getByNameAndType($name . '-' . $times, $name))) return $name . '-' . $times; + } + } +} + diff --git a/module/mr/ui/diff.html.php b/module/mr/ui/diff.html.php index ff38d2c79f..f8cf49a8be 100644 --- a/module/mr/ui/diff.html.php +++ b/module/mr/ui/diff.html.php @@ -135,6 +135,7 @@ panel tree ( set::id('monacoTree'), + set::canSplit(false), set::items($tree), set::collapsedIcon('folder'), set::expandedIcon('folder-open'), diff --git a/module/mr/ui/linkbug.html.php b/module/mr/ui/linkbug.html.php index 210bb27f38..5c7b28bd9f 100644 --- a/module/mr/ui/linkbug.html.php +++ b/module/mr/ui/linkbug.html.php @@ -33,8 +33,7 @@ div $cols = array(); foreach($config->release->dtable->defaultFields['linkBug'] as $field) $cols[$field] = zget($config->bug->dtable->fieldList, $field, array()); $data = array_values($allBugs); -$cols['title']['data-size'] = 'lg'; -$cols['title']['data-toggle'] = 'modal'; +$cols['title']['link'] = array('module' => 'bug', 'method' => 'view', 'params' => 'bugID={id}', 'target' => '_blank'); dtable ( set::userMap($users), diff --git a/module/mr/ui/linkstory.html.php b/module/mr/ui/linkstory.html.php index a4a482d285..ffd983eee5 100644 --- a/module/mr/ui/linkstory.html.php +++ b/module/mr/ui/linkstory.html.php @@ -33,9 +33,9 @@ div $cols = array(); foreach($config->release->dtable->defaultFields['linkStory'] as $field) $cols[$field] = zget($config->release->dtable->story->fieldList, $field, array()); $cols = array_map(function($col){$col['show'] = true; return $col;}, $cols); -$cols['title']['link'] = $this->createLink('story', 'view', "storyID={id}"); +$cols['title']['link'] = array('module' => 'story', 'method' => 'view', 'params' => 'storyID={id}', 'target' => '_blank'); $cols['title']['nestedToggle'] = false; -$cols['title']['data-size'] = 'lg'; +$cols['title']['data-toggle'] = ''; $data = array_values($allStories); dtable diff --git a/module/repo/config/dtable.php b/module/repo/config/dtable.php index b9f525c963..306f241264 100644 --- a/module/repo/config/dtable.php +++ b/module/repo/config/dtable.php @@ -189,8 +189,8 @@ $config->repo->taskDtable->fieldList['assignedTo'] = $config->task->dtable->fiel $config->repo->taskDtable->fieldList['status'] = $config->task->dtable->fieldList['status']; $config->repo->taskDtable->fieldList['pri']['fixed'] = 'left'; -$config->repo->taskDtable->fieldList['name']['data-toggle'] = 'modal'; -$config->repo->taskDtable->fieldList['name']['data-size'] = 'lg'; $config->repo->taskDtable->fieldList['name']['nestedToggle'] = false; $config->repo->taskDtable->fieldList['name']['title'] = $lang->task->name; +$config->repo->taskDtable->fieldList['name']['link'] = array('module' => 'task', 'method' => 'view', 'params' => 'taskID={id}', 'target' => '_blank'); $config->repo->taskDtable->fieldList['assignedTo']['title'] = $lang->task->assignedTo; + diff --git a/module/repo/ui/linkbug.html.php b/module/repo/ui/linkbug.html.php index c952a9a03c..5df84e76c5 100644 --- a/module/repo/ui/linkbug.html.php +++ b/module/repo/ui/linkbug.html.php @@ -41,8 +41,8 @@ div ); $cols = array(); foreach($config->release->dtable->defaultFields['linkBug'] as $field) $cols[$field] = zget($config->bug->dtable->fieldList, $field, array()); -$cols['title']['data-size'] = 'lg'; -$cols['title']['data-toggle'] = 'modal'; +$cols['title']['data-toggle'] = ''; +$cols['title']['link'] = array('module' => 'bug', 'method' => 'view', 'params' => 'bugID={id}', 'target' => '_blank'); $allBugs = initTableData($allBugs, $cols); $data = array_values($allBugs); diff --git a/module/repo/ui/linkstory.html.php b/module/repo/ui/linkstory.html.php index b8d14e3b15..2062c59a5e 100644 --- a/module/repo/ui/linkstory.html.php +++ b/module/repo/ui/linkstory.html.php @@ -43,9 +43,9 @@ div $cols = array(); foreach($config->release->dtable->defaultFields['linkStory'] as $field) $cols[$field] = zget($config->release->dtable->story->fieldList, $field, array()); $cols = array_map(function($col){$col['show'] = true; return $col;}, $cols); -$cols['title']['link'] = $this->createLink('story', 'view', "storyID={id}"); +$cols['title']['link'] = array('module' => 'story', 'method' => 'view', 'params' => 'storyID={id}', 'target' => '_blank'); +$cols['title']['data-toggle'] = ''; $cols['title']['nestedToggle'] = false; -$cols['title']['data-size'] = 'lg'; $allStories = initTableData($allStories, $cols); $data = array_values($allStories);