Skip to content

Commit

Permalink
Type and simplify DocsHelper module. (#16601)
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisoelkers authored Sep 21, 2023
1 parent 3942e49 commit 659aed2
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* <http://www.mongodb.com/licensing/server-side-public-license>.
*/

class DocsHelper {
PAGES = {
const docsHelper = {
PAGES: {
ALERTS: 'alerts',
AUDIT_LOG: 'auditlog',
AUTHENTICATORS: 'permission-management#authentication',
Expand Down Expand Up @@ -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 `<a href="${this.toString(path)}" target="_blank">${title}</a>`;
}
},

versionedDocsHomePage() {
return this.toString('');
}
}

const docsHelper = new DocsHelper();
},
} as const;

export default docsHelper;

0 comments on commit 659aed2

Please sign in to comment.