@collabdt/core 0.12.2 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/components/AppSidebarContent.js +2 -2
- package/dist/core/components/AppSidebarContent.js.map +1 -1
- package/dist/core/components/organizationConfig/src/organizationConfigContent.d.ts.map +1 -1
- package/dist/core/components/organizationConfig/src/organizationConfigContent.js +5 -11
- package/dist/core/components/organizationConfig/src/organizationConfigContent.js.map +1 -1
- package/dist/core/components/viewers/Data/DataMenu.js +1 -1
- package/dist/core/components/viewers/Data/DataMenu.js.map +1 -1
- package/dist/core/components/viewers/Data/HeaderButtons.js +1 -1
- package/dist/core/components/viewers/Data/HeaderButtons.js.map +1 -1
- package/dist/core/components/viewers/Data/utils/viewerConfig.js +1 -1
- package/dist/core/components/viewers/Data/utils/viewerConfig.js.map +1 -1
- package/dist/core/components/viewers/Viewer.js +1 -1
- package/dist/core/components/viewers/Viewer.js.map +1 -1
- package/dist/core/components/viewers/plugins/PluginsManager.d.ts +6 -9
- package/dist/core/components/viewers/plugins/PluginsManager.d.ts.map +1 -1
- package/dist/core/components/viewers/plugins/PluginsManager.js +321 -122
- package/dist/core/components/viewers/plugins/PluginsManager.js.map +1 -1
- package/dist/core/components/viewers/plugins/src/PluginDetails.d.ts +22 -0
- package/dist/core/components/viewers/plugins/src/PluginDetails.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/PluginDetails.js +204 -0
- package/dist/core/components/viewers/plugins/src/PluginDetails.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/PluginQuickControls.d.ts +25 -0
- package/dist/core/components/viewers/plugins/src/PluginQuickControls.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/PluginQuickControls.js +79 -0
- package/dist/core/components/viewers/plugins/src/PluginQuickControls.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/PluginRow.d.ts +28 -0
- package/dist/core/components/viewers/plugins/src/PluginRow.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/PluginRow.js +141 -0
- package/dist/core/components/viewers/plugins/src/PluginRow.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/RegistryAccessList.d.ts +9 -0
- package/dist/core/components/viewers/plugins/src/RegistryAccessList.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/RegistryAccessList.js +96 -0
- package/dist/core/components/viewers/plugins/src/RegistryAccessList.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/RegistryDetails.d.ts +19 -0
- package/dist/core/components/viewers/plugins/src/RegistryDetails.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/RegistryDetails.js +171 -0
- package/dist/core/components/viewers/plugins/src/RegistryDetails.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/RegistryImport.d.ts +7 -0
- package/dist/core/components/viewers/plugins/src/RegistryImport.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/RegistryImport.js +88 -0
- package/dist/core/components/viewers/plugins/src/RegistryImport.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/RegistryPublishStrip.d.ts +14 -0
- package/dist/core/components/viewers/plugins/src/RegistryPublishStrip.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/RegistryPublishStrip.js +74 -0
- package/dist/core/components/viewers/plugins/src/RegistryPublishStrip.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/RegistryToolbar.d.ts +12 -0
- package/dist/core/components/viewers/plugins/src/RegistryToolbar.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/RegistryToolbar.js +41 -0
- package/dist/core/components/viewers/plugins/src/RegistryToolbar.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/VisibleToPicker.d.ts +10 -0
- package/dist/core/components/viewers/plugins/src/VisibleToPicker.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/VisibleToPicker.js +82 -0
- package/dist/core/components/viewers/plugins/src/VisibleToPicker.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/pluginColumns.d.ts +12 -0
- package/dist/core/components/viewers/plugins/src/pluginColumns.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/pluginColumns.js +47 -0
- package/dist/core/components/viewers/plugins/src/pluginColumns.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/pluginRows.d.ts +29 -0
- package/dist/core/components/viewers/plugins/src/pluginRows.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/pluginRows.js +66 -0
- package/dist/core/components/viewers/plugins/src/pluginRows.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/pluginStatus.d.ts +6 -5
- package/dist/core/components/viewers/plugins/src/pluginStatus.d.ts.map +1 -1
- package/dist/core/components/viewers/plugins/src/pluginStatus.js +8 -1
- package/dist/core/components/viewers/plugins/src/pluginStatus.js.map +1 -1
- package/dist/core/components/viewers/plugins/src/publishState.d.ts +22 -0
- package/dist/core/components/viewers/plugins/src/publishState.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/publishState.js +19 -0
- package/dist/core/components/viewers/plugins/src/publishState.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/registryErrorMessage.d.ts +3 -0
- package/dist/core/components/viewers/plugins/src/registryErrorMessage.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/registryErrorMessage.js +11 -0
- package/dist/core/components/viewers/plugins/src/registryErrorMessage.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/sharedPluginChanges.d.ts +15 -0
- package/dist/core/components/viewers/plugins/src/sharedPluginChanges.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/sharedPluginChanges.js +24 -0
- package/dist/core/components/viewers/plugins/src/sharedPluginChanges.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/sortPluginRows.d.ts +15 -0
- package/dist/core/components/viewers/plugins/src/sortPluginRows.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/sortPluginRows.js +45 -0
- package/dist/core/components/viewers/plugins/src/sortPluginRows.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/useFittedColumns.d.ts +5 -0
- package/dist/core/components/viewers/plugins/src/useFittedColumns.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/useFittedColumns.js +27 -0
- package/dist/core/components/viewers/plugins/src/useFittedColumns.js.map +1 -0
- package/dist/core/components/viewers/plugins/src/useMountedPlugins.d.ts +6 -2
- package/dist/core/components/viewers/plugins/src/useMountedPlugins.d.ts.map +1 -1
- package/dist/core/components/viewers/plugins/src/useMountedPlugins.js +8 -2
- package/dist/core/components/viewers/plugins/src/useMountedPlugins.js.map +1 -1
- package/dist/core/components/viewers/plugins/src/usePluginsData.d.ts.map +1 -1
- package/dist/core/components/viewers/plugins/src/usePluginsData.js +10 -5
- package/dist/core/components/viewers/plugins/src/usePluginsData.js.map +1 -1
- package/dist/core/components/viewers/plugins/src/useRegistryPlugins.d.ts +15 -0
- package/dist/core/components/viewers/plugins/src/useRegistryPlugins.d.ts.map +1 -0
- package/dist/core/components/viewers/plugins/src/useRegistryPlugins.js +105 -0
- package/dist/core/components/viewers/plugins/src/useRegistryPlugins.js.map +1 -0
- package/dist/core/components/viewers/plugins/types.d.ts +87 -0
- package/dist/core/components/viewers/plugins/types.d.ts.map +1 -1
- package/dist/core/components/viewers/viewerAccess.d.ts.map +1 -1
- package/dist/core/components/viewers/viewerAccess.js +2 -0
- package/dist/core/components/viewers/viewerAccess.js.map +1 -1
- package/dist/core/hooks/plugins/createPluginHooks.d.ts +2 -10
- package/dist/core/hooks/plugins/createPluginHooks.d.ts.map +1 -1
- package/dist/core/hooks/plugins/createPluginHooks.js +1 -2
- package/dist/core/hooks/plugins/createPluginHooks.js.map +1 -1
- package/dist/core/i18n/messages/en.json +130 -19
- package/dist/core/i18n/messages/es.json +130 -19
- package/dist/core/i18n/messages/fr.json +130 -19
- package/dist/core/plugins/sdk/semver.d.ts +7 -0
- package/dist/core/plugins/sdk/semver.d.ts.map +1 -0
- package/dist/core/plugins/sdk/semver.js +52 -0
- package/dist/core/plugins/sdk/semver.js.map +1 -0
- package/dist/core/types/dbTypes.d.ts +1 -1
- package/dist/core/types/dbTypes.d.ts.map +1 -1
- package/dist/core/types/dbTypes.js +1 -1
- package/dist/core/types/dbTypes.js.map +1 -1
- package/dist/core/utils/appContent.d.ts +4 -7
- package/dist/core/utils/appContent.d.ts.map +1 -1
- package/dist/core/utils/appContent.js +8 -3
- package/dist/core/utils/appContent.js.map +1 -1
- package/package.json +1 -1
- package/dist/core/components/viewers/plugins/src/PluginCard.d.ts +0 -14
- package/dist/core/components/viewers/plugins/src/PluginCard.d.ts.map +0 -1
- package/dist/core/components/viewers/plugins/src/PluginCard.js +0 -234
- package/dist/core/components/viewers/plugins/src/PluginCard.js.map +0 -1
|
@@ -34,6 +34,7 @@ var __objRest = (source, exclude) => {
|
|
|
34
34
|
return target;
|
|
35
35
|
};
|
|
36
36
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
37
|
+
import * as LR from "lucide-react";
|
|
37
38
|
import { useTranslations } from "next-intl";
|
|
38
39
|
import * as React from "react";
|
|
39
40
|
import { toast } from "sonner";
|
|
@@ -42,6 +43,8 @@ import { INSTALLED_PLUGINS } from "../../../plugins/installed";
|
|
|
42
43
|
import { resolvePluginEntry } from "../../../plugins/sdk/types";
|
|
43
44
|
import { usePermissions } from "../../../store/Permissions/context";
|
|
44
45
|
import { ViewerNames } from "../../../types/dbTypes";
|
|
46
|
+
import ConfirmDialog from "../../ConfirmDialog";
|
|
47
|
+
import { Badge } from "../../ui/Badge";
|
|
45
48
|
import {
|
|
46
49
|
Breadcrumb,
|
|
47
50
|
BreadcrumbItem,
|
|
@@ -49,53 +52,85 @@ import {
|
|
|
49
52
|
BreadcrumbPage
|
|
50
53
|
} from "../../ui/Breadcrumb";
|
|
51
54
|
import { Input } from "../../ui/Input";
|
|
55
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../ui/Tabs";
|
|
52
56
|
import { VIEWER_CONFIG } from "../Data/utils/viewerConfig";
|
|
53
|
-
import {
|
|
57
|
+
import { visibleColumns } from "./src/pluginColumns";
|
|
58
|
+
import { PluginDetails } from "./src/PluginDetails";
|
|
59
|
+
import { InstallQuickControl, OrgQuickControl, UserQuickControl } from "./src/PluginQuickControls";
|
|
60
|
+
import { PLUGIN_ROW_GRID, PluginRow, pluginRowStyle } from "./src/PluginRow";
|
|
61
|
+
import { isInTab, isMine, matchesSearch, mergePluginRows, registryStanding } from "./src/pluginRows";
|
|
54
62
|
import { effectiveStatus } from "./src/pluginStatus";
|
|
63
|
+
import { isPublishState } from "./src/publishState";
|
|
64
|
+
import { RegistryDetails } from "./src/RegistryDetails";
|
|
65
|
+
import { RegistryToolbar } from "./src/RegistryToolbar";
|
|
66
|
+
import { nextSort, rowName, SORT_KEYS, sortPluginRows } from "./src/sortPluginRows";
|
|
67
|
+
import { useFittedColumns } from "./src/useFittedColumns";
|
|
55
68
|
import { usePluginsActions, usePluginsData } from "./src/usePluginsData";
|
|
56
|
-
|
|
69
|
+
import { useRegistryActions, useRegistryPlugins } from "./src/useRegistryPlugins";
|
|
70
|
+
import { VisibleToPicker } from "./src/VisibleToPicker";
|
|
71
|
+
function PluginsManager({ listings, actions, registryActions }) {
|
|
72
|
+
var _a;
|
|
57
73
|
const t = useTranslations("PluginsPage");
|
|
58
|
-
const
|
|
59
|
-
const { ability } = usePermissions();
|
|
74
|
+
const tRegistry = useTranslations("PluginRegistry");
|
|
75
|
+
const { ability: casl } = usePermissions();
|
|
60
76
|
const [searchTerm, setSearchTerm] = React.useState("");
|
|
61
|
-
const
|
|
77
|
+
const [tab, setTab] = React.useState("all");
|
|
78
|
+
const [scope, setScope] = React.useState("all");
|
|
79
|
+
const viewerConfig = VIEWER_CONFIG[ViewerNames.plugins];
|
|
62
80
|
const headerTitle = t("title");
|
|
63
81
|
const MenuIcon = viewerConfig == null ? void 0 : viewerConfig.icon;
|
|
64
82
|
const { listings: resolved, isLoading } = usePluginsData(listings);
|
|
65
83
|
const boundActions = usePluginsActions(actions);
|
|
66
84
|
const host = usePluginHost();
|
|
85
|
+
const { registry } = useRegistryPlugins();
|
|
86
|
+
const boundRegistryActions = useRegistryActions(registryActions);
|
|
67
87
|
const [overrides, setOverrides] = React.useState({});
|
|
68
|
-
const
|
|
88
|
+
const listingRows = React.useMemo(
|
|
69
89
|
() => resolved.map((row) => {
|
|
70
90
|
const patch = overrides[row.manifest.slug];
|
|
71
91
|
return patch ? __spreadValues(__spreadValues({}, row), patch) : row;
|
|
72
92
|
}),
|
|
73
93
|
[resolved, overrides]
|
|
74
94
|
);
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const orgAdmin = ability.can("update", "PluginInstallation") || legacyWriter;
|
|
95
|
+
const ability = React.useMemo(() => {
|
|
96
|
+
const orgAdmin = casl.can("update", "PluginInstallation");
|
|
78
97
|
return {
|
|
79
|
-
canInstall:
|
|
98
|
+
canInstall: casl.can("create", "PluginInstallation") || orgAdmin,
|
|
80
99
|
canConfigureOrg: orgAdmin,
|
|
81
|
-
canChooseForSelf:
|
|
100
|
+
canChooseForSelf: casl.can("update", "PluginUserSetting")
|
|
82
101
|
};
|
|
83
|
-
}, [
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
102
|
+
}, [casl]);
|
|
103
|
+
const rows = React.useMemo(
|
|
104
|
+
() => mergePluginRows(listingRows, registry.configured ? registry.plugins : []),
|
|
105
|
+
[listingRows, registry]
|
|
106
|
+
);
|
|
107
|
+
const devTeam = React.useMemo(
|
|
108
|
+
() => {
|
|
109
|
+
var _a2;
|
|
110
|
+
return registry.configured && registry.viewer ? { canGrant: registry.viewer.canGrant, canPublishFromDisk: (_a2 = registry.viewer.canPublishFromDisk) != null ? _a2 : false } : null;
|
|
111
|
+
},
|
|
112
|
+
[registry]
|
|
113
|
+
);
|
|
114
|
+
const canGrant = (_a = devTeam == null ? void 0 : devTeam.canGrant) != null ? _a : false;
|
|
115
|
+
const hasRegistryStanding = rows.some((row) => registryStanding(row, devTeam) !== null);
|
|
116
|
+
const columns = React.useMemo(
|
|
117
|
+
() => visibleColumns(ability, canGrant, hasRegistryStanding),
|
|
118
|
+
[ability, canGrant, hasRegistryStanding]
|
|
119
|
+
);
|
|
120
|
+
const [sort, setSort] = React.useState(null);
|
|
121
|
+
const tabs = [
|
|
122
|
+
"all",
|
|
123
|
+
"running",
|
|
124
|
+
"installed",
|
|
125
|
+
...ability.canInstall ? ["notInstalled"] : [],
|
|
126
|
+
...registry.configured ? ["registry"] : []
|
|
127
|
+
];
|
|
128
|
+
const needle = searchTerm.trim().toLowerCase();
|
|
129
|
+
const rowsFor = (target) => rows.filter((row) => isInTab(row, target, tabs) && matchesSearch(row, needle) && (target !== "registry" || scope === "all" || isMine(row)));
|
|
130
|
+
const sortedRowsFor = (target) => sortPluginRows(rowsFor(target), sort);
|
|
96
131
|
React.useEffect(() => {
|
|
97
132
|
if (!host) return;
|
|
98
|
-
for (const row of
|
|
133
|
+
for (const row of listingRows) {
|
|
99
134
|
const { slug } = row.manifest;
|
|
100
135
|
const shouldRun = effectiveStatus(row) === "running";
|
|
101
136
|
const isRunning = host.getStatus(slug) === "active";
|
|
@@ -109,7 +144,7 @@ function PluginsManager({ listings, actions }) {
|
|
|
109
144
|
void host.unloadPlugin(slug);
|
|
110
145
|
}
|
|
111
146
|
}
|
|
112
|
-
}, [
|
|
147
|
+
}, [listingRows, host]);
|
|
113
148
|
const commit = React.useCallback(
|
|
114
149
|
async (slug, name, patch, write, success) => {
|
|
115
150
|
setOverrides((current) => __spreadProps(__spreadValues({}, current), { [slug]: __spreadValues(__spreadValues({}, current[slug]), patch) }));
|
|
@@ -119,7 +154,7 @@ function PluginsManager({ listings, actions }) {
|
|
|
119
154
|
} catch (error) {
|
|
120
155
|
console.error("Plugin update failed:", error);
|
|
121
156
|
setOverrides((current) => {
|
|
122
|
-
const
|
|
157
|
+
const _a2 = current, { [slug]: _reverted } = _a2, rest = __objRest(_a2, [__restKey(slug)]);
|
|
123
158
|
return rest;
|
|
124
159
|
});
|
|
125
160
|
toast.error(t("toastFailed", { name }));
|
|
@@ -127,120 +162,284 @@ function PluginsManager({ listings, actions }) {
|
|
|
127
162
|
},
|
|
128
163
|
[t]
|
|
129
164
|
);
|
|
165
|
+
const tabLabel = {
|
|
166
|
+
all: t("tabAll"),
|
|
167
|
+
running: t("tabRunning"),
|
|
168
|
+
installed: t("tabInstalled"),
|
|
169
|
+
notInstalled: t("tabNotInstalled"),
|
|
170
|
+
registry: tRegistry("tabLabel")
|
|
171
|
+
};
|
|
172
|
+
const emptyText = (target) => {
|
|
173
|
+
if (needle) return t("noResults", { query: searchTerm.trim() });
|
|
174
|
+
if (target === "registry") return emptyRegistryText();
|
|
175
|
+
if (target === "notInstalled") return t("emptyNotInstalled");
|
|
176
|
+
if (target === "running") return t("emptyRunning");
|
|
177
|
+
if (isLoading && resolved.length === 0) return t("loading");
|
|
178
|
+
return ability.canInstall ? t("emptyAdmin") : t("empty");
|
|
179
|
+
};
|
|
180
|
+
const emptyRegistryText = () => {
|
|
181
|
+
if (scope === "mine") return tRegistry("emptyMine");
|
|
182
|
+
if (devTeam == null ? void 0 : devTeam.canPublishFromDisk) return tRegistry("empty");
|
|
183
|
+
return canGrant ? tRegistry("emptyImport") : tRegistry("emptyAwaitingImport");
|
|
184
|
+
};
|
|
130
185
|
return /* @__PURE__ */ jsx("div", { className: "sm:p-2 overflow-hidden bg-[#fafafa] h-full", children: /* @__PURE__ */ jsx("div", { className: "bg-background rounded-xl shadow h-full min-h-0", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
131
186
|
/* @__PURE__ */ jsx("div", { className: "flex flex-row gap-2 justify-start items-center px-3 py-4 relative", children: /* @__PURE__ */ jsx(Breadcrumb, { className: "px-3", children: /* @__PURE__ */ jsx(BreadcrumbList, { children: /* @__PURE__ */ jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsx(BreadcrumbPage, { children: headerTitle }) }) }) }) }),
|
|
132
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-row justify-between items-center px-6 py-6", children: /* @__PURE__ */ jsxs("div", { className: "flex
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
135
|
-
/* @__PURE__ */ jsx("h1", { className: "text-2xl text-foreground", children: headerTitle })
|
|
136
|
-
] }),
|
|
137
|
-
/* @__PURE__ */ jsx("h2", { className: "text-sm text-muted-foreground font-normal max-w-[70ch]", children: t("intro") })
|
|
187
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-row justify-between items-center px-6 py-6", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
188
|
+
MenuIcon && /* @__PURE__ */ jsx(MenuIcon, { className: "h-8 w-8" }),
|
|
189
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl text-foreground", children: headerTitle })
|
|
138
190
|
] }) }),
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
|
|
191
|
+
/* @__PURE__ */ jsxs(
|
|
192
|
+
Tabs,
|
|
141
193
|
{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
194
|
+
value: tab,
|
|
195
|
+
onValueChange: (value) => setTab(value),
|
|
196
|
+
className: "flex flex-1 min-h-0 flex-col",
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row sm:justify-between items-stretch sm:items-end px-3 sm:px-6 py-4 gap-3 sm:gap-4", children: [
|
|
199
|
+
tabs.length > 1 ? /* @__PURE__ */ jsx(TabsList, { className: "w-auto sm:flex-1", children: tabs.map((target) => /* @__PURE__ */ jsxs(TabsTrigger, { value: target, children: [
|
|
200
|
+
tabLabel[target],
|
|
201
|
+
/* @__PURE__ */ jsx(Badge, { className: "ml-1 tabular-nums", children: rowsFor(target).length })
|
|
202
|
+
] }, target)) }) : /* @__PURE__ */ jsx("span", {}),
|
|
203
|
+
/* @__PURE__ */ jsx("div", { className: "w-full sm:w-80", children: /* @__PURE__ */ jsx(
|
|
204
|
+
Input,
|
|
205
|
+
{
|
|
206
|
+
placeholder: t("searchPlaceholder"),
|
|
207
|
+
value: searchTerm,
|
|
208
|
+
onChange: (event) => setSearchTerm(event.target.value),
|
|
209
|
+
"aria-label": t("searchPlaceholder")
|
|
210
|
+
}
|
|
211
|
+
) })
|
|
212
|
+
] }),
|
|
213
|
+
tabs.map((target) => /* @__PURE__ */ jsxs(
|
|
214
|
+
TabsContent,
|
|
156
215
|
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
216
|
+
value: target,
|
|
217
|
+
className: "mt-0 flex-1 min-h-0 overflow-y-auto px-3 sm:px-6 pb-8",
|
|
218
|
+
"data-testid": target === "registry" ? "plugin-registry" : `plugins-tab-${target}`,
|
|
219
|
+
children: [
|
|
220
|
+
target === "registry" && /* @__PURE__ */ jsx(
|
|
221
|
+
RegistryToolbar,
|
|
222
|
+
{
|
|
223
|
+
registry,
|
|
224
|
+
actions: boundRegistryActions,
|
|
225
|
+
scope,
|
|
226
|
+
onScopeChange: setScope
|
|
227
|
+
}
|
|
228
|
+
),
|
|
229
|
+
target === "notInstalled" && /* @__PURE__ */ jsx("p", { className: "mb-3 text-sm text-muted-foreground", children: t("tabNotInstalledHint") }),
|
|
230
|
+
/* @__PURE__ */ jsx(
|
|
231
|
+
PluginTable,
|
|
232
|
+
{
|
|
233
|
+
rows: sortedRowsFor(target),
|
|
234
|
+
columns,
|
|
235
|
+
sort,
|
|
236
|
+
onSort: (key) => setSort((current) => nextSort(current, key)),
|
|
237
|
+
emptyText: emptyText(target),
|
|
238
|
+
children: (row, fittedColumns) => /* @__PURE__ */ jsx(
|
|
239
|
+
Row,
|
|
240
|
+
{
|
|
241
|
+
row,
|
|
242
|
+
columns: fittedColumns,
|
|
243
|
+
ability,
|
|
244
|
+
actions: boundActions,
|
|
245
|
+
commit,
|
|
246
|
+
devTeam,
|
|
247
|
+
registryActions: boundRegistryActions
|
|
248
|
+
},
|
|
249
|
+
row.slug
|
|
250
|
+
)
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
]
|
|
161
254
|
},
|
|
162
|
-
|
|
255
|
+
target
|
|
163
256
|
))
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
Row,
|
|
168
|
-
{
|
|
169
|
-
listing: row,
|
|
170
|
-
ability: canManage,
|
|
171
|
-
actions: boundActions,
|
|
172
|
-
commit
|
|
173
|
-
},
|
|
174
|
-
row.manifest.slug
|
|
175
|
-
)) })
|
|
176
|
-
] }) })
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
)
|
|
177
260
|
] }) }) });
|
|
178
261
|
}
|
|
262
|
+
const COLUMN_LABEL_KEY = {
|
|
263
|
+
name: "columnPlugin",
|
|
264
|
+
version: "columnVersion",
|
|
265
|
+
status: "columnStatus",
|
|
266
|
+
run: "columnRun",
|
|
267
|
+
install: "columnInstall",
|
|
268
|
+
enable: "columnEnable",
|
|
269
|
+
visibleTo: "columnVisibleTo",
|
|
270
|
+
registry: "columnRegistry"
|
|
271
|
+
};
|
|
272
|
+
const isSortKey = (column) => SORT_KEYS.includes(column);
|
|
273
|
+
function PluginTable({
|
|
274
|
+
rows,
|
|
275
|
+
columns,
|
|
276
|
+
sort,
|
|
277
|
+
onSort,
|
|
278
|
+
emptyText,
|
|
279
|
+
children
|
|
280
|
+
}) {
|
|
281
|
+
const t = useTranslations("PluginsPage");
|
|
282
|
+
const [tableRef, fitted] = useFittedColumns(columns);
|
|
283
|
+
if (rows.length === 0) {
|
|
284
|
+
return /* @__PURE__ */ jsx("p", { className: "rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground", children: emptyText });
|
|
285
|
+
}
|
|
286
|
+
return /* @__PURE__ */ jsxs("div", { ref: tableRef, className: "min-w-0 overflow-hidden rounded-xl border", children: [
|
|
287
|
+
/* @__PURE__ */ jsx(
|
|
288
|
+
"div",
|
|
289
|
+
{
|
|
290
|
+
role: "row",
|
|
291
|
+
className: `${PLUGIN_ROW_GRID} border-b bg-muted/30 px-3 py-1 text-xs text-muted-foreground`,
|
|
292
|
+
style: pluginRowStyle(fitted),
|
|
293
|
+
children: fitted.map((column) => {
|
|
294
|
+
const label = t(COLUMN_LABEL_KEY[column]);
|
|
295
|
+
const className = column === "name" ? "pl-6" : void 0;
|
|
296
|
+
if (!isSortKey(column)) return /* @__PURE__ */ jsx("span", { role: "columnheader", className, children: label }, column);
|
|
297
|
+
const direction = (sort == null ? void 0 : sort.key) === column ? sort.direction : null;
|
|
298
|
+
const SortIcon = direction === "asc" ? LR.ArrowUp : direction === "desc" ? LR.ArrowDown : LR.ArrowUpDown;
|
|
299
|
+
return /* @__PURE__ */ jsx(
|
|
300
|
+
"span",
|
|
301
|
+
{
|
|
302
|
+
role: "columnheader",
|
|
303
|
+
"aria-sort": direction === "asc" ? "ascending" : direction === "desc" ? "descending" : "none",
|
|
304
|
+
className,
|
|
305
|
+
children: /* @__PURE__ */ jsxs(
|
|
306
|
+
"button",
|
|
307
|
+
{
|
|
308
|
+
type: "button",
|
|
309
|
+
className: "-mx-1 inline-flex items-center gap-1 rounded px-1 py-1 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
310
|
+
onClick: () => onSort(column),
|
|
311
|
+
"aria-label": t("sortBy", { column: label }),
|
|
312
|
+
children: [
|
|
313
|
+
label,
|
|
314
|
+
/* @__PURE__ */ jsx(SortIcon, { "aria-hidden": true, className: direction ? "h-3.5 w-3.5" : "h-3.5 w-3.5 opacity-40" })
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
},
|
|
319
|
+
column
|
|
320
|
+
);
|
|
321
|
+
})
|
|
322
|
+
}
|
|
323
|
+
),
|
|
324
|
+
/* @__PURE__ */ jsx("ul", { children: rows.map((row) => children(row, fitted)) })
|
|
325
|
+
] });
|
|
326
|
+
}
|
|
179
327
|
function Row({
|
|
180
|
-
|
|
328
|
+
row,
|
|
329
|
+
columns,
|
|
181
330
|
ability,
|
|
182
331
|
actions,
|
|
183
|
-
commit
|
|
332
|
+
commit,
|
|
333
|
+
devTeam,
|
|
334
|
+
registryActions
|
|
184
335
|
}) {
|
|
336
|
+
var _a, _b, _c, _d;
|
|
185
337
|
const t = useTranslations("PluginsPage");
|
|
186
|
-
const { slug } =
|
|
187
|
-
const name =
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
338
|
+
const { slug, listing, entry } = row;
|
|
339
|
+
const name = rowName(row);
|
|
340
|
+
const canGrant = (_a = devTeam == null ? void 0 : devTeam.canGrant) != null ? _a : false;
|
|
341
|
+
const standing = registryStanding(row, devTeam);
|
|
342
|
+
const publishing = listing && standing && isPublishState(standing) ? { manifest: listing.manifest, state: standing } : void 0;
|
|
343
|
+
const showRegistry = Boolean(devTeam && (entry || publishing));
|
|
344
|
+
const [open, setOpen] = React.useState(false);
|
|
345
|
+
const [confirmingUninstall, setConfirmingUninstall] = React.useState(false);
|
|
346
|
+
const setOrgEnabled = (enabled) => void commit(
|
|
347
|
+
slug,
|
|
348
|
+
name,
|
|
349
|
+
{ orgEnabled: enabled },
|
|
350
|
+
() => actions.setOrgEnabled(slug, enabled),
|
|
351
|
+
enabled ? t("toastOrgEnabled", { name }) : t("toastOrgDisabled", { name })
|
|
352
|
+
);
|
|
353
|
+
const setUserEnabled = (enabled) => void commit(
|
|
354
|
+
slug,
|
|
355
|
+
name,
|
|
356
|
+
{ userEnabled: enabled },
|
|
357
|
+
() => actions.setUserEnabled(slug, enabled),
|
|
358
|
+
enabled ? t("toastUserEnabled", { name }) : t("toastUserDisabled", { name })
|
|
359
|
+
);
|
|
360
|
+
const writeInstalled = (installed) => void commit(
|
|
361
|
+
slug,
|
|
362
|
+
name,
|
|
363
|
+
{ installed, status: installed ? "off" : "available" },
|
|
364
|
+
() => actions.setInstalled(slug, installed),
|
|
365
|
+
installed ? t("toastInstalled", { name }) : t("toastUninstalled", { name })
|
|
366
|
+
);
|
|
367
|
+
const setInstalled = (installed) => installed ? writeInstalled(true) : setConfirmingUninstall(true);
|
|
368
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
369
|
+
/* @__PURE__ */ jsxs(
|
|
370
|
+
PluginRow,
|
|
371
|
+
{
|
|
372
|
+
open,
|
|
373
|
+
onOpenChange: setOpen,
|
|
374
|
+
columns,
|
|
375
|
+
cells: {
|
|
376
|
+
run: /* @__PURE__ */ jsx(UserQuickControl, { listing, ability, name, onSetUserEnabled: setUserEnabled }),
|
|
377
|
+
install: /* @__PURE__ */ jsx(InstallQuickControl, { listing, ability, name, onSetInstalled: setInstalled, onReview: () => setOpen(true) }),
|
|
378
|
+
enable: /* @__PURE__ */ jsx(OrgQuickControl, { listing, ability, name, onSetOrgEnabled: setOrgEnabled }),
|
|
379
|
+
visibleTo: entry && canGrant ? /* @__PURE__ */ jsx(VisibleToPicker, { plugin: entry, actions: registryActions }) : null
|
|
380
|
+
},
|
|
215
381
|
slug,
|
|
216
382
|
name,
|
|
217
|
-
|
|
218
|
-
()
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
383
|
+
icon: (_b = listing == null ? void 0 : listing.manifest.icon) != null ? _b : entry == null ? void 0 : entry.icon,
|
|
384
|
+
version: (_d = (_c = listing == null ? void 0 : listing.manifest.version) != null ? _c : entry == null ? void 0 : entry.latestVersion) != null ? _d : null,
|
|
385
|
+
status: listing ? effectiveStatus(listing) : void 0,
|
|
386
|
+
standing,
|
|
387
|
+
children: [
|
|
388
|
+
listing ? /* @__PURE__ */ jsx(
|
|
389
|
+
PluginDetails,
|
|
390
|
+
{
|
|
391
|
+
listing,
|
|
392
|
+
ability,
|
|
393
|
+
onSetInstalled: setInstalled,
|
|
394
|
+
onSetOrgEnabled: setOrgEnabled,
|
|
395
|
+
onSetAllowUserOverride: (allow) => void commit(
|
|
396
|
+
slug,
|
|
397
|
+
name,
|
|
398
|
+
{ allowUserOverride: allow },
|
|
399
|
+
() => actions.setAllowUserOverride(slug, allow),
|
|
400
|
+
allow ? t("toastOverrideAllowed", { name }) : t("toastOverrideBlocked", { name })
|
|
401
|
+
),
|
|
402
|
+
onSetUserEnabled: setUserEnabled,
|
|
403
|
+
onCopyError: () => {
|
|
404
|
+
var _a2, _b2;
|
|
405
|
+
void ((_b2 = navigator.clipboard) == null ? void 0 : _b2.writeText((_a2 = listing.error) != null ? _a2 : "").then(() => toast.success(t("errorCopied"))).catch(() => toast.error(t("toastFailed", { name }))));
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
) : /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
409
|
+
(entry == null ? void 0 : entry.description) && /* @__PURE__ */ jsx("span", { className: "mb-1 block text-foreground", children: entry.description }),
|
|
410
|
+
t("notInOrg")
|
|
411
|
+
] }),
|
|
412
|
+
showRegistry && /* @__PURE__ */ jsx(
|
|
413
|
+
RegistryDetails,
|
|
414
|
+
{
|
|
415
|
+
entry,
|
|
416
|
+
publishing,
|
|
417
|
+
canGrant,
|
|
418
|
+
actions: registryActions
|
|
419
|
+
}
|
|
420
|
+
)
|
|
421
|
+
]
|
|
224
422
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
423
|
+
),
|
|
424
|
+
/* @__PURE__ */ jsx(
|
|
425
|
+
ConfirmDialog,
|
|
426
|
+
{
|
|
427
|
+
isOpen: confirmingUninstall,
|
|
428
|
+
isDeleting: false,
|
|
429
|
+
onOpenChange: setConfirmingUninstall,
|
|
430
|
+
handleConfirm: (event) => {
|
|
431
|
+
event.preventDefault();
|
|
432
|
+
setConfirmingUninstall(false);
|
|
433
|
+
writeInstalled(false);
|
|
434
|
+
},
|
|
435
|
+
title: t("uninstallTitle", { name }),
|
|
436
|
+
description: t("uninstallDescription"),
|
|
437
|
+
confirmLabel: t("uninstallConfirm"),
|
|
438
|
+
cancelLabel: t("cancel")
|
|
439
|
+
}
|
|
440
|
+
)
|
|
239
441
|
] });
|
|
240
442
|
}
|
|
241
|
-
function Empty({ text }) {
|
|
242
|
-
return /* @__PURE__ */ jsx("p", { className: "rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground", children: text });
|
|
243
|
-
}
|
|
244
443
|
export {
|
|
245
444
|
PluginsManager
|
|
246
445
|
};
|