1
+ <main class="w-full flex-grow p-6">
2
+ <div class="py-3">
3
+ <main class="h-full overflow-y-auto">
4
+ <div class="container mx-auto grid">
5
+ <div class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-4">
6
+ <!-- Nodes start -->
7
+ <?php
8
+ $ nodes = \webinterface \main::buildDefaultRequest ("cluster " , "GET " );
9
+
10
+
11
+ foreach ($ nodes ['nodes ' ] as $ node ) { ?>
12
+
13
+ <div class="min-w-0 p-4 dark:bg-gray-800 bg-white rounded-lg shadow-lg border-t-4 border-green-600">
14
+ <div class="flex items-center justify-between">
15
+ <h4 class="mb-4 font-semibold text-blue-500"><?= $ node ['node ' ]['uniqueId ' ]; ?> </h4>
16
+ <!-- State Starting: bg-yellow-600 // State Stop: bg-red-600 -->
17
+ <?php if ($ node ['available ' ] == true ){ ?>
18
+ <span class="text-sm text-center text-white h-6 w-16 bg-green-600 rounded-full">Online</span>
19
+ <?php } else { ?>
20
+ <span class="text-sm text-center text-white h-6 w-16 bg-red-600 rounded-full">Offline</span>
21
+ <?php } ?>
22
+ </div>
23
+ <div class="flex">
24
+ <span class="text-gray-400">•</span>
25
+ <p class="flex-1 dark:text-white text-gray-900 items-center pl-2">Memory Usage: <?= $ node ['nodeInfoSnapshot ' ]['usedMemory ' ]; ?> MB/<?= $ node ['nodeInfoSnapshot ' ]['maxMemory ' ]; ?> MB<br></p>
26
+ </div>
27
+ <div class="flex">
28
+ <span class="text-gray-400">•</span>
29
+ <p class="flex-1 dark:text-white text-gray-900 items-center pl-2">CPU Usage: <?= min (round ($ node ['nodeInfoSnapshot ' ]['processSnapshot ' ]['cpuUsage ' ] * 100 ), 100 ); ?> %<br></p>
30
+ </div>
31
+ <div class="flex">
32
+ <span class="text-gray-400">•</span>
33
+ <p class="flex-1 dark:text-white text-gray-900 items-center pl-2">Version: <?= $ node ['nodeInfoSnapshot ' ]['version ' ] ?> <br></p>
34
+ </div>
35
+ <div class="flex">
36
+ <span class="text-gray-400">•</span>
37
+ <p class="flex-1 dark:text-white text-gray-900 items-center pl-2">Host: <?= $ node ['node ' ]['listeners ' ][0 ]['host ' ].": " .$ node ['node ' ]['listeners ' ][0 ]['port ' ]; ?> <br></p>
38
+ </div>
39
+ <div class="flex justify-center mt-4 space-x-3 text-sm text-white">
40
+ <div class="flex items-center">
41
+ <form method="post">
42
+ <input name="action" value="stopNode" type="hidden">
43
+ <input name="node_id" value="<?= $ node ['node ' ]['uniqueId ' ]; ?> " type="hidden">
44
+ <input name="csrf" value="<?= $ _SESSION ['cn3-wi-csrf ' ] ?> " type="hidden">
45
+
46
+ <button type="submit" class="h-10 bg-blue-500 text-white rounded-md px-4 py-2 m-2 hover:bg-blue-600 focus:outline-none focus:shadow-outline">Shutdown</button>
47
+ </form>
48
+ <form method="post">
49
+ <input name="action" value="deleteNode" type="hidden">
50
+ <input name="node_id" value="<?= $ node ['node ' ]['uniqueId ' ]; ?> " type="hidden">
51
+ <input name="csrf" value="<?= $ _SESSION ['cn3-wi-csrf ' ] ?> " type="hidden">
52
+
53
+ <button type="submit" class="h-10 bg-blue-500 text-white rounded-md px-4 py-2 m-2 hover:bg-blue-600 focus:outline-none focus:shadow-outline">Delete</button>
54
+ </form>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ <?php } ?>
59
+ <!-- Nodes end-->
60
+ </div>
61
+ </div>
62
+ </main>
63
+ </div>
64
+
65
+ <div class="py-3">
66
+ <main class="h-full overflow-y-auto">
67
+ <div class="container mx-auto grid">
68
+ <div class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-1">
69
+ <!-- Create Node -->
70
+ <div class="w-full">
71
+ <div class="coding inverse-toggle px-5 pt-4 shadow-lg text-gray-100 dark:bg-gray-800 bg-white pb-6 pt-4 rounded-lg leading-normal overflow-hidden">
72
+ <div class="top mb-2 flex">
73
+ <h4 class="mb-2 font-semibold dark:text-white text-gray-900">Create Node</h4>
74
+ </div>
75
+ <form method="post">
76
+ <input name="action" value="createNode" type="hidden">
77
+ <input name="csrf" value="<?= $ _SESSION ['cn3-wi-csrf ' ] ?> " type="hidden">
78
+
79
+ <div class="flex-1 flex flex-col md:flex-row text-sm font-mono subpixel-antialiased">
80
+ <div class="w-full flex-1 mx-2">
81
+ <input placeholder="Name" name="name" required class="my-2 p-2 dark:bg-gray-900 bg-gray-100 flex border dark:border-gray-900 border-gray-100 rounded px-2 appearance-none outline-none w-full dark:text-white text-gray-900 focus:ring-2 focus:ring-blue-600">
82
+ </div>
83
+ <div class="w-full flex-1 mx-2">
84
+ <input placeholder="Host" name="host" required class="my-2 p-2 dark:bg-gray-900 bg-gray-100 flex border dark:border-gray-900 border-gray-100 rounded px-2 appearance-none outline-none w-full dark:text-white text-gray-900 focus:ring-2 focus:ring-blue-600">
85
+ </div>
86
+ <div class="w-full flex-1 mx-2">
87
+ <input placeholder="Port" name="port" required class="my-2 p-2 dark:bg-gray-900 bg-gray-100 flex border dark:border-gray-900 border-gray-100 rounded px-2 appearance-none outline-none w-full dark:text-white text-gray-900 focus:ring-2 focus:ring-blue-600">
88
+ </div>
89
+ </div>
90
+ <button type="submit" class="h-10 bg-blue-500 text-white rounded-md px-4 py-2 m-2 hover:bg-blue-600 focus:outline-none focus:shadow-outline">Create</button>
91
+ </form>
92
+ </div>
93
+ </div>
94
+ </div>
95
+ </div>
96
+ </main>
97
+ </div>
98
+ </main>
0 commit comments