1
|
|
|
/* |
2
|
|
|
* MikoPBX - free phone system for small business |
3
|
|
|
* Copyright © 2017-2023 Alexey Portnov and Nikolay Beketov |
4
|
|
|
* |
5
|
|
|
* This program is free software: you can redistribute it and/or modify |
6
|
|
|
* it under the terms of the GNU General Public License as published by |
7
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
8
|
|
|
* (at your option) any later version. |
9
|
|
|
* |
10
|
|
|
* This program is distributed in the hope that it will be useful, |
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
|
|
|
* GNU General Public License for more details. |
14
|
|
|
* |
15
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
16
|
|
|
* If not, see <https://www.gnu.org/licenses/>. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
/* global PbxApi */ |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Object responsible for handling system restart and shutdown. |
23
|
|
|
* |
24
|
|
|
* @module restart |
25
|
|
|
*/ |
26
|
|
|
const restart = { |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Initializes the restart object by attaching event listeners to the restart and shutdown buttons. |
30
|
|
|
*/ |
31
|
|
|
initialize() { |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Event listener for the restart button click event. |
35
|
|
|
* @param {Event} e - The click event. |
36
|
|
|
*/ |
37
|
|
|
$('#restart-button').on('click', (e) => { |
38
|
|
|
$(e.target).closest('button').addClass('loading'); |
39
|
|
|
PbxApi.SystemReboot(); |
40
|
|
|
}); |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Event listener for the shutdown button click event. |
44
|
|
|
* @param {Event} e - The click event. |
45
|
|
|
*/ |
46
|
|
|
$('#shutdown-button').on('click', (e) => { |
47
|
|
|
$(e.target).closest('button').addClass('loading'); |
48
|
|
|
PbxApi.SystemShutDown(); |
49
|
|
|
}); |
50
|
|
|
}, |
51
|
|
|
}; |
52
|
|
|
|
53
|
|
|
// When the document is ready, initialize the reboot shutDown form |
54
|
|
|
$(document).ready(() => { |
55
|
|
|
restart.initialize(); |
56
|
|
|
}); |
57
|
|
|
|
58
|
|
|
|