Skip to content

Commit 714daa6

Browse files
authored
Merge pull request #6 from dockersamples/fix-local-catalog-issues
Fix remove button and other issues when using local content
2 parents af07bb0 + 253b6d8 commit 714daa6

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/CatalogContext.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function CatalogContextProvider({ children }) {
7777
const allLabspaces = [...customLabspaces];
7878
catalogDetails.forEach((catalog) => {
7979
catalog.labspaces.forEach((labspace) => {
80-
allLabspaces.push({ ...labspace, catalog: catalog.url });
80+
allLabspaces.push({ ...labspace, catalog: { name: catalog.name, url: catalog.url } });
8181
});
8282
});
8383
return allLabspaces.sort((a, b) => {

src/components/Catalog/CatalogSidebar.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ export function CatalogSidebar({ onFilterChange }) {
99
const [searchTerm, setSearchTerm] = useState("");
1010
const [activeCategory, setActiveCategory] = useState(null);
1111
const [selectedCatalogs, setSelectedCatalogs] = useState(
12-
catalogs.map((c) => c.url),
12+
catalogs.map((c) => c.name),
1313
);
1414
const [showManageCatalogsModal, setShowManageCatalogsModal] = useState(false);
1515

1616
useEffect(() => {
1717
const filters = [];
1818

19-
filters.push((l) => selectedCatalogs.includes(l.catalog));
19+
filters.push((l) => selectedCatalogs.includes(l.catalog.name));
2020

2121
if (searchTerm && searchTerm.length > 0) {
2222
filters.push(
@@ -92,15 +92,15 @@ export function CatalogSidebar({ onFilterChange }) {
9292
label={`${c.name} (${c.labspaces.length})`}
9393
name="catalog-filter"
9494
onChange={() => {
95-
if (selectedCatalogs.includes(c.url)) {
95+
if (selectedCatalogs.includes(c.name)) {
9696
setSelectedCatalogs(
97-
selectedCatalogs.filter((url) => url !== c.url),
97+
selectedCatalogs.filter((name) => name !== c.name),
9898
);
9999
} else {
100-
setSelectedCatalogs([...selectedCatalogs, c.url]);
100+
setSelectedCatalogs([...selectedCatalogs, c.name]);
101101
}
102102
}}
103-
checked={selectedCatalogs.includes(c.url)}
103+
checked={selectedCatalogs.includes(c.name)}
104104
/>
105105
))}
106106
</div>

0 commit comments

Comments
 (0)