mirror of
https://github.com/usebruno/bruno.git
synced 2025-07-19 13:25:36 +02:00
56 lines
1.7 KiB
JavaScript
56 lines
1.7 KiB
JavaScript
import React from 'react';
|
|
import StyledWrapper from './StyledWrapper';
|
|
|
|
function countRequests(items) {
|
|
let count = 0;
|
|
|
|
function recurse(item) {
|
|
if (item && typeof item === 'object') {
|
|
if (item.type !== 'folder') {
|
|
count++;
|
|
}
|
|
if (Array.isArray(item.items)) {
|
|
item.items.forEach(recurse);
|
|
}
|
|
}
|
|
}
|
|
|
|
items.forEach(recurse);
|
|
|
|
return count;
|
|
}
|
|
|
|
const Info = ({ collection }) => {
|
|
return (
|
|
<StyledWrapper className="w-full flex flex-col h-full">
|
|
<div className="text-xs mb-4 text-muted">General information about the collection.</div>
|
|
<table className="w-full border-collapse">
|
|
<tbody>
|
|
<tr className="">
|
|
<td className="py-2 px-2 text-right">Name :</td>
|
|
<td className="py-2 px-2">{collection.name}</td>
|
|
</tr>
|
|
<tr className="">
|
|
<td className="py-2 px-2 text-right">Location :</td>
|
|
<td className="py-2 px-2 break-all">{collection.pathname}</td>
|
|
</tr>
|
|
<tr className="">
|
|
<td className="py-2 px-2 text-right">Ignored files :</td>
|
|
<td className="py-2 px-2 break-all">{collection.brunoConfig.ignore.map((x) => `'${x}'`).join(', ')}</td>
|
|
</tr>
|
|
<tr className="">
|
|
<td className="py-2 px-2 text-right">Environments :</td>
|
|
<td className="py-2 px-2">{collection.environments?.length || 0}</td>
|
|
</tr>
|
|
<tr className="">
|
|
<td className="py-2 px-2 text-right">Requests :</td>
|
|
<td className="py-2 px-2">{countRequests(collection.items)}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</StyledWrapper>
|
|
);
|
|
};
|
|
|
|
export default Info;
|