From a72d3da6937592e986e2779cce7f662586b6b040 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Wed, 21 Jun 2023 17:49:36 +0800 Subject: [PATCH] * Add modal.alert of gitlab,jenkins,job. --- module/gitlab/control.php | 5 +++-- module/jenkins/control.php | 4 ++-- module/job/config/dtable.php | 9 +++++---- module/job/control.php | 10 +++++++--- module/job/model.php | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/module/gitlab/control.php b/module/gitlab/control.php index 27f68baf49..0828467587 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -231,8 +231,9 @@ class gitlab extends control $actionID = $this->pipeline->delete($id, 'gitlab'); if(!$actionID) { - $response['result'] = 'fail'; - $response['message'] = $this->lang->pipeline->delError; + $response['result'] = 'fail'; + $response['callback'] = sprintf('zui.Modal.alert("%s");', $this->lang->pipeline->delError); + return $this->send($response); } diff --git a/module/jenkins/control.php b/module/jenkins/control.php index b795ee4361..9d3db13085 100644 --- a/module/jenkins/control.php +++ b/module/jenkins/control.php @@ -105,8 +105,8 @@ class jenkins extends control $jobs = $this->dao->select('*')->from(TABLE_JOB)->where('server')->eq($id)->andWhere('engine')->eq('jenkins')->andWhere('deleted')->eq('0')->fetchAll(); if($jobs) { - $response['result'] = 'fail'; - $response['message'] = $this->lang->jenkins->error->linkedJob; + $response['result'] = 'fail'; + $response['callback'] = sprintf('zui.Modal.alert("%s");', $this->lang->jenkins->error->linkedJob); return $this->send($response); } diff --git a/module/job/config/dtable.php b/module/job/config/dtable.php index 8a3bdfdebb..321939ce3d 100644 --- a/module/job/config/dtable.php +++ b/module/job/config/dtable.php @@ -84,10 +84,11 @@ $config->job->actionList['edit']['text'] = $lang->job->edit; $config->job->actionList['edit']['hint'] = $lang->job->edit; $config->job->actionList['edit']['url'] = helper::createLink('job', 'edit',"jobID={id}"); -$config->job->actionList['exec']['icon'] = 'play'; -$config->job->actionList['exec']['text'] = $lang->job->exec; -$config->job->actionList['exec']['hint'] = $lang->job->exec; -$config->job->actionList['exec']['url'] = helper::createLink('job', 'exec',"jobID={id}"); +$config->job->actionList['exec']['icon'] = 'play'; +$config->job->actionList['exec']['text'] = $lang->job->exec; +$config->job->actionList['exec']['hint'] = $lang->job->exec; +$config->job->actionList['exec']['className'] = 'ajax-submit'; +$config->job->actionList['exec']['url'] = helper::createLink('job', 'exec',"jobID={id}"); $config->job->actionList['delete']['icon'] = 'trash'; $config->job->actionList['delete']['text'] = $lang->job->delete; diff --git a/module/job/control.php b/module/job/control.php index 7b9d06b1f7..80c539975c 100644 --- a/module/job/control.php +++ b/module/job/control.php @@ -265,7 +265,7 @@ class job extends control */ public function view($jobID, $compileID = 0) { - $job = $this->job->getById($jobID); + $job = $this->job->getById($jobID); $this->loadModel('compile'); if($compileID) @@ -348,11 +348,15 @@ class job extends control if(strtolower($job->engine) == 'gitlab' and (!isset($job->reference) or !$job->reference)) return $this->send(array('result' => 'fail', 'message' => $this->lang->job->setReferenceTips, 'locate' => inlink('edit', "id=$jobID"))); $compile = $this->job->exec($jobID); - if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + if(dao::isError()) return $this->send(array('result' => 'fail', 'callback' => sprintf('zui.Modal.alert("%s");', dao::getError()))); $this->app->loadLang('compile'); $this->loadModel('action')->create('job', $jobID, 'executed'); - return $this->send(array('result' => 'success', 'message' => sprintf($this->lang->job->sendExec, zget($this->lang->compile->statusList, $compile->status)))); + + $message = sprintf($this->lang->job->sendExec, zget($this->lang->compile->statusList, $compile->status)); + $response['result'] = 'success'; + $response['callback'] = sprintf('zui.Modal.alert("%s");', $message); + return $this->send($response); } /** diff --git a/module/job/model.php b/module/job/model.php index 9ea3f34a77..847de0d18a 100644 --- a/module/job/model.php +++ b/module/job/model.php @@ -681,7 +681,7 @@ class jobModel extends model * @param string $action * @param string $module * @access public - * @return void + * @return bool */ public static function isClickable($object, $action, $module = 'job') {