* Fix bug#37168,37170
This commit is contained in:
@@ -2057,7 +2057,7 @@ class InstanceModel extends model
|
||||
if($action == 'uninstall') return $instance->type != 'external' && $this->canDo('uninstall', $instance);
|
||||
if($action == 'visit') return $instance->type != 'external' ? ($instance->domain && $this->canDo('visit', $instance)) : true;
|
||||
if($action == 'upgrade') return !empty($instance->latestVersion);
|
||||
if($action == 'bindUser') return ($instance->type == 'external' && in_array($instance->appName, array('Gitlab', 'Gitea', 'Gogs'))) ? true : false;
|
||||
if($action == 'bindUser') return ($instance->externalID && in_array($instance->appName, array('Gitlab', 'Gitea', 'Gogs'))) ? true : false;
|
||||
if($action == 'edit') return $instance->type != 'external' ? false : true;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$config->space = new stdclass();
|
||||
$config->space->zentaoApps = array('GitLab', 'Gitea', 'Gogs', 'Jenkins', 'SonarQube');
|
||||
|
||||
@@ -71,4 +71,4 @@ $config->space->dtable->fieldList['actions']['list']['edit']['url'] = 'javascri
|
||||
|
||||
$config->space->dtable->fieldList['actions']['list']['bindUser']['icon'] = 'lock';
|
||||
$config->space->dtable->fieldList['actions']['list']['bindUser']['hint'] = $lang->gitlab->bindUser;
|
||||
$config->space->dtable->fieldList['actions']['list']['bindUser']['url'] = 'javascript:bindUser({orgID}, "{appName}")';
|
||||
$config->space->dtable->fieldList['actions']['list']['bindUser']['url'] = 'javascript:bindUser({externalID}, "{appName}")';
|
||||
|
||||
@@ -51,6 +51,12 @@ class space extends control
|
||||
$instance->externalID = 0;
|
||||
$instance->orgID = $instance->id;
|
||||
$instance->type = 'app';
|
||||
|
||||
if(in_array($instance->appName, $this->config->space->zentaoApps))
|
||||
{
|
||||
$externalApp = $this->space->getExternalAppByApp($instance);
|
||||
if($externalApp) $instance->externalID = $externalApp->id;
|
||||
}
|
||||
}
|
||||
$pipelines = $this->loadModel('pipeline')->getList('', 'id_desc');
|
||||
$maxID = 0;
|
||||
@@ -58,8 +64,9 @@ class space extends control
|
||||
foreach($pipelines as $key => $pipeline)
|
||||
{
|
||||
if($pipeline->createdBy == 'system') unset($pipelines[$key]);
|
||||
|
||||
$pipeline->createdAt = $pipeline->createdDate;
|
||||
$pipeline->appName = ucfirst($pipeline->type);
|
||||
$pipeline->appName = $this->lang->space->appType[$pipeline->type];
|
||||
$pipeline->status = '';
|
||||
$pipeline->type = 'external';
|
||||
$pipeline->externalID = $pipeline->id;
|
||||
|
||||
@@ -20,10 +20,10 @@ function onChangeAppType(event)
|
||||
{
|
||||
const appType = $(event.target).val();
|
||||
|
||||
if(appType == 'Jenkins' || appType == 'SonarQube')
|
||||
if(appType == 'jenkins' || appType == 'sonarqube')
|
||||
{
|
||||
$('div.jenkins').removeClass('hidden');
|
||||
if(appType == 'Jenkins')
|
||||
if(appType == 'jenkins')
|
||||
{
|
||||
$('div.token').removeClass('hidden');
|
||||
$('div.password .form-label').removeClass('required');
|
||||
@@ -46,23 +46,23 @@ function onChangeAppType(event)
|
||||
$('#password').attr('placeholder', '');
|
||||
switch(appType)
|
||||
{
|
||||
case 'GitLab':
|
||||
case 'gitlab':
|
||||
$('#createAppForm').attr('action', $.createLink('gitlab', 'create'));
|
||||
$('#url').attr('placeholder', gitlabUrlTips);
|
||||
$('#token').attr('placeholder', gitlabTokenTips);
|
||||
break;
|
||||
case 'Gitea':
|
||||
case 'gitea':
|
||||
$('#createAppForm').attr('action', $.createLink('gitea', 'create'));
|
||||
break;
|
||||
case 'Gogs':
|
||||
case 'gogs':
|
||||
$('#createAppForm').attr('action', $.createLink('gogs', 'create'));
|
||||
break;
|
||||
case 'Jenkins':
|
||||
case 'jenkins':
|
||||
$('#createAppForm').attr('action', $.createLink('jenkins', 'create'));
|
||||
$('#token').attr('placeholder', jenkinsTokenTips);
|
||||
$('#password').attr('placeholder', jenkinsPasswordTips);
|
||||
break;
|
||||
case 'SonarQube':
|
||||
case 'sonarqube':
|
||||
$('#createAppForm').attr('action', $.createLink('sonarqube', 'create'));
|
||||
$('#url').attr('placeholder', sonarqubeUrlTips);
|
||||
$('#account').attr('placeholder', sonarqubeAccountTips);
|
||||
@@ -87,7 +87,6 @@ function onChangeStoreAppType(event)
|
||||
|
||||
$('#createStoreAppForm').attr('action', $.createLink('instance', 'install', 'appID=' + storeApp));
|
||||
|
||||
var externalApps = ['GitLab', 'Gitea', 'Gogs', 'Jenkins', 'SonarQube'];
|
||||
var storeAppName = apps[storeApp];
|
||||
|
||||
if(externalApps.indexOf(storeAppName) !== -1)
|
||||
|
||||
@@ -20,8 +20,8 @@ $lang->space->featureBar['browse']['running'] = 'Running';
|
||||
$lang->space->featureBar['browse']['stopped'] = 'Stopped';
|
||||
$lang->space->featureBar['browse']['abnormal'] = 'Abnormal';
|
||||
|
||||
$lang->space->appType['GitLab'] = 'GitLab';
|
||||
$lang->space->appType['Gitea'] = 'Gitea';
|
||||
$lang->space->appType['Gogs'] = 'Gogs';
|
||||
$lang->space->appType['Jenkins'] = 'Jenkins';
|
||||
$lang->space->appType['SonarQube'] = 'SonarQube';
|
||||
$lang->space->appType['gitlab'] = 'GitLab';
|
||||
$lang->space->appType['gitea'] = 'Gitea';
|
||||
$lang->space->appType['gogs'] = 'Gogs';
|
||||
$lang->space->appType['jenkins'] = 'Jenkins';
|
||||
$lang->space->appType['sonarqube'] = 'SonarQube';
|
||||
|
||||
@@ -23,8 +23,8 @@ $lang->space->featureBar['browse']['running'] = '运行中';
|
||||
$lang->space->featureBar['browse']['stopped'] = '已停止';
|
||||
$lang->space->featureBar['browse']['abnormal'] = '异常';
|
||||
|
||||
$lang->space->appType['GitLab'] = 'GitLab';
|
||||
$lang->space->appType['Gitea'] = 'Gitea';
|
||||
$lang->space->appType['Gogs'] = 'Gogs';
|
||||
$lang->space->appType['Jenkins'] = 'Jenkins';
|
||||
$lang->space->appType['SonarQube'] = 'SonarQube';
|
||||
$lang->space->appType['gitlab'] = 'GitLab';
|
||||
$lang->space->appType['gitea'] = 'Gitea';
|
||||
$lang->space->appType['gogs'] = 'Gogs';
|
||||
$lang->space->appType['jenkins'] = 'Jenkins';
|
||||
$lang->space->appType['sonarqube'] = 'SonarQube';
|
||||
|
||||
@@ -129,4 +129,21 @@ class spaceModel extends model
|
||||
->andWhere('owner')->eq($this->app->user->account)
|
||||
->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用市场应用对应的外部应用。
|
||||
* Get External app By store app.
|
||||
*
|
||||
* @param object $instance
|
||||
* @access public
|
||||
* @return object|false
|
||||
*/
|
||||
public function getExternalAppByApp(object $instance): object|false
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_PIPELINE)
|
||||
->where('deleted')->eq('0')
|
||||
->andWhere('createdBy')->eq('system')
|
||||
->andWhere('url')->like("%{$instance->domain}%")
|
||||
->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ jsVar('mysqlList', $mysqlList);
|
||||
jsVar('pgList', $pgList);
|
||||
jsVar('defaultApp', $defaultApp);
|
||||
jsVar('appID', $appID);
|
||||
jsVar('externalApps', $config->space->zentaoApps);
|
||||
|
||||
$showVersion = getenv('ALLOW_SELECT_VERSION') && (strtolower(getenv('ALLOW_SELECT_VERSION')) == 'true' || strtolower(getenv('ALLOW_SELECT_VERSION')) == '1');
|
||||
$dbTypeItems = array();
|
||||
|
||||
Reference in New Issue
Block a user