Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1b4a4119

Přidáno uživatelem Pavel Fidranský před asi 6 roky(ů)

added Diagram JS class

Zobrazit rozdíly:

sources/src/main/webapp/js/app.js
55 55
	/** @prop {array<Group>} groupList */
56 56
	this.groupList = [];
57 57

  
58
	/** TODO: jsDoc */
58
	/** @prop {Diagram} diagram */
59 59
	this.diagram = null;
60 60

  
61 61
	/** TODO: jsDoc */
......
372 372
			getDiagramPromise = $.getJSON(self.API.getDiagram + '?id=' + diagramId);
373 373

  
374 374
			loadGraphDataPromise = getDiagramPromise.then(function(data) {
375
				self.diagram = {
376
					id: data.id,
377
					name: data.name,
378
				};
375
				self.diagram = new Diagram(data);
379 376

  
380 377
				return $.getJSON(self.API.loadGraphData + '?diagramId=' + diagramId);
381 378
			});
sources/src/main/webapp/js/diagram.js
1
/**
2
 * Class representing a saved diagram.
3
 * @constructor
4
 * @param {object} props Properties of the diagram.
5
 */
6
function Diagram(props) {
7
	/** @prop {int} id Identifier of the diagram. */
8
	this.id = parseInt(props.id);
9
	/** @prop {string} name Name of the diagram. */
10
	this.name = props.name;
11
	/** @prop {bool} public True if the diagram is public, otherwise false. */
12
	this.public = props.public === '1';
13
}
sources/src/main/webapp/showGraph.jsp
42 42

  
43 43
		<script src="js/constants.js"></script>
44 44
		<script src="js/coordinates.js"></script>
45
		<script src="js/diagram.js"></script>
45 46
		<script src="js/filter.js"></script>
46 47
		<script src="js/forceDirected.js"></script>
47 48
		<script src="js/graphLoader.js"></script>

Také k dispozici: Unified diff