This commit is contained in:
zhaoke
2023-08-04 15:50:30 +08:00
parent b5ccce451c
commit ba3b2d805b
8 changed files with 85 additions and 11 deletions
+4 -1
View File
@@ -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;
}
+71
View File
@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
/**
* The zen file of instance 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 Ke Zhao<zhaoke@easycorp.ltd>
* @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;
}
}
}
+1
View File
@@ -135,6 +135,7 @@ panel
tree
(
set::id('monacoTree'),
set::canSplit(false),
set::items($tree),
set::collapsedIcon('folder'),
set::expandedIcon('folder-open'),
+1 -2
View File
@@ -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),
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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);