From 8ef15d6cdfd866630ca02150d761f1483f8b221b Mon Sep 17 00:00:00 2001 From: irof Date: Sat, 7 Feb 2026 02:27:39 +0900 Subject: [PATCH] Remove unused aggregation helpers --- .../resources/templates/assets/package.js | 38 ------------------ jig-core/src/test/js/package.test.js | 39 ------------------- 2 files changed, 77 deletions(-) diff --git a/jig-core/src/main/resources/templates/assets/package.js b/jig-core/src/main/resources/templates/assets/package.js index a4bba8784..b02e076f0 100644 --- a/jig-core/src/main/resources/templates/assets/package.js +++ b/jig-core/src/main/resources/templates/assets/package.js @@ -153,29 +153,6 @@ function buildAggregationStats(packages, relations, maxDepth) { return stats; } -function buildAggregationStatsForPackageFilter(packages, relations, packageFilterFqn, maxDepth) { - const filterPrefix = packageFilterFqn ? `${packageFilterFqn}.` : null; - const withinFilter = fqn => !packageFilterFqn || fqn === packageFilterFqn || fqn.startsWith(filterPrefix); - const filteredPackages = packages.filter(item => withinFilter(item.fqn)); - const filteredRelations = relations.filter(relation => withinFilter(relation.from) && withinFilter(relation.to)); - return buildAggregationStats(filteredPackages, filteredRelations, maxDepth); -} - -function buildAggregationStatsForRelated(packages, relations, rootFqn, maxDepth, aggregationDepth, relatedFilterMode) { - if (!rootFqn) { - return buildAggregationStats(packages, relations, maxDepth); - } - const aggregatedRoot = getAggregatedFqn(rootFqn, aggregationDepth); - const relatedSet = collectRelatedSet(aggregatedRoot, relations, aggregationDepth, relatedFilterMode); - const relatedPackages = packages.filter(item => relatedSet.has(getAggregatedFqn(item.fqn, aggregationDepth))); - const relatedRelations = relations.filter(relation => { - const from = getAggregatedFqn(relation.from, aggregationDepth); - const to = getAggregatedFqn(relation.to, aggregationDepth); - return relatedSet.has(from) && relatedSet.has(to); - }); - return buildAggregationStats(relatedPackages, relatedRelations, maxDepth); -} - function buildAggregationStatsForFilters(packages, relations, packageFilterFqn, relatedFilterFqn, maxDepth, aggregationDepth, relatedFilterMode) { const withinPackageFilter = fqn => { if (!packageFilterFqn) return true; @@ -516,18 +493,6 @@ function renderPackageTable(context) { }); } -function filterPackageTableRows(packageFilterFqn) { - const rows = dom.getPackageTableRows(); - const rowFqns = Array.from(rows, row => { - const fqnCell = row.querySelector('td.fqn'); - return fqnCell ? fqnCell.textContent : ''; - }); - const visibility = buildPackageRowVisibility(rowFqns, packageFilterFqn); - rows.forEach((row, index) => { - row.classList.toggle('hidden', !visibility[index]); - }); -} - function filterRelatedTableRows(fqn, context) { const rows = dom.getPackageTableRows(); const {relations} = getPackageSummaryData(context); @@ -1243,8 +1208,6 @@ if (typeof module !== 'undefined' && module.exports) { getCommonPrefixDepth, getPackageFqnFromTypeFqn, buildAggregationStats, - buildAggregationStatsForPackageFilter, - buildAggregationStatsForRelated, buildAggregationStatsForFilters, normalizePackageFilterValue, normalizeAggregationDepthValue, @@ -1260,7 +1223,6 @@ if (typeof module !== 'undefined' && module.exports) { buildPackageTableActionSpecs, buildPackageTableRowElement, renderPackageTable, - filterPackageTableRows, filterRelatedTableRows, renderRelatedFilterLabel, setRelatedFilterAndRender, diff --git a/jig-core/src/test/js/package.test.js b/jig-core/src/test/js/package.test.js index c0303dc53..fe5e826eb 100644 --- a/jig-core/src/test/js/package.test.js +++ b/jig-core/src/test/js/package.test.js @@ -319,45 +319,6 @@ test.describe('package.js', () => { test.describe('集計', () => { test.describe('ロジック', () => { - test('buildAggregationStatsForPackageFilter: 対象のみ数える', () => { - testContext.aggregationDepth = 0; - const packages = [ - {fqn: 'app.domain.a'}, - {fqn: 'app.domain.b'}, - {fqn: 'app.other.c'}, - ]; - const relations = [ - {from: 'app.domain.a', to: 'app.domain.b'}, - {from: 'app.other.c', to: 'app.domain.a'}, - ]; - - const stats = pkg.buildAggregationStatsForPackageFilter(packages, relations, 'app.domain', 0); - const depth0 = stats.get(0); - - assert.equal(depth0.packageCount, 2); - assert.equal(depth0.relationCount, 1); - }); - - test('buildAggregationStatsForRelated: 集計深さを反映する', () => { - const aggregationDepth = 1; - const relatedFilterMode = 'all'; - const packages = [ - {fqn: 'app.domain.a'}, - {fqn: 'app.domain.b'}, - {fqn: 'app.other.c'}, - ]; - const relations = [ - {from: 'app.domain.a', to: 'app.domain.b'}, - {from: 'app.domain.b', to: 'app.other.c'}, - ]; - - const stats = pkg.buildAggregationStatsForRelated(packages, relations, 'app.domain.a', 1, aggregationDepth, relatedFilterMode); - const depth1 = stats.get(1); - - assert.equal(depth1.packageCount, 1); - assert.equal(depth1.relationCount, 0); - }); - test('buildAggregationStatsForFilters: directモードの複合集計を行う', () => { const packages = [ {fqn: 'app.domain.a'},