Files
JasonHoku-ComfyUI-Ultimate-…/resources/logic_state.js
T
Jason HokuandClaude Opus 4.6 b3fab600c7 feat: media type filter (image vs video) in Dashboard filter panel
Adds a new "Type" filter row to the filter panel that lets users toggle
between showing images and videos. Works alongside all existing filters
(sampler, scheduler, model, upscale, etc.).

- logic_state.js: new filters.mediaType Set
- logic_pipeline.js: filter check in both incrementalFilter and
  executePipeline; included in getFilterKey() hash for cache
  invalidation
- logic_ui.js initFilters(): populate mediaType values from
  d.media_type (defaults to "image" for backwards compat)
- template.html: new .filter-row with #filter-mediaType container

Items without media_type still appear under "image" automatically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 00:44:22 -07:00

120 lines
3.1 KiB
JavaScript

/**
* GLOBAL STATE MANAGEMENT
* Holds the raw data, layout metrics, and viewport coordinates.
*/
// --- DATA CONTAINERS ---
// --- 2. HELPERS (Restored) ---
var currentSort = currentSort || 'oldest';
var currentSecondarySort = currentSecondarySort || 'none';
var processedData = processedData || [];
var activeData = activeData || [];
var searchFilters = searchFilters || [];
var isPipelinePending = false;
var lastFilterKey = null;
var idToIndexMap = new Map();
var meta = meta || {};
// Filter State Containers
var filters = filters || {
model: new Set(),
sampler: new Set(),
scheduler: new Set(),
denoise: new Set(),
lora: new Set(),
positive: new Set(),
negative: new Set(),
size: new Set(),
seed: new Set(),
steps: new Set(),
cfg: new Set(),
upscaleMethod: new Set(),
mediaType: new Set()
};
// Top-level filter toggles (true = show, false = hide)
var topFilters = topFilters || {
showFavorites: true, // Default ON
showNonFavorited: true, // Default ON
showRejected: false // Default OFF
};
const sortOptionsList = [
{ id: 'oldest', label: 'Oldest' },
{ id: 'newest', label: 'Newest' },
{ id: 'fastest', label: 'Fastest' },
{ id: 'favorited', label: 'Favorited' },
{ id: 'model', label: 'Model' },
{ id: 'prompt', label: 'Prompt' },
{ id: 'cfg', label: 'CFG' },
{ id: 'denoise', label: 'Denoise' },
{ id: 'lora', label: 'LoRA' },
{ id: 'sampler', label: 'Sampler' },
{ id: 'seed', label: 'Seed' },
{ id: 'size', label: 'Size' }
];
// --- SEARCH FILTER STATE ---
// Array of search filter objects: { type: 'model', term: 'mountain' }
// --- VIRTUALIZATION & PIPELINE ---
let visibleSlice = { start: -1, end: -1 };
const nodeMap = new Map();
// --- LAYOUT METRICS ---
let metrics = {
cardWidth: 240,
cardHeight: 350,
colCount: 4,
totalHeight: 0,
ready: false
};
// --- VIEWPORT COORDINATES (Legacy - kept for compatibility) ---
let px = 0;
let py = 0;
let s = 1;
// --- RENDER THROTTLING ---
let isRenderPending = false;
let lastRenderTime = 0;
const RENDER_THROTTLE_MS = 16;
// --- DEBOUNCE TIMER (Prevents rapid re-renders) ---
let updateDebounceTimer = null;
// --- LABEL MODE STATE ---
// Which fields to show as overlays on cards (persisted to localStorage)
var labelMode = labelMode || {
enabled: false,
labelSize: 9,
fields: {
model: false,
lora: false,
loraUniqueOnly: true, // When true, skip loras that appear on every card
prompt: false,
sampler: false,
scheduler: false,
cfg: false,
steps: false,
seed: false,
denoise: false,
upscale: false,
upscaleMode: false,
upscaleModel: false,
upscaleRatio: false,
upscaleDenoise: false,
upscaleResizeMethod: false,
upscaleHiresSteps: false,
upscaleTiling: false,
hiresPromptBehavior: false,
hiresPromptText: false
}
};
// Cache of values that are the same across ALL items (computed once per dataset)
var labelGlobalValues = labelGlobalValues || null;