Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Commits
2bd314c3
Commit
2bd314c3
authored
8 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
Interface zum auslesen der Statistik hinzugefügt
parent
21f39cd5
No related branches found
Branches containing commit
No related tags found
1 merge request
!1365
Resolve "Filter Options for MetaGer"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/Http/Controllers/AdminInterface.php
+33
-0
33 additions, 0 deletions
app/Http/Controllers/AdminInterface.php
app/Http/routes.php
+1
-0
1 addition, 0 deletions
app/Http/routes.php
resources/views/admin/engines.blade.php
+54
-0
54 additions, 0 deletions
resources/views/admin/engines.blade.php
with
88 additions
and
0 deletions
app/Http/Controllers/AdminInterface.php
+
33
−
0
View file @
2bd314c3
...
...
@@ -96,4 +96,37 @@ class AdminInterface extends Controller
->
with
(
'title'
,
'Wer sucht was? - MetaGer'
)
->
with
(
'q'
,
$q
);
}
public
function
engines
()
{
# Wir laden den Inhalt der Log Datei und übergeben ihn an den view
$file
=
"/var/log/metager/engine.log"
;
if
(
file_exists
(
$file
)
&&
is_readable
(
$file
))
{
$engineStats
=
file_get_contents
(
$file
);
# Daten vom JSON Format dekodieren
$engineStats
=
json_decode
(
$engineStats
,
true
);
# Eine Sortierung wäre nicht das verkehrteste
uasort
(
$engineStats
[
"recent"
],
function
(
$a
,
$b
)
{
if
(
$a
[
"requests"
]
==
$b
[
"requests"
])
{
return
0
;
}
return
(
$a
[
"requests"
]
<
$b
[
"requests"
])
?
1
:
-
1
;
});
uasort
(
$engineStats
[
"overall"
],
function
(
$a
,
$b
)
{
if
(
$a
[
"requests"
]
==
$b
[
"requests"
])
{
return
0
;
}
return
(
$a
[
"requests"
]
<
$b
[
"requests"
])
?
1
:
-
1
;
});
return
view
(
'admin.engines'
)
->
with
(
'engineStats'
,
$engineStats
)
->
with
(
'title'
,
"Suchmaschinenstatus - MetaGer"
);
}
else
{
return
redirect
(
url
(
'admin'
));
}
}
}
This diff is collapsed.
Click to expand it.
app/Http/routes.php
+
1
−
0
View file @
2bd314c3
...
...
@@ -144,6 +144,7 @@ Route::group(
Route
::
get
(
'admin'
,
'AdminInterface@index'
);
Route
::
get
(
'admin/count'
,
'AdminInterface@count'
);
Route
::
get
(
'admin/check'
,
'AdminInterface@check'
);
Route
::
get
(
'admin/engines'
,
'AdminInterface@engines'
);
Route
::
get
(
'settings'
,
'StartpageController@loadSettings'
);
...
...
This diff is collapsed.
Click to expand it.
resources/views/admin/engines.blade.php
0 → 100644
+
54
−
0
View file @
2bd314c3
@
extends
(
'layouts.subPages'
)
@
section
(
'title'
,
$title
)
@
section
(
'content'
)
<
h1
>
Suchmaschinenübersicht
</
h1
>
<
p
>
Diese
Übersicht
gibt
Aufschluss
darüber
,
welche
Suchmaschinen
wie
oft
abgefragt
wurden
und
zusätzlich
wie
oft
diese
innerhalb
unseres
Timeouts
geantwortet
haben
</
p
>
<
table
class
=
"table table-bordered"
>
<
caption
>
Daten
der
letzten
10
Minuten
</
caption
>
<
thead
>
<
tr
>
<
th
>
Name
</
th
>
<
th
>
Anzahl
der
gesamten
Abfragen
</
th
>
<
th
>
Davon
tatsächlich
beantwortet
</
th
>
<
th
>
Prozent
</
th
>
</
tr
>
</
thead
>
<
tbody
>
@
foreach
(
$engineStats
[
"recent"
]
as
$name
=>
$values
)
@
if
(
$values
[
"requests"
]
>
0
)
<
tr
@
if
(
$values
[
"requests"
]
===
$values
[
"answered"
])
class
=
"success"
@
else
class
=
"danger"
@
endif
>
<
td
>
{{
$name
}}
</
td
>
<
td
>
{{
$values
[
"requests"
]}}
</
td
>
<
td
>
{{
$values
[
"answered"
]}}
</
td
>
<
td
>
{{
floor
((
$values
[
"answered"
]
/
$values
[
"requests"
])
*
100
)
}}
%</
td
>
</
tr
>
@
endif
@
endforeach
</
tbody
>
</
table
>
<
table
class
=
"table table-bordered"
>
<
caption
>
Daten
insgesamt
</
caption
>
<
thead
>
<
tr
>
<
th
>
Name
</
th
>
<
th
>
Anzahl
der
gesamten
Abfragen
</
th
>
<
th
>
Davon
tatsächlich
beantwortet
</
th
>
<
th
>
Prozent
</
th
>
</
tr
>
</
thead
>
<
tbody
>
@
foreach
(
$engineStats
[
"overall"
]
as
$name
=>
$values
)
@
if
(
$values
[
"requests"
]
>
0
)
<
tr
@
if
(
$values
[
"requests"
]
===
$values
[
"answered"
])
class
=
"success"
@
else
class
=
"danger"
@
endif
>
<
td
>
{{
$name
}}
</
td
>
<
td
>
{{
$values
[
"requests"
]}}
</
td
>
<
td
>
{{
$values
[
"answered"
]}}
</
td
>
<
td
>
{{
floor
((
$values
[
"answered"
]
/
$values
[
"requests"
])
*
100
)
}}
%</
td
>
</
tr
>
@
endif
@
endforeach
</
tbody
>
</
table
>
@
endsection
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment