diff --git a/admin.php b/admin.php index 1a4344e..df479ce 100644 --- a/admin.php +++ b/admin.php @@ -16,7 +16,7 @@ $app->on('admin.init', function () use ($app) { // Bind admin routes. $this->bindClass('Drone\\Controller\\Admin', 'drone/deploys'); - if ($app->module('cockpit')->hasaccess('drone', 'deploys.view')) { + if ($app->module('cockpit')->hasaccess('drone', 'manage.view')) { // Add to modules menu. $this('admin')->addMenuItem('modules', [ 'label' => 'Drone Deploys', diff --git a/bootstrap.php b/bootstrap.php index 6acc3be..664d275 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -26,8 +26,8 @@ if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) { $headers = [ 'Content-Type: application/json', - 'Accept: application/json', - 'Authorization: Bearer ' . $settings['token'] + 'Accept: application/json', + 'Authorization: Bearer ' . $settings['token'] ]; $ch = curl_init($url); @@ -57,8 +57,8 @@ if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) { $limit--; if ($limit>0) { $deploys[] = $deploy; - } - } + } + } } } @@ -72,15 +72,15 @@ if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) { } $deploys[$idx]->created_at = date('Y-m-d H:i', $deploy->created); $deploys[$idx]->updated_at = date('Y-m-d H:i', $deploy->updated); - if ($deploy->finished) { - $deploys[$idx]->deploy_time = $deploy->finished - $deploy->started; - } + if ($deploy->finished) { + $deploys[$idx]->deploy_time = $deploy->finished - $deploy->started; + } } return [ 'deploys' => $deploys, 'building' => $building, - 'build' => $build + 'build' => $build ]; }, @@ -102,8 +102,8 @@ if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) { $headers = [ 'Content-Type: application/json', - 'Accept: application/json', - 'Authorization: Bearer ' . $settings['token'] + 'Accept: application/json', + 'Authorization: Bearer ' . $settings['token'] ]; $ch = curl_init($url); diff --git a/views/deploys/index.php b/views/deploys/index.php index 945e69d..c5f3a85 100644 --- a/views/deploys/index.php +++ b/views/deploys/index.php @@ -130,14 +130,14 @@ } else { App.ui.notify("unknown error", "danger"); } - if (data) { + if (data) { $this.modal.show(); editor = $this.refs.codemirror.editor; editor.setValue(JSON.stringify(data, null, 2), true); editor.setOption("readOnly", true); editor.setSize($this.modal.dialog[0].clientWidth - 50, $this.modal.dialog[0].clientHeight - 70); editor.refresh(); - } + } return; } App.ui.notify(App.i18n.get("A new deploy was requested."), "success");