ajout heimdall
This commit is contained in:
77
heimdall/config/www/SupportedApps/GitLab/GitLab.php
Executable file
77
heimdall/config/www/SupportedApps/GitLab/GitLab.php
Executable file
@@ -0,0 +1,77 @@
|
||||
<?php namespace App\SupportedApps\GitLab;
|
||||
|
||||
class GitLab extends \App\SupportedApps implements \App\EnhancedApps
|
||||
{
|
||||
public $config;
|
||||
|
||||
//protected $login_first = true; // Uncomment if api requests need to be authed first
|
||||
//protected $method = 'POST'; // Uncomment if requests to the API should be set by POST
|
||||
|
||||
function __construct()
|
||||
{
|
||||
//$this->jar = new \GuzzleHttp\Cookie\CookieJar; // Uncomment if cookies need to be set
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
if (!empty($this->config->health_apikey)) {
|
||||
$test = parent::appTest(
|
||||
$this->url(
|
||||
"/-/readiness?token=" .
|
||||
$this->config->health_apikey .
|
||||
"&all=1"
|
||||
)
|
||||
);
|
||||
echo $test->status;
|
||||
} else {
|
||||
echo "Health API key missing!";
|
||||
}
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$status = "inactive";
|
||||
$data = [];
|
||||
|
||||
if (!empty($this->config->health_apikey)) {
|
||||
$res1 = parent::execute(
|
||||
$this->url(
|
||||
"/-/readiness?token=" .
|
||||
$this->config->health_apikey .
|
||||
"&all=1"
|
||||
)
|
||||
);
|
||||
$details1 = json_decode($res1->getBody());
|
||||
if ($details1) {
|
||||
$data["status"] = $details1->status;
|
||||
$status = $details1->status;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($this->config->private_apikey)) {
|
||||
$call_header["headers"] = [
|
||||
"PRIVATE-TOKEN" => $this->config->private_apikey,
|
||||
];
|
||||
$res2 = parent::execute(
|
||||
$this->url("/api/v4/application/statistics"),
|
||||
$call_header
|
||||
);
|
||||
$details2 = json_decode($res2->getBody());
|
||||
if (
|
||||
$details2 &&
|
||||
isset($details2->projects) &&
|
||||
isset($details2->active_users)
|
||||
) {
|
||||
$data["count_projects"] = $details2->projects;
|
||||
$data["count_users"] = $details2->active_users;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getLiveStats($status, $data);
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url) . $endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
}
|
||||
10
heimdall/config/www/SupportedApps/GitLab/app.json
Executable file
10
heimdall/config/www/SupportedApps/GitLab/app.json
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "322f31631de66bcf71bd6c199b41606d516fe3f9",
|
||||
"name": "GitLab",
|
||||
"website": "https://gitlab.com",
|
||||
"license": "MIT License",
|
||||
"description": "From project planning and source code management to CI/CD and monitoring, GitLab is a single application for the entire DevOps lifecycle.",
|
||||
"enhanced": true,
|
||||
"tile_background": "dark",
|
||||
"icon": "gitlab.svg"
|
||||
}
|
||||
17
heimdall/config/www/SupportedApps/GitLab/config.blade.php
Executable file
17
heimdall/config/www/SupportedApps/GitLab/config.blade.php
Executable file
@@ -0,0 +1,17 @@
|
||||
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
|
||||
<h5>{{ __('app.apps.only_admin_account') }}</h5>
|
||||
<div class="items">
|
||||
<div class="input">
|
||||
<label>Health Token</label>
|
||||
<small>Admin Area » Monitoring » Health Check</small>
|
||||
{!! Form::text('config[health_apikey]', isset($item) ? $item->getconfig()->health_apikey : null, ['placeholder' => 'Health Token', 'data-config' => 'health_apikey', 'id' => 'health_apikey', 'class' => 'form-control config-item']) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label>Private API-Read Token</label>
|
||||
<small>User Settings » Access Tokens</small>
|
||||
{!! Form::text('config[private_apikey]', isset($item) ? $item->getconfig()->private_apikey : null, ['placeholder' => __('app.apps.apikey'), 'data-config' => 'private_apikey', 'id' => 'private_apikey', 'class' => 'form-control config-item']) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
BIN
heimdall/config/www/SupportedApps/GitLab/gitlab.png
Executable file
BIN
heimdall/config/www/SupportedApps/GitLab/gitlab.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
14
heimdall/config/www/SupportedApps/GitLab/livestats.blade.php
Executable file
14
heimdall/config/www/SupportedApps/GitLab/livestats.blade.php
Executable file
@@ -0,0 +1,14 @@
|
||||
<ul class="livestats">
|
||||
@isset($status)
|
||||
<li>
|
||||
<span class="title">Status</span>
|
||||
<strong>{!! $status !!}</strong>
|
||||
</li>
|
||||
@endisset
|
||||
@isset($count_projects)
|
||||
<li>
|
||||
<span class="title">Projects/<br />Users</span>
|
||||
<strong>{!! $count_projects !!} / {!! $count_users !!}</strong>
|
||||
</li>
|
||||
@endisset
|
||||
</ul>
|
||||
Reference in New Issue
Block a user