Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dccviewer-js
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Benedikt
dccviewer-js
Commits
8dd1581f
Commit
8dd1581f
authored
2 months ago
by
Benedikt
Browse files
Options
Downloads
Patches
Plain Diff
influence condition renderer improved
parent
16030d3b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#52054
passed
2 months ago
Stage: test
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/renderers/InfluenceConditionsRenderer.js
+11
-14
11 additions, 14 deletions
src/renderers/InfluenceConditionsRenderer.js
with
11 additions
and
14 deletions
src/renderers/InfluenceConditionsRenderer.js
+
11
−
14
View file @
8dd1581f
...
@@ -36,7 +36,7 @@ export class InfluenceConditionsRenderer {
...
@@ -36,7 +36,7 @@ export class InfluenceConditionsRenderer {
const
valueStr
=
this
.
_formatQuantity
(
qty
,
true
);
const
valueStr
=
this
.
_formatQuantity
(
qty
,
true
);
summaryText
+=
` :
${
valueStr
}
`
;
summaryText
+=
` :
${
valueStr
}
`
;
}
}
// Use innerHTML
here
so that
any
HTML markup in the unit is rendered
// Use innerHTML so that HTML markup in the unit is rendered
summary
.
innerHTML
=
summaryText
;
summary
.
innerHTML
=
summaryText
;
details
.
appendChild
(
summary
);
details
.
appendChild
(
summary
);
...
@@ -57,9 +57,9 @@ export class InfluenceConditionsRenderer {
...
@@ -57,9 +57,9 @@ export class InfluenceConditionsRenderer {
table
.
style
.
width
=
'
100%
'
;
table
.
style
.
width
=
'
100%
'
;
table
.
style
.
borderCollapse
=
'
collapse
'
;
table
.
style
.
borderCollapse
=
'
collapse
'
;
// Header row for the table
// Header row for the table
(removed "Additional Info" column)
const
headerRow
=
document
.
createElement
(
'
tr
'
);
const
headerRow
=
document
.
createElement
(
'
tr
'
);
[
'
Quantity
'
,
'
Value
'
,
'
Description
'
,
'
Additional Info
'
].
forEach
(
text
=>
{
[
'
Quantity
'
,
'
Value
'
,
'
Description
'
].
forEach
(
text
=>
{
const
th
=
document
.
createElement
(
'
th
'
);
const
th
=
document
.
createElement
(
'
th
'
);
th
.
textContent
=
text
;
th
.
textContent
=
text
;
th
.
style
.
border
=
'
1px solid #ccc
'
;
th
.
style
.
border
=
'
1px solid #ccc
'
;
...
@@ -85,7 +85,7 @@ export class InfluenceConditionsRenderer {
...
@@ -85,7 +85,7 @@ export class InfluenceConditionsRenderer {
valueCell
.
style
.
padding
=
'
4px
'
;
valueCell
.
style
.
padding
=
'
4px
'
;
const
formattedValue
=
this
.
_formatQuantity
(
q
,
false
);
const
formattedValue
=
this
.
_formatQuantity
(
q
,
false
);
valueCell
.
innerHTML
=
formattedValue
;
valueCell
.
innerHTML
=
formattedValue
;
//
If additional (non-standard) data exists, attach a tooltip
//
Attach tooltip for additional data if present
const
additional
=
this
.
_getAdditionalData
(
q
);
const
additional
=
this
.
_getAdditionalData
(
q
);
if
(
Object
.
keys
(
additional
).
length
>
0
)
{
if
(
Object
.
keys
(
additional
).
length
>
0
)
{
const
infoSpan
=
document
.
createElement
(
'
span
'
);
const
infoSpan
=
document
.
createElement
(
'
span
'
);
...
@@ -104,13 +104,6 @@ export class InfluenceConditionsRenderer {
...
@@ -104,13 +104,6 @@ export class InfluenceConditionsRenderer {
descCell
.
textContent
=
this
.
_getText
(
q
[
'
dcc:description
'
]);
descCell
.
textContent
=
this
.
_getText
(
q
[
'
dcc:description
'
]);
row
.
appendChild
(
descCell
);
row
.
appendChild
(
descCell
);
// Column 4: Additional info (if any)
const
additionalCell
=
document
.
createElement
(
'
td
'
);
additionalCell
.
style
.
border
=
'
1px solid #ccc
'
;
additionalCell
.
style
.
padding
=
'
4px
'
;
additionalCell
.
textContent
=
Object
.
keys
(
additional
).
length
>
0
?
JSON
.
stringify
(
additional
)
:
''
;
row
.
appendChild
(
additionalCell
);
table
.
appendChild
(
row
);
table
.
appendChild
(
row
);
});
});
contentDiv
.
appendChild
(
table
);
contentDiv
.
appendChild
(
table
);
...
@@ -143,8 +136,12 @@ export class InfluenceConditionsRenderer {
...
@@ -143,8 +136,12 @@ export class InfluenceConditionsRenderer {
return
quantities
;
return
quantities
;
}
}
// Helper: format a quantity's value.
/**
// If plain is true, render unit as plain text; otherwise use HTML from DSIUnit.
* Helper: Format a quantity's value.
* @param {Object} quantity - The quantity node.
* @param {boolean} plain - If true, render unit as plain text; otherwise use HTML from DSIUnit.
* @returns {string}
*/
_formatQuantity
(
quantity
,
plain
=
false
)
{
_formatQuantity
(
quantity
,
plain
=
false
)
{
// Handle noQuantity (categorical data)
// Handle noQuantity (categorical data)
if
(
quantity
[
'
dcc:noQuantity
'
])
{
if
(
quantity
[
'
dcc:noQuantity
'
])
{
...
@@ -163,7 +160,7 @@ export class InfluenceConditionsRenderer {
...
@@ -163,7 +160,7 @@ export class InfluenceConditionsRenderer {
if
(
real
[
'
si:unit
'
])
{
if
(
real
[
'
si:unit
'
])
{
const
rawUnit
=
real
[
'
si:unit
'
].
trim
();
const
rawUnit
=
real
[
'
si:unit
'
].
trim
();
const
unitObj
=
new
DSIUnit
(
rawUnit
);
const
unitObj
=
new
DSIUnit
(
rawUnit
);
unit
=
plain
?
unitObj
.
toHTML
()
:
unitObj
.
toHTML
({
oneLine
:
true
});
unit
=
plain
?
unitObj
.
toHTML
()
:
unitObj
.
toHTML
({
oneLine
:
true
});
}
}
let
uncertainty
=
''
;
let
uncertainty
=
''
;
if
(
real
[
'
si:measurementUncertaintyUnivariate
'
]
&&
if
(
real
[
'
si:measurementUncertaintyUnivariate
'
]
&&
...
...
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