Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1d964b97

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

re #2: "move found nodes to group" feature

Zobrazit rozdíly:

sources/imiger-core/src/main/webapp/css/components/navbar.css
69 69
	line-height: 40px;
70 70
	vertical-align: middle;
71 71
}
72

  
73
.navbar .search-count {
74
	margin-right: 5px;
75
}
sources/imiger-core/src/main/webapp/js/components/navbar.js
133 133
			onClick: () => resetSearch(),
134 134
		});
135 135

  
136
		const groupFoundButton = DOM.h('button', {
137
			id: 'groupFoundButton',
138
			innerText: 'Group found vertices',
139
			onClick: () => {
140
				const foundVertexList = app.vertexList.filter(node => node.isFound === true && node.group === null);
141

  
142
				if (foundVertexList.length > 0) {
143
					// create a new group
144
					let group = Group.create();
145
					group.isExcluded = true;
146

  
147
					app.nodeList.push(group);
148
					app.groupList.push(group);
149

  
150
					app.sidebarComponent.excludedNodeListComponent.addNode(group);
151

  
152
					foundVertexList.forEach(node => {
153
						group.addVertex(node);
154
						app.sidebarComponent.excludedNodeListComponent.removeNode(node);
155
						node.remove(true);
156
					});
157
				}
158

  
159
				resetSearch();
160
			},
161
		})
162

  
136 163
		function search(term) {
137 164
			if (term.length < 2) return;
138 165

  
139 166
			let found = 0;
140
			
167

  
141 168
			let nodeList = app.nodeList;
142 169
			nodeList.forEach(node => {
143 170
				if (node.name.toLowerCase().includes(term.toLowerCase())) {
......
165 192
			searchInput,
166 193
			searchButton,
167 194
			searchCounter,
195
			groupFoundButton,
168 196
		]);
169 197
	}
170 198

  
sources/imiger-core/src/main/webapp/js/components/node.js
143 143
		return this._relatedArchetypeListComponent.data;
144 144
	}
145 145

  
146
	/**
147
	 * @returns {boolean} True if the node is found, otherwise false.
148
	 */
149
	get isFound() {
150
		return this._isFound;
151
	}
152

  
146 153
	/**
147 154
	 * Sets the node as found. Highlighting is skipped when the node is excluded.
148 155
	 * @param {boolean} newValue True to mark the node as found, otherwise false.

Také k dispozici: Unified diff