Audit dialog: add SDK link support

Treeview can now show links, not only text

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I49f53f598355f398841947adaefb475cfa6ba7d1
This commit is contained in:
Szymon Kłos 2024-06-03 15:05:45 +02:00 committed by Caolán McNamara
parent 1a0d289e13
commit 58c4d86f0e
2 changed files with 28 additions and 17 deletions

View file

@ -44,22 +44,22 @@ class ServerAuditDialog {
app.serverAudit.forEach(function (entry: any) {
switch (entry.code) {
case 'is_admin':
{
if (entry.status === '0') {
entries.push({
row: 0,
columns: [
errorIcon,
{ text: _('Admin user property not set') },
{
text: 'https://sdk.collaboraonline.com/docs/advanced_integration.html?highlight=userprivateinfo#userprivateinfo',
},
],
} as TreeEntryJSON);
}
case 'is_admin': {
if (entry.status === '0') {
entries.push({
row: 0,
columns: [
errorIcon,
{ text: _('Admin user property not set') },
{
text: 'SDK: userextrainfo',
link: 'https://sdk.collaboraonline.com/docs/advanced_integration.html?highlight=userprivateinfo#userextrainfo',
},
],
} as TreeEntryJSON);
}
break;
}
}
});
@ -150,7 +150,7 @@ class ServerAuditDialog {
data: any,
builder: any,
) {
this.close();
if (eventType === 'response' || object.id === 'ok') this.close();
}
}

View file

@ -30,7 +30,7 @@
* headers: [ { text: 'first column' }, { text: 'second' }],
* entries: [
* { row: 0, columns [ { text: 'a' }, { collapsed: 'collapsedIcon.svg' }, { collapsedimage: '<BASE64 encoded PNG>' } ] },
* { row: 1, columns [ { text: 'a2' }, { expanded: 'expandedIcon.svg' }, selected: true ]}
* { row: 1, columns [ { link: 'http://example.com' }, { expanded: 'expandedIcon.svg' }, selected: true ]}
* ]
* }
*
@ -232,6 +232,11 @@ function _treelistboxEntry(parentContainer, treeViewData, entry, builder, isTree
var iconName = builder._createIconURL(iconId, true);
L.LOUtil.setImage(icon, iconName, builder.map);
L.DomUtil.addClass(span, 'ui-listview-expandable-with-icon');
} else if (entry.columns[i].link && !_isSeparator(entry.columns[i])) {
var innerText = L.DomUtil.create('span', builder.options.cssClass + ' ui-treeview-cell-text', text);
var link = L.DomUtil.create('a', '', innerText);
link.href = entry.columns[i].link || entry.columns[i].text;
link.innerText = entry.columns[i].text || entry.text;
} else if (entry.columns[i].text && !_isSeparator(entry.columns[i])) {
var innerText = L.DomUtil.create('span', builder.options.cssClass + ' ui-treeview-cell-text', text);
innerText.innerText = entry.columns[i].text || entry.text;
@ -395,8 +400,14 @@ function _headerlistboxEntry(parentContainer, treeViewData, entry, builder) {
L.DomUtil.addClass(icon, iconId + 'img');
var iconName = builder._createIconURL(iconId, true);
L.LOUtil.setImage(icon, iconName, builder.map);
} else if (entry.columns[i].text)
} else if (entry.columns[i].link) {
var link = L.DomUtil.create('a', '', td);
link.href = entry.columns[i].link || entry.columns[i].text;
link.target = '_blank';
link.innerText = entry.columns[i].text || entry.text;
} else if (entry.columns[i].text) {
td.innerText = entry.columns[i].text;
}
if (!disabled)
$(td).click(clickFunction);