diff --git a/src/app/admin/users/user-minimal.service.ts b/src/app/admin/users/user-minimal.service.ts index 279fb8a55..d7f22f385 100644 --- a/src/app/admin/users/user-minimal.service.ts +++ b/src/app/admin/users/user-minimal.service.ts @@ -43,4 +43,12 @@ export class UserMinimalService { )?.name; return username; } + + setHasSeenWelcomeScreen(): void { + localStorage.setItem('hasSeenWelcomeScreen', true.toString()); + } + + getHasSeenWelcomeScreen(): boolean { + return !!localStorage.getItem('hasSeenWelcomeScreen'); + } } diff --git a/src/app/admin/users/user.model.ts b/src/app/admin/users/user.model.ts index aa93e1ffc..2ac0b91cb 100644 --- a/src/app/admin/users/user.model.ts +++ b/src/app/admin/users/user.model.ts @@ -7,6 +7,7 @@ export class UserRequest { password: string; active: boolean; globalAdmin: boolean; + showWelcomeScreen: boolean; } export interface UserResponse { @@ -23,9 +24,10 @@ export interface UserResponse { active: boolean; lastLogin: Date; permissions: PermissionResponse[]; + showWelcomeScreen: boolean; } export interface UserGetManyResponse { data: UserResponse[]; count: number; -} \ No newline at end of file +} diff --git a/src/app/admin/users/user.service.ts b/src/app/admin/users/user.service.ts index a2a799dc8..c60933e06 100644 --- a/src/app/admin/users/user.service.ts +++ b/src/app/admin/users/user.service.ts @@ -63,4 +63,8 @@ export class UserService { }); } } + + hideWelcome(id: number): Observable { + return this.restService.put(`${this.URL}/${id}/hide-welcome`, null, null); + } } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 050a11330..97266391f 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,7 +1,6 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule, PreloadAllModules } from '@angular/router'; import { AuthComponent } from './auth/auth.component'; -import { DashboardComponent } from './dashboard/dashboard.component'; import { ErrorPageComponent } from './error-page/error-page.component'; import { SearchComponent } from './search/search.component'; import { AuthGuardService as AuthGuard } from './auth/auth-guard.service'; @@ -9,7 +8,6 @@ import { AuthGuardService as AuthGuard } from './auth/auth-guard.service'; const routes: Routes = [ { path: 'admin', loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule), canActivate: [AuthGuard] }, { path: 'auth', component: AuthComponent }, - { path: 'dashboard', component: DashboardComponent, canActivate: [AuthGuard] }, { path: 'applications', loadChildren: () => import('./applications/applications.module').then(m => m.ApplicationsModule), canActivate: [AuthGuard] }, { path: 'gateways', loadChildren: () => import('./gateway/gateway.module').then(m => m.GatewayModule), canActivate: [AuthGuard] }, { path: 'profiles', loadChildren: () => import('./profiles/profiles.module').then(m => m.ProfilesModule), canActivate: [AuthGuard] }, @@ -19,7 +17,7 @@ const routes: Routes = [ { path: 'search', component: SearchComponent, canActivate: [AuthGuard] }, { path: 'not-found', component: ErrorPageComponent, data: { message: 'not-found', code: 404 } }, { path: 'not-authorized', component: ErrorPageComponent }, - { path: '', redirectTo: '/dashboard', pathMatch: 'full' }, + { path: '', redirectTo: '/applications', pathMatch: 'full' }, { path: '**', redirectTo: '/not-found', pathMatch: 'full' } ]; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 95617f8b0..f691a7088 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -12,7 +12,6 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { ProfilesModule } from './profiles/profiles.module'; import { AuthJwtInterceptor } from '@shared/helpers/auth-jwt.interceptor'; import { AuthModule } from './auth/auth.module'; -import { DashboardModule } from './dashboard/dashboard.module'; import { GatewayModule } from './gateway/gateway.module'; import { SharedVariableModule } from '@shared/shared-variable/shared-variable.module'; import { SAVER, getSaver } from '@shared/providers/saver.provider'; @@ -24,6 +23,7 @@ import { MatInputModule } from '@angular/material/input'; import { MatPaginatorIntl } from '@angular/material/paginator'; import { MatPaginatorIntlDa } from '@shared/helpers/mat-paginator-intl-da'; import { MatTooltipModule } from '@angular/material/tooltip'; +import { WelcomeDialogModule } from '@shared/components/welcome-dialog/welcome-dialog.module'; export function HttpLoaderFactory(http: HttpClient) { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); @@ -45,7 +45,6 @@ export function tokenGetter() { BrowserAnimationsModule, HttpClientModule, AppRoutingModule, - DashboardModule, NavbarModule, ProfilesModule, TranslateModule.forRoot({ @@ -70,6 +69,7 @@ export function tokenGetter() { }, }), MonacoEditorModule.forRoot(), + WelcomeDialogModule, ], bootstrap: [AppComponent], exports: [TranslateModule], diff --git a/src/app/applications/applications-list/applications-list.component.html b/src/app/applications/applications-list/applications-list.component.html index 8e1ca4949..46776e59e 100644 --- a/src/app/applications/applications-list/applications-list.component.html +++ b/src/app/applications/applications-list/applications-list.component.html @@ -1,14 +1,31 @@ + +
+
+
+ +
+

{{'WELCOME-DIALOG.WELCOME' | translate}}

+

{{'WELCOME-DIALOG.NO-ACCESS' | translate}}

+
+
+
+
+
+
+ [ctaRouterLink]="'new-application'"> -
-
-
-
- - +
+ + +
+
+
+ +
+
-
-
-
\ No newline at end of file + + + +
diff --git a/src/app/applications/applications-list/applications-list.component.ts b/src/app/applications/applications-list/applications-list.component.ts index 1e9bab84c..34660b5d6 100644 --- a/src/app/applications/applications-list/applications-list.component.ts +++ b/src/app/applications/applications-list/applications-list.component.ts @@ -1,14 +1,16 @@ -import { - Component, - OnInit, - Input, -} from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; import { Title } from '@angular/platform-browser'; +import { ActivatedRoute, Router } from '@angular/router'; +import { UserMinimalService } from '@app/admin/users/user-minimal.service'; import { NavbarComponent } from '@app/navbar/navbar.component'; import { Application } from '@applications/application.model'; +import { AuthService } from '@auth/auth.service'; import { environment } from '@environments/environment'; import { TranslateService } from '@ngx-translate/core'; +import { WelcomeDialogComponent } from '@shared/components/welcome-dialog/welcome-dialog.component'; import { SharedVariableService } from '@shared/shared-variable/shared-variable.service'; +import { WelcomeDialogModel } from '@shared/models/dialog.model'; @Component({ providers: [NavbarComponent], @@ -17,31 +19,116 @@ import { SharedVariableService } from '@shared/shared-variable/shared-variable.s styleUrls: ['./applications-list.component.scss'], }) export class ApplicationsListComponent implements OnInit { - isLoadingResults = false; + isLoadingResults = true; public pageLimit = environment.tablePageSize; public resultsLength: number; public pageOffset = 0; public applications: Application[]; @Input() organizationId: number; + private unauthorizedMessage: string; + private kombitError: string; + private noAccess: string; + hasSomePermission: boolean; + isGlobalAdmin = false; constructor( public translate: TranslateService, private titleService: Title, - private globalService: SharedVariableService + private sharedVariableService: SharedVariableService, + private authService: AuthService, + private route: ActivatedRoute, + private router: Router, + private dialog: MatDialog, + private userMinimalService: UserMinimalService ) { translate.use('da'); } ngOnInit(): void { - this.translate.get(['TITLE.APPLICATION']) - .subscribe(translations => { - this.titleService.setTitle(translations['TITLE.APPLICATION']); - }); - this.organizationId = this.globalService.getSelectedOrganisationId(); + this.translate.get(['TITLE.APPLICATION']).subscribe((translations) => { + this.titleService.setTitle(translations['TITLE.APPLICATION']); + }); + this.organizationId = this.sharedVariableService.getSelectedOrganisationId(); + + // Authenticate user + this.verifyUserAndInit(); } - updatePageLimit(limit: any) { - console.log(limit); + verifyUserAndInit() { + this.route.queryParams.subscribe(async (params) => { + await this.translate + .get([ + 'WELCOME-DIALOG.NO-JOB-ACCESS', + 'TITLE.FRONTPAGE', + 'WELCOME-DIALOG.KOMBIT-LOGIN-ERROR', + 'WELCOME-DIALOG.USER-INACTIVE', + ]) + .toPromise() + .then((translations) => { + this.unauthorizedMessage = translations['WELCOME-DIALOG.NO-JOB-ACCESS']; + this.kombitError = translations['WELCOME-DIALOG.KOMBIT-LOGIN-ERROR']; + this.noAccess = translations['WELCOME-DIALOG.USER-INACTIVE']; + this.titleService.setTitle(translations['TITLE.FRONTPAGE']); + }); + // this is used when a user is returned from Kombit login + const jwt = params['jwt']; + if (jwt) { + this.authService.setSession(jwt); + // Clear the URL from the parameter + this.router.navigate(['/applications']); + } else { + const error = params['error']; + if (error) { + if ( + error === 'MESSAGE.KOMBIT-LOGIN-FAILED' || + error === 'MESSAGE.API-KEY-AUTH-FAILED' + ) { + this.router.navigate(['/not-authorized'], { + state: { message: this.kombitError, code: 401 }, + }); + } else if (error === 'MESSAGE.USER-INACTIVE') { + this.router.navigate(['/not-authorized'], { + state: { message: this.noAccess, code: 401 }, + }); + } else { + this.router.navigate(['/not-authorized'], { + state: { message: this.unauthorizedMessage, code: 401 }, + }); + } + } + } + + const userInfo = await this.sharedVariableService.setUserInfo(); + this.isGlobalAdmin = this.sharedVariableService.isGlobalAdmin(); + const hasSeenWelcomeScreen = this.userMinimalService.getHasSeenWelcomeScreen(); + this.hasSomePermission = this.sharedVariableService.getHasAnyPermission(); + + if ( + !this.hasSomePermission || + (!this.isGlobalAdmin && + !hasSeenWelcomeScreen && + userInfo?.user?.showWelcomeScreen) + ) { + this.userMinimalService.setHasSeenWelcomeScreen(); + + this.dialog.open(WelcomeDialogComponent, { + disableClose: true, + closeOnNavigation: true, + panelClass: 'welcome-screen', + maxWidth: '60vw', + data: { + hasSomePermission: this.hasSomePermission, + } as WelcomeDialogModel + }); + } + + if (this.hasSomePermission) { + await this.sharedVariableService.setOrganizationInfo(); + this.userMinimalService.setUserMinimalList(); + } + + this.isLoadingResults = false; + }); } } diff --git a/src/app/auth/auth.component.ts b/src/app/auth/auth.component.ts index 0110fa474..0f355ed22 100644 --- a/src/app/auth/auth.component.ts +++ b/src/app/auth/auth.component.ts @@ -35,7 +35,7 @@ export class AuthComponent implements OnInit { ngOnInit(): void {} getKombitLoginUrl() { - const frontpage = encodeURI(window.location.origin + '/dashboard'); + const frontpage = encodeURI(window.location.origin + '/applications'); return `${environment.baseUrl}auth/kombit/login?redirect=${frontpage}`; } @@ -49,7 +49,7 @@ export class AuthComponent implements OnInit { this.userMinimalService.setUserMinimalList(); this.isLoading = false; this.loggedinService.emitChange(true); - this.router.navigateByUrl('/dashboard'); + this.router.navigateByUrl('/applications'); } fail() { diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html deleted file mode 100644 index 8425e3a99..000000000 --- a/src/app/dashboard/dashboard.component.html +++ /dev/null @@ -1,73 +0,0 @@ -
- -
-
-
- - -
-
-
-

- -
-

{{'DASHBOARD.WELCOME' | translate}}

-

{{'DASHBOARD.WELCOME-SUB' | translate}}

-
-
- -
-
-

{{'DASHBOARD.LIST.HEADLINE' | translate}} -

-
    -
  • {{'DASHBOARD.LIST.P1' | translate}}
  • -
  • {{'DASHBOARD.LIST.P2' | translate}}
  • -
  • {{'DASHBOARD.LIST.P3' | translate}}
  • -
  • {{'DASHBOARD.LIST.P4' | translate}}
  • -
  • {{'DASHBOARD.LIST.P5' | translate}}
  • -
  • {{'DASHBOARD.LIST.P6' | translate}}
  • -
  • {{'DASHBOARD.LIST.P7' | translate}}
  • -
-
-
-

{{'DASHBOARD.SUB-HEADER-1' | translate}}

-

{{'DASHBOARD.WELCOME-MESSAGE' | translate}}{{'DASHBOARD.LINK-1' | - translate}}{{'DASHBOARD.WELCOME-MESSAGE-3' | translate}} -

-

{{'DASHBOARD.SUB-HEADER-2' | translate}}

-

{{'DASHBOARD.WELCOME-MESSAGE-2' | translate}}{{'DASHBOARD.LINK-2' | - translate}} -

-
-
-
-

- -
-
-
-
-
-
-
- -
-

{{'DASHBOARD.WELCOME' | translate}}

-

{{'DASHBOARD.NO-ACCESS' | translate}}

-
-
-
-
-
-
-
-
\ No newline at end of file diff --git a/src/app/dashboard/dashboard.component.scss b/src/app/dashboard/dashboard.component.scss deleted file mode 100644 index c39c88a03..000000000 --- a/src/app/dashboard/dashboard.component.scss +++ /dev/null @@ -1,96 +0,0 @@ -@import '~src/assets/scss/setup/breakpoints'; -@import '~src/assets/scss/setup/variables'; - -.header { - .heading-primary { - padding: 1rem; - color: $color-white-001; - backface-visibility: hidden; - - &--main { - font-weight: 400; - animation-name: slideInLeft; - animation-duration: 1s; - animation-timing-function: ease-out; - text-align: center; - h1 { - font-size: 3rem; - color: $color-white-001; - margin-bottom: 0 !important; - } - h2 { - color: $color-white-001; - } - } - - &--sub { - display: block; - font-size: 1rem; - font-weight: 500; - animation: slideInRight 1s ease-out; - white-space: pre-wrap; - line-height: 1.7rem; - p { - strong { - color: $color-white-001; - text-transform: uppercase; - } - color: $color-white-001; - margin-bottom: 0 !important; - margin-top: 0 !important; - &:nth-child(odd) { - margin-top: 1.5rem !important; - //margin-bottom: 0 !important; - } - a { - color: $color-white-001; - border-bottom: 1px $color-white-001 solid; - &:hover, - :visited { - color: darken($color-primary, 10%); - border-bottom: 1px darken($color-primary, 10%) solid; - } - } - } - - ul { - display: block; - list-style-type: disc; - margin-block-start: 0; - margin-block-end: 1em; - margin-inline-start: 0px; - margin-inline-end: 0px; - padding-inline-start: 40px; - li { - display: list-item; - list-style: disc; - font-weight: normal; - } - } - } - } - - background-color: $color-green-001; - background-size: cover; - background-position: top; - position: relative; - - @supports (clip-path: polygon(0 0)) or (-webkit-clip-path: polygon(0 0)) { - -webkit-clip-path: polygon(0 0, 100% 0, 100% 80%, 0 100%); - clip-path: polygon(0 0, 100% 0, 100% 80%, 0 100%); - height: 120%; - } - - &__logo-box { - position: absolute; - bottom: 1vh; - right: 4rem; - @include media-breakpoint-up(md) { - bottom: 5vh; - } - } - - &__logo { - height: 3.5rem; - } -} diff --git a/src/app/dashboard/dashboard.component.spec.ts b/src/app/dashboard/dashboard.component.spec.ts deleted file mode 100644 index 9c996c371..000000000 --- a/src/app/dashboard/dashboard.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DashboardComponent } from './dashboard.component'; - -describe('DashboardComponent', () => { - let component: DashboardComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ DashboardComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DashboardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts deleted file mode 100644 index a071e8caf..000000000 --- a/src/app/dashboard/dashboard.component.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { Title } from '@angular/platform-browser'; -import { ActivatedRoute, Router } from '@angular/router'; -import { UserMinimalService } from '@app/admin/users/user-minimal.service'; -import { AuthService } from '@auth/auth.service'; -import { TranslateService } from '@ngx-translate/core'; -import { SharedVariableService } from '@shared/shared-variable/shared-variable.service'; - -@Component({ - selector: 'app-dashboard', - templateUrl: './dashboard.component.html', - styleUrls: ['./dashboard.component.scss'], -}) -export class DashboardComponent implements OnInit { - unauthorizedMessage: string; - kombitError: string; - noAccess: string; - isLoadingResults = true; - hasSomePermission: boolean; - isGlobalAdmin = false; - - constructor( - private route: ActivatedRoute, - private authService: AuthService, - private router: Router, - private sharedVariableService: SharedVariableService, - private translate: TranslateService, - private titleService: Title, - private userMinimalService: UserMinimalService, - ) { - this.route.queryParams.subscribe(async (params) => { - this.translate.use('da'); - await this.translate.get(['DASHBOARD.NO-JOB-ACCESS','TITLE.FRONTPAGE', 'DASHBOARD.KOMBIT-LOGIN-ERROR','DASHBOARD.USER-INACTIVE']) - .toPromise() - .then(translations => { - this.unauthorizedMessage = translations['DASHBOARD.NO-JOB-ACCESS']; - this.kombitError = translations['DASHBOARD.KOMBIT-LOGIN-ERROR']; - this.noAccess = translations['DASHBOARD.USER-INACTIVE']; - this.titleService.setTitle(translations['TITLE.FRONTPAGE']); - } - ); - // this is used when a user is returned from Kombit login - const jwt = params['jwt']; - if (jwt) { - this.authService.setSession(jwt); - // Clear the URL from the parameter - this.router.navigate(['/dashboard']); - } else { - const error = params['error']; - if (error) { - if (error == "MESSAGE.KOMBIT-LOGIN-FAILED" || error == "MESSAGE.API-KEY-AUTH-FAILED") { - this.router.navigate(['/not-authorized'], { state: { message: this.kombitError, code: 401 } }); - } if (error == "MESSAGE.USER-INACTIVE") { - this.router.navigate(['/not-authorized'], { state: { message: this.noAccess, code: 401 } }); - } else { - this.router.navigate(['/not-authorized'], { state: { message: this.unauthorizedMessage, code: 401 } }); - } - } - } - await this.sharedVariableService.setUserInfo(); - await this.sharedVariableService.setOrganizationInfo(); - this.userMinimalService.setUserMinimalList() - this.hasSomePermission = this.sharedVariableService.getHasAnyPermission(); - this.isGlobalAdmin = this.sharedVariableService.isGlobalAdmin(); - this.isLoadingResults = false; - }); - } - - ngOnInit(): void { } -} diff --git a/src/app/dashboard/dashboard.module.ts b/src/app/dashboard/dashboard.module.ts deleted file mode 100644 index 035d83f84..000000000 --- a/src/app/dashboard/dashboard.module.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { DashboardComponent } from './dashboard.component'; -import { SharedModule } from '@shared/shared.module'; -import { RouterModule } from '@angular/router'; - - -@NgModule({ - declarations: [ - DashboardComponent - ], - imports: [ - CommonModule, - SharedModule, - RouterModule - ], -}) -export class DashboardModule { } diff --git a/src/app/navbar/navbar.component.html b/src/app/navbar/navbar.component.html index fb872d4c2..968f95373 100644 --- a/src/app/navbar/navbar.component.html +++ b/src/app/navbar/navbar.component.html @@ -1,9 +1,9 @@ \ No newline at end of file + diff --git a/src/app/shared/components/welcome-dialog/welcome-dialog.component.html b/src/app/shared/components/welcome-dialog/welcome-dialog.component.html new file mode 100644 index 000000000..9a1e136d7 --- /dev/null +++ b/src/app/shared/components/welcome-dialog/welcome-dialog.component.html @@ -0,0 +1,42 @@ +
+

X

+
+
+
+

+ {{'WELCOME-DIALOG.WELCOME' | translate}} +

+

{{ (dialogModel?.hasSomePermission ? 'WELCOME-DIALOG.WELCOME-SUB' : 'WELCOME-DIALOG.NO-ACCESS') | translate}}

+
+
+

{{'WELCOME-DIALOG.SUB-HEADER-1' | translate}}

+

{{'WELCOME-DIALOG.WELCOME-MESSAGE' | translate}} + + {{'WELCOME-DIALOG.LINK-1' | + translate}} + {{'WELCOME-DIALOG.WELCOME-MESSAGE-2' | translate}} +

+

{{'WELCOME-DIALOG.SUB-HEADER-2' | translate}}

+

{{'WELCOME-DIALOG.WELCOME-MESSAGE-3' | translate}} + + {{'WELCOME-DIALOG.LINK-2' | + translate}} + . + + {{'WELCOME-DIALOG.WELCOME-MESSAGE-4' | translate}} + + {{'WELCOME-DIALOG.LINK-3' | + translate}}. + +

+
+
+ + +
+
+{{ + 'DIALOG.WELCOME.DONT-SHOW-AGAIN' | translate}} diff --git a/src/app/shared/components/welcome-dialog/welcome-dialog.component.scss b/src/app/shared/components/welcome-dialog/welcome-dialog.component.scss new file mode 100644 index 000000000..72d4cb2a9 --- /dev/null +++ b/src/app/shared/components/welcome-dialog/welcome-dialog.component.scss @@ -0,0 +1,65 @@ +@import '~src/assets/scss/setup/variables'; + +$spacing: 5rem; + +.container { + padding-left: $spacing; + padding-right: $spacing; +} + +.header { + h1 { + font-size: 3rem; + color: $color-white-001; + margin-bottom: 0 !important; + } + h2 { + color: $color-white-001; + } +} + +.mat-dialog-content { + p { + &.sub-header { + strong { + color: $color-white-001; + font-size: 1.5rem; + } + margin-bottom: 1rem !important; + } + + color: $color-white-001; + margin-bottom: 0 !important; + margin-top: 0 !important; + &:nth-child(odd) { + margin-top: 1.5rem !important; + } + a { + color: $color-white-001; + border-bottom: 1px $color-white-001 solid; + &:hover, + :visited { + color: darken($color-primary, 10%); + border-bottom: 1px darken($color-primary, 10%) solid; + } + } + } +} + +.btn.ok { + margin-top: 5rem; + margin-bottom: 1rem; + + background-color: #f79267; + color: $color-white-001; + padding-left: 2rem; + padding-right: 2rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; +} + +.close-symbol { + color: $color-white-001; + cursor: pointer; + font-size: 2rem; +} diff --git a/src/app/shared/components/welcome-dialog/welcome-dialog.component.ts b/src/app/shared/components/welcome-dialog/welcome-dialog.component.ts new file mode 100644 index 000000000..7388c1649 --- /dev/null +++ b/src/app/shared/components/welcome-dialog/welcome-dialog.component.ts @@ -0,0 +1,35 @@ +import { Component, Inject, OnInit } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { UserService } from '@app/admin/users/user.service'; +import { WelcomeDialogModel } from '@shared/models/dialog.model'; +import { SharedVariableService } from '@shared/shared-variable/shared-variable.service'; + +@Component({ + selector: 'app-welcome-dialog', + templateUrl: './welcome-dialog.component.html', + styleUrls: ['./welcome-dialog.component.scss'], +}) +export class WelcomeDialogComponent implements OnInit { + dontShowAgain = false; + + constructor( + private dialog: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public dialogModel: WelcomeDialogModel, + private sharedVariableService: SharedVariableService, + private userService: UserService + ) {} + + ngOnInit(): void {} + + close(): void { + if (this.dontShowAgain) { + const userResponse = this.sharedVariableService.getUserInfo(); + this.userService.hideWelcome(userResponse.user.id).subscribe( + (_response) => {}, + (_error) => {} + ); + } + + this.dialog.close(); + } +} diff --git a/src/app/shared/components/welcome-dialog/welcome-dialog.module.ts b/src/app/shared/components/welcome-dialog/welcome-dialog.module.ts new file mode 100644 index 000000000..51e1804a2 --- /dev/null +++ b/src/app/shared/components/welcome-dialog/welcome-dialog.module.ts @@ -0,0 +1,19 @@ +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; +import { NGMaterialModule } from '@shared/Modules/materiale.module'; +import { SharedModule } from '@shared/shared.module'; +import { WelcomeDialogComponent } from './welcome-dialog.component'; + +@NgModule({ + declarations: [WelcomeDialogComponent], + imports: [ + CommonModule, + SharedModule, + RouterModule, + NGMaterialModule, + FormsModule, + ], +}) +export class WelcomeDialogModule {} diff --git a/src/app/shared/models/dialog.model.ts b/src/app/shared/models/dialog.model.ts index fd54f8c18..14cf2b874 100644 --- a/src/app/shared/models/dialog.model.ts +++ b/src/app/shared/models/dialog.model.ts @@ -1,9 +1,13 @@ export class DialogModel { - infoTitle: string; - showOk = true; - showAccept = true; - showCancel = true; - message: string; - acceptText: string; - cancelText: string; + infoTitle: string; + showOk = true; + showAccept = true; + showCancel = true; + message: string; + acceptText: string; + cancelText: string; +} + +export class WelcomeDialogModel { + hasSomePermission: boolean; } diff --git a/src/assets/i18n/da.json b/src/assets/i18n/da.json index 88efc9499..273a64c6f 100644 --- a/src/assets/i18n/da.json +++ b/src/assets/i18n/da.json @@ -16,7 +16,6 @@ "to": "til" }, "NAV": { - "DASHBOARD": "Dashboard", "APPLICATIONS": "Applikationer", "APPLICATION": "Applikation", "ALL-IOT-DEVICES": "Alle IoT enheder", @@ -965,27 +964,18 @@ "PASSWORD": "Adgangskode", "KOMBIT-BUTTON": "Login med KOMBIT adgangsstyring" }, - "DASHBOARD": { + "WELCOME-DIALOG": { "WELCOME": "VELKOMMEN TIL OS2IoT", "WELCOME-SUB": " Din indgang til administration af IoT enheder", - "LINK-1": "OS2iot.os2.eu", - "LINK-2": "løsningens produktside", - "SUB-HEADER-1":"Community", + "LINK-1": "OS2iot's brugerforum", + "LINK-2": "produktsiden", + "LINK-3": "Github", + "SUB-HEADER-1":"Brugerforum", "SUB-HEADER-2": "Om OS2IOT", - "BUTTON":"Start med at oprette en organisation", - "LIST": { - "HEADLINE": "Med version 1.0 kan du:", - "P1": "Håndtere dine IoT enheder ét sted", - "P2":"Få et samlet overblik over dine IoT enheder på tværs af netværksteknologier ", - "P3":"Lave bulk import af IoT enheder", - "P4":"Oprette applikationer på tværs af organisationer", - "P5":"Genbruge dekodningsfunktioner og –scripts på tværs af organisationer", - "P6":"Dele gateways og data fra IoT enheder på tværs af organisationer", - "P7":"Let offentligøre dine data og meget mere." - }, - "WELCOME-MESSAGE": "Vi opfordrer dig til at blive en aktiv del af vores OS2iot community på ", - "WELCOME-MESSAGE-3": " og dele dine spørgsmål, udviklingsønsker og de fejl du måtte finde. Ved fælles hjælp bliver løsningen bedre.", - "WELCOME-MESSAGE-2": "OS2iot er en open source løsning organiseret igennem OS2-fællesskabet. Du kan derfor finde al yderligere information om OS2iot på ", + "WELCOME-MESSAGE": "Bliv en aktiv del af ", + "WELCOME-MESSAGE-2": ". Her kan du stille spørgsmål og indrapportere udviklingsønsker og de fejl, du måtte finde. Ved fælles hjælp bliver løsningen bedre.", + "WELCOME-MESSAGE-3": "OS2iot er en open source løsning organiseret igennem OS2-fællesskabet. Du kan derfor finde al yderligere information om OS2iot på ", + "WELCOME-MESSAGE-4": " og følge udviklingen på ", "NO-ACCESS": "Du har endnu ikke de fornødne rettigheder i OS2iot. Kontakt din administrator for at få tildelt rettigheder.", "NO-JOB-ACCESS": "Du har ikke passende jobfunktionsrolle, og har derfor ikke adgang til OS2IoT.", "KOMBIT-LOGIN-ERROR": "Der skete en fejl ved login via KOMBIT adgangsstyring. Prøv igen senere.", @@ -1006,6 +996,9 @@ "CLOSE": "Nej, tak", "TITLE": "Vil du sende data til OpenDataDK?", "MESSAGE": "Send en mail til OpendataDK så opretter de dit datasæt" + }, + "WELCOME": { + "DONT-SHOW-AGAIN": "Vis ikke igen" } }, "BATTERY": { diff --git a/src/styles.scss b/src/styles.scss index b2296fe21..1a1598761 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -89,3 +89,14 @@ body { font-size: 1rem !important; } +.welcome-screen .mat-dialog-container { + background-color: #55b156; +} + +.hide-checkbox { + color: $color-white-001; + + .mat-checkbox-frame { + border-color: $color-white-001; + } +}