Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nghyd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Cassiopée
nghyd
Commits
f7dbfb69
Commit
f7dbfb69
authored
2 years ago
by
François Grand
Browse files
Options
Downloads
Patches
Plain Diff
refactor: PAB: optimise table space by moving up values of the basin section (length, width, ZRMB)
refs
#607
parent
6610d19f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!225
Release v4.17.0
,
!207
Draft: Resolve "PAB : optimiser l'espace occupé par le tableau de la géométrie de la passe"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/components/pab-table/pab-table.component.ts
+50
-81
50 additions, 81 deletions
src/app/components/pab-table/pab-table.component.ts
with
50 additions
and
81 deletions
src/app/components/pab-table/pab-table.component.ts
+
50
−
81
View file @
f7dbfb69
...
@@ -540,58 +540,58 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni
...
@@ -540,58 +540,58 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni
for
(
const
cloison
of
this
.
model
.
children
)
{
for
(
const
cloison
of
this
.
model
.
children
)
{
// as much rows as the greatest number of parameters among its devices
// as much rows as the greatest number of parameters among its devices
const
maxNbParams
=
this
.
findMaxNumberOfDeviceParameters
(
cloison
);
const
maxNbParams
=
this
.
findMaxNumberOfDeviceParameters
(
cloison
);
for
(
let
i
=
0
;
i
<
maxNbParams
;
i
++
)
{
for
(
let
r
=
0
;
r
<
maxNbParams
;
r
++
)
{
// build device params row
// build device params row
const
deviceParamRow
=
{
selectable
:
cloison
,
cells
:
[]
};
const
deviceParamRow
=
{
selectable
:
cloison
,
cells
:
[]
};
// basin number and ZRAM
// basin number
, LB, BB, ZRMB
and ZRAM
if
(
i
===
0
)
{
if
(
r
===
0
)
{
// basin number
// basin number
deviceParamRow
.
cells
.
push
({
deviceParamRow
.
cells
.
push
({
value
:
childIndex
+
1
,
value
:
childIndex
+
1
,
rowspan
:
maxNbParams
+
1
,
rowspan
:
maxNbParams
,
class
:
"
basin_number
"
,
class
:
"
basin_number
"
,
selectable
:
cloison
selectable
:
cloison
});
});
// 3 empty cells
// Longueur bassin
deviceParamRow
.
cells
.
push
({
colspan
:
3
,
rowspan
:
maxNbParams
-
1
,
selectable
:
cloison
});
// ZRAM
deviceParamRow
.
cells
.
push
({
model
:
cloison
.
prms
.
ZRAM
,
title
:
this
.
formService
.
expandVariableNameAndUnit
(
CalculatorType
.
Pab
,
"
ZRAM
"
)
});
}
// basin cells on the last but 1 row
if
(
i
===
maxNbParams
-
1
)
{
deviceParamRow
.
cells
.
push
({
deviceParamRow
.
cells
.
push
({
model
:
cloison
.
prms
.
LB
,
model
:
cloison
.
prms
.
LB
,
title
:
this
.
formService
.
expandVariableNameAndUnit
(
CalculatorType
.
Pab
,
"
LB
"
)
title
:
this
.
formService
.
expandVariableNameAndUnit
(
CalculatorType
.
Pab
,
"
LB
"
)
});
});
// Largeur bassin
deviceParamRow
.
cells
.
push
({
deviceParamRow
.
cells
.
push
({
model
:
cloison
.
prms
.
BB
,
model
:
cloison
.
prms
.
BB
,
title
:
this
.
formService
.
expandVariableNameAndUnit
(
CalculatorType
.
Pab
,
"
BB
"
)
title
:
this
.
formService
.
expandVariableNameAndUnit
(
CalculatorType
.
Pab
,
"
BB
"
)
});
});
// Cote radier mi bassin
deviceParamRow
.
cells
.
push
({
deviceParamRow
.
cells
.
push
({
model
:
cloison
.
prms
.
ZRMB
,
model
:
cloison
.
prms
.
ZRMB
,
title
:
this
.
formService
.
expandVariableNameAndUnit
(
CalculatorType
.
Pab
,
"
ZRMB
"
)
title
:
this
.
formService
.
expandVariableNameAndUnit
(
CalculatorType
.
Pab
,
"
ZRMB
"
)
});
});
// ZRAM
deviceParamRow
.
cells
.
push
({
model
:
cloison
.
prms
.
ZRAM
,
title
:
this
.
formService
.
expandVariableNameAndUnit
(
CalculatorType
.
Pab
,
"
ZRAM
"
)
});
}
}
// 1 empty cell below ZRAM
else
if
(
r
===
1
)
{
if
(
i
===
1
)
{
// 1 row for QA editor
const
qaParam
=
new
NgParameter
(
cloison
.
prms
.
QA
,
this
.
pabTable
.
form
);
qaParam
.
radioConfig
=
ParamRadioConfig
.
VAR
;
deviceParamRow
.
cells
.
push
({
deviceParamRow
.
cells
.
push
({
rowspan
:
maxNbParams
,
model
:
qaParam
,
selectable
:
cloison
colspan
:
4
,
rowspan
:
maxNbParams
-
1
,
qa
:
true
,
title
:
this
.
formService
.
expandVariableNameAndUnit
(
CalculatorType
.
Pab
,
"
QA
"
)
});
});
}
}
// device param cells : 3 cells for each device
// device param cells : 3 cells for each device
for
(
const
ouvrage
of
cloison
.
structures
)
{
for
(
const
ouvrage
of
cloison
.
structures
)
{
const
nvParam
=
ouvrage
.
getNthVisibleParam
(
i
);
const
nvParam
=
ouvrage
.
getNthVisibleParam
(
r
);
const
nvParamTitle
=
nvParam
?
this
.
formService
.
expandVariableNameAndUnit
(
CalculatorType
.
Pab
,
nvParam
.
symbol
)
:
""
;
const
nvParamTitle
=
nvParam
?
this
.
formService
.
expandVariableNameAndUnit
(
CalculatorType
.
Pab
,
nvParam
.
symbol
)
:
""
;
const
childStructParamCount
=
this
.
nubVisibleParameterCount
(
ouvrage
);
// cell 1 : device type
// cell 1 : device type
if
(
i
===
0
)
{
// 1st row
if
(
r
===
0
)
{
// 1st row
deviceParamRow
.
cells
.
push
({
deviceParamRow
.
cells
.
push
({
model
:
ouvrage
,
model
:
ouvrage
,
modelValue
:
ouvrage
.
getPropValue
(
"
loiDebit
"
),
modelValue
:
ouvrage
.
getPropValue
(
"
loiDebit
"
),
...
@@ -600,75 +600,42 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni
...
@@ -600,75 +600,42 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni
});
});
}
}
// fill space below device type selector
// fill space below device type selector
if
(
i
===
1
)
{
else
if
(
r
===
1
)
{
deviceParamRow
.
cells
.
push
({
deviceParamRow
.
cells
.
push
({
rowspan
:
(
maxNbParams
-
1
),
rowspan
:
(
maxNbParams
-
1
),
selectable
:
ouvrage
selectable
:
ouvrage
});
});
}
}
// cell 2 : param name
if
(
nvParam
)
{
if
(
nvParam
)
{
// cell 2 : param name
deviceParamRow
.
cells
.
push
({
deviceParamRow
.
cells
.
push
({
value
:
nvParam
.
symbol
,
value
:
nvParam
.
symbol
,
title
:
nvParamTitle
,
title
:
nvParamTitle
,
selectable
:
ouvrage
selectable
:
ouvrage
});
});
}
else
{
// cell 3 : param value
deviceParamRow
.
cells
.
push
({
selectable
:
ouvrage
});
}
// cell 3 : param value
if
(
nvParam
)
{
deviceParamRow
.
cells
.
push
({
deviceParamRow
.
cells
.
push
({
model
:
nvParam
,
model
:
nvParam
,
title
:
nvParamTitle
,
title
:
nvParamTitle
,
selectable
:
ouvrage
selectable
:
ouvrage
});
});
}
else
{
deviceParamRow
.
cells
.
push
({
selectable
:
ouvrage
});
}
}
}
else
if
(
r
===
childStructParamCount
)
{
// fill horizontal space
// fill remaining space
const
devDiff
=
(
maxNbDevices
-
cloison
.
structures
.
length
);
const
remaining
=
maxNbParams
-
childStructParamCount
;
if
(
i
===
0
)
{
if
(
remaining
>
0
)
{
for
(
let
j
=
0
;
j
<
devDiff
;
j
++
)
{
deviceParamRow
.
cells
.
push
({
deviceParamRow
.
cells
.
push
({
colspan
:
2
,
colspan
:
3
,
rowspan
:
remaining
,
rowspan
:
maxNbParams
,
selectable
:
cloison
selectable
:
cloison
,
});
selectableColumn
:
cloison
.
structures
.
length
+
j
}
});
}
}
}
}
// done !
// done !
this
.
rows
.
push
(
deviceParamRow
);
this
.
rows
.
push
(
deviceParamRow
);
}
}
// 1 row for QA editor
childIndex
++
;
const
qaParam
=
new
NgParameter
(
cloison
.
prms
.
QA
,
this
.
pabTable
.
form
);
qaParam
.
radioConfig
=
ParamRadioConfig
.
VAR
;
const
qaRow
:
{
selectable
:
any
,
cells
:
any
[]
}
=
{
selectable
:
undefined
,
cells
:
[
{
model
:
qaParam
,
colspan
:
3
,
qa
:
true
,
title
:
this
.
formService
.
expandVariableNameAndUnit
(
CalculatorType
.
Pab
,
"
QA
"
)
}
]
};
// as many pairs of columns as the maximum number of devices
qaRow
.
cells
.
push
({
colspan
:
maxNbDevices
*
3
,
// selectable: cloison @TODO oui ou non ?
});
// done !
this
.
rows
.
push
(
qaRow
);
childIndex
++
;
}
}
// B.2 many rows for downwall
// B.2 many rows for downwall
...
@@ -790,18 +757,20 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni
...
@@ -790,18 +757,20 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni
return
maxNbDevices
;
return
maxNbDevices
;
}
}
private
nubVisibleParameterCount
(
n
:
Nub
)
{
let
res
=
0
;
for
(
const
p
of
n
.
parameterIterator
)
{
if
(
p
.
visible
)
{
res
++
;
}
}
return
res
;
}
private
findMaxNumberOfDeviceParameters
(
struct
:
ParallelStructure
):
number
{
private
findMaxNumberOfDeviceParameters
(
struct
:
ParallelStructure
):
number
{
let
maxNbParams
=
1
;
let
maxNbParams
=
1
;
for
(
const
d
of
struct
.
getChildren
())
{
for
(
const
child
of
struct
.
getChildren
())
{
let
nbParams
=
0
;
maxNbParams
=
Math
.
max
(
maxNbParams
,
this
.
nubVisibleParameterCount
(
child
));
for
(
const
p
of
d
.
parameterIterator
)
{
if
(
p
.
visible
)
{
// console.log("(counting)", p.symbol);
nbParams
++
;
}
}
// console.log(">>> child params: ", nbParams);
maxNbParams
=
Math
.
max
(
maxNbParams
,
nbParams
);
}
}
return
maxNbParams
;
return
maxNbParams
;
}
}
...
...
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