ncp-web: added nc-config and helper buttons

This commit is contained in:
nachoparker 2018-04-03 17:47:56 +02:00
parent d133c73526
commit 30da787f91
9 changed files with 202 additions and 28 deletions

View File

@ -50,7 +50,7 @@ echo "HTTPD service|$( pgrep -c apache2 &>/dev/null && echo up || echo down )"
echo "PHP service|$( pgrep -c php-fpm &>/dev/null && echo up || echo down )"
echo "MariaDB service|$( pgrep -c mysqld &>/dev/null && echo up || echo down )"
echo "Redis service|$( pgrep -c redis-server &>/dev/null && echo up || echo down )"
echo "Postfix service|$( postfix status &>/dev/null && echo up || echo down )"
echo "Postfix service|$( pgrep -fc postfix &>/dev/null && echo up || echo down )"
# WAN
echo "internet check|$( ping -W 2 -w 1 -q github.com &>/dev/null && echo ok || echo no } )"

View File

@ -1,7 +1,11 @@
[v0.53.10](https://github.com/nextcloud/nextcloudpi/commit/dce58cc) (2018-04-03) ncp-web: implement dashboard
[v0.53.12](https://github.com/nextcloud/nextcloudpi/commit/4e597b9) (2018-04-03) ncp-web: added nc-config and helper buttons
[v0.53.9](https://github.com/nextcloud/nextcloudpi/commit/486d6ef) (2018-04-02) SSH: stop service upon activation
[v0.53.11](https://github.com/nextcloud/nextcloudpi/commit/42adfb3) (2018-04-03) ncp-web: fix glitch showing power dialog
[v0.53.10](https://github.com/nextcloud/nextcloudpi/commit/96a8c73) (2018-04-03) ncp-web: implement dashboard
[v0.53.9 ](https://github.com/nextcloud/nextcloudpi/commit/486d6ef) (2018-04-02) SSH: stop service upon activation
[v0.53.8 ](https://github.com/nextcloud/nextcloudpi/commit/afd2c8e) (2018-04-02) ncp-web: fix update notification

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="16"
width="16"
version="1"
id="svg6"
sodipodi:docname="info-white.svg"
inkscape:version="0.92.2 2405546, 2018-03-11">
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs10" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1096"
inkscape:window-height="729"
id="namedview8"
showgrid="false"
inkscape:zoom="14.75"
inkscape:cx="-3.7966102"
inkscape:cy="8"
inkscape:window-x="532"
inkscape:window-y="80"
inkscape:window-maximized="0"
inkscape:current-layer="svg6" />
<path
color="#000"
fill="none"
d="M-62.897-32.993h163.31v97.986h-163.31z"
id="path2" />
<path
opacity=".5"
d="M5 7.474c.155.382.325.69.644.246.407-.268 1.76-1.427 1.662-.342-.368 2.017-.834 4.017-1.17 6.04-.393 1.114.634 2.067 1.637 1.31 1.078-.502 1.99-1.287 2.927-2.01-.144-.323-.25-.79-.596-.347-.468.24-1.47 1.318-1.696.472.315-2.18.975-4.295 1.365-6.462.397-1.005-.364-2.223-1.4-1.363C7.117 5.634 6.083 6.6 5 7.474zM9.46.005C8.15-.017 7.553 2.147 8.815 2.68c1.023.378 2.077-.714 1.79-1.75-.098-.542-.598-.97-1.147-.93z"
id="path4"
style="fill:#ffffff;opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

60
ncp-web/img/nc-button.svg Normal file
View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="10.552508"
width="11.494591"
viewBox="0 0 11.494592 10.552508"
version="1.1"
id="svg4"
sodipodi:docname="nc-button.svg"
inkscape:version="0.92.2 2405546, 2018-03-11">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1079"
id="namedview6"
showgrid="false"
inkscape:zoom="16.468745"
inkscape:cx="10.298683"
inkscape:cy="7.8646197"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg4"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<path
style="color:#000000;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;white-space:normal;isolation:auto;mix-blend-mode:normal;fill:#ffffff;stroke-width:0.20051436"
d="m 5.7771253,2.6695678 c -1.1930604,0 -2.1950308,0.8170956 -2.5010156,1.9159143 C 3.008824,3.9979751 2.4207154,3.5809055 1.7373625,3.5809055 0.80737701,3.5811059 0.04241471,4.3458676 0.04241471,5.2762543 c 0,0.9303867 0.7647617,1.6949475 1.69494779,1.6951485 0.6837539,0 1.271261,-0.4170702 1.5383461,-1.0045772 0.3057846,1.0986182 1.3083563,1.9161149 2.5014167,1.9161149 1.1866439,0 2.183601,-0.8080727 2.4960026,-1.8978682 0.2714965,0.5770803 0.8505818,0.9861295 1.525914,0.9865305 0.9303871,0 1.6955491,-0.7651623 1.6955491,-1.695549 0,-0.9303866 -0.765162,-1.6953488 -1.6953484,-1.6951483 -0.675733,0 -1.2552198,0.4090491 -1.5267168,0.9861294 C 7.9599245,3.4776403 6.9637692,2.6695678 5.7771253,2.6695678 Z m 0,0.9949521 a 1.6041148,1.6041148 0 0 1 1.612135,1.6117344 1.6041148,1.6041148 0 0 1 -1.612135,1.6117345 1.6041148,1.6041148 0 0 1 -1.611534,-1.6121354 1.6041148,1.6041148 0 0 1 1.611534,-1.611133 z M 1.7373625,4.5760581 A 0.69257657,0.69257657 0 0 1 2.4371576,5.2758534 0.69277707,0.69277707 0 0 1 1.7373625,5.9764505 0.69277707,0.69277707 0 0 1 1.0375674,5.2762543 0.69257657,0.69257657 0 0 1 1.7373625,4.5760581 Z m 8.0616794,0 A 0.69277707,0.69277707 0 0 1 10.499439,5.2758534 0.69277707,0.69277707 0 0 1 9.7992426,5.9764505 0.69277707,0.69277707 0 0 1 9.0992471,5.2762543 0.69257657,0.69257657 0 0 1 9.7990419,4.5760581 Z"
id="path2-6"
inkscape:connector-curvature="0" />
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1"><path d="M6.938 0A.43.43 0 0 0 6.5.438v1.25a5.818 5.818 0 0 0-1.53.656l-.907-.906a.436.436 0 0 0-.625 0l-1.5 1.5a.436.436 0 0 0 0 .624l.906.907c-.285.48-.514.976-.656 1.53H.938a.43.43 0 0 0-.438.438v2.125C.5 8.81.69 9 .938 9h1.25a5.82 5.82 0 0 0 .656 1.53l-.907.908a.436.436 0 0 0 0 .625l1.5 1.5c.176.176.45.176.625 0l.907-.907c.48.285.976.514 1.53.656v1.25c0 .25.19.438.437.438h2.125a.43.43 0 0 0 .438-.438v-1.25a5.82 5.82 0 0 0 1.53-.657l.907.907c.176.175.45.175.625 0l1.5-1.5a.436.436 0 0 0 0-.625l-.906-.906A5.79 5.79 0 0 0 13.812 9h1.25a.43.43 0 0 0 .438-.438V6.437A.43.43 0 0 0 15.062 6h-1.25a5.79 5.79 0 0 0-.656-1.532l.906-.906a.436.436 0 0 0 0-.625l-1.5-1.5a.436.436 0 0 0-.625 0l-.906.906a5.816 5.816 0 0 0-1.53-.656V.437A.43.43 0 0 0 9.063 0zM8 4.157a3.344 3.344 0 0 1 0 6.686 3.344 3.344 0 0 1 0-6.686z" display="block" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 927 B

View File

@ -100,8 +100,7 @@ HTML;
<header role="banner"><div id="header">
<div id="header-left">
<a href="https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/"
id="nextcloudpi" tabindex="1">
<a href="https://ownyourbits.com" id="nextcloudpi" target="_blank" tabindex="1">
<div class="logo-icon">
<h1 class="hidden-visually">NextCloudPi</h1>
</div>
@ -111,11 +110,18 @@ HTML;
</a>
</div>
<div id="header-right">
<div id="dashboard-btn">
<div id="expand">
<div class="icon-dashboard"></div>
<a href="https://ownyourbits.com" id="nextcloud-btn" target="_blank" tabindex="1">
<div id="nc-button">
<div id="expand">
<div class="icon-nc-white"></div>
</div>
</div>
</div>
</a>
<div id="dashboard-btn">
<div id="expand">
<div class="icon-dashboard"></div>
</div>
</div>
<?php
if ( file_exists( 'wizard' ) )
echo <<<HTML
@ -127,13 +133,25 @@ HTML;
</div>
</a>
HTML;
?>
<div id="poweroff">
<div id="expand">
<div class="icon-power-white"></div>
</div>
?>
<div id="config-btn">
<div id="expand">
<div class="icon-config"></div>
</div>
</div>
<a href="https://github.com/nextcloud/nextcloudpi/wiki" target="_blank" tabindex="1">
<div id="nc-button">
<div id="expand">
<div class="icon-nc-info"></div>
</div>
</div>
</a>
<div id="poweroff">
<div id="expand">
<div class="icon-power-white"></div>
</div>
</div>
</div>
</header>
<div id="content-wrapper">
@ -199,8 +217,19 @@ HTML;
<h2 class="text-title"><?php echo $l->__("System Info"); ?></h2>
<div id="dashboard-suggestions" class="table-wrapper"></div>
<div id="dashboard-table" class="outputbox table-wrapper"></div>
<div id="loading-info-gif"> <img src="img/loading-small.gif"> </div>
</div>
<div id="nc-config-wrapper" class="hidden">
<h2 class="text-title"><?php echo $l->__("Nextcloud configuration"); ?></h2>
<div id="nc-config-box" class="table-wrapper">
<?php
$config = file_get_contents( '/var/www/nextcloud/config/config.php' );
$config = str_replace( "\n", "<br>", $config );
echo "$config";
?>
</div>
</div>
<div id="loading-info-gif"> <img src="img/loading-small.gif"> </div>
</div>
<div id="poweroff-dialog" class='dialog primary hidden'>

View File

@ -190,10 +190,9 @@ else
// return JSON
echo '{ "token": "' . getCSRFToken() . '",'; // Get new token
echo ' "ref": " ' . $_POST['ref'] . '",';
echo ' "table": ' . json_encode( $table ) . ' , ';
echo ' "suggestions": ' . json_encode( $suggestions ) . ' , ';
echo ' "ret": "' . $ret . '" }';
echo ' "ret": "' . $ret . '" }';
}
}

View File

@ -1118,7 +1118,15 @@ select {
.icon-power-white {
background-image: url('img/poweroff.svg');
}
.icon-nc-white {
background-image: url('img/nc-button.svg');
}
.icon-nc-info {
background-image: url('img/info-white.svg');
}
.icon-config {
background-image: url('img/settings-white.svg');
}
.icon-reboot-white {
background-image: url('img/reboot.svg');
}
@ -1283,6 +1291,10 @@ a#versionlink:hover {
margin-bottom: 1em;
}
#nc-config-box {
color: gray;
}
.hidden {
display:none
}

View File

@ -17,6 +17,16 @@ function errorMsg()
$('#config-box').fill( "Something went wrong. Try refreshing the page" );
}
function switch_to_section( name )
{
$( '#config-wrapper' ).hide();
$( '#dashboard-wrapper' ).hide();
$( '#nc-config-wrapper' ).hide();
$( '#' + name + '-wrapper' ).show();
$( '#' + selectedID ).set('-active');
selectedID = null;
}
function cfgreqReceive( result )
{
var ret = $.parseJSON( result );
@ -24,12 +34,11 @@ function cfgreqReceive( result )
$('#csrf-token').set( { value: ret.token } );
$('#details-box' ).hide();
$('#dashboard-wrapper').hide();
$('#circle-retstatus').hide();
$('#config-box').ht( ret.output );
$('#config-box-title' ).fill( $( '#' + selectedID + '-desc' ).get( '.value' ) );
$('#config-box-info-txt' ).fill( $( '#' + selectedID + '-info' ).get( '.value' ) );
$('#config-wrapper').show();
switch_to_section( 'config' );
$('#config-box-wrapper').show();
$('#config-extra-info').set( { $display: 'inline-block' } );
$('#config-extra-info').up().set( '@href', 'https://github.com/nextcloud/nextcloudpi/wiki/Configuration-Reference#' + selectedID );
@ -78,11 +87,9 @@ $(function()
csrf_token: $( '#csrf-token' ).get( '.value' ) }).then(
function success( result )
{
cfgreqReceive( result );
selectedID = that.get('.id');
that.set( '+active' );
cfgreqReceive( result );
confLock = false;
}).error( errorMsg );
});
@ -300,7 +307,7 @@ $(function()
} );
// click to nextcloud button
$('#nextcloudpi').set( '@href', window.location.protocol + '//' + window.location.hostname );
$('#nextcloud-btn').set( '@href', window.location.protocol + '//' + window.location.hostname );
// load dashboard info
$.request('post', 'ncp-launcher.php', { action: 'info',
@ -319,10 +326,13 @@ $(function()
// dashboard button
$( '#dashboard-btn' ).on('click', function(e)
{
$( '#config-wrapper' ).hide();
$( '#dashboard-wrapper' ).show();
$( '#' + selectedID ).set('-active');
selectedID = null;
switch_to_section( 'dashboard' );
} );
// config button
$( '#config-btn' ).on('click', function(e)
{
switch_to_section( 'nc-config' );
} );
} );