@rxdrag/website-studio 0.0.48 → 0.0.50

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.
Files changed (40) hide show
  1. package/dist/components/ConfigDrawer/{EmialTemplatesPanel.d.ts → EmailTemplatesPanel.d.ts} +1 -1
  2. package/dist/components/StatusBar/StopButton.d.ts +7 -0
  3. package/dist/components/StatusBar/useSubscribeTaskEvents.d.ts +2 -0
  4. package/dist/components/StudioRoot/contexts.d.ts +6 -4
  5. package/dist/components/common/ComponentCategoryListScope/index.d.ts +1 -1
  6. package/dist/{cssMode-e235f5c4.js → cssMode-3b37fb1f.js} +2 -2
  7. package/dist/{cssMode-e235f5c4.js.map → cssMode-3b37fb1f.js.map} +1 -1
  8. package/dist/{freemarker2-775aff18.js → freemarker2-1fbc5bf0.js} +2 -2
  9. package/dist/{freemarker2-775aff18.js.map → freemarker2-1fbc5bf0.js.map} +1 -1
  10. package/dist/{handlebars-46315f0e.js → handlebars-0d2d8087.js} +2 -2
  11. package/dist/{handlebars-46315f0e.js.map → handlebars-0d2d8087.js.map} +1 -1
  12. package/dist/{html-ed8824db.js → html-1f416956.js} +2 -2
  13. package/dist/{html-ed8824db.js.map → html-1f416956.js.map} +1 -1
  14. package/dist/{htmlMode-6d3a7f40.js → htmlMode-f8f5f503.js} +2 -2
  15. package/dist/{htmlMode-6d3a7f40.js.map → htmlMode-f8f5f503.js.map} +1 -1
  16. package/dist/{index-aaa4e570.js → index-525006cd.js} +351 -154
  17. package/dist/{index-aaa4e570.js.map → index-525006cd.js.map} +1 -1
  18. package/dist/index.mjs +1 -1
  19. package/dist/{javascript-c0d8cc8b.js → javascript-fa1a44fb.js} +3 -3
  20. package/dist/{javascript-c0d8cc8b.js.map → javascript-fa1a44fb.js.map} +1 -1
  21. package/dist/{jsonMode-165aee85.js → jsonMode-c7e6869c.js} +2 -2
  22. package/dist/{jsonMode-165aee85.js.map → jsonMode-c7e6869c.js.map} +1 -1
  23. package/dist/{liquid-fd914edd.js → liquid-f59e1243.js} +2 -2
  24. package/dist/{liquid-fd914edd.js.map → liquid-f59e1243.js.map} +1 -1
  25. package/dist/{mdx-5e7a0f83.js → mdx-831aab9e.js} +2 -2
  26. package/dist/{mdx-5e7a0f83.js.map → mdx-831aab9e.js.map} +1 -1
  27. package/dist/{python-e1d6d047.js → python-c08d64d5.js} +2 -2
  28. package/dist/{python-e1d6d047.js.map → python-c08d64d5.js.map} +1 -1
  29. package/dist/{razor-e15c6655.js → razor-c37a2ffd.js} +2 -2
  30. package/dist/{razor-e15c6655.js.map → razor-c37a2ffd.js.map} +1 -1
  31. package/dist/store/atoms.d.ts +7 -1
  32. package/dist/{tsMode-2f97f8d8.js → tsMode-fe874300.js} +2 -2
  33. package/dist/{tsMode-2f97f8d8.js.map → tsMode-fe874300.js.map} +1 -1
  34. package/dist/{typescript-0b9ed5c9.js → typescript-37e16b75.js} +2 -2
  35. package/dist/{typescript-0b9ed5c9.js.map → typescript-37e16b75.js.map} +1 -1
  36. package/dist/{xml-4e563c2c.js → xml-68f06860.js} +2 -2
  37. package/dist/{xml-4e563c2c.js.map → xml-68f06860.js.map} +1 -1
  38. package/dist/{yaml-c9882143.js → yaml-11d37d04.js} +2 -2
  39. package/dist/{yaml-c9882143.js.map → yaml-11d37d04.js.map} +1 -1
  40. package/package.json +16 -16
@@ -7,9 +7,9 @@ var __publicField = (obj, key2, value) => {
7
7
  var _a, _b, _c, _d, _e, _f, _g, _h, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$2, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa;
8
8
  import * as React from "react";
9
9
  import React__default, { createContext, useContext, useMemo, memo, useEffect, useCallback, useState, useRef, forwardRef as forwardRef$2, Component, useImperativeHandle, isValidElement, cloneElement } from "react";
10
- import { ThemeFields, PageQueryOptions, PageFields, FrontComponentQueryOptions, FrontComponentFields, ComponentCategoryFields, SectionTemplateQueryOptions, SectionTemplateFields, ComponentCategoryQueryOptions, TemplateCategoryQueryOptions, TemplateCategoryFields, ThemeQueryOptions, StyleConfigFields, LangFields, ThemeConfigQueryOptions, ThemeConfigFields, PageAssciations, PageType, ProductCategoryEntityName, ProductCategoryQueryOptions, ProductCategoryFields, ProductQueryOptions, ProductFields, PublishableStatus, websiteToInput, LangQueryOptions, WebsiteAssciations, ExtendFieldType, ThemeConfigAssciations, MediaQueryOptions, WebsiteSettingsQueryOptions, WebsiteSettingsFields, themeConfigToInputCascade, ThemeConfigEntityName, MediaType, themeConfigToInput, websiteSettingsToInput, WebsiteSettingsEntityName, WebsiteSettingsAssciations, PageEntityName, ThemeEntityName, themeToInputCascade, ThemeCategoryFields, themeToInput, frontComponentToInput, sectionTemplateToInput, pageToInputCascade, ComponentCategoryEntityName, SectionTemplateEntityName, FrontComponentEntityName, TaskFields, TaskStatus, TaskQueryOptions, AppModule, PageMetaFields, pageToInput, PageMetaAssciations, componentCategoryToInput, TemplateCategoryEntityName, templateCategoryToInput } from "@rxdrag/rxcms-models";
11
- import { GlobalLoading, EntityForm, SubmitButton, useListData, SearchInput, EntityPagination, useIsLoading, QueryListScope, EditButton, RemoveButton, EntityTable, useRemoveRow, useEditRow, EntityEditModal, useSelectionsState, EntityListScope, NewButton, EntityRowScope, EntitySelectField, useNewRow } from "@rxdrag/rxcms-models-ui";
12
- import { useOneTheme, usePageList, useTemplateCategoryList, useSectionTemplateList, useComponentCategoryList, useFrontComponentList, useOneThemeById, useUpsertOneWebsite, useDeleteThemeById, useUpsertOneTheme, useLangList, useOneWebsiteSettings, useOneThemeConfig, useUpsertOneThemeConfig, useUpsertOneWebsiteSettings, useUpsertOnePage, useUpsertOneFrontComponent, useUpsertOneSectionTemplate, useDeletePageById } from "@rxdrag/rxcms-model-hooks";
10
+ import { ThemeFields, PageQueryOptions, PageFields, FrontComponentQueryOptions, FrontComponentFields, ComponentCategoryFields, SectionTemplateQueryOptions, SectionTemplateFields, ComponentCategoryQueryOptions, TemplateCategoryQueryOptions, TemplateCategoryFields, ThemeQueryOptions, StyleConfigFields, LangFields, ThemeConfigQueryOptions, ThemeConfigFields, PageAssciations, TaskQueryOptions, TaskFields, AppModule, TaskStatus, PageType, ProductCategoryEntityName, ProductCategoryQueryOptions, ProductCategoryFields, ProductQueryOptions, ProductFields, PublishableStatus, websiteToInput, TaskType, LangQueryOptions, WebsiteAssciations, ExtendFieldType, ThemeConfigAssciations, MediaQueryOptions, WebsiteSettingsQueryOptions, WebsiteSettingsFields, themeConfigToInputCascade, ThemeConfigEntityName, MediaType, themeConfigToInput, websiteSettingsToInput, WebsiteSettingsEntityName, WebsiteSettingsAssciations, PageEntityName, ThemeEntityName, themeToInputCascade, ThemeCategoryFields, themeToInput, frontComponentToInput, sectionTemplateToInput, pageToInputCascade, ComponentCategoryEntityName, SectionTemplateEntityName, FrontComponentEntityName, TaskEntityName, PageMetaFields, pageToInput, PageMetaAssciations, componentCategoryToInput, TemplateCategoryEntityName, templateCategoryToInput } from "@rxdrag/rxcms-models";
11
+ import { GlobalLoading, EntityForm, SubmitButton, useListData, SearchInput, EntityPagination, useIsLoading, QueryListScope, RemoveButton, EntityTable, useRemoveRow, useEditRow, EntityEditModal, useSelectionsState, EntityListScope, NewButton, EntityRowScope, EntitySelectField, useNewRow } from "@rxdrag/rxcms-models-ui";
12
+ import { useOneTheme, usePageList, useTemplateCategoryList, useSectionTemplateList, useComponentCategoryList, useFrontComponentList, useOneThemeById, useTaskList, useUpsertOneWebsite, useDeleteThemeById, useUpsertOneTheme, useLangList, useOneWebsiteSettings, useOneThemeConfig, useUpsertOneThemeConfig, useUpsertOneWebsiteSettings, useUpsertOnePage, useUpsertOneFrontComponent, useUpsertOneSectionTemplate, useDeletePageById } from "@rxdrag/rxcms-model-hooks";
13
13
  import { newPageMetaOptions, useWebsite, useCurrentLang, ComponentType, currentLangState, useCurrentLangId, MediaSingleSelectField, FullImageSelectField, useSiteId, usePreviewUrl, LangSelect, TitleAndSlug, TitleViewField, DescriptionViewField, SiteRoot } from "@rxdrag/biz-components";
14
14
  import { parseExpressionValue, isExpression, extractVariables, compileCode, AsyncFunction, transformCodeToSchema, transformSchemaToCode } from "@rxdrag/astro-compiler";
15
15
  import { CommentNodeName, TextNodeName, CharNodeName } from "@rxdrag/schema-pro";
@@ -20,7 +20,7 @@ import { isHTMLElement as isHTMLElement$1, isStr } from "@rxdrag/shared";
20
20
  import { isFunction as isFunction$2, debounce, keys, uniqueId } from "lodash-es";
21
21
  import { useEntifyEndpoint, useEntifyToken, useLazyQueryEntityList, useLazyQueryOneEntity, emitEntityChange, useCreateEntityClient } from "@rxdrag/entify-hooks";
22
22
  import dayjs from "dayjs";
23
- import { ErrorBoundary, ColorPicker, useSave, CheckCircleIcon as CheckCircleIcon$1, CloseIcon, ModalBody, AddIcon as AddIcon$1, AiStarIcon, ConfirmDialog, SettingsIcon, ModalFooter, FavouriteIcon, LightIcon, DarkIcon, EditIcon, TextInput, Drawer, ModalHeader, ModalClose, SearchIcon, ModalContent as ModalContent$1, Modal as Modal$1, ModalOverlay as ModalOverlay$1, MonacoEditor, getTheFile, MoreIcon, LanguageIcon, SeoIcon, AiIcon, SettingsMinimalisticIcon, CodeSquareIcon, DownloadIcon, UploadIcon, StyledTooltip, PlayIcon, Logo, GlobalIcon, SnsIcon, LightBoltIcon, TaskIcon, TaskErrorIcon, TaskSuspendIcon, WarningIcon, PinIcon, PredefinedColorPicker, PagesIcon, WidgetIcon, LeafNode, GroupNode, TreeView, DesignIcon, RemoveIcon, ResetIcon, TaskStopIcon, ImportIcon, AstroIcon, AddFolderIcon, TemplateIcon, AddTemplateIcon } from "@rxdrag/rxcms-common";
23
+ import { ErrorBoundary, ColorPicker, useSave, CheckCircleIcon as CheckCircleIcon$1, CloseIcon, ModalBody, AddIcon as AddIcon$1, TaskStopIcon, AiStarIcon, ConfirmDialog, SettingsIcon, ModalFooter, FavouriteIcon, LightIcon, DarkIcon, EditIcon, TextInput, Drawer, ModalHeader, ModalClose, SearchIcon, ModalContent as ModalContent$1, Modal as Modal$1, ModalOverlay as ModalOverlay$1, MonacoEditor, getTheFile, MoreIcon, LanguageIcon, SeoIcon, AiIcon, SettingsMinimalisticIcon, CodeSquareIcon, DownloadIcon, UploadIcon, StyledTooltip, PlayIcon, Logo, GlobalIcon, SnsIcon, LightBoltIcon, TaskIcon, TaskErrorIcon, TaskSuspendIcon, TaskSuccessIcon, StopOutlineIcon, RemoveIcon, RunningIcon, WarningIcon, PinIcon, PredefinedColorPicker, PagesIcon, WidgetIcon, LeafNode, GroupNode, TreeView, DesignIcon, ResetIcon, ImportIcon, AstroIcon, AddFolderIcon, TemplateIcon, AddTemplateIcon } from "@rxdrag/rxcms-common";
24
24
  import { PageLoader, PopoverController, ModalController, AnimateController, TabsController, NumberController, FlipController, CollapseController, AosController } from "@rxdrag/website-lib-core";
25
25
  import gsap$2 from "gsap";
26
26
  import { Input, Textarea, StringArrayInput, ImageSelect, TargetSetter, propSetters, DeviceBreakpoints, DeviceContext } from "@rxdrag/schema-setters";
@@ -30,7 +30,7 @@ import JSZip from "jszip";
30
30
  import { create as create$4 } from "zustand";
31
31
  import { Icon } from "@iconify/react";
32
32
  import { useAiUrl, useAiAgent, AiWidget, AiAgentRoot } from "@rxdrag/ai-agent";
33
- import { createHttpClient } from "@rxdrag/entify-lib";
33
+ import { createHttpClient, emit, EVENT_ENTITY_POSTED } from "@rxdrag/entify-lib";
34
34
  import { InputField, TextareaField, toField, ColorField, SwitchField, SelectField, PasswordField, Form } from "@rxdrag/fieldy-heroui";
35
35
  import { ObjectField, useFormValue, useForm, VirtualForm } from "@rxdrag/react-fieldy-pro";
36
36
  import "react-colorful";
@@ -1034,6 +1034,9 @@ function useStudioLoading() {
1034
1034
  function useBaseLangThemeId() {
1035
1035
  return useContext(StudioContext).baseLangThemeId;
1036
1036
  }
1037
+ function useTasksNotDone() {
1038
+ return useContext(StudioContext).tasksNotDone;
1039
+ }
1037
1040
  const fields = [
1038
1041
  ThemeFields.id,
1039
1042
  ThemeFields.name,
@@ -1394,6 +1397,39 @@ function StudioRoot(props) {
1394
1397
  (baseLangThemeData == null ? void 0 : baseLangThemeData.parentThemeId) || void 0,
1395
1398
  newParentThemeByIdQueryOptions()
1396
1399
  );
1400
+ const { data: tasksNotDone } = useTaskList(
1401
+ new TaskQueryOptions(
1402
+ [
1403
+ TaskFields.id,
1404
+ TaskFields.type,
1405
+ TaskFields.name,
1406
+ TaskFields.status,
1407
+ TaskFields.websiteId,
1408
+ TaskFields.status,
1409
+ TaskFields.errorMessage,
1410
+ TaskFields.module,
1411
+ TaskFields.idempotencyKey,
1412
+ TaskFields.params,
1413
+ TaskFields.endedAt,
1414
+ TaskFields.startedAt,
1415
+ TaskFields.createdAt,
1416
+ TaskFields.updatedAt
1417
+ ],
1418
+ {
1419
+ where: {
1420
+ websiteId: {
1421
+ _eq: website == null ? void 0 : website.id
1422
+ },
1423
+ module: {
1424
+ _eq: AppModule.Studio
1425
+ },
1426
+ status: {
1427
+ _in: [TaskStatus.B_Pending, TaskStatus.A_Progress]
1428
+ }
1429
+ }
1430
+ }
1431
+ )
1432
+ );
1397
1433
  const loading = (
1398
1434
  //isLoading ||
1399
1435
  componentsLoading || pagesLoading || templatesLoading || parentThemeLoading || isTemplateCategoriesLoading || isComponentCategoriesLoading || baseLangThemeLoading
@@ -1410,9 +1446,22 @@ function StudioRoot(props) {
1410
1446
  parentTheme,
1411
1447
  baseLangThemeId: baseLangThemeData == null ? void 0 : baseLangThemeData.id,
1412
1448
  loading,
1413
- deployUrl
1449
+ deployUrl,
1450
+ tasksNotDone: tasksNotDone == null ? void 0 : tasksNotDone.items
1414
1451
  };
1415
- }, [theme, templateCategories, templatesData == null ? void 0 : templatesData.items, componentCategories, componentsData == null ? void 0 : componentsData.items, pagesData == null ? void 0 : pagesData.items, parentTheme, baseLangThemeData == null ? void 0 : baseLangThemeData.id, loading, deployUrl]);
1452
+ }, [
1453
+ theme,
1454
+ templateCategories,
1455
+ templatesData == null ? void 0 : templatesData.items,
1456
+ componentCategories,
1457
+ componentsData == null ? void 0 : componentsData.items,
1458
+ pagesData == null ? void 0 : pagesData.items,
1459
+ parentTheme,
1460
+ baseLangThemeData == null ? void 0 : baseLangThemeData.id,
1461
+ loading,
1462
+ deployUrl,
1463
+ tasksNotDone == null ? void 0 : tasksNotDone.items
1464
+ ]);
1416
1465
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(StudioContext.Provider, { value: studioData, children: [
1417
1466
  children,
1418
1467
  /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalLoading, { loading })
@@ -6365,6 +6414,7 @@ const useStudioStore = create$4((set) => ({
6365
6414
  canvasRefId: void 0,
6366
6415
  isDark: false,
6367
6416
  bgColor: "#ffffff",
6417
+ lastedTaskEvent: void 0,
6368
6418
  // 操作方法
6369
6419
  setDrawerType: (drawerType) => set({ drawerType }),
6370
6420
  setConfigType: (configType) => set({ configType }),
@@ -6383,7 +6433,8 @@ const useStudioStore = create$4((set) => ({
6383
6433
  setContentChanged: (contentChanged) => set({ contentChanged }),
6384
6434
  setCanvasRefId: (canvasRefId) => set({ canvasRefId }),
6385
6435
  setIsDark: (isDark2) => set({ isDark: isDark2 }),
6386
- setBgColor: (bgColor) => set({ bgColor })
6436
+ setBgColor: (bgColor) => set({ bgColor }),
6437
+ setLastedTaskEvent: (lastedTaskEvent) => set({ lastedTaskEvent })
6387
6438
  }));
6388
6439
  ({
6389
6440
  get: () => useStudioStore.getState().drawerType,
@@ -6457,6 +6508,10 @@ const useStudioStore = create$4((set) => ({
6457
6508
  get: () => useStudioStore.getState().bgColor,
6458
6509
  set: useStudioStore.getState().setBgColor
6459
6510
  });
6511
+ ({
6512
+ get: () => useStudioStore.getState().lastedTaskEvent,
6513
+ set: useStudioStore.getState().setLastedTaskEvent
6514
+ });
6460
6515
  var ThemeConfigType = /* @__PURE__ */ ((ThemeConfigType2) => {
6461
6516
  ThemeConfigType2["MultiLang"] = "multi-Lang";
6462
6517
  ThemeConfigType2["Tailwind"] = "tailwind";
@@ -6699,50 +6754,68 @@ function useTranslateTheme() {
6699
6754
  langId: langId.trim(),
6700
6755
  title: title.trim()
6701
6756
  });
6702
- console.log("翻译主题成功:", response);
6703
6757
  return response;
6704
6758
  } catch (error) {
6705
- const isErrorObject = (err) => {
6759
+ const isAxiosError = (err) => {
6706
6760
  return typeof err === "object" && err !== null;
6707
6761
  };
6708
- if (isErrorObject(error) && (error.code === "NETWORK_ERROR" || ((_a3 = error.message) == null ? void 0 : _a3.includes("fetch")))) {
6762
+ if (isAxiosError(error) && (error.code === "NETWORK_ERROR" || ((_a3 = error.message) == null ? void 0 : _a3.includes("fetch")))) {
6709
6763
  console.error("翻译主题网络错误:", error);
6710
6764
  throw new Error("网络连接失败,请检查网络连接");
6711
6765
  }
6712
- if (isErrorObject(error) && ((_b3 = error.response) == null ? void 0 : _b3.status)) {
6766
+ if (isAxiosError(error) && ((_b3 = error.response) == null ? void 0 : _b3.status)) {
6713
6767
  const status2 = error.response.status;
6768
+ const responseData = error.response.data;
6714
6769
  let errorMsg2 = "翻译请求失败";
6715
- switch (status2) {
6716
- case 400:
6717
- errorMsg2 = "请求参数错误";
6718
- break;
6719
- case 401:
6720
- errorMsg2 = "认证失败,请重新登录";
6721
- break;
6722
- case 403:
6723
- errorMsg2 = "没有权限执行此操作";
6724
- break;
6725
- case 404:
6726
- errorMsg2 = "翻译服务不存在";
6727
- break;
6728
- case 429:
6729
- errorMsg2 = "请求过于频繁,请稍后再试";
6730
- break;
6731
- case 500:
6732
- errorMsg2 = "服务器内部错误";
6733
- break;
6734
- case 502:
6735
- case 503:
6736
- case 504:
6737
- errorMsg2 = "服务暂时不可用,请稍后再试";
6738
- break;
6739
- default:
6740
- errorMsg2 = `请求失败 (${status2})`;
6770
+ if (responseData) {
6771
+ if (typeof responseData === "string") {
6772
+ errorMsg2 = responseData;
6773
+ } else if (responseData.error) {
6774
+ errorMsg2 = responseData.error;
6775
+ } else if (responseData.message) {
6776
+ errorMsg2 = responseData.message;
6777
+ } else if (responseData.msg) {
6778
+ errorMsg2 = responseData.msg;
6779
+ }
6780
+ }
6781
+ if (errorMsg2 === "翻译请求失败") {
6782
+ switch (status2) {
6783
+ case 400:
6784
+ errorMsg2 = "请求参数错误";
6785
+ break;
6786
+ case 401:
6787
+ errorMsg2 = "认证失败,请重新登录";
6788
+ break;
6789
+ case 403:
6790
+ errorMsg2 = "没有权限执行此操作";
6791
+ break;
6792
+ case 404:
6793
+ errorMsg2 = "翻译服务不存在";
6794
+ break;
6795
+ case 429:
6796
+ errorMsg2 = "请求过于频繁,请稍后再试";
6797
+ break;
6798
+ case 500:
6799
+ errorMsg2 = "服务器内部错误";
6800
+ break;
6801
+ case 502:
6802
+ case 503:
6803
+ case 504:
6804
+ errorMsg2 = "服务暂时不可用,请稍后再试";
6805
+ break;
6806
+ default:
6807
+ errorMsg2 = `请求失败 (${status2})`;
6808
+ }
6741
6809
  }
6742
- console.error("翻译主题HTTP错误:", { status: status2, error });
6810
+ console.error("翻译主题HTTP错误:", {
6811
+ status: status2,
6812
+ statusText: error.response.statusText,
6813
+ responseData,
6814
+ error
6815
+ });
6743
6816
  throw new Error(errorMsg2);
6744
6817
  }
6745
- const errorMsg = isErrorObject(error) && error.message ? error.message : "翻译过程中发生未知错误";
6818
+ const errorMsg = isAxiosError(error) && error.message ? error.message : "翻译过程中发生未知错误";
6746
6819
  console.error("翻译主题未知错误:", error);
6747
6820
  throw new Error(errorMsg);
6748
6821
  }
@@ -6818,10 +6891,14 @@ const linkTypes = [
6818
6891
  ];
6819
6892
  function MultiLangPanel() {
6820
6893
  var _a3, _b3, _c2, _d2, _e2, _f2;
6894
+ const [task, setTask] = useState(null);
6821
6895
  const [linkType, setLinkType] = useState("subdomain");
6822
6896
  const [confirmOpen, setConfirmOpen] = useState(false);
6823
6897
  const [currentLangId, setCurrentLangId] = useCurrentLangId();
6824
6898
  const setError = useEntifyWrapperStore((state) => state.setGlobalError);
6899
+ const setSuccess = useEntifyWrapperStore((state) => state.setGlobalSuccess);
6900
+ const tasksNotDone = useTasksNotDone();
6901
+ const lastTask = useStudioStore((state) => state.lastedTaskEvent);
6825
6902
  const selectedContent = useStudioStore((state) => state.selectedContent);
6826
6903
  const setSelectedContent = useStudioStore(
6827
6904
  (state) => state.setSelectedContent
@@ -6830,6 +6907,21 @@ function MultiLangPanel() {
6830
6907
  const isChanginBaseLangRef = useRef(false);
6831
6908
  const [upsertTheme, { isMutating: isCreating }] = useUpsertOneTheme();
6832
6909
  const translateTheme = useTranslateTheme();
6910
+ useEffect(() => {
6911
+ const notDoneTask = tasksNotDone == null ? void 0 : tasksNotDone.find(
6912
+ (task2) => {
6913
+ var _a4;
6914
+ return task2.websiteId === (website == null ? void 0 : website.id) && ((_a4 = task2.params) == null ? void 0 : _a4.langId) === currentLangId && task2.type === TaskType.TranslateTheme;
6915
+ }
6916
+ );
6917
+ setTask(notDoneTask || null);
6918
+ }, [currentLangId, tasksNotDone, website == null ? void 0 : website.id]);
6919
+ useEffect(() => {
6920
+ var _a4;
6921
+ if ((lastTask == null ? void 0 : lastTask.websiteId) === (website == null ? void 0 : website.id) && ((_a4 = lastTask == null ? void 0 : lastTask.params) == null ? void 0 : _a4.langId) === currentLangId && (lastTask == null ? void 0 : lastTask.type) === TaskType.TranslateTheme) {
6922
+ setTask(lastTask);
6923
+ }
6924
+ }, [currentLangId, lastTask, website == null ? void 0 : website.id]);
6833
6925
  useEffect(() => {
6834
6926
  var _a4;
6835
6927
  if (website && !currentLangId) {
@@ -6916,7 +7008,7 @@ function MultiLangPanel() {
6916
7008
  const handleTranslate = useCallback(() => {
6917
7009
  setConfirmOpen(true);
6918
7010
  }, []);
6919
- useCallback(() => {
7011
+ const handleStop = useCallback(() => {
6920
7012
  }, []);
6921
7013
  const handleCloseConfirm = useCallback(() => {
6922
7014
  setConfirmOpen(false);
@@ -6930,14 +7022,16 @@ function MultiLangPanel() {
6930
7022
  try {
6931
7023
  const lang = (_a4 = allLangs == null ? void 0 : allLangs.items) == null ? void 0 : _a4.find((lang2) => lang2.id === currentLangId);
6932
7024
  const title = `网站代码翻译到:${(lang == null ? void 0 : lang.cnName) || (lang == null ? void 0 : lang.enName) || (lang == null ? void 0 : lang.localName) || (lang == null ? void 0 : lang.abbr) || ""}`;
6933
- await translateTheme(currentLangId, title);
7025
+ const task2 = await translateTheme(currentLangId, title);
7026
+ setTask(task2);
7027
+ setSuccess("翻译任务已提交");
6934
7028
  } catch (error) {
6935
7029
  console.error("翻译主题失败:", error);
6936
7030
  const errorString = error instanceof Error ? error.message : String(error);
6937
7031
  setError(errorString);
6938
7032
  }
6939
- }, [currentLangId, allLangs == null ? void 0 : allLangs.items, translateTheme, setError]);
6940
- const isRunning = false;
7033
+ }, [currentLangId, allLangs == null ? void 0 : allLangs.items, translateTheme, setSuccess, setError]);
7034
+ const isRunning = (task == null ? void 0 : task.status) === TaskStatus.B_Pending || (task == null ? void 0 : task.status) === TaskStatus.A_Progress;
6941
7035
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6942
7036
  /* @__PURE__ */ jsxRuntimeExports.jsx(ModalBody, { className: "flex-1 p-4 min-h-0 overflow-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
6943
7037
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { className: "bg-default-50", children: [
@@ -7047,7 +7141,15 @@ function MultiLangPanel() {
7047
7141
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-6 flex items-center justify-between", children: [
7048
7142
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-default-500" }),
7049
7143
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-2", children: [
7050
- isRunning,
7144
+ isRunning && /* @__PURE__ */ jsxRuntimeExports.jsx(
7145
+ Button$2,
7146
+ {
7147
+ variant: "flat",
7148
+ startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(TaskStopIcon, { className: "size-5" }),
7149
+ onPress: handleStop,
7150
+ children: "停止"
7151
+ }
7152
+ ),
7051
7153
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7052
7154
  Button$2,
7053
7155
  {
@@ -7607,7 +7709,7 @@ function WebsiteInfoPanel(props) {
7607
7709
  }
7608
7710
  ) });
7609
7711
  }
7610
- function EmialTemplatesPanel(props) {
7712
+ function EmailTemplatesPanel(props) {
7611
7713
  const { onSuccess } = props;
7612
7714
  const theme = useStudioTheme();
7613
7715
  const { data: themeConfig2 } = useOneThemeConfig(newThemeConfigOptions(theme));
@@ -138288,7 +138390,7 @@ registerLanguage({
138288
138390
  aliases: ["FreeMarker2", "Apache FreeMarker2"],
138289
138391
  loader: () => {
138290
138392
  {
138291
- return import("./freemarker2-775aff18.js").then((m2) => m2.TagAutoInterpolationDollar);
138393
+ return import("./freemarker2-1fbc5bf0.js").then((m2) => m2.TagAutoInterpolationDollar);
138292
138394
  }
138293
138395
  }
138294
138396
  });
@@ -138297,7 +138399,7 @@ registerLanguage({
138297
138399
  aliases: ["FreeMarker2 (Angle/Dollar)", "Apache FreeMarker2 (Angle/Dollar)"],
138298
138400
  loader: () => {
138299
138401
  {
138300
- return import("./freemarker2-775aff18.js").then((m2) => m2.TagAngleInterpolationDollar);
138402
+ return import("./freemarker2-1fbc5bf0.js").then((m2) => m2.TagAngleInterpolationDollar);
138301
138403
  }
138302
138404
  }
138303
138405
  });
@@ -138306,7 +138408,7 @@ registerLanguage({
138306
138408
  aliases: ["FreeMarker2 (Bracket/Dollar)", "Apache FreeMarker2 (Bracket/Dollar)"],
138307
138409
  loader: () => {
138308
138410
  {
138309
- return import("./freemarker2-775aff18.js").then((m2) => m2.TagBracketInterpolationDollar);
138411
+ return import("./freemarker2-1fbc5bf0.js").then((m2) => m2.TagBracketInterpolationDollar);
138310
138412
  }
138311
138413
  }
138312
138414
  });
@@ -138315,7 +138417,7 @@ registerLanguage({
138315
138417
  aliases: ["FreeMarker2 (Angle/Bracket)", "Apache FreeMarker2 (Angle/Bracket)"],
138316
138418
  loader: () => {
138317
138419
  {
138318
- return import("./freemarker2-775aff18.js").then((m2) => m2.TagAngleInterpolationBracket);
138420
+ return import("./freemarker2-1fbc5bf0.js").then((m2) => m2.TagAngleInterpolationBracket);
138319
138421
  }
138320
138422
  }
138321
138423
  });
@@ -138324,7 +138426,7 @@ registerLanguage({
138324
138426
  aliases: ["FreeMarker2 (Bracket/Bracket)", "Apache FreeMarker2 (Bracket/Bracket)"],
138325
138427
  loader: () => {
138326
138428
  {
138327
- return import("./freemarker2-775aff18.js").then((m2) => m2.TagBracketInterpolationBracket);
138429
+ return import("./freemarker2-1fbc5bf0.js").then((m2) => m2.TagBracketInterpolationBracket);
138328
138430
  }
138329
138431
  }
138330
138432
  });
@@ -138333,7 +138435,7 @@ registerLanguage({
138333
138435
  aliases: ["FreeMarker2 (Auto/Dollar)", "Apache FreeMarker2 (Auto/Dollar)"],
138334
138436
  loader: () => {
138335
138437
  {
138336
- return import("./freemarker2-775aff18.js").then((m2) => m2.TagAutoInterpolationDollar);
138438
+ return import("./freemarker2-1fbc5bf0.js").then((m2) => m2.TagAutoInterpolationDollar);
138337
138439
  }
138338
138440
  }
138339
138441
  });
@@ -138342,7 +138444,7 @@ registerLanguage({
138342
138444
  aliases: ["FreeMarker2 (Auto/Bracket)", "Apache FreeMarker2 (Auto/Bracket)"],
138343
138445
  loader: () => {
138344
138446
  {
138345
- return import("./freemarker2-775aff18.js").then((m2) => m2.TagAutoInterpolationBracket);
138447
+ return import("./freemarker2-1fbc5bf0.js").then((m2) => m2.TagAutoInterpolationBracket);
138346
138448
  }
138347
138449
  }
138348
138450
  });
@@ -138392,7 +138494,7 @@ registerLanguage({
138392
138494
  mimetypes: ["text/x-handlebars-template"],
138393
138495
  loader: () => {
138394
138496
  {
138395
- return import("./handlebars-46315f0e.js");
138497
+ return import("./handlebars-0d2d8087.js");
138396
138498
  }
138397
138499
  }
138398
138500
  });
@@ -138425,7 +138527,7 @@ registerLanguage({
138425
138527
  mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
138426
138528
  loader: () => {
138427
138529
  {
138428
- return import("./html-ed8824db.js");
138530
+ return import("./html-1f416956.js");
138429
138531
  }
138430
138532
  }
138431
138533
  });
@@ -138478,7 +138580,7 @@ registerLanguage({
138478
138580
  mimetypes: ["text/javascript"],
138479
138581
  loader: () => {
138480
138582
  {
138481
- return import("./javascript-c0d8cc8b.js");
138583
+ return import("./javascript-fa1a44fb.js");
138482
138584
  }
138483
138585
  }
138484
138586
  });
@@ -138577,7 +138679,7 @@ registerLanguage({
138577
138679
  mimetypes: ["application/liquid"],
138578
138680
  loader: () => {
138579
138681
  {
138580
- return import("./liquid-fd914edd.js");
138682
+ return import("./liquid-f59e1243.js");
138581
138683
  }
138582
138684
  }
138583
138685
  });
@@ -138625,7 +138727,7 @@ registerLanguage({
138625
138727
  aliases: ["MDX", "mdx"],
138626
138728
  loader: () => {
138627
138729
  {
138628
- return import("./mdx-5e7a0f83.js");
138730
+ return import("./mdx-831aab9e.js");
138629
138731
  }
138630
138732
  }
138631
138733
  });
@@ -138884,7 +138986,7 @@ registerLanguage({
138884
138986
  firstLine: "^#!/.*\\bpython[0-9.-]*\\b",
138885
138987
  loader: () => {
138886
138988
  {
138887
- return import("./python-e1d6d047.js");
138989
+ return import("./python-c08d64d5.js");
138888
138990
  }
138889
138991
  }
138890
138992
  });
@@ -138933,7 +139035,7 @@ registerLanguage({
138933
139035
  mimetypes: ["text/x-cshtml"],
138934
139036
  loader: () => {
138935
139037
  {
138936
- return import("./razor-e15c6655.js");
139038
+ return import("./razor-c37a2ffd.js");
138937
139039
  }
138938
139040
  }
138939
139041
  });
@@ -139269,7 +139371,7 @@ registerLanguage({
139269
139371
  mimetypes: ["text/typescript"],
139270
139372
  loader: () => {
139271
139373
  {
139272
- return import("./typescript-0b9ed5c9.js");
139374
+ return import("./typescript-37e16b75.js");
139273
139375
  }
139274
139376
  }
139275
139377
  });
@@ -139353,7 +139455,7 @@ registerLanguage({
139353
139455
  mimetypes: ["text/xml", "application/xml", "application/xaml+xml", "application/xml-dtd"],
139354
139456
  loader: () => {
139355
139457
  {
139356
- return import("./xml-4e563c2c.js");
139458
+ return import("./xml-68f06860.js");
139357
139459
  }
139358
139460
  }
139359
139461
  });
@@ -139370,7 +139472,7 @@ registerLanguage({
139370
139472
  mimetypes: ["application/x-yaml", "text/x-yaml"],
139371
139473
  loader: () => {
139372
139474
  {
139373
- return import("./yaml-c9882143.js");
139475
+ return import("./yaml-11d37d04.js");
139374
139476
  }
139375
139477
  }
139376
139478
  });
@@ -139494,7 +139596,7 @@ var lessDefaults = new LanguageServiceDefaultsImpl$3(
139494
139596
  monaco_editor_core_exports$3.languages.css = { cssDefaults, lessDefaults, scssDefaults };
139495
139597
  function getMode$3() {
139496
139598
  {
139497
- return import("./cssMode-e235f5c4.js");
139599
+ return import("./cssMode-3b37fb1f.js");
139498
139600
  }
139499
139601
  }
139500
139602
  monaco_editor_core_exports$3.languages.onLanguage("less", () => {
@@ -139625,7 +139727,7 @@ monaco_editor_core_exports$2.languages.html = {
139625
139727
  };
139626
139728
  function getMode$2() {
139627
139729
  {
139628
- return import("./htmlMode-6d3a7f40.js");
139730
+ return import("./htmlMode-f8f5f503.js");
139629
139731
  }
139630
139732
  }
139631
139733
  function registerHTMLLanguageService(languageId, options = optionsDefault, modeConfiguration = getConfigurationDefault(languageId)) {
@@ -139723,7 +139825,7 @@ var getWorker = () => getMode$1().then((mode) => mode.getWorker());
139723
139825
  monaco_editor_core_exports$1.languages.json = { jsonDefaults, getWorker };
139724
139826
  function getMode$1() {
139725
139827
  {
139726
- return import("./jsonMode-165aee85.js");
139828
+ return import("./jsonMode-c7e6869c.js");
139727
139829
  }
139728
139830
  }
139729
139831
  monaco_editor_core_exports$1.languages.register({
@@ -139999,7 +140101,7 @@ monaco_editor_core_exports.languages.typescript = {
139999
140101
  };
140000
140102
  function getMode() {
140001
140103
  {
140002
- return import("./tsMode-2f97f8d8.js");
140104
+ return import("./tsMode-fe874300.js");
140003
140105
  }
140004
140106
  }
140005
140107
  monaco_editor_core_exports.languages.onLanguage("typescript", () => {
@@ -189577,7 +189679,7 @@ function ConfigDrawer() {
189577
189679
  openSettingsType === ThemeConfigType.MultiLang && /* @__PURE__ */ jsxRuntimeExports.jsx(MultiLangPanel, {}),
189578
189680
  openSettingsType === ThemeConfigType.Extends && /* @__PURE__ */ jsxRuntimeExports.jsx(ExtendsPanel, {}),
189579
189681
  openSettingsType === ThemeConfigType.WebsiteInfo && /* @__PURE__ */ jsxRuntimeExports.jsx(WebsiteInfoPanel, { onSuccess: () => setOpenSettingsType(void 0) }),
189580
- openSettingsType === ThemeConfigType.EmailTemplates && /* @__PURE__ */ jsxRuntimeExports.jsx(EmialTemplatesPanel, { onSuccess: () => setOpenSettingsType(void 0) }),
189682
+ openSettingsType === ThemeConfigType.EmailTemplates && /* @__PURE__ */ jsxRuntimeExports.jsx(EmailTemplatesPanel, { onSuccess: () => setOpenSettingsType(void 0) }),
189581
189683
  openSettingsType === ThemeConfigType.Redirects && /* @__PURE__ */ jsxRuntimeExports.jsx(Map301Panel, { onClose: () => setOpenSettingsType(void 0) }),
189582
189684
  openSettingsType === ThemeConfigType.DeployConfig && /* @__PURE__ */ jsxRuntimeExports.jsx(DeployConfigPanel, { onSuccess: () => setOpenSettingsType(void 0) })
189583
189685
  ]
@@ -198521,6 +198623,35 @@ const RightPanel = memo(() => {
198521
198623
  }
198522
198624
  ) }) });
198523
198625
  });
198626
+ const StopButton = forwardRef$2(
198627
+ (props, ref2) => {
198628
+ const { confirm, onStop, ...rest } = props;
198629
+ const [open, setOpen] = useState(false);
198630
+ const handleClick = useCallback(() => {
198631
+ if (confirm) {
198632
+ setOpen(true);
198633
+ } else {
198634
+ onStop == null ? void 0 : onStop();
198635
+ }
198636
+ }, [confirm, onStop]);
198637
+ const handleConfirm = useCallback(() => {
198638
+ onStop == null ? void 0 : onStop();
198639
+ setOpen(false);
198640
+ }, [onStop]);
198641
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
198642
+ /* @__PURE__ */ jsxRuntimeExports.jsx(StyledTooltip, { content: "停止任务", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button$2, { ref: ref2, onPress: handleClick, ...rest }) }),
198643
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
198644
+ ConfirmDialog,
198645
+ {
198646
+ open,
198647
+ onClose: () => setOpen(false),
198648
+ onConfirm: handleConfirm,
198649
+ confirm
198650
+ }
198651
+ )
198652
+ ] });
198653
+ }
198654
+ );
198524
198655
  function TaskTable() {
198525
198656
  var _a3, _b3;
198526
198657
  const data = useListData();
@@ -198530,85 +198661,95 @@ function TaskTable() {
198530
198661
  dataIndex: TaskFields.name,
198531
198662
  key: TaskFields.name,
198532
198663
  title: "任务",
198533
- width: 240,
198664
+ width: "100%",
198534
198665
  sortable: false,
198535
198666
  editable: false,
198536
198667
  cellRender: (text2, row) => {
198537
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
198538
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
198539
- (row == null ? void 0 : row.status) === TaskStatus.A_Progress && /* @__PURE__ */ jsxRuntimeExports.jsx(TaskIcon, { className: "size-5 text-primary" }),
198540
- (row == null ? void 0 : row.status) === TaskStatus.B_Failure && /* @__PURE__ */ jsxRuntimeExports.jsx(TaskErrorIcon, { className: "size-5 text-danger" }),
198541
- (row == null ? void 0 : row.status) === TaskStatus.C_Pending && /* @__PURE__ */ jsxRuntimeExports.jsx(TaskSuspendIcon, { className: "size-5" })
198542
- ] }),
198543
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
198544
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: text2 }),
198545
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-500 flex items-center gap-1", children: [
198546
- row == null ? void 0 : row.message,
198547
- (row == null ? void 0 : row.status) === TaskStatus.A_Progress && /* @__PURE__ */ jsxRuntimeExports.jsxs(
198548
- "svg",
198549
- {
198550
- xmlns: "http://www.w3.org/2000/svg",
198551
- className: "size-4",
198552
- viewBox: "0 0 24 24",
198553
- children: [
198554
- /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "4", cy: "12", r: "3", fill: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
198555
- "animate",
198556
- {
198557
- id: "SVG7x14Dcom",
198558
- fill: "freeze",
198559
- attributeName: "opacity",
198560
- begin: "0;SVGqSjG0dUp.end-0.25s",
198561
- dur: "0.75s",
198562
- values: "1;0.2"
198563
- }
198564
- ) }),
198565
- /* @__PURE__ */ jsxRuntimeExports.jsx(
198566
- "circle",
198567
- {
198568
- cx: "12",
198569
- cy: "12",
198570
- r: "3",
198571
- fill: "currentColor",
198572
- opacity: "0.4",
198573
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
198668
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
198669
+ "div",
198670
+ {
198671
+ className: cn(
198672
+ "flex items-center gap-2",
198673
+ (row == null ? void 0 : row.status) === TaskStatus.E_Success && "opacity-70"
198674
+ ),
198675
+ children: [
198676
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
198677
+ (row == null ? void 0 : row.status) === TaskStatus.A_Progress && /* @__PURE__ */ jsxRuntimeExports.jsx(TaskIcon, { className: "size-5 text-primary" }),
198678
+ (row == null ? void 0 : row.status) === TaskStatus.C_Failure && /* @__PURE__ */ jsxRuntimeExports.jsx(TaskErrorIcon, { className: "size-5 text-danger" }),
198679
+ (row == null ? void 0 : row.status) === TaskStatus.B_Pending && /* @__PURE__ */ jsxRuntimeExports.jsx(TaskSuspendIcon, { className: "size-5" }),
198680
+ (row == null ? void 0 : row.status) === TaskStatus.E_Success && /* @__PURE__ */ jsxRuntimeExports.jsx(TaskSuccessIcon, { className: "size-5" })
198681
+ ] }),
198682
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
198683
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("text-sm"), children: text2 }),
198684
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-500 flex items-center gap-1", children: [
198685
+ row == null ? void 0 : row.message,
198686
+ (row == null ? void 0 : row.status) === TaskStatus.A_Progress && /* @__PURE__ */ jsxRuntimeExports.jsxs(
198687
+ "svg",
198688
+ {
198689
+ xmlns: "http://www.w3.org/2000/svg",
198690
+ className: "size-4",
198691
+ viewBox: "0 0 24 24",
198692
+ children: [
198693
+ /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "4", cy: "12", r: "3", fill: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
198574
198694
  "animate",
198575
198695
  {
198696
+ id: "SVG7x14Dcom",
198576
198697
  fill: "freeze",
198577
198698
  attributeName: "opacity",
198578
- begin: "SVG7x14Dcom.begin+0.15s",
198699
+ begin: "0;SVGqSjG0dUp.end-0.25s",
198579
198700
  dur: "0.75s",
198580
198701
  values: "1;0.2"
198581
198702
  }
198582
- )
198583
- }
198584
- ),
198585
- /* @__PURE__ */ jsxRuntimeExports.jsx(
198586
- "circle",
198587
- {
198588
- cx: "20",
198589
- cy: "12",
198590
- r: "3",
198591
- fill: "currentColor",
198592
- opacity: "0.3",
198593
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
198594
- "animate",
198703
+ ) }),
198704
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
198705
+ "circle",
198595
198706
  {
198596
- id: "SVGqSjG0dUp",
198597
- fill: "freeze",
198598
- attributeName: "opacity",
198599
- begin: "SVG7x14Dcom.begin+0.3s",
198600
- dur: "0.75s",
198601
- values: "1;0.2"
198707
+ cx: "12",
198708
+ cy: "12",
198709
+ r: "3",
198710
+ fill: "currentColor",
198711
+ opacity: "0.4",
198712
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
198713
+ "animate",
198714
+ {
198715
+ fill: "freeze",
198716
+ attributeName: "opacity",
198717
+ begin: "SVG7x14Dcom.begin+0.15s",
198718
+ dur: "0.75s",
198719
+ values: "1;0.2"
198720
+ }
198721
+ )
198722
+ }
198723
+ ),
198724
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
198725
+ "circle",
198726
+ {
198727
+ cx: "20",
198728
+ cy: "12",
198729
+ r: "3",
198730
+ fill: "currentColor",
198731
+ opacity: "0.3",
198732
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
198733
+ "animate",
198734
+ {
198735
+ id: "SVGqSjG0dUp",
198736
+ fill: "freeze",
198737
+ attributeName: "opacity",
198738
+ begin: "SVG7x14Dcom.begin+0.3s",
198739
+ dur: "0.75s",
198740
+ values: "1;0.2"
198741
+ }
198742
+ )
198602
198743
  }
198603
198744
  )
198604
- }
198605
- )
198606
- ]
198607
- }
198608
- )
198609
- ] })
198610
- ] })
198611
- ] });
198745
+ ]
198746
+ }
198747
+ )
198748
+ ] })
198749
+ ] })
198750
+ ]
198751
+ }
198752
+ );
198612
198753
  }
198613
198754
  },
198614
198755
  // {
@@ -198629,23 +198770,21 @@ function TaskTable() {
198629
198770
  // },
198630
198771
  {
198631
198772
  key: "operate",
198632
- width: 120,
198633
- title: "操作",
198634
- cellRender: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center", children: [
198635
- /* @__PURE__ */ jsxRuntimeExports.jsx(EditButton, { isIconOnly: true, size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
198636
- Icon,
198637
- {
198638
- icon: "solar:pen-linear",
198639
- className: "size-4 text-default-500"
198640
- }
198641
- ) }),
198642
- /* @__PURE__ */ jsxRuntimeExports.jsx(RemoveButton, { isIconOnly: true, size: "sm", variant: "light", color: "danger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
198643
- Icon,
198773
+ width: 80,
198774
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full text-center", children: "操作" }),
198775
+ cellRender: (text2, row) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center", children: [
198776
+ (row == null ? void 0 : row.status) === TaskStatus.A_Progress && /* @__PURE__ */ jsxRuntimeExports.jsx(StopButton, { isIconOnly: true, size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(StopOutlineIcon, { className: "size-4 text-default-500" }) }),
198777
+ (row == null ? void 0 : row.status) !== TaskStatus.A_Progress && /* @__PURE__ */ jsxRuntimeExports.jsx(
198778
+ RemoveButton,
198644
198779
  {
198645
- icon: "solar:trash-bin-minimalistic-linear",
198646
- className: "size-4"
198780
+ confirm: "确定要删除吗?",
198781
+ isIconOnly: true,
198782
+ size: "sm",
198783
+ variant: "light",
198784
+ color: "danger",
198785
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(RemoveIcon, { className: "size-4" })
198647
198786
  }
198648
- ) })
198787
+ )
198649
198788
  ] })
198650
198789
  }
198651
198790
  ];
@@ -198653,9 +198792,10 @@ function TaskTable() {
198653
198792
  return /* @__PURE__ */ jsxRuntimeExports.jsx(React.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
198654
198793
  EntityTable,
198655
198794
  {
198656
- "aria-label": "用户列表",
198795
+ "aria-label": "任务列表",
198657
198796
  columns: cols,
198658
198797
  removeWrapper: true,
198798
+ selectionMode: "single",
198659
198799
  headerProps: {
198660
198800
  style: {
198661
198801
  padding: "12px 6px",
@@ -198671,12 +198811,17 @@ function TaskTable() {
198671
198811
  }
198672
198812
  function TaskManager() {
198673
198813
  const [open, setOpen] = useState();
198814
+ const notDoneTasks = useTasksNotDone();
198674
198815
  const handleClose = useCallback(() => {
198675
198816
  setOpen(false);
198676
198817
  }, []);
198677
198818
  const handlePress = useCallback(() => {
198678
198819
  setOpen(true);
198679
198820
  }, []);
198821
+ const runningTasks = useMemo(
198822
+ () => notDoneTasks == null ? void 0 : notDoneTasks.filter((task) => task.status === TaskStatus.A_Progress),
198823
+ [notDoneTasks]
198824
+ );
198680
198825
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
198681
198826
  /* @__PURE__ */ jsxRuntimeExports.jsx(
198682
198827
  Button$2,
@@ -198684,10 +198829,10 @@ function TaskManager() {
198684
198829
  variant: "light",
198685
198830
  size: "sm",
198686
198831
  className: cn(
198687
- "px-1 py-1 shrink-0"
198688
- //runningTasks.length ? "text-default-600" : "text-default-500"
198832
+ "px-1 py-1 shrink-0",
198833
+ (runningTasks == null ? void 0 : runningTasks.length) ? "text-default-600" : "text-default-500"
198689
198834
  ),
198690
- startContent: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex gap-1" }),
198835
+ startContent: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex gap-1", children: !!(runningTasks == null ? void 0 : runningTasks.length) && /* @__PURE__ */ jsxRuntimeExports.jsx(RunningIcon, { width: 14, className: "text-primary" }) }),
198691
198836
  onPress: handlePress,
198692
198837
  children: "任务"
198693
198838
  }
@@ -198713,10 +198858,62 @@ function TaskManager() {
198713
198858
  )
198714
198859
  ] });
198715
198860
  }
198861
+ function useSubscribeTaskEvents(onTaskEvent) {
198862
+ const website = useWebsite();
198863
+ const baseURL = useAiUrl();
198864
+ const token = useEntifyToken();
198865
+ const eventSourceRef = useRef(null);
198866
+ const onTaskEventRef = useRef(onTaskEvent);
198867
+ onTaskEventRef.current = onTaskEvent;
198868
+ useEffect(() => {
198869
+ if (!(website == null ? void 0 : website.id) || !baseURL || !token) {
198870
+ return;
198871
+ }
198872
+ if (eventSourceRef.current) {
198873
+ eventSourceRef.current.close();
198874
+ }
198875
+ const url = new URL(`/api/studio/task-event/${website.id}`, baseURL);
198876
+ url.searchParams.set("token", token);
198877
+ const eventSource = new EventSource(url.toString());
198878
+ eventSourceRef.current = eventSource;
198879
+ eventSource.onmessage = (event) => {
198880
+ try {
198881
+ const taskEvent = JSON.parse(event.data);
198882
+ if (onTaskEventRef.current) {
198883
+ onTaskEventRef.current(taskEvent);
198884
+ }
198885
+ } catch (parseError) {
198886
+ console.error("解析事件数据失败:", parseError);
198887
+ }
198888
+ };
198889
+ eventSource.onerror = (error) => {
198890
+ console.error("SSE连接错误:", error);
198891
+ };
198892
+ return () => {
198893
+ eventSource.close();
198894
+ };
198895
+ }, [website == null ? void 0 : website.id, baseURL, token]);
198896
+ }
198716
198897
  function StatusBar({ doc }) {
198898
+ const setLastedTaskEvent = useStudioStore(
198899
+ (state) => state.setLastedTaskEvent
198900
+ );
198717
198901
  const viewMode = useStudioStore((state) => state.viewMode);
198718
198902
  const selectedContent = useStudioStore((state) => state.selectedContent);
198719
198903
  const website = useWebsite();
198904
+ const handleEvent = useCallback(
198905
+ (event) => {
198906
+ console.log("收到任务事件:", event);
198907
+ setLastedTaskEvent(event);
198908
+ emit(EVENT_ENTITY_POSTED, {
198909
+ entityName: TaskEntityName,
198910
+ requested: event,
198911
+ response: event
198912
+ });
198913
+ },
198914
+ [setLastedTaskEvent]
198915
+ );
198916
+ useSubscribeTaskEvents(handleEvent);
198720
198917
  const breadcrumbsText = useMemo(() => {
198721
198918
  var _a3;
198722
198919
  return ((_a3 = selectedContent == null ? void 0 : selectedContent.breadcrumbs) == null ? void 0 : _a3.join("/")) || "";
@@ -204211,4 +204408,4 @@ export {
204211
204408
  typescriptDefaults as t,
204212
204409
  useCustomizedMaterials as u
204213
204410
  };
204214
- //# sourceMappingURL=index-aaa4e570.js.map
204411
+ //# sourceMappingURL=index-525006cd.js.map