Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Commit

Permalink
add routes
Browse files Browse the repository at this point in the history
  • Loading branch information
mms-gianni committed Jun 18, 2020
1 parent 1194629 commit 529d76b
Showing 1 changed file with 94 additions and 3 deletions.
97 changes: 94 additions & 3 deletions routes/web.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Illuminate\Support\Facades\Route;
use Jenssegers\Mongodb\Query\Builder;

/*
|--------------------------------------------------------------------------
Expand All @@ -18,9 +19,99 @@
});

Route::get('/images', function () {
return view('images');

/*
$klustair_all = DB::collection('pods')
->get();
print_r($klustair_all);
$klustair_all = DB::collection('pods')
->first();
print_r($klustair_all);
$klustair_namespace = DB::collection('pods')
->where('metadata.namespace', 'cms-search')
->first();
print_r($klustair_namespace);
$data['images'] = DB::collection('pods')
->select("metadata.namespace","containers.image")
->get();
print_r($data);
*/
$data['pods'] = DB::collection('pods')
->distinct("metadata.name")
->get();

$data['images'] = DB::collection('pods')
->distinct("containers.0.image")
->get();

$data['reports'] = DB::collection('pods')
->distinct("checktime")
->get();


return view('images', $data);
});

Route::get('/reports', function () {
return view('reports');
Route::get('/latestreport', function () {

$data['checktime'] = DB::collection('pods')
->distinct("checktime")
->first();
$data['pods'] = DB::collection('pods')
//->select("metadata.namespace","containers.image")
->where('checktime', $data['checktime'])
->get();
//->first();
//print_r($data);

$vulnseverity = array(
"High" => 'bg-danger text-white',
"Critical" => 'bg-warning text-dark',
"Medium" => 'bg-info text-white',
"Low" => 'bg-secondary text-white',
"Negligible" => 'bg-dark text-white',
"Unknown" => 'bg-white text-dark'
);

$error = array(
"danger",
"success",
);

$data['vulnseverity'] = $vulnseverity;
$data['error'] = $error;

return view('reports', $data);
});



Route::get('/pod/{podid}', function ($podid) {

$vulnseverity = array(
"High" => 'bg-danger text-white',
"Critical" => 'bg-warning text-dark',
"Medium" => 'bg-info text-white',
"Low" => 'bg-secondary text-white',
"Negligible" => 'bg-dark text-white',
"Unknown" => 'bg-white text-dark'
);

$error = array(
"danger",
"success",
);

$data['vulnseverity'] = $vulnseverity;
$data['error'] = $error;

$data['pod'] = DB::collection('pods')
->where('metadata.uid', $podid)
->first();
$data['podid'] = $podid;
return view('pod', $data);
});

0 comments on commit 529d76b

Please sign in to comment.