fix 'new' processing; remove obsolete parent from handle() method

This commit is contained in:
Helmut Merz 2023-03-25 17:11:06 +01:00
parent bf2c1bfa91
commit a067f6db7f
4 changed files with 9 additions and 8 deletions

View file

@ -67,7 +67,7 @@ function handle(msg) {
return
}
if (comp) {
comp.handle(this, domain, action, class_, item, msg.payload)
comp.handle(domain, action, class_, item, msg.payload)
}
}

View file

@ -32,15 +32,15 @@ export function Data(name: string, conf: any): object {
// Data methods
function handle(parent: any, domain, action, class_, item, payload: string) {
function handle(domain, action, class_, item, payload: string) {
const data = JSON.parse(payload)
if (action == 'data') { // && this.state.id == item) {
if (action === 'data') { // && this.state.id == item) {
Object.assign(this.data, data)
this.state.mode = 'view'
} else if (action == 'response') { // && data.rc == 3) {
} else if (action === 'response') { // && data.rc == 3) {
this.state.id = item
window.location.hash = item
sendMsg(parent.conf, [this.domain, 'query', this.name, item], {})
sendMsg(this.conf, [this.domain, 'query', this.name, item], {})
}
}
@ -55,7 +55,7 @@ function exec(action: string) {
this.output += '\n' + value
console.log('exec:', value)
const msgbase = [this.domain, action, this.name]
if (this.mode != 'new') {
if (this.state.mode !== 'new') {
msgbase.push(this.state.id)
}
sendMsg(conf, msgbase, data)

View file

@ -27,7 +27,7 @@ export function List(name: string, conf: any): object {
// Data methods
function handle(parent: any, domain, action, class_, item: string, payload) {
function handle(domain, action, class_, item: string, payload) {
if (action == 'list') {
const rows = payload.split('\n')
this.data.length = 0

View file

@ -5,7 +5,8 @@
{{- $conf := merge $.Params (dict "domain" $domain "action" $action)
| jsonify -}}
<table class="table"
v-scope="{{ $comp }}('{{ $name }}', {{ $conf }})">
v-scope="{{ $comp }}('{{ $name }}', {{ $conf }})"
@vue:mounted="register('{{ $name }}', valueOf())">
<tr>{{- .Inner -}}</tr>
<tr v-for="item in data" :key="item._item">
<td v-for="(col, fname) in meta">