mirror of
https://github.com/karl0ss/homepage.git
synced 2025-04-29 12:03:41 +01:00
Fix: support shvl on customapi dynamic list target (#5081)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
parent
313835c0e6
commit
ee7e8fab61
@ -245,7 +245,15 @@ export default function Component({ service }) {
|
||||
listItems.map((item, index) => {
|
||||
const itemName = shvl.get(item, name, "");
|
||||
const itemLabel = shvl.get(item, label, "");
|
||||
const itemUrl = target ? target.replace(/\{([^}]+)\}/g, (_, key) => item[key] || "") : null;
|
||||
|
||||
const itemUrl = target
|
||||
? [...target.matchAll(/\{(.*?)\}/g)]
|
||||
.map((match) => match[1])
|
||||
.reduce((url, targetTemplate) => {
|
||||
const value = shvl.get(item, targetTemplate, item[targetTemplate]) ?? "";
|
||||
return url.replaceAll(`{${targetTemplate}}`, value);
|
||||
}, target)
|
||||
: null;
|
||||
const className =
|
||||
"bg-theme-200/50 dark:bg-theme-900/20 rounded-sm m-1 flex-1 flex flex-row items-center justify-between p-1 text-xs";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user