1 |
1e2b2c27
|
Tomáš Šimandl
|
/**
|
2 |
|
|
* Light version of the vertex to be used inside of a change as a placeholder until full change details are loaded.
|
3 |
|
|
* @see Vertex
|
4 |
|
|
* @see Change
|
5 |
|
|
* @constructor
|
6 |
|
|
* @param {object} props Properties of the vertex.
|
7 |
|
|
*/
|
8 |
|
|
function VertexLight(props) {
|
9 |
|
|
/** @prop {string} id Identifier of the component in CRCE. */
|
10 |
|
|
this.id = props.uuid;
|
11 |
|
|
/** @prop {string} name Name of the component. */
|
12 |
|
|
this.name = props['external-id'] + ' v' + props.version;
|
13 |
|
|
|
14 |
|
|
/**
|
15 |
|
|
* Removes the DOM element representing the vertex from document.
|
16 |
|
|
*/
|
17 |
|
|
this.exclude = function() {
|
18 |
|
|
this.remove();
|
19 |
|
|
};
|
20 |
|
|
|
21 |
|
|
/**
|
22 |
|
|
* Creates a new DOM element representing the vertex in memory.
|
23 |
|
|
* @returns {Element} HTML DOM element.
|
24 |
|
|
*/
|
25 |
|
|
this.render = function() {
|
26 |
|
|
rootElement = app.utils.createHtmlElement('li', {
|
27 |
|
|
'class': 'node vertex',
|
28 |
|
|
'data-id': this.id,
|
29 |
|
|
});
|
30 |
|
|
|
31 |
|
|
// name
|
32 |
|
|
var nameText = app.utils.createHtmlElement('div', {
|
33 |
|
|
'class': 'vertex-name',
|
34 |
|
|
'title': this.name,
|
35 |
|
|
});
|
36 |
|
|
nameText.appendChild(document.createTextNode(this.name));
|
37 |
|
|
rootElement.appendChild(nameText);
|
38 |
|
|
|
39 |
|
|
return rootElement;
|
40 |
|
|
};
|
41 |
|
|
|
42 |
|
|
/**
|
43 |
|
|
* Removes the DOM element representing the vertex from document.
|
44 |
|
|
*/
|
45 |
|
|
this.remove = function() {
|
46 |
|
|
rootElement.remove();
|
47 |
|
|
};
|
48 |
|
|
}
|