From 68e6e724417efa46a90234d5d870bebbd0a8a76b Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Thu, 21 Dec 2023 13:48:28 -0500 Subject: [PATCH] show warning on downloads screen for eval/import nodes --- html/index.html | 5 +++-- html/js/i18n.js | 1 + html/js/routes/downloads.js | 10 ++++++++++ html/js/routes/downloads.test.js | 34 ++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 html/js/routes/downloads.test.js diff --git a/html/index.html b/html/index.html index 1b399aee..3597263c 100644 --- a/html/index.html +++ b/html/index.html @@ -1098,10 +1098,11 @@

- -

+

+ +
  • Windows x86_64 Installer
  • Linux x86_64 Installer
  • diff --git a/html/js/i18n.js b/html/js/i18n.js index f9cd697b..e52b7959 100644 --- a/html/js/i18n.js +++ b/html/js/i18n.js @@ -260,6 +260,7 @@ const i18n = { diskUsageRoot: 'Disk Usage Root', diskUsageRootAbbr: 'Root', downloads: 'Downloads', + downloadsAgentUnavailable: 'Evaluation installs and Import installs do not support remote elastic agents. The links below are shown for demonstration purposes only.', downloadsFirewallTip: 'When installing the Elastic Agent onto remote systems, be sure to allow network access through the firewall.', downloadsInfo: 'These Elastic Agent installers are customized for this specific Elastic Fleet installation. These files are not signed. If you need signed non-customized Elastic Agent installers, you can get them from elastic.co.', downloadsElasticAgent: 'Elastic Agent Installers', diff --git a/html/js/routes/downloads.js b/html/js/routes/downloads.js index a74ccae8..5dd7d447 100644 --- a/html/js/routes/downloads.js +++ b/html/js/routes/downloads.js @@ -8,11 +8,21 @@ routes.push({ path: '/downloads', name: 'downloads', component: { template: '#page-downloads', data() { return { i18n: this.$root.i18n, + remoteAgentSupported: true, }}, created() { + this.$root.subscribe("node", this.updateNode); + }, + destroyed() { + this.$root.unsubscribe("node", this.updateNode); }, watch: { }, methods: { + updateNode(node) { + if (['so-eval', 'so-import'].includes(node.role)) { + this.remoteAgentSupported = false; + } + }, } }}); diff --git a/html/js/routes/downloads.test.js b/html/js/routes/downloads.test.js new file mode 100644 index 00000000..4476fc8a --- /dev/null +++ b/html/js/routes/downloads.test.js @@ -0,0 +1,34 @@ +// Copyright 2019 Jason Ertel (github.com/jertel). +// Copyright 2020-2023 Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one +// or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at +// https://securityonion.net/license; you may not use this file except in compliance with the +// Elastic License 2.0. + +require('../test_common.js'); +require('./downloads.js'); + +const comp = getComponent("downloads"); + +test('updateNode', () => { + expect(comp.remoteAgentSupported).toBe(true); + + comp.remoteAgentSupported = true; + comp.updateNode({ role: 'so-import'}); + expect(comp.remoteAgentSupported).toBe(false); + + comp.remoteAgentSupported = true; + comp.updateNode({ role: 'so-eval'}); + expect(comp.remoteAgentSupported).toBe(false); + + comp.remoteAgentSupported = true; + comp.updateNode({ role: 'so-standalone'}); + expect(comp.remoteAgentSupported).toBe(true); + + comp.remoteAgentSupported = true; + comp.updateNode({ role: 'so-manager'}); + expect(comp.remoteAgentSupported).toBe(true); + + comp.remoteAgentSupported = true; + comp.updateNode({ role: 'so-managersearch'}); + expect(comp.remoteAgentSupported).toBe(true); +});