Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-jams
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
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
savoirfairelinux
jami-jams
Commits
1f17671c
Commit
1f17671c
authored
1 year ago
by
Léo Banno-Cloutier
Browse files
Options
Downloads
Patches
Plain Diff
jams-react-client: show CustomUiPreview in Customization tab
Change-Id: I537f76a77cbe6ef49da26c5d70bf3abc808dd1f8
parent
70ccecd1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jams-react-client/src/views/Blueprint/EditBlueprintUi.js
+39
-0
39 additions, 0 deletions
jams-react-client/src/views/Blueprint/EditBlueprintUi.js
with
39 additions
and
0 deletions
jams-react-client/src/views/Blueprint/EditBlueprintUi.js
+
39
−
0
View file @
1f17671c
...
...
@@ -29,6 +29,8 @@ import Snackbar from "@material-ui/core/Snackbar";
import
MuiAlert
from
"
@material-ui/lab/Alert
"
;
import
i18next
from
"
i18next
"
;
import
CustomUiPreview
from
"
components/CustomUiPreview/CustomUiPreview
"
;
import
EditBlueprintUiForm
from
"
./EditBlueprintUiForm
"
;
const
DEFAULT_UI_CUSTOMIZATION
=
{
hasTitle
:
true
,
...
...
@@ -124,6 +126,11 @@ export default function EditBlueprintUi({ blueprintName }) {
setPolicyData
({
...
policyData
,
uiCustomization
:
ui
});
};
const
[
oldUiCustomization
,
setOldUiCustomization
]
=
useState
({
...
uiCustomization
,
});
const
[
opacity
,
setOpacity
]
=
useState
(
0
);
const
[
open
,
setOpen
]
=
useState
(
false
);
const
[
message
,
setMessage
]
=
useState
(
false
);
const
[
severity
,
setSeverity
]
=
useState
(
"
success
"
);
...
...
@@ -176,6 +183,8 @@ export default function EditBlueprintUi({ blueprintName }) {
}
}
// refresh the preview
setOldUiCustomization
(
uiCustomizationResponse
);
console
.
log
(
"
Found ui customization in the policy data
"
);
}
else
{
setUiCustomization
(
DEFAULT_UI_CUSTOMIZATION
);
...
...
@@ -194,6 +203,19 @@ export default function EditBlueprintUi({ blueprintName }) {
const
handleUpdateUi
=
(
field
,
value
)
=>
{
const
newUiCustomization
=
{
...
uiCustomization
,
[
field
]:
value
};
if
(
field
===
"
title
"
||
field
===
"
description
"
||
field
===
"
backgroundColor
"
)
{
// Don't fade in for those fields
setOldUiCustomization
(
newUiCustomization
);
}
else
{
// To make a fade effect, the new preview fades in,
// then the old preview is updated, and the preview on top fades out
setOpacity
(
1
);
setTimeout
(()
=>
{
setOldUiCustomization
(
newUiCustomization
);
setOpacity
(
0
);
},
250
);
}
axios
(
configApiCall
(
api_path_blueprints
+
"
?name=
"
+
blueprintName
,
...
...
@@ -337,6 +359,23 @@ export default function EditBlueprintUi({ blueprintName }) {
<
Grid
container
spacing
=
{
5
}
>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
12
}
>
<
Grid
container
spacing
=
{
2
}
>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
12
}
className
=
{
classes
.
previewContainer
}
>
<
CustomUiPreview
opacity
=
{
opacity
}
uiCustomization
=
{
policyData
.
uiCustomization
}
/
>
<
CustomUiPreview
isOldPreview
opacity
=
"
1
"
uiCustomization
=
{
oldUiCustomization
}
/
>
<
/Grid
>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
12
}
>
<
EditBlueprintUiForm
uiCustomization
=
{
policyData
.
uiCustomization
}
...
...
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