mirror of
https://github.com/dkmstr/openuds-gui.git
synced 2024-12-21 13:33:48 +03:00
Update dependencies and enhance cookie consent functionality in app component
This commit is contained in:
parent
88fceab9d6
commit
7b948ffd2f
22
package.json
22
package.json
@ -27,9 +27,9 @@
|
||||
"@angular/platform-browser": "^19.0.0",
|
||||
"@angular/platform-browser-dynamic": "^19.0.0",
|
||||
"@angular/router": "^19.0.0",
|
||||
"core-js": "^3.38.1",
|
||||
"core-js": "^3.39.0",
|
||||
"rxjs": "^7.8.1",
|
||||
"tslib": "^2.7.0",
|
||||
"tslib": "^2.8.1",
|
||||
"zone.js": "^0.15.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -47,18 +47,18 @@
|
||||
"@types/cookieconsent": "^3.1.3",
|
||||
"@types/jasmine": "~5.1.4",
|
||||
"@types/jasminewd2": "~2.0.13",
|
||||
"@types/node": "^22.5.4",
|
||||
"@typescript-eslint/eslint-plugin": "^8.5.0",
|
||||
"@typescript-eslint/parser": "^8.5.0",
|
||||
"@typescript-eslint/utils": "^8.5.0",
|
||||
"browser-sync": "^3.0.2",
|
||||
"@types/node": "^22.9.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.15.0",
|
||||
"@typescript-eslint/parser": "^8.15.0",
|
||||
"@typescript-eslint/utils": "^8.15.0",
|
||||
"browser-sync": "^3.0.3",
|
||||
"codelyzer": "^6.0.2",
|
||||
"eslint": "^9.10.0",
|
||||
"eslint": "^9.15.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.30.0",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-prefer-arrow": "^1.2.3",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"jasmine-core": "^5.3.0",
|
||||
"jasmine-core": "^5.4.0",
|
||||
"jasmine-spec-reporter": "^7.0.0",
|
||||
"jsonc-parser": "^3.3.1",
|
||||
"karma": "^6.4.4",
|
||||
@ -69,7 +69,7 @@
|
||||
"prettier": "^3.3.3",
|
||||
"prettier-eslint": "^16.3.0",
|
||||
"ts-node": "~10.9.2",
|
||||
"typescript": "~5.5.4"
|
||||
"typescript": "~5.6.3"
|
||||
},
|
||||
"packageManager": "yarn@4.4.1"
|
||||
}
|
||||
|
@ -2,10 +2,10 @@ import { Component, HostListener, OnInit } from '@angular/core';
|
||||
import { UDSApiService } from './services/uds-api.service';
|
||||
|
||||
@Component({
|
||||
selector: 'uds-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss'],
|
||||
standalone: false
|
||||
selector: 'uds-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss'],
|
||||
standalone: false,
|
||||
})
|
||||
export class AppComponent implements OnInit {
|
||||
title = 'UDS';
|
||||
@ -33,21 +33,55 @@ export class AppComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
// Swith theme if needed
|
||||
this.api.switchTheme(this.blackTheme);
|
||||
|
||||
const message =
|
||||
this.api.config.cookies_consent.text ||
|
||||
django.gettext('We use cookies to authenticate users and remember preferences.') +
|
||||
'<br/>' +
|
||||
django.gettext('If you do not agree, please') +
|
||||
' <a class="cc-link" href="https://www.cookiesandyou.com">' +
|
||||
django.gettext('leave this site') +
|
||||
'</a>.';
|
||||
|
||||
// Initialize cookie consent
|
||||
cookieconsent.initialise({
|
||||
onStatusChange: (status: string, chosenBefore: boolean) => {
|
||||
console.log('cookieconsent.onStatusChange', status, chosenBefore);
|
||||
console.log('This: ', this);
|
||||
console.log('CookieConsent: ', cookieconsent);
|
||||
if (cookieconsent.hasConsented()) {
|
||||
console.log('enable cookies');
|
||||
} else {
|
||||
alert('We need cookies to work, you will be redirected to an outside page');
|
||||
window.location.href = 'https://www.cookiesandyou.com';
|
||||
}
|
||||
console.log(cookieconsent.hasConsented() ? 'enable cookies' : 'disable cookies');
|
||||
},
|
||||
palette: {
|
||||
popup: {
|
||||
background: '#343c66',
|
||||
text: '#cfcfe8',
|
||||
text: '#dfdfe8',
|
||||
},
|
||||
button: {
|
||||
background: '#f71559',
|
||||
},
|
||||
},
|
||||
enabled: this.api.config.cookies_consent.enabled,
|
||||
layout: 'basic',
|
||||
position: 'bottom-right',
|
||||
theme: 'classic',
|
||||
revokable: true,
|
||||
type: 'info',
|
||||
content: {
|
||||
message: django.gettext('We use cookies to track usage and preferences'),
|
||||
dismiss: django.gettext('I Understand'),
|
||||
message: message,
|
||||
dismiss: django.gettext('I Accept'),
|
||||
//deny: django.gettext('Refuse and leave'),
|
||||
//allow: django.gettext('I Accept'),
|
||||
link: django.gettext('Learn more'),
|
||||
href: 'https://www.cookiesandyou.com',
|
||||
policy: django.gettext('Cookie Policy'),
|
||||
close: '❌',
|
||||
target: '_blank',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -40,6 +40,11 @@ export interface UDSMessages {
|
||||
readonly calendar_denied: string;
|
||||
}
|
||||
|
||||
export interface CookiesConsent {
|
||||
text: string;
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
export interface MFAInfo {
|
||||
label: string;
|
||||
validity: number;
|
||||
@ -66,6 +71,7 @@ export interface UDSConfig {
|
||||
readonly messages: UDSMessages;
|
||||
readonly urls: UDSUrls;
|
||||
readonly min_for_filter: number;
|
||||
readonly cookies_consent: CookiesConsent;
|
||||
}
|
||||
|
||||
export interface Downloadable {
|
||||
|
Loading…
Reference in New Issue
Block a user