* Fix error of edit instance.
This commit is contained in:
@@ -121,7 +121,8 @@ class gitea extends control
|
|||||||
|
|
||||||
if($_POST)
|
if($_POST)
|
||||||
{
|
{
|
||||||
$this->checkToken();
|
$gitea = fixer::input('post')->trim('url,token')->get();
|
||||||
|
$this->checkToken($gitea);
|
||||||
$this->gitea->update($giteaID);
|
$this->gitea->update($giteaID);
|
||||||
$gitea = $this->gitea->getByID($giteaID);
|
$gitea = $this->gitea->getByID($giteaID);
|
||||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||||
@@ -130,7 +131,7 @@ class gitea extends control
|
|||||||
$actionID = $this->action->create('gitea', $giteaID, 'edited');
|
$actionID = $this->action->create('gitea', $giteaID, 'edited');
|
||||||
$changes = common::createChanges($oldGitea, $gitea);
|
$changes = common::createChanges($oldGitea, $gitea);
|
||||||
$this->action->logHistory($actionID, $changes);
|
$this->action->logHistory($actionID, $changes);
|
||||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
|
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true, 'closeModal' => true));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->title = $this->lang->gitea->common . $this->lang->colon . $this->lang->gitea->edit;
|
$this->view->title = $this->lang->gitea->common . $this->lang->colon . $this->lang->gitea->edit;
|
||||||
|
|||||||
@@ -116,7 +116,8 @@ class gitlab extends control
|
|||||||
|
|
||||||
if($_POST)
|
if($_POST)
|
||||||
{
|
{
|
||||||
$this->checkToken();
|
$gitlab = fixer::input('post')->trim('url,token')->get();
|
||||||
|
$this->checkToken($gitlab, $id);
|
||||||
$this->gitlab->update($id);
|
$this->gitlab->update($id);
|
||||||
$gitLab = $this->gitlab->getByID($id);
|
$gitLab = $this->gitlab->getByID($id);
|
||||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||||
@@ -125,7 +126,7 @@ class gitlab extends control
|
|||||||
$actionID = $this->action->create('gitlab', $id, 'edited');
|
$actionID = $this->action->create('gitlab', $id, 'edited');
|
||||||
$changes = common::createChanges($oldGitLab, $gitLab);
|
$changes = common::createChanges($oldGitLab, $gitLab);
|
||||||
$this->action->logHistory($actionID, $changes);
|
$this->action->logHistory($actionID, $changes);
|
||||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('space', 'browse')));
|
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true, 'closeModal' => true));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->edit;
|
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->edit;
|
||||||
@@ -292,9 +293,9 @@ class gitlab extends control
|
|||||||
* @access protected
|
* @access protected
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function checkToken(object $gitlab)
|
protected function checkToken(object $gitlab, int $gitlabID = 0)
|
||||||
{
|
{
|
||||||
$this->dao->update('gitlab')->data($gitlab)->batchCheck($this->config->gitlab->create->requiredFields, 'notempty');
|
$this->dao->update('gitlab')->data($gitlab)->batchCheck($gitlabID ? $this->config->gitlab->edit->requiredFields : $this->config->gitlab->create->requiredFields, 'notempty');
|
||||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||||
|
|
||||||
if(strpos($gitlab->url, 'http') !== 0) return $this->send(array('result' => 'fail', 'message' => array('url' => array(sprintf($this->lang->gitlab->hostError, $this->config->gitlab->minCompatibleVersion)))));
|
if(strpos($gitlab->url, 'http') !== 0) return $this->send(array('result' => 'fail', 'message' => array('url' => array(sprintf($this->lang->gitlab->hostError, $this->config->gitlab->minCompatibleVersion)))));
|
||||||
|
|||||||
@@ -120,7 +120,8 @@ class gogs extends control
|
|||||||
|
|
||||||
if($_POST)
|
if($_POST)
|
||||||
{
|
{
|
||||||
$this->checkToken();
|
$gogs = fixer::input('post')->trim('url,token')->get();
|
||||||
|
$this->checkToken($gogs);
|
||||||
$this->gogs->update($gogsID);
|
$this->gogs->update($gogsID);
|
||||||
$gogs = $this->gogs->getByID($gogsID);
|
$gogs = $this->gogs->getByID($gogsID);
|
||||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||||
@@ -129,7 +130,7 @@ class gogs extends control
|
|||||||
$actionID = $this->action->create('gogs', $gogsID, 'edited');
|
$actionID = $this->action->create('gogs', $gogsID, 'edited');
|
||||||
$changes = common::createChanges($oldGogs, $gogs);
|
$changes = common::createChanges($oldGogs, $gogs);
|
||||||
$this->action->logHistory($actionID, $changes);
|
$this->action->logHistory($actionID, $changes);
|
||||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
|
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true, 'closeModal' => true));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->title = $this->lang->gogs->common . $this->lang->colon . $this->lang->gogs->edit;
|
$this->view->title = $this->lang->gogs->common . $this->lang->colon . $this->lang->gogs->edit;
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class jenkins extends control
|
|||||||
{
|
{
|
||||||
$this->jenkins->update($id);
|
$this->jenkins->update($id);
|
||||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
|
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true, 'closeModal' => true));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->title = $this->lang->jenkins->common . $this->lang->colon . $this->lang->jenkins->edit;
|
$this->view->title = $this->lang->jenkins->common . $this->lang->colon . $this->lang->jenkins->edit;
|
||||||
|
|||||||
@@ -156,11 +156,11 @@ class sonarqube extends control
|
|||||||
/**
|
/**
|
||||||
* Check post info.
|
* Check post info.
|
||||||
*
|
*
|
||||||
* @param object $sonarqube
|
* @param int $sonarqubeID
|
||||||
* @access protected
|
* @access protected
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function checkToken(object $sonarqube)
|
protected function checkToken(int $sonarqubeID)
|
||||||
{
|
{
|
||||||
$sonarqube = fixer::input('post')->trim('url,token,account,password')->get();
|
$sonarqube = fixer::input('post')->trim('url,token,account,password')->get();
|
||||||
$this->dao->update('sonarqube')->data($sonarqube)
|
$this->dao->update('sonarqube')->data($sonarqube)
|
||||||
@@ -207,7 +207,7 @@ class sonarqube extends control
|
|||||||
$actionID = $this->action->create('sonarqube', $sonarqubeID, 'edited');
|
$actionID = $this->action->create('sonarqube', $sonarqubeID, 'edited');
|
||||||
$changes = common::createChanges($oldSonarQube, $sonarqube);
|
$changes = common::createChanges($oldSonarQube, $sonarqube);
|
||||||
$this->action->logHistory($actionID, $changes);
|
$this->action->logHistory($actionID, $changes);
|
||||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
|
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true, 'closeModal' => true));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->title = $this->lang->sonarqube->common . $this->lang->colon . $this->lang->sonarqube->editServer;
|
$this->view->title = $this->lang->sonarqube->common . $this->lang->colon . $this->lang->sonarqube->editServer;
|
||||||
|
|||||||
@@ -77,5 +77,6 @@ window.bindUser = function(externalID, appName)
|
|||||||
|
|
||||||
window.editApp = function(externalID, appName)
|
window.editApp = function(externalID, appName)
|
||||||
{
|
{
|
||||||
openUrl($.createLink(appName.toLowerCase(), 'edit', 'id=' + externalID));
|
$('#editLinkContainer').attr('href', $.createLink(appName.toLowerCase(), 'edit', 'id=' + externalID));
|
||||||
|
$('#editLinkContainer').trigger('click');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,5 +42,7 @@ dtable
|
|||||||
set::footPager(usePager()),
|
set::footPager(usePager()),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
a(setStyle('display', 'none'), setID('editLinkContainer'), setData('toggle', 'modal'));
|
||||||
|
|
||||||
render();
|
render();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user