* Finish task #59451.

This commit is contained in:
liyuchun
2022-07-05 08:42:48 +00:00
parent 0044a55b76
commit 8a3d924e2b
11 changed files with 74 additions and 14 deletions
+43
View File
@@ -1104,6 +1104,10 @@ class commonModel extends model
$executionID = $menuItem->link['vars'];
commonModel::buildMoreButton($executionID);
}
elseif($menuItem->link['module'] == 'app' and $menuItem->link['method'] == 'serverlink')
{
commonModel::buildAppButton();
}
else
{
if($menuItem->link)
@@ -1746,6 +1750,45 @@ EOD;
echo $html;
}
/**
* Build devops app button.
*
* @static
* @access public
* @return void
*/
public static function buildAppButton()
{
if(defined('TUTORIAL')) return;
global $app, $config, $lang;
$pipelinePairs = array();
$condition = '';
if(!$app->user->admin)
{
$types = '';
foreach($config->pipelineTypeList as $pipelineType)
{
if(commonModel::hasPriv($pipelineType, 'browse')) $types .= "'$pipelineType',";
}
if(empty($types)) return;
$condition .= ' AND `type` in (' . trim($types, ',') . ')';
}
$pipelineList = $app->dbh->query("SELECT type,name,url FROM " . TABLE_PIPELINE . " WHERE `deleted` = '0' $condition order by type")->fetchAll();
if(empty($pipelineList)) return;
$html = "<li class='dropdown dropdown-hover'><a href='javascript:;' data-toggle='dropdown'>{$lang->app->common}<span class='caret'></span></a>";
$html .= "<ul class='dropdown-menu'>";
foreach($pipelineList as $pipeline)
{
$html .= "<li style='max-width: 300px;'>" . html::a($pipeline->url, "[{$pipeline->type}] {$pipeline->name}", '', "title='{$pipeline->name}' class='text-ellipsis' style='padding: 2px 10px' target='_blank'") . '</li>';
}
$html .= "</ul></li>\n";
echo $html;
}
/**
* Print link icon.
*