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
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
Cassiopée
nghyd
Commits
c43d270d
Commit
c43d270d
authored
6 years ago
by
mathias.chouet
Browse files
Options
Downloads
Patches
Plain Diff
Aperçu des paramètres liés: gestion des résultats de calcul
parent
e488c136
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!40
Resolve "Amélioration du système de paramètres liés"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/formulaire/ngparam.ts
+40
-9
40 additions, 9 deletions
src/app/formulaire/ngparam.ts
with
40 additions
and
9 deletions
src/app/formulaire/ngparam.ts
+
40
−
9
View file @
c43d270d
...
...
@@ -51,9 +51,11 @@ export class NgParameter extends InputField implements Observer {
/**
* Returns a text preview of the current value(s), depending on the value mode
* @TODO use display precision to limit decimals
*/
public
static
preview
(
p
:
ParamDefinition
):
string
{
let
valuePreview
:
string
;
const
i18n
=
ServiceFactory
.
instance
.
i18nService
;
// console.log("NgParam::preview()", p.symbol, ParamValueMode[p.valueMode], p);
switch
(
p
.
valueMode
)
{
case
ParamValueMode
.
SINGLE
:
...
...
@@ -73,30 +75,59 @@ export class NgParameter extends InputField implements Observer {
if
(
step
)
{
step
=
step
.
toFixed
(
nDigits
);
}
valuePreview
=
ServiceFactory
.
instance
.
i18nService
.
localizeText
(
"
INFO_PARAMFIELD_PARAMVARIER_MINMAXSTEP
"
);
valuePreview
=
i18n
.
localizeText
(
"
INFO_PARAMFIELD_PARAMVARIER_MINMAXSTEP
"
);
valuePreview
=
sprintf
(
valuePreview
,
min
,
max
,
step
);
break
;
case
ParamValueMode
.
LISTE
:
valuePreview
=
ServiceFactory
.
instance
.
i18nService
.
localizeText
(
"
INFO_PARAMFIELD_PARAMVARIER_VALUES
"
);
valuePreview
=
i18n
.
localizeText
(
"
INFO_PARAMFIELD_PARAMVARIER_VALUES
"
);
const
vals
=
p
.
paramValues
.
valueList
||
[];
valuePreview
+=
"
"
+
vals
.
slice
(
0
,
5
).
join
(
"
;
"
)
+
"
…
"
;
break
;
case
ParamValueMode
.
CALCUL
:
valuePreview
=
ServiceFactory
.
instance
.
i18nService
.
localizeText
(
"
INFO_PARAMFIELD_IN_CALCULATION
"
);
valuePreview
=
i18n
.
localizeText
(
"
INFO_PARAMFIELD_IN_CALCULATION
"
);
if
(
p
.
calculability
===
ParamCalculability
.
DICHO
)
{
valuePreview
+=
"
(
"
+
ServiceFactory
.
instance
.
i18nService
.
localizeText
(
"
INFO_PARAMFIELD_IN_CALCULATION_INITIAL_VALUE
"
)
valuePreview
+=
"
(
"
+
i18n
.
localizeText
(
"
INFO_PARAMFIELD_IN_CALCULATION_INITIAL_VALUE
"
)
+
"
:
"
+
p
.
getValue
()
+
"
)
"
;
}
break
;
case
ParamValueMode
.
LINK
:
if
(
p
.
isReferenceDefined
())
{
if
(
p
.
referencedValue
.
isParameter
())
{
// recursive call
valuePreview
=
NgParameter
.
preview
(
p
.
referencedValue
.
element
as
ParamDefinition
);
const
targetParam
=
(
p
.
referencedValue
.
element
as
ParamDefinition
);
// calculated param ?
if
(
targetParam
.
valueMode
===
ParamValueMode
.
CALCUL
)
{
// was the result already computed ?
if
(
p
.
referencedValue
.
nub
.
result
)
{
if
(
p
.
referencedValue
.
hasMultipleValues
())
{
// like LIST mode
valuePreview
=
i18n
.
localizeText
(
"
INFO_PARAMFIELD_PARAMVARIER_VALUES
"
);
valuePreview
+=
"
"
+
p
.
referencedValue
.
nub
.
result
.
getCalculatedValues
().
slice
(
0
,
5
).
join
(
"
;
"
)
+
"
…
"
;
}
else
{
valuePreview
=
String
(
p
.
referencedValue
.
nub
.
result
.
vCalc
);
}
}
else
{
valuePreview
=
i18n
.
localizeText
(
"
INFO_PARAMFIELD_IN_CALCULATION
"
);
}
}
else
{
// recursive call
valuePreview
=
NgParameter
.
preview
(
targetParam
);
}
}
else
{
// @TODO what if the result was already computed ?
// Is the computed value fresh or stale ?
valuePreview
=
ServiceFactory
.
instance
.
i18nService
.
localizeText
(
"
INFO_PARAMFIELD_IN_CALCULATION
"
);
// was the result already computed ?
try
{
const
remoteValues
=
p
.
referencedValue
.
getParamValues
();
// @TODO is the computed value fresh or stale ?
if
(
p
.
referencedValue
.
hasMultipleValues
())
{
// like LIST mode
valuePreview
=
i18n
.
localizeText
(
"
INFO_PARAMFIELD_PARAMVARIER_VALUES
"
);
valuePreview
+=
"
"
+
remoteValues
.
valueList
.
slice
(
0
,
5
).
join
(
"
;
"
)
+
"
…
"
;
}
else
{
// like SINGLE mode
valuePreview
=
String
(
remoteValues
.
currentValue
);
}
}
catch
(
e
)
{
valuePreview
=
i18n
.
localizeText
(
"
INFO_PARAMFIELD_IN_CALCULATION
"
);
}
}
}
}
...
...
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