From 9de4e23a6295c42f3cebd9308b749463133f3fea Mon Sep 17 00:00:00 2001 From: Matthieu Fesselier <contact@matthieufesselier.com> Date: Thu, 10 Feb 2022 16:14:44 +0100 Subject: [PATCH] update: remove menu attributes --- src/orbit-envoy.pug | 46 -------------------------------- src/views/partials/menu-left.pug | 2 +- 2 files changed, 1 insertion(+), 47 deletions(-) diff --git a/src/orbit-envoy.pug b/src/orbit-envoy.pug index fbd7a968..5e460625 100644 --- a/src/orbit-envoy.pug +++ b/src/orbit-envoy.pug @@ -139,52 +139,6 @@ for component of components component.attributes.route = component.route; component.attributes.uniq = component.uniq; } - if(component.menuAttributes) { - let federation = new Set(); - if(client.server) { - federation.add(client.server); - } - if(client.servers) { - for(server of client.servers) { - federation.add(server); - } - } - if(component.federation) { - for(target of component.federation) { - federation.add(target); - } - } - component.federation = [...federation]; - for(const [attribute, path] of Object.entries(component.menuAttributes)) { - if(typeof path === 'string') { - if(path.startsWith('federation://')) { - let contains = generateUrl(federation, path); - if(contains.length > 1) { - federations[`store://local.${component.uniq}/${attribute}/`] = { - "@cache": "false", - "@context": "https://cdn.happy-dev.fr/owl/hdcontext.jsonld", - "@type": "ldp:Container", - "@id": `store://local.${component.uniq}/${attribute}/`, - "ldp:contains": contains, - "permissions": [{"mode": {"@type": "view"}}] - }; - component.menuAttributes[attribute] = `store://local.${component.uniq}/${attribute}/`; - } else { - component.menuAttributes[attribute] = federation.values().next().value + path.replace(/federation:\//, ''); - } - } - if(path.startsWith('server://')) { - component.menuAttributes[attribute] = client.server + path.replace(/server:\//, ''); - } - } - } - /* Rewrite every parameters to kebab-case */ - let rewriteParameters = {}; - for(const [attribute, value] of Object.entries(component.menuAttributes)) { - rewriteParameters[attribute.replace(/((?<=[a-z\d])[A-Z]|(?<=[A-Z\d])[A-Z](?=[a-z]))/g, '-$1').toLowerCase()] = value; - } - component.menuAttributes = rewriteParameters; - } if(component.extensions) { for(extension of component.extensions) { if(extension.parameters) { diff --git a/src/views/partials/menu-left.pug b/src/views/partials/menu-left.pug index efa045de..b0c39659 100644 --- a/src/views/partials/menu-left.pug +++ b/src/views/partials/menu-left.pug @@ -183,7 +183,7 @@ solid-router#navbar-router(default-route=defaultRoute) if component.experimental if component.experimental.includes('menu') div.jsMenuTab - #{"solid-"+component.type+"-menu"}&attributes(component.menuAttributes) + #{"solid-"+component.type+"-menu"} div.divider if componentSet.has('registering') -- GitLab