Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
eole-wol
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
primtux-eole
Grenoble
eole-wol
Commits
a9e501aa
Verified
Commit
a9e501aa
authored
5 years ago
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
Actions and sortable table
parent
9e6f26d1
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
wol/scripts/wakeonlanservice.sh
+1
-1
1 addition, 1 deletion
wol/scripts/wakeonlanservice.sh
wol/www/index.php
+24
-15
24 additions, 15 deletions
wol/www/index.php
wol/www/stupidtable.min.js
+7
-0
7 additions, 0 deletions
wol/www/stupidtable.min.js
with
32 additions
and
16 deletions
wol/scripts/wakeonlanservice.sh
+
1
−
1
View file @
a9e501aa
...
@@ -45,7 +45,7 @@ do
...
@@ -45,7 +45,7 @@ do
break
break
fi
fi
done
done
elif
[
$MAC
==
"get
_r
egistry"
]
elif
[
$MAC
==
"get
R
egistry"
]
then
then
hostfile
=
"/etc/registry/hosts"
hostfile
=
"/etc/registry/hosts"
while
read
line
while
read
line
...
...
This diff is collapsed.
Click to expand it.
wol/www/index.php
+
24
−
15
View file @
a9e501aa
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
<meta
charset=
"utf-8"
>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<script
src=
"jquery-3.3.1.min.js"
></script>
<script
src=
"jquery-3.3.1.min.js"
></script>
<script
src=
"stupidtable.min.js"
></script>
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity=
"sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin=
"anonymous"
>
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity=
"sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin=
"anonymous"
>
</head>
</head>
...
@@ -33,7 +34,7 @@ error_reporting(E_ALL);
...
@@ -33,7 +34,7 @@ error_reporting(E_ALL);
extract
(
$_POST
);
extract
(
$_POST
);
if
(
!
isset
(
$action
)){
if
(
!
isset
(
$action
)){
exec
(
"../scripts/action.sh get
_r
egistry"
,
$lines
,
$code
);
exec
(
"../scripts/action
s
.sh get
R
egistry"
,
$lines
,
$code
);
?>
?>
<p>
<p>
<?php
<?php
...
@@ -61,19 +62,25 @@ if(!isset($action)){
...
@@ -61,19 +62,25 @@ if(!isset($action)){
<input
type=
"submit"
value=
"Télécharger le dernier log de mise à jour"
title=
"Télécharger le dernier log de mise à jour"
>
<input
type=
"submit"
value=
"Télécharger le dernier log de mise à jour"
title=
"Télécharger le dernier log de mise à jour"
>
</form>
</form>
<h2>
Gestion des postes
</h2>
<h2>
Gestion des postes
</h2>
<p>
Vous pouvez trier la table ci dessous en cliquant sur la colonne que vous voulez.
</p>
<div
class=
"table-responsive"
>
<div
class=
"table-responsive"
>
<table
class=
"table-striped table-bordered table-hover"
style=
"text-align:center;"
>
<table
class=
"table-striped table-bordered table-hover"
style=
"text-align:center;"
>
<thead>
<tr>
<tr>
<th
style=
"text-align:center;"
>
Nom
</th>
<th
style=
"text-align:center;"
data-sort=
"string"
data-sort-onload=
"yes"
>
Nom
</th>
<th
style=
"text-align:center;"
>
IP(s)
</th>
<th
style=
"text-align:center;"
data-sort=
"string"
>
IP(s)
</th>
<th
style=
"text-align:center;"
>
MAC
</th>
<th
style=
"text-align:center;"
data-sort=
"string"
>
MAC
</th>
<th
style=
"text-align:center;"
>
Version Debian
</th>
<th
style=
"text-align:center;"
data-sort=
"string"
>
Version Debian
</th>
<th
style=
"text-align:center;"
>
Version Primtux
</th>
<th
style=
"text-align:center;"
data-sort=
"string"
>
Version Primtux
</th>
<th
style=
"text-align:center;"
>
Mises
à
jour apt
en
attente
</th>
<th
style=
"text-align:center;"
data-sort=
"string"
>
Mises
à
jour apt
en
attente
</th>
<th
style=
"text-align:center;"
>
État
git
</th>
<th
style=
"text-align:center;"
data-sort=
"string"
>
État
git
</th>
<th
style=
"text-align:center;"
>
Date dernier contact
</th>
<th
style=
"text-align:center;"
data-sort=
"string"
>
Date dernier contact
</th>
<th
style=
"text-align:center;"
>
Actions
</th>
<th
style=
"text-align:center;"
>
Actions
</th>
</tr>
</tr>
</thead>
<tbody>
<?php
<?php
$registry
=
array
();
$registry
=
array
();
foreach
(
$lines
as
$line
){
foreach
(
$lines
as
$line
){
...
@@ -128,6 +135,7 @@ if(!isset($action)){
...
@@ -128,6 +135,7 @@ if(!isset($action)){
}
}
}
}
?>
?>
</tbody>
</table>
</table>
<!-- Script to add titles to each td -->
<!-- Script to add titles to each td -->
...
@@ -140,6 +148,8 @@ if(!isset($action)){
...
@@ -140,6 +148,8 @@ if(!isset($action)){
$
(
'
td
'
).
attr
(
'
title
'
,
function
(
index
,
attr
)
{
$
(
'
td
'
).
attr
(
'
title
'
,
function
(
index
,
attr
)
{
return
titles
[
$
(
this
).
index
()];
return
titles
[
$
(
this
).
index
()];
});
});
// Make table sortable
$
(
"
table
"
).
stupidtable
();
});
});
</script>
</script>
</div>
</div>
...
@@ -181,22 +191,21 @@ if(!isset($action)){
...
@@ -181,22 +191,21 @@ if(!isset($action)){
<?php
<?php
break
;
break
;
case
"upgradeAll"
:
case
"upgradeAll"
:
echo
"
I should
upgrade
A
ll machines
, not implemented yet
"
;
echo
"
Sending request to
upgrade
a
ll machines"
;
breaK
;
echo
"Todo see log"
;
case
"upgradeAllApt"
:
case
"upgradeAllApt"
:
echo
"I should upgradeAllApt machines, not implemented yet"
;
echo
"Sending request to upgrade all machines with apt"
;
breaK
;
case
"getLogAll"
:
case
"getLogAll"
:
echo
"I should download all logs, not implemented yet"
;
echo
"I should download all logs, not implemented yet"
;
exec
(
"../scripts/action.sh
$action
"
,
$lines
,
$code
);
break
;
break
;
case
"upgrade"
:
case
"upgrade"
:
echo
"I should upgrade
$mac
, not implemented yet"
;
echo
"I should upgrade
$mac
, not implemented yet"
;
break
;
case
"upgradeAPT"
:
case
"upgradeAPT"
:
echo
"I should upgrade
$mac
with apt, not implemented yet"
;
echo
"I should upgrade
$mac
with apt, not implemented yet"
;
break
;
case
"getLog"
:
case
"getLog"
:
echo
"I should download logs for
$mac
, not implemented yet"
;
echo
"I should download logs for
$mac
, not implemented yet"
;
exec
(
"../scripts/action.sh
$action
"
.
escapeshellarg
(
$mac
),
$lines
,
$code
);
break
;
break
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
wol/www/stupidtable.min.js
0 → 100644
+
7
−
0
View file @
a9e501aa
(
function
(
c
){
c
.
fn
.
stupidtable
=
function
(
a
){
return
this
.
each
(
function
(){
var
b
=
c
(
this
);
a
=
a
||
{};
a
=
c
.
extend
({},
c
.
fn
.
stupidtable
.
default_sort_fns
,
a
);
b
.
data
(
"
sortFns
"
,
a
);
b
.
stupidtable_build
();
b
.
on
(
"
click.stupidtable
"
,
"
thead th
"
,
function
(){
c
(
this
).
stupidsort
()});
b
.
find
(
"
th[data-sort-onload=yes]
"
).
eq
(
0
).
stupidsort
()})};
c
.
fn
.
stupidtable
.
default_settings
=
{
should_redraw
:
function
(
a
){
return
!
0
},
will_manually_build_table
:
!
1
};
c
.
fn
.
stupidtable
.
dir
=
{
ASC
:
"
asc
"
,
DESC
:
"
desc
"
};
c
.
fn
.
stupidtable
.
default_sort_fns
=
{
"
int
"
:
function
(
a
,
b
){
return
parseInt
(
a
,
10
)
-
parseInt
(
b
,
10
)},
"
float
"
:
function
(
a
,
b
){
return
parseFloat
(
a
)
-
parseFloat
(
b
)},
string
:
function
(
a
,
b
){
return
a
.
toString
().
localeCompare
(
b
.
toString
())},
"
string-ins
"
:
function
(
a
,
b
){
a
=
a
.
toString
().
toLocaleLowerCase
();
b
=
b
.
toString
().
toLocaleLowerCase
();
return
a
.
localeCompare
(
b
)}};
c
.
fn
.
stupidtable_settings
=
function
(
a
){
return
this
.
each
(
function
(){
var
b
=
c
(
this
),
f
=
c
.
extend
({},
c
.
fn
.
stupidtable
.
default_settings
,
a
);
b
.
stupidtable
.
settings
=
f
})};
c
.
fn
.
stupidsort
=
function
(
a
){
var
b
=
c
(
this
),
f
=
b
.
data
(
"
sort
"
)
||
null
;
if
(
null
!==
f
){
var
d
=
b
.
closest
(
"
table
"
),
e
=
{
$th
:
b
,
$table
:
d
,
datatype
:
f
};
d
.
stupidtable
.
settings
||
(
d
.
stupidtable
.
settings
=
c
.
extend
({},
c
.
fn
.
stupidtable
.
default_settings
));
e
.
compare_fn
=
d
.
data
(
"
sortFns
"
)[
f
];
e
.
th_index
=
h
(
e
);
e
.
sort_dir
=
k
(
a
,
e
);
b
.
data
(
"
sort-dir
"
,
e
.
sort_dir
);
d
.
trigger
(
"
beforetablesort
"
,{
column
:
e
.
th_index
,
direction
:
e
.
sort_dir
,
$th
:
b
});
d
.
css
(
"
display
"
);
setTimeout
(
function
(){
d
.
stupidtable
.
settings
.
will_manually_build_table
||
d
.
stupidtable_build
();
var
a
=
l
(
e
),
a
=
m
(
a
,
e
);
if
(
d
.
stupidtable
.
settings
.
should_redraw
(
e
)){
d
.
children
(
"
tbody
"
).
append
(
a
);
var
a
=
e
.
$table
,
c
=
e
.
$th
,
f
=
c
.
data
(
"
sort-dir
"
);
a
.
find
(
"
th
"
).
data
(
"
sort-dir
"
,
null
).
removeClass
(
"
sorting-desc sorting-asc
"
);
c
.
data
(
"
sort-dir
"
,
f
).
addClass
(
"
sorting-
"
+
f
);
d
.
trigger
(
"
aftertablesort
"
,{
column
:
e
.
th_index
,
direction
:
e
.
sort_dir
,
$th
:
b
});
d
.
css
(
"
display
"
)}},
10
);
return
b
}};
c
.
fn
.
updateSortVal
=
function
(
a
){
var
b
=
c
(
this
);
b
.
is
(
"
[data-sort-value]
"
)
&&
b
.
attr
(
"
data-sort-value
"
,
a
);
b
.
data
(
"
sort-value
"
,
a
);
return
b
};
c
.
fn
.
stupidtable_build
=
function
(){
return
this
.
each
(
function
(){
var
a
=
c
(
this
),
b
=
[];
a
.
children
(
"
tbody
"
).
children
(
"
tr
"
).
each
(
function
(
a
,
d
){
var
e
=
{
$tr
:
c
(
d
),
columns
:[],
index
:
a
};
c
(
d
).
children
(
"
td
"
).
each
(
function
(
a
,
b
){
var
d
=
c
(
b
).
data
(
"
sort-value
"
);
"
undefined
"
===
typeof
d
&&
(
d
=
c
(
b
).
text
(),
c
(
b
).
data
(
"
sort-value
"
,
d
));
e
.
columns
.
push
(
d
)});
b
.
push
(
e
)});
a
.
data
(
"
stupidsort_internaltable
"
,
b
)})};
var
l
=
function
(
a
){
var
b
=
a
.
$table
.
data
(
"
stupidsort_internaltable
"
),
f
=
a
.
th_index
,
d
=
a
.
$th
.
data
(
"
sort-multicolumn
"
),
d
=
d
?
d
.
split
(
"
,
"
):[],
e
=
c
.
map
(
d
,
function
(
b
,
d
){
var
c
=
a
.
$table
.
find
(
"
th
"
),
e
=
parseInt
(
b
,
10
),
f
;
e
||
0
===
e
?
f
=
c
.
eq
(
e
):(
f
=
c
.
siblings
(
"
#
"
+
b
),
e
=
c
.
index
(
f
));
return
{
index
:
e
,
$e
:
f
}});
b
.
sort
(
function
(
b
,
c
){
for
(
var
d
=
e
.
slice
(
0
),
g
=
a
.
compare_fn
(
b
.
columns
[
f
],
c
.
columns
[
f
]);
0
===
g
&&
d
.
length
;){
var
g
=
d
[
0
],
h
=
g
.
$e
.
data
(
"
sort
"
),
g
=
(
0
,
a
.
$table
.
data
(
"
sortFns
"
)[
h
])(
b
.
columns
[
g
.
index
],
c
.
columns
[
g
.
index
]);
d
.
shift
()}
return
0
===
g
?
b
.
index
-
c
.
index
:
g
});
a
.
sort_dir
!=
c
.
fn
.
stupidtable
.
dir
.
ASC
&&
b
.
reverse
();
return
b
},
m
=
function
(
a
,
b
){
var
f
=
c
.
map
(
a
,
function
(
a
,
c
){
return
[[
a
.
columns
[
b
.
th_index
],
a
.
$tr
,
c
]]});
b
.
column
=
f
;
return
c
.
map
(
a
,
function
(
a
){
return
a
.
$tr
})},
k
=
function
(
a
,
b
){
var
f
,
d
=
b
.
$th
,
e
=
c
.
fn
.
stupidtable
.
dir
;
a
?
f
=
a
:(
f
=
a
||
d
.
data
(
"
sort-default
"
)
||
e
.
ASC
,
d
.
data
(
"
sort-dir
"
)
&&
(
f
=
d
.
data
(
"
sort-dir
"
)
===
e
.
ASC
?
e
.
DESC
:
e
.
ASC
));
return
f
},
h
=
function
(
a
){
var
b
=
0
,
f
=
a
.
$th
.
index
();
a
.
$th
.
parents
(
"
tr
"
).
find
(
"
th
"
).
slice
(
0
,
f
).
each
(
function
(){
var
a
=
c
(
this
).
attr
(
"
colspan
"
)
||
1
;
b
+=
parseInt
(
a
,
10
)});
return
b
}})(
jQuery
);
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