Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions jig-core/src/main/resources/templates/assets/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1243,8 +1208,6 @@ if (typeof module !== 'undefined' && module.exports) {
getCommonPrefixDepth,
getPackageFqnFromTypeFqn,
buildAggregationStats,
buildAggregationStatsForPackageFilter,
buildAggregationStatsForRelated,
buildAggregationStatsForFilters,
normalizePackageFilterValue,
normalizeAggregationDepthValue,
Expand All @@ -1260,7 +1223,6 @@ if (typeof module !== 'undefined' && module.exports) {
buildPackageTableActionSpecs,
buildPackageTableRowElement,
renderPackageTable,
filterPackageTableRows,
filterRelatedTableRows,
renderRelatedFilterLabel,
setRelatedFilterAndRender,
Expand Down
39 changes: 0 additions & 39 deletions jig-core/src/test/js/package.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand Down