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
c6d367a5
Verified
Commit
c6d367a5
authored
5 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
More documentation for plotly helper
parent
bebf2a0c
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
src/core/js/ext_bottom_line.js
+33
-15
33 additions, 15 deletions
src/core/js/ext_bottom_line.js
with
33 additions
and
15 deletions
src/core/js/ext_bottom_line.js
+
33
−
15
View file @
c6d367a5
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
* ** header v3.0
* ** header v3.0
* This file is a part of the CaosDB Project.
* This file is a part of the CaosDB Project.
*
*
* Copyright (C) 20
19
IndiScale GmbH
(
info@indiscale.com
)
* Copyright (C) 20
20
IndiScale GmbH
<
info@indiscale.com
>
* Copyright (C) 20
19
Timm Fitschen
(
t.fitschen@indiscale.com
)
* Copyright (C) 20
20
Timm Fitschen
<
t.fitschen@indiscale.com
>
*
*
* This program is free software: you can redistribute it and/or modify
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* it under the terms of the GNU Affero General Public License as
...
@@ -26,17 +26,20 @@
...
@@ -26,17 +26,20 @@
/**
/**
* Add a special section to each entity one the current page where a thumbnail,
* Add a special section to each entity one the current page where a thumbnail,
* a video preview or any other kind of
preview
for the entity is shown.
* a video preview or any other kind of
summary
for the entity is shown.
*
*
* @module ext_bottom_line
* @module ext_bottom_line
* @version 0.1
* @version 0.1
*
*
* @requires jQuery
* @requires jQuery (library)
* @requires logger
* @requires log (singleton from loglevel library)
* @requires resolve_references.is_in_viewport_vertically (funtion from ext_references.js)
* @requires load_config (function from caosdb.js)
* @requires getEntityPath (function from caosdb.js)
* @requires connection (module from webcaosdb.js)
*/
*/
var
ext_bottom_line
=
function
(
$
,
logger
,
is_in_view_port
,
load_config
,
getEntityPath
,
connection
)
{
var
ext_bottom_line
=
function
(
$
,
logger
,
is_in_view_port
,
load_config
,
getEntityPath
,
connection
)
{
/**
/**
* Check if an entity has a path attribute and one of a set of extensions.
* Check if an entity has a path attribute and one of a set of extensions.
*
*
...
@@ -122,7 +125,7 @@ var ext_bottom_line = function ($, logger, is_in_view_port, load_config, getEnti
...
@@ -122,7 +125,7 @@ var ext_bottom_line = function ($, logger, is_in_view_port, load_config, getEnti
*
*
* @member {Creator[]}
* @member {Creator[]}
*/
*/
var
_creators
=
[];
const
_creators
=
[];
/**
/**
* Return the preview container of the entity.
* Return the preview container of the entity.
...
@@ -131,7 +134,7 @@ var ext_bottom_line = function ($, logger, is_in_view_port, load_config, getEnti
...
@@ -131,7 +134,7 @@ var ext_bottom_line = function ($, logger, is_in_view_port, load_config, getEnti
* @returns {HTMLElement} the preview container or `undefined` if the entity
* @returns {HTMLElement} the preview container or `undefined` if the entity
* doesn't have any.
* doesn't have any.
*/
*/
var
get_preview_container
=
function
(
entity
)
{
const
get_preview_container
=
function
(
entity
)
{
return
$
(
entity
).
children
(
`.
${
_css_class_preview_container
}
`
)[
0
];
return
$
(
entity
).
children
(
`.
${
_css_class_preview_container
}
`
)[
0
];
}
}
...
@@ -152,8 +155,8 @@ var ext_bottom_line = function ($, logger, is_in_view_port, load_config, getEnti
...
@@ -152,8 +155,8 @@ var ext_bottom_line = function ($, logger, is_in_view_port, load_config, getEnti
* @param {HTMLElement} entity - An entity in HTML Representation which
* @param {HTMLElement} entity - An entity in HTML Representation which
* must have a (deep) child with class `caosdb-f-ext_bottom_line-container`.
* must have a (deep) child with class `caosdb-f-ext_bottom_line-container`.
*/
*/
var
set_preview_container
=
function
(
entity
,
element
)
{
const
set_preview_container
=
function
(
entity
,
element
)
{
var
preview_container
=
$
(
get_preview_container
(
entity
));
const
preview_container
=
$
(
get_preview_container
(
entity
));
if
(
preview_container
[
0
])
{
if
(
preview_container
[
0
])
{
preview_container
.
empty
();
preview_container
.
empty
();
var
buttons
=
preview_container
.
siblings
(
`.
${
_css_class_preview_container_button
}
`
);
var
buttons
=
preview_container
.
siblings
(
`.
${
_css_class_preview_container_button
}
`
);
...
@@ -407,7 +410,7 @@ var ext_bottom_line = function ($, logger, is_in_view_port, load_config, getEnti
...
@@ -407,7 +410,7 @@ var ext_bottom_line = function ($, logger, is_in_view_port, load_config, getEnti
* @property {Config} [config] - an optional config. Per default, the
* @property {Config} [config] - an optional config. Per default, the
* configuration is fetched from the server.
* configuration is fetched from the server.
*/
*/
var
init
=
async
function
(
config
)
{
const
init
=
async
function
(
config
)
{
logger
.
info
(
"
ext_bottom_line initialized
"
);
logger
.
info
(
"
ext_bottom_line initialized
"
);
try
{
try
{
...
@@ -446,20 +449,35 @@ var ext_bottom_line = function ($, logger, is_in_view_port, load_config, getEnti
...
@@ -446,20 +449,35 @@ var ext_bottom_line = function ($, logger, is_in_view_port, load_config, getEnti
*/
*/
var
plotly_preview
=
function
(
logger
,
ext_bottom_line
,
plotly
)
{
var
plotly_preview
=
function
(
logger
,
ext_bottom_line
,
plotly
)
{
var
create_plot
=
function
(
data
)
{
/**
* Create a plot with plotly.
*
* The layout and any other plotly options are set by this function. The
* only parameter `data` is the `data` parameter of the `Plotly.newPlot`
* factory.
*
* Hence the full documentation of the `data` parameter is available at
* https://plotly.com/javascript/plotlyjs-function-reference/#plotlynewplot
*
*
* @param {object[]} data - array of objects containing the data which is
* to be plotted.
* @returns {HTMLElement} the element which contains the plot.
*/
const
create_plot
=
function
(
data
)
{
var
div
=
$
(
'
<div/>
'
)[
0
];
var
div
=
$
(
'
<div/>
'
)[
0
];
plotly
.
newPlot
(
div
,
data
,
{
margin
:
{
t
:
0
},
height
:
400
,
widht
:
400
},
{
responsive
:
true
});
plotly
.
newPlot
(
div
,
data
,
{
margin
:
{
t
:
0
},
height
:
400
,
widht
:
400
},
{
responsive
:
true
});
return
div
;
return
div
;
}
}
var
resize_plots_event_handler
=
function
(
e
)
{
const
resize_plots_event_handler
=
function
(
e
)
{
var
plots
=
$
(
e
.
target
).
find
(
"
.js-plotly-plot
"
);
var
plots
=
$
(
e
.
target
).
find
(
"
.js-plotly-plot
"
);
for
(
let
plot
of
plots
)
{
for
(
let
plot
of
plots
)
{
plotly
.
Plots
.
resize
(
plot
);
plotly
.
Plots
.
resize
(
plot
);
}
}
}
}
var
init
=
function
()
{
const
init
=
function
()
{
window
.
addEventListener
(
ext_bottom_line
.
previewReadyEvent
.
type
,
window
.
addEventListener
(
ext_bottom_line
.
previewReadyEvent
.
type
,
resize_plots_event_handler
,
true
);
resize_plots_event_handler
,
true
);
window
.
addEventListener
(
ext_bottom_line
.
previewShownEvent
.
type
,
window
.
addEventListener
(
ext_bottom_line
.
previewShownEvent
.
type
,
...
@@ -476,7 +494,7 @@ var plotly_preview = function (logger, ext_bottom_line, plotly) {
...
@@ -476,7 +494,7 @@ var plotly_preview = function (logger, ext_bottom_line, plotly) {
// this will be replaced by require.js in the future.
// this will be replaced by require.js in the future.
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
if
(
"
${BUILD_MODULE_
NEW_MODUL
E}
"
===
"
ENABLED
"
)
{
if
(
"
${BUILD_MODULE_
EXT_BOTTOM_LIN
E}
"
===
"
ENABLED
"
)
{
caosdb_modules
.
register
(
plotly_preview
);
caosdb_modules
.
register
(
plotly_preview
);
caosdb_modules
.
register
(
ext_bottom_line
);
caosdb_modules
.
register
(
ext_bottom_line
);
}
}
...
...
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