MCPcopy
hub / github.com/Comfy-Org/ComfyUI-Manager / renderGrid

Method renderGrid

comfyui_manager/js/model-manager.js:298–399  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

296 }
297
298 renderGrid() {
299
300 // update theme
301 const colorPalette = this.app.ui.settings.settingsValues['Comfy.ColorPalette'];
302 Array.from(this.element.classList).forEach(cn => {
303 if (cn.startsWith("cmm-manager-")) {
304 this.element.classList.remove(cn);
305 }
306 });
307 this.element.classList.add(`cmm-manager-${colorPalette}`);
308
309 const options = {
310 theme: colorPalette === "light" ? "" : "dark"
311 };
312
313 const rows = this.modelList || [];
314
315 const columns = [{
316 id: 'id',
317 name: 'ID',
318 width: 50,
319 align: 'center'
320 }, {
321 id: 'name',
322 name: 'Name',
323 width: 200,
324 minWidth: 100,
325 maxWidth: 500,
326 classMap: 'cmm-node-name',
327 formatter: function(name, rowItem, columnItem, cellNode) {
328 return `<a href=${rowItem.reference} target="_blank"><b>${name}</b></a>`;
329 }
330 }, {
331 id: 'installed',
332 name: 'Install',
333 width: 130,
334 minWidth: 110,
335 maxWidth: 200,
336 sortable: false,
337 align: 'center',
338 formatter: (installed, rowItem, columnItem) => {
339 if (rowItem.refresh) {
340 return `<font color="red">Refresh Required</span>`;
341 }
342 if (installed === "True") {
343 return `<div class="cmm-icon-passed">${icons.passed}</div>`;
344 }
345 return `<button class="cmm-btn-install p-button p-component" mode="install">Install</button>`;
346 }
347 }, {
348 id: 'url',
349 name: '',
350 width: 50,
351 sortable: false,
352 align: 'center',
353 formatter: (url, rowItem, columnItem) => {
354 return `<a class="cmm-btn-download" tooltip="Download file" href="${url}" target="_blank">${icons.download}</a>`;
355 }

Callers 1

loadDataMethod · 0.95

Calls 5

formatSizeMethod · 0.95
restoreColumnWidthFunction · 0.90
removeMethod · 0.80
setDataMethod · 0.80
renderMethod · 0.80

Tested by

no test coverage detected