From 659aed27453181380daacc351f6e637049c4c0f8 Mon Sep 17 00:00:00 2001 From: Dennis Oelkers Date: Thu, 21 Sep 2023 14:39:50 +0200 Subject: [PATCH] Type and simplify `DocsHelper` module. (#16601) --- .../src/util/{DocsHelper.js => DocsHelper.ts} | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) rename graylog2-web-interface/src/util/{DocsHelper.js => DocsHelper.ts} (91%) diff --git a/graylog2-web-interface/src/util/DocsHelper.js b/graylog2-web-interface/src/util/DocsHelper.ts similarity index 91% rename from graylog2-web-interface/src/util/DocsHelper.js rename to graylog2-web-interface/src/util/DocsHelper.ts index cc8d0b4e6c83..862c29e50f24 100644 --- a/graylog2-web-interface/src/util/DocsHelper.js +++ b/graylog2-web-interface/src/util/DocsHelper.ts @@ -15,8 +15,8 @@ * . */ -class DocsHelper { - PAGES = { +const docsHelper = { + PAGES: { ALERTS: 'alerts', AUDIT_LOG: 'auditlog', AUTHENTICATORS: 'permission-management#authentication', @@ -62,25 +62,19 @@ class DocsHelper { UPGRADE_GUIDE: 'upgrading-graylog', USERS_ROLES: 'permission-management', WELCOME: '', // Welcome page to the documentation - }; + }, - DOCS_URL = 'https://docs.graylog.org/docs'; + DOCS_URL: 'https://docs.graylog.org/docs', - toString(path) { + toString(path: string) { const baseUrl = this.DOCS_URL; return path === '' ? baseUrl : `${baseUrl}/${path}`; - } - - toLink(path, title) { - return `${title}`; - } + }, versionedDocsHomePage() { return this.toString(''); - } -} - -const docsHelper = new DocsHelper(); + }, +} as const; export default docsHelper;