Skip to content

Commit

Permalink
Cb 5124 add a notification about the upcoming expiration of the licen…
Browse files Browse the repository at this point in the history
…se add to status (#2733)

* CB-5124. Add license status to /status api

* CB-5124. Add license status to /status api

* CB-5124 adds reminder for soon expiring license

* CB-5124. Refactor after review

* CB-5153 adds core-website package

* CB-5124 updates TS references

* CB-5124 refactors website links service

* CB-5124 pr fixes

* CB-5124 update TS references

* CB-5124 removes WebSiteLinks from coreWebsiteManifest

---------

Co-authored-by: sergeyteleshev <[email protected]>
Co-authored-by: Evgenia Bezborodova <[email protected]>
  • Loading branch information
3 people authored Jun 28, 2024
1 parent 0755561 commit 4433018
Show file tree
Hide file tree
Showing 26 changed files with 190 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.jkiss.dbeaver.model.websocket.event.WSEventController;

import java.nio.file.Path;
import java.util.Map;

/**
* Base interface for web application
Expand Down Expand Up @@ -95,4 +96,8 @@ default String getRootURI() {
int getServerPort();

boolean isLicenseRequired();

default void getStatusInfo(Map<String, Object> infoMap) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
package io.cloudbeaver.server.servlets;

import com.google.gson.stream.JsonWriter;
import io.cloudbeaver.server.CBApplication;
import io.cloudbeaver.server.CBConstants;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.data.json.JSONUtils;
import org.jkiss.dbeaver.utils.GeneralUtils;
Expand All @@ -44,6 +46,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
infoMap.put("health", "ok");
infoMap.put("product.name", GeneralUtils.getProductName());
infoMap.put("product.version", GeneralUtils.getProductVersion().toString());
CBApplication.getInstance().getStatusInfo(infoMap);
try (JsonWriter writer = new JsonWriter(response.getWriter())) {
JSONUtils.serializeMap(writer, infoMap);
}
Expand Down
3 changes: 3 additions & 0 deletions webapp/packages/core-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@
},
"peerDependencies": {},
"devDependencies": {
"@cloudbeaver/core-di": "^0",
"@cloudbeaver/core-dialogs": "^0",
"@cloudbeaver/core-events": "^0",
"@cloudbeaver/core-localization": "^0",
"@cloudbeaver/core-settings": "^0",
"@cloudbeaver/core-theming": "^0",
"@cloudbeaver/core-utils": "^0",
"@cloudbeaver/tests-runner": "^0",
"@testing-library/jest-dom": "^6",
"@testing-library/react": "^16",
Expand Down
9 changes: 9 additions & 0 deletions webapp/packages/core-blocks/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
{
"path": "../core-di/tsconfig.json"
},
{
"path": "../core-di/tsconfig.json"
},
{
"path": "../core-dialogs/tsconfig.json"
},
{
"path": "../core-dialogs/tsconfig.json"
},
Expand Down Expand Up @@ -51,6 +57,9 @@
{
"path": "../core-utils/tsconfig.json"
},
{
"path": "../core-utils/tsconfig.json"
},
{
"path": "../tests-runner/tsconfig.json"
}
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@cloudbeaver/core-version": "^0",
"@cloudbeaver/core-version-update": "^0",
"@cloudbeaver/core-view": "^0",
"@cloudbeaver/core-website": "^0",
"mobx": "^6",
"react": "^18",
"react-dom": "^18"
Expand Down
2 changes: 2 additions & 0 deletions webapp/packages/core-bootstrap/src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { coreUIManifest } from '@cloudbeaver/core-ui';
import { coreVersionManifest } from '@cloudbeaver/core-version';
import { coreVersionUpdateManifest } from '@cloudbeaver/core-version-update';
import { coreViewManifest } from '@cloudbeaver/core-view';
import { coreWebsiteManifest } from '@cloudbeaver/core-website';

export const coreManifests: PluginManifest[] = [
{
Expand All @@ -63,6 +64,7 @@ export const coreManifests: PluginManifest[] = [
coreResourceManifest,
coreSDKManifest,
coreRootManifest,
coreWebsiteManifest,
coreBrowserSettingsManifest,
coreBrowserCookiesManifest,
coreProductManifest,
Expand Down
3 changes: 3 additions & 0 deletions webapp/packages/core-bootstrap/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@
},
{
"path": "../core-view/tsconfig.json"
},
{
"path": "../core-website/tsconfig.json"
}
],
"include": [
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-root/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"peerDependencies": {},
"devDependencies": {
"@cloudbeaver/core-sdk": "^0",
"@cloudbeaver/core-website": "^0",
"@cloudbeaver/tests-runner": "^0",
"@types/jest": "^29",
"msw": "^2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* you may not use this file except in compliance with the License.
*/
import type { ServerConfigQuery } from '@cloudbeaver/core-sdk';
import { WebsiteLinks } from '@cloudbeaver/core-website';

import { defaultProductConfiguration } from './defaultProductConfiguration';

Expand Down Expand Up @@ -112,7 +113,7 @@ export const defaultServerConfig: (productConfiguration?: Record<string, any>) =
productInfo: {
id: 'io.cloudbeaver.product.ce.product',
version: '22.1.2.202207140640',
latestVersionInfo: 'https://dbeaver.com/product/cloudbeaver-ce-version.json',
latestVersionInfo: WebsiteLinks.LATEST_COMMUNITY_VERSION_PAGE,
name: 'CloudBeaver CE Server',
description: 'Cloudbeaver Web UI Application',
buildTime: 'July 14, 2022',
Expand Down
3 changes: 3 additions & 0 deletions webapp/packages/core-root/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
{
"path": "../core-utils/tsconfig.json"
},
{
"path": "../core-website/tsconfig.json"
},
{
"path": "../tests-runner/tsconfig.json"
}
Expand Down
24 changes: 24 additions & 0 deletions webapp/packages/core-website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/lib

# misc
.DS_Store
.env*

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# typescript
*.tsbuildinfo
28 changes: 28 additions & 0 deletions webapp/packages/core-website/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@cloudbeaver/core-website",
"sideEffects": [
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
],
"version": "0.1.0",
"description": "",
"license": "Apache-2.0",
"main": "dist/index.js",
"scripts": {
"build": "tsc -b",
"clean": "rimraf --glob dist",
"lint": "eslint ./src/ --ext .ts,.tsx",
"lint-fix": "eslint ./src/ --ext .ts,.tsx --fix",
"test": "core-cli-test",
"validate-dependencies": "core-cli-validate-dependencies",
"update-ts-references": "yarn run clean && typescript-resolve-references"
},
"dependencies": {
"@cloudbeaver/core-di": "^0"
},
"peerDependencies": {},
"devDependencies": {
"typescript": "^5"
}
}
34 changes: 34 additions & 0 deletions webapp/packages/core-website/src/WebsiteLinks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
export class WebsiteLinks {
static DATA_EDITOR_DOCUMENTATION_PAGE = 'https://dbeaver.com/docs/cloudbeaver/Data-editor/';
static SQL_EDITOR_DOCUMENTATION_PAGE = 'https://dbeaver.com/docs/cloudbeaver/SQL-Editor/';
static SERVER_CONFIGURATION_RESOURCE_QUOTAS_PAGE = 'https://dbeaver.com/docs/cloudbeaver/Server-configuration/#resource-quotas';
static DATABASE_NAVIGATOR_DOCUMENTATION_PAGE = 'https://dbeaver.com/docs/cloudbeaver/Database-Navigator/';

static ENTERPRISE_BUY_PRODUCT_PAGE = 'https://dbeaver.com/products/cloudbeaver-enterprise/';
static TEAM_EDITION_BUY_PRODUCT_PAGE = 'https://dbeaver.com/products/team-edition/';
static LATEST_COMMUNITY_VERSION_PAGE = 'https://dbeaver.com/product/cloudbeaver-ce-version.json';

static TEAM_ARCHIVE = 'https://dbeaver.com/downloads-team';
static CONTACT_PAGE = 'https://dbeaver.com/contact/';

static GITHUB_REPOSITORY_PAGE = 'https://github.com/dbeaver/cloudbeaver';

static getTeamArchiveById(id: string) {
return `${WebsiteLinks.TEAM_ARCHIVE}/${id}`;
}

static getProductBuyPage(distributed: boolean) {
if (distributed) {
return WebsiteLinks.TEAM_EDITION_BUY_PRODUCT_PAGE;
}

return WebsiteLinks.ENTERPRISE_BUY_PRODUCT_PAGE;
}
}
9 changes: 9 additions & 0 deletions webapp/packages/core-website/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
export * from './WebsiteLinks';
export * from './manifest';
16 changes: 16 additions & 0 deletions webapp/packages/core-website/src/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import type { PluginManifest } from '@cloudbeaver/core-di';

export const coreWebsiteManifest: PluginManifest = {
info: {
name: 'Core Website',
},

providers: [],
};
25 changes: 25 additions & 0 deletions webapp/packages/core-website/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo"
},
"references": [
{
"path": "../core-di/tsconfig.json"
}
],
"include": [
"__custom_mocks__/**/*",
"src/**/*",
"src/**/*.json",
"src/**/*.css",
"src/**/*.scss"
],
"exclude": [
"**/node_modules",
"lib/**/*",
"dist/**/*"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { AuthDialogService } from './Dialog/AuthDialogService';
import type { IAuthOptions } from './IAuthOptions';
import { isAutoLoginSessionAction } from './isAutoLoginSessionAction';

type AuthEventType = 'before' | 'after';
export type AuthEventType = 'before' | 'after';

@injectable()
export class AuthenticationService extends Bootstrap {
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/plugin-data-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@cloudbeaver/core-ui": "^0",
"@cloudbeaver/core-utils": "^0",
"@cloudbeaver/core-view": "^0",
"@cloudbeaver/core-website": "^0",
"@cloudbeaver/plugin-codemirror6": "^0",
"@cloudbeaver/plugin-navigation-tabs": "^0",
"@cloudbeaver/plugin-object-viewer": "^0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { observer } from 'mobx-react-lite';

import { Container, Link, s, usePermission, useS, useTranslate } from '@cloudbeaver/core-blocks';
import { EAdminPermission } from '@cloudbeaver/core-root';
import { WebsiteLinks } from '@cloudbeaver/core-website';

import type { IResultSetElementKey } from '../DatabaseDataModel/Actions/ResultSet/IResultSetDataKey';
import { ResultSetDataContentAction } from '../DatabaseDataModel/Actions/ResultSet/ResultSetDataContentAction';
Expand Down Expand Up @@ -45,12 +46,7 @@ export const QuotaPlaceholder: React.FC<React.PropsWithChildren<Props>> = observ
&nbsp;
<span className={s(style, { limitWord: true })}>
{admin ? (
<Link
title={limitInfo?.limitWithSize}
href="https://dbeaver.com/docs/cloudbeaver/Server-configuration/#resource-quotas"
target="_blank"
indicator
>
<Link title={limitInfo?.limitWithSize} href={WebsiteLinks.SERVER_CONFIGURATION_RESOURCE_QUOTAS_PAGE} target="_blank" indicator>
{translate('ui_limit')}
</Link>
) : (
Expand Down
3 changes: 3 additions & 0 deletions webapp/packages/plugin-data-viewer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@
{
"path": "../core-view/tsconfig.json"
},
{
"path": "../core-website/tsconfig.json"
},
{
"path": "../plugin-codemirror6/tsconfig.json"
},
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/plugin-help/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@cloudbeaver/core-routing": "^0",
"@cloudbeaver/core-utils": "^0",
"@cloudbeaver/core-view": "^0",
"@cloudbeaver/core-website": "^0",
"@cloudbeaver/plugin-navigation-tree": "^0",
"@cloudbeaver/plugin-sql-editor": "^0",
"@cloudbeaver/plugin-top-app-bar": "^0",
Expand Down
7 changes: 4 additions & 3 deletions webapp/packages/plugin-help/src/Shortcuts/ShortcutsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
useTranslate,
} from '@cloudbeaver/core-blocks';
import type { DialogComponent } from '@cloudbeaver/core-dialogs';
import { WebsiteLinks } from '@cloudbeaver/core-website';

import { Shortcut } from './Shortcut';
import { DATA_VIEWER_SHORTCUTS, NAVIGATION_TREE_SHORTCUTS, SQL_EDITOR_SHORTCUTS } from './SHORTCUTS_DATA';
Expand All @@ -36,7 +37,7 @@ export const ShortcutsDialog: DialogComponent<null> = function ShortcutsDialog({
<Container className={s(styles, { container: true })} gap wrap overflow>
<Group box gap dense overflow>
<GroupTitle header>
<Link href="https://dbeaver.com/docs/cloudbeaver/Data-editor/" target="_blank" wrapper indicator>
<Link href={WebsiteLinks.DATA_EDITOR_DOCUMENTATION_PAGE} target="_blank" wrapper indicator>
Data Viewer
</Link>
</GroupTitle>
Expand All @@ -46,7 +47,7 @@ export const ShortcutsDialog: DialogComponent<null> = function ShortcutsDialog({
</Group>
<Group box gap dense overflow>
<GroupTitle header>
<Link href="https://dbeaver.com/docs/cloudbeaver/SQL-Editor/" target="_blank" wrapper indicator>
<Link href={WebsiteLinks.SQL_EDITOR_DOCUMENTATION_PAGE} target="_blank" wrapper indicator>
SQL Editor
</Link>
</GroupTitle>
Expand All @@ -56,7 +57,7 @@ export const ShortcutsDialog: DialogComponent<null> = function ShortcutsDialog({
</Group>
<Group box gap dense overflow>
<GroupTitle header>
<Link href="https://dbeaver.com/docs/cloudbeaver/Database-Navigator/" target="_blank" wrapper indicator>
<Link href={WebsiteLinks.DATABASE_NAVIGATOR_DOCUMENTATION_PAGE} target="_blank" wrapper indicator>
Navigation Tree
</Link>
</GroupTitle>
Expand Down
3 changes: 3 additions & 0 deletions webapp/packages/plugin-help/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
{
"path": "../core-view/tsconfig.json"
},
{
"path": "../core-website/tsconfig.json"
},
{
"path": "../plugin-navigation-tree/tsconfig.json"
},
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/plugin-product/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@cloudbeaver/core-theming": "^0",
"@cloudbeaver/core-version": "^0",
"@cloudbeaver/core-view": "^0",
"@cloudbeaver/core-website": "^0",
"@cloudbeaver/plugin-settings-menu": "^0",
"mobx-react-lite": "^4",
"react": "^18"
Expand Down
Loading

0 comments on commit 4433018

Please sign in to comment.