@xuda.io/xuda-dbs-plugin-couchdb
Version:
Xuda Database Socket for CouchDB
40 lines (35 loc) • 1.43 kB
JavaScript
export function tabs(doc) {
return {
accounts: {
svg_icon:
'<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-palette" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="#2c3e50" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"/> <path d="M12 21a9 9 0 1 1 0 -18a9 8 0 0 1 9 8a4.5 4 0 0 1 -4.5 4h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25" /> <circle cx="7.5" cy="10.5" r=".5" fill="currentColor" /> <circle cx="12" cy="7.5" r=".5" fill="currentColor" /> <circle cx="16.5" cy="10.5" r=".5" fill="currentColor" /> </svg>',
text: "Connections",
type: "multi",
fields: {
db_name: {
type: "string",
placeholder: "My Db",
mandatory: true,
label: "Name",
size: 12,
value: `Main Db`,
},
db_connection_string: {
type: "string",
placeholder: "https://john:12345678@db.xuda.io:6984/employees",
mandatory: true,
label: "Db Connection String",
size: 12,
value: `https://${doc.app_db_admin_username}:${doc.app_db_admin_password}@xuda.io/db/${doc.app_db_name}`,
},
},
},
};
}
export function public_filter(doc) {
var ret = {};
for (const [key, val] of Object.entries(doc.accounts)) {
ret[key] = {};
}
return ret;
}