refactor: update CRUD dspy and UI files

This commit is contained in:
yumoqing 2026-05-29 18:25:40 +08:00
parent 4ea407c60b
commit b41dc0a02d
20 changed files with 889 additions and 854 deletions

View File

@ -1,5 +1,8 @@
ns = params_kw.copy() ns = params_kw.copy()
for k,v in ns.items():
if v == 'NaN' or v == 'null':
ns[k] = None
id = params_kw.id id = params_kw.id
if not id or len(id) > 32: if not id or len(id) > 32:
id = uuid() id = uuid()
@ -8,28 +11,27 @@ ns['id'] = id
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.C('components', ns.copy()) r = await sor.C('components', ns.copy())
return { return {
"widgettype":"Message", "widgettype":"Message",
"options":{ "options":{
"user_data":ns,
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"title":"Add Success", "title":"Add Success",
"timeout":3, "timeout":3,
"message":"ok" "message":"ok"
} }
} }
return { return {
"widgettype":"Error", "widgettype":"Error",
"options":{ "options":{
"title":"Add Error", "title":"Add Error",
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"timeout":3, "timeout":3,
"message":"failed" "message":"failed"
} }
} }

View File

@ -1,33 +1,33 @@
ns = { ns = {
'id':params_kw['id'], 'id':params_kw['id'],
} }
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.D('components', ns) r = await sor.D('components', ns)
debug('delete success'); debug('delete success');
return { return {
"widgettype":"Message", "widgettype":"Message",
"options":{ "options":{
"title":"Delete Success", "title":"Delete Success",
"timeout":3, "timeout":3,
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"message":"ok" "message":"ok"
} }
} }
debug('Delete failed'); debug('Delete failed');
return { return {
"widgettype":"Error", "widgettype":"Error",
"options":{ "options":{
"title":"Delete Error", "title":"Delete Error",
"timeout":3, "timeout":3,
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"message":"failed" "message":"failed"
} }
} }

View File

@ -4,7 +4,7 @@ ns = params_kw.copy()
debug(f'get_components.dspy:{ns=}') debug(f'get_components.dspy:{ns=}')
if not ns.get('page'): if not ns.get('page'):
ns['page'] = 1 ns['page'] = 1
if not ns.get('sort'): if not ns.get('sort'):
ns['sort'] = 'id' ns['sort'] = 'id'
@ -15,8 +15,7 @@ from (select * from components where 1=1 [[filterstr]]) a left join (select k as
v as ccatelogid_text from appcodes_kv where parentid='ccatelog') b on a.ccatelogid = b.ccatelogid''' v as ccatelogid_text from appcodes_kv where parentid='ccatelog') b on a.ccatelogid = b.ccatelogid'''
filterjson = params_kw.get('data_filter') filterjson = params_kw.get('data_filter')
if not filterjson: fields_str=r'''[
fields = [ f['name'] for f in [
{ {
"name": "id", "name": "id",
"title": "id", "title": "id",
@ -52,7 +51,10 @@ if not filterjson:
"title": "计量值", "title": "计量值",
"type": "short" "type": "short"
} }
] ] ]'''
ori_fields = json.loads(fields_str)
if not filterjson:
fields = [ f['name'] for f in ori_fields ]
filterjson = default_filterjson(fields, ns) filterjson = default_filterjson(fields, ns)
filterdic = ns.copy() filterdic = ns.copy()
filterdic['filterstr'] = '' filterdic['filterstr'] = ''
@ -73,10 +75,10 @@ sql = ac.convert(sql, filterdic)
debug(f'{sql=}') debug(f'{sql=}')
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.sqlPaging(sql, ns) r = await sor.sqlPaging(sql, ns)
return r return r
return { return {
"total":0, "total":0,
"rows":[] "rows":[]

View File

@ -1,8 +1,10 @@
{ {
"id":"components_tbl", "id":"components_tbl",
"widgettype":"Tabular", "widgettype":"Tabular",
"options":{ "options":{
"width":"100%",
"height":"100%",
"title":"部件表", "title":"部件表",
@ -12,14 +14,22 @@
"css":"card", "css":"card",
"editable":{ "editable":{
"new_data_url":"{{entire_url('add_components.dspy')}}", "new_data_url":"{{entire_url('add_components.dspy')}}",
"delete_data_url":"{{entire_url('delete_components.dspy')}}", "delete_data_url":"{{entire_url('delete_components.dspy')}}",
"update_data_url":"{{entire_url('update_components.dspy')}}" "update_data_url":"{{entire_url('update_components.dspy')}}"
}, },
"data_url":"{{entire_url('./get_components.dspy')}}", "data_url":"{{entire_url('./get_components.dspy')}}",
"data_method":"GET", "data_method":"GET",
"data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}}, "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
"row_options":{ "row_options":{
@ -69,7 +79,7 @@
"valueField": "ccatelogid", "valueField": "ccatelogid",
"textField": "ccatelogid_text", "textField": "ccatelogid_text",
"params": { "params": {
"dbname": "{{rfexe('get_module_dbname', 'cpcc')}}", "dbname": "{{get_module_dbname('cpcc')}}",
"table": "appcodes_kv", "table": "appcodes_kv",
"tblvalue": "k", "tblvalue": "k",
"tbltext": "v", "tbltext": "v",
@ -109,13 +119,13 @@
"label": "计量值" "label": "计量值"
} }
] ]
}, },
"page_rows":160, "page_rows":160,
"cache_limit":5 "cache_limit":5
} }
,"binds":[] ,"binds":[]

View File

@ -1,32 +1,36 @@
ns = params_kw.copy() ns = params_kw.copy()
for k,v in ns.items():
if v == 'NaN' or v == 'null':
ns[k] = None
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.U('components', ns)
debug('update success'); r = await sor.U('components', ns)
return { debug('update success');
"widgettype":"Message", return {
"options":{ "widgettype":"Message",
"title":"Update Success", "options":{
"title":"Update Success",
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"timeout":3, "timeout":3,
"message":"ok" "message":"ok"
} }
} }
return { return {
"widgettype":"Error", "widgettype":"Error",
"options":{ "options":{
"title":"Update Error", "title":"Update Error",
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"timeout":3, "timeout":3,
"message":"failed" "message":"failed"
} }
} }

View File

@ -1,5 +1,8 @@
ns = params_kw.copy() ns = params_kw.copy()
for k,v in ns.items():
if v == 'NaN' or v == 'null':
ns[k] = None
id = params_kw.id id = params_kw.id
if not id or len(id) > 32: if not id or len(id) > 32:
id = uuid() id = uuid()
@ -8,28 +11,27 @@ ns['id'] = id
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.C('cpccluster', ns.copy()) r = await sor.C('cpccluster', ns.copy())
return { return {
"widgettype":"Message", "widgettype":"Message",
"options":{ "options":{
"user_data":ns,
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"title":"Add Success", "title":"Add Success",
"timeout":3, "timeout":3,
"message":"ok" "message":"ok"
} }
} }
return { return {
"widgettype":"Error", "widgettype":"Error",
"options":{ "options":{
"title":"Add Error", "title":"Add Error",
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"timeout":3, "timeout":3,
"message":"failed" "message":"failed"
} }
} }

View File

@ -1,33 +1,33 @@
ns = { ns = {
'id':params_kw['id'], 'id':params_kw['id'],
} }
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.D('cpccluster', ns) r = await sor.D('cpccluster', ns)
debug('delete success'); debug('delete success');
return { return {
"widgettype":"Message", "widgettype":"Message",
"options":{ "options":{
"title":"Delete Success", "title":"Delete Success",
"timeout":3, "timeout":3,
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"message":"ok记得把关联的节点都解除占用状态 ~" "message":"ok"
} }
} }
debug('Delete failed'); debug('Delete failed');
return { return {
"widgettype":"Error", "widgettype":"Error",
"options":{ "options":{
"title":"Delete Error", "title":"Delete Error",
"timeout":3, "timeout":3,
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"message":"failed" "message":"failed"
} }
} }

View File

@ -4,19 +4,19 @@ ns = params_kw.copy()
debug(f'get_cpccluster.dspy:{ns=}') debug(f'get_cpccluster.dspy:{ns=}')
if not ns.get('page'): if not ns.get('page'):
ns['page'] = 1 ns['page'] = 1
if not ns.get('sort'): if not ns.get('sort'):
ns['sort'] = 'id' ns['sort'] = 'id'
sql = '''select a.*, b.clustertype_text, c.controllerid_text sql = '''select a.*, b.clustertype_text, c.controllerid_text
from (select * from cpccluster where 1=1 [[filterstr]]) a left join (select k as clustertype, from (select * from cpccluster where 1=1 [[filterstr]]) a left join (select k as clustertype,
v as clustertype_text from appcodes_kv where parentid='clustertype') b on a.clustertype = b.clustertype left join (select id as controllerid, v as clustertype_text from appcodes_kv where parentid='clustertype') b on a.clustertype = b.clustertype left join (select id as controllerid,
ip as controllerid_text from cpcnode where 1 = 1) c on a.controllerid = c.controllerid''' name as controllerid_text from hostdev where 1 = 1) c on a.controllerid = c.controllerid'''
filterjson = params_kw.get('data_filter') filterjson = params_kw.get('data_filter')
if not filterjson: fields_str=r'''[
fields = [ f['name'] for f in [
{ {
"name": "id", "name": "id",
"title": "id", "title": "id",
@ -60,7 +60,10 @@ if not filterjson:
"type": "date", "type": "date",
"length": 255 "length": 255
} }
] ] ]'''
ori_fields = json.loads(fields_str)
if not filterjson:
fields = [ f['name'] for f in ori_fields ]
filterjson = default_filterjson(fields, ns) filterjson = default_filterjson(fields, ns)
filterdic = ns.copy() filterdic = ns.copy()
filterdic['filterstr'] = '' filterdic['filterstr'] = ''
@ -81,10 +84,10 @@ sql = ac.convert(sql, filterdic)
debug(f'{sql=}') debug(f'{sql=}')
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.sqlPaging(sql, ns) r = await sor.sqlPaging(sql, ns)
return r return r
return { return {
"total":0, "total":0,
"rows":[] "rows":[]

View File

@ -1,239 +1,155 @@
{ {
"id": "cpccluster_tbl", "id":"cpccluster_tbl",
"widgettype": "Tabular", "widgettype":"Tabular",
"options": { "options":{
"title": "算力集群", "width":"100%",
"css": "card", "height":"100%",
"toolbar": {
"tools": [
{ "title":"算力集群",
"name": "newworker",
"selected_row": true,
"label": "新增工作节点"
},
{ "css":"card",
"name": "newpodyaml",
"selected_row": true,
"label": "新建资源YAML" "editable":{
}
], "new_data_url":"{{entire_url('add_cpccluster.dspy')}}",
"css": "float-right"
},
"editable": { "delete_data_url":"{{entire_url('delete_cpccluster.dspy')}}",
"new_data_url": "{{entire_url('add_cpccluster.dspy')}}",
"delete_data_url": "{{entire_url('delete_cpccluster.dspy')}}",
"update_data_url": "{{entire_url('update_cpccluster.dspy')}}" "update_data_url":"{{entire_url('update_cpccluster.dspy')}}"
},
"data_url": "{{entire_url('./get_cpccluster.dspy')}}", },
"data_method": "GET",
"data_params": {{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
"row_options": { "data_url":"{{entire_url('./get_cpccluster.dspy')}}",
"browserfields": {
"exclouded": [ "data_method":"GET",
"id", "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
"cpcid", "row_options":{
"clusterid"
],
"alters": {}
}, "browserfields": {
"editexclouded": [ "exclouded": [
"id", "id",
"cpcid", "cpcid"
"clusterid" ],
], "alters": {}
"fields": [ },
{
"name": "name",
"title": "集群名称", "editexclouded":[
"type": "str", "id",
"length": 255, "cpcid"
"cwidth": 14, ],
"uitype": "str",
"datatype": "str", "fields":[
"label": "集群名称"
},
{
"name": "controllerid",
"title": "控制节点IP",
"type": "str",
"length": 32,
"cwidth": 12,
"label": "控制节点IP",
"uitype": "code",
"valueField": "controllerid",
"textField": "controllerid_text",
"params": {
"dbname": "{{rfexe('get_module_dbname', 'cpcc')}}",
"table": "cpcnode",
"tblvalue": "id",
"tbltext": "name",
"valueField": "controllerid",
"textField": "controllerid_text"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "id",
"title": "id",
"type": "str",
"length": 32,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "id"
},
{
"name": "cpcid",
"title": "算力中心id",
"type": "str",
"length": 32,
"nullable": "no",
"cwidth": 10,
"uitype": "str",
"datatype": "str",
"label": "算力中心id"
},
{
"name": "clustertype",
"title": "集群类型",
"type": "str",
"length": 1,
"cwidth": 8,
"label": "集群类型",
"uitype": "code",
"valueField": "clustertype",
"textField": "clustertype_text",
"params": {
"dbname": "{{rfexe('get_module_dbname', 'cpcc')}}",
"table": "appcodes_kv",
"tblvalue": "k",
"tbltext": "v",
"valueField": "clustertype",
"textField": "clustertype_text",
"cond": "parentid='clustertype'"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "clusterjoin",
"title": "加入集群凭证",
"type": "str",
"length": 255,
"cwidth": 45,
"uitype": "str",
"datatype": "str",
"label": "加入集群凭证"
},
{
"name": "enable_date",
"title": "启用日期",
"type": "date",
"length": 0,
"cwidth": 8,
"uitype": "date",
"datatype": "date",
"label": "启用日期"
},
{
"name": "export_date",
"title": "停用日期",
"type": "date",
"length": 0,
"cwidth": 8,
"uitype": "date",
"datatype": "date",
"label": "停用日期"
}
]
},
"content_view": {
"widgettype": "TabPanel",
"options": {
"tab_wide": "auto",
"height": "100%",
"width": "100%",
"tab_pos": "top",
"items": [
{
"name": "cpcpod",
"label": "实时资源实例",
"content": {
"widgettype": "urlwidget",
"options": {
"params": {
"clusterid": "${id}",
"cpcid": "${cpcid}"
},
"url": "{{entire_url('..\/cpcpod')}}"
}
}
},
{
"name": "cpcworker",
"label": "实时集群节点",
"content": {
"widgettype": "urlwidget",
"options": {
"params": {
"clusterid": "${id}",
"cpcid": "${cpcid}"
},
"url": "{{entire_url('..\/cpcworker')}}"
}
}
},
{
"name": "cpcyamlconfig",
"label": "资源实例配置",
"content": {
"widgettype": "urlwidget",
"options": {
"params": {
"clusterid": "${id}",
"cpcid": "${cpcid}"
},
"url": "{{entire_url('..\/cpcpodyaml')}}"
}
}
}
]
}
},
"page_rows": 160,
"cache_limit": 5
},
"binds": [
{ {
"wid": "self", "name": "id",
"event": "newworker", "title": "id",
"actiontype": "urlwidget", "type": "str",
"target": "PopupWindow", "length": 32,
"popup_options": { "cwidth": 18,
"width": "80%", "uitype": "str",
"height": "80%" "datatype": "str",
}, "label": "id"
"options": {
"url": "{{entire_url('../cpcworker/new_worker.ui')}}",
"params": {
"id": "{{params_kw.id}}"
}
}
}, },
{ {
"wid": "self", "name": "name",
"event": "newpodyaml", "title": "名称",
"actiontype": "urlwidget", "type": "str",
"target": "PopupWindow", "length": 255,
"popup_options": { "cwidth": 18,
"width": "80%", "uitype": "str",
"height": "80%" "datatype": "str",
"label": "名称"
},
{
"name": "cpcid",
"title": "算力中心id",
"type": "str",
"length": 32,
"nullable": "no",
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "算力中心id"
},
{
"name": "clustertype",
"title": "集群类型",
"type": "str",
"length": 1,
"label": "集群类型",
"uitype": "code",
"valueField": "clustertype",
"textField": "clustertype_text",
"params": {
"dbname": "{{get_module_dbname('cpcc')}}",
"table": "appcodes_kv",
"tblvalue": "k",
"tbltext": "v",
"valueField": "clustertype",
"textField": "clustertype_text",
"cond": "parentid='clustertype'"
}, },
"options": { "dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
"url": "{{entire_url('../cpcpod/new_podyaml.ui')}}", },
"params": { {
"id": "{{params_kw.id}}" "name": "controllerid",
} "title": "控制节点id",
} "type": "str",
"length": 32,
"label": "控制节点id",
"uitype": "code",
"valueField": "controllerid",
"textField": "controllerid_text",
"params": {
"dbname": "{{get_module_dbname('cpcc')}}",
"table": "hostdev",
"tblvalue": "id",
"tbltext": "name",
"valueField": "controllerid",
"textField": "controllerid_text"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "enable_date",
"title": "启用日期",
"type": "date",
"length": 0,
"cwidth": 18,
"uitype": "date",
"datatype": "date",
"label": "启用日期"
},
{
"name": "export_date",
"title": "停用日期",
"type": "date",
"length": 0,
"cwidth": 18,
"uitype": "date",
"datatype": "date",
"label": "停用日期"
} }
] ]
} },
"page_rows":160,
"cache_limit":5
}
,"binds":[]
}

View File

@ -1,32 +1,36 @@
ns = params_kw.copy() ns = params_kw.copy()
for k,v in ns.items():
if v == 'NaN' or v == 'null':
ns[k] = None
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.U('cpccluster', ns)
debug('update success'); r = await sor.U('cpccluster', ns)
return { debug('update success');
"widgettype":"Message", return {
"options":{ "widgettype":"Message",
"title":"Update Success", "options":{
"title":"Update Success",
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"timeout":3, "timeout":3,
"message":"ok" "message":"ok"
} }
} }
return { return {
"widgettype":"Error", "widgettype":"Error",
"options":{ "options":{
"title":"Update Error", "title":"Update Error",
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"timeout":3, "timeout":3,
"message":"failed" "message":"failed"
} }
} }

View File

@ -1,5 +1,8 @@
ns = params_kw.copy() ns = params_kw.copy()
for k,v in ns.items():
if v == 'NaN' or v == 'null':
ns[k] = None
id = params_kw.id id = params_kw.id
if not id or len(id) > 32: if not id or len(id) > 32:
id = uuid() id = uuid()
@ -25,28 +28,27 @@ if not userorgid:
ns['orgid'] = userorgid ns['orgid'] = userorgid
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.C('cpclist', ns.copy()) r = await sor.C('cpclist', ns.copy())
return { return {
"widgettype":"Message", "widgettype":"Message",
"options":{ "options":{
"user_data":ns,
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"title":"Add Success", "title":"Add Success",
"timeout":3, "timeout":3,
"message":"ok" "message":"ok"
} }
} }
return { return {
"widgettype":"Error", "widgettype":"Error",
"options":{ "options":{
"title":"Add Error", "title":"Add Error",
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"timeout":3, "timeout":3,
"message":"failed" "message":"failed"
} }
} }

View File

@ -1,6 +1,6 @@
ns = { ns = {
'id':params_kw['id'], 'id':params_kw['id'],
} }
@ -19,29 +19,29 @@ if not userorgid:
ns['orgid'] = userorgid ns['orgid'] = userorgid
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.D('cpclist', ns) r = await sor.D('cpclist', ns)
debug('delete success'); debug('delete success');
return { return {
"widgettype":"Message", "widgettype":"Message",
"options":{ "options":{
"title":"Delete Success", "title":"Delete Success",
"timeout":3, "timeout":3,
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"message":"ok" "message":"ok"
} }
} }
debug('Delete failed'); debug('Delete failed');
return { return {
"widgettype":"Error", "widgettype":"Error",
"options":{ "options":{
"title":"Delete Error", "title":"Delete Error",
"timeout":3, "timeout":3,
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"message":"failed" "message":"failed"
} }
} }

View File

@ -19,7 +19,7 @@ ns['userorgid'] = userorgid
debug(f'get_cpclist.dspy:{ns=}') debug(f'get_cpclist.dspy:{ns=}')
if not ns.get('page'): if not ns.get('page'):
ns['page'] = 1 ns['page'] = 1
if not ns.get('sort'): if not ns.get('sort'):
ns['sort'] = 'id' ns['sort'] = 'id'
@ -30,8 +30,7 @@ from (select * from cpclist where 1=1 [[filterstr]]) a left join (select id as o
orgname as orgid_text from organization where 1 = 1) b on a.orgid = b.orgid''' orgname as orgid_text from organization where 1 = 1) b on a.orgid = b.orgid'''
filterjson = params_kw.get('data_filter') filterjson = params_kw.get('data_filter')
if not filterjson: fields_str=r'''[
fields = [ f['name'] for f in [
{ {
"name": "id", "name": "id",
"title": "id", "title": "id",
@ -92,7 +91,10 @@ if not filterjson:
"type": "str", "type": "str",
"length": 100 "length": 100
} }
] ] ]'''
ori_fields = json.loads(fields_str)
if not filterjson:
fields = [ f['name'] for f in ori_fields ]
filterjson = default_filterjson(fields, ns) filterjson = default_filterjson(fields, ns)
filterdic = ns.copy() filterdic = ns.copy()
filterdic['filterstr'] = '' filterdic['filterstr'] = ''
@ -113,10 +115,10 @@ sql = ac.convert(sql, filterdic)
debug(f'{sql=}') debug(f'{sql=}')
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.sqlPaging(sql, ns) r = await sor.sqlPaging(sql, ns)
return r return r
return { return {
"total":0, "total":0,
"rows":[] "rows":[]

View File

@ -1,209 +1,266 @@
{ {
"id": "cpclist_tbl", "id":"cpclist_tbl",
"widgettype": "Tabular", "widgettype":"Tabular",
"options": { "options":{
"title": "算力中心列表", "width":"100%",
"toolbar": { "height":"100%",
"tools": [
{
"name": "newcluster", "title":"算力中心列表",
"selected_row": true,
"label": "新建集群"
}
]
}, "toolbar":{
"css": "card", "tools": [
"editable": {
"new_data_url": "{{entire_url('add_cpclist.dspy')}}",
"delete_data_url": "{{entire_url('delete_cpclist.dspy')}}",
"update_data_url": "{{entire_url('update_cpclist.dspy')}}"
},
"data_url": "{{entire_url('./get_cpclist.dspy')}}",
"data_method": "GET",
"data_params": {{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
"row_options": {
"browserfields": {
"exclouded": [
"id",
"orgid",
"pcapi_url",
"pcapi_user",
"pcapi_pwd"
],
"alters": {}
},
"editexclouded": [
"id",
"orgid"
],
"fields": [
{
"name": "id",
"title": "id",
"type": "str",
"length": 32,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "id"
},
{
"name": "name",
"title": "名称",
"type": "str",
"length": 255,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "名称"
},
{
"name": "orgid",
"title": "属主机构id",
"type": "str",
"length": 32,
"label": "属主机构id",
"uitype": "code",
"valueField": "orgid",
"textField": "orgid_text",
"params": {
"dbname": "{{rfexe('get_module_dbname', 'cpcc')}}",
"table": "organization",
"tblvalue": "id",
"tbltext": "orgname",
"valueField": "orgid",
"textField": "orgid_text"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "pcapi_url",
"title": "pcapi网址",
"type": "str",
"length": 500,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "pcapi网址"
},
{
"name": "api_user",
"title": "接口用户",
"type": "str",
"length": 100,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "接口用户"
},
{
"name": "api_pwd",
"title": "接口密码",
"type": "str",
"length": 100,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "接口密码"
},
{
"name": "enable_date",
"title": "启用日期",
"type": "date",
"length": 0,
"cwidth": 18,
"uitype": "date",
"datatype": "date",
"label": "启用日期"
},
{
"name": "expire_date",
"title": "停用日期",
"type": "date",
"length": 0,
"cwidth": 18,
"uitype": "date",
"datatype": "date",
"label": "停用日期"
},
{
"name": "contactname",
"title": "联系人",
"type": "str",
"length": 100,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "联系人"
},
{
"name": "contactphone",
"title": "联系电话",
"type": "str",
"length": 100,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "联系电话"
}
]
},
"content_view": {
"widgettype": "TabPanel",
"options": {
"tab_wide": "auto",
"height": "100%",
"width": "100%",
"tab_pos": "top",
"items": [
{
"name": "cpccluster",
"label": "集群",
"content": {
"widgettype": "urlwidget",
"options": {
"params": {
"cpcid": "${id}"
},
"url": "{{entire_url('..\/cpccluster')}}"
}
}
},
{
"name": "cpcnode",
"label": "节点",
"content": {
"widgettype": "urlwidget",
"options": {
"params": {
"cpcid": "${id}"
},
"url": "{{entire_url('..\/cpcnode')}}"
}
}
}
]
}
},
"page_rows": 160,
"cache_limit": 5
},
"binds": [
{ {
"wid": "self", "name": "newcluster",
"event": "newcluster", "selected_row": true,
"actiontype": "urlwidget", "label": "新建集群"
"target": "PopupWindow", },
"popup_options": { {
"width": "80%", "selected_row": true,
"height": "80%" "name": "cpccluster",
}, "icon": "{{entire_url('/imgs/cpccluster.svg')}}",
"options": { "label": "集群"
"url": "{{entire_url('../handy/new_cluster.ui')}}", },
"params": { {
"id": "{{params_kw.id}}" "selected_row": true,
} "name": "cpcnode",
} "icon": "{{entire_url('/imgs/cpcnode.svg')}}",
"label": "节点"
} }
] ]
} },
"css":"card",
"editable":{
"new_data_url":"{{entire_url('add_cpclist.dspy')}}",
"delete_data_url":"{{entire_url('delete_cpclist.dspy')}}",
"update_data_url":"{{entire_url('update_cpclist.dspy')}}"
},
"data_url":"{{entire_url('./get_cpclist.dspy')}}",
"data_method":"GET",
"data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
"row_options":{
"browserfields": {
"exclouded": [
"id",
"orgid",
"pcapi_url",
"pcapi_user",
"pcapi_pwd"
],
"alters": {}
},
"editexclouded":[
"id",
"orgid"
],
"fields":[
{
"name": "id",
"title": "id",
"type": "str",
"length": 32,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "id"
},
{
"name": "name",
"title": "名称",
"type": "str",
"length": 255,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "名称"
},
{
"name": "orgid",
"title": "属主机构id",
"type": "str",
"length": 32,
"label": "属主机构id",
"uitype": "code",
"valueField": "orgid",
"textField": "orgid_text",
"params": {
"dbname": "{{get_module_dbname('cpcc')}}",
"table": "organization",
"tblvalue": "id",
"tbltext": "orgname",
"valueField": "orgid",
"textField": "orgid_text"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "pcapi_url",
"title": "pcapi网址",
"type": "str",
"length": 500,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "pcapi网址"
},
{
"name": "api_user",
"title": "接口用户",
"type": "str",
"length": 100,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "接口用户"
},
{
"name": "api_pwd",
"title": "接口密码",
"type": "str",
"length": 100,
"cwidth": 18,
"uitype": "password",
"datatype": "str",
"label": "接口密码"
},
{
"name": "enable_date",
"title": "启用日期",
"type": "date",
"length": 0,
"cwidth": 18,
"uitype": "date",
"datatype": "date",
"label": "启用日期"
},
{
"name": "expire_date",
"title": "停用日期",
"type": "date",
"length": 0,
"cwidth": 18,
"uitype": "date",
"datatype": "date",
"label": "停用日期"
},
{
"name": "contactname",
"title": "联系人",
"type": "str",
"length": 100,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "联系人"
},
{
"name": "contactphone",
"title": "联系电话",
"type": "str",
"length": 100,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "联系电话"
}
]
},
"page_rows":160,
"cache_limit":5
}
,"binds":[
{
"wid": "self",
"event": "newcluster",
"actiontype": "urlwidget",
"target": "PopupWindow",
"popup_options": {
"width": "80%",
"height": "80%"
},
"options": {
"url": "{{entire_url('../handy/new_cluster.ui')}}",
"params": {
"id": "{{params_kw.id}}"
}
}
},
{
"wid": "self",
"event": "cpccluster",
"actiontype": "urlwidget",
"target": "PopupWindow",
"popup_options": {
"title": "集群",
"icon": "{{entire_url('/appbase/get_icon.dspy')}}?id=cpccluster",
"resizable": true,
"height": "70%",
"width": "70%"
},
"params_mapping": {
"mapping": {
"id": "cpcid",
"referer_widget": "referer_widget"
},
"need_other": false
},
"options": {
"method": "POST",
"params": {},
"url": "{{entire_url('../cpccluster')}}"
}
},
{
"wid": "self",
"event": "cpcnode",
"actiontype": "urlwidget",
"target": "PopupWindow",
"popup_options": {
"title": "节点",
"icon": "{{entire_url('/appbase/get_icon.dspy')}}?id=cpcnode",
"resizable": true,
"height": "70%",
"width": "70%"
},
"params_mapping": {
"mapping": {
"id": "cpcid",
"referer_widget": "referer_widget"
},
"need_other": false
},
"options": {
"method": "POST",
"params": {},
"url": "{{entire_url('../cpcnode')}}"
}
}
]
}

View File

@ -1,5 +1,8 @@
ns = params_kw.copy() ns = params_kw.copy()
for k,v in ns.items():
if v == 'NaN' or v == 'null':
ns[k] = None
userorgid = await get_userorgid() userorgid = await get_userorgid()
@ -18,32 +21,53 @@ ns['orgid'] = userorgid
if params_kw.get('api_pwd'): if params_kw.get('api_pwd'):
ns['api_pwd'] = password_encode(params_kw.get('api_pwd')) ns['api_pwd'] = password_encode(params_kw.get('api_pwd'))
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.U('cpclist', ns)
debug('update success'); ns1 = {
return {
"widgettype":"Message", "orgid": userorgid,
"options":{
"title":"Update Success",
"id": params_kw.id
}
recs = await sor.R('cpclist', ns1)
if len(recs) < 1:
return {
"widgettype":"Error",
"options":{
"title":"Update Error",
"cwidth":16,
"cheight":9,
"timeout":3,
"message":"Record no exist or with wrong ownership"
}
}
r = await sor.U('cpclist', ns)
debug('update success');
return {
"widgettype":"Message",
"options":{
"title":"Update Success",
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"timeout":3, "timeout":3,
"message":"ok" "message":"ok"
} }
} }
return { return {
"widgettype":"Error", "widgettype":"Error",
"options":{ "options":{
"title":"Update Error", "title":"Update Error",
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"timeout":3, "timeout":3,
"message":"failed" "message":"failed"
} }
} }

View File

@ -1,5 +1,8 @@
ns = params_kw.copy() ns = params_kw.copy()
for k,v in ns.items():
if v == 'NaN' or v == 'null':
ns[k] = None
id = params_kw.id id = params_kw.id
if not id or len(id) > 32: if not id or len(id) > 32:
id = uuid() id = uuid()
@ -11,28 +14,27 @@ if params_kw.get('adminpwd'):
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.C('cpcnode', ns.copy()) r = await sor.C('cpcnode', ns.copy())
return { return {
"widgettype":"Message", "widgettype":"Message",
"options":{ "options":{
"user_data":ns,
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"title":"Add Success", "title":"Add Success",
"timeout":3, "timeout":3,
"message":"ok" "message":"ok"
} }
} }
return { return {
"widgettype":"Error", "widgettype":"Error",
"options":{ "options":{
"title":"Add Error", "title":"Add Error",
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"timeout":3, "timeout":3,
"message":"failed" "message":"failed"
} }
} }

View File

@ -1,33 +1,33 @@
ns = { ns = {
'id':params_kw['id'], 'id':params_kw['id'],
} }
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.D('cpcnode', ns) r = await sor.D('cpcnode', ns)
debug('delete success'); debug('delete success');
return { return {
"widgettype":"Message", "widgettype":"Message",
"options":{ "options":{
"title":"Delete Success", "title":"Delete Success",
"timeout":3, "timeout":3,
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"message":"ok" "message":"ok"
} }
} }
debug('Delete failed'); debug('Delete failed');
return { return {
"widgettype":"Error", "widgettype":"Error",
"options":{ "options":{
"title":"Delete Error", "title":"Delete Error",
"timeout":3, "timeout":3,
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"message":"failed" "message":"failed"
} }
} }

View File

@ -4,23 +4,18 @@ ns = params_kw.copy()
debug(f'get_cpcnode.dspy:{ns=}') debug(f'get_cpcnode.dspy:{ns=}')
if not ns.get('page'): if not ns.get('page'):
ns['page'] = 1 ns['page'] = 1
if not ns.get('sort'): if not ns.get('sort'):
ns['sort'] = 'id' ns['sort'] = 'id'
sql = '''select a.*, b.node_status_text,d.devicetype_text sql = '''select a.*, b.node_status_text
from (select * from cpcnode where 1=1 [[filterstr]]) from (select * from cpcnode where 1=1 [[filterstr]]) a left join (select k as node_status,
a left join (select k as node_status, v as node_status_text from appcodes_kv where parentid='node_status') v as node_status_text from appcodes_kv where parentid='node_status') b on a.node_status = b.node_status'''
b on a.node_status = b.node_status
left join (select k as devicetype, v as devicetype_text from appcodes_kv where parentid = 'devicetype')
d on a.devicetype = d.devicetype'''
filterjson = params_kw.get('data_filter') filterjson = params_kw.get('data_filter')
if not filterjson: fields_str=r'''[
fields = [ f['name'] for f in [
{ {
"name": "id", "name": "id",
"title": "id", "title": "id",
@ -33,12 +28,6 @@ if not filterjson:
"type": "str", "type": "str",
"length": 255 "length": 255
}, },
{
"name": "devicetype",
"title": "设备类型",
"type": "str",
"length": 1
},
{ {
"name": "ip", "name": "ip",
"title": "内网ip", "title": "内网ip",
@ -95,7 +84,10 @@ if not filterjson:
"type": "date", "type": "date",
"length": 255 "length": 255
} }
] ] ]'''
ori_fields = json.loads(fields_str)
if not filterjson:
fields = [ f['name'] for f in ori_fields ]
filterjson = default_filterjson(fields, ns) filterjson = default_filterjson(fields, ns)
filterdic = ns.copy() filterdic = ns.copy()
filterdic['filterstr'] = '' filterdic['filterstr'] = ''
@ -116,10 +108,10 @@ sql = ac.convert(sql, filterdic)
debug(f'{sql=}') debug(f'{sql=}')
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.sqlPaging(sql, ns) r = await sor.sqlPaging(sql, ns)
return r return r
return { return {
"total":0, "total":0,
"rows":[] "rows":[]

View File

@ -1,179 +1,188 @@
{ {
"id": "cpcnode_tbl", "id":"cpcnode_tbl",
"widgettype": "Tabular", "widgettype":"Tabular",
"options": { "options":{
"title": "入网算力节点", "width":"100%",
"css": "card", "height":"100%",
"editable": {
"new_data_url": "{{entire_url('add_cpcnode.dspy')}}",
"delete_data_url": "{{entire_url('delete_cpcnode.dspy')}}", "title":"算力节点",
"update_data_url": "{{entire_url('update_cpcnode.dspy')}}"
},
"data_url": "{{entire_url('./get_cpcnode.dspy')}}",
"data_method": "GET",
"data_params": {{json.dumps(params_kw, indent=4, ensure_ascii=False)}}, "css":"card",
"row_options": {
"browserfields": {
"exclouded": [ "editable":{
"id",
"cpcid", "new_data_url":"{{entire_url('add_cpcnode.dspy')}}",
"clusterid"
],
"alters": {} "delete_data_url":"{{entire_url('delete_cpcnode.dspy')}}",
},
"editexclouded": [
"id", "update_data_url":"{{entire_url('update_cpcnode.dspy')}}"
"cpcid",
"clusterid" },
],
"fields": [
{ "data_url":"{{entire_url('./get_cpcnode.dspy')}}",
"name": "id",
"title": "id", "data_method":"GET",
"type": "str", "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
"length": 32, "row_options":{
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "id" "browserfields": {
}, "exclouded": [
{ "id",
"name": "ip", "cpcid"
"title": "内网ip", ],
"type": "str", "alters": {}
"length": 90, },
"cwidth": 10,
"uitype": "str",
"datatype": "str", "editexclouded":[
"label": "内网ip" "id",
}, "cpcid",
{ "clusterid"
"name": "name", ],
"title": "名称",
"type": "str", "fields":[
"length": 255, {
"cwidth": 16, "name": "id",
"uitype": "str", "title": "id",
"datatype": "str", "type": "str",
"label": "名称" "length": 32,
}, "cwidth": 18,
{ "uitype": "str",
"name": "devicetype", "datatype": "str",
"title": "设备类型", "label": "id"
"type": "str",
"length": 1,
"cwidth": 8,
"label": "设备类型",
"uitype": "code",
"valueField": "devicetype",
"textField": "devicetype_text",
"params": {
"dbname": "{{rfexe('get_module_dbname', 'cpcc')}}",
"table": "appcodes_kv",
"tblvalue": "k",
"tbltext": "v",
"valueField": "devicetype",
"textField": "devicetype_text",
"cond": "parentid='devicetype'"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "sshport",
"title": "ssh端口号",
"type": "short",
"length": 0,
"uitype": "int",
"datatype": "short",
"label": "ssh端口号"
},
{
"name": "adminuser",
"title": "管理账号",
"type": "str",
"length": 99,
"cwidth": 8,
"uitype": "str",
"datatype": "str",
"label": "管理账号"
},
{
"name": "adminpwd",
"title": "管理密码",
"type": "str",
"length": 99,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "管理密码"
},
{
"name": "cpcid",
"title": "算力中心id",
"type": "str",
"length": 32,
"nullable": "no",
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "算力中心id"
},
{
"name": "node_status",
"title": "节点状态",
"type": "str",
"length": 1,
"nullable": "yes",
"label": "节点状态",
"uitype": "code",
"valueField": "node_status",
"textField": "node_status_text",
"params": {
"dbname": "{{rfexe('get_module_dbname', 'cpcc')}}",
"table": "appcodes_kv",
"tblvalue": "k",
"tbltext": "v",
"valueField": "node_status",
"textField": "node_status_text",
"cond": "parentid='node_status'"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "clusterid",
"title": "所属集群",
"type": "long",
"length": 0,
"nullable": "yes",
"cwidth": 18,
"uitype": "int",
"datatype": "long",
"label": "所属集群"
},
{
"name": "enable_date",
"title": "启用日期",
"type": "date",
"length": 0,
"cwidth": 18,
"uitype": "date",
"datatype": "date",
"label": "启用日期"
},
{
"name": "export_date",
"title": "停用日期",
"type": "date",
"length": 0,
"cwidth": 18,
"uitype": "date",
"datatype": "date",
"label": "停用日期"
}
]
},
"page_rows": 160,
"cache_limit": 5
}, },
"binds": [] {
"name": "name",
"title": "名称",
"type": "str",
"length": 255,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "名称"
},
{
"name": "ip",
"title": "内网ip",
"type": "str",
"length": 90,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "内网ip"
},
{
"name": "sshport",
"title": "ssh端口号",
"type": "short",
"length": 0,
"uitype": "int",
"datatype": "short",
"label": "ssh端口号"
},
{
"name": "adminuser",
"title": "管理账号",
"type": "str",
"length": 99,
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "管理账号"
},
{
"name": "adminpwd",
"title": "管理密码",
"type": "str",
"length": 99,
"cwidth": 18,
"uitype": "password",
"datatype": "str",
"label": "管理密码"
},
{
"name": "cpcid",
"title": "算力中心id",
"type": "str",
"length": 32,
"nullable": "no",
"cwidth": 18,
"uitype": "str",
"datatype": "str",
"label": "算力中心id"
},
{
"name": "node_status",
"title": "节点状态",
"type": "str",
"length": 1,
"nullable": "yes",
"label": "节点状态",
"uitype": "code",
"valueField": "node_status",
"textField": "node_status_text",
"params": {
"dbname": "{{get_module_dbname('cpcc')}}",
"table": "appcodes_kv",
"tblvalue": "k",
"tbltext": "v",
"valueField": "node_status",
"textField": "node_status_text",
"cond": "parentid='node_status'"
},
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
},
{
"name": "clusterid",
"title": "所属集群",
"type": "long",
"length": 0,
"nullable": "yes",
"cwidth": 18,
"uitype": "int",
"datatype": "long",
"label": "所属集群"
},
{
"name": "enable_date",
"title": "启用日期",
"type": "date",
"length": 0,
"cwidth": 18,
"uitype": "date",
"datatype": "date",
"label": "启用日期"
},
{
"name": "export_date",
"title": "停用日期",
"type": "date",
"length": 0,
"cwidth": 18,
"uitype": "date",
"datatype": "date",
"label": "停用日期"
}
]
},
"page_rows":160,
"cache_limit":5
}
,"binds":[]
} }

View File

@ -1,35 +1,39 @@
ns = params_kw.copy() ns = params_kw.copy()
for k,v in ns.items():
if v == 'NaN' or v == 'null':
ns[k] = None
if params_kw.get('adminpwd'): if params_kw.get('adminpwd'):
ns['adminpwd'] = password_encode(params_kw.get('adminpwd')) ns['adminpwd'] = password_encode(params_kw.get('adminpwd'))
db = DBPools() db = DBPools()
dbname = await rfexe('get_module_dbname', 'cpcc') dbname = get_module_dbname('cpcc')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
r = await sor.U('cpcnode', ns)
debug('update success'); r = await sor.U('cpcnode', ns)
return { debug('update success');
"widgettype":"Message", return {
"options":{ "widgettype":"Message",
"title":"Update Success", "options":{
"title":"Update Success",
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"timeout":3, "timeout":3,
"message":"ok" "message":"ok"
} }
} }
return { return {
"widgettype":"Error", "widgettype":"Error",
"options":{ "options":{
"title":"Update Error", "title":"Update Error",
"cwidth":16, "cwidth":16,
"cheight":9, "cheight":9,
"timeout":3, "timeout":3,
"message":"failed" "message":"failed"
} }
} }