diff --git a/assets/js/common.ts b/assets/js/common.ts index 7a0f520..8d6e633 100644 --- a/assets/js/common.ts +++ b/assets/js/common.ts @@ -1,7 +1,6 @@ import { createApp } from 'petite-vue' -import { api, polling } from './settings' -import { pageid, domain } from '@params' +import { pageid, domain, nopoll } from '@params' type Config = { apiurl: string @@ -10,6 +9,7 @@ type Config = { itemid: string sid: string iid: string + nopoll: boolean } export function config (api, polling): Config { @@ -21,7 +21,8 @@ export function config (api, polling): Config { domain: domain, itemid: urlparams.get('id'), sid: getSid(), - iid: createRandString(1) + iid: createRandString(1), + nopoll: nopoll } } @@ -29,7 +30,7 @@ export const pvapp = { run(conf: Config) { appdata.conf = conf createApp(appdata).mount() - if (appdata.conf.pollurl) { + if (appdata.conf.pollurl && !appdata.conf.nopoll) { appdata.poll() } } @@ -84,7 +85,10 @@ function handle(msg) { const [ domain, action, class_, item ] = msg.path.split('/') //console.log('msgbase: ', domain, action, class_, item) // TODO: check message parts (using default values), select handler fct - Object.assign(this.components[class_ || 'data'].data, data) + const comp = this.components[class_ || data] + if (comp != undefined) { + Object.assign(comp.data, data) + } } // basic functions - move to api.ts diff --git a/assets/js/params-tsc.ts b/assets/js/params-tsc.ts index b8747c9..62ac180 100644 --- a/assets/js/params-tsc.ts +++ b/assets/js/params-tsc.ts @@ -10,4 +10,4 @@ export const domain = 'domain-dummy' export const action = 'action-dummy' export const class_ = 'class-dummy' -export const nopolling = false +export const nopoll = false diff --git a/assets/js/settings.ts b/assets/js/settings.ts index a4c5fae..7ed65af 100644 --- a/assets/js/settings.ts +++ b/assets/js/settings.ts @@ -5,8 +5,8 @@ export const api = { //export const polling = null // suppress polling export const polling = { - msgbase: ['system', 'poll', 'service', 'pclt-0001'] - //msgbase: ['system', 'poll', 'session'] + //msgbase: ['system', 'poll', 'service', 'pclt-0001'] + msgbase: ['system', 'poll', 'session'] //msgbase: ['system', 'poll', 'interaction'] } diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 43e8051..2818b79 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -28,6 +28,7 @@ params: api: domain: demo module: main.ts + nopoll: false taxonomies: domain: domains diff --git a/exampleSite/content/app/login.md b/exampleSite/content/app/login.md new file mode 100644 index 0000000..860361f --- /dev/null +++ b/exampleSite/content/app/login.md @@ -0,0 +1,29 @@ +--- +title: Login +summary: Enter Login data +img: +pageid: app-login +domains: [App] +topics: [Examples] +date: 2023-03-14 +author: helmutm +draft: false +weight: 100 +api: + domain: system + nopoll: false +--- + +cyberscopes example site - Login Form + +{{< pv/fieldset name="login" >}} + + Login: {{< pv/input-textline name="login" attrs="autofocus" >}} + Password: {{< pv/input-textline type="password" name="password" >}} + {{< pv/button label="Login" >}} + +{{< /pv/fieldset >}} + +--- + +{{< pv/debug >}} diff --git a/layouts/partials/js.html b/layouts/partials/js.html index 023d927..8529d30 100644 --- a/layouts/partials/js.html +++ b/layouts/partials/js.html @@ -1,7 +1,8 @@ {{- if $jsmod := $.Param "api.module" -}} {{- $pageid := or .Params.Pageid (and .File .File.UniqueID) "unknown" -}} {{- $params := dict "pageid" $pageid - "domain" ($.Param "api.domain") -}} + "domain" ($.Param "api.domain") + "nopoll" ($.Param "api.nopoll") | default false -}} {{- $js := resources.Get (printf "js/%s" $jsmod) | js.Build ( dict "minify" false "params" $params) -}} diff --git a/layouts/shortcodes/pv/debug.html b/layouts/shortcodes/pv/debug.html index fed3a50..ee27f27 100644 --- a/layouts/shortcodes/pv/debug.html +++ b/layouts/shortcodes/pv/debug.html @@ -4,6 +4,7 @@