Feat(UI/modules): display more module informations
This commit is contained in:
@@ -143,6 +143,8 @@ def get_roles(module_path: Path) -> None | list[str]:
|
|||||||
|
|
||||||
class ModuleManifest(TypedDict):
|
class ModuleManifest(TypedDict):
|
||||||
name: str
|
name: str
|
||||||
|
description: str
|
||||||
|
categories: list[str]
|
||||||
features: dict[str, bool]
|
features: dict[str, bool]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ export const createModulesQuery = (
|
|||||||
const response = await callApi("list_modules", {
|
const response = await callApi("list_modules", {
|
||||||
base_path: uri,
|
base_path: uri,
|
||||||
});
|
});
|
||||||
console.log({ response });
|
|
||||||
if (response.status === "error") {
|
if (response.status === "error") {
|
||||||
toast.error("Failed to fetch data");
|
toast.error("Failed to fetch data");
|
||||||
} else {
|
} else {
|
||||||
|
console.log(response.data.localModules["hello-world"]["manifest"]);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ const Roles = (props: RolesProps) => {
|
|||||||
const ModuleItem = (props: {
|
const ModuleItem = (props: {
|
||||||
name: string;
|
name: string;
|
||||||
info: ModuleInfo;
|
info: ModuleInfo;
|
||||||
|
source: string;
|
||||||
class?: string;
|
class?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const { name, info } = props;
|
const { name, info } = props;
|
||||||
@@ -60,10 +61,27 @@ const ModuleItem = (props: {
|
|||||||
props.class,
|
props.class,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{/* <div class="stat-figure text-primary-800">
|
<header class="flex flex-row items-center justify-between">
|
||||||
<div class="join">
|
<div class="flex flex-col gap-4">
|
||||||
|
<A href={`/modules/details/${props.source}/${info.manifest.name}`}>
|
||||||
|
<div class="">
|
||||||
|
<div class="flex flex-col">
|
||||||
|
{/* <Categories categories={info.categories} /> */}
|
||||||
|
<Typography hierarchy="title" size="m" weight="medium">
|
||||||
|
{info.manifest.name}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</A>
|
||||||
|
|
||||||
|
<div class="w-full">
|
||||||
|
<Typography hierarchy="body" size="xs">
|
||||||
|
{info.manifest.description}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<Menu popoverid={`menu-${props.name}`} label={<Icon icon={"More"} />}>
|
<Menu popoverid={`menu-${props.name}`} label={<Icon icon={"More"} />}>
|
||||||
<ul class="z-[1] w-52 p-2 shadow">
|
<ul class="z-[1] w-52 bg-slate-100 p-2 shadow">
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -75,27 +93,6 @@ const ModuleItem = (props: {
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
|
||||||
</div> */}
|
|
||||||
|
|
||||||
<header class="flex flex-col gap-4">
|
|
||||||
<A href={`/modules/details/${name}`}>
|
|
||||||
<div class="">
|
|
||||||
<div class="flex flex-col">
|
|
||||||
{/* <Categories categories={info.categories} /> */}
|
|
||||||
<Typography hierarchy="title" size="m" weight="medium">
|
|
||||||
{name}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</A>
|
|
||||||
|
|
||||||
<div class="w-full">
|
|
||||||
<Typography hierarchy="body" size="xs">
|
|
||||||
description
|
|
||||||
{/* TODO: {info.description} */}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</header>
|
</header>
|
||||||
<Roles roles={info.roles || {}} />
|
<Roles roles={info.roles || {}} />
|
||||||
</div>
|
</div>
|
||||||
@@ -181,6 +178,7 @@ export const ModuleList = () => {
|
|||||||
<For each={Object.entries(v)}>
|
<For each={Object.entries(v)}>
|
||||||
{([moduleName, moduleInfo]) => (
|
{([moduleName, moduleInfo]) => (
|
||||||
<ModuleItem
|
<ModuleItem
|
||||||
|
source={sourceName}
|
||||||
info={moduleInfo}
|
info={moduleInfo}
|
||||||
name={moduleName}
|
name={moduleName}
|
||||||
class={view() == "grid" ? cx("max-w-md") : ""}
|
class={view() == "grid" ? cx("max-w-md") : ""}
|
||||||
@@ -194,6 +192,7 @@ export const ModuleList = () => {
|
|||||||
<For each={Object.entries(modules().localModules)}>
|
<For each={Object.entries(modules().localModules)}>
|
||||||
{([moduleName, moduleInfo]) => (
|
{([moduleName, moduleInfo]) => (
|
||||||
<ModuleItem
|
<ModuleItem
|
||||||
|
source={"localModules"}
|
||||||
info={moduleInfo}
|
info={moduleInfo}
|
||||||
name={moduleName}
|
name={moduleName}
|
||||||
class={view() == "grid" ? cx("max-w-md") : ""}
|
class={view() == "grid" ? cx("max-w-md") : ""}
|
||||||
|
|||||||
Reference in New Issue
Block a user