Skip to content

Commit 2a04eef

Browse files
committed
improvements in upgrade menu information. Made it always visible
1 parent ea34791 commit 2a04eef

6 files changed

Lines changed: 63 additions & 33 deletions

File tree

src/Controllers/InstallController.php

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,28 +78,43 @@ public function index()
7878
}
7979

8080
return view('panichd::install.index', compact('inactive_migrations', 'previous_ticketit', 'quickstart'));
81-
}else{
82-
$inactive_settings = $this->inactiveSettings();
83-
84-
if($inactive_settings and count($inactive_settings) > 0){
85-
// Panic Help Desk requires an upgrade
86-
if (Member::isAdmin()){
87-
return view('panichd::install.upgrade', compact('inactive_migrations', 'inactive_settings'));
88-
}else{
89-
return view('panichd::install.status', [
90-
'title' => trans('panichd::install.package-requires-update'),
91-
'description' => trans('panichd::install.package-requires-update-info'),
92-
]);
93-
}
94-
81+
}elseif(!$this->isUpdated()){
82+
// Panic Help Desk requires an upgrade
83+
if (Member::isAdmin()){
84+
return view('panichd::install.upgrade', [
85+
'inactive_migrations' => $inactive_migrations,
86+
'inactive_settings' => $this->inactiveSettings(),
87+
'isUpdated' => false
88+
]);
9589
}else{
96-
// Panic Help Desk installed and configured. Go to stats page
97-
return redirect()->route('dashboard');
90+
return view('panichd::install.status', [
91+
'title' => trans('panichd::install.package-requires-update'),
92+
'description' => trans('panichd::install.package-requires-update-info'),
93+
]);
9894
}
95+
}else{
96+
// Panic Help Desk installed and up to date. Go to stats page
97+
return redirect()->route('dashboard');
9998
}
10099
}
101100
}
102101

102+
/**
103+
* Displays the upgrade menu although there isn't any pending action
104+
*/
105+
public function upgrade_menu()
106+
{
107+
if (!$this->isInstalled() or !Member::isAdmin()){
108+
return redirect()->route('panichd.install.setup');
109+
}
110+
111+
return view('panichd::install.upgrade', [
112+
'inactive_migrations' => $this->inactiveMigrations(),
113+
'inactive_settings' => $this->inactiveSettings(),
114+
'isUpdated' => $this->isUpdated()
115+
]);
116+
}
117+
103118
/**
104119
* Check if PanicHD is installed
105120
*

src/PanicHDServiceProvider.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ public function boot()
4949
'middleware' => $authMiddleware,
5050
'as' => 'panichd.install.setup',
5151
'uses' => 'PanicHD\PanicHD\Controllers\InstallController@setup',
52-
]);
52+
]);
53+
54+
Route::get('/panichd/upgrade', [
55+
'middleware' => $authMiddleware,
56+
'as' => 'panichd.install.upgrade_menu',
57+
'uses' => 'PanicHD\PanicHD\Controllers\InstallController@upgrade_menu',
58+
]);
5359

5460
Route::post('/panichd/upgrade', [
5561
'middleware' => $authMiddleware,

src/Translations/ca/install.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@
3535
'package-requires-update' => 'Panic Help Desk requereix <b>configurar una actualització</b>',
3636
'package-requires-update-info' => 'L\'Administrador ha instal·lat una actualització de Panic Help Desk però no ha acabat de configurar-la. Si us plau espera que el procés hagi acabat',
3737

38+
'status-updated' => 'La llibreria està actualitzada i <b>En línia</b> ara mateix',
3839
'status-out-of-date' => '<b>Estat actual: Fora de línia</b> fins que s\'instal·li la darrera actualització',
3940
'about-to-update' => 'Aquest és el <b>menú d\'actualització</b> de Panic Help Desk',
4041
'about-to-update-description' => 'Un cop facis clic al botó "Actualitzar ara", es farà els següents canvis:',
41-
'all-tables-migrated' => 'No hi ha actualitzacions pendents de la base de dades així que no s\'executarà cap migració.',
42+
'all-tables-migrated' => 'Totes les modificacions de la base de dades ja estan instal·lades. No es farà canvis.',
4243

4344
'optional-config' => 'Configuració opcional',
44-
'choose-public-folder-action' => 'Has fet modificacions als fitxers del directori "public/vendor/panichd"? Vols fer-ne una còpia de seguretat?',
45-
'public-folder-destroy' => 'No (Opció recomanada)',
46-
'public-folder-backup' => 'Si. Fer còpia de seguretat del directori abans de copiar els fitxers nous',
45+
'choose-public-folder-action' => 'Vols fer una còpia de seguretat del directori "public/vendor/panichd" abans de reinstal·lar-lo? (Necessari només si has fet modificacions als fitxers que hi ha)',
46+
'public-folder-destroy' => 'No',
47+
'public-folder-backup' => 'Si (Es crearà una còpia de seguretat a "public/vendor")',
4748

4849
'upgrade-now' => 'Actualitzar ara!',
4950

@@ -59,5 +60,6 @@
5960
'another-file' => 'un altre arxiu',
6061
'upgrade' => 'Actualització de la versió de Panic Help Desk',
6162
'settings-to-be-installed' => 'S\'instal·laran aquests ajustos:',
62-
'all-settings-installed' => 'Tots els ajustos necessaris estan instal·lats',
63+
'all-settings-installed' => 'Ja hi ha registrats tots els paràmetres de configuració. No es farà canvis',
64+
'public-folder-will-be-replaced' => '<b>S\'eliminarà i es reinstal·larà</b> el contingut del directori public/vendor/panichd',
6365
];

src/Translations/en/install.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,31 @@
3535
'package-requires-update' => 'Panic Help Desk requires to <b>configure an upgrade</b>',
3636
'package-requires-update-info' => 'The administrator has installed a Panic Help Desk upgrade but has not finished configuring it. Please wait until the process has ended',
3737

38+
'status-updated' => 'The package is up to date and <b>Online</b> right now',
3839
'status-out-of-date' => '<b>Current status: Offline</b> until the the upgrade is configured',
39-
'about-to-update' => 'This is the Panic Help Desk <b>upgrade menu</b>',
40+
'about-to-update' => 'Upgrade menu',
4041
'about-to-update-description' => 'Once you click on the "Upgrade now" button, the following changes are going to be done:',
41-
'all-tables-migrated' => 'There are no pending database updates, so no migration will be executed',
42+
'all-tables-migrated' => 'All database modifications are already installed. No changes to do here',
4243

4344
'optional-config' => 'Optional configuration',
44-
'choose-public-folder-action' => 'Have you done any modifications to the files at Laravel\'s "public/vendor/panichd" folder? Do you want to backup it?',
45-
'public-folder-destroy' => 'No (Recommended option)',
46-
'public-folder-backup' => 'Yes. Make a directory backup before copying the new files',
45+
'choose-public-folder-action' => 'Do you want to backup "public/vendor/panichd" folder before it is reinstalled? (Needed if you have you done any modifications on it\'s files)',
46+
'public-folder-destroy' => 'No',
47+
'public-folder-backup' => 'Yes (A backup folder will be created inside "public/vendor")',
4748

4849
'upgrade-now' => 'Upgrade now!',
4950

5051
'upgrade-done' => 'The upgrade has finished correctly',
5152

52-
'pending-settings' => 'There are still some <b>configurations pending</b>',
53+
'pending-settings' => 'There are still some <b>configurations pending</b>',
5354
'pending-settings-description' => 'Before you can add new tickets, you must ensure that you have at least one status, priority, category and an agent assigned to it.',
5455

5556
'master-template-file' => 'Master template file',
5657
'master-template-other-path' => 'Other path to the master template file',
5758
'master-template-other-path-ex' => 'ex. views/layouts/app.blade.php',
5859
'migrations-to-be-installed' => 'These migrations will be installed:',
5960
'another-file' => 'another File',
60-
'upgrade' => 'Panic Help Desk version upgrade', // New v0.2.3
61-
'settings-to-be-installed' => 'These settings will be installed:', // New v0.2.3
62-
'all-settings-installed' => 'All needed settings are installed', // New v0.2.3
61+
'upgrade' => 'Panic Help Desk version upgrade',
62+
'settings-to-be-installed' => 'These settings will be installed:',
63+
'all-settings-installed' => 'All needed configuration settings are registered. No changes to do here',
64+
'public-folder-will-be-replaced' => 'The public/vendor/panichd folder content will be <b>deleted and reinstalled</b>',
6365
];

src/Views/install/partials/html.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<div class="page-header" style="margin: 20px 0px 10px 0px;">
2525
<div class="row">
2626
<div class="col-md-6 col-sm-5"><h1>{{ trans('panichd::install.main-title') }}</h1></div>
27-
<div class="col-md-6 col-sm-7"><div class="text-warning pull-right" style="margin: 2em 0em 0em 0em;">@yield('current_status')</div></div>
27+
<div class="col-md-6 col-sm-7"><div class="pull-right" style="margin: 2em 0em 0em 0em;">@yield('current_status')</div></div>
2828
</div>
2929

3030
</div>

src/Views/install/upgrade.blade.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
@extends('panichd::install.partials.html')
22

33
@section('current_status')
4-
<span class="glyphicon glyphicon-alert" style="font-size: 1.5em; padding: 0em 0.5em 0em 0em;"></span>{!! trans('panichd::install.status-out-of-date') !!}
4+
@if ($isUpdated)
5+
<span class="text-success"><span class="glyphicon glyphicon-ok" style="font-size: 1.5em; padding: 0em 0.5em 0em 0em;"></span>{!! trans('panichd::install.status-updated') !!}</span>
6+
@else
7+
<span class="text-warning"><span class="glyphicon glyphicon-alert" style="font-size: 1.5em; padding: 0em 0.5em 0em 0em;"></span>{!! trans('panichd::install.status-out-of-date') !!}</span>
8+
@endif
59
@stop
610

711
@section('content')
@@ -30,6 +34,7 @@
3034
@endforeach
3135
</ul>
3236
@endif
37+
<li>{!! trans('panichd::install.public-folder-will-be-replaced') !!}</li>
3338
</ol>
3439

3540
<form class="form-horizontal" action="{{url('/panichd/upgrade') }}" method="post">

0 commit comments

Comments
 (0)