mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-10 15:12:01 -03:30
ncp-web: collapse sidebar menu when clicking in new sections
This commit is contained in:
parent
60314405d8
commit
eece4d08c9
@ -84,7 +84,7 @@
|
||||
echo <<<HTML
|
||||
<div id="first-run-wizard">
|
||||
<div class='dialog'>
|
||||
<br>
|
||||
<br><br>
|
||||
<h2 id="config-box-title">NextCloudPi First Run</h2>
|
||||
<p>Click to start the configuration wizard</p>
|
||||
<br>
|
||||
|
||||
@ -1193,11 +1193,17 @@ a#versionlink:hover {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
#first-run-wizard img {
|
||||
width: 70%;
|
||||
max-width: 210px;
|
||||
}
|
||||
|
||||
.dialog {
|
||||
display:block;
|
||||
background: white;
|
||||
position:relative;
|
||||
width:50%;
|
||||
max-width: 400px;
|
||||
top:25%;
|
||||
margin:0px auto;
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
var MINI = require('minified');
|
||||
var $ = MINI.$, $$ = MINI.$$, EE = MINI.EE;
|
||||
var selectedID = null;
|
||||
var confLock = false;
|
||||
var lock = false;
|
||||
|
||||
function errorMsg()
|
||||
{
|
||||
@ -27,8 +27,12 @@ function switch_to_section( name )
|
||||
selectedID = null;
|
||||
}
|
||||
|
||||
// slide menu
|
||||
var slide_menu_enabled = false;
|
||||
|
||||
function open_menu()
|
||||
{
|
||||
if ( !slide_menu_enabled ) return;
|
||||
if ( $('#app-navigation').get('$width') != '250px' )
|
||||
{
|
||||
$('#overlay').show();
|
||||
@ -39,6 +43,7 @@ function open_menu()
|
||||
|
||||
function close_menu()
|
||||
{
|
||||
if ( !slide_menu_enabled ) return;
|
||||
if ( $('#app-navigation').get('$width') == '250px' )
|
||||
{
|
||||
$('#app-navigation').animate( {$width: '0px'}, 150 );
|
||||
@ -47,6 +52,32 @@ function close_menu()
|
||||
}
|
||||
}
|
||||
|
||||
function hide_overlay(e) { $('#overlay').hide() }
|
||||
|
||||
function close_menu_on_click_out(e) { close_menu(); }
|
||||
|
||||
function enable_slide_menu()
|
||||
{
|
||||
if ( slide_menu_enabled ) return;
|
||||
$( '#app-navigation' ).set( { $width: '0px' } );
|
||||
$( '#app-navigation' ).set( { $position: 'absolute' } );
|
||||
$( '#app-navigation-toggle' ).on('click', open_menu );
|
||||
$( '#app-content' ).on('|click', close_menu_on_click_out );
|
||||
slide_menu_enabled = true;
|
||||
}
|
||||
|
||||
function disable_slide_menu()
|
||||
{
|
||||
if ( !slide_menu_enabled ) return;
|
||||
$.off( open_menu );
|
||||
$.off( close_menu );
|
||||
$.off( close_menu_on_click_out );
|
||||
$( '#app-navigation' ).set( { $width: '250px' } );
|
||||
$( '#app-navigation' ).set( { $position: 'unset' } );
|
||||
$('#overlay').hide();
|
||||
slide_menu_enabled = false;
|
||||
}
|
||||
|
||||
function set_sidebar_click_handlers()
|
||||
{
|
||||
// Show selected option configuration box
|
||||
@ -55,8 +86,8 @@ function set_sidebar_click_handlers()
|
||||
if ( selectedID == this.get( '.id' ) ) // already selected
|
||||
return;
|
||||
|
||||
if ( confLock ) return;
|
||||
confLock = true;
|
||||
if ( lock ) return;
|
||||
lock = true;
|
||||
|
||||
if ( window.innerWidth <= 768 )
|
||||
close_menu();
|
||||
@ -69,7 +100,7 @@ function set_sidebar_click_handlers()
|
||||
function success( result )
|
||||
{
|
||||
cfgreqReceive( result, that );
|
||||
confLock = false;
|
||||
lock = false;
|
||||
}).error( errorMsg );
|
||||
});
|
||||
}
|
||||
@ -138,7 +169,7 @@ $(function()
|
||||
// Launch selected script
|
||||
$( '#config-button' ).on('click', function(e)
|
||||
{
|
||||
confLock = true;
|
||||
lock = true;
|
||||
$('#details-box').hide( '' );
|
||||
$('#config-button').set('@disabled',true);
|
||||
$('#loading-gif').set( { $display: 'inline' } );
|
||||
@ -201,15 +232,15 @@ $(function()
|
||||
$( 'input' , '#config-box-wrapper' ).set('@disabled', null);
|
||||
$('#config-button').set('@disabled',null);
|
||||
$('#loading-gif').hide();
|
||||
confLock = false;
|
||||
lock = false;
|
||||
}).error( errorMsg );
|
||||
});
|
||||
|
||||
// Update notification
|
||||
$( '#notification' ).on('click', function(e)
|
||||
{
|
||||
if ( confLock ) return;
|
||||
confLock = true;
|
||||
if ( lock ) return;
|
||||
lock = true;
|
||||
|
||||
$( '#' + selectedID ).set('-active');
|
||||
|
||||
@ -220,7 +251,7 @@ $(function()
|
||||
function success( result )
|
||||
{
|
||||
cfgreqReceive( result, $( '#nc-update' ) );
|
||||
confLock = false;
|
||||
lock = false;
|
||||
}
|
||||
).error( errorMsg );
|
||||
|
||||
@ -229,34 +260,6 @@ $(function()
|
||||
} );
|
||||
|
||||
// slide menu
|
||||
var slide_menu_enabled = false;
|
||||
|
||||
function hide_overlay(e) { $('#overlay').hide() }
|
||||
|
||||
function close_menu_on_click_out(e) { close_menu(); }
|
||||
|
||||
function enable_slide_menu()
|
||||
{
|
||||
if ( slide_menu_enabled ) return;
|
||||
$( '#app-navigation' ).set( { $width: '0px' } );
|
||||
$( '#app-navigation' ).set( { $position: 'absolute' } );
|
||||
$( '#app-navigation-toggle' ).on('click', open_menu );
|
||||
$( '#app-content' ).on('|click', close_menu_on_click_out );
|
||||
slide_menu_enabled = true;
|
||||
}
|
||||
|
||||
function disable_slide_menu()
|
||||
{
|
||||
if ( !slide_menu_enabled ) return;
|
||||
$.off( open_menu );
|
||||
$.off( close_menu );
|
||||
$.off( close_menu_on_click_out );
|
||||
$( '#app-navigation' ).set( { $width: '250px' } );
|
||||
$( '#app-navigation' ).set( { $position: 'unset' } );
|
||||
$('#overlay').hide();
|
||||
slide_menu_enabled = false;
|
||||
}
|
||||
|
||||
if ( window.innerWidth <= 768 )
|
||||
enable_slide_menu();
|
||||
|
||||
@ -350,12 +353,16 @@ $(function()
|
||||
// dashboard button
|
||||
$( '#dashboard-btn' ).on('click', function(e)
|
||||
{
|
||||
if ( lock ) return;
|
||||
close_menu();
|
||||
switch_to_section( 'dashboard' );
|
||||
} );
|
||||
|
||||
// config button
|
||||
$( '#config-btn' ).on('click', function(e)
|
||||
{
|
||||
if ( lock ) return;
|
||||
close_menu();
|
||||
switch_to_section( 'nc-config' );
|
||||
} );
|
||||
} );
|
||||
|
||||
@ -23,6 +23,7 @@ a:hover, a:active, a:link {
|
||||
.ncp-tab-pane {
|
||||
display: table;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
.ncp-tab-pane p {
|
||||
text-align: center;
|
||||
|
||||
120
update.sh
120
update.sh
@ -121,103 +121,6 @@ done
|
||||
# not for image builds, only live updates
|
||||
[[ ! -f /.ncp-image ]] && {
|
||||
|
||||
# update ncp-backup
|
||||
cd "$CONFDIR" &>/dev/null
|
||||
install_script nc-backup.sh &>/dev/null
|
||||
cd - &>/dev/null
|
||||
|
||||
# randomize passwords for old images ( older than v0.46.30 )
|
||||
cat > /usr/lib/systemd/system/nc-provisioning.service <<'EOF'
|
||||
[Unit]
|
||||
Description=Randomize passwords on first boot
|
||||
Requires=network.target
|
||||
After=mysql.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/bash /usr/local/bin/ncp-provisioning.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable nc-provisioning
|
||||
|
||||
NEED_UPDATE=false
|
||||
|
||||
MAJOR=0 MINOR=46 PATCH=30
|
||||
|
||||
MAJ=$( grep -oP "\d+\.\d+\.\d+" /usr/local/etc/ncp-version | cut -d. -f1 )
|
||||
MIN=$( grep -oP "\d+\.\d+\.\d+" /usr/local/etc/ncp-version | cut -d. -f2 )
|
||||
PAT=$( grep -oP "\d+\.\d+\.\d+" /usr/local/etc/ncp-version | cut -d. -f3 )
|
||||
|
||||
if [ "$MAJOR" -gt "$MAJ" ]; then
|
||||
NEED_UPDATE=true
|
||||
elif [ "$MAJOR" -eq "$MAJ" ] && [ "$MINOR" -gt "$MIN" ]; then
|
||||
NEED_UPDATE=true
|
||||
elif [ "$MAJOR" -eq "$MAJ" ] && [ "$MINOR" -eq "$MIN" ] && [ "$PATCH" -gt "$PAT" ]; then
|
||||
NEED_UPDATE=true
|
||||
fi
|
||||
|
||||
[[ "$NEED_UPDATE" == "true" ]] && {
|
||||
REDISPASS="default"
|
||||
DBPASSWD="default"
|
||||
sed -i -E "s|^requirepass .*|requirepass $REDISPASS|" /etc/redis/redis.conf
|
||||
echo -e "[client]\npassword=$DBPASSWD" > /root/.my.cnf
|
||||
chmod 600 /root/.my.cnf
|
||||
systemctl start nc-provisioning
|
||||
}
|
||||
|
||||
# adjust services
|
||||
systemctl mask nfs-blkmap
|
||||
grep -q '^ACTIVE_=yes$' "$CONFDIR"/samba.sh || update-rc.d nmbd disable
|
||||
|
||||
# fix automount dependencies with other ncp-apps
|
||||
sed -i \
|
||||
's|^Before=.*|Before=mysqld.service dphys-swapfile.service fail2ban.service smbd.service nfs-server.service|' \
|
||||
/usr/lib/systemd/system/nc-automount.service
|
||||
|
||||
sed -i \
|
||||
's|^Before=.*|Before=nc-automount.service|' \
|
||||
/usr/lib/systemd/system/nc-automount-links.service
|
||||
|
||||
# adjust when other services start
|
||||
DBUNIT=/lib/systemd/system/mariadb.service
|
||||
F2BUNIT=/lib/systemd/system/fail2ban.service
|
||||
SWPUNIT=/etc/init.d/dphys-swapfile
|
||||
grep -q sleep "$DBUNIT" || sed -i "/^ExecStart=/iExecStartPre=/bin/sleep 10" "$DBUNIT"
|
||||
grep -q sleep "$F2BUNIT" || sed -i "/^ExecStart=/iExecStartPre=/bin/sleep 10" "$F2BUNIT"
|
||||
grep -q sleep "$SWPUNIT" || sed -i "/\<start)/asleep 30" "$SWPUNIT"
|
||||
|
||||
# disable ncp user login
|
||||
chsh -s /usr/sbin/nologin ncp
|
||||
|
||||
# remove old instance of ramlogs
|
||||
[[ -f /usr/lib/systemd/system/ramlogs.service ]] && {
|
||||
systemctl disable ramlogs
|
||||
rm -f /usr/lib/systemd/system/ramlogs.service /usr/local/bin/ramlog-dirs.sh
|
||||
}
|
||||
sed -i '/tmpfs \/var\/log.* in RAM$/d' /etc/fstab
|
||||
sed -i '/tmpfs \/tmp.* in RAM$/d' /etc/fstab
|
||||
|
||||
# update ramlogs with log2ram
|
||||
type log2ram &>/dev/null || {
|
||||
cd "$CONFDIR" &>/dev/null
|
||||
install_script nc-ramlogs.sh &>/dev/null
|
||||
grep -q '^ACTIVE_=yes$' "$CONFDIR"/nc-ramlogs.sh && \
|
||||
systemctl enable log2ram
|
||||
cd - &>/dev/null
|
||||
}
|
||||
|
||||
# update nc-backup-auto to use cron
|
||||
[[ -f /etc/systemd/system/nc-backup.timer ]] && {
|
||||
systemctl stop nc-backup.timer
|
||||
systemctl disable nc-backup.timer
|
||||
rm -f /etc/systemd/system/nc-backup.timer /etc/systemd/system/nc-backup.service
|
||||
cd "$CONFDIR" &>/dev/null
|
||||
grep -q '^ACTIVE_=yes$' "$CONFDIR"/nc-backup-auto.sh && \
|
||||
activate_script nc-backup-auto.sh
|
||||
cd - &>/dev/null
|
||||
}
|
||||
|
||||
# make sure the redis directory exists
|
||||
mkdir -p /var/log/redis
|
||||
chown redis /var/log/redis
|
||||
@ -271,29 +174,6 @@ EOF
|
||||
systemctl stop log2ram
|
||||
}
|
||||
|
||||
# add new virtual host for initial password setup
|
||||
cat > /etc/apache2/sites-available/ncp-activation.conf <<EOF
|
||||
<VirtualHost _default_:443>
|
||||
DocumentRoot /var/www/ncp-web/
|
||||
SSLEngine on
|
||||
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
|
||||
|
||||
</VirtualHost>
|
||||
<Directory /var/www/ncp-web/>
|
||||
<RequireAll>
|
||||
|
||||
<RequireAny>
|
||||
Require host localhost
|
||||
Require local
|
||||
Require ip 192.168
|
||||
Require ip 172
|
||||
Require ip 10
|
||||
</RequireAny>
|
||||
|
||||
</RequireAll>
|
||||
</Directory>
|
||||
EOF
|
||||
} # end - only live updates
|
||||
|
||||
exit 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user