Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
X-tee
X-Road-catalogue
Commits
5039f3f6
Commit
5039f3f6
authored
Apr 16, 2019
by
Vitali Stupin
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix instance switching
parent
72dd2e4b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
src/app/subsystem-list/subsystem-list.component.spec.ts
src/app/subsystem-list/subsystem-list.component.spec.ts
+17
-1
src/app/subsystem-list/subsystem-list.component.ts
src/app/subsystem-list/subsystem-list.component.ts
+5
-0
src/app/subsystems.service.ts
src/app/subsystems.service.ts
+1
-1
No files found.
src/app/subsystem-list/subsystem-list.component.spec.ts
View file @
5039f3f6
...
...
@@ -115,8 +115,14 @@ describe('SubsystemListComponent', () => {
fixture
=
TestBed
.
createComponent
(
SubsystemListComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
const
spy
=
TestBed
.
get
(
Router
).
navigateByUrl
;
component
.
switchInstance
(
'
NEWINST
'
);
expect
(
TestBed
.
get
(
Router
).
navigateByUrl
).
toHaveBeenCalledWith
(
'
/NEWINST
'
);
expect
(
spy
).
toHaveBeenCalledWith
(
'
/NEWINST
'
);
spy
.
calls
.
reset
();
component
.
switchInstance
(
'
INST
'
);
expect
(
spy
).
toHaveBeenCalledWith
(
'
/INST
'
);
});
it
(
'
should receive service warnings
'
,
()
=>
{
...
...
@@ -230,4 +236,14 @@ describe('SubsystemListComponent (with instance version)', () => {
component
.
setInstanceVersion
();
expect
(
TestBed
.
get
(
Router
).
navigateByUrl
).
toHaveBeenCalledWith
(
'
/INST?at=12345
'
);
});
it
(
'
switchInstance should reset instance version when instance does not change
'
,
()
=>
{
fixture
=
TestBed
.
createComponent
(
SubsystemListComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
component
.
instanceVersion
=
'
test
'
;
component
.
switchInstance
(
'
INST
'
);
expect
(
TestBed
.
get
(
Router
).
navigateByUrl
).
toHaveBeenCalledWith
(
'
/INST
'
);
expect
(
component
.
instanceVersion
).
toBe
(
''
);
});
});
src/app/subsystem-list/subsystem-list.component.ts
View file @
5039f3f6
...
...
@@ -48,6 +48,11 @@ export class SubsystemListComponent implements OnInit, AfterViewInit, OnDestroy
switchInstance
(
instance
:
string
):
void
{
this
.
router
.
navigateByUrl
(
'
/
'
+
instance
);
// Reloading data if clicked on the current instance
if
(
this
.
subsystemsService
.
getInstance
()
===
instance
)
{
this
.
instanceVersion
=
''
;
this
.
subsystemsService
.
setInstance
(
instance
,
this
.
instanceVersion
);
}
}
getApiUrl
():
string
{
...
...
src/app/subsystems.service.ts
View file @
5039f3f6
import
{
Injectable
,
EventEmitter
}
from
'
@angular/core
'
;
import
{
HttpClient
}
from
'
@angular/common/http
'
;
import
{
Observable
,
of
,
BehaviorSubject
,
Subject
}
from
'
rxjs
'
;
import
{
of
,
BehaviorSubject
,
Subject
}
from
'
rxjs
'
;
import
{
catchError
,
debounceTime
,
distinctUntilChanged
}
from
'
rxjs/operators
'
;
import
{
Subsystem
}
from
'
./subsystem
'
;
import
{
Method
}
from
'
./method
'
;
...
...
RIA Bitbucket
@ria-bitbucket
mentioned in commit
9cf8ce15
·
Nov 23, 2020
mentioned in commit
9cf8ce15
mentioned in commit 9cf8ce155ad84d31d5963abc5d5566dda9b9d475
Toggle commit list
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