-
-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added template for enhanced app. * Enhanced app implementation for GNS3. * Minified png image.
- Loading branch information
Showing
5 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php namespace App\SupportedApps\GNS3; | ||
|
||
class GNS3 extends \App\SupportedApps implements \App\EnhancedApps { | ||
Check failure on line 3 in GNS3/GNS3.php GitHub Actions / Lint Code Base
|
||
|
||
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() | ||
{ | ||
$test = parent::appTest($this->url('/v2/version'), ['auth' => [$this->config->username, $this->config->password]]); | ||
$details = json_decode($test->response); | ||
if ($details && isset($details->version)) { | ||
echo $test->status . "\nServer version: " . $details->version; | ||
} else { | ||
echo $test->status; | ||
} | ||
} | ||
|
||
public function livestats() | ||
{ | ||
$status = 'inactive'; | ||
$res = parent::execute($this->url('/v2/projects'), ['auth' => [$this->config->username, $this->config->password]]); | ||
$details = json_decode($res->getBody()); | ||
|
||
$data = []; | ||
$data["opened"] = 0; | ||
$data["closed"] = 0; | ||
|
||
foreach ($details as $project) { | ||
if ($project->status == "opened") { | ||
$data["opened"]++; | ||
} else { | ||
$data["closed"]++; | ||
} | ||
} | ||
|
||
return parent::getLiveStats($status, $data); | ||
|
||
} | ||
public function url($endpoint) | ||
{ | ||
$api_url = parent::normaliseurl($this->config->url, false).$endpoint; | ||
return $api_url; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"appid": "95493920561b1c745f4f6eafb1572a1e17c26cc9", | ||
"name": "GNS3", | ||
"website": "https://www.gns3.com/", | ||
"license": "GNU General Public License v3.0 or later", | ||
"description": "Build, Design and Test your network in a risk-free virtual environment and access the largest networking community to help. Whether you are studying for your first networking exam or building out a state-wide telecommunications network, GNS3 offers an easy way to design and build networks of any size without the need for hardware. And the best part is it's free!", | ||
"enhanced": true, | ||
"tile_background": "dark", | ||
"icon": "gns3.png" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2> | ||
<div class="items"> | ||
<div class="input"> | ||
<label>{{ strtoupper(__('app.url')) }}</label> | ||
{!! Form::text('config[override_url]', isset($item) ? $item->getconfig()->override_url : null, array('placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control')) !!} | ||
</div> | ||
<div class="input"> | ||
<label>{{ __('app.apps.username') }}</label> | ||
{!! Form::text('config[username]', isset($item) ? $item->getconfig()->username : null, array('placeholder' => __('app.apps.username'), 'data-config' => 'username', 'class' => 'form-control config-item')) !!} | ||
</div> | ||
<div class="input"> | ||
<label>{{ __('app.apps.password') }}</label> | ||
{!! Form::input('password', 'config[password]', '', ['placeholder' => __('app.apps.password'), 'data-config' => 'password', 'class' => 'form-control config-item']) !!} | ||
</div> | ||
<div class="input"> | ||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button> | ||
</div> | ||
</div> | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<ul class="livestats"> | ||
<li> | ||
<span class="title">Opened</span> | ||
<strong>{!! $opened !!}</strong> | ||
</li> | ||
<li> | ||
<span class="title">Closed</span> | ||
<strong>{!! $closed !!}</strong> | ||
</li> | ||
</ul> |