Skip to content
Snippets Groups Projects
Verified Commit ed11b091 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: refactoring of ext_bottom_line

parent efdf7f49
Branches
Tags
No related merge requests found
......@@ -34,7 +34,7 @@
* `conf/core/json/ext_bottom_line.json`.
*
* @module ext_bottom_line
* @version 0.1
* @version 0.1.1
*
* @requires jQuery (library)
* @requires log (singleton from loglevel library)
......@@ -165,67 +165,6 @@ var ext_bottom_line = function($, logger, is_in_view_port, load_config, getEntit
_css_class_preview_container}`)[0];
}
/**
* Add the element to the entity's preview container and remove all other
* content.
*
* This method appends the element (usually a preview, a waiting
* notification or an error message) to the HTMLElement with class
* `caosdb-f-ext_bottom_line-container` which was added to the entity by the
* {@link root_preview_handler}.
*
* If the preview container cannot be found an error is logged, but not
* thrown.
*
* @param {HTMLElement|String} element - A preview, a waiting notification,
* an error message or similar.
* @param {HTMLElement} entity - An entity in HTML Representation which
* must have a (deep) child with class `caosdb-f-ext_bottom_line-container`.
*/
const set_preview_container = function(entity, element) {
// TODO remove
}
/**
* Append a preview to the entity and removes any pre-existing preview.
*
* If the preview is Promise for a preview a waiting notification is added
* to the entity instead and the actual preview is added after the Promise
* is resolved. If the Promise is rejected, a correspondig error is shown
* instead.
*
* @see root_preview_handler
*
* @async
* @param {HTMLElement} entity
* @param {string|HTMLElement|Promise} preview - A preview for an entity or
* a Promise for a preview (which resolves as a string or an HTMLElement as well).
*/
var set_preview = function(entity, preview) {
// TODO remove
}
/**
* Create and return a preview for a given entity.
*
* This root_preview_creator iterates over all the registered creators and
* uses the first match, i.e. the first creator object which return true
* for the `is_applicable(entity)` method of the creator object.
*
* If a creator throws an error during checking whether it `is_applicable`
* or during the `create` the error is logged and the creator is treated as
* if it were not applicable.
*
* @async
* @param {HTMLElement} entity - the entity for which the preview is to be
* created.
* @returns {String|HTMLElement|Promise} A preview which can be added to
* the entity DOM representation or a Promise for such a preview.
*/
var root_preview_creator = async function(entity) {
// TODO remove
};
/**
* Add a preview container to the entity.
*
......@@ -300,7 +239,7 @@ var ext_bottom_line = function($, logger, is_in_view_port, load_config, getEntit
if (container) {
await ext_applicable.root_handler(entity, container, _creators);
} else {
logger.error(new Error("Could not find the preview container."));
logger.error(new Error("Could not create the preview container."));
}
}
......@@ -319,7 +258,7 @@ var ext_bottom_line = function($, logger, is_in_view_port, load_config, getEntit
*
* @param {BottomLineConfig} config
*/
var configure = async function(config) {
var configure = async function(config, default_config) {
logger.debug("configure", config);
if (config.version != "0.1") {
throw new Error("Wrong version in config.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment