11package io .nodelink .server ;
22
3+ import io .nodelink .server .app .data .BONE_LOCATION ;
4+ import io .nodelink .server .app .data .CLUSTER_LOCATION ;
35import io .nodelink .server .command .CommandDispatcher ;
46import io .nodelink .server .command .CommandLogics ;
57import io .nodelink .server .command .CommandRegistry ;
@@ -95,6 +97,7 @@ private void initTerminal() {
9597 String command = reader .readLine (prompt );
9698
9799 if (command == null || command .trim ().isEmpty ()) {
100+ terminal .writer ().println ("\n " );
98101 continue ;
99102 }
100103
@@ -103,11 +106,9 @@ private void initTerminal() {
103106
104107 if (!handled ) {
105108 terminal .writer ().println ("Commande inconnue : " + command );
106- terminal .writer ().println ("\n " );
107109 }
108110 } catch (Exception e ) {
109111 terminal .writer ().println ("Erreur : La commande '" + command + "' n'est pas reconnue." );
110- terminal .writer ().println ("\n " );
111112 }
112113
113114 terminal .writer ().flush ();
@@ -149,6 +150,43 @@ public void fullClearAndRefresh(Terminal terminal) {
149150 terminal .flush ();
150151 }
151152
153+ private void updateLocationDisplay () {
154+ Object value = NodeLink .getInstance ().getStoreData ().get (NodeLink .getInstance ().getStoreData ().WHICH_TYPE );
155+
156+ if (value == null ) {
157+ terminal .writer ().println (GREEN + " ● Type: " + RESET + "Not set..." );
158+ } else if ((boolean ) value ) {
159+ terminal .writer ().println (GREEN + " ● Type: " + RESET + "Cluster" );
160+ } else {
161+ terminal .writer ().println (GREEN + " ● Type: " + RESET + "Bone" );
162+ }
163+
164+ if (value != null && (boolean ) value ) {
165+ Object clusterLocationValue = NodeLink .getInstance ().getStoreData ().get (NodeLink .getInstance ().getStoreData ().CLUSTER_LOCATION );
166+ if (clusterLocationValue != null ) {
167+ CLUSTER_LOCATION clusterLocation = CLUSTER_LOCATION .valueOf (clusterLocationValue .toString ());
168+
169+ terminal .writer ().println (GREEN + " ● Cluster Region: " + RESET + clusterLocation .name () + " |" + " (" + "https://1." + clusterLocation .getLocation () + ".nodelinkapp.xyz" + ")" );
170+ } else {
171+ terminal .writer ().println (GREEN + " ● Cluster Region: " + RESET + "Not set..." );
172+ }
173+ } else if (value != null && !(boolean ) value ) {
174+ Object boneLocationValue = NodeLink .getInstance ().getStoreData ().get (NodeLink .getInstance ().getStoreData ().BONE_LOCATION );
175+ if (boneLocationValue != null ) {
176+ BONE_LOCATION boneLocation = BONE_LOCATION .valueOf (boneLocationValue .toString ());
177+
178+ terminal .writer ().println (GREEN + " ● Bone Location: " + RESET + boneLocation .name () + " |" + " (" + "https://1." + boneLocation .getLocation () + ".nodelinkapp.xyz" + ")" );
179+ } else {
180+ terminal .writer ().println (GREEN + " ● Bone Location: " + RESET + "Not set..." );
181+ }
182+ }
183+
184+ Object locationValue = NodeLink .getInstance ().getStoreData ().get (NodeLink .getInstance ().getStoreData ().CLUSTER_LOCATION );
185+
186+ terminal .writer ().flush ();
187+ }
188+
189+
152190 private void drawStaticInterface (Terminal terminal ) {
153191 terminal .puts (Capability .cursor_address , 0 , 0 );
154192
@@ -174,11 +212,8 @@ private void drawStaticInterface(Terminal terminal) {
174212 terminal .writer ().println (GREEN + " ● Status: " + RESET + YELLOW + PRODUCT + RESET );
175213 terminal .writer ().println (GREEN + " ● Version: " + RESET + Version .VERSION );
176214
177- // if ((boolean) NodeLink.getInstance().getStoreData().get(NodeLink.getInstance().getStoreData().WHICH_TYPE)) {
178- // terminal.writer().println(GREEN + " ● Region: " + RESET + "Cluster");
179- // } else {
180- // terminal.writer().println(GREEN + " ● LOCATION: " + RESET + "Bone");
181- // }
215+ updateLocationDisplay ();
216+
182217
183218 int currentLine = logoHeight + 4 ;
184219 for (int i = currentLine ; i < RESERVED_ROWS - 1 ; i ++) {
0 commit comments