From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 391AC1FF185 for ; Mon, 18 Aug 2025 12:00:39 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E47E6348CB; Mon, 18 Aug 2025 12:02:22 +0200 (CEST) From: Shan Shaji To: pve-devel@lists.proxmox.com Date: Mon, 18 Aug 2025 12:01:33 +0200 Message-ID: <20250818100134.30550-3-s.shaji@proxmox.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250818100134.30550-1-s.shaji@proxmox.com> References: <20250818100134.30550-1-s.shaji@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1755511270938 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.188 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH pve_flutter_frontend v5 2/3] refactor: noVNC: seperate duplicate onTap implementation X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" The noVNC console opening implementation was the same for all guests. However, the code in this section was duplicated. To fix this, extract the duplicate logic into a single function and use that function as the `onTap` callback. Signed-off-by: Shan Shaji --- lib/widgets/pve_console_menu_widget.dart | 43 ++++++++---------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/lib/widgets/pve_console_menu_widget.dart b/lib/widgets/pve_console_menu_widget.dart index 6de2c0b..66a852c 100644 --- a/lib/widgets/pve_console_menu_widget.dart +++ b/lib/widgets/pve_console_menu_widget.dart @@ -105,35 +105,7 @@ class PveConsoleMenu extends StatelessWidget { style: TextStyle(fontWeight: FontWeight.bold), ), subtitle: const Text("Open console view"), - onTap: () async { - if (['qemu', 'lxc'].contains(type)) { - SystemChrome.setEnabledSystemUIMode( - SystemUiMode.immersive); - Navigator.of(context) - .push(_createHTMLConsoleRoute()) - .then((completion) { - SystemChrome.setEnabledSystemUIMode( - SystemUiMode.edgeToEdge, - overlays: [ - SystemUiOverlay.top, - SystemUiOverlay.bottom - ]); - }); - } else if (type == 'node') { - SystemChrome.setEnabledSystemUIMode( - SystemUiMode.immersive); - Navigator.of(context) - .push(_createHTMLConsoleRoute()) - .then((completion) { - SystemChrome.setEnabledSystemUIMode( - SystemUiMode.edgeToEdge, - overlays: [ - SystemUiOverlay.top, - SystemUiOverlay.bottom - ]); - }); - } - }, + onTap: () => _openNoVncConsole(context, type), ), ], ), @@ -141,6 +113,19 @@ class PveConsoleMenu extends StatelessWidget { ); } + Future _openNoVncConsole(BuildContext context, String type) async { + if(!['lxc', 'node', 'qemu'].contains(type)) return; + SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive); + await Navigator.push(context, _createHTMLConsoleRoute()); + SystemChrome.setEnabledSystemUIMode( + SystemUiMode.edgeToEdge, + overlays: [ + SystemUiOverlay.top, + SystemUiOverlay.bottom, + ], + ); + } + void showTextDialog(BuildContext context, String title, String content) { showDialog( context: context, -- 2.50.1 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel