Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
enasequence
webin-portal
Commits
6346a078
Commit
6346a078
authored
Oct 04, 2018
by
Rasko Leinonen
Browse files
Added redirect URL to the update request page: ena/submit/webin?page=update-request.
parent
6f0ad18c
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
67 additions
and
31 deletions
+67
-31
frontend/src/app/app.module.ts
frontend/src/app/app.module.ts
+1
-1
frontend/src/app/dashboard/dashboard.component.html
frontend/src/app/dashboard/dashboard.component.html
+4
-0
frontend/src/app/dashboard/dashboard.component.spec.ts
frontend/src/app/dashboard/dashboard.component.spec.ts
+10
-3
frontend/src/app/dashboard/dashboard.component.ts
frontend/src/app/dashboard/dashboard.component.ts
+20
-0
frontend/src/app/header/header.component.html
frontend/src/app/header/header.component.html
+1
-1
frontend/src/app/login/login.component.ts
frontend/src/app/login/login.component.ts
+11
-4
frontend/src/app/submit/submit.component.html
frontend/src/app/submit/submit.component.html
+1
-14
frontend/src/app/update-request/update-request.component.html
...tend/src/app/update-request/update-request.component.html
+3
-0
frontend/src/app/webin-authentication-guard.service.ts
frontend/src/app/webin-authentication-guard.service.ts
+10
-4
frontend/src/app/webin-authentication.interceptor.ts
frontend/src/app/webin-authentication.interceptor.ts
+1
-1
frontend/src/app/webin-authentication.service.ts
frontend/src/app/webin-authentication.service.ts
+5
-3
No files found.
frontend/src/app/app.module.ts
View file @
6346a078
...
...
@@ -74,7 +74,7 @@ const appRoutes: Routes = [
// Router
RouterModule
.
forRoot
(
appRoutes
,
{
enableTracing
:
tru
e
}
// <-- debugging purposes only
{
enableTracing
:
fals
e
}
// <-- debugging purposes only
),
],
declarations
:
[
...
...
frontend/src/app/dashboard/dashboard.component.html
View file @
6346a078
...
...
@@ -35,6 +35,10 @@
<app-report
#unsubmittedFiles
[reportType]=
"ReportType.unsubmittedFiles"
(reportChange)=
"consumeReportChange($event)"
></app-report>
</mat-tab>
<mat-tab
label=
"Update request"
>
<app-update-request></app-update-request>
</mat-tab>
</ng-container>
<ng-container
*ngIf=
"isEga()"
>
...
...
frontend/src/app/dashboard/dashboard.component.spec.ts
View file @
6346a078
...
...
@@ -13,8 +13,12 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import
{
UiModule
}
from
'
../ui/ui.module
'
;
import
{
WebinAuthenticationService
}
from
'
../webin-authentication.service
'
;
import
{
MockWebinAuthenticationService
}
from
'
../mock/mock-webin-authentication.service
'
;
import
{
UpdateRequestComponent
}
from
'
../update-request/update-request.component
'
;
import
{
MockReportComponent
}
from
'
../mock/mock-report.component
'
;
import
{
MockSubmitComponent
}
from
'
../mock/mock-submit.component
'
;
import
{
WebinRestService
}
from
'
../webin-rest.service
'
;
import
{
MockWebinRestService
}
from
'
../mock/mock-webin-rest.service
'
;
import
{
RouterTestingModule
}
from
'
@angular/router/testing
'
;
import
{
DashboardComponent
}
from
'
./dashboard.component
'
;
...
...
@@ -26,17 +30,20 @@ describe('DashboardComponent', () => {
TestBed
.
configureTestingModule
({
declarations
:
[
DashboardComponent
,
UpdateRequestComponent
,
MockReportComponent
,
MockSubmitComponent
,
],
imports
:
[
UiModule
,
],
imports
:
[
UiModule
,
RouterTestingModule
],
providers
:
[
{
provide
:
WebinAuthenticationService
,
useClass
:
MockWebinAuthenticationService
},
{
provide
:
WebinRestService
,
useClass
:
MockWebinRestService
},
]
})
.
compileComponents
();
...
...
frontend/src/app/dashboard/dashboard.component.ts
View file @
6346a078
...
...
@@ -11,6 +11,7 @@
import
{
Component
,
ViewEncapsulation
,
ViewChild
}
from
'
@angular/core
'
;
import
{
MatTabGroup
}
from
'
@angular/material/tabs
'
;
import
{
Router
,
ActivatedRoute
}
from
'
@angular/router
'
;
import
{
ReportComponent
}
from
'
../report/report.component
'
;
import
{
WebinAuthenticationService
}
from
'
../webin-authentication.service
'
;
import
{
ReportType
}
from
'
../report-type.enum
'
;
...
...
@@ -44,8 +45,27 @@ export class DashboardComponent {
@
ViewChild
(
'
datasets
'
)
datasets
:
ReportComponent
;
constructor
(
private
_router
:
Router
,
private
_route
:
ActivatedRoute
,
private
_webinAuthenticationService
:
WebinAuthenticationService
)
{
}
private
_sub
;
ngOnInit
()
{
this
.
_sub
=
this
.
_route
.
queryParams
.
subscribe
(
params
=>
{
if
(
params
.
page
===
'
update-request
'
&&
!
this
.
isEga
())
{
this
.
tabGroup
.
selectedIndex
=
10
;
this
.
_router
.
navigateByUrl
(
''
);
// Remove query parameters.
}
});
}
ngOnDestroy
()
{
this
.
_sub
.
unsubscribe
();
}
isEga
():
boolean
{
return
this
.
_webinAuthenticationService
.
ega
;
}
...
...
frontend/src/app/header/header.component.html
View file @
6346a078
...
...
@@ -5,7 +5,7 @@
<div
class=
"masthead-inner row expanded"
>
<!-- local-title -->
<div
class=
"float-left inline-block padding-left-large"
id=
"local-title"
>
<h4
style=
"color:white"
>
{{getTitle()}}
</h4>
<!-- ** Application specific content ** -->
<a
routerLink=
""
>
<h4
style=
"color:white"
>
{{getTitle()}}
</h4>
</a>
<!-- ** Application specific content ** -->
</div>
<!-- /local-title -->
<!-- local-nav -->
...
...
frontend/src/app/login/login.component.ts
View file @
6346a078
...
...
@@ -33,7 +33,7 @@ export class LoginComponent implements OnInit {
private
_webinAuthenticationService
:
WebinAuthenticationService
)
{
}
ngOnInit
()
{
console
.
log
(
'
**
LoginComponent.ngOnInit
**
'
);
//
console.log('LoginComponent.ngOnInit');
if
(
this
.
_webinAuthenticationService
.
authenticated
)
{
this
.
_router
.
navigateByUrl
(
''
);
}
...
...
@@ -45,7 +45,7 @@ export class LoginComponent implements OnInit {
this
.
_webinAuthenticationService
.
login
(
this
.
username
,
this
.
password
).
pipe
(
mergeMap
(
data
=>
{
console
.
log
(
'
WebinAuthenticationService.login succeeded
'
);
//
console.log('WebinAuthenticationService.login succeeded');
this
.
_webinAuthenticationService
.
ega
=
data
.
roles
.
EGA
;
this
.
_webinAuthenticationService
.
account
=
data
.
principle
;
return
this
.
_webinAuthenticationService
.
loginToken
(
this
.
username
,
this
.
password
);
...
...
@@ -53,9 +53,16 @@ export class LoginComponent implements OnInit {
).
subscribe
(
data
=>
{
console
.
log
(
'
WebinAuthenticationService.loginToken succeeded
'
);
//
console.log('WebinAuthenticationService.loginToken succeeded');
this
.
_webinAuthenticationService
.
token
=
data
;
this
.
_router
.
navigateByUrl
(
''
);
const
redirectUrl
=
this
.
_webinAuthenticationService
.
redirectUrl
;
if
(
redirectUrl
)
{
this
.
_router
.
navigateByUrl
(
redirectUrl
);
this
.
_webinAuthenticationService
.
redirectUrl
=
null
;
}
else
{
this
.
_router
.
navigateByUrl
(
''
);
}
},
// Errors.
(
err
:
HttpErrorResponse
)
=>
{
...
...
frontend/src/app/submit/submit.component.html
View file @
6346a078
...
...
@@ -16,7 +16,7 @@
<span
class =
"app-primary-color"
>
<i
class=
"material-icons"
>
info
</i>
</span>
This page is used for making new submissions. To access
reports
please select one of the other pages above.
This page is used for making new submissions. To access
other functionality
please select one of the other pages above.
</p>
</div>
...
...
@@ -71,19 +71,6 @@
<button
mat-raised-button
color=
"accent"
[disabled]=
"!canSubmit()"
(click)=
"submit()"
>
Submit
</button>
</mat-expansion-panel>
<mat-expansion-panel
*ngIf=
"!isEga()"
>
<mat-expansion-panel-header>
<mat-panel-title>
<b>
Request an update
</b>
</mat-panel-title>
</mat-expansion-panel-header>
<app-update-request></app-update-request>
</mat-expansion-panel>
<mat-expansion-panel
*ngIf=
"!isEga()"
>
<mat-expansion-panel-header>
<mat-panel-title>
...
...
frontend/src/app/update-request/update-request.component.html
View file @
6346a078
...
...
@@ -15,6 +15,9 @@
<div
fxLayout=
"row"
>
<div
fxFlex=
"100%"
>
<p>
<span
class =
"app-primary-color"
>
<i
class=
"material-icons"
>
info
</i>
</span>
Use this page to request changes to records that can't be updated by any other means.
</p>
<p>
...
...
frontend/src/app/webin-authentication-guard.service.ts
View file @
6346a078
...
...
@@ -19,21 +19,27 @@ export class WebinAuthenticationGuardService implements CanActivate {
constructor
(
private
webinAuthenticationService
:
WebinAuthenticationService
,
private
router
:
Router
)
{}
canActivate
(
route
:
ActivatedRouteSnapshot
,
state
:
RouterStateSnapshot
):
boolean
{
console
.
log
(
'
**
WebinAuthenticationGuardService.canActivate
**
'
);
//
console.log('WebinAuthenticationGuardService.canActivate');
if
(
this
.
webinAuthenticationService
.
authenticated
)
{
if
(
new
Date
()
>=
this
.
webinAuthenticationService
.
logoutDate
)
{
console
.
log
(
'
**
WebinAuthenticationGuardService: authentication timeout
**
'
);
//
console.log('WebinAuthenticationGuardService: authentication timeout');
this
.
webinAuthenticationService
.
logout
();
this
.
router
.
navigate
([
'
login
'
]);
return
false
;
}
else
{
console
.
log
(
'
**
WebinAuthenticationGuardService: authenticated
**
'
);
//
console.log('WebinAuthenticationGuardService: authenticated');
return
true
;
}
}
console
.
log
(
'
** WebinAuthenticationGuardService: not authenticated **
'
);
// console.log('WebinAuthenticationGuardService: not authenticated');
const
url
=
state
.
url
;
if
(
url
.
startsWith
(
"
/?page=
"
))
{
// console.log('WebinAuthenticationGuardService: set redirectUrl', url);
this
.
webinAuthenticationService
.
redirectUrl
=
url
;
}
this
.
router
.
navigate
([
'
login
'
]);
return
false
;
}
...
...
frontend/src/app/webin-authentication.interceptor.ts
View file @
6346a078
...
...
@@ -24,7 +24,7 @@ export class WebinAuthenticationInterceptor implements HttpInterceptor {
intercept
(
req
:
HttpRequest
<
any
>
,
next
:
HttpHandler
):
Observable
<
HttpEvent
<
any
>>
{
if
(
!
req
.
url
.
startsWith
(
environment
.
webinAuthenticationServiceUrl
))
{
console
.
log
(
'
**
Webin authentication interceptor
**
'
);
//
console.log('Webin authentication interceptor');
const
webinAuthenticationService
=
this
.
injector
.
get
(
WebinAuthenticationService
);
/* if (req.url.startsWith(environment.webinReportServiceUrl)) {
...
...
frontend/src/app/webin-authentication.service.ts
View file @
6346a078
...
...
@@ -21,6 +21,8 @@ import { WebinAuthenticationResultInterface } from './webin-authentication-resul
@
Injectable
()
export
class
WebinAuthenticationService
implements
WebinAuthenticationServiceInterface
{
redirectUrl
:
string
;
get
username
():
string
{
return
sessionStorage
.
getItem
(
'
username
'
);
}
...
...
@@ -88,7 +90,7 @@ export class WebinAuthenticationService implements WebinAuthenticationServiceInt
}
logout
()
{
console
.
log
(
'
**
logout
**
'
);
//
console.log('logout');
sessionStorage
.
removeItem
(
'
username
'
);
sessionStorage
.
removeItem
(
'
token
'
);
...
...
@@ -101,7 +103,7 @@ export class WebinAuthenticationService implements WebinAuthenticationServiceInt
login
(
username
:
string
,
password
:
string
):
Observable
<
WebinAuthenticationResultInterface
>
{
const
baseUrl
:
string
=
environment
.
webinAuthenticationServiceUrl
;
console
.
log
(
'
**
Webin authentication login
**
'
,
baseUrl
);
//
console.log('Webin authentication login', baseUrl);
this
.
username
=
username
;
const
today
=
new
Date
();
...
...
@@ -118,7 +120,7 @@ export class WebinAuthenticationService implements WebinAuthenticationServiceInt
loginToken
(
username
:
string
,
password
:
string
):
Observable
<
string
>
{
const
baseUrl
:
string
=
environment
.
webinAuthenticationTokenUrl
;
console
.
log
(
'
**
Webin authentication token
**
'
,
baseUrl
);
//
console.log('Webin authentication token', baseUrl);
this
.
username
=
username
;
const
today
=
new
Date
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment