From 573e5fa6defc0ca8ef065f3f0dbe85a2fdfe1f01 Mon Sep 17 00:00:00 2001 From: Bogdan Tintor Date: Tue, 20 Aug 2024 14:21:13 +0200 Subject: [PATCH 1/6] CTX-6562: Implement coretex node status command. --- coretex/cli/commands/node.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/coretex/cli/commands/node.py b/coretex/cli/commands/node.py index f5b2dcdd..4fcbf93b 100644 --- a/coretex/cli/commands/node.py +++ b/coretex/cli/commands/node.py @@ -179,6 +179,13 @@ def config(advanced: bool) -> None: activateAutoUpdate() +@click.command() +def status() -> None: + status = getNodeStatus() + + ui.stdEcho(f"Current status of Node is {status.name}.") + + @click.group() @onBeforeCommandExecute(docker.isDockerAvailable) @onBeforeCommandExecute(initializeUserSession) @@ -192,3 +199,4 @@ def node() -> None: node.add_command(stop, "stop") node.add_command(update, "update") node.add_command(config, "config") +node.add_command(status, "status") From 30115cd812a7c562fedda457d5f4c196fe724ae1 Mon Sep 17 00:00:00 2001 From: Bogdan Tintor Date: Tue, 20 Aug 2024 14:22:05 +0200 Subject: [PATCH 2/6] CTX-6562: short way of implementation --- coretex/cli/commands/node.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/coretex/cli/commands/node.py b/coretex/cli/commands/node.py index 4fcbf93b..af318fd7 100644 --- a/coretex/cli/commands/node.py +++ b/coretex/cli/commands/node.py @@ -181,9 +181,7 @@ def config(advanced: bool) -> None: @click.command() def status() -> None: - status = getNodeStatus() - - ui.stdEcho(f"Current status of Node is {status.name}.") + ui.stdEcho(f"Current status of Node is {getNodeStatus().name}.") @click.group() From bd8eb98cf5e9e6522a8dbbcbac4571fd3cc7cea7 Mon Sep 17 00:00:00 2001 From: Bogdan Tintor Date: Tue, 20 Aug 2024 15:02:09 +0200 Subject: [PATCH 3/6] CTX-6562: Changes regarding discussions on PR. --- coretex/cli/commands/node.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/coretex/cli/commands/node.py b/coretex/cli/commands/node.py index af318fd7..7763c99b 100644 --- a/coretex/cli/commands/node.py +++ b/coretex/cli/commands/node.py @@ -181,7 +181,16 @@ def config(advanced: bool) -> None: @click.command() def status() -> None: - ui.stdEcho(f"Current status of Node is {getNodeStatus().name}.") + nodeStatus = getNodeStatus() + statusColors = { + 'inactive': ui.errorEcho, + 'active': ui.successEcho, + 'busy': ui.progressEcho, + 'reconnecting': ui.progressEcho + } + + echo = statusColors.get(nodeStatus.name, ui.stdEcho) + echo(f"Current status of Node is {nodeStatus.name}.") @click.group() From a0ca69d82d9ecda909d8a77297b471c1de6aa730 Mon Sep 17 00:00:00 2001 From: Bogdan Tintor Date: Tue, 20 Aug 2024 15:17:20 +0200 Subject: [PATCH 4/6] CTX-6562: busy should be blue color. --- coretex/cli/commands/node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coretex/cli/commands/node.py b/coretex/cli/commands/node.py index 7763c99b..51184878 100644 --- a/coretex/cli/commands/node.py +++ b/coretex/cli/commands/node.py @@ -185,7 +185,7 @@ def status() -> None: statusColors = { 'inactive': ui.errorEcho, 'active': ui.successEcho, - 'busy': ui.progressEcho, + 'busy': ui.stdEcho, 'reconnecting': ui.progressEcho } From d2439d0f0cba691cd614d81016b1a7d92689f5bf Mon Sep 17 00:00:00 2001 From: Bogdan Tintor Date: Tue, 20 Aug 2024 16:39:23 +0200 Subject: [PATCH 5/6] CTX-6562: Only string that represents the status should be of different color. --- coretex/cli/commands/node.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/coretex/cli/commands/node.py b/coretex/cli/commands/node.py index 51184878..bccb8223 100644 --- a/coretex/cli/commands/node.py +++ b/coretex/cli/commands/node.py @@ -183,14 +183,14 @@ def config(advanced: bool) -> None: def status() -> None: nodeStatus = getNodeStatus() statusColors = { - 'inactive': ui.errorEcho, - 'active': ui.successEcho, - 'busy': ui.stdEcho, - 'reconnecting': ui.progressEcho + 'inactive': 'red', + 'active': 'green', + 'busy': 'cyan', + 'reconnecting': 'yellow' } - echo = statusColors.get(nodeStatus.name, ui.stdEcho) - echo(f"Current status of Node is {nodeStatus.name}.") + statusEcho = click.style(nodeStatus.name, fg = statusColors[nodeStatus.name]) + ui.stdEcho(f"Current status of node is {statusEcho}.") @click.group() From af13cbd30e743c0e79ceaa5c876bb7237719ea51 Mon Sep 17 00:00:00 2001 From: Bogdan Tintor Date: Tue, 20 Aug 2024 17:00:06 +0200 Subject: [PATCH 6/6] CTX-6562: Single quotes -> double quotes --- coretex/cli/commands/node.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coretex/cli/commands/node.py b/coretex/cli/commands/node.py index bccb8223..a6f7f8a4 100644 --- a/coretex/cli/commands/node.py +++ b/coretex/cli/commands/node.py @@ -183,10 +183,10 @@ def config(advanced: bool) -> None: def status() -> None: nodeStatus = getNodeStatus() statusColors = { - 'inactive': 'red', - 'active': 'green', - 'busy': 'cyan', - 'reconnecting': 'yellow' + "inactive": "red", + "active": 'green', + "busy": "cyan", + "reconnecting": "yellow" } statusEcho = click.style(nodeStatus.name, fg = statusColors[nodeStatus.name])