Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-webui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
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
Code review analytics
Issue 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
caosdb
Software
caosdb-webui
Commits
43ccb2b0
Commit
43ccb2b0
authored
2 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
FIX: Unhide entities in preview container
parent
b4d2ba9f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!92
F fix hidden prop in preview
Pipeline
#32720
passed
2 years ago
Stage: linting
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/js/ext_prop_display.js
+23
-18
23 additions, 18 deletions
src/core/js/ext_prop_display.js
with
23 additions
and
18 deletions
src/core/js/ext_prop_display.js
+
23
−
18
View file @
43ccb2b0
...
...
@@ -25,7 +25,7 @@
* @requires log (singleton from loglevel library)
* @requires load_config (function from webcaosdb.js)
*/
var
prop_display
=
new
function
(
$
,
edit_mode
,
getEntityName
,
getEntityRole
,
getPropertyElements
,
getPropertyName
,
getUserName
,
getUserRoles
,
logger
,
load_config
,
query
)
{
var
prop_display
=
new
function
(
$
,
edit_mode
,
getEntityName
,
getEntityRole
,
getPropertyElements
,
getPropertyName
,
getUserName
,
getUserRoles
,
logger
,
load_config
,
preview
,
query
)
{
/**
* Return the property-display config file; `ext_prop_display.json` by
...
...
@@ -210,29 +210,34 @@ var prop_display = new function ($, edit_mode, getEntityName, getEntityRole, get
this
.
displayProperties
(
entities
,
conf
,
allTypes
,
userName
,
userRoles
);
// If we are in the edit mode, (un)hide properties after ending
// the editing of an entity
for
(
let
event_t
of
[
edit_mode
.
start_edit
.
type
,
preview
.
showPreviewEvent
.
type
])
{
document
.
body
.
addEventListener
(
event_t
,
(
e
)
=>
{
edit_mode
.
app
.
onAfterShowResults
=
this
.
_displayPropertiesWrapper
(
edit_mode
.
app
.
onAfterShowResults
,
conf
,
allTypes
);
},
true
);
}
document
.
body
.
addEventListener
(
edit_mode
.
start_edit
.
type
,
(
e
)
=>
{
edit_mode
.
app
.
onAfterShowResults
=
this
.
_displayPropertiesWrapper
(
edit_mode
.
app
.
onAfterShowResults
,
conf
,
allTypes
);
},
true
);
// After showing a preview for the first time, its entity card is
// added to the dom tree, so the properties have to be (un)hidden
// afterwards.
document
.
body
.
addEventListener
(
preview
.
previewReadyEvent
.
type
,
(
e
)
=>
{
let
newEntities
=
$
(
"
.caosdb-entity-preview
"
);
this
.
displayProperties
(
newEntities
,
conf
,
allTypes
,
userName
,
userRoles
);
console
.
log
(
"
unhiding properties in preview
"
);
},
true
);
}
else
{
// There are no properties to be hidden, so make this clear in HTML body
$
(
"
body
"
).
attr
(
"
data-hidden-properties
"
,
"
false
"
)
$
(
"
body
"
).
attr
(
"
data-hidden-properties
"
,
"
false
"
)
;
this
.
unhideAllProperties
();
for
(
let
event_t
of
[
edit_mode
.
start_edit
.
type
,
preview
.
showPreviewEvent
.
type
])
{
document
.
body
.
addEventListener
(
edit_mode
.
start_edit
.
type
,
(
e
)
=>
{
// also unhide properties when leaving the edit mode
// TODO(fspreck): We're lacking a proper state/event here in the
// edit mode, so do this on "init", since this is the state to which
// the state machine returns after either successfully saving an
// entity or canceling the edit.
edit_mode
.
app
.
onAfterShowResults
=
this
.
_unhideAllPropertiesWrapper
(
edit_mode
.
app
.
onAfterShowResults
);
},
true
);
}
document
.
body
.
addEventListener
(
edit_mode
.
start_edit
.
type
,
(
e
)
=>
{
// also unhide properties when leaving the edit mode
// TODO(fspreck): We're lacking a proper state/event here in the
// edit mode, so do this on "init", since this is the state to which
// the state machine returns after either successfully saving an
// entity or canceling the edit.
edit_mode
.
app
.
onAfterShowResults
=
this
.
_unhideAllPropertiesWrapper
(
edit_mode
.
app
.
onAfterShowResults
);
},
true
);
document
.
body
.
addEventListener
(
preview
.
previewReadyEvent
.
type
,
(
e
)
=>
this
.
unhideAllProperties
(),
true
);
}
}
}(
$
,
edit_mode
,
getEntityName
,
getEntityRole
,
getPropertyElements
,
getPropertyName
,
getUserName
,
getUserRoles
,
log
.
getLogger
(
"
ext_prop_display
"
),
load_config
,
query
);
}(
$
,
edit_mode
,
getEntityName
,
getEntityRole
,
getPropertyElements
,
getPropertyName
,
getUserName
,
getUserRoles
,
log
.
getLogger
(
"
ext_prop_display
"
),
load_config
,
preview
,
query
);
$
(
document
).
ready
(()
=>
{
if
(
"
${BUILD_MODULE_EXT_PROPERTY_DISPLAY}
"
==
"
ENABLED
"
)
{
...
...
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