@abpjs/ui 0.2.0-next.37 → 0.2.0-next.39

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/storage.js CHANGED
@@ -55,7 +55,8 @@ var ar_default = {
55
55
  copyCounts: "{total, plural, zero {\u0644\u0627 \u0645\u0644\u0641\u0627\u062A} one {\u0645\u0644\u0641 \u0648\u0627\u062D\u062F} two {\u0645\u0644\u0641\u0627\u0646} few {# \u0645\u0644\u0641\u0627\u062A} many {# \u0645\u0644\u0641\u064B\u0627} other {# \u0645\u0644\u0641}}: \u0646\u064F\u0633\u062E {copied}\u060C \u0645\u0648\u062C\u0648\u062F \u0623\u0635\u0644\u064B\u0627 {skipped}\u060C \u063A\u064A\u0631 \u0645\u0648\u062C\u0648\u062F \u0641\u064A \u0623\u064A \u0645\u0646\u0647\u0645\u0627 {missing}\u060C \u062A\u0639\u0630\u0651\u0631 \u0646\u0633\u062E\u0647 {failed}",
56
56
  copyProblems: "\u0645\u0644\u0641\u0627\u062A \u062A\u0639\u0630\u0651\u0631 \u0646\u0633\u062E\u0647\u0627",
57
57
  copyFile: "\u0627\u0644\u0645\u0644\u0641",
58
- copyProblem: "\u0627\u0644\u0633\u0628\u0628"
58
+ copyProblem: "\u0627\u0644\u0633\u0628\u0628",
59
+ notFound: "\u0644\u0627 \u062A\u0648\u062C\u062F \u0635\u0641\u062D\u0629 \u0643\u0647\u0630\u0647."
59
60
  };
60
61
 
61
62
  // src/areas/storage/texts/en.json
@@ -90,7 +91,8 @@ var en_default = {
90
91
  copyCounts: "{total, plural, one {# file} other {# files}}: {copied} copied, {skipped} already there, {missing} in neither, {failed} couldn't be copied",
91
92
  copyProblems: "Files that couldn't be copied",
92
93
  copyFile: "File",
93
- copyProblem: "Why"
94
+ copyProblem: "Why",
95
+ notFound: "There is no such page."
94
96
  };
95
97
 
96
98
  // src/areas/storage/texts.ts
@@ -99,6 +101,7 @@ var useStorageTexts = createAreaTexts("storage", { en: en_default, ar: ar_defaul
99
101
  // src/areas/storage/StorageScreen.tsx
100
102
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
101
103
  var COPY_POLL_MS = 1e3;
104
+ var isolate = (text) => `\u2068${text}\u2069`;
102
105
  function StorageScreen({ onChanged, storeName }) {
103
106
  const t = useStorageTexts();
104
107
  const request = useAreaRequest("storage");
@@ -121,6 +124,7 @@ function StorageScreen({ onChanged, storeName }) {
121
124
  return text !== key ? text : p;
122
125
  };
123
126
  async function test() {
127
+ setTests(null);
124
128
  const result = await action.run(() => request("/test", { method: "POST" }));
125
129
  if (result) setTests(result);
126
130
  }
@@ -151,7 +155,7 @@ function StorageScreen({ onChanged, storeName }) {
151
155
  ]
152
156
  }
153
157
  ),
154
- data?.previous && /* @__PURE__ */ jsx(InlineAlert, { tone: "info", title: t("previousTitle"), children: t("previousBody", { provider: provider(data.previous.provider), location: data.previous.location }) })
158
+ data?.previous && /* @__PURE__ */ jsx(InlineAlert, { tone: "info", title: t("previousTitle"), children: t("previousBody", { provider: provider(data.previous.provider), location: isolate(data.previous.location) }) })
155
159
  ] })
156
160
  }
157
161
  ),
@@ -188,8 +192,19 @@ function CopyPanel({ onChanged }) {
188
192
  const { reload } = copy;
189
193
  useEffect(() => {
190
194
  if (!running) return;
191
- const timer = setInterval(() => void reload(), COPY_POLL_MS);
192
- return () => clearInterval(timer);
195
+ let stopped = false;
196
+ let timer;
197
+ const next = () => {
198
+ timer = setTimeout(async () => {
199
+ await reload();
200
+ if (!stopped) next();
201
+ }, COPY_POLL_MS);
202
+ };
203
+ next();
204
+ return () => {
205
+ stopped = true;
206
+ clearTimeout(timer);
207
+ };
193
208
  }, [running, reload]);
194
209
  const last = useRef(void 0);
195
210
  const state = copy.data?.state;
@@ -206,6 +221,11 @@ function CopyPanel({ onChanged }) {
206
221
  }
207
222
  const c = copy.data;
208
223
  const n = (value) => number(Number(value));
224
+ const stateName = (value) => {
225
+ const key = `copyStates.${value}`;
226
+ const text = t(key);
227
+ return text !== key ? text : value;
228
+ };
209
229
  return /* @__PURE__ */ jsx(
210
230
  Panel,
211
231
  {
@@ -217,12 +237,12 @@ function CopyPanel({ onChanged }) {
217
237
  children: /* @__PURE__ */ jsxs(Stack, { gap: "3", children: [
218
238
  /* @__PURE__ */ jsx(InlineAlert, { tone: "danger", children: copy.error ?? action.error }),
219
239
  c && c.state !== "idle" && /* @__PURE__ */ jsxs(Fragment, { children: [
220
- /* @__PURE__ */ jsxs(HStack, { gap: "2", flexWrap: "wrap", children: [
240
+ /* @__PURE__ */ jsxs(HStack, { gap: "2", flexWrap: "wrap", role: "status", "aria-live": "polite", children: [
221
241
  /* @__PURE__ */ jsx(
222
242
  StatusPill,
223
243
  {
224
244
  tone: c.state === "done" ? Number(c.failed) > 0 || Number(c.missing) > 0 ? "warning" : "success" : c.state === "failed" ? "danger" : "info",
225
- children: t(`copyStates.${c.state}`)
245
+ children: stateName(c.state)
226
246
  }
227
247
  ),
228
248
  /* @__PURE__ */ jsx(Text, { textStyle: "sm", children: t("copyCounts", { total: Number(c.total), copied: n(c.copied), skipped: n(c.skipped), missing: n(c.missing), failed: n(c.failed) }) })
@@ -231,13 +251,13 @@ function CopyPanel({ onChanged }) {
231
251
  DataTable,
232
252
  {
233
253
  "aria-label": t("copyProblems"),
234
- rows: c.problems,
235
- getRowId: (p) => `${p.store}/${p.name}`,
254
+ rows: c.problems.map((p, i) => ({ ...p, row: i })),
255
+ getRowId: (p) => String(p.row),
236
256
  columns: [
237
257
  {
238
258
  id: "file",
239
259
  header: t("copyFile"),
240
- cell: (p) => /* @__PURE__ */ jsx(Text, { fontFamily: "mono", textStyle: "sm", dir: "ltr", children: p.store ? `${p.store}/${p.name}` : EMPTY_VALUE })
260
+ cell: (p) => /* @__PURE__ */ jsx(Text, { fontFamily: "mono", textStyle: "sm", dir: "ltr", children: p.store ? `${p.store}/${p.name}` : p.name || EMPTY_VALUE })
241
261
  },
242
262
  { id: "problem", header: t("copyProblem"), cell: (p) => /* @__PURE__ */ jsx(Text, { textStyle: "sm", children: p.problem }) }
243
263
  ]
@@ -248,6 +268,10 @@ function CopyPanel({ onChanged }) {
248
268
  }
249
269
  );
250
270
  }
271
+ function StorageNotFound({ href }) {
272
+ const t = useStorageTexts();
273
+ return /* @__PURE__ */ jsx(PageHeader, { breadcrumbs: [{ label: t("title"), href }], title: t("notFound") });
274
+ }
251
275
 
252
276
  // src/areas/storage/pages.tsx
253
277
  import { jsx as jsx2 } from "react/jsx-runtime";
@@ -261,8 +285,8 @@ function pageFor(href, options) {
261
285
  const entry = { options, component: (() => null) };
262
286
  const onChanged = () => entry.options.onChanged?.();
263
287
  const storeName = (store) => entry.options.storeName?.(store) ?? store;
264
- entry.component = function StoragePage() {
265
- return /* @__PURE__ */ jsx2(StorageScreen, { onChanged, storeName });
288
+ entry.component = function StoragePage({ path }) {
289
+ return path.length > 0 ? /* @__PURE__ */ jsx2(StorageNotFound, { href }) : /* @__PURE__ */ jsx2(StorageScreen, { onChanged, storeName });
266
290
  };
267
291
  pages.set(href, entry);
268
292
  return entry.component;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/areas/storage/StorageScreen.tsx","../src/areas/storage/texts.ts","../src/areas/storage/texts/ar.json","../src/areas/storage/texts/en.json","../src/areas/storage/pages.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { HStack, Stack, Text } from '@chakra-ui/react';\nimport {\n Button,\n DataTable,\n EMPTY_VALUE,\n HostSlot,\n InlineAlert,\n PageHeader,\n Panel,\n PropertyList,\n StatusPill,\n useApiAction,\n useAbpLocale,\n useApiQuery,\n useAreaRequest,\n useFormatters,\n} from '@abpjs/ui';\nimport { useStorageTexts } from './texts';\nimport type { StorageCopy, StorageInfo, StorageTest } from './types';\n\nexport interface StorageScreenProps {\n /** Told after a change the server has taken: a copy started, and a copy that finished or stopped. */\n onChanged?: () => void | Promise<void>;\n /**\n * A store's name for people. By default the area's text `storeNames.<store>` (a host gives those through\n * `AbpHost.texts.storage`), else the store's own key.\n */\n storeName?: (store: string) => string;\n}\n\n/** How often a running copy is read again. */\nconst COPY_POLL_MS = 1000;\n\n/**\n * The site's storage (AbpCluster.Storage): where its files are kept (the provider and its place, never a key), what's\n * kept there, a test of each store, and, while a previous storage is being left, the copy from it with its progress.\n * Storage is set in the server's configuration, so nothing here changes where files go. Starting the copy is the one\n * sensitive action: a host's step-up answers its 403 through the host's request. The host's own links go in the\n * `storage.page.actions` slot.\n */\nexport function StorageScreen({ onChanged, storeName }: StorageScreenProps) {\n const t = useStorageTexts();\n const request = useAreaRequest('storage');\n // The package's root route: the base path itself, with no slash after it.\n const storage = useApiQuery<StorageInfo>('storage', '');\n const action = useApiAction();\n const { number } = useFormatters();\n const { locale } = useAbpLocale();\n const [tests, setTests] = useState<StorageTest[] | null>(null);\n\n const nameOf = useCallback(\n (store: string) => {\n const key = `storeNames.${store}`;\n const text = t(key);\n return text !== key ? text : (storeName?.(store) ?? store);\n },\n [t, storeName],\n );\n const provider = (p: string) => {\n const key = `providers.${p}`;\n const text = t(key);\n return text !== key ? text : p;\n };\n\n async function test() {\n const result = await action.run(() => request<StorageTest[]>('/test', { method: 'POST' }));\n if (result) setTests(result);\n }\n\n const data = storage.data;\n return (\n <Stack gap=\"section\">\n <PageHeader title={t('title')} description={t('description')} actions={<HostSlot name=\"storage.page.actions\" />} />\n <InlineAlert tone=\"danger\">{storage.error ?? action.error}</InlineAlert>\n {(data || storage.loading) && (\n <Panel\n title={t('whereTitle')}\n description={t('whereHint')}\n data-testid=\"storage-where\"\n loading={storage.loading && !data}\n actions={\n <Button size=\"sm\" onClick={() => void test()} loading={action.busy} disabled={!data}>\n {t('test')}\n </Button>\n }\n >\n <Stack gap=\"4\">\n <PropertyList\n loading={storage.loading && !data}\n items={[\n { label: t('provider'), value: data ? provider(data.current.provider) : null },\n {\n label: t('location'),\n value: data ? (\n <Text as=\"span\" fontFamily=\"mono\" dir=\"ltr\">\n {data.current.location}\n </Text>\n ) : null,\n },\n { label: t('stores'), value: data ? new Intl.ListFormat(locale, { type: 'conjunction' }).format(data.stores.map(nameOf)) : null },\n ]}\n />\n {data?.previous && (\n <InlineAlert tone=\"info\" title={t('previousTitle')}>\n {t('previousBody', { provider: provider(data.previous.provider), location: data.previous.location })}\n </InlineAlert>\n )}\n </Stack>\n </Panel>\n )}\n {data?.previous && <CopyPanel onChanged={onChanged} />}\n {tests && (\n <Panel title={t('testTitle')} flush data-testid=\"storage-test\">\n <DataTable\n aria-label={t('testTitle')}\n rows={tests}\n getRowId={(r) => r.store}\n columns={[\n { id: 'store', header: t('store'), cell: (r) => nameOf(r.store) },\n {\n id: 'result',\n header: t('result'),\n cell: (r) => (\n <HStack gap=\"2\">\n <StatusPill tone={r.ok ? 'success' : 'danger'}>{r.ok ? t('works') : t('fails')}</StatusPill>\n {r.error && (\n <Text textStyle=\"sm\" color=\"fg.muted\">\n {r.error}\n </Text>\n )}\n </HStack>\n ),\n },\n { id: 'time', header: t('time'), numeric: true, cell: (r) => t('ms', { ms: number(Number(r.milliseconds)) }) },\n ]}\n />\n </Panel>\n )}\n </Stack>\n );\n}\n\n/**\n * The copy from the previous storage: started by a site admin (the host's step-up, when it asks for one), read again\n * every second while it runs, then its counts and the first problems.\n */\nfunction CopyPanel({ onChanged }: { onChanged?: () => void | Promise<void> }) {\n const t = useStorageTexts();\n const request = useAreaRequest('storage');\n const copy = useApiQuery<StorageCopy>('storage', '/copy');\n const action = useApiAction();\n const { number } = useFormatters();\n const running = copy.data?.state === 'running';\n\n const { reload } = copy;\n useEffect(() => {\n if (!running) return;\n const timer = setInterval(() => void reload(), COPY_POLL_MS);\n return () => clearInterval(timer);\n }, [running, reload]);\n\n // A copy that was running and has now finished or stopped is a change the host may want to hear of.\n const last = useRef<string | undefined>(undefined);\n const state = copy.data?.state;\n useEffect(() => {\n if (last.current === 'running' && state && state !== 'running') void onChanged?.();\n last.current = state;\n }, [state, onChanged]);\n\n async function start() {\n const started = await action.run(() => request<StorageCopy>('/copy', { method: 'POST' }));\n if (started) {\n copy.setData(started);\n await onChanged?.();\n }\n }\n\n const c = copy.data;\n const n = (value: number | string) => number(Number(value));\n return (\n <Panel\n title={t('copyTitle')}\n description={t('copyHint')}\n data-testid=\"storage-copy\"\n loading={copy.loading && !c && !copy.error}\n actions={\n <Button size=\"sm\" onClick={() => void start()} loading={action.busy || running} disabled={running || !c}>\n {t('copyStart')}\n </Button>\n }\n >\n <Stack gap=\"3\">\n <InlineAlert tone=\"danger\">{copy.error ?? action.error}</InlineAlert>\n {c && c.state !== 'idle' && (\n <>\n <HStack gap=\"2\" flexWrap=\"wrap\">\n <StatusPill\n tone={c.state === 'done' ? (Number(c.failed) > 0 || Number(c.missing) > 0 ? 'warning' : 'success') : c.state === 'failed' ? 'danger' : 'info'}\n >\n {t(`copyStates.${c.state}`)}\n </StatusPill>\n <Text textStyle=\"sm\">\n {t('copyCounts', { total: Number(c.total), copied: n(c.copied), skipped: n(c.skipped), missing: n(c.missing), failed: n(c.failed) })}\n </Text>\n </HStack>\n {c.problems.length > 0 && (\n <DataTable\n aria-label={t('copyProblems')}\n rows={c.problems}\n getRowId={(p) => `${p.store}/${p.name}`}\n columns={[\n {\n id: 'file',\n header: t('copyFile'),\n cell: (p) => (\n <Text fontFamily=\"mono\" textStyle=\"sm\" dir=\"ltr\">\n {p.store ? `${p.store}/${p.name}` : EMPTY_VALUE}\n </Text>\n ),\n },\n { id: 'problem', header: t('copyProblem'), cell: (p) => <Text textStyle=\"sm\">{p.problem}</Text> },\n ]}\n />\n )}\n </>\n )}\n </Stack>\n </Panel>\n );\n}\n","import { createAreaTexts } from '@abpjs/ui';\nimport ar from './texts/ar.json';\nimport en from './texts/en.json';\n\n/** The area's words, in English and Arabic; a host overrides any key through `AbpHost.texts.storage`. */\nexport const useStorageTexts = createAreaTexts('storage', { en, ar });\n","{\n \"title\": \"التخزين\",\n \"description\": \"حيث يحفظ {product} ملفاته. يُضبط في إعدادات الخادم، لا من هنا.\",\n \"whereTitle\": \"أين تُحفظ الملفات\",\n \"whereHint\": \"نظام ملفات الخادم، أو حاوية S3 (من AWS أو خادم يتحدث S3 مثل MinIO)، أو Azure Blob. لا يُوصل إلى الملفات إلا عبر {product}، الذي يتحقق ممن يحق له قراءتها.\",\n \"provider\": \"النوع\",\n \"location\": \"المكان\",\n \"stores\": \"ما يُحفظ هناك\",\n \"providers.FileSystem\": \"نظام ملفات الخادم\",\n \"providers.S3\": \"حاوية S3\",\n \"providers.Azure\": \"Azure Blob\",\n \"previousTitle\": \"تُنقل الملفات الآن\",\n \"previousBody\": \"الملف الذي لم يُنقل بعد يُقرأ من مكانه السابق: {provider}، {location}.\",\n \"test\": \"اختبار\",\n \"testTitle\": \"الاختبار\",\n \"store\": \"المخزن\",\n \"result\": \"النتيجة\",\n \"works\": \"يعمل\",\n \"fails\": \"لا يعمل\",\n \"time\": \"الوقت\",\n \"ms\": \"{ms} ملّي ثانية\",\n \"copyTitle\": \"النسخ من التخزين السابق\",\n \"copyHint\": \"ينسخ كل ملف ما زال في التخزين السابق إلى التخزين الحالي، ويتحقق من كل ملف مقابل البصمة المحفوظة له. الملفات الموجودة أصلًا تُترك كما هي، لذا يمكن تشغيله مرة أخرى. عندما لا يتبقى شيء، أزل Storage:Previous من الإعدادات.\",\n \"copyStart\": \"نسخ\",\n \"copyStates.idle\": \"لم يُشغَّل\",\n \"copyStates.running\": \"جارٍ النسخ\",\n \"copyStates.done\": \"تم\",\n \"copyStates.failed\": \"توقف\",\n \"copyCounts\": \"{total, plural, zero {لا ملفات} one {ملف واحد} two {ملفان} few {# ملفات} many {# ملفًا} other {# ملف}}: نُسخ {copied}، موجود أصلًا {skipped}، غير موجود في أي منهما {missing}، تعذّر نسخه {failed}\",\n \"copyProblems\": \"ملفات تعذّر نسخها\",\n \"copyFile\": \"الملف\",\n \"copyProblem\": \"السبب\"\n}\n","{\n \"title\": \"Storage\",\n \"description\": \"Where {product} keeps its files. It's set in the server's configuration, not here.\",\n \"whereTitle\": \"Where files are kept\",\n \"whereHint\": \"The file system, an S3 bucket (AWS or a server that speaks S3, such as MinIO), or Azure Blob. Files are only ever reached through {product}, which checks who may read them.\",\n \"provider\": \"Kind\",\n \"location\": \"Where\",\n \"stores\": \"What's kept there\",\n \"providers.FileSystem\": \"The server's file system\",\n \"providers.S3\": \"S3 bucket\",\n \"providers.Azure\": \"Azure Blob\",\n \"previousTitle\": \"Files are being moved\",\n \"previousBody\": \"A file not moved yet is read from where they were before: {provider}, {location}.\",\n \"test\": \"Test\",\n \"testTitle\": \"Test\",\n \"store\": \"Store\",\n \"result\": \"Result\",\n \"works\": \"Works\",\n \"fails\": \"Fails\",\n \"time\": \"Time\",\n \"ms\": \"{ms} ms\",\n \"copyTitle\": \"Copy from the previous storage\",\n \"copyHint\": \"Copies every file still in the previous storage to the one in use, each checked against the hash kept for it. Files already there are left as they are, so it can be run again. When nothing's left, remove Storage:Previous from the configuration.\",\n \"copyStart\": \"Copy\",\n \"copyStates.idle\": \"Not run\",\n \"copyStates.running\": \"Copying\",\n \"copyStates.done\": \"Done\",\n \"copyStates.failed\": \"Stopped\",\n \"copyCounts\": \"{total, plural, one {# file} other {# files}}: {copied} copied, {skipped} already there, {missing} in neither, {failed} couldn't be copied\",\n \"copyProblems\": \"Files that couldn't be copied\",\n \"copyFile\": \"File\",\n \"copyProblem\": \"Why\"\n}\n","import type { ComponentType } from 'react';\nimport type { AbpHost, SettingsPage } from '@abpjs/ui';\nimport { StorageScreen } from './StorageScreen';\nimport en from './texts/en.json';\n\nexport interface StoragePageOptions {\n section: string;\n href: string;\n weight?: number;\n title?: string;\n about?: string;\n visible?: SettingsPage['visible'];\n host?: Pick<AbpHost, 'can'>;\n /** After a change the server has taken (a copy started, a copy that ended): the host reads what it shows again. */\n onChanged?: () => void | Promise<void>;\n /** A store's name for people, when the host doesn't give `storeNames.<store>` as words; the store's key by default. */\n storeName?: (store: string) => string;\n}\n\n/**\n * One page component per address, kept across calls: a host's `onChanged` refreshes its pages, which builds its settings\n * again, and a new component there would start the screen afresh, a running copy's progress and a test's results gone.\n * It reads the latest call's options. The map is the module's, shared by every host in the process; a host whose\n * options differ by request uses `StorageScreen` in a page of its own instead.\n */\nconst pages = new Map<string, { options: StoragePageOptions; component: ComponentType<{ path: string[] }> }>();\n\nfunction pageFor(href: string, options: StoragePageOptions): ComponentType<{ path: string[] }> {\n const kept = pages.get(href);\n if (kept) {\n kept.options = options;\n return kept.component;\n }\n const entry = { options, component: (() => null) as ComponentType<{ path: string[] }> };\n const onChanged = () => entry.options.onChanged?.();\n const storeName = (store: string) => entry.options.storeName?.(store) ?? store;\n entry.component = function StoragePage() {\n return <StorageScreen onChanged={onChanged} storeName={storeName} />;\n };\n pages.set(href, entry);\n return entry.component;\n}\n\n/**\n * The area's settings page for a host to file under its sections: `storage.admin` at `href`, drawn by the host's\n * catch-all route. Who sees it is the host's `storage.site.admin` when `host` is given. The title is the area's English\n * word unless given; the server checks every call.\n */\nexport function storagePages(options: StoragePageOptions): SettingsPage[] {\n const href = options.href.replace(/\\/$/, '');\n return [\n {\n id: 'storage.admin',\n section: options.section,\n weight: options.weight ?? 100,\n title: options.title ?? en.title,\n href,\n about: options.about,\n plugin: 'storage',\n visible: options.visible ?? (options.host?.can ? () => options.host!.can!('storage.site.admin') : undefined),\n component: pageFor(href, options),\n },\n ];\n}\n"],"mappings":";;;AAAA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,QAAQ,OAAO,YAAY;AACpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACjBP,SAAS,uBAAuB;;;ACAhC;AAAA,EACE,OAAS;AAAA,EACT,aAAe;AAAA,EACf,YAAc;AAAA,EACd,WAAa;AAAA,EACb,UAAY;AAAA,EACZ,UAAY;AAAA,EACZ,QAAU;AAAA,EACV,wBAAwB;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}
1
+ {"version":3,"sources":["../src/areas/storage/StorageScreen.tsx","../src/areas/storage/texts.ts","../src/areas/storage/texts/ar.json","../src/areas/storage/texts/en.json","../src/areas/storage/pages.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { HStack, Stack, Text } from '@chakra-ui/react';\nimport {\n Button,\n DataTable,\n EMPTY_VALUE,\n HostSlot,\n InlineAlert,\n PageHeader,\n Panel,\n PropertyList,\n StatusPill,\n useApiAction,\n useAbpLocale,\n useApiQuery,\n useAreaRequest,\n useFormatters,\n} from '@abpjs/ui';\nimport { useStorageTexts } from './texts';\nimport type { StorageCopy, StorageInfo, StorageTest } from './types';\n\nexport interface StorageScreenProps {\n /** Told after a change the server has taken: a copy started, and a copy that finished or stopped. */\n onChanged?: () => void | Promise<void>;\n /**\n * A store's name for people. By default the area's text `storeNames.<store>` (a host gives those through\n * `AbpHost.texts.storage`), else the store's own key.\n */\n storeName?: (store: string) => string;\n}\n\n/** How long after each answer a running copy is read again. */\nconst COPY_POLL_MS = 1000;\n\n/** A path or URL set apart from the sentence around it (U+2068 … U+2069), so it keeps its order in right-to-left text. */\nconst isolate = (text: string) => `\\u2068${text}\\u2069`;\n\n/**\n * The site's storage (AbpCluster.Storage): where its files are kept (the provider and its place, never a key), what's\n * kept there, a test of each store, and, while a previous storage is being left, the copy from it with its progress.\n * Storage is set in the server's configuration, so nothing here changes where files go. Starting the copy is the one\n * sensitive action: a host's step-up answers its 403 through the host's request. The host's own links go in the\n * `storage.page.actions` slot.\n */\nexport function StorageScreen({ onChanged, storeName }: StorageScreenProps) {\n const t = useStorageTexts();\n const request = useAreaRequest('storage');\n // The package's root route: the base path itself, with no slash after it.\n const storage = useApiQuery<StorageInfo>('storage', '');\n const action = useApiAction();\n const { number } = useFormatters();\n const { locale } = useAbpLocale();\n const [tests, setTests] = useState<StorageTest[] | null>(null);\n\n const nameOf = useCallback(\n (store: string) => {\n const key = `storeNames.${store}`;\n const text = t(key);\n return text !== key ? text : (storeName?.(store) ?? store);\n },\n [t, storeName],\n );\n const provider = (p: string) => {\n const key = `providers.${p}`;\n const text = t(key);\n return text !== key ? text : p;\n };\n\n async function test() {\n // Last time's results go first, so a test that fails never leaves them saying \"Works\".\n setTests(null);\n const result = await action.run(() => request<StorageTest[]>('/test', { method: 'POST' }));\n if (result) setTests(result);\n }\n\n const data = storage.data;\n return (\n <Stack gap=\"section\">\n <PageHeader title={t('title')} description={t('description')} actions={<HostSlot name=\"storage.page.actions\" />} />\n <InlineAlert tone=\"danger\">{storage.error ?? action.error}</InlineAlert>\n {(data || storage.loading) && (\n <Panel\n title={t('whereTitle')}\n description={t('whereHint')}\n data-testid=\"storage-where\"\n loading={storage.loading && !data}\n actions={\n <Button size=\"sm\" onClick={() => void test()} loading={action.busy} disabled={!data}>\n {t('test')}\n </Button>\n }\n >\n <Stack gap=\"4\">\n <PropertyList\n loading={storage.loading && !data}\n items={[\n { label: t('provider'), value: data ? provider(data.current.provider) : null },\n {\n label: t('location'),\n value: data ? (\n <Text as=\"span\" fontFamily=\"mono\" dir=\"ltr\">\n {data.current.location}\n </Text>\n ) : null,\n },\n { label: t('stores'), value: data ? new Intl.ListFormat(locale, { type: 'conjunction' }).format(data.stores.map(nameOf)) : null },\n ]}\n />\n {data?.previous && (\n <InlineAlert tone=\"info\" title={t('previousTitle')}>\n {t('previousBody', { provider: provider(data.previous.provider), location: isolate(data.previous.location) })}\n </InlineAlert>\n )}\n </Stack>\n </Panel>\n )}\n {data?.previous && <CopyPanel onChanged={onChanged} />}\n {tests && (\n <Panel title={t('testTitle')} flush data-testid=\"storage-test\">\n <DataTable\n aria-label={t('testTitle')}\n rows={tests}\n getRowId={(r) => r.store}\n columns={[\n { id: 'store', header: t('store'), cell: (r) => nameOf(r.store) },\n {\n id: 'result',\n header: t('result'),\n cell: (r) => (\n <HStack gap=\"2\">\n <StatusPill tone={r.ok ? 'success' : 'danger'}>{r.ok ? t('works') : t('fails')}</StatusPill>\n {r.error && (\n <Text textStyle=\"sm\" color=\"fg.muted\">\n {r.error}\n </Text>\n )}\n </HStack>\n ),\n },\n { id: 'time', header: t('time'), numeric: true, cell: (r) => t('ms', { ms: number(Number(r.milliseconds)) }) },\n ]}\n />\n </Panel>\n )}\n </Stack>\n );\n}\n\n/**\n * The copy from the previous storage: started by a site admin (the host's step-up, when it asks for one), read again\n * every second while it runs, then its counts and the first problems.\n */\nfunction CopyPanel({ onChanged }: { onChanged?: () => void | Promise<void> }) {\n const t = useStorageTexts();\n const request = useAreaRequest('storage');\n const copy = useApiQuery<StorageCopy>('storage', '/copy');\n const action = useApiAction();\n const { number } = useFormatters();\n const running = copy.data?.state === 'running';\n\n // Read again a second after each answer, never on a fixed beat, so slow answers don't pile up.\n const { reload } = copy;\n useEffect(() => {\n if (!running) return;\n let stopped = false;\n let timer: ReturnType<typeof setTimeout> | undefined;\n const next = () => {\n timer = setTimeout(async () => {\n await reload();\n if (!stopped) next();\n }, COPY_POLL_MS);\n };\n next();\n return () => {\n stopped = true;\n clearTimeout(timer);\n };\n }, [running, reload]);\n\n // A copy that was running and has now finished or stopped is a change the host may want to hear of.\n const last = useRef<string | undefined>(undefined);\n const state = copy.data?.state;\n useEffect(() => {\n if (last.current === 'running' && state && state !== 'running') void onChanged?.();\n last.current = state;\n }, [state, onChanged]);\n\n async function start() {\n const started = await action.run(() => request<StorageCopy>('/copy', { method: 'POST' }));\n if (started) {\n copy.setData(started);\n await onChanged?.();\n }\n }\n\n const c = copy.data;\n const n = (value: number | string) => number(Number(value));\n const stateName = (value: string) => {\n const key = `copyStates.${value}`;\n const text = t(key);\n return text !== key ? text : value;\n };\n return (\n <Panel\n title={t('copyTitle')}\n description={t('copyHint')}\n data-testid=\"storage-copy\"\n loading={copy.loading && !c && !copy.error}\n actions={\n <Button size=\"sm\" onClick={() => void start()} loading={action.busy || running} disabled={running || !c}>\n {t('copyStart')}\n </Button>\n }\n >\n <Stack gap=\"3\">\n <InlineAlert tone=\"danger\">{copy.error ?? action.error}</InlineAlert>\n {c && c.state !== 'idle' && (\n <>\n <HStack gap=\"2\" flexWrap=\"wrap\" role=\"status\" aria-live=\"polite\">\n <StatusPill\n tone={c.state === 'done' ? (Number(c.failed) > 0 || Number(c.missing) > 0 ? 'warning' : 'success') : c.state === 'failed' ? 'danger' : 'info'}\n >\n {stateName(c.state)}\n </StatusPill>\n <Text textStyle=\"sm\">\n {t('copyCounts', { total: Number(c.total), copied: n(c.copied), skipped: n(c.skipped), missing: n(c.missing), failed: n(c.failed) })}\n </Text>\n </HStack>\n {c.problems.length > 0 && (\n <DataTable\n aria-label={t('copyProblems')}\n rows={c.problems.map((p, i) => ({ ...p, row: i }))}\n getRowId={(p) => String(p.row)}\n columns={[\n {\n id: 'file',\n header: t('copyFile'),\n cell: (p) => (\n <Text fontFamily=\"mono\" textStyle=\"sm\" dir=\"ltr\">\n {p.store ? `${p.store}/${p.name}` : p.name || EMPTY_VALUE}\n </Text>\n ),\n },\n { id: 'problem', header: t('copyProblem'), cell: (p) => <Text textStyle=\"sm\">{p.problem}</Text> },\n ]}\n />\n )}\n </>\n )}\n </Stack>\n </Panel>\n );\n}\n\n/** An address under the storage page, which has none: a header that says so, with the way back. */\nexport function StorageNotFound({ href }: { href: string }) {\n const t = useStorageTexts();\n return <PageHeader breadcrumbs={[{ label: t('title'), href }]} title={t('notFound')} />;\n}\n","import { createAreaTexts } from '@abpjs/ui';\nimport ar from './texts/ar.json';\nimport en from './texts/en.json';\n\n/** The area's words, in English and Arabic; a host overrides any key through `AbpHost.texts.storage`. */\nexport const useStorageTexts = createAreaTexts('storage', { en, ar });\n","{\n \"title\": \"التخزين\",\n \"description\": \"حيث يحفظ {product} ملفاته. يُضبط في إعدادات الخادم، لا من هنا.\",\n \"whereTitle\": \"أين تُحفظ الملفات\",\n \"whereHint\": \"نظام ملفات الخادم، أو حاوية S3 (من AWS أو خادم يتحدث S3 مثل MinIO)، أو Azure Blob. لا يُوصل إلى الملفات إلا عبر {product}، الذي يتحقق ممن يحق له قراءتها.\",\n \"provider\": \"النوع\",\n \"location\": \"المكان\",\n \"stores\": \"ما يُحفظ هناك\",\n \"providers.FileSystem\": \"نظام ملفات الخادم\",\n \"providers.S3\": \"حاوية S3\",\n \"providers.Azure\": \"Azure Blob\",\n \"previousTitle\": \"تُنقل الملفات الآن\",\n \"previousBody\": \"الملف الذي لم يُنقل بعد يُقرأ من مكانه السابق: {provider}، {location}.\",\n \"test\": \"اختبار\",\n \"testTitle\": \"الاختبار\",\n \"store\": \"المخزن\",\n \"result\": \"النتيجة\",\n \"works\": \"يعمل\",\n \"fails\": \"لا يعمل\",\n \"time\": \"الوقت\",\n \"ms\": \"{ms} ملّي ثانية\",\n \"copyTitle\": \"النسخ من التخزين السابق\",\n \"copyHint\": \"ينسخ كل ملف ما زال في التخزين السابق إلى التخزين الحالي، ويتحقق من كل ملف مقابل البصمة المحفوظة له. الملفات الموجودة أصلًا تُترك كما هي، لذا يمكن تشغيله مرة أخرى. عندما لا يتبقى شيء، أزل Storage:Previous من الإعدادات.\",\n \"copyStart\": \"نسخ\",\n \"copyStates.idle\": \"لم يُشغَّل\",\n \"copyStates.running\": \"جارٍ النسخ\",\n \"copyStates.done\": \"تم\",\n \"copyStates.failed\": \"توقف\",\n \"copyCounts\": \"{total, plural, zero {لا ملفات} one {ملف واحد} two {ملفان} few {# ملفات} many {# ملفًا} other {# ملف}}: نُسخ {copied}، موجود أصلًا {skipped}، غير موجود في أي منهما {missing}، تعذّر نسخه {failed}\",\n \"copyProblems\": \"ملفات تعذّر نسخها\",\n \"copyFile\": \"الملف\",\n \"copyProblem\": \"السبب\",\n \"notFound\": \"لا توجد صفحة كهذه.\"\n}\n","{\n \"title\": \"Storage\",\n \"description\": \"Where {product} keeps its files. It's set in the server's configuration, not here.\",\n \"whereTitle\": \"Where files are kept\",\n \"whereHint\": \"The file system, an S3 bucket (AWS or a server that speaks S3, such as MinIO), or Azure Blob. Files are only ever reached through {product}, which checks who may read them.\",\n \"provider\": \"Kind\",\n \"location\": \"Where\",\n \"stores\": \"What's kept there\",\n \"providers.FileSystem\": \"The server's file system\",\n \"providers.S3\": \"S3 bucket\",\n \"providers.Azure\": \"Azure Blob\",\n \"previousTitle\": \"Files are being moved\",\n \"previousBody\": \"A file not moved yet is read from where they were before: {provider}, {location}.\",\n \"test\": \"Test\",\n \"testTitle\": \"Test\",\n \"store\": \"Store\",\n \"result\": \"Result\",\n \"works\": \"Works\",\n \"fails\": \"Fails\",\n \"time\": \"Time\",\n \"ms\": \"{ms} ms\",\n \"copyTitle\": \"Copy from the previous storage\",\n \"copyHint\": \"Copies every file still in the previous storage to the one in use, each checked against the hash kept for it. Files already there are left as they are, so it can be run again. When nothing's left, remove Storage:Previous from the configuration.\",\n \"copyStart\": \"Copy\",\n \"copyStates.idle\": \"Not run\",\n \"copyStates.running\": \"Copying\",\n \"copyStates.done\": \"Done\",\n \"copyStates.failed\": \"Stopped\",\n \"copyCounts\": \"{total, plural, one {# file} other {# files}}: {copied} copied, {skipped} already there, {missing} in neither, {failed} couldn't be copied\",\n \"copyProblems\": \"Files that couldn't be copied\",\n \"copyFile\": \"File\",\n \"copyProblem\": \"Why\",\n \"notFound\": \"There is no such page.\"\n}\n","import type { ComponentType } from 'react';\nimport type { AbpHost, SettingsPage } from '@abpjs/ui';\nimport { StorageNotFound, StorageScreen } from './StorageScreen';\nimport en from './texts/en.json';\n\nexport interface StoragePageOptions {\n section: string;\n href: string;\n weight?: number;\n title?: string;\n about?: string;\n visible?: SettingsPage['visible'];\n host?: Pick<AbpHost, 'can'>;\n /** After a change the server has taken (a copy started, a copy that ended): the host reads what it shows again. */\n onChanged?: () => void | Promise<void>;\n /** A store's name for people, when the host doesn't give `storeNames.<store>` as words; the store's key by default. */\n storeName?: (store: string) => string;\n}\n\n/**\n * One page component per address, kept across calls: a host's `onChanged` refreshes its pages, which builds its settings\n * again, and a new component there would start the screen afresh, a running copy's progress and a test's results gone.\n * It reads the latest call's options. The map is the module's, shared by every host in the process; a host whose\n * options differ by request uses `StorageScreen` in a page of its own instead.\n */\nconst pages = new Map<string, { options: StoragePageOptions; component: ComponentType<{ path: string[] }> }>();\n\nfunction pageFor(href: string, options: StoragePageOptions): ComponentType<{ path: string[] }> {\n const kept = pages.get(href);\n if (kept) {\n kept.options = options;\n return kept.component;\n }\n const entry = { options, component: (() => null) as ComponentType<{ path: string[] }> };\n const onChanged = () => entry.options.onChanged?.();\n const storeName = (store: string) => entry.options.storeName?.(store) ?? store;\n entry.component = function StoragePage({ path }: { path: string[] }) {\n // The page has no pages under it: an address below it is one that doesn't exist.\n return path.length > 0 ? <StorageNotFound href={href} /> : <StorageScreen onChanged={onChanged} storeName={storeName} />;\n };\n pages.set(href, entry);\n return entry.component;\n}\n\n/**\n * The area's settings page for a host to file under its sections: `storage.admin` at `href`, drawn by the host's\n * catch-all route. Who sees it is the host's `storage.site.admin` when `host` is given. The title is the area's English\n * word unless given; the server checks every call.\n */\nexport function storagePages(options: StoragePageOptions): SettingsPage[] {\n const href = options.href.replace(/\\/$/, '');\n return [\n {\n id: 'storage.admin',\n section: options.section,\n weight: options.weight ?? 100,\n title: options.title ?? en.title,\n href,\n about: options.about,\n plugin: 'storage',\n visible: options.visible ?? (options.host?.can ? () => options.host!.can!('storage.site.admin') : undefined),\n component: pageFor(href, options),\n },\n ];\n}\n"],"mappings":";;;AAAA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,QAAQ,OAAO,YAAY;AACpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACjBP,SAAS,uBAAuB;;;ACAhC;AAAA,EACE,OAAS;AAAA,EACT,aAAe;AAAA,EACf,YAAc;AAAA,EACd,WAAa;AAAA,EACb,UAAY;AAAA,EACZ,UAAY;AAAA,EACZ,QAAU;AAAA,EACV,wBAAwB;AAA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AAQ,YAAY;AAClD,QAAM,YAAY,CAAC,UAAkB,MAAM,QAAQ,YAAY,KAAK,KAAK;AACzE,QAAM,YAAY,SAAS,YAAY,EAAE,KAAK,GAAuB;AAEnE,WAAO,KAAK,SAAS,IAAI,gBAAAA,KAAC,mBAAgB,MAAY,IAAK,gBAAAA,KAAC,iBAAc,WAAsB,WAAsB;AAAA,EACxH;AACA,QAAM,IAAI,MAAM,KAAK;AACrB,SAAO,MAAM;AACf;AAOO,SAAS,aAAa,SAA6C;AACxE,QAAM,OAAO,QAAQ,KAAK,QAAQ,OAAO,EAAE;AAC3C,SAAO;AAAA,IACL;AAAA,MACE,IAAI;AAAA,MACJ,SAAS,QAAQ;AAAA,MACjB,QAAQ,QAAQ,UAAU;AAAA,MAC1B,OAAO,QAAQ,SAAS,WAAG;AAAA,MAC3B;AAAA,MACA,OAAO,QAAQ;AAAA,MACf,QAAQ;AAAA,MACR,SAAS,QAAQ,YAAY,QAAQ,MAAM,MAAM,MAAM,QAAQ,KAAM,IAAK,oBAAoB,IAAI;AAAA,MAClG,WAAW,QAAQ,MAAM,OAAO;AAAA,IAClC;AAAA,EACF;AACF;","names":["jsx"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abpjs/ui",
3
- "version": "0.2.0-next.37",
3
+ "version": "0.2.0-next.39",
4
4
  "description": "The design system for ABP applications on Chakra UI v3 and React 19: tokens, recipes, the app shell, tables, lists, boards, forms and a settings frame. Names no product: the host gives its prefix, colours and words.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {