Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge changes from main into oldstable #4209

Merged
merged 53 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
f365986
Deps: Bump the patch-updates group with 3 updates
dependabot[bot] Oct 1, 2024
d26c7be
Merge pull request #4168 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Oct 1, 2024
173b1a1
Deps: Bump @sentry/react from 8.28.0 to 8.32.0
dependabot[bot] Oct 1, 2024
894a9aa
Merge pull request #4169 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Oct 1, 2024
b2ccbda
Deps: Bump i18next from 23.14.0 to 23.15.1
dependabot[bot] Oct 1, 2024
45dfb40
Merge pull request #4172 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Oct 1, 2024
b0a8cd7
Deps: Bump eslint from 8.57.0 to 8.57.1
dependabot[bot] Oct 1, 2024
5840c4d
Merge pull request #4171 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Oct 2, 2024
e983d0d
Deps: Bump @typescript-eslint/eslint-plugin from 8.7.0 to 8.8.0
dependabot[bot] Oct 2, 2024
72db309
Merge pull request #4174 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Oct 2, 2024
f7ef329
Deps: Bump @typescript-eslint/parser from 8.7.0 to 8.8.0
dependabot[bot] Oct 2, 2024
8b41294
Merge pull request #4175 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Oct 2, 2024
3d9ea30
Deps: Bump eslint-plugin-react from 7.36.1 to 7.37.1
dependabot[bot] Oct 2, 2024
0c1af74
Merge pull request #4177 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Oct 2, 2024
d969267
Bump @sentry/browser and @sentry/react
dependabot[bot] Oct 4, 2024
9d35019
fix: rejected request error message
daniele-mng Oct 2, 2024
48f6dcb
Merge pull request #4180 from greenbone/fix-rejected-request-error-me…
a-h-abdelsalam Oct 4, 2024
c4f5458
Merge branch 'main' into dependabot/npm_and_yarn/multi-2d94857e42
daniele-mng Oct 7, 2024
df20476
Merge pull request #4179 from greenbone/dependabot/npm_and_yarn/multi…
daniele-mng Oct 7, 2024
9ade506
Deps: Bump ical.js from 2.0.1 to 2.1.0
dependabot[bot] Oct 7, 2024
d8168b0
Merge pull request #4170 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Oct 7, 2024
627ae57
add: appliance model to page title
daniele-mng Oct 1, 2024
f36deb4
Merge pull request #4176 from greenbone/add-appliance-in-page-title
a-h-abdelsalam Oct 15, 2024
2958587
add: user settings time and date format
daniele-mng Aug 29, 2024
6b9e6b8
change dateTimeWithTimeZone
daniele-mng Aug 29, 2024
ee9af43
change shortDate
daniele-mng Aug 29, 2024
15b8c79
change longDate
daniele-mng Aug 29, 2024
6983d1e
add translation and sys default
daniele-mng Aug 30, 2024
d0bd504
update dialog for sys default
daniele-mng Aug 30, 2024
34a6530
address comments
daniele-mng Sep 2, 2024
0b99ae9
Update generalpart and usermenu
daniele-mng Sep 6, 2024
5c332df
fix linting
daniele-mng Sep 6, 2024
29113a4
Merge pull request #4154 from greenbone/Add-user-custom-setting-time-…
a-h-abdelsalam Oct 17, 2024
7dadcc7
Deps: Bump uuid from 10.0.0 to 11.0.2
dependabot[bot] Nov 1, 2024
a475d8b
Merge pull request #4194 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Nov 1, 2024
f134bbb
Deps: Bump vite-plugin-eslint2 from 4.4.2 to 5.0.1
dependabot[bot] Nov 1, 2024
d7356a7
Merge pull request #4191 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Nov 1, 2024
76b0758
Deps: Bump @sentry/react from 8.33.1 to 8.36.0
dependabot[bot] Nov 1, 2024
8d3f4f4
Merge pull request #4190 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Nov 4, 2024
84a0fc1
Deps: Bump @reduxjs/toolkit from 2.2.7 to 2.3.0
dependabot[bot] Nov 4, 2024
b3d3df3
Merge pull request #4197 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Nov 4, 2024
4408d0c
Deps: Bump the patch-updates group with 14 updates
dependabot[bot] Nov 4, 2024
ca11288
Merge pull request #4188 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Nov 4, 2024
1b68962
Deps: Bump i18next from 23.15.1 to 23.16.4
dependabot[bot] Nov 4, 2024
9e8cf61
Merge pull request #4193 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Nov 4, 2024
827cca5
Deps: Bump eslint-plugin-react-hooks from 4.6.2 to 5.0.0
dependabot[bot] Nov 4, 2024
4634256
Merge pull request #4196 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Nov 4, 2024
6d56715
Deps: Bump @typescript-eslint/parser from 8.8.0 to 8.12.2
dependabot[bot] Nov 4, 2024
2f12995
Merge pull request #4195 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Nov 5, 2024
e192edd
Deps: Bump @typescript-eslint/eslint-plugin from 8.8.0 to 8.13.0
dependabot[bot] Nov 5, 2024
6caa6fc
Merge pull request #4199 from greenbone/dependabot/npm_and_yarn/main/…
daniele-mng Nov 5, 2024
d8bd19a
deps: remove core-js
daniele-mng Nov 7, 2024
111e44b
Merge pull request #4202 from greenbone/deps-remove-core-js
a-h-abdelsalam Nov 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/img/favicon.png" type="image/png"/>
<link rel="icon" href="/img/favicon.png" type="image/png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Greenbone Security Assistant</title>
<script type="text/javascript" src="/config.js"></script>
Expand All @@ -11,5 +11,24 @@
<div id="app"></div>
<div id="portals"></div>
<script type="module" src="/src/index.jsx"></script>
<script>
window.addEventListener('DOMContentLoaded', () => {
try {
const vendorLabel = config.vendorLabel;

const match = vendorLabel.match(/gsm-(\w+)_label\.svg/);
if (match) {
let labelPart = match[1];
if (isNaN(labelPart)) {
labelPart = labelPart.toUpperCase();
}
const pageTitle = `Greenbone - ${labelPart}`;
document.title = pageTitle;
} else {
document.title = 'Greenbone Security Assistant';
}
} catch (error) {}
});
</script>
</body>
</html>
2,133 changes: 990 additions & 1,143 deletions package-lock.json

Large diffs are not rendered by default.

45 changes: 22 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@
"node": ">=18.0"
},
"dependencies": {
"@reduxjs/toolkit": "^2.2.7",
"@sentry/react": "^8.28.0",
"@reduxjs/toolkit": "^2.3.0",
"@sentry/react": "^8.36.0",
"@visx/axis": "^3.10.1",
"@visx/gradient": "^3.3.0",
"@visx/shape": "^3.5.0",
"babel-preset-react-app": "^10.0.1",
"core-js": "^3.37.1",
"d3-cloud": "^1.2.7",
"d3-color": "^3.1.0",
"d3-force": "^3.0.0",
Expand All @@ -51,12 +50,12 @@
"fast-deep-equal": "^3.1.3",
"fast-xml-parser": "^4.4.1",
"hoist-non-react-statics": "^3.3.2",
"i18next": "^23.14.0",
"i18next-http-backend": "^2.6.1",
"ical.js": "^2.0.0",
"i18next": "^23.16.4",
"i18next-http-backend": "^2.6.2",
"ical.js": "^2.1.0",
"memoize-one": "^6.0.0",
"moment": "^2.30.1",
"moment-timezone": "^0.5.45",
"moment-timezone": "^0.5.46",
"prop-types": "^15.8.1",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
Expand All @@ -67,40 +66,40 @@
"redux": "^5.0.1",
"redux-logger": "^3.0.6",
"styled-components": "^6.1.13",
"uuid": "^10.0.0",
"uuid": "^11.0.2",
"whatwg-fetch": "^3.6.20"
},
"devDependencies": {
"@babel/cli": "^7.25.6",
"@babel/cli": "^7.25.9",
"@pandatix/js-cvss": "^0.4.4",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.3.9",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.7.0",
"@vitejs/plugin-legacy": "^5.4.2",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-v8": "^2.1.1",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^8.13.0",
"@typescript-eslint/parser": "^8.12.2",
"@vitejs/plugin-legacy": "^5.4.3",
"@vitejs/plugin-react": "^4.3.3",
"@vitest/coverage-v8": "^2.1.4",
"@vitest/ui": "^2.1.1",
"babel-plugin-i18next-extract": "^0.10.0",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.11",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"eslint-plugin-vitest": "^0.5.4",
"eslint-plugin-vitest-globals": "^1.5.0",
"husky": "^2.7.0",
"jest-styled-components": "^7.2.0",
"jsdom": "^25.0.1",
"lint-staged": "^13.1.0",
"prettier": "^3.3.3",
"typescript": "^5.6.2",
"vite": "^5.4.8",
"vite-plugin-eslint2": "^4.4.2",
"typescript": "^5.6.3",
"vite": "^5.4.10",
"vite-plugin-eslint2": "^5.0.1",
"vite-plugin-svgr": "^4.2.0",
"vitest": "^2.1.1"
},
Expand Down
6 changes: 6 additions & 0 deletions public/locales/gsa-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@
"Dashboards": "Dashboards",
"Dashboards limit reached": "Dashboardgrenze erreicht",
"Date": "Datum",
"Date Format": "Datumsformat",
"Day": "Tag",
"Debug": "Debug",
"Decrease the minimum QoD in the filter settings to 30 percent to see those results.": "Die Minimum-QdE im Filter auf 30 Prozent verringern, um diese Ergebnisse zu sehen.",
Expand Down Expand Up @@ -1538,6 +1539,7 @@
"Super (Has super access)": "Super (hat Super-Zugriff)",
"Support for LDAP is not available.": "Unterstützung für LDAP ist nicht verfügbar.",
"Support for RADIUS is not available.": "Unterstützung für RADIUS ist nicht verfügbar.",
"System Default": "Systemstandard",
"System Logger": "System-Logger",
"System Reports": "Systemberichte",
"TCP": "TCP",
Expand Down Expand Up @@ -1727,6 +1729,7 @@
"Tickets by Creation Time (Total: {{count}})": "Tickets nach Erstellungszeit (Gesamt: {{count}})",
"Tickets by Status (Total: {{count}})": "Tickets nach Status (Gesamt: {{count}})",
"Time": "Zeit",
"Time Format": "Zeitformat",
"Timeout": "Timeout",
"Timezone": "Zeitzone",
"TippingPoint SMS": "TippingPoint SMS",
Expand Down Expand Up @@ -1795,6 +1798,7 @@
"Uploading": "Hochladen",
"Urgency": "Dringlichkeit",
"Use LDAPS only": "Ausschließlich LDAPS verwenden",
"Use System Default for Time and Date Format": "Systemstandard für Zeit- und Datumsformat verwenden",
"Use workaround for default certificate": "Problemumgehung für Standard-Zertifikat verwenden",
"User": "Benutzer",
"User ID": "Benutzer-ID",
Expand Down Expand Up @@ -1857,6 +1861,8 @@
"Wednesday": "Mittwoch",
"Week": "Woche",
"Weekly": "Wöchentlich",
"Weekday, Month, Day, Year": "Wochentag, Monat, Tag, Jahr",
"Weekday, Day, Month, Year": "Wochentag, Tag, Monat, Jahr",
"When changing status to \"closed\", a \"Note for Closed\" is required.": "Wenn der Status zu \"Geschlossen\" geändert wird, ist eine \"Notiz für Geschlossen\" erforderlich.",
"When changing status to \"fixed\", a \"Note for Fixed\" is required.": "Wenn der Status zu \"Behoben\" geändert wird, ist eine \"Notiz für Behoben\" erforderlich.",
"When changing status to \"open\", a \"Note for Open\" is required.": "Wenn der Status zu \"Offen\" geändert wird, ist eine \"Notiz für Offen\" erforderlich.",
Expand Down
8 changes: 8 additions & 0 deletions src/gmp/commands/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ export const DEFAULT_FILTER_SETTINGS = {
vulnerability: '17c9d269-95e7-4bfa-b1b2-bc106a2175c7',
};

const PARAM_KEYS = {
DATE: 'date_format',
TIME: 'time_format',
};

const saveDefaultFilterSettingId = entityType =>
`settings_filter:${DEFAULT_FILTER_SETTINGS[entityType]}`;

Expand Down Expand Up @@ -251,9 +256,12 @@ export class UserCommand extends EntityCommand {

saveSettings(data) {
log.debug('Saving settings', data);

return this.httpPost({
cmd: 'save_my_settings',
text: data.timezone,
[PARAM_KEYS.DATE]: data.userInterfaceDateFormat,
[PARAM_KEYS.TIME]: data.userInterfaceTimeFormat,
old_password: data.oldPassword,
password: data.newPassword,
lang: data.userInterfaceLanguage,
Expand Down
158 changes: 143 additions & 15 deletions src/gmp/locale/__tests__/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import {describe, test, expect} from '@gsa/testing';
import {describe, test, expect, beforeEach} from '@gsa/testing';

import date, {setLocale as locale} from '../../models/date';

Expand Down Expand Up @@ -55,15 +55,30 @@ describe('shortDate tests', () => {
expect(shortDate(d)).toEqual('01/01/2018');
});

test('should format string', () => {
setLocale('en');
expect(shortDate('2018-01-01')).toEqual('01/01/2018');
test('should format date locale', () => {
setLocale('de');
expect(
shortDate(date('2018-11-24T15:30:00Z'), 'UTC', 'system_default'),
).toEqual('24.11.2018');
});

test('should format JS date', () => {
const d = new Date('2018-01-01');
setLocale('en');
expect(shortDate(d)).toEqual('01/01/2018');
describe('shortDate tests', () => {
beforeEach(() => {
setLocale('en');
});

test.each([
['2018-01-01', undefined, undefined, '01/01/2018'],
[new Date('2018-01-01'), undefined, undefined, '01/01/2018'],
[new Date('2018-11-24'), undefined, 'wmdy', '11/24/2018'],
[new Date('2018-11-24'), undefined, 'wdmy', '24/11/2018'],
[new Date('2018-11-24'), undefined, 'system_default', '11/24/2018'],
])(
'should format date %p with tz %p and userInterfaceDateFormat %p to %p',
(input, tz, userInterfaceDateFormat, expected) => {
expect(shortDate(input, tz, userInterfaceDateFormat)).toEqual(expected);
},
);
});
});

Expand All @@ -83,15 +98,61 @@ describe('longDate tests', () => {
expect(longDate(d)).toEqual('Mon, Jan 1, 2018 12:00 AM');
});

test('should format string', () => {
setLocale('en');
expect(longDate('2018-01-01')).toEqual('Mon, Jan 1, 2018 12:00 AM');
test('should format date locale', () => {
setLocale('de');
expect(
longDate(
date('2018-11-24T15:30:00Z'),
'UTC',
'system_default',
'system_default',
),
).toEqual('Sa., 24. Nov. 2018 15:30');
});

test('should format JS date', () => {
const d = new Date('2018-01-01T00:00:00');
setLocale('en');
expect(longDate(d)).toEqual('Mon, Jan 1, 2018 12:00 AM');
describe('longDate tests', () => {
beforeEach(() => {
setLocale('en');
});

test.each([
[
'2018-11-24',
undefined,
undefined,
undefined,
'Sat, Nov 24, 2018 12:00 AM',
],
[
new Date('2018-11-23T00:00:00'),
undefined,
undefined,
undefined,
'Fri, Nov 23, 2018 12:00 AM',
],
['2018-11-24T15:30:00Z', 'UTC', 12, 'wdmy', 'Sat, 24 Nov 2018 3:30 PM'],
['2018-11-24T15:30:00Z', 'UTC', 24, 'wmdy', 'Sat, Nov 24, 2018 15:30'],
[
'2018-11-24T15:30:00Z',
'UTC',
'system_default',
'system_default',
'Sat, Nov 24, 2018 3:30 PM',
],
])(
'should format date %p with tz %p, userInterfaceTimeFormat %p, and userInterfaceDateFormat %p to %p',
(
input,
tz,
userInterfaceTimeFormat,
userInterfaceDateFormat,
expected,
) => {
expect(
longDate(input, tz, userInterfaceTimeFormat, userInterfaceDateFormat),
).toEqual(expected);
},
);
});
});

Expand All @@ -110,6 +171,73 @@ describe('dateTimeWithTimeZone tests', () => {
const d = date('2018-01-01T00:00:00+01:00').tz('CET');
expect(dateTimeWithTimeZone(d)).toEqual('Mon, Jan 1, 2018 12:00 AM CET');
});

test('should format date locale', () => {
setLocale('de');
expect(
dateTimeWithTimeZone(
date('2018-11-24T15:30:00Z'),
'UTC',
'system_default',
'system_default',
),
).toEqual('Sa., 24. Nov. 2018 15:30 UTC');
});

describe('dateTimeWithTimeZone tests', () => {
beforeEach(() => {
setLocale('en');
});

test.each([
[
new Date('2018-11-23T00:00:00'),
undefined,
undefined,
undefined,
'Fri, Nov 23, 2018 12:00 AM ',
],
[
'2018-11-24T15:30:00Z',
'UTC',
12,
'wdmy',
'Sat, 24 Nov 2018 3:30 PM UTC',
],
[
'2018-11-24T15:30:00Z',
'UTC',
24,
'wmdy',
'Sat, Nov 24, 2018 15:30 UTC',
],
[
'2018-11-24T15:30:00Z',
'UTC',
'system_default',
'system_default',
'Sat, Nov 24, 2018 3:30 PM UTC',
],
])(
'should format date %p with tz %p, userInterfaceTimeFormat %p, and userInterfaceDateFormat %p to %p',
(
input,
tz,
userInterfaceTimeFormat,
userInterfaceDateFormat,
expected,
) => {
expect(
dateTimeWithTimeZone(
input,
tz,
userInterfaceTimeFormat,
userInterfaceDateFormat,
),
).toEqual(expected);
},
);
});
});

// vim: set ts=2 sw=2 tw=80:
Loading
Loading