* Merge 18 devopos to 20
This commit is contained in:
+21
-21
@@ -21,31 +21,31 @@ $config->instance->enableAutoRestore = in_array('auto-rollback', $features);
|
||||
global $lang, $app;
|
||||
$app->loadLang('space');
|
||||
|
||||
$config->instance->actionList['start']['icon'] = 'play';
|
||||
$config->instance->actionList['start']['className'] = 'ajax-submit';
|
||||
$config->instance->actionList['start']['hint'] = $lang->instance->start;
|
||||
$config->instance->actionList['start']['text'] = $lang->instance->start;
|
||||
$config->instance->actionList['start']['url'] = array('module' => 'instance', 'method' => 'ajaxStart', 'params' => 'id={id}');
|
||||
$config->instance->actionList['ajaxStart']['icon'] = 'play';
|
||||
$config->instance->actionList['ajaxStart']['className'] = 'ajax-submit';
|
||||
$config->instance->actionList['ajaxStart']['hint'] = $lang->instance->start;
|
||||
$config->instance->actionList['ajaxStart']['text'] = $lang->instance->start;
|
||||
$config->instance->actionList['ajaxStart']['url'] = array('module' => 'instance', 'method' => 'ajaxStart', 'params' => 'id={id}');
|
||||
|
||||
$config->instance->actionList['stop']['icon'] = 'off';
|
||||
$config->instance->actionList['stop']['className'] = 'ajax-submit';
|
||||
$config->instance->actionList['stop']['hint'] = $lang->instance->stop;
|
||||
$config->instance->actionList['stop']['text'] = $lang->instance->stop;
|
||||
$config->instance->actionList['stop']['data-confirm'] = $lang->instance->notices['confirmStop'];
|
||||
$config->instance->actionList['stop']['url'] = array('module' => 'instance', 'method' => 'ajaxStop', 'params' => 'id={id}');
|
||||
$config->instance->actionList['ajaxStop']['icon'] = 'off';
|
||||
$config->instance->actionList['ajaxStop']['className'] = 'ajax-submit';
|
||||
$config->instance->actionList['ajaxStop']['hint'] = $lang->instance->stop;
|
||||
$config->instance->actionList['ajaxStop']['text'] = $lang->instance->stop;
|
||||
$config->instance->actionList['ajaxStop']['data-confirm'] = $lang->instance->notices['confirmStop'];
|
||||
$config->instance->actionList['ajaxStop']['url'] = array('module' => 'instance', 'method' => 'ajaxStop', 'params' => 'id={id}');
|
||||
|
||||
$config->instance->actionList['uninstall']['icon'] = 'trash';
|
||||
$config->instance->actionList['uninstall']['hint'] = $lang->instance->uninstall;
|
||||
$config->instance->actionList['uninstall']['text'] = $lang->instance->uninstall;
|
||||
$config->instance->actionList['uninstall']['className'] = 'ajax-submit';
|
||||
$config->instance->actionList['uninstall']['data-confirm'] = $lang->instance->notices['confirmUninstall'];
|
||||
$config->instance->actionList['uninstall']['url'] = array('module' => 'instance', 'method' => 'ajaxUninstall', 'params' => 'id={id}');
|
||||
$config->instance->actionList['ajaxUninstall']['icon'] = 'trash';
|
||||
$config->instance->actionList['ajaxUninstall']['hint'] = $lang->instance->uninstall;
|
||||
$config->instance->actionList['ajaxUninstall']['text'] = $lang->instance->uninstall;
|
||||
$config->instance->actionList['ajaxUninstall']['className'] = 'ajax-submit';
|
||||
$config->instance->actionList['ajaxUninstall']['data-confirm'] = $lang->instance->notices['confirmUninstall'];
|
||||
$config->instance->actionList['ajaxUninstall']['url'] = array('module' => 'instance', 'method' => 'ajaxUninstall', 'params' => 'id={id}&type={type}');
|
||||
|
||||
$config->instance->actionList['visit']['icon'] = 'menu-my';
|
||||
$config->instance->actionList['visit']['hint'] = $lang->instance->visit;
|
||||
$config->instance->actionList['visit']['text'] = $lang->instance->visit;
|
||||
$config->instance->actionList['visit']['target'] = '_blank';
|
||||
$config->instance->actionList['visit']['url'] = array('module' => 'instance', 'method' => 'visit', 'params' => 'id={id}');
|
||||
$config->instance->actionList['visit']['url'] = array('module' => 'instance', 'method' => 'visit', 'params' => 'id={id}&externalID={externalID}');
|
||||
|
||||
$config->instance->actionList['upgrade']['icon'] = 'refresh';
|
||||
$config->instance->actionList['upgrade']['data-toggle'] = 'modal';
|
||||
@@ -56,7 +56,7 @@ $config->instance->actionList['upgrade']['url'] = helper::createLink('in
|
||||
|
||||
$config->instance->actions = new stdclass();
|
||||
$config->instance->actions->view = array();
|
||||
$config->instance->actions->view['mainActions'] = array('visit', 'start', 'stop', 'upgrade');
|
||||
$config->instance->actions->view['suffixActions'] = array('uninstall');
|
||||
$config->instance->actions->view['mainActions'] = array('visit', 'ajaxStart', 'ajaxStop', 'upgrade');
|
||||
$config->instance->actions->view['suffixActions'] = array('ajaxUninstall');
|
||||
|
||||
$config->instance->devopsApps = array(89 => 'gitea', 58 => 'gitlab', 57 => 'gogs', 59 => 'jenkins', 60 => 'sonarqube', 118 => 'nexus');
|
||||
$config->instance->devopsApps = array('gitea', 'gitlab', 'jenkins', 'sonarqube', 'nexus');
|
||||
|
||||
+156
-29
@@ -37,8 +37,62 @@ class instance extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function view($id, $recTotal = 0, $recPerPage = 20, $pageID = 1, $tab ='baseinfo' )
|
||||
public function view($id, $type = 'store', $tab ='baseinfo' )
|
||||
{
|
||||
if(!commonModel::hasPriv('space', 'browse')) $this->loadModel('common')->deny('space', 'browse', false);
|
||||
if($type === 'store')
|
||||
{
|
||||
$this->storeView($id, $tab);
|
||||
}
|
||||
else
|
||||
{
|
||||
$instance = $this->loadModel('gitea')->getByID($id);
|
||||
$instance->status = '';
|
||||
$instance->source = 'user';
|
||||
$instance->externalID = $instance->id;
|
||||
$instance->runDuration = 0;
|
||||
$instance->appName = $instance->type;
|
||||
$instance->createdAt = $instance->createdDate;
|
||||
|
||||
$instanceMetric = new stdclass();
|
||||
$instanceMetric->cpu = 0;
|
||||
$instanceMetric->memory = 0;
|
||||
|
||||
$this->view->title = $instance->name;
|
||||
$this->view->instance = $instance;
|
||||
$this->view->cloudApp = array();
|
||||
$this->view->seniorAppList = array();
|
||||
$this->view->actions = $this->loadModel('action')->getList($instance->type, $id);
|
||||
$this->view->defaultAccount = '';
|
||||
$this->view->instanceMetric = $instanceMetric;
|
||||
$this->view->currentResource = '';
|
||||
$this->view->customItems = array();
|
||||
$this->view->backupList = array();
|
||||
$this->view->hasRestoreLog = false;
|
||||
$this->view->latestBackup = array();
|
||||
$this->view->dbList = array();
|
||||
$this->view->domain = '';
|
||||
}
|
||||
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->tab = $tab;
|
||||
$this->view->type = $type;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show instance view.
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $page
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
protected function storeView($id, $tab ='baseinfo' )
|
||||
{
|
||||
if(!commonModel::hasPriv('space', 'browse')) $this->loadModel('common')->deny('space', 'browse', false);
|
||||
$this->loadModel('system');
|
||||
$this->app->loadLang('system');
|
||||
|
||||
@@ -53,9 +107,6 @@ class instance extends control
|
||||
$instanceMetric = $instanceMetric[$instance->id];
|
||||
$this->lang->switcherMenu = $this->instance->getSwitcher($instance);
|
||||
|
||||
$this->app->loadClass('pager', true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$backupList = array();
|
||||
$latestBackup = new stdclass;
|
||||
if($tab == 'backup') $backupList = $this->instance->backupList($instance);
|
||||
@@ -82,13 +133,18 @@ class instance extends control
|
||||
$customItems = $this->cne->getCustomItems($instance);
|
||||
|
||||
if($instance->status == 'running') $this->instanceZen->saveAuthInfo($instance);
|
||||
if(in_array($instance->chart, $this->config->instance->devopsApps))
|
||||
{
|
||||
$url = strstr(getWebRoot(true), ':', true) . '://' . $instance->domain;
|
||||
$pipeline = $this->loadModel('pipeline')->getByUrl($url);
|
||||
$instance->externalID = !empty($pipeline) ? $pipeline->id : 0;
|
||||
}
|
||||
|
||||
$this->view->title = $instance->appName;
|
||||
$this->view->instance = $instance;
|
||||
$this->view->cloudApp = $this->loadModel('store')->getAppInfoByChart($instance->chart, $instance->channel, false);
|
||||
$this->view->seniorAppList = $tab == 'baseinfo' ? $this->instance->seniorAppList($instance, $instance->channel) : array();
|
||||
$this->view->actions = $this->loadModel('action')->getList('instance', $id);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->defaultAccount = $this->cne->getDefaultAccount($instance);
|
||||
$this->view->instanceMetric = $instanceMetric;
|
||||
$this->view->currentResource = $currentResource;
|
||||
@@ -99,9 +155,6 @@ class instance extends control
|
||||
$this->view->dbList = $dbList;
|
||||
$this->view->domain = $this->cne->getDomain($instance);
|
||||
$this->view->tab = $tab;
|
||||
$this->view->pager = $pager;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,6 +278,7 @@ class instance extends control
|
||||
*/
|
||||
public function setting($id)
|
||||
{
|
||||
if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false);
|
||||
$currentResource = new stdclass;
|
||||
$instance = $this->instance->getByID($id);
|
||||
$currentResource = $this->cne->getAppConfig($instance);
|
||||
@@ -302,6 +356,7 @@ class instance extends control
|
||||
*/
|
||||
public function upgrade($id)
|
||||
{
|
||||
if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false);
|
||||
$instance = $this->instance->getByID($id);
|
||||
$instance->latestVersion = $this->store->appLatestVersion($instance->appID, $instance->version);
|
||||
|
||||
@@ -342,6 +397,7 @@ class instance extends control
|
||||
*/
|
||||
public function visit(int $id, int $externalID = 0): void
|
||||
{
|
||||
if(!commonModel::hasPriv('space', 'browse')) $this->loadModel('common')->deny('space', 'browse', false);
|
||||
if(!$externalID)
|
||||
{
|
||||
$instance = $this->instance->getByID($id);
|
||||
@@ -366,6 +422,8 @@ class instance extends control
|
||||
*/
|
||||
public function createExternalApp(string $type)
|
||||
{
|
||||
if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false);
|
||||
|
||||
$this->app->loadModuleConfig('sonarqube');
|
||||
$this->app->loadLang('pipeline');
|
||||
|
||||
@@ -388,6 +446,72 @@ class instance extends control
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('space', 'browse')));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑手工配置外部应用。
|
||||
* Edit a external app.
|
||||
*
|
||||
* @param int $externalID
|
||||
* @access public
|
||||
* @return viod
|
||||
*/
|
||||
public function editExternalApp(int $externalID)
|
||||
{
|
||||
if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false);
|
||||
|
||||
$oldApp = $this->loadModel('pipeline')->getByID($externalID);
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$this->pipeline->update($externalID);
|
||||
$app = $this->pipeline->getByID($externalID);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
$this->loadModel('action');
|
||||
$actionID = $this->action->create($app->type, $externalID, 'edited');
|
||||
$changes = common::createChanges($oldApp, $app);
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true, 'closeModal' => true));
|
||||
}
|
||||
|
||||
$this->app->loadLang('space');
|
||||
$this->app->loadLang('sonarqube');
|
||||
|
||||
$this->view->app = $oldApp;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一个外部应用。
|
||||
* Delete a external app.
|
||||
*
|
||||
* @param int $externalID
|
||||
* @access public
|
||||
* @return viod
|
||||
*/
|
||||
public function deleteExternalApp(int $externalID)
|
||||
{
|
||||
if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false);
|
||||
|
||||
$oldApp = $this->loadModel('pipeline')->getByID($externalID);
|
||||
$actionID = $this->pipeline->delete($externalID, $oldApp->type);
|
||||
if(!$actionID)
|
||||
{
|
||||
$response['result'] = 'fail';
|
||||
$response['callback'] = sprintf('zui.Modal.alert("%s");', $this->lang->pipeline->delError);
|
||||
return $this->send($response);
|
||||
}
|
||||
|
||||
$app = $this->pipeline->getByID($externalID);
|
||||
$changes = common::createChanges($oldApp, $app);
|
||||
$this->loadModel('action')->logHistory($actionID, $changes);
|
||||
|
||||
$response['load'] = true;
|
||||
$response['message'] = zget($this->lang->instance->notices, 'uninstallSuccess');
|
||||
$response['result'] = 'success';
|
||||
|
||||
return $this->send($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* (Not used at present.) Install app by custom settings.
|
||||
*
|
||||
@@ -406,29 +530,16 @@ class instance extends control
|
||||
* Install app.
|
||||
*
|
||||
* @param int $appID
|
||||
* @param string $checkResource
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function install($appID)
|
||||
public function install(int $appID, string $checkResource = 'true')
|
||||
{
|
||||
if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false);
|
||||
$cloudApp = $this->store->getAppInfo($appID);
|
||||
if(empty($cloudApp)) return $this->send(array('result' => 'fail', 'message' => $this->lang->instance->errors->noAppInfo));
|
||||
|
||||
if(empty($this->config->demoAccounts))
|
||||
{
|
||||
$clusterResource = $this->cne->cneMetrics();
|
||||
$freeMemory = intval($clusterResource->metrics->memory->allocatable * 0.9); // Remain 10% memory for system.
|
||||
if($cloudApp->memory > $freeMemory)
|
||||
{
|
||||
$cloudApp = $cloudApp;
|
||||
$gapMemory = helper::formatKB(intval(($cloudApp->memory - $freeMemory)));
|
||||
$requiredMemory = helper::formatKB(intval($cloudApp->memory));
|
||||
$freeMemory = helper::formatKB(intval($freeMemory));
|
||||
|
||||
return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->instance->errors->notEnoughMemory, $cloudApp->alias, $requiredMemory, $freeMemory, $gapMemory)));
|
||||
}
|
||||
}
|
||||
|
||||
$versionList = $this->store->appVersionList($cloudApp->id);
|
||||
$mysqlList = $this->cne->sharedDBList('mysql');
|
||||
$pgList = $this->cne->sharedDBList('postgresql');
|
||||
@@ -456,6 +567,16 @@ class instance extends control
|
||||
if(!validater::checkLength($customData->customDomain, 20, 2)) return $this->send(array('result' => 'fail', 'message' => $this->lang->instance->errors->domainLength));
|
||||
if(!validater::checkREG($customData->customDomain, '/^[a-z\d]+$/')) return $this->send(array('result' => 'fail', 'message' => $this->lang->instance->errors->wrongDomainCharacter));
|
||||
|
||||
if($checkResource == 'true')
|
||||
{
|
||||
$resource = new stdclass();
|
||||
$resource->cpu = $cloudApp->cpu;
|
||||
$resource->memory = $cloudApp->memory;
|
||||
|
||||
$result = $this->cne->tryAllocate(array($resource));
|
||||
if(!isset($result->code) || $result->code != 200) return $this->send(array('callback' => 'alertResource()'));
|
||||
}
|
||||
|
||||
/* If select the version, replace the latest version of App by selected version. */
|
||||
if($customData->version)
|
||||
{
|
||||
@@ -505,15 +626,17 @@ class instance extends control
|
||||
*/
|
||||
public function ajaxUninstall($instanceID, $type = '')
|
||||
{
|
||||
if($type == 'external')
|
||||
if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false);
|
||||
if($type !== 'store')
|
||||
{
|
||||
$instance = $this->loadModel('pipeline')->getByID($instanceID);
|
||||
if(!$instance) return $this->send(array('result' => 'success', 'message' => $this->lang->instance->notices['success']));
|
||||
if(!$instance) return $this->send(array('result' => 'success', 'message' => $this->lang->instance->notices['success'], 'load' => $this->createLink('space', 'browse')));
|
||||
|
||||
return $this->send($this->fetch($instance->type, 'delete', array('id' => $instance->id)));
|
||||
if($instance->type == 'nexus') return $this->deleteExternalApp($instance->id);
|
||||
return $this->fetch($instance->type, 'delete', array('id' => $instance->id));
|
||||
}
|
||||
$instance = $this->instance->getByID($instanceID);
|
||||
if(!$instance) return $this->send(array('result' => 'success', 'message' => $this->lang->instance->notices['success']));
|
||||
if(!$instance) return $this->send(array('result' => 'success', 'message' => $this->lang->instance->notices['success'], 'load' => $this->createLink('space', 'browse')));
|
||||
|
||||
$externalApp = $this->loadModel('space')->getExternalAppByApp($instance);
|
||||
if($externalApp)
|
||||
@@ -524,7 +647,7 @@ class instance extends control
|
||||
|
||||
$success = $this->instance->uninstall($instance);
|
||||
$this->action->create('instance', $instance->id, 'uninstall', '', json_encode(array('result' => $success, 'app' => array('alias' => $instance->appName, 'app_version' => $instance->version))));
|
||||
if($success) return $this->send(array('result' => 'success', 'message' => zget($this->lang->instance->notices, 'uninstallSuccess'), 'locate' => $this->createLink('space', 'browse')));
|
||||
if($success) return $this->send(array('result' => 'success', 'message' => zget($this->lang->instance->notices, 'uninstallSuccess'), 'load' => $this->createLink('space', 'browse')));
|
||||
|
||||
return $this->send(array('result' => 'fail', 'message' => zget($this->lang->instance->notices, 'uninstallFail')));
|
||||
}
|
||||
@@ -538,6 +661,7 @@ class instance extends control
|
||||
*/
|
||||
public function ajaxStart($instanceID)
|
||||
{
|
||||
if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false);
|
||||
$instance = $this->instance->getByID($instanceID);
|
||||
if(!$instance) return $this->send(array('result' => 'fail', 'message' => $this->lang->instance->instanceNotExists));
|
||||
|
||||
@@ -558,6 +682,7 @@ class instance extends control
|
||||
*/
|
||||
public function ajaxStop($instanceID)
|
||||
{
|
||||
if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false);
|
||||
$instance = $this->instance->getByID($instanceID);
|
||||
if(!$instance) return $this->send(array('result' => 'fail', 'message' => $this->lang->instance->instanceNotExists));
|
||||
|
||||
@@ -656,6 +781,7 @@ class instance extends control
|
||||
*/
|
||||
public function ajaxDBAuthUrl()
|
||||
{
|
||||
if(!commonModel::hasPriv('space', 'browse')) $this->loadModel('common')->deny('space', 'browse', false);
|
||||
$post = fixer::input('post')
|
||||
->setDefault('namespace', 'default')
|
||||
->setDefault('instanceID', 0)
|
||||
@@ -689,6 +815,7 @@ class instance extends control
|
||||
*/
|
||||
public function ajaxAdjustMemory($instanceID)
|
||||
{
|
||||
if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false);
|
||||
$postData = fixer::input('post')->get();
|
||||
|
||||
/* Check free memory size is enough or not. */
|
||||
|
||||
@@ -5,4 +5,5 @@
|
||||
.progress-container {word-break: keep-all; white-space: nowrap;}
|
||||
.progress-container i {margin: auto; margin-right: 6px;}
|
||||
.progress-container .progress {margin: auto; width: 100%; height: .7rem; margin-left: 6px; margin-right: 15px;}
|
||||
.label-dot {display: inline-block; width: 8px; height: 8px; padding: 0; line-height: 20px; text-indent: -9999em; border-radius: 50%;}
|
||||
.label-dot {display: inline-block; width: 8px; height: 8px; padding: 0; line-height: 20px; text-indent: -9999em; border-radius: 50%;}
|
||||
#instanceInfoContainer .table>*>tr>* {padding: .5rem .3rem;}
|
||||
@@ -1,4 +1,4 @@
|
||||
window.openAdminer = function()
|
||||
$('#mainContent').on('click', '.db-management', function()
|
||||
{
|
||||
var dbName = $(this).data('dbname');
|
||||
var dbType = $(this).data('dbtype');
|
||||
@@ -22,22 +22,78 @@ window.openAdminer = function()
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
var reloadTimes = 0;
|
||||
var refreshTime = 0;
|
||||
var timer = null;
|
||||
var currentStatus = instanceStatus;
|
||||
const postData = new FormData();
|
||||
postData.append('idList[]', instanceID);
|
||||
window.afterPageUpdate = function()
|
||||
{
|
||||
refreshStatus();
|
||||
}
|
||||
|
||||
function refreshStatus()
|
||||
{
|
||||
if(new Date().getTime() - refreshTime < 4000) return;
|
||||
refreshTime = new Date().getTime();
|
||||
|
||||
$.ajaxSubmit({
|
||||
url: $.createLink('instance', 'ajaxStatus'),
|
||||
method: 'POST',
|
||||
data:postData,
|
||||
onComplete: function(res)
|
||||
{
|
||||
if(res.result === 'success')
|
||||
{
|
||||
$.each(res.data, function(index, instance)
|
||||
{
|
||||
if(instance.status === 'running' && ($('#statusTD').data('reload') === true || $('#memoryRate').data('load') === true))
|
||||
{
|
||||
setTimeout(() => {loadCurrentPage();}, 3000);
|
||||
currentStatus = instance.status;
|
||||
return;
|
||||
}
|
||||
if(currentStatus != instance.status)
|
||||
{
|
||||
loadCurrentPage();
|
||||
currentStatus = instance.status;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
timer = setTimeout(() => {refreshStatus()}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.onPageUnmount = function()
|
||||
{
|
||||
if(!timer) return;
|
||||
clearTimeout(timer);
|
||||
}
|
||||
|
||||
$('.copy-btn').on('click', function()
|
||||
{
|
||||
var copyText = $(this).parent().find('input');
|
||||
copyText.show();
|
||||
copyText[0].select();
|
||||
document.execCommand("Copy");
|
||||
copyText.hide();
|
||||
|
||||
var that = this;
|
||||
$(that).tooltip
|
||||
({
|
||||
trigger: 'click',
|
||||
placement: 'bottom',
|
||||
title: copied,
|
||||
tipClass: 'success',
|
||||
show:true
|
||||
});
|
||||
setTimeout(function()
|
||||
{
|
||||
if(reloadTimes > 20) return;
|
||||
if($('#statusTD').data('reload') === true || $('#memoryRate').data('load') == true)
|
||||
{
|
||||
reloadTimes++;
|
||||
fetchContent({url: $.createLink('instance', 'view', 'id=' + instanceID),
|
||||
selector: '#instanceInfoContainer',
|
||||
id: 'instanceInfoContainer',
|
||||
target: '#instanceInfoContainer',
|
||||
});
|
||||
}
|
||||
}, 4000);
|
||||
}
|
||||
$(that).tooltip('hide');
|
||||
}, 2000)
|
||||
})
|
||||
+58
-43
@@ -1,5 +1,12 @@
|
||||
<?PHP
|
||||
$lang->instance = new stdclass;
|
||||
$lang->instance->common = 'Applications';
|
||||
$lang->instance->manage = 'Manage Applications';
|
||||
$lang->instance->view = 'Application Detail';
|
||||
$lang->instance->ajaxStatus = 'Get Application Status';
|
||||
$lang->instance->ajaxStart = 'Start Application';
|
||||
$lang->instance->ajaxStop = 'Stop Application';
|
||||
$lang->instance->ajaxUninstall = 'Uninstall Application';
|
||||
$lang->instance->name = 'name';
|
||||
$lang->instance->appName = 'Application type';
|
||||
$lang->instance->version = 'version';
|
||||
@@ -13,7 +20,7 @@ $lang->instance->dbType = 'Database';
|
||||
$lang->instance->advanceOption = 'Advanced Options';
|
||||
$lang->instance->baseInfo = 'Basic Information';
|
||||
$lang->instance->backupAndRestore = 'Backup';
|
||||
$lang->instance->advanced = 'Advanced';
|
||||
$lang->instance->advance = 'Advanced';
|
||||
$lang->instance->enableLDAP = 'Enable LDAP';
|
||||
$lang->instance->linkLDAP = 'Integrated LDAP';
|
||||
$lang->instance->enableSMTP = 'Enable SMTP';
|
||||
@@ -32,8 +39,9 @@ $lang->instance->uninstall = 'delete';
|
||||
$lang->instance->visit = 'Visit';
|
||||
$lang->instance->editName = 'Modify Name';
|
||||
$lang->instance->cpuCore = 'Core';
|
||||
$lang->instance->scaleble = 'Application level expansion';
|
||||
$lang->instance->scalable = 'Application level expansion';
|
||||
$lang->instance->change = 'Modify';
|
||||
$lang->instance->browseProject = "Project List";
|
||||
|
||||
$lang->instance->systemLDAPInactive = 'System LDAP not enabled';
|
||||
$lang->instance->toSystemLDAP = 'Deactivate';
|
||||
@@ -50,6 +58,10 @@ $lang->instance->installAt = 'Creation time';
|
||||
$lang->instance->runDuration = 'Running';
|
||||
$lang->instance->defaultAccount = 'Default User';
|
||||
$lang->instance->defaultPassword = 'Default Password';
|
||||
$lang->instance->account = 'User';
|
||||
$lang->instance->password = 'Password';
|
||||
$lang->instance->token = 'Token';
|
||||
$lang->instance->copied = 'Copy successful';
|
||||
$lang->instance->operationLog = 'Operation Record';
|
||||
$lang->instance->installedService = 'Installed Service';
|
||||
$lang->instance->runningService = 'Running Service';
|
||||
@@ -92,7 +104,7 @@ $lang->instance->backup->dbName = 'name';
|
||||
$lang->instance->backup->dbStatus = 'Status';
|
||||
$lang->instance->backup->dbSpentSeconds = 'Time taken (seconds)';
|
||||
$lang->instance->backup->dbSize = 'Size';
|
||||
$lang->instance->backup->volume = 'Data volume';
|
||||
$lang->instance->backup->volumne = 'Data volume';
|
||||
$lang->instance->backup->volName = 'name';
|
||||
$lang->instance->backup->volMountName = 'Mount directory';
|
||||
$lang->instance->backup->volStatus = 'Status';
|
||||
@@ -100,7 +112,7 @@ $lang->instance->backup->volSpentSeconds = 'Time taken (seconds)';
|
||||
$lang->instance->backup->volSize = 'Size';
|
||||
$lang->instance->backup->lastRestore = 'Last rollback';
|
||||
$lang->instance->backup->restoreDate = 'Rollback time';
|
||||
$lang->instance->backup->lastBackupAt = 'Last backup time';
|
||||
$lang->instance->backup->latestBackupAt = 'Last backup time';
|
||||
$lang->instance->backup->backupBeforeRestore = 'We recommend that you backup before rolling back!';
|
||||
$lang->instance->backup->enableAutoBackup = 'Enable automatic backup';
|
||||
$lang->instance->backup->autoBackup = 'Automatic backup';
|
||||
@@ -163,7 +175,7 @@ $lang->instance->log->date = 'date';
|
||||
$lang->instance->log->message = 'Content';
|
||||
|
||||
$lang->instance->actionList = array();
|
||||
$lang->instance->actionList['istall'] = '%s installed';
|
||||
$lang->instance->actionList['install'] = '%s installed';
|
||||
$lang->instance->actionList['uninstall'] = '%s deleted';
|
||||
$lang->instance->actionList['start'] = 'Started %s';
|
||||
$lang->instance->actionList['stop'] = '%s closed';
|
||||
@@ -186,39 +198,41 @@ $lang->instance->actionList['autorestore'] = 'The system has perform
|
||||
$lang->instance->actionList['deleteexpiredbackup'] = 'The system has deleted expired automatic backups';
|
||||
|
||||
$lang->instance->sourceList = array();
|
||||
$lang->instance->sourceList['cloud'] = 'Chancheng Public Market';
|
||||
$lang->instance->sourceList['cloud'] = 'Store';
|
||||
$lang->instance->sourceList['local'] = 'Local Market';
|
||||
$lang->instance->sourceList['user'] = 'User';
|
||||
|
||||
$lang->instance->channelList = array();
|
||||
$lang->instance->channelList['test'] = 'Test version';
|
||||
$lang->instance->channelList['stable'] = 'stable version';
|
||||
|
||||
$lang->instance->statusList = array();
|
||||
$lang->instance->statusList['istallationFailure'] = 'Installation failed';
|
||||
$lang->instance->statusList['creating'] = 'Creating';
|
||||
$lang->instance->statusList['initializing'] = 'initializing';
|
||||
$lang->instance->statusList['pulling'] = 'Downloading';
|
||||
$lang->instance->statusList['startup'] = 'Starting';
|
||||
$lang->instance->statusList['starting'] = 'Starting';
|
||||
$lang->instance->statusList['running'] = 'Running';
|
||||
$lang->instance->statusList['spending'] = 'Suspending';
|
||||
$lang->instance->statusList['suspended'] = 'paused';
|
||||
$lang->instance->statusList['istalling'] = 'Installing';
|
||||
$lang->instance->statusList['uninstalling'] = 'Removing';
|
||||
$lang->instance->statusList['stopping'] = 'Closing';
|
||||
$lang->instance->statusList['stopped'] = 'Closed';
|
||||
$lang->instance->statusList['destroying'] = 'Destroying';
|
||||
$lang->instance->statusList['destroyed'] = 'Destroyed';
|
||||
$lang->instance->statusList['abnormal'] = 'Abnormal';
|
||||
$lang->instance->statusList['upgrading'] = 'Updating';
|
||||
$lang->instance->statusList['unknown'] = 'unknown';
|
||||
$lang->instance->statusList['installationFail'] = 'Installation failed';
|
||||
$lang->instance->statusList['creating'] = 'Creating';
|
||||
$lang->instance->statusList['initializing'] = 'initializing';
|
||||
$lang->instance->statusList['pulling'] = 'Downloading';
|
||||
$lang->instance->statusList['startup'] = 'Starting';
|
||||
$lang->instance->statusList['starting'] = 'Starting';
|
||||
$lang->instance->statusList['running'] = 'Running';
|
||||
$lang->instance->statusList['suspending'] = 'Suspending';
|
||||
$lang->instance->statusList['suspended'] = 'paused';
|
||||
$lang->instance->statusList['installing'] = 'Installing';
|
||||
$lang->instance->statusList['uninstalling'] = 'Removing';
|
||||
$lang->instance->statusList['stopping'] = 'Closing';
|
||||
$lang->instance->statusList['stopped'] = 'Closed';
|
||||
$lang->instance->statusList['destroying'] = 'Destroying';
|
||||
$lang->instance->statusList['destroyed'] = 'Destroyed';
|
||||
$lang->instance->statusList['abnormal'] = 'Abnormal';
|
||||
$lang->instance->statusList['upgrading'] = 'Updating';
|
||||
$lang->instance->statusList['unknown'] = 'unknown';
|
||||
$lang->instance->statusList['scheduling'] = 'Scheduling';
|
||||
|
||||
$lang->instance->htmlStatusesClass = array();
|
||||
$lang->instance->htmlStatusesClass['running'] = 'success';
|
||||
$lang->instance->htmlStatusesClass['stopped'] = 'default';
|
||||
$lang->instance->htmlStatusesClass['abnormal'] = 'danger';
|
||||
$lang->instance->htmlStatusesClass['istallationFailure'] = 'danger';
|
||||
$lang->instance->htmlStatusesClass['busy'] = "warning";
|
||||
$lang->instance->htmlStatusesClass['running'] = 'success';
|
||||
$lang->instance->htmlStatusesClass['stopped'] = 'default';
|
||||
$lang->instance->htmlStatusesClass['abnormal'] = 'danger';
|
||||
$lang->instance->htmlStatusesClass['installationFail'] = 'danger';
|
||||
$lang->instance->htmlStatusesClass['busy'] = "warning";
|
||||
|
||||
$lang->instance->memOptions = array();
|
||||
$lang->instance->memOptions[128 * 1024] = '128MB';
|
||||
@@ -244,27 +258,27 @@ $lang->instance->notices['confirmStart'] = 'Are you sure to start the appl
|
||||
$lang->instance->notices['confirmStop'] = 'Are you sure to close this application?';
|
||||
$lang->instance->notices['confirmUninstall'] = 'Are you sure to delete this application?';
|
||||
$lang->instance->notices['startSuccess'] = 'Successfully started';
|
||||
$lang->instance->notices['startFailure'] = 'Start failed';
|
||||
$lang->instance->notices['startFail'] = 'Start failed';
|
||||
$lang->instance->notices['stopSuccess'] = 'Close successfully';
|
||||
$lang->instance->notices['stopFail'] = 'Close failed';
|
||||
$lang->instance->notices['uninstallSuccess'] = 'Successfully deleted';
|
||||
$lang->instance->notices['uninstallFailure'] = 'Delete failed';
|
||||
$lang->instance->notices['iinstallSuccess'] = 'Installation successful';
|
||||
$lang->instance->notices['iinstallFailure'] = 'Installation failed';
|
||||
$lang->instance->notices['uninstallFail'] = 'Delete failed';
|
||||
$lang->instance->notices['installSuccess'] = 'Installation successful';
|
||||
$lang->instance->notices['installFail'] = 'Installation failed';
|
||||
$lang->instance->notices['upgradeSuccess'] = 'Upgrade successful';
|
||||
$lang->instance->notices['upgradeFailure'] = 'Upgrade failed';
|
||||
$lang->instance->notices['upgradeFail'] = 'Upgrade failed';
|
||||
$lang->instance->notices['backupSuccess'] = 'Backup task submitted';
|
||||
$lang->instance->notices['backupFailure'] = 'Backup failed';
|
||||
$lang->instance->notices['backupFail'] = 'Backup failed';
|
||||
$lang->instance->notices['restoreSuccess'] = 'The rollback task has been submitted';
|
||||
$lang->instance->notices['restoreFailure'] = 'Rollback failed';
|
||||
$lang->instance->notices['restoreFail'] = 'Rollback failed';
|
||||
$lang->instance->notices['deleteSuccess'] = 'DeleteSuccess';
|
||||
$lang->instance->notices['deleteFail'] = 'Delete failed';
|
||||
$lang->instance->notices['starting'] = 'Starting, please wait...';
|
||||
$lang->instance->notices['stopping'] = 'Closing, please wait...';
|
||||
$lang->instance->notices['istalling'] = 'Installing, please wait...';
|
||||
$lang->instance->notices['installing'] = 'Installing, please wait...';
|
||||
$lang->instance->notices['uninstalling'] = 'Deleting, please wait...';
|
||||
$lang->instance->notices['upgrading'] = 'Upgrading, please wait...';
|
||||
$lang->instance->notices['backup'] = 'Backing up, please wait...';
|
||||
$lang->instance->notices['backuping'] = 'Backing up, please wait...';
|
||||
$lang->instance->notices['restoring'] = 'Rolling back, please wait...';
|
||||
$lang->instance->notices['deleting'] = 'Deleting, please wait...';
|
||||
$lang->instance->notices['adjusting'] = 'Adjusting, please wait...';
|
||||
@@ -288,6 +302,7 @@ $lang->instance->notices['enableSMTPSuccess'] = 'Enable SMTP successfully';
|
||||
$lang->instance->notices['disableSMTPSuccess'] = 'Disable SMTP successfully';
|
||||
$lang->instance->notices['confirmCustom'] = 'After modifying the custom configuration, the service will automatically restart to make the configuration effective.';
|
||||
$lang->instance->notices['required'] = 'cannot be empty';
|
||||
$lang->instance->notices['notEnoughResource'] = 'Insufficient platform resources. Do you want to continue installing?';
|
||||
|
||||
$lang->instance->nameChangeTo = '%s is modified to %s.';
|
||||
$lang->instance->versionChangeTo = 'Upgrade %s to %s.';
|
||||
@@ -296,8 +311,8 @@ $lang->instance->adjustMemorySize = 'It is recommended to adjust the memory to
|
||||
$lang->instance->enableAutoBackup = 'Enable automatic backup';
|
||||
$lang->instance->disableAutoBackup = 'Turn off automatic backup';
|
||||
|
||||
$lang->instance->InstanceNotExists = 'Service does not exist';
|
||||
$lang->instance->capticasTooSmall = 'The number of replicas cannot be less than 1';
|
||||
$lang->instance->instanceNotExists = 'Service does not exist';
|
||||
$lang->instance->caplicasTooSmall = 'The number of replicas cannot be less than 1';
|
||||
$lang->instance->empty = 'Currently no service available';
|
||||
$lang->instance->noComponent = 'No component, click';
|
||||
$lang->instance->noHigherVersion = 'No higher version found!';
|
||||
@@ -323,9 +338,9 @@ $lang->instance->errors->wrongRequestData = 'The submitted data is incorrect
|
||||
$lang->instance->errors->noDBList = 'No database or inaccessible';
|
||||
$lang->instance->errors->notFoundDB = 'The database cannot be found';
|
||||
$lang->instance->errors->dbNameIsEmpty = 'Database name is empty';
|
||||
$lang->instance->errors->faultToAdjustMemory = 'Failed to adjust memory';
|
||||
$lang->instance->errors->failToAdjustMemory = 'Failed to adjust memory';
|
||||
$lang->instance->errors->switchLDAPFailed = 'Modifying LDAP settings failed';
|
||||
$lang->instance->errors->switchSMTPFailed = 'Modifying SMTP settings failed';
|
||||
$lang->instance->errors->updateCustomimFailed = 'Modifying custom configuration failed';
|
||||
$lang->instance->errors->FailToSenior = 'Upgrade to Advanced version failed';
|
||||
$lang->instance->errors->updateCustomFailed = 'Modifying custom configuration failed';
|
||||
$lang->instance->errors->failToSenior = 'Upgrade to Advanced version failed';
|
||||
$lang->instance->errors->failedToUpdateDomain = 'Failed to update domain name';
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<?PHP
|
||||
$lang->instance = new stdclass;
|
||||
$lang->instance->common = 'Applications';
|
||||
$lang->instance->manage = 'Manage Applications';
|
||||
$lang->instance->view = 'Application Detail';
|
||||
$lang->instance->ajaxStatus = 'Get Application Status';
|
||||
$lang->instance->ajaxStart = 'Start Application';
|
||||
$lang->instance->ajaxStop = 'Stop Application';
|
||||
$lang->instance->ajaxUninstall = 'Uninstall Application';
|
||||
$lang->instance->name = 'name';
|
||||
$lang->instance->appName = 'Application type';
|
||||
$lang->instance->version = 'version';
|
||||
@@ -13,7 +20,7 @@ $lang->instance->dbType = 'Database';
|
||||
$lang->instance->advanceOption = 'Advanced Options';
|
||||
$lang->instance->baseInfo = 'Basic Information';
|
||||
$lang->instance->backupAndRestore = 'Backup';
|
||||
$lang->instance->advance = 'Advanced';
|
||||
$lang->instance->advance = 'Advanced';
|
||||
$lang->instance->enableLDAP = 'Enable LDAP';
|
||||
$lang->instance->linkLDAP = 'Integrated LDAP';
|
||||
$lang->instance->enableSMTP = 'Enable SMTP';
|
||||
@@ -34,6 +41,7 @@ $lang->instance->editName = 'Modify Name';
|
||||
$lang->instance->cpuCore = 'Core';
|
||||
$lang->instance->scalable = 'Application level expansion';
|
||||
$lang->instance->change = 'Modify';
|
||||
$lang->instance->browseProject = "Project List";
|
||||
|
||||
$lang->instance->systemLDAPInactive = 'System LDAP not enabled';
|
||||
$lang->instance->toSystemLDAP = 'Deactivate';
|
||||
@@ -50,6 +58,10 @@ $lang->instance->installAt = 'Creation time';
|
||||
$lang->instance->runDuration = 'Running';
|
||||
$lang->instance->defaultAccount = 'Default User';
|
||||
$lang->instance->defaultPassword = 'Default Password';
|
||||
$lang->instance->account = 'User';
|
||||
$lang->instance->password = 'Password';
|
||||
$lang->instance->token = 'Token';
|
||||
$lang->instance->copied = 'Copy successful';
|
||||
$lang->instance->operationLog = 'Operation Record';
|
||||
$lang->instance->installedService = 'Installed Service';
|
||||
$lang->instance->runningService = 'Running Service';
|
||||
@@ -92,7 +104,7 @@ $lang->instance->backup->dbName = 'name';
|
||||
$lang->instance->backup->dbStatus = 'Status';
|
||||
$lang->instance->backup->dbSpentSeconds = 'Time taken (seconds)';
|
||||
$lang->instance->backup->dbSize = 'Size';
|
||||
$lang->instance->backup->volume = 'Data volume';
|
||||
$lang->instance->backup->volumne = 'Data volume';
|
||||
$lang->instance->backup->volName = 'name';
|
||||
$lang->instance->backup->volMountName = 'Mount directory';
|
||||
$lang->instance->backup->volStatus = 'Status';
|
||||
@@ -100,8 +112,7 @@ $lang->instance->backup->volSpentSeconds = 'Time taken (seconds)';
|
||||
$lang->instance->backup->volSize = 'Size';
|
||||
$lang->instance->backup->lastRestore = 'Last rollback';
|
||||
$lang->instance->backup->restoreDate = 'Rollback time';
|
||||
$lang->instance->backup->latestBackupAt = 'Last Backup';
|
||||
$lang->instance->backup->lastBackupAt = 'Last backup time';
|
||||
$lang->instance->backup->latestBackupAt = 'Last backup time';
|
||||
$lang->instance->backup->backupBeforeRestore = 'We recommend that you backup before rolling back!';
|
||||
$lang->instance->backup->enableAutoBackup = 'Enable automatic backup';
|
||||
$lang->instance->backup->autoBackup = 'Automatic backup';
|
||||
@@ -164,7 +175,7 @@ $lang->instance->log->date = 'date';
|
||||
$lang->instance->log->message = 'Content';
|
||||
|
||||
$lang->instance->actionList = array();
|
||||
$lang->instance->actionList['install'] = '%s installed';
|
||||
$lang->instance->actionList['install'] = '%s installed';
|
||||
$lang->instance->actionList['uninstall'] = '%s deleted';
|
||||
$lang->instance->actionList['start'] = 'Started %s';
|
||||
$lang->instance->actionList['stop'] = '%s closed';
|
||||
@@ -187,8 +198,9 @@ $lang->instance->actionList['autorestore'] = 'The system has perform
|
||||
$lang->instance->actionList['deleteexpiredbackup'] = 'The system has deleted expired automatic backups';
|
||||
|
||||
$lang->instance->sourceList = array();
|
||||
$lang->instance->sourceList['cloud'] = 'Chancheng Public Market';
|
||||
$lang->instance->sourceList['cloud'] = 'Store';
|
||||
$lang->instance->sourceList['local'] = 'Local Market';
|
||||
$lang->instance->sourceList['user'] = 'User';
|
||||
|
||||
$lang->instance->channelList = array();
|
||||
$lang->instance->channelList['test'] = 'Test version';
|
||||
@@ -213,6 +225,7 @@ $lang->instance->statusList['destroyed'] = 'Destroyed';
|
||||
$lang->instance->statusList['abnormal'] = 'Abnormal';
|
||||
$lang->instance->statusList['upgrading'] = 'Updating';
|
||||
$lang->instance->statusList['unknown'] = 'unknown';
|
||||
$lang->instance->statusList['scheduling'] = 'Scheduling';
|
||||
|
||||
$lang->instance->htmlStatusesClass = array();
|
||||
$lang->instance->htmlStatusesClass['running'] = 'success';
|
||||
@@ -289,6 +302,7 @@ $lang->instance->notices['enableSMTPSuccess'] = 'Enable SMTP successfully';
|
||||
$lang->instance->notices['disableSMTPSuccess'] = 'Disable SMTP successfully';
|
||||
$lang->instance->notices['confirmCustom'] = 'After modifying the custom configuration, the service will automatically restart to make the configuration effective.';
|
||||
$lang->instance->notices['required'] = 'cannot be empty';
|
||||
$lang->instance->notices['notEnoughResource'] = 'Insufficient platform resources. Do you want to continue installing?';
|
||||
|
||||
$lang->instance->nameChangeTo = '%s is modified to %s.';
|
||||
$lang->instance->versionChangeTo = 'Upgrade %s to %s.';
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<?PHP
|
||||
$lang->instance = new stdclass;
|
||||
$lang->instance->common = 'Applications';
|
||||
$lang->instance->manage = 'Manage Applications';
|
||||
$lang->instance->view = 'Application Detail';
|
||||
$lang->instance->ajaxStatus = 'Get Application Status';
|
||||
$lang->instance->ajaxStart = 'Start Application';
|
||||
$lang->instance->ajaxStop = 'Stop Application';
|
||||
$lang->instance->ajaxUninstall = 'Uninstall Application';
|
||||
$lang->instance->name = 'name';
|
||||
$lang->instance->appName = 'Application type';
|
||||
$lang->instance->version = 'version';
|
||||
@@ -13,7 +20,7 @@ $lang->instance->dbType = 'Database';
|
||||
$lang->instance->advanceOption = 'Advanced Options';
|
||||
$lang->instance->baseInfo = 'Basic Information';
|
||||
$lang->instance->backupAndRestore = 'Backup';
|
||||
$lang->instance->advanced = 'Advanced';
|
||||
$lang->instance->advance = 'Advanced';
|
||||
$lang->instance->enableLDAP = 'Enable LDAP';
|
||||
$lang->instance->linkLDAP = 'Integrated LDAP';
|
||||
$lang->instance->enableSMTP = 'Enable SMTP';
|
||||
@@ -32,8 +39,9 @@ $lang->instance->uninstall = 'delete';
|
||||
$lang->instance->visit = 'Visit';
|
||||
$lang->instance->editName = 'Modify Name';
|
||||
$lang->instance->cpuCore = 'Core';
|
||||
$lang->instance->scaleble = 'Application level expansion';
|
||||
$lang->instance->scalable = 'Application level expansion';
|
||||
$lang->instance->change = 'Modify';
|
||||
$lang->instance->browseProject = "Project List";
|
||||
|
||||
$lang->instance->systemLDAPInactive = 'System LDAP not enabled';
|
||||
$lang->instance->toSystemLDAP = 'Deactivate';
|
||||
@@ -50,6 +58,10 @@ $lang->instance->installAt = 'Creation time';
|
||||
$lang->instance->runDuration = 'Running';
|
||||
$lang->instance->defaultAccount = 'Default User';
|
||||
$lang->instance->defaultPassword = 'Default Password';
|
||||
$lang->instance->account = 'User';
|
||||
$lang->instance->password = 'Password';
|
||||
$lang->instance->token = 'Token';
|
||||
$lang->instance->copied = 'Copy successful';
|
||||
$lang->instance->operationLog = 'Operation Record';
|
||||
$lang->instance->installedService = 'Installed Service';
|
||||
$lang->instance->runningService = 'Running Service';
|
||||
@@ -92,7 +104,7 @@ $lang->instance->backup->dbName = 'name';
|
||||
$lang->instance->backup->dbStatus = 'Status';
|
||||
$lang->instance->backup->dbSpentSeconds = 'Time taken (seconds)';
|
||||
$lang->instance->backup->dbSize = 'Size';
|
||||
$lang->instance->backup->volume = 'Data volume';
|
||||
$lang->instance->backup->volumne = 'Data volume';
|
||||
$lang->instance->backup->volName = 'name';
|
||||
$lang->instance->backup->volMountName = 'Mount directory';
|
||||
$lang->instance->backup->volStatus = 'Status';
|
||||
@@ -100,7 +112,7 @@ $lang->instance->backup->volSpentSeconds = 'Time taken (seconds)';
|
||||
$lang->instance->backup->volSize = 'Size';
|
||||
$lang->instance->backup->lastRestore = 'Last rollback';
|
||||
$lang->instance->backup->restoreDate = 'Rollback time';
|
||||
$lang->instance->backup->lastBackupAt = 'Last backup time';
|
||||
$lang->instance->backup->latestBackupAt = 'Last backup time';
|
||||
$lang->instance->backup->backupBeforeRestore = 'We recommend that you backup before rolling back!';
|
||||
$lang->instance->backup->enableAutoBackup = 'Enable automatic backup';
|
||||
$lang->instance->backup->autoBackup = 'Automatic backup';
|
||||
@@ -163,7 +175,7 @@ $lang->instance->log->date = 'date';
|
||||
$lang->instance->log->message = 'Content';
|
||||
|
||||
$lang->instance->actionList = array();
|
||||
$lang->instance->actionList['istall'] = '%s installed';
|
||||
$lang->instance->actionList['install'] = '%s installed';
|
||||
$lang->instance->actionList['uninstall'] = '%s deleted';
|
||||
$lang->instance->actionList['start'] = 'Started %s';
|
||||
$lang->instance->actionList['stop'] = '%s closed';
|
||||
@@ -186,8 +198,9 @@ $lang->instance->actionList['autorestore'] = 'The system has perform
|
||||
$lang->instance->actionList['deleteexpiredbackup'] = 'The system has deleted expired automatic backups';
|
||||
|
||||
$lang->instance->sourceList = array();
|
||||
$lang->instance->sourceList['cloud'] = 'Chancheng Public Market';
|
||||
$lang->instance->sourceList['cloud'] = 'Store';
|
||||
$lang->instance->sourceList['local'] = 'Local Market';
|
||||
$lang->instance->sourceList['user'] = 'User';
|
||||
|
||||
$lang->instance->channelList = array();
|
||||
$lang->instance->channelList['test'] = 'Test version';
|
||||
@@ -212,6 +225,7 @@ $lang->instance->statusList['destroyed'] = 'Destroyed';
|
||||
$lang->instance->statusList['abnormal'] = 'Abnormal';
|
||||
$lang->instance->statusList['upgrading'] = 'Updating';
|
||||
$lang->instance->statusList['unknown'] = 'unknown';
|
||||
$lang->instance->statusList['scheduling'] = 'Scheduling';
|
||||
|
||||
$lang->instance->htmlStatusesClass = array();
|
||||
$lang->instance->htmlStatusesClass['running'] = 'success';
|
||||
@@ -288,6 +302,7 @@ $lang->instance->notices['enableSMTPSuccess'] = 'Enable SMTP successfully';
|
||||
$lang->instance->notices['disableSMTPSuccess'] = 'Disable SMTP successfully';
|
||||
$lang->instance->notices['confirmCustom'] = 'After modifying the custom configuration, the service will automatically restart to make the configuration effective.';
|
||||
$lang->instance->notices['required'] = 'cannot be empty';
|
||||
$lang->instance->notices['notEnoughResource'] = 'Insufficient platform resources. Do you want to continue installing?';
|
||||
|
||||
$lang->instance->nameChangeTo = '%s is modified to %s.';
|
||||
$lang->instance->versionChangeTo = 'Upgrade %s to %s.';
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<?php
|
||||
$lang->instance = new stdclass;
|
||||
$lang->instance->common = '应用';
|
||||
$lang->instance->manage = '管理应用';
|
||||
$lang->instance->view = '应用详情';
|
||||
$lang->instance->ajaxStatus = '获取应用状态';
|
||||
$lang->instance->ajaxStart = '启动应用';
|
||||
$lang->instance->ajaxStop = '关闭应用';
|
||||
$lang->instance->ajaxUninstall = '卸载应用';
|
||||
$lang->instance->name = '名称';
|
||||
$lang->instance->appName = '应用类型';
|
||||
$lang->instance->version = '版本';
|
||||
@@ -34,6 +41,7 @@ $lang->instance->editName = '修改名称';
|
||||
$lang->instance->cpuCore = '核';
|
||||
$lang->instance->scalable = '应用水平扩容';
|
||||
$lang->instance->change = '修改';
|
||||
$lang->instance->browseProject = "项目列表";
|
||||
|
||||
$lang->instance->systemLDAPInactive = '未开启系统LDAP';
|
||||
$lang->instance->toSystemLDAP = '去启用';
|
||||
@@ -42,7 +50,6 @@ $lang->instance->enableSMTP = '启用SMTP';
|
||||
$lang->instance->systemSMTPInactive = '未开启系统SMTP';
|
||||
$lang->instance->toSystemSMTP = '去启用';
|
||||
|
||||
|
||||
$lang->instance->serviceInfo = '服务信息';
|
||||
$lang->instance->appTemplate = '应用模板';
|
||||
$lang->instance->source = '来源';
|
||||
@@ -51,6 +58,10 @@ $lang->instance->installAt = '创建时间';
|
||||
$lang->instance->runDuration = '已运行';
|
||||
$lang->instance->defaultAccount = '默认用户';
|
||||
$lang->instance->defaultPassword = '默认密码';
|
||||
$lang->instance->account = '用户名';
|
||||
$lang->instance->password = '密码';
|
||||
$lang->instance->token = 'Token';
|
||||
$lang->instance->copied = '复制成功';
|
||||
$lang->instance->operationLog = '操作记录';
|
||||
$lang->instance->installedService = '已安装服务';
|
||||
$lang->instance->runningService = '运行中的服务';
|
||||
@@ -93,7 +104,7 @@ $lang->instance->backup->dbName = '名称';
|
||||
$lang->instance->backup->dbStatus = '状态';
|
||||
$lang->instance->backup->dbSpentSeconds = '耗时(秒)';
|
||||
$lang->instance->backup->dbSize = '大小';
|
||||
$lang->instance->backup->volume = '数据卷';
|
||||
$lang->instance->backup->volumne = '数据卷';
|
||||
$lang->instance->backup->volName = '名称';
|
||||
$lang->instance->backup->volMountName = '挂载目录';
|
||||
$lang->instance->backup->volStatus = '状态';
|
||||
@@ -187,8 +198,9 @@ $lang->instance->actionList['autorestore'] = '系统执行了自动
|
||||
$lang->instance->actionList['deleteexpiredbackup'] = '系统删除了过期的自动备份';
|
||||
|
||||
$lang->instance->sourceList = array();
|
||||
$lang->instance->sourceList['cloud'] = '渠成公共市场';
|
||||
$lang->instance->sourceList['cloud'] = '应用市场';
|
||||
$lang->instance->sourceList['local'] = '本地市场';
|
||||
$lang->instance->sourceList['user'] = '手工配置';
|
||||
|
||||
$lang->instance->channelList = array();
|
||||
$lang->instance->channelList['test'] = '测试版';
|
||||
@@ -213,6 +225,7 @@ $lang->instance->statusList['destroyed'] = '已销毁';
|
||||
$lang->instance->statusList['abnormal'] = '异常';
|
||||
$lang->instance->statusList['upgrading'] = '更新中';
|
||||
$lang->instance->statusList['unknown'] = '未知';
|
||||
$lang->instance->statusList['scheduling'] = '调度中';
|
||||
|
||||
$lang->instance->htmlStatusesClass = array();
|
||||
$lang->instance->htmlStatusesClass['running'] = 'success';
|
||||
@@ -289,6 +302,7 @@ $lang->instance->notices['enableSMTPSuccess'] = '启用SMTP成功';
|
||||
$lang->instance->notices['disableSMTPSuccess'] = '禁用SMTP成功';
|
||||
$lang->instance->notices['confirmCustom'] = '修改自定义配置后服务将自动重启以使配置生效。';
|
||||
$lang->instance->notices['required'] = '不能为空';
|
||||
$lang->instance->notices['notEnoughResource'] = '平台资源不足,要继续安装吗?';
|
||||
|
||||
$lang->instance->nameChangeTo = ' %s 修改为 %s 。';
|
||||
$lang->instance->versionChangeTo = ' %s 升级为 %s 。';
|
||||
@@ -309,8 +323,7 @@ $lang->instance->appLifeTip = 'demo账号安装的应用有30分钟限
|
||||
$lang->instance->serialDiff = '查看版本区别';
|
||||
$lang->instance->descOfSwitchSerial = '您当前使用的是<strong>%s</strong>,想要体验更多高级功能,可升级至%s。';
|
||||
$lang->instance->toSeniorAttention = '重要提示';
|
||||
$lang->instance->toSeniorTips = "<ul class='text-danger'><li>版本升级后,无法回退到原版本。</li><li>企业版、旗舰版自安装后免费试用6个月。</li><li>开源版升级到企业版或旗舰版后,试用期最大支持3个用户,
|
||||
请检查开源版用户数量。超出限制将不可用。</li><li>升级成功后,服务将自动重启。</li><li>为避免造成数据丢失,请您在升级前务必做好数据备份。</li></ul>";
|
||||
$lang->instance->toSeniorTips = "<ul class='text-danger'><li>版本升级后,无法回退到原版本。</li><li>企业版、旗舰版自安装后免费试用6个月。</li><li>开源版升级到企业版或旗舰版后,试用期最大支持3个用户,请检查开源版用户数量。超出限制将不可用。</li><li>升级成功后,服务将自动重启。</li><li>为避免造成数据丢失,请您在升级前务必做好数据备份。</li></ul>";
|
||||
|
||||
$lang->instance->errors = new stdclass;
|
||||
$lang->instance->errors->domainLength = '域名长度必须介于2-20字符之间';
|
||||
|
||||
+65
-41
@@ -49,6 +49,20 @@ class InstanceModel extends model
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用url获取应用信息。
|
||||
* Get a application by url.
|
||||
*
|
||||
* @param string $url
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByUrl(string $url)
|
||||
{
|
||||
$url = str_replace(array('https://', 'http://'), '', trim($url));
|
||||
return $this->dao->select('id')->from(TABLE_INSTANCE)->where('domain')->eq($url)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by id list.
|
||||
*
|
||||
@@ -63,10 +77,10 @@ class InstanceModel extends model
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchAll('id');
|
||||
|
||||
$spaces = $this->dao->select('*')->from(TABLE_SPACE)->where('deleted')->eq(0)->andWhere('id')->in(array_column($instances, 'space'))->fetchAll('id');
|
||||
$spaces = $this->dao->select('*')->from(TABLE_SPACE)->where('deleted')->eq(0)->andWhere('id')->in(helper::arrayColumn($instances, 'space'))->fetchAll('id');
|
||||
foreach($instances as $instance) $instance->spaceData = zget($spaces, $instance->space, new stdclass);
|
||||
|
||||
$solutionIDList = array_column($instances, 'solution');
|
||||
$solutionIDList = helper::arrayColumn($instances, 'solution');
|
||||
$solutions = $this->dao->select('*')->from(TABLE_SOLUTION)->where('id')->in($solutionIDList)->fetchAll('id');
|
||||
foreach($instances as $instance) $instance->solutionData = zget($solutions, $instance->solution, new stdclass);
|
||||
|
||||
@@ -103,13 +117,13 @@ class InstanceModel extends model
|
||||
*/
|
||||
public function getByAccount($account = '', $pager = null, $pinned = '', $searchParam = '', $status = 'all')
|
||||
{
|
||||
$defaultSpace = $this->loadModel('space')->defaultSpace($account ? $account : $this->app->user->account);
|
||||
// $defaultSpace = $this->loadModel('space')->defaultSpace($account ? $account : $this->app->user->account);
|
||||
|
||||
$instances = $this->dao->select('instance.*')->from(TABLE_INSTANCE)->alias('instance')
|
||||
->leftJoin(TABLE_SPACE)->alias('space')->on('space.id=instance.space')
|
||||
->where('instance.deleted')->eq(0)
|
||||
->andWhere('space.id')->eq($defaultSpace->id)
|
||||
->beginIF($account)->andWhere('space.owner')->eq($account)->fi()
|
||||
// ->andWhere('space.id')->eq($defaultSpace->id)
|
||||
// ->beginIF($account)->andWhere('space.owner')->eq($account)->fi()
|
||||
->beginIF($pinned)->andWhere('instance.pinned')->eq((int)$pinned)->fi()
|
||||
->beginIF($searchParam)->andWhere('instance.name')->like("%{$searchParam}%")->fi()
|
||||
->beginIF($status != 'all')->andWhere('instance.status')->eq($status)->fi()
|
||||
@@ -119,12 +133,12 @@ class InstanceModel extends model
|
||||
|
||||
$spaces = $this->dao->select('*')->from(TABLE_SPACE)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('id')->in(array_column($instances, 'space'))
|
||||
->andWhere('id')->in(helper::arrayColumn($instances, 'space'))
|
||||
->fetchAll('id');
|
||||
|
||||
foreach($instances as $instance) $instance->spaceData = zget($spaces, $instance->space, new stdclass);
|
||||
|
||||
$solutionIDList = array_column($instances, 'solution');
|
||||
$solutionIDList = helper::arrayColumn($instances, 'solution');
|
||||
$solutions = $this->dao->select('*')->from(TABLE_SOLUTION)->where('id')->in($solutionIDList)->fetchAll('id');
|
||||
foreach($instances as $instance) $instance->solutionData = zget($solutions, $instance->solution, new stdclass);
|
||||
|
||||
@@ -143,7 +157,7 @@ class InstanceModel extends model
|
||||
|
||||
$spaces = $this->dao->select('*')->from(TABLE_SPACE)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('id')->in(array_column($instances, 'space'))
|
||||
->andWhere('id')->in(helper::arrayColumn($instances, 'space'))
|
||||
->fetchAll('id');
|
||||
|
||||
foreach($instances as $instance) $instance->spaceData = zget($spaces, $instance->space, new stdclass);
|
||||
@@ -330,7 +344,7 @@ class InstanceModel extends model
|
||||
->andWhere("REPLACE(domain, '.$sysDomain', '')")->like("%.%")
|
||||
->fetchAll('id');
|
||||
|
||||
$spaces = $this->dao->select('*')->from(TABLE_SPACE)->where('deleted')->eq(0)->andWhere('id')->in(array_column($instanceList, 'space'))->fetchAll('id');
|
||||
$spaces = $this->dao->select('*')->from(TABLE_SPACE)->where('deleted')->eq(0)->andWhere('id')->in(helper::arrayColumn($instanceList, 'space'))->fetchAll('id');
|
||||
|
||||
foreach($instanceList as $instance) $instance->spaceData = zget($spaces, $instance->space, new stdclass);
|
||||
|
||||
@@ -575,7 +589,7 @@ class InstanceModel extends model
|
||||
$settingsMap->global->ingress->host = $settingsMap->ingress->host;
|
||||
}
|
||||
|
||||
if(!empty($this->config->instance->devopsApps[$instance->appID]))
|
||||
if(in_array($instance->chart, $this->config->instance->devopsApps))
|
||||
{
|
||||
$settingsMap->ci = new stdclass();
|
||||
$settingsMap->ci->enabled = true;
|
||||
@@ -914,7 +928,7 @@ class InstanceModel extends model
|
||||
*/
|
||||
public function createInstance($app, $space, $thirdDomain, $name = '', $k8name = '', $channel = 'stable', $snippets = array())
|
||||
{
|
||||
if(empty($k8name)) $k8name = "{$app->chart}-{$this->app->user->account}-" . date('YmdHis'); //name rule: chartName-userAccount-YmdHis;
|
||||
if(empty($k8name)) $k8name = "{$app->chart}-" . date('YmdHis'); //name rule: chartName-userAccount-YmdHis;
|
||||
|
||||
$instanceData = new stdclass;
|
||||
$instanceData->appId = $app->id;
|
||||
@@ -1518,8 +1532,8 @@ class InstanceModel extends model
|
||||
$backupList = $result->data;
|
||||
usort($backupList, function($backup1, $backup2){ return $backup1->create_time < $backup2->create_time; });
|
||||
|
||||
$accounts = array_column($backupList, 'creator');
|
||||
foreach($backupList as $backup) $accounts = array_merge($accounts, array_column($backup->restores, 'creator'));
|
||||
$accounts = helper::arrayColumn($backupList, 'creator');
|
||||
foreach($backupList as $backup) $accounts = array_merge($accounts, helper::arrayColumn($backup->restores, 'creator'));
|
||||
|
||||
$accounts = array_unique($accounts);
|
||||
|
||||
@@ -1652,7 +1666,7 @@ class InstanceModel extends model
|
||||
->fetchAll();
|
||||
if(empty($instanceList)) return;
|
||||
|
||||
$spaceList = $this->dao->select('*')->from(TABLE_SPACE)->where('id')->in(array_column($instanceList, 'space'))->fetchAll('id');
|
||||
$spaceList = $this->dao->select('*')->from(TABLE_SPACE)->where('id')->in(helper::arrayColumn($instanceList, 'space'))->fetchAll('id');
|
||||
|
||||
foreach($instanceList as $instance)
|
||||
{
|
||||
@@ -1710,13 +1724,13 @@ class InstanceModel extends model
|
||||
*
|
||||
* @param object $instance
|
||||
* @param object $metrics
|
||||
* @param string $type 'bar' is progress bar, 'pie' is progress pie.
|
||||
* @static
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public static function printCpuUsage($instance, $metrics, $type = 'bar')
|
||||
public static function printCpuUsage($instance, $metrics)
|
||||
{
|
||||
if($instance->source === 'user') return array('color' => '', 'tip' => '', 'rate' => '', 'usage' => '', 'limit' => '');
|
||||
$rate = $instance->status == 'stopped' ? 0 : $metrics->rate;
|
||||
$tip = "{$rate}% = {$metrics->usage} / {$metrics->limit}";
|
||||
|
||||
@@ -1726,14 +1740,7 @@ class InstanceModel extends model
|
||||
if(empty($color) && $rate >= 0 && $rate < 90) $color = 'important';
|
||||
if(empty($color) && $rate >= 80) $color = 'danger';
|
||||
|
||||
if($type == 'array') return array('color' => $color, 'tip' => $tip, 'rate' => $rate . '%', 'usage' => $metrics->usage, 'limit' => $metrics->limit);
|
||||
|
||||
if(strtolower($type) == 'pie') commonModel::printProgressPie($rate, '', $tip);
|
||||
|
||||
$valueType = 'percent';
|
||||
if($instance->status == 'stopped') $valueType = '';
|
||||
|
||||
commonModel::printProgressBar($rate, '', $tip, $valueType);
|
||||
return array('color' => $color, 'tip' => $tip, 'rate' => $rate . '%', 'usage' => $metrics->usage, 'limit' => $metrics->limit);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1741,13 +1748,13 @@ class InstanceModel extends model
|
||||
*
|
||||
* @param object $instance
|
||||
* @param object $metrics
|
||||
* @param string $type 'bar' is progress bar, 'pie' is progress pie.
|
||||
* @static
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public static function printMemUsage($instance, $metrics, $type = 'bar')
|
||||
public static function printMemUsage($instance, $metrics)
|
||||
{
|
||||
if($instance->source === 'user') return array('color' => '', 'tip' => '', 'rate' => '', 'usage' => '', 'limit' => '');
|
||||
$rate = $instance->status == 'stopped' ? 0 : $metrics->rate;
|
||||
$tip = "{$rate}% = " . helper::formatKB($metrics->usage) . ' / ' . helper::formatKB($metrics->limit);
|
||||
|
||||
@@ -1757,14 +1764,7 @@ class InstanceModel extends model
|
||||
if(empty($color) && $rate >= 0 && $rate < 90) $color = 'important';
|
||||
if(empty($color) && $rate >= 80) $color = 'danger';
|
||||
|
||||
if($type == 'array') return array('color' => $color, 'tip' => $tip, 'rate' => $rate . '%', 'usage' => helper::formatKB($metrics->usage), 'limit' => helper::formatKB($metrics->limit));
|
||||
|
||||
if(strtolower($type) == 'pie') commonModel::printProgressPie($rate, '', $tip);
|
||||
|
||||
$valueType = 'tip';
|
||||
if($instance->status == 'stopped') $valueType = '';
|
||||
|
||||
commonModel::printProgressBar($rate, '', $tip, $valueType);
|
||||
return array('color' => $color, 'tip' => $tip, 'rate' => $rate . '%', 'usage' => helper::formatKB($metrics->usage), 'limit' => helper::formatKB($metrics->limit));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2054,14 +2054,38 @@ class InstanceModel extends model
|
||||
public function isClickable(object $instance, string $action): bool
|
||||
{
|
||||
if(!isset($instance->type)) $instance->type = 'store';
|
||||
if($action == 'start') return $instance->type != 'external' ? $this->canDo('start', $instance) : false;
|
||||
if($action == 'stop') return $instance->type != 'external' ? $this->canDo('stop', $instance) : false;
|
||||
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->externalID && in_array($instance->appName, array('GitLab', 'Gitea', 'Gogs'))) ? true : false;
|
||||
if($action == 'edit') return $instance->type != 'external' ? false : true;
|
||||
|
||||
if($instance->type !== 'store')
|
||||
{
|
||||
if($action === 'edit' || $action === 'visit') return true;
|
||||
if($action == 'bindUser') return in_array($instance->appName, array('GitLab', 'Gitea', 'Gogs'));
|
||||
if($action == 'ajaxUninstall') return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if($action == 'ajaxStart') return $this->canDo('start', $instance);
|
||||
if($action == 'ajaxStop') return $this->canDo('stop', $instance);
|
||||
if($action == 'ajaxUninstall') return $this->canDo('uninstall', $instance);
|
||||
if($action == 'visit') return !empty($instance->domain) && $this->canDo('visit', $instance);
|
||||
if($action == 'upgrade') return !empty($instance->latestVersion) && in_array($instance->status, array('stopped', 'running'));
|
||||
if($action == 'edit') return false;
|
||||
if($action == 'bindUser') return in_array($instance->appName, array('GitLab', 'Gitea', 'Gogs'));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断按钮是否显示。
|
||||
* Adjust the action display.
|
||||
*
|
||||
* @param object $instance
|
||||
* @param string $action
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isDisplay(object $instance, string $action): bool
|
||||
{
|
||||
if($action !== 'visit' && !commonModel::hasPriv('instance', 'manage')) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The edit externalapp view 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 Zeng gang<zenggang@easycorp.ltd>
|
||||
* @package instance
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
|
||||
namespace zin;
|
||||
|
||||
formPanel
|
||||
(
|
||||
set::id('appCreateForm'),
|
||||
set::title($lang->edit . $lang->space->appType[$app->type]),
|
||||
set::submitBtnText($lang->save),
|
||||
set::actions(array('submit', array('text' => $lang->cancel, 'data-type' => 'submit', 'data-dismiss' => 'modal'))),
|
||||
formRow
|
||||
(
|
||||
formGroup
|
||||
(
|
||||
set::name('name'),
|
||||
set::required(true),
|
||||
set::label($lang->sonarqube->name),
|
||||
set::value($app->name),
|
||||
)
|
||||
),
|
||||
formRow
|
||||
(
|
||||
formGroup
|
||||
(
|
||||
set::name('url'),
|
||||
set::required(true),
|
||||
set::label($lang->sonarqube->url),
|
||||
set::value($app->url),
|
||||
)
|
||||
),
|
||||
formRow
|
||||
(
|
||||
formGroup
|
||||
(
|
||||
set::name('account'),
|
||||
set::label($lang->sonarqube->account),
|
||||
set::value($app->account),
|
||||
)
|
||||
),
|
||||
formRow
|
||||
(
|
||||
formGroup
|
||||
(
|
||||
set::name('password'),
|
||||
set::label($lang->sonarqube->password),
|
||||
set::value($app->password),
|
||||
)
|
||||
),
|
||||
);
|
||||
@@ -24,6 +24,7 @@ formPanel
|
||||
(
|
||||
set::name('name'),
|
||||
set::width('500px'),
|
||||
set::required(true),
|
||||
set::label($lang->instance->name),
|
||||
set::value($instance->name),
|
||||
)
|
||||
@@ -35,6 +36,7 @@ formPanel
|
||||
set::name('memory_kb'),
|
||||
set::width('250px'),
|
||||
set::control('picker'),
|
||||
set::required(true),
|
||||
set::label($lang->instance->adjustMem),
|
||||
set::value(intval($currentResource->max->memory / 1024)),
|
||||
set::items($this->instance->filterMemOptions($currentResource)),
|
||||
|
||||
@@ -13,13 +13,27 @@ declare(strict_types=1);
|
||||
|
||||
namespace zin;
|
||||
|
||||
jsVar('instanceID', $instance->id);
|
||||
jsVar('copied', $lang->instance->copied);
|
||||
jsVar('instanceID', $instance->id);
|
||||
jsVar('instanceStatus', $instance->status);
|
||||
jsVar('instanceType', $type);
|
||||
|
||||
$setting = usePager('pager');
|
||||
$instance->appName = strtolower($instance->appName);
|
||||
$cpuInfo = $this->instance->printCpuUsage($instance, $instanceMetric->cpu, 'array');
|
||||
$memoryInfo = $this->instance->printMemUsage($instance, $instanceMetric->memory, 'array');
|
||||
$actions = $this->loadModel('common')->buildOperateMenu($instance);
|
||||
|
||||
if($type !== 'store')
|
||||
{
|
||||
$defaultAccount = new stdclass();
|
||||
$defaultAccount->username = $instance->account;
|
||||
$defaultAccount->password = $instance->password;
|
||||
$defaultAccount->token = $instance->token;
|
||||
|
||||
$lang->instance->defaultAccount = $lang->instance->account;
|
||||
$lang->instance->defaultPassword = $lang->instance->password;
|
||||
}
|
||||
|
||||
$dbListWg = array();
|
||||
foreach($dbList as $db)
|
||||
{
|
||||
@@ -39,11 +53,10 @@ foreach($dbList as $db)
|
||||
btn
|
||||
(
|
||||
$lang->instance->management,
|
||||
setClass('btn text-primary ghost ' . $disabledClass),
|
||||
setClass('btn text-primary ghost db-management ' . $disabledClass),
|
||||
setData('dbname', $db->name),
|
||||
setData('dbtype', $db->db_type),
|
||||
setData('id', $instance->id),
|
||||
on::click('openAdminer'),
|
||||
)
|
||||
),
|
||||
);
|
||||
@@ -55,10 +68,10 @@ detailHeader(
|
||||
);
|
||||
div
|
||||
(
|
||||
setClass('flex flex-normal gap-x-5'),
|
||||
setClass('flex flex-normal gap-x-5 justify-center'),
|
||||
div
|
||||
(
|
||||
setClass('basis-2/3'),
|
||||
setClass('flex-none w-2/3'),
|
||||
setID('instanceInfoContainer'),
|
||||
detailBody
|
||||
(
|
||||
@@ -67,26 +80,27 @@ div
|
||||
/* 应用名称信息图标区块 */
|
||||
section
|
||||
(
|
||||
set::title(''),
|
||||
div
|
||||
(
|
||||
setClass('flex justify-between'),
|
||||
div
|
||||
(
|
||||
setClass('flex basis-full'),
|
||||
img(set::src($instance->logo), setStyle(array('width' => '50px', 'height' => '50px'))),
|
||||
$type === 'store' ? img(set::src($instance->logo), setStyle(array('width' => '50px', 'height' => '50px'))) : null,
|
||||
div
|
||||
(
|
||||
setClass('ml-3 flex col gap-y-1 basis-full'),
|
||||
setClass(($type === 'store' ? 'ml-3' : '') . ' flex col gap-y-1 basis-full'),
|
||||
div
|
||||
(
|
||||
$instance->name, setClass('text-xl'),
|
||||
span($cloudApp->app_version, setClass('ml-3 label lighter rounded-full'))
|
||||
$type === 'store' ? span($instance->appVersion, setClass('ml-3 label lighter rounded-full')) : null
|
||||
),
|
||||
div
|
||||
$type === 'store' ? div
|
||||
(
|
||||
setClass('flex progress-container'),
|
||||
set::title($cpuInfo['tip']),
|
||||
icon('cog-outline text-' . $cpuInfo['color']),
|
||||
icon('cpu text-' . $cpuInfo['color']),
|
||||
$lang->instance->cpuUsage,
|
||||
div
|
||||
(
|
||||
@@ -99,7 +113,7 @@ div
|
||||
setStyle('width', $cpuInfo['rate'])
|
||||
)
|
||||
),
|
||||
icon('desktop text-' . $memoryInfo['color']),
|
||||
icon('memory text-' . $memoryInfo['color']),
|
||||
$lang->instance->memUsage,
|
||||
span
|
||||
(
|
||||
@@ -120,10 +134,10 @@ div
|
||||
setStyle('width', $memoryInfo['rate'])
|
||||
)
|
||||
)
|
||||
),
|
||||
) : null,
|
||||
),
|
||||
),
|
||||
btn
|
||||
$type !== 'store' ? null : btn
|
||||
(
|
||||
$lang->instance->setting,
|
||||
setClass('btn ghost'),
|
||||
@@ -144,18 +158,20 @@ div
|
||||
setClass('table w-auto max-w-full bordered mt-4'),
|
||||
h::tr
|
||||
(
|
||||
h::th($lang->instance->status),
|
||||
$type !== 'store' ? null : h::th($lang->instance->status),
|
||||
h::th($lang->instance->source),
|
||||
// h::th($lang->instance->appTemplate),
|
||||
h::th($lang->instance->installBy),
|
||||
h::th($lang->instance->installAt),
|
||||
h::th($lang->instance->runDuration),
|
||||
$defaultAccount ? h::th($lang->instance->defaultAccount) : null,
|
||||
$defaultAccount ? h::th($lang->instance->defaultPassword) : null,
|
||||
$type !== 'store' ? null : h::th($lang->instance->runDuration),
|
||||
!empty($defaultAccount->username) ? h::th($lang->instance->defaultAccount) : null,
|
||||
!empty($defaultAccount->password) ? h::th($lang->instance->defaultPassword) : null,
|
||||
!empty($defaultAccount->token) ? h::th($lang->instance->token) : null,
|
||||
(!in_array($instance->appName, array('gitlab', 'sonarqube'))) ? null : h::th($lang->instance->browseProject),
|
||||
),
|
||||
h::tr
|
||||
(
|
||||
h::td
|
||||
$type !== 'store' ? null : h::td
|
||||
(
|
||||
setID('statusTD'),
|
||||
setData('reload', in_array($instance->status, array('creating', 'initializing', 'pulling', 'startup', 'starting', 'suspending', 'installing', 'uninstalling', 'stopping', 'destroying', 'upgrading'))),
|
||||
@@ -169,9 +185,28 @@ div
|
||||
// h::td(a(set::href($this->createLink('store', 'appView', "id=$instance->appID")), $instance->appName)),
|
||||
h::td(zget($users, $instance->createdBy, '')),
|
||||
h::td(substr($instance->createdAt, 0, 16)),
|
||||
h::td(common::printDuration($instance->runDuration)),
|
||||
$defaultAccount ? h::td($defaultAccount->username) : null,
|
||||
$defaultAccount ? h::td($defaultAccount->password) : null,
|
||||
$type !== 'store' ? null : h::td(common::printDuration($instance->runDuration)),
|
||||
!empty($defaultAccount->username) ? h::td($defaultAccount->username) : null,
|
||||
!empty($defaultAccount->password) ? h::td
|
||||
(
|
||||
input(set::type('text'), set::value($defaultAccount->password), set::name('password'), setStyle('display', 'none')),
|
||||
btn(set::className('copy-btn ghost'),set::icon('copy'))
|
||||
): null,
|
||||
!empty($defaultAccount->token) ? h::td
|
||||
(
|
||||
input(set::type('text'), set::value($defaultAccount->token), set::name('token'), setStyle('display', 'none')),
|
||||
btn(set::className('copy-btn ghost'),set::icon('copy'))
|
||||
): null,
|
||||
(!in_array($instance->appName, array('gitlab', 'sonarqube'))) ? null : h::td
|
||||
(
|
||||
btn
|
||||
(
|
||||
$lang->instance->management,
|
||||
setClass('btn text-primary ghost'),
|
||||
set::disabled($instance->type === 'store' && $instance->status != 'running'),
|
||||
set::url(createLink($instance->appName, 'browseProject', "{$instance->appName}ID={$instance->externalID}"))
|
||||
)
|
||||
),
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -205,10 +240,10 @@ div
|
||||
),
|
||||
div
|
||||
(
|
||||
setClass('basis-auto'),
|
||||
setClass('w-1/3'),
|
||||
history
|
||||
(
|
||||
set::commentUrl(createLink('action', 'comment', array('objectType' => 'instance', 'objectID' => $instance->id))),
|
||||
set::commentUrl(createLink('action', 'comment', array('objectType' => $type === 'store' ? 'instance' : $instance->type, 'objectID' => $instance->id))),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -21,9 +21,9 @@ class instanceZen extends instance
|
||||
*/
|
||||
protected function saveAuthInfo(object $instance): void
|
||||
{
|
||||
if(empty($this->config->instance->devopsApps[$instance->appID])) return;
|
||||
if(!in_array($instance->chart, $this->config->instance->devopsApps)) return;
|
||||
|
||||
$url = 'https://' . $instance->domain;
|
||||
$url = strstr(getWebRoot(true), ':', true) . '://' . $instance->domain;
|
||||
$pipeline = $this->loadModel('pipeline')->getByUrl($url);
|
||||
if(!empty($pipeline)) return;
|
||||
|
||||
@@ -31,19 +31,21 @@ class instanceZen extends instance
|
||||
if(empty($tempMappings)) return;
|
||||
|
||||
$pipeline = new stdclass();
|
||||
$instance->type = $this->config->instance->devopsApps[$instance->appID];
|
||||
$instance->type = $instance->chart;
|
||||
$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', '');
|
||||
$pipeline->token = zget($tempMappings, 'api_token', '');
|
||||
$pipeline->account = zget($tempMappings, 'z_username', '');
|
||||
$pipeline->password = zget($tempMappings, 'z_password', '');
|
||||
if($instance->appID == 60) $pipeline->token = base64_encode($pipeline->token . ':');
|
||||
if(empty($pipeline->account)) $pipeline->account = zget($tempMappings, 'admin_username', '');
|
||||
|
||||
$this->pipeline->create($pipeline);
|
||||
if(dao::isError()) dao::getError();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user