Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
3ece963f
Commit
3ece963f
authored
6 years ago
by
Reinoud Bokhorst
Browse files
Options
Downloads
Patches
Plain Diff
OSB-35
: refactoring
parent
cea7b8e7
No related branches found
No related tags found
2 merge requests
!89
Monitoring maintenance Epic branch merge
,
!1
Resolve OSB-13 "Monitoringmaintenance "
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
LCU/Maintenance/MDB_WebView/maintenancedb_view/src/components/StationTestView.js
+38
-42
38 additions, 42 deletions
...View/maintenancedb_view/src/components/StationTestView.js
with
38 additions
and
42 deletions
LCU/Maintenance/MDB_WebView/maintenancedb_view/src/components/StationTestView.js
+
38
−
42
View file @
3ece963f
...
@@ -45,7 +45,7 @@ class GenericStatusTdC extends Component {
...
@@ -45,7 +45,7 @@ class GenericStatusTdC extends Component {
onMouseOver
=
(
e
)
=>
{
onMouseOver
=
(
e
)
=>
{
e
.
stopPropagation
();
e
.
stopPropagation
();
if
(
this
.
props
.
n_errors
>
0
)
{
if
(
this
.
props
.
n_errors
>
0
)
{
this
.
props
.
onSelect
(
this
.
props
.
errors
);
this
.
props
.
onSelect
(
this
.
props
.
data
);
}
}
};
};
...
@@ -66,7 +66,7 @@ class GenericStatusTdC extends Component {
...
@@ -66,7 +66,7 @@ class GenericStatusTdC extends Component {
onContextMenu
=
(
e
)
=>
{
onContextMenu
=
(
e
)
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
if
(
this
.
props
.
n_errors
>
0
)
{
if
(
this
.
props
.
n_errors
>
0
)
{
this
.
props
.
onSelect
(
this
.
props
.
errors
,
true
);
this
.
props
.
onSelect
(
this
.
props
.
data
,
true
);
}
}
};
};
...
@@ -100,12 +100,12 @@ class TestLineC extends Component {
...
@@ -100,12 +100,12 @@ class TestLineC extends Component {
shouldHighlight
()
{
shouldHighlight
()
{
const
props
=
this
.
props
,
const
props
=
this
.
props
,
d
ata
=
props
.
highlightData
;
errorD
ata
=
props
.
highlightData
;
return
d
ata
!==
null
&&
return
errorD
ata
!==
null
&&
d
ata
.
component_type
===
props
.
component_type
&&
errorD
ata
.
component_type
===
props
.
component_type
&&
d
ata
.
test_type
===
props
.
test_type
&&
errorD
ata
.
test_type
===
props
.
test_type
&&
d
ata
.
datetime
===
TestLineC
.
formatDate
(
props
.
data
.
start_date
);
errorD
ata
.
datetime
===
TestLineC
.
formatDate
(
props
.
data
.
start_date
);
}
}
shouldComponentUpdate
(
nextProps
,
nextState
,
nextContext
)
{
shouldComponentUpdate
(
nextProps
,
nextState
,
nextContext
)
{
...
@@ -125,31 +125,35 @@ class TestLineC extends Component {
...
@@ -125,31 +125,35 @@ class TestLineC extends Component {
renderComponentErrors
()
{
renderComponentErrors
()
{
const
componentErrors
=
this
.
props
.
data
.
component_errors
;
const
componentErrors
=
this
.
props
.
data
.
component_errors
;
const
renderedComponentErrors
=
this
.
props
.
ordered_component_ids
.
map
((
component_id
,
key
)
=>
{
const
renderedComponentErrors
=
this
.
props
.
ordered_component_ids
.
map
((
component_id
,
key
)
=>
{
let
nErrors
=
0
;
let
nErrors
=
0
,
let
errors
=
[];
errors
=
[],
let
errorDetails
=
{};
errorData
=
{};
if
(
componentErrors
.
hasOwnProperty
(
component_id
))
{
if
(
componentErrors
.
hasOwnProperty
(
component_id
))
{
nErrors
=
Object
.
keys
(
componentErrors
[
component_id
]).
length
;
errors
=
componentErrors
[
component_id
];
errors
=
componentErrors
[
component_id
];
errorDetails
.
errors
=
errors
;
nErrors
=
Object
.
keys
(
errors
).
length
;
errorDetails
.
datetime
=
TestLineC
.
formatDate
(
this
.
props
.
data
.
start_date
);
errorDetails
.
test_type
=
this
.
props
.
test_type
;
// Data for child panel and checking if an antenna item must be highlighted permanently (see shouldHighlight)
errorDetails
.
component_id
=
component_id
;
errorData
.
errors
=
errors
;
errorDetails
.
component_type
=
this
.
props
.
component_type
;
errorData
.
datetime
=
TestLineC
.
formatDate
(
this
.
props
.
data
.
start_date
);
errorData
.
test_type
=
this
.
props
.
test_type
;
errorData
.
component_id
=
component_id
;
errorData
.
component_type
=
this
.
props
.
component_type
;
}
}
return
<
GenericStatusTd
return
<
GenericStatusTd
doHighlight
=
{
this
.
doHighlight
&&
component_id
===
this
.
props
.
highlightData
.
component_id
}
doHighlight
=
{
this
.
doHighlight
&&
component_id
===
this
.
props
.
highlightData
.
component_id
}
key
=
{
key
}
key
=
{
key
}
errors
=
{
errorD
e
ta
ils
}
data
=
{
errorD
a
ta
}
antenna_id
=
{
component_id
}
antenna_id
=
{
component_id
}
antenna_type
=
{
this
.
props
.
component_type
}
antenna_type
=
{
this
.
props
.
component_type
}
station_name
=
{
this
.
props
.
station_name
}
station_name
=
{
this
.
props
.
station_name
}
n_errors
=
{
nErrors
}
n_errors
=
{
nErrors
}
onSelect
=
{
this
.
onSelect
}
onSelect
=
{
this
.
onSelect
}
/
>
/
>
});
});
return
renderedComponentErrors
;
return
renderedComponentErrors
;
}
}
...
@@ -182,19 +186,8 @@ const TestLine = connect(state => {
...
@@ -182,19 +186,8 @@ const TestLine = connect(state => {
class
RTSMSummaryLine
extends
Component
{
class
RTSMSummaryLine
extends
Component
{
constructor
(
props
)
{
state
=
{
super
(
props
);
displaySingleTests
:
false
this
.
state
=
{
displaySingleTests
:
false
}
}
renderTestLine
(
key
,
data
,
component_id_list
)
{
return
(
<
TestLine
className
=
"
collapse open
"
key
=
{
key
}
ordered_component_ids
=
{
component_id_list
}
test_type
=
"
RT
"
station_name
=
{
this
.
props
.
station_name
}
component_type
=
{
this
.
props
.
component_type
}
station_type
=
{
this
.
props
.
station_type
}
data
=
{
data
}
/>
)
}
}
renderTestSummaryLine
(
data
,
component_id_list
)
{
renderTestSummaryLine
(
data
,
component_id_list
)
{
...
@@ -235,17 +228,13 @@ class RTSMSummaryLine extends Component {
...
@@ -235,17 +228,13 @@ class RTSMSummaryLine extends Component {
let
summary
=
this
.
computeSummary
();
let
summary
=
this
.
computeSummary
();
const
component_id_list
=
this
.
props
.
ordered_component_ids
;
const
component_id_list
=
this
.
props
.
ordered_component_ids
;
const
summaryLine
=
this
.
renderTestSummaryLine
(
summary
,
component_id_list
);
const
summaryLine
=
this
.
renderTestSummaryLine
(
summary
,
component_id_list
);
let
jsx
;
let
all_rtsm
;
if
(
this
.
state
.
displaySingleTests
)
{
let
all_rtsm
=
this
.
state
.
displaySingleTests
?
this
.
props
.
data
:
[];
all_rtsm
=
this
.
props
.
data
.
map
((
item
,
key
)
=>
this
.
renderTestLine
(
key
,
item
,
component_id_list
))
}
let
dropdownAdditionStyles
=
classNames
(
let
dropdownAdditionStyles
=
classNames
(
'
dropdownbutton
'
,
{
'
dropdownbutton-up
'
:
this
.
state
.
displaySingleTests
});
'
dropdownbutton
'
,
{
'
dropdownbutton-up
'
:
this
.
state
.
displaySingleTests
});
jsx
=
(
return
(
<
React
.
Fragment
>
<
React
.
Fragment
>
<
tr
className
=
'
stv-rtsm-summary-row
'
>
<
tr
className
=
'
stv-rtsm-summary-row
'
>
<
td
className
=
"
row-header
"
onClick
=
{
this
.
toggleDisplaySingleTests
}
>
<
td
className
=
"
row-header
"
onClick
=
{
this
.
toggleDisplaySingleTests
}
>
...
@@ -254,12 +243,19 @@ class RTSMSummaryLine extends Component {
...
@@ -254,12 +243,19 @@ class RTSMSummaryLine extends Component {
<
/td
>
<
/td
>
{
summaryLine
}
{
summaryLine
}
<
/tr
>
<
/tr
>
{
all_rtsm
}
{
// All RTSM lines in this block (expanded or folded)
all_rtsm
.
map
((
item
,
key
)
=>
<
TestLine
className
=
"
collapse open
"
key
=
{
key
}
ordered_component_ids
=
{
component_id_list
}
test_type
=
"
RT
"
station_name
=
{
this
.
props
.
station_name
}
component_type
=
{
this
.
props
.
component_type
}
station_type
=
{
this
.
props
.
station_type
}
data
=
{
item
}
/
>
)
}
<
/React.Fragment
>
<
/React.Fragment
>
);
);
return
jsx
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment