From 6289eb47ab18e1d64927db5f9f83b1be64448158 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 17 Oct 2023 23:16:10 +0200 Subject: [PATCH] [Extensions UI] Added `Actions` and `Events` sections to `Doc`. --- .../src/components/panels/Extensions/Doc.vue | 81 +++++++++++++++++-- .../panels/Extensions/Extension.vue | 5 -- 2 files changed, 76 insertions(+), 10 deletions(-) diff --git a/platypush/backend/http/webapp/src/components/panels/Extensions/Doc.vue b/platypush/backend/http/webapp/src/components/panels/Extensions/Doc.vue index e01e1567..fc86c506 100644 --- a/platypush/backend/http/webapp/src/components/panels/Extensions/Doc.vue +++ b/platypush/backend/http/webapp/src/components/panels/Extensions/Doc.vue @@ -9,7 +9,39 @@ -
+ @@ -33,6 +65,16 @@ export default { } }, + computed: { + actionNames() { + return Object.keys(this.extension.actions).sort() + }, + + eventNames() { + return Object.keys(this.extension.events).sort() + }, + }, + methods: { async parseDoc() { if (!this.extension.doc?.length) @@ -52,19 +94,19 @@ export default { // in-app connections, or opens them in a new tab if they // don't point to an internal documentation page. onDocClick(event) { - if (!event.target.tagName.toLowerCase() === 'a') - return + if (event.target.tagName.toLowerCase() !== 'a') + return true event.preventDefault() const href = event.target.getAttribute('href') if (!href) - return + return true const match = href.match(/^https:\/\/docs\.platypush\.tech\/platypush\/(plugins|backend)\/([\w.]+)\.html#?.*$/) if (!match) { event.preventDefault() window.open(href, '_blank') - return + return true } let [type, name] = match.slice(1) @@ -114,5 +156,34 @@ section { } } } + + .actions, .events { + padding: 0.5em; + overflow: auto; + + h3 { + width: calc(100% - 1em); + margin: 0 -0.5em; + padding: 0 0.5em; + font-size: 1.25em; + opacity: 0.85; + border-bottom: 1px solid $border-color-1; + } + + ul { + display: flex; + flex-direction: column; + margin: 0; + + li { + margin: 0.5em 0; + list-style: none; + } + } + + pre { + margin: 0; + } + } } diff --git a/platypush/backend/http/webapp/src/components/panels/Extensions/Extension.vue b/platypush/backend/http/webapp/src/components/panels/Extensions/Extension.vue index 49c960e9..f27181ef 100644 --- a/platypush/backend/http/webapp/src/components/panels/Extensions/Extension.vue +++ b/platypush/backend/http/webapp/src/components/panels/Extensions/Extension.vue @@ -16,11 +16,6 @@ @input="selectedTab = 'config'"> Configuration - - - Actions -