File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ block content
25
25
ul.list-unstyled
26
26
- each gpu in machine .gpus
27
27
li= gpu
28
+ h2 Capacity
29
+ button.btn.btn-warning.reset ( type ="button" ) Reset Capacity
28
30
h2 Projects
29
31
ul.list-unstyled
30
32
- each project in projects
@@ -37,6 +39,29 @@ block scripts
37
39
var ws = null ; // WebSocket
38
40
var $status = $ (" #machine-status" ); // Machine status icon
39
41
42
+ // Reset machine capacity
43
+ $ (" button.reset" ).on (" click" , function () {
44
+ var $el = $ (this );
45
+ var id = $el .data (" id" );
46
+
47
+ var confirmReset = confirm (" Are you sure you want to reset this machine's capacity?" );
48
+ if (confirmReset) {
49
+ // Reset capacity
50
+ $ .ajax ({
51
+ url: " #{machine.address}/capacity/reset" ,
52
+ type: " POST"
53
+ })
54
+ .then (function () {
55
+ alert (" Capacity successfully reset." );
56
+ })
57
+ .catch (function (err ) {
58
+ alert (err .statusText );
59
+ });
60
+ }
61
+ return false ; // Stop event and propagation
62
+ });
63
+
64
+
40
65
// Connects to WebSocket server
41
66
var wsConnect = function () {
42
67
ws = new WebSocket (host); // Attempt to connect
You can’t perform that action at this time.
0 commit comments