SimpleChatTCRV:UICleanup: ObjInfo dClassNames
Distinguish between top level and remaining levels. More flexibility and also cleaner flow
This commit is contained in:
parent
dac97c1e8f
commit
f8af792dc2
|
|
@ -1677,7 +1677,7 @@ export class Me {
|
||||||
modelPath: json["model_path"],
|
modelPath: json["model_path"],
|
||||||
ctxSize: json["default_generation_settings"]["n_ctx"]
|
ctxSize: json["default_generation_settings"]["n_ctx"]
|
||||||
}
|
}
|
||||||
ui.ui_show_obj_props_info(elDiv, this, props, "Current Settings/Info (dev console document[gMe])", "", { legend: 'role-system' })
|
ui.ui_show_obj_props_info(elDiv, this, props, "Current Settings/Info (dev console document[gMe])", "", { toplegend: 'role-system' })
|
||||||
}).catch(err=>console.log(`WARN:ShowInfo:${err}`))
|
}).catch(err=>console.log(`WARN:ShowInfo:${err}`))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -363,15 +363,14 @@ export function ui_show_obj_props_edit(elParent, propsTreeRoot, oObj, lProps, sL
|
||||||
* @param {Array<string>} lProps
|
* @param {Array<string>} lProps
|
||||||
* @param {string} sLegend - the legend/title for the currrent block of properties
|
* @param {string} sLegend - the legend/title for the currrent block of properties
|
||||||
* @param {string} sOffset - can be used to prefix each of the prop entries
|
* @param {string} sOffset - can be used to prefix each of the prop entries
|
||||||
* @param {any | undefined} dClassNames - can specify class for top level parent and legend
|
* @param {any | undefined} dClassNames - can specify class for toplegend and remaining levels parent and legend
|
||||||
*/
|
*/
|
||||||
export function ui_show_obj_props_info(elParent, oObj, lProps, sLegend, sOffset="", dClassNames=undefined) {
|
export function ui_show_obj_props_info(elParent, oObj, lProps, sLegend, sOffset="", dClassNames=undefined) {
|
||||||
if (sOffset.length == 0) {
|
if (sOffset.length == 0) {
|
||||||
let elDet = document.createElement("details");
|
let elDet = document.createElement("details");
|
||||||
let elSum = document.createElement("summary")
|
let elSum = document.createElement("summary")
|
||||||
if (dClassNames['legend']) {
|
if (dClassNames && dClassNames['toplegend']) {
|
||||||
elSum.classList.add(dClassNames['legend'])
|
elSum.classList.add(dClassNames['toplegend'])
|
||||||
dClassNames['legend'] = undefined
|
|
||||||
}
|
}
|
||||||
elSum.appendChild(document.createTextNode(sLegend))
|
elSum.appendChild(document.createTextNode(sLegend))
|
||||||
sLegend = ""
|
sLegend = ""
|
||||||
|
|
@ -381,7 +380,7 @@ export function ui_show_obj_props_info(elParent, oObj, lProps, sLegend, sOffset=
|
||||||
elParent = elDet
|
elParent = elDet
|
||||||
}
|
}
|
||||||
let elPLegend = el_create_append_p(sLegend, elParent)
|
let elPLegend = el_create_append_p(sLegend, elParent)
|
||||||
if (dClassNames) {
|
if ((dClassNames) && (sOffset.length > 0)) {
|
||||||
if (dClassNames['parent']) {
|
if (dClassNames['parent']) {
|
||||||
elParent.classList.add(dClassNames['parent'])
|
elParent.classList.add(dClassNames['parent'])
|
||||||
}
|
}
|
||||||
|
|
@ -401,7 +400,7 @@ export function ui_show_obj_props_info(elParent, oObj, lProps, sLegend, sOffset=
|
||||||
if (vtype != 'object') {
|
if (vtype != 'object') {
|
||||||
el_create_append_p(`${kPrint}: ${oObj[k]}`, elS)
|
el_create_append_p(`${kPrint}: ${oObj[k]}`, elS)
|
||||||
} else {
|
} else {
|
||||||
ui_show_obj_props_info(elS, val, Object.keys(val), kPrint, `>${sOffset}`)
|
ui_show_obj_props_info(elS, val, Object.keys(val), kPrint, `>${sOffset}`, dClassNames)
|
||||||
//el_create_append_p(`${k}:${JSON.stringify(oObj[k], null, " - ")}`, elS);
|
//el_create_append_p(`${k}:${JSON.stringify(oObj[k], null, " - ")}`, elS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue