sonarqube->noReport;?>
+diff --git a/module/instance/config.php b/module/instance/config.php index 3c893d7600..7c1981f13d 100644 --- a/module/instance/config.php +++ b/module/instance/config.php @@ -59,4 +59,4 @@ $config->instance->actions->view = array(); $config->instance->actions->view['mainActions'] = array('visit', 'ajaxStart', 'ajaxStop', 'upgrade'); $config->instance->actions->view['suffixActions'] = array('ajaxUninstall'); -$config->instance->devopsApps = array('gitea', 'gitlab', 'jenkins', 'sonarqube', 'nexus3'); +$config->instance->devopsApps = array('gitea', 'gitlab', 'jenkins', 'sonarqube', 'nexus3', 'nexus'); diff --git a/module/instance/control.php b/module/instance/control.php index 27858a96e0..a22d6936b8 100644 --- a/module/instance/control.php +++ b/module/instance/control.php @@ -594,6 +594,7 @@ class instance extends control $sharedDB = zget($pgList, $customData->dbService); } $instance = $this->instance->install($cloudApp, $sharedDB, $customData); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); if(!$instance) return $this->send(array('result' => 'fail', 'message' => $this->lang->instance->notices['installFail'])); unset($_GET['onlybody']); diff --git a/module/instance/model.php b/module/instance/model.php index 61de2a5cc4..ba71875b4d 100644 --- a/module/instance/model.php +++ b/module/instance/model.php @@ -996,6 +996,7 @@ class InstanceModel extends model if($result->code != 200) { $this->dao->delete()->from(TABLE_INSTANCE)->where('id')->eq($instance->id)->exec(); + dao::$errors['server'][] = $result->message; return false; } @@ -1177,6 +1178,8 @@ class InstanceModel extends model ->autoCheck() ->exec(); $instance->status = $statusData->status; + + if($instance->status == 'running') $this->saveAuthInfo($instance); } $status = new stdclass; @@ -2135,7 +2138,7 @@ class InstanceModel extends model $pipeline = new stdclass(); $instance->type = $instance->chart; - $pipeline->type = $instance->type; + $pipeline->type = $instance->type == 'nexus3' ? 'nexus' : $instance->type; $pipeline->private = md5(strval(rand(10,113450))); $pipeline->createdBy = 'system'; $pipeline->createdDate = helper::now(); diff --git a/module/solution/lang/de.php b/module/solution/lang/de.php new file mode 100644 index 0000000000..cce02bded4 --- /dev/null +++ b/module/solution/lang/de.php @@ -0,0 +1,64 @@ +solution->market = new stdclass; +$lang->solution->market->browse = 'Solution Market'; +$lang->solution->market->view = 'Solution Detail'; + +$lang->solution->name = 'Name'; + +$lang->solution->browse = 'Installed'; +$lang->solution->view = 'Solution Detail'; +$lang->solution->detail = 'Detail'; +$lang->solution->progress = 'Progress'; +$lang->solution->install = 'Install'; +$lang->solution->background = 'Background'; +$lang->solution->cancelInstall = 'Cancel'; +$lang->solution->uninstall = 'Uninstall'; +$lang->solution->retryInstall = 'Retry'; +$lang->solution->nextStep = 'Next'; +$lang->solution->config = 'Config'; + +$lang->solution->introduction = 'Introduction'; +$lang->solution->scenes = 'Scenes'; +$lang->solution->diagram = 'Diagram'; +$lang->solution->includedApp = 'Included App'; +$lang->solution->features = 'Features'; +$lang->solution->relatedLinks = 'Related Links'; +$lang->solution->customers = 'Customers'; +$lang->solution->apps = 'Installed Apps'; +$lang->solution->externalApps = 'External Apps'; +$lang->solution->resources = 'Resources'; + +$lang->solution->editName = 'Edit Name'; + +$lang->solution->chooseApp = 'Choose App'; +$lang->solution->noInstalledSolution = 'No installed solution'; +$lang->solution->toInstall = 'To Install'; + +$lang->solution->notices = new stdclass; +$lang->solution->notices->fail = 'Fail'; +$lang->solution->notices->success = 'Success'; +$lang->solution->notices->creatingSolution = 'Creating solution...'; +$lang->solution->notices->uninstallingSolution = 'Uninstalling solution...'; +$lang->solution->notices->installingApp = 'Installing: '; +$lang->solution->notices->installationSuccess = 'Installation success!'; +$lang->solution->notices->cancelInstall = 'Are you sure to cancel installation?'; +$lang->solution->notices->confirmToUninstall = 'Are you sure to uninstall?'; +$lang->solution->notices->confirmReinstall = 'Are you sure to retry installation?'; + +$lang->solution->errors = new stdclass; +$lang->solution->errors->error = 'Error'; +$lang->solution->errors->notFound = 'Not found'; +$lang->solution->errors->failToInstallApp = 'Fail to install %s'; +$lang->solution->errors->timeout = 'Timeout'; +$lang->solution->errors->failToUninstallApp = 'Fail to uninstall %s'; +$lang->solution->errors->hasInstallationError = 'Has installation error'; +$lang->solution->errors->notFoundAppByVersion = 'Not found %s version of %s'; +$lang->solution->errors->notEnoughResource = 'Not enough resource, please increase the configuration or release other resources and try again.'; + +$lang->solution->installationErrors = array(); +$lang->solution->installationErrors['waiting'] = 'Installation not started.'; +$lang->solution->installationErrors['uninstalling'] = 'Installation canceled.'; +$lang->solution->installationErrors['cneError'] = 'Installation failed.'; +$lang->solution->installationErrors['timeout'] = 'Installation timeout.'; +$lang->solution->installationErrors['notFoundApp'] = 'Not found app to be installed.'; +$lang->solution->installationErrors['notEnoughResource'] = 'Not enough resource, please increase the configuration or release other resources and try again.'; diff --git a/module/solution/lang/en.php b/module/solution/lang/en.php new file mode 100644 index 0000000000..cce02bded4 --- /dev/null +++ b/module/solution/lang/en.php @@ -0,0 +1,64 @@ +solution->market = new stdclass; +$lang->solution->market->browse = 'Solution Market'; +$lang->solution->market->view = 'Solution Detail'; + +$lang->solution->name = 'Name'; + +$lang->solution->browse = 'Installed'; +$lang->solution->view = 'Solution Detail'; +$lang->solution->detail = 'Detail'; +$lang->solution->progress = 'Progress'; +$lang->solution->install = 'Install'; +$lang->solution->background = 'Background'; +$lang->solution->cancelInstall = 'Cancel'; +$lang->solution->uninstall = 'Uninstall'; +$lang->solution->retryInstall = 'Retry'; +$lang->solution->nextStep = 'Next'; +$lang->solution->config = 'Config'; + +$lang->solution->introduction = 'Introduction'; +$lang->solution->scenes = 'Scenes'; +$lang->solution->diagram = 'Diagram'; +$lang->solution->includedApp = 'Included App'; +$lang->solution->features = 'Features'; +$lang->solution->relatedLinks = 'Related Links'; +$lang->solution->customers = 'Customers'; +$lang->solution->apps = 'Installed Apps'; +$lang->solution->externalApps = 'External Apps'; +$lang->solution->resources = 'Resources'; + +$lang->solution->editName = 'Edit Name'; + +$lang->solution->chooseApp = 'Choose App'; +$lang->solution->noInstalledSolution = 'No installed solution'; +$lang->solution->toInstall = 'To Install'; + +$lang->solution->notices = new stdclass; +$lang->solution->notices->fail = 'Fail'; +$lang->solution->notices->success = 'Success'; +$lang->solution->notices->creatingSolution = 'Creating solution...'; +$lang->solution->notices->uninstallingSolution = 'Uninstalling solution...'; +$lang->solution->notices->installingApp = 'Installing: '; +$lang->solution->notices->installationSuccess = 'Installation success!'; +$lang->solution->notices->cancelInstall = 'Are you sure to cancel installation?'; +$lang->solution->notices->confirmToUninstall = 'Are you sure to uninstall?'; +$lang->solution->notices->confirmReinstall = 'Are you sure to retry installation?'; + +$lang->solution->errors = new stdclass; +$lang->solution->errors->error = 'Error'; +$lang->solution->errors->notFound = 'Not found'; +$lang->solution->errors->failToInstallApp = 'Fail to install %s'; +$lang->solution->errors->timeout = 'Timeout'; +$lang->solution->errors->failToUninstallApp = 'Fail to uninstall %s'; +$lang->solution->errors->hasInstallationError = 'Has installation error'; +$lang->solution->errors->notFoundAppByVersion = 'Not found %s version of %s'; +$lang->solution->errors->notEnoughResource = 'Not enough resource, please increase the configuration or release other resources and try again.'; + +$lang->solution->installationErrors = array(); +$lang->solution->installationErrors['waiting'] = 'Installation not started.'; +$lang->solution->installationErrors['uninstalling'] = 'Installation canceled.'; +$lang->solution->installationErrors['cneError'] = 'Installation failed.'; +$lang->solution->installationErrors['timeout'] = 'Installation timeout.'; +$lang->solution->installationErrors['notFoundApp'] = 'Not found app to be installed.'; +$lang->solution->installationErrors['notEnoughResource'] = 'Not enough resource, please increase the configuration or release other resources and try again.'; diff --git a/module/solution/lang/fr.php b/module/solution/lang/fr.php new file mode 100644 index 0000000000..cce02bded4 --- /dev/null +++ b/module/solution/lang/fr.php @@ -0,0 +1,64 @@ +solution->market = new stdclass; +$lang->solution->market->browse = 'Solution Market'; +$lang->solution->market->view = 'Solution Detail'; + +$lang->solution->name = 'Name'; + +$lang->solution->browse = 'Installed'; +$lang->solution->view = 'Solution Detail'; +$lang->solution->detail = 'Detail'; +$lang->solution->progress = 'Progress'; +$lang->solution->install = 'Install'; +$lang->solution->background = 'Background'; +$lang->solution->cancelInstall = 'Cancel'; +$lang->solution->uninstall = 'Uninstall'; +$lang->solution->retryInstall = 'Retry'; +$lang->solution->nextStep = 'Next'; +$lang->solution->config = 'Config'; + +$lang->solution->introduction = 'Introduction'; +$lang->solution->scenes = 'Scenes'; +$lang->solution->diagram = 'Diagram'; +$lang->solution->includedApp = 'Included App'; +$lang->solution->features = 'Features'; +$lang->solution->relatedLinks = 'Related Links'; +$lang->solution->customers = 'Customers'; +$lang->solution->apps = 'Installed Apps'; +$lang->solution->externalApps = 'External Apps'; +$lang->solution->resources = 'Resources'; + +$lang->solution->editName = 'Edit Name'; + +$lang->solution->chooseApp = 'Choose App'; +$lang->solution->noInstalledSolution = 'No installed solution'; +$lang->solution->toInstall = 'To Install'; + +$lang->solution->notices = new stdclass; +$lang->solution->notices->fail = 'Fail'; +$lang->solution->notices->success = 'Success'; +$lang->solution->notices->creatingSolution = 'Creating solution...'; +$lang->solution->notices->uninstallingSolution = 'Uninstalling solution...'; +$lang->solution->notices->installingApp = 'Installing: '; +$lang->solution->notices->installationSuccess = 'Installation success!'; +$lang->solution->notices->cancelInstall = 'Are you sure to cancel installation?'; +$lang->solution->notices->confirmToUninstall = 'Are you sure to uninstall?'; +$lang->solution->notices->confirmReinstall = 'Are you sure to retry installation?'; + +$lang->solution->errors = new stdclass; +$lang->solution->errors->error = 'Error'; +$lang->solution->errors->notFound = 'Not found'; +$lang->solution->errors->failToInstallApp = 'Fail to install %s'; +$lang->solution->errors->timeout = 'Timeout'; +$lang->solution->errors->failToUninstallApp = 'Fail to uninstall %s'; +$lang->solution->errors->hasInstallationError = 'Has installation error'; +$lang->solution->errors->notFoundAppByVersion = 'Not found %s version of %s'; +$lang->solution->errors->notEnoughResource = 'Not enough resource, please increase the configuration or release other resources and try again.'; + +$lang->solution->installationErrors = array(); +$lang->solution->installationErrors['waiting'] = 'Installation not started.'; +$lang->solution->installationErrors['uninstalling'] = 'Installation canceled.'; +$lang->solution->installationErrors['cneError'] = 'Installation failed.'; +$lang->solution->installationErrors['timeout'] = 'Installation timeout.'; +$lang->solution->installationErrors['notFoundApp'] = 'Not found app to be installed.'; +$lang->solution->installationErrors['notEnoughResource'] = 'Not enough resource, please increase the configuration or release other resources and try again.'; diff --git a/module/solution/lang/zh-cn.php b/module/solution/lang/zh-cn.php index 1220e55343..b3297110a7 100644 --- a/module/solution/lang/zh-cn.php +++ b/module/solution/lang/zh-cn.php @@ -10,6 +10,7 @@ $lang->solution->view = '解决方案详情'; $lang->solution->detail = '查看'; $lang->solution->progress = '安装进度'; $lang->solution->install = '安装'; +$lang->solution->background = '后台安装'; $lang->solution->cancelInstall = '取消安装'; $lang->solution->uninstall = '卸载'; $lang->solution->retryInstall = '重试'; diff --git a/module/solution/model.php b/module/solution/model.php index acf8f8ad02..e041b67014 100644 --- a/module/solution/model.php +++ b/module/solution/model.php @@ -82,6 +82,12 @@ class solutionModel extends model if(empty($selectedApps[$category])) unset($selectedApps[$category]); } + if(!$this->app->user->account) + { + $this->app->user = new stdclass(); + $this->app->user->account = $this->dao->select('*')->from(TABLE_USER)->where('deleted')->eq(0)->fetch('account'); + } + /* Create solution. */ $solution = new stdclass; $solution->name = $cloudSolution->title; @@ -171,6 +177,7 @@ class solutionModel extends model $solutionSchema = $this->loadModel('store')->solutionConfig('id', $solution->appID); $channel = $this->app->session->cloudChannel ? $this->app->session->cloudChannel : $this->config->cloud->api->channel; $components = json_decode($solution->components); + $apps = helper::arrayColumn(json_decode($solution->components, true), 'chart'); foreach($components as $categorty => $componentApp) { $solutionStatus = $this->dao->select('status')->from(TABLE_SOLUTION)->where('id')->eq($solutionID)->fetch(); @@ -211,7 +218,7 @@ class solutionModel extends model } if(!$this->checkInstallStatus($solutionID)) return false; - $settings = $this->mountSettings($solutionSchema, $componentApp->chart, $components, $allMappings, isset($components->sonarqube)); + $settings = $this->mountSettings($solutionSchema, $componentApp->chart, $components, $allMappings, in_array('sonarqube', $apps)); $instance = $this->installApp($cloudApp, $settings); } @@ -250,6 +257,7 @@ class solutionModel extends model } $componentApp->status = 'installed'; $this->dao->update(TABLE_SOLUTION)->set('components')->eq(json_encode($components))->where('id')->eq($solution->id)->exec(); + $this->instance->saveAuthInfo($instance); } else { @@ -291,8 +299,10 @@ class solutionModel extends model $settings = array(); $appSettings = zget($solutionSchema->settings, $chart, array()); + $apps = helper::arrayColumn((array)$components, 'chart'); foreach($appSettings as $item) { + if(!empty($item->when) && !in_array($item->when, $apps)) continue; switch($item->type) { case 'static': @@ -308,6 +318,9 @@ class solutionModel extends model $mappingInfo = zget($mappings, $item->target, ''); if($mappingInfo) $settings[] = array('key' => $item->key, 'value' => zget($mappingInfo, $item->key, '')); break; + case 'auto': + if($item->value === 'protocol') $settings[] = array('key' => $item->key, 'value' => strstr(getWebRoot(true), ':', true)); + break; } } diff --git a/module/sonarqube/control.php b/module/sonarqube/control.php index 5051ee8f5d..c795a4f597 100644 --- a/module/sonarqube/control.php +++ b/module/sonarqube/control.php @@ -96,6 +96,7 @@ class sonarqube extends control $this->view->measures = $measures; $this->view->qualitygate = $qualitygate; $this->view->projectName = $projectName; + $this->view->projectKey = $job->projectKey; $this->view->sonarqubeID = $job->sonarqubeServer; $this->display(); @@ -119,7 +120,6 @@ class sonarqube extends control $options[] = array('text' => $projectName, 'value' => $productKey); } return print(json_encode($options)); - //echo html::select('projectKey', $projectPairs, str_replace('*', '-', $projectKey), "class='form-control chosen'"); } /** @@ -381,6 +381,7 @@ class sonarqube extends control */ public function browseIssue($sonarqubeID, $projectKey = '', $search = false, $orderBy = 'severity_desc', $recPerPage = 100, $pageID = 1) { + $projectKey = str_replace('*', '-', $projectKey); if(isset($_POST['keyword'])) { $keyword = htmlspecialchars(trim($_POST['keyword'])); diff --git a/module/sonarqube/view/reportview.html.php b/module/sonarqube/view/reportview.html.php index 7c3be1835e..c37e82dd2d 100644 --- a/module/sonarqube/view/reportview.html.php +++ b/module/sonarqube/view/reportview.html.php @@ -14,13 +14,15 @@
sonarqube->noReport;?>
+