-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Migrate and fix member graphs view
- Loading branch information
Showing
6 changed files
with
274 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,82 @@ | ||
<?php | ||
/* | ||
* Copyright (C) 2009-2017 Internet Neutral Exchange Association Company Limited By Guarantee. | ||
* All Rights Reserved. | ||
* | ||
* This file is part of IXP Manager. | ||
* | ||
* IXP Manager is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
* Software Foundation, version v2.0 of the License. | ||
* | ||
* IXP Manager is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License v2.0 | ||
* along with IXP Manager. If not, see: | ||
* | ||
* http://www.gnu.org/licenses/gpl-2.0.html | ||
*/ | ||
|
||
namespace IXP\Http\Controllers; | ||
|
||
use App, D2EM; | ||
|
||
use IXP\Services\Grapher\Graph; | ||
|
||
use Illuminate\View\View; | ||
use Illuminate\Support\Facades\Cache; | ||
|
||
use Entities\{ | ||
Customer as CustomerEntity, | ||
Vlan as VlanEntity | ||
}; | ||
|
||
/** | ||
* Statistics Controller | ||
* @author Barry O'Donovan <barry@islandbridgenetworks.ie> | ||
* @category Statistics | ||
* @copyright Copyright (C) 2009-2017 Internet Neutral Exchange Association Company Limited By Guarantee | ||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL V2.0 | ||
*/ | ||
class StatisticsController extends Controller | ||
{ | ||
|
||
/** | ||
* Display all member graphs | ||
* | ||
* @return View | ||
*/ | ||
public function members() : View { | ||
|
||
// $this->setIXP(); | ||
// $this->setInfrastructure(); | ||
// $this->setCategory(); | ||
// $category = $this->setCategory(); | ||
// $period = $this->setPeriod(); | ||
|
||
$grapher = App::make('IXP\Services\Grapher'); | ||
|
||
$custs = D2EM::getRepository( CustomerEntity::class )->getCurrentActive( false, true, false ); | ||
|
||
// if( $this->infra instanceof Entities\Infrastructure ) { | ||
// $custs = $this->getD2R( 'Entities\Customer')->filterForInfrastructure( $custs, $this->infra ); | ||
// } | ||
|
||
$graphs = []; | ||
|
||
foreach( $custs as $c ) { | ||
$graphs[] = $grapher->customer( $c ) | ||
->setType( Graph::TYPE_PNG ) | ||
->setProtocol( Graph::PROTOCOL_ALL ) | ||
->setCategory( Graph::CATEGORY_BITS ) | ||
->setPeriod( Graph::PERIOD_DAY ); | ||
} | ||
|
||
return view( 'statistics/members' )->with([ | ||
'graphs' => $graphs, | ||
]); | ||
} | ||
} |
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
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,61 @@ | ||
<?php | ||
/** @var Foil\Template\Template $t */ | ||
|
||
$this->layout( 'layouts/ixpv4' ) | ||
?> | ||
|
||
<?php $this->section( 'title' ) ?> | ||
Home / Statistics / Graphs ( Bits / Day ) | ||
<?php $this->append() ?> | ||
|
||
<?php $this->section( 'page-header-postamble' ) ?> | ||
<li> | ||
Home / Statistics / Graphs ( Bits / Day ) | ||
</li> | ||
|
||
<span class="pull-right"> | ||
<div class="btn-group btn-group-xs" role="group"> | ||
<a type="button" class="btn btn-default" id="add-l2a"> | ||
<span class="glyphicon glyphicon-plus"></span> | ||
</a> | ||
</div> | ||
</span> | ||
<?php $this->append() ?> | ||
|
||
|
||
<?php $this->section( 'content' ) ?> | ||
|
||
<div class="row-fluid"> | ||
|
||
<?php | ||
foreach( $t->graphs as $graph ): ?> | ||
|
||
<div class="col-md-12 col-lg-4"> | ||
|
||
<div class="well"> | ||
<h4 style="vertical-align: middle"> | ||
<?= $graph->customer()->getFormattedName() ?> | ||
<?php if( config('grapher.backends.sflow.enabled') /* && ( $category == 'bits' || $category == 'pkts' ) */ ): ?> | ||
<span class="btn btn-mini" style="float: right"> | ||
<?php /* {genUrl controller="statistics" action="p2p" shortname=$graph->customer()->getShortname() category=$category period=$period} */ ?> | ||
<a href="#"><i class="icon-random"></i></a> | ||
</span> | ||
<?php endif; ?> | ||
</h4> | ||
|
||
<p> | ||
<br /> | ||
<?= $graph->renderer()->boxLegacy() ?> | ||
</p> | ||
</div> | ||
|
||
</div> | ||
|
||
<?php endforeach; ?> | ||
|
||
</div> | ||
|
||
<?php $this->append() ?> | ||
|
||
<?php $this->section( 'scripts' ) ?> | ||
<?php $this->append() ?> |
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
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