This commit is contained in:
Diamantis Tziotzios 2024-01-24 16:17:06 +02:00
parent a1849c64ca
commit cc7edc2f49
7 changed files with 176 additions and 27 deletions

View File

@ -5,7 +5,33 @@
<app-sidebar></app-sidebar> <app-sidebar></app-sidebar>
</mat-sidenav> </mat-sidenav>
<mat-sidenav-content class="sidenav-content"> <mat-sidenav-content class="sidenav-content">
<div id="main-page"> <div id="main-page" >
<div class="main-content h-100 pb-0" *ngIf="newReleaseNotificationVisible">
<div class="container-fluid">
<div class="d-flex flex-direction-row">
<div class="card notification-header">
<div class="col">
<div class="row">
<div class="col-auto info">
<div class="notification-title">{{'NEW-RELEASE-NOTIFICATION.TITLE' | translate}}</div>
<div class="notification-subtitle" *ngIf="!this.configurationService.newReleaseNotificationLink">{{'NEW-RELEASE-NOTIFICATION.SUBTITLE' | translate}}</div>
<div class="notification-subtitle" *ngIf="this.configurationService.newReleaseNotificationLink">{{'NEW-RELEASE-NOTIFICATION.SUBTITLE-WITH-PRE-LINK' | translate }} <a class="notification-link" href="{{this.configurationService.newReleaseNotificationLink}}" target="_blank">{{'NEW-RELEASE-NOTIFICATION.SUBTITLE-LINK-TEXT' | translate }}</a> {{'NEW-RELEASE-NOTIFICATION.SUBTITLE-WITH-AFTER-LINK' | translate }}</div>
</div>
<div class="ml-auto d-flex flex-row">
<div class="col-auto d-flex align-items-center">
<div>
<button mat-raised-button class="notification-save-btn" (click)="dismissNewReleaseNotification()">
{{'NEW-RELEASE-NOTIFICATION.ACTIONS.DISMISS' | translate}}
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<router-outlet (activate)='onActivate($event)' (deactivate)='onDeactivate($event)'></router-outlet> <router-outlet (activate)='onActivate($event)' (deactivate)='onDeactivate($event)'></router-outlet>
</div> </div>
</mat-sidenav-content> </mat-sidenav-content>
@ -25,7 +51,4 @@
<app-notification *ngIf="!onlySplash"></app-notification> <app-notification *ngIf="!onlySplash"></app-notification>
<router-outlet *ngIf="onlySplash"></router-outlet> <router-outlet *ngIf="onlySplash"></router-outlet>
<ngx-guided-tour <ngx-guided-tour [skipText]="'DASHBOARD.TOUR-GUIDE.LEAVE-TOUR'| translate" [nextText]="'DASHBOARD.TOUR-GUIDE.GOT-IT'| translate"></ngx-guided-tour>
[skipText]="'DASHBOARD.TOUR-GUIDE.LEAVE-TOUR'| translate"
[nextText]="'DASHBOARD.TOUR-GUIDE.GOT-IT'| translate"
></ngx-guided-tour>

View File

@ -40,3 +40,70 @@
::ng-deep .mat-chip { ::ng-deep .mat-chip {
height: auto !important; height: auto !important;
} }
.notification-header {
height: 64px;
background: var(--unnamed-color-var(--primary-color)) 0% 0% no-repeat padding-box;
background: var(--primary-color) 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 6px #00000029;
padding: 0.6rem;
margin: 30px 0px 0px 0px;
border-radius: 4px;
opacity: 1;
.info {
flex: 2;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.notification-discard-btn {
background: transparent;
border: 1px solid #ffffff;
color: white;
border-radius: 30px;
opacity: 1;
width: 110px;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
}
.notification-title {
text-align: left;
font-weight: 400;
font-size: 14px;
color: #ffffff;
opacity: 0.75;
}
.notification-subtitle {
text-align: left;
color: #ffffff;
font-weight: 700;
font-size: 16px;
opacity: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.notification-link {
color: #ffffff;
text-decoration: underline;
}
.notification-save-btn {
background: #ffffff 0% 0% no-repeat padding-box !important;
border-radius: 30px;
opacity: 1;
width: 110px;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
font-weight: 700;
color: var(--primary-color);
}

View File

@ -20,6 +20,8 @@ import { MatomoInjector } from 'ngx-matomo';
import { MatomoService } from './core/services/matomo/matomo-service'; import { MatomoService } from './core/services/matomo/matomo-service';
import { SideNavService } from './core/services/sidenav/side-nav.sevice'; import { SideNavService } from './core/services/sidenav/side-nav.sevice';
import { MatSidenav } from '@angular/material/sidenav'; import { MatSidenav } from '@angular/material/sidenav';
import { runInThisContext } from 'vm';
import * as moment from 'moment';
declare const gapi: any; declare const gapi: any;
@ -38,8 +40,9 @@ export class AppComponent implements OnInit, AfterViewInit {
helpContentEnabled: boolean; helpContentEnabled: boolean;
private statusChangeSubscription: Subscription; private statusChangeSubscription: Subscription;
onlySplash = true; onlySplash = true;
newReleaseNotificationVisible = false;
@ViewChild('sidenav') sidenav:MatSidenav; @ViewChild('sidenav') sidenav: MatSidenav;
constructor( constructor(
private router: Router, private router: Router,
@ -52,7 +55,7 @@ export class AppComponent implements OnInit, AfterViewInit {
private cookieService: CookieService, private cookieService: CookieService,
private ccService: NgcCookieConsentService, private ccService: NgcCookieConsentService,
private language: LanguageService, private language: LanguageService,
private configurationService: ConfigurationService, public configurationService: ConfigurationService,
private location: Location, private location: Location,
private matomoService: MatomoService, private matomoService: MatomoService,
private sidenavService: SideNavService private sidenavService: SideNavService
@ -63,37 +66,38 @@ export class AppComponent implements OnInit, AfterViewInit {
} }
ngAfterViewInit(): void { ngAfterViewInit(): void {
setTimeout(() => { setTimeout(() => {
this.sideNavSubscription = this.sidenavService.status().subscribe(isopen=>{ this.sideNavSubscription = this.sidenavService.status().subscribe(isopen => {
const hamburger = document.getElementById('hamburger'); const hamburger = document.getElementById('hamburger');
if(isopen){ if (isopen) {
//update value of hamburfer //update value of hamburfer
if(!hamburger){//try later if (!hamburger) {//try later
setTimeout(() => { setTimeout(() => {
const hamburger = document.getElementById('hamburger'); const hamburger = document.getElementById('hamburger');
if(hamburger){ if (hamburger) {
hamburger.classList.add('change'); hamburger.classList.add('change');
} }
}, 300); }, 300);
}else{ } else {
hamburger.classList.add('change'); hamburger.classList.add('change');
} }
this.sidenav.open() this.sidenav.open()
}else{//closed } else {//closed
if(!hamburger){//try later if (!hamburger) {//try later
setTimeout(() => { setTimeout(() => {
const hamburger = document.getElementById('hamburger'); const hamburger = document.getElementById('hamburger');
if(hamburger){ if (hamburger) {
hamburger.classList.remove('change'); hamburger.classList.remove('change');
} }
}, 300); }, 300);
}else{ } else {
hamburger.classList.remove('change'); hamburger.classList.remove('change');
} }
this.sidenav.close(); this.sidenav.close();
} }
}); });
}); });
this.newReleaseNotificationVisible = this.isNewReleaseNotificationVisible();
} }
onActivate(event: any) { onActivate(event: any) {
@ -120,8 +124,8 @@ export class AppComponent implements OnInit, AfterViewInit {
} }
if (!this.cookieService.check("cookiesConsent")) { if (!this.cookieService.check("cookiesConsent")) {
// this.cookieService.set("cookiesConsent", "false", 356); // this.cookieService.set("cookiesConsent", "false", 356);
this.cookieService.set("cookiesConsent", "false", 356,null,null,false, 'Lax'); this.cookieService.set("cookiesConsent", "false", 356, null, null, false, 'Lax');
} }
this.hasBreadCrumb = this.router.events.pipe( this.hasBreadCrumb = this.router.events.pipe(
@ -155,7 +159,7 @@ export class AppComponent implements OnInit, AfterViewInit {
this.statusChangeSubscription = this.ccService.statusChange$.subscribe((event: NgcStatusChangeEvent) => { this.statusChangeSubscription = this.ccService.statusChange$.subscribe((event: NgcStatusChangeEvent) => {
if (event.status == "dismiss") { if (event.status == "dismiss") {
// this.cookieService.set("cookiesConsent", "true", 365); // this.cookieService.set("cookiesConsent", "true", 365);
this.cookieService.set("cookiesConsent", "true", 356,null,null,false, 'Lax'); this.cookieService.set("cookiesConsent", "true", 356, null, null, false, 'Lax');
} }
}); });
@ -177,7 +181,7 @@ export class AppComponent implements OnInit, AfterViewInit {
} }
this.ccService.destroy(); this.ccService.destroy();
this.ccService.init(this.ccService.getConfig()); this.ccService.init(this.ccService.getConfig());
}); });
} }
translateTitle(ttl: string) { translateTitle(ttl: string) {
@ -196,7 +200,7 @@ export class AppComponent implements OnInit, AfterViewInit {
ngOnDestroy() { ngOnDestroy() {
this.statusChangeSubscription.unsubscribe(); this.statusChangeSubscription.unsubscribe();
if(this.sideNavSubscription){ if (this.sideNavSubscription) {
this.sideNavSubscription.unsubscribe(); this.sideNavSubscription.unsubscribe();
} }
} }
@ -232,5 +236,27 @@ export class AppComponent implements OnInit, AfterViewInit {
toggleNavbar(event) { toggleNavbar(event) {
document.getElementById('hamburger').classList.toggle("change"); document.getElementById('hamburger').classList.toggle("change");
} }
dismissNewReleaseNotification() {
this.cookieService.set('new-release-dismiss-' + this.configurationService.newReleaseNotificationVersionCode, 'true', 5000, null, null, false, 'Lax');
this.newReleaseNotificationVisible = false;
}
isNewReleaseNotificationVisible() {
if (this.configurationService.newReleaseNotificationVersionCode == null) {
return false;
}
if (this.configurationService.newReleaseNotificationExpires == null && this.configurationService.newReleaseNotificationLink == null) {
return false;
}
if (this.configurationService.newReleaseNotificationExpires != null && moment(this.configurationService.newReleaseNotificationExpires).tz('UTC') < moment.utc()) {
return false;
}
if (this.cookieService.get('new-release-dismiss-' + this.configurationService.newReleaseNotificationVersionCode) === 'true') {
return false;
}
return true;
}
} }

View File

@ -101,6 +101,21 @@ export class ConfigurationService extends BaseComponent {
return this._maxFileSizeInMB; return this._maxFileSizeInMB;
} }
private _newReleaseNotificationLink: number;
get newReleaseNotificationLink(): number {
return this._newReleaseNotificationLink;
}
private _newReleaseNotificationExpires: number;
get newReleaseNotificationExpires(): number {
return this._newReleaseNotificationExpires;
}
private _newReleaseNotificationVersionCode: number;
get newReleaseNotificationVersionCode(): number {
return this._newReleaseNotificationVersionCode;
}
public loadConfiguration(): Promise<any> { public loadConfiguration(): Promise<any> {
return new Promise((r, e) => { return new Promise((r, e) => {
@ -146,6 +161,9 @@ export class ConfigurationService extends BaseComponent {
this._matomoSiteId = config.matomo.siteId; this._matomoSiteId = config.matomo.siteId;
} }
this._maxFileSizeInMB = config.maxFileSizeInMB; this._maxFileSizeInMB = config.maxFileSizeInMB;
this._newReleaseNotificationExpires = config.newReleaseNotification?.expires;
this._newReleaseNotificationLink = config.newReleaseNotification?.link;
this._newReleaseNotificationVersionCode = config.newReleaseNotification?.versionCode;
} }
} }

View File

@ -917,7 +917,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
} }
const templates: Array<DmpDatasetProfile> = new Array<DmpDatasetProfile>(); const templates: Array<DmpDatasetProfile> = new Array<DmpDatasetProfile>();
this.selectedDmpBlueprintDefinition.sections.forEach(section => { this.selectedDmpBlueprintDefinition.sections.forEach(section => {
if (profiles !== undefined) { if (profiles != null) {
profiles.filter(profile => profile.data.dmpSectionIndex.includes(section.ordinal - 1)).forEach(profile => this.sectionTemplates[section.ordinal - 1].push({ id: profile.descriptionTemplateId, label: profile.label, description: "" })); profiles.filter(profile => profile.data.dmpSectionIndex.includes(section.ordinal - 1)).forEach(profile => this.sectionTemplates[section.ordinal - 1].push({ id: profile.descriptionTemplateId, label: profile.label, description: "" }));
} }
else { else {

View File

@ -105,5 +105,10 @@
"allowOrganizationCreator": true, "allowOrganizationCreator": true,
"useSplash": false, "useSplash": false,
"orcidPath": "https://orcid.org/", "orcidPath": "https://orcid.org/",
"maxFileSizeInMB": 10 "maxFileSizeInMB": 10,
"newReleaseNotification": {
"link": "https://google.com",
"versionCode": "0",
"expires": "2024-01-28T00:00"
}
} }

View File

@ -1983,5 +1983,15 @@
"DRAFT": "Draft", "DRAFT": "Draft",
"FINALIZED": "Finalized", "FINALIZED": "Finalized",
"DELETED": "Deleted" "DELETED": "Deleted"
},
"NEW-RELEASE-NOTIFICATION": {
"TITLE": "New ARGOS Release!",
"SUBTITLE": "Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum.",
"SUBTITLE-WITH-PRE-LINK": "Check all the new features ",
"SUBTITLE-WITH-AFTER-LINK": ".",
"SUBTITLE-LINK-TEXT": "here",
"ACTIONS": {
"DISMISS": "Dismiss"
}
} }
} }