cleanup commands
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
const channel = getContext("channel");
|
||||
export let folder;
|
||||
export let schema;
|
||||
export let expanded = folder.shoudlExpand;
|
||||
export let expanded = folder.shouldExpand;
|
||||
|
||||
function toggleExpand() {
|
||||
expanded = !expanded;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
const readableSchemas = getContext("readableSchemas");
|
||||
|
||||
function addToFolder(tree, folderPath, aSchema) {
|
||||
let shoudlExpand = aSchema.name === schema?.name;
|
||||
let shouldExpand = aSchema.name === schema?.name;
|
||||
if (folderPath === "") {
|
||||
tree.files.push(aSchema)
|
||||
return tree
|
||||
@@ -16,12 +16,15 @@
|
||||
folderNames.forEach(folderName => {
|
||||
let queriedFolder = tree.folders.find(folder => folder.name === folderName)
|
||||
if (!queriedFolder) {
|
||||
queriedFolder = {name: folderName, files: [], folders: [], shoudlExpand: shoudlExpand};
|
||||
queriedFolder = {name: folderName, files: [], folders: [], shouldExpand: shouldExpand};
|
||||
}
|
||||
folderNames.shift()
|
||||
let remainingFolderPath = folderNames.join(".");
|
||||
queriedFolder = addToFolder(queriedFolder, remainingFolderPath, aSchema)
|
||||
|
||||
tree.folders = tree.folders.filter(f => f.name !== queriedFolder.name)
|
||||
tree.folders.push(queriedFolder);
|
||||
|
||||
})
|
||||
|
||||
return tree;
|
||||
@@ -30,7 +33,9 @@
|
||||
const schemaTree = readableSchemas.reduce((carry, schema) => {
|
||||
carry = addToFolder(carry, schema.folder,schema)
|
||||
return carry;
|
||||
}, {name: "", files: [], folders: [], shoudlExpand:true});
|
||||
}, {name: "", files: [], folders: [], shouldExpand:true});
|
||||
|
||||
console.log({schemaTree})
|
||||
</script>
|
||||
<div class="sidebar-top">
|
||||
<a class="logo" href="{channel.lucentUrl}">{channel.name}</a>
|
||||
|
||||
Reference in New Issue
Block a user