@phis/ui 0.8.0 → 0.8.2
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/README.md +9 -2
- package/components/cms/phi-cms-layout-renderer.js +15 -7
- package/components/cms/phi-cms-render-diagnostic-client.d.ts +3 -1
- package/components/cms/phi-cms-render-diagnostic-client.js +4 -3
- package/components/cms/phi-cms-render-diagnostic.d.ts +8 -2
- package/components/cms/phi-cms-render-diagnostic.js +12 -2
- package/components/cms/phi-cms-render-error-boundary.d.ts +2 -0
- package/components/cms/phi-cms-render-error-boundary.js +1 -1
- package/components/cms/phi-cms-root-layout.js +3 -1
- package/components/controls/phi-media-picker-control.d.ts +9 -0
- package/components/controls/phi-media-picker-control.js +1 -1
- package/components/controls/phi-popover-control.js +4 -1
- package/components/controls/phi-table-control.d.ts +7 -1
- package/components/controls/phi-table-control.js +26 -11
- package/components/forms/form-descriptor-field-check.d.ts +18 -0
- package/components/forms/form-descriptor-field-check.js +41 -0
- package/components/forms/form-descriptor-runtime-client.js +11 -10
- package/components/forms/form-record-source.d.ts +38 -0
- package/components/forms/form-record-source.js +48 -0
- package/components/forms/shared-form-descriptors.d.ts +0 -34
- package/components/forms/shared-form-descriptors.js +0 -6
- package/components/forms/shared-form-ids.d.ts +1 -1
- package/components/forms/shared-form-ids.js +1 -1
- package/components/media/media-settings-labels.d.ts +1 -0
- package/components/media/media-settings-labels.js +2 -0
- package/components/media/media-upload-flow.d.ts +62 -5
- package/components/media/media-upload-flow.js +62 -24
- package/components/media/phi-area-upload-widget.d.ts +44 -1
- package/components/media/phi-area-upload-widget.js +32 -7
- package/components/media/phi-media-picker-binding.d.ts +41 -33
- package/components/media/phi-media-picker-binding.js +2 -1
- package/components/media/phi-media-upload.d.ts +10 -3
- package/components/media/phi-media-upload.js +11 -8
- package/components/media/use-media-library-add-picker.d.ts +33 -32
- package/components/overlays/phi-overlay-container-client.js +11 -9
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +7 -0
- package/components/regions/presets/phi-settings-page-shell-tree.js +3 -3
- package/components/shell/phi-icon-names.d.ts +3 -0
- package/components/shell/phi-icon-names.js +3 -0
- package/components/shell/phi-icon.d.ts +5 -7
- package/components/shell/phi-icon.js +8 -21
- package/components/shell/phi-widget-icon.js +1 -0
- package/components/tables/client/phi-table-binding-params.d.ts +24 -0
- package/components/tables/client/phi-table-binding-params.js +39 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -3
- package/components/tables/client/phi-table-binding.js +5 -9
- package/components/widgets/client/html-editor-link-node.d.ts +12 -0
- package/components/widgets/client/html-editor-link-node.js +60 -0
- package/components/widgets/client/html-editor.js +10 -6
- package/components/widgets/client/shared/phi-button-icons.d.ts +6 -4
- package/components/widgets/client/shared/phi-button-icons.js +8 -12
- package/components/widgets/client/shared/phi-collection-binding-params.d.ts +8 -0
- package/components/widgets/client/shared/phi-collection-binding-params.js +13 -0
- package/components/widgets/client/shared/phi-collection-provider.d.ts +11 -1
- package/components/widgets/client/shared/phi-collection-provider.js +5 -0
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-collection-view-binding.js +33 -26
- package/components/widgets/client/shared/phi-command-buttons.d.ts +16 -0
- package/components/widgets/client/shared/phi-command-buttons.js +9 -1
- package/components/widgets/label-sets/admin-users.d.ts +1 -0
- package/components/widgets/label-sets/admin-users.js +2 -0
- package/components/widgets/label-sets/builder-modules.js +4 -0
- package/components/widgets/label-sets/profile.d.ts +0 -16
- package/components/widgets/label-sets/profile.js +0 -37
- package/components/widgets/label-sets/registration.d.ts +0 -1
- package/components/widgets/label-sets/registration.js +0 -2
- package/components/widgets/label-sets/revisions.js +2 -0
- package/components/widgets/label-sets/signals.js +2 -0
- package/components/widgets/label-types/builder-modules.d.ts +4 -0
- package/components/widgets/label-types/builder-modules.js +2 -0
- package/components/widgets/label-types/revisions.d.ts +2 -0
- package/components/widgets/label-types/revisions.js +2 -1
- package/components/widgets/label-types/signals.d.ts +2 -0
- package/components/widgets/label-types/signals.js +1 -0
- package/components/widgets/shared/widget-failure-audience.d.ts +7 -0
- package/components/widgets/shared/widget-failure-audience.js +21 -0
- package/components/widgets/shared/widget-failure-client.js +5 -2
- package/components/widgets/shared/widget-failure-notice-client.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice-client.js +10 -0
- package/components/widgets/shared/widget-failure-notice.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice.js +17 -0
- package/components/widgets/shared/widget-failure-staff.d.ts +3 -0
- package/components/widgets/shared/widget-failure-staff.js +18 -0
- package/components/widgets/shared/widget-failure.d.ts +9 -6
- package/components/widgets/shared/widget-failure.js +0 -9
- package/components/widgets/shared/widget-failure.server.d.ts +4 -2
- package/components/widgets/shared/widget-failure.server.js +8 -3
- package/constants/cms-widget-types.d.ts +1 -0
- package/constants/cms-widget-types.js +3 -0
- package/constants/customer-file.d.ts +12 -3
- package/constants/customer-file.js +12 -3
- package/constants/runtime-module-ownership.js +5 -3
- package/constants/site-address.d.ts +9 -0
- package/constants/site-address.js +10 -0
- package/constants/table-loading.d.ts +14 -0
- package/constants/table-loading.js +14 -0
- package/constants.d.ts +2 -1
- package/constants.js +3 -1
- package/gateway/site-cms-write-validation.js +19 -3
- package/gateway/site-proxy.d.ts +12 -0
- package/gateway/site-proxy.js +20 -0
- package/helpers/announced-action.d.ts +17 -0
- package/helpers/announced-action.js +29 -0
- package/helpers/phi-metadata.d.ts +0 -8
- package/helpers/phi-metadata.js +1 -10
- package/helpers/phi-site-description.d.ts +11 -0
- package/helpers/phi-site-description.js +13 -0
- package/helpers/preset-form-check.d.ts +14 -0
- package/helpers/preset-form-check.js +12 -0
- package/helpers/preset-table-check.d.ts +19 -15
- package/helpers/preset-table-check.js +33 -39
- package/helpers/record-widget-binding.d.ts +10 -0
- package/helpers/record-widget-binding.js +35 -0
- package/helpers/record-widget.d.ts +1 -10
- package/helpers/record-widget.js +4 -33
- package/helpers/table-widget-binding.d.ts +12 -0
- package/helpers/table-widget-binding.js +296 -0
- package/helpers/tree-widget-binding.d.ts +19 -0
- package/helpers/tree-widget-binding.js +72 -0
- package/helpers/typed-confirmation.d.ts +9 -0
- package/helpers/typed-confirmation.js +13 -0
- package/helpers/widget-binding-check.d.ts +22 -0
- package/helpers/widget-binding-check.js +91 -0
- package/module-page-check.d.ts +2 -0
- package/module-page-check.js +2 -0
- package/net/phi-next-proxy.d.ts +7 -0
- package/net/phi-next-proxy.js +1 -1
- package/next/root-route.js +2 -1
- package/package.json +27 -14
- package/plugins/runtime-modules/accounting/ids.d.ts +7 -4
- package/plugins/runtime-modules/accounting/ids.js +14 -3
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +21 -9
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +29 -15
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +11 -8
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +206 -137
- package/plugins/runtime-modules/app/client-data-providers.js +1 -1
- package/plugins/runtime-modules/app/data-providers.d.ts +14 -69
- package/plugins/runtime-modules/app/data-providers.js +19 -54
- package/plugins/runtime-modules/app/definition.d.ts +8 -80
- package/plugins/runtime-modules/app/forms.d.ts +1 -16
- package/plugins/runtime-modules/app/forms.js +0 -59
- package/plugins/runtime-modules/app/ids.d.ts +2 -1
- package/plugins/runtime-modules/app/ids.js +3 -2
- package/plugins/runtime-modules/app/module.d.ts +8 -80
- package/plugins/runtime-modules/app/services/addresses-collection.d.ts +59 -0
- package/plugins/runtime-modules/app/services/{addresses-table.js → addresses-collection.js} +23 -19
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +10 -6
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +37 -73
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +0 -5
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +2 -6
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.d.ts +1 -2
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +1 -17
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +0 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.js +2 -14
- package/plugins/runtime-modules/area-contributions/admin.d.ts +1 -1
- package/plugins/runtime-modules/area-contributions/admin.js +2 -0
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
- package/plugins/runtime-modules/avatar/addresses.d.ts +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +16 -6
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -1
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -1
- package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +5 -1
- package/plugins/runtime-modules/builder/signal-wiring-options.js +9 -2
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +5 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +14 -1
- package/plugins/runtime-modules/cdn/authoring-widgets.d.ts +3 -0
- package/plugins/runtime-modules/cdn/authoring-widgets.js +7 -0
- package/plugins/runtime-modules/cdn/authoring.d.ts +1 -0
- package/plugins/runtime-modules/cdn/authoring.js +8 -0
- package/plugins/runtime-modules/cdn/bytes.d.ts +5 -0
- package/plugins/runtime-modules/cdn/bytes.js +17 -0
- package/plugins/runtime-modules/cdn/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/cdn/client-data-providers.js +9 -0
- package/plugins/runtime-modules/cdn/data-providers.d.ts +134 -0
- package/plugins/runtime-modules/cdn/data-providers.js +117 -0
- package/plugins/runtime-modules/cdn/definition.d.ts +140 -0
- package/plugins/runtime-modules/cdn/definition.js +23 -0
- package/plugins/runtime-modules/cdn/ids.d.ts +18 -0
- package/plugins/runtime-modules/cdn/ids.js +20 -0
- package/plugins/runtime-modules/cdn/module.d.ts +131 -0
- package/plugins/runtime-modules/cdn/module.js +4 -0
- package/plugins/runtime-modules/cdn/platform.d.ts +25 -0
- package/plugins/runtime-modules/cdn/platform.js +73 -0
- package/plugins/runtime-modules/cdn/presets.d.ts +2 -0
- package/plugins/runtime-modules/cdn/presets.js +20 -0
- package/plugins/runtime-modules/cdn/server.d.ts +1 -0
- package/plugins/runtime-modules/cdn/server.js +14 -0
- package/plugins/runtime-modules/cdn/services/table.d.ts +11 -0
- package/plugins/runtime-modules/cdn/services/table.js +296 -0
- package/plugins/runtime-modules/cdn/services/upload.d.ts +20 -0
- package/plugins/runtime-modules/cdn/services/upload.js +146 -0
- package/plugins/runtime-modules/cdn/table-params.d.ts +10 -0
- package/plugins/runtime-modules/cdn/table-params.js +10 -0
- package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.d.ts +95 -0
- package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.js +156 -0
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.d.ts +18 -0
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.js +479 -0
- package/plugins/runtime-modules/cdn/widgets/upload/client.d.ts +12 -0
- package/plugins/runtime-modules/cdn/widgets/upload/client.js +138 -0
- package/plugins/runtime-modules/cdn/widgets/upload/config.d.ts +29 -0
- package/plugins/runtime-modules/cdn/widgets/upload/config.js +43 -0
- package/plugins/runtime-modules/cdn/widgets/upload/label-types.d.ts +24 -0
- package/plugins/runtime-modules/cdn/widgets/upload/label-types.js +1 -0
- package/plugins/runtime-modules/cdn/widgets/upload/labels.d.ts +4 -0
- package/plugins/runtime-modules/cdn/widgets/upload/labels.js +72 -0
- package/plugins/runtime-modules/cdn/widgets/upload/plugin.d.ts +3 -0
- package/plugins/runtime-modules/cdn/widgets/upload/plugin.js +7 -0
- package/plugins/runtime-modules/cdn/widgets/upload/server.d.ts +8 -0
- package/plugins/runtime-modules/cdn/widgets/upload/server.js +17 -0
- package/plugins/runtime-modules/cdn/widgets.d.ts +2 -0
- package/plugins/runtime-modules/cdn/widgets.js +13 -0
- package/plugins/runtime-modules/client-authoring-providers/admin.d.ts +1 -1
- package/plugins/runtime-modules/client-authoring-providers/admin.js +6 -0
- package/plugins/runtime-modules/client-manifests/admin.js +11 -1
- package/plugins/runtime-modules/client-manifests/common.js +6 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +5 -2
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.d.ts +55 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +175 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.d.ts +48 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.js +67 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.js +14 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +2 -6
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +36 -52
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.js +6 -1
- package/plugins/runtime-modules/core/widgets/thread-widget-config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/thread-widget-config.js +6 -0
- package/plugins/runtime-modules/core/widgets/tree/client.js +6 -6
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.d.ts +2 -0
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.js +2 -0
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +5 -0
- package/plugins/runtime-modules/revisions/controller/binding.d.ts +37 -0
- package/plugins/runtime-modules/revisions/controller/binding.js +75 -0
- package/plugins/runtime-modules/revisions/controller/client.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/client.js +74 -50
- package/plugins/runtime-modules/revisions/controller/definition.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/definition.js +10 -0
- package/plugins/runtime-modules/revisions/forms.js +1 -1
- package/plugins/runtime-modules/revisions/page-ids.d.ts +1 -1
- package/plugins/runtime-modules/revisions/page-ids.js +4 -1
- package/plugins/runtime-modules/revisions/services/options.js +14 -4
- package/plugins/runtime-modules/revisions/services/table.js +41 -21
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +76 -3
- package/plugins/runtime-modules/theme/controller/runtime.js +14 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +39 -13
- package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
- package/plugins/runtime-modules/threads/controller/client.js +62 -2
- package/plugins/runtime-modules/threads/controller/definition.js +48 -0
- package/plugins/runtime-modules/threads/data-providers.d.ts +22 -37
- package/plugins/runtime-modules/threads/data-providers.js +35 -24
- package/plugins/runtime-modules/threads/definition.d.ts +22 -37
- package/plugins/runtime-modules/threads/ids.d.ts +2 -0
- package/plugins/runtime-modules/threads/ids.js +2 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.d.ts +30 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.js +59 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.d.ts +22 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.js +101 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +14 -80
- package/plugins/runtime-modules/threads/services/customer-file-table.js +27 -112
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +4 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +4 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +15 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -0
- package/server-helpers/runtime.js +0 -1
- package/styles/controls.css +4 -2
- package/styles/layout.css +7 -0
- package/theme/phi-antd-token-resolver.d.ts +8 -0
- package/theme/phi-antd-token-resolver.js +10 -0
- package/theme/phi-theme-color.d.ts +19 -0
- package/theme/phi-theme-color.js +42 -0
- package/theme/phi-theme-gradients.js +4 -22
- package/theme/phi-theme-palette-defaults.d.ts +16 -0
- package/theme/phi-theme-palette-defaults.js +103 -0
- package/types/cms-plugins.d.ts +6 -1
- package/types/collection-provider.d.ts +27 -0
- package/types/collection-signal-values.d.ts +2 -0
- package/types/collection-signal-values.js +23 -0
- package/types/collection-view-widget.d.ts +9 -0
- package/types/core-widget-placements.d.ts +6 -0
- package/types/signals.d.ts +2 -0
- package/types/signals.js +2 -0
- package/types/table-widget.d.ts +17 -3
- package/types/table-widget.js +0 -282
- package/types/tree-widget.d.ts +0 -1
- package/types/tree-widget.js +0 -60
- package/types/widget-runtime.d.ts +0 -1
- package/types.d.ts +1 -1
- package/types.js +1 -1
- package/plugins/runtime-modules/app/services/addresses-table.d.ts +0 -135
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import { createPhiPresetCmsInstanceIdMap } from "../../../../types/cms-instance-id";
|
|
2
|
+
import { PHI_CDN_ADMIN_PAGE_PRESET_KEY, PHI_CDN_RUNTIME_DATA_PROVIDER_KEYS, PHI_CDN_RUNTIME_MODULE_ID, PHI_CDN_TABLE_RESOURCE_KEYS, } from "../ids";
|
|
3
|
+
import { PHI_CMS_DEFAULT_SLOT_INDEX } from "../../../../constants/cms-layout-types";
|
|
4
|
+
import { PhiCmsFlags, PhiCmsPageType } from "../../../../constants/phi-cms";
|
|
5
|
+
import { createPhiCmsPresetNodes } from "../../../../helpers/cms-preset-nodes";
|
|
6
|
+
import { buildPhiBasePageContentScaffold, PHI_BASE_PAGE_LAYOUT_NODE_ID } from "../../../../components/regions/presets/phi-base-page-layout";
|
|
7
|
+
import { createPhiSignalAddress, PHI_SIGNAL_VALUE_SCHEMAS } from "../../../../types/signals";
|
|
8
|
+
import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_WIDTH_SINGLE_COLUMN } from "../../../../helpers/cms-dialog";
|
|
9
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
10
|
+
import { getPhiAdminCdnPageLabels } from "./admin-cdn-label-set";
|
|
11
|
+
import { getPhiCdnUploadWidgetLabels } from "../widgets/upload/labels";
|
|
12
|
+
import { PHI_CDN_TABLE_PARAM_KEYS } from "../table-params";
|
|
13
|
+
const SYNTHETIC_ADMIN_CDN_REGION_IDS = {
|
|
14
|
+
regionContent: -443,
|
|
15
|
+
};
|
|
16
|
+
const PRESET = {
|
|
17
|
+
domain: "page",
|
|
18
|
+
ownerModuleId: PHI_CDN_RUNTIME_MODULE_ID,
|
|
19
|
+
presetKey: PHI_CDN_ADMIN_PAGE_PRESET_KEY,
|
|
20
|
+
};
|
|
21
|
+
const LAYOUT_IDS = createPhiPresetCmsInstanceIdMap(PRESET, ["layoutDetail", "layoutUpload", "layoutCheck"]);
|
|
22
|
+
const OVERLAY_IDS = createPhiPresetCmsInstanceIdMap(PRESET, ["overlayDetail", "overlayUpload", "overlayCheck"]);
|
|
23
|
+
const WIDGET_IDS = createPhiPresetCmsInstanceIdMap(PRESET, ["widgetTable", "widgetDetail", "widgetUpload", "widgetCheck"]);
|
|
24
|
+
/** The Table's announcement of one of its actions, to one receiver that decides by the action's key. */
|
|
25
|
+
function tableActionRoute(routeKey, receiverId) {
|
|
26
|
+
return {
|
|
27
|
+
routeKey,
|
|
28
|
+
capabilityId: "actionActivate",
|
|
29
|
+
scope: "page",
|
|
30
|
+
channel: "action",
|
|
31
|
+
action: "activate",
|
|
32
|
+
valueType: "json",
|
|
33
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction,
|
|
34
|
+
receiver: createPhiSignalAddress("cms", receiverId),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The Admin page `CDN`: the catalogue as one Table, and three dialogs its actions open.
|
|
39
|
+
*
|
|
40
|
+
* - Upload (toolbar): the Module's upload Widget, which tells the Table to read again once a file is
|
|
41
|
+
* published.
|
|
42
|
+
* - Check (toolbar): a second Table on the same Provider, the `check` resource, which runs the check when
|
|
43
|
+
* the dialog opens (`remount`) and adopts what it can, row by row.
|
|
44
|
+
* - Details (row): the `record` Widget on the row, with the addresses in full.
|
|
45
|
+
*
|
|
46
|
+
* Copy address, Withdraw and Delete are the Provider's row actions; the two that change anything ask
|
|
47
|
+
* first. What any of them may do is Core's to decide, and Core refuses what a reader may not.
|
|
48
|
+
*/
|
|
49
|
+
export async function buildPhiDefaultAdminCdnPageTree({ page, runtime, }) {
|
|
50
|
+
const translator = buildPhiWidgetLabelTranslatorOptions(runtime);
|
|
51
|
+
const [labels, uploadLabels] = await Promise.all([
|
|
52
|
+
getPhiAdminCdnPageLabels(translator),
|
|
53
|
+
getPhiCdnUploadWidgetLabels(translator),
|
|
54
|
+
]);
|
|
55
|
+
const tableAddress = createPhiSignalAddress("cms", WIDGET_IDS.widgetTable);
|
|
56
|
+
const platformNames = { ...uploadLabels.osNames, ...uploadLabels.archNames };
|
|
57
|
+
const stateColors = { offered: "success", withdrawn: "warning", deleted: "error" };
|
|
58
|
+
const storageColors = { cdn: "default", link: "processing" };
|
|
59
|
+
const originNames = { cli: labels.origins.cli, upload: labels.origins.upload, addon: labels.origins.addon };
|
|
60
|
+
const source = {
|
|
61
|
+
providerKey: PHI_CDN_RUNTIME_DATA_PROVIDER_KEYS.table,
|
|
62
|
+
resourceKey: PHI_CDN_TABLE_RESOURCE_KEYS.files,
|
|
63
|
+
params: {
|
|
64
|
+
[PHI_CDN_TABLE_PARAM_KEYS.noCdnText]: labels.noCdn,
|
|
65
|
+
[PHI_CDN_TABLE_PARAM_KEYS.copiedText]: labels.copied,
|
|
66
|
+
[PHI_CDN_TABLE_PARAM_KEYS.copyFailedText]: labels.copyFailed,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
const scaffold = buildPhiBasePageContentScaffold({
|
|
70
|
+
page,
|
|
71
|
+
regionId: SYNTHETIC_ADMIN_CDN_REGION_IDS.regionContent,
|
|
72
|
+
});
|
|
73
|
+
const nodes = createPhiCmsPresetNodes(page);
|
|
74
|
+
const upload = nodes.dialog({
|
|
75
|
+
id: OVERLAY_IDS.overlayUpload,
|
|
76
|
+
bodyLayoutNodeId: LAYOUT_IDS.layoutUpload,
|
|
77
|
+
sortOrder: 1,
|
|
78
|
+
label: "cdn upload modal",
|
|
79
|
+
body: { label: "cdn upload modal content" },
|
|
80
|
+
config: {
|
|
81
|
+
title: labels.uploadTitle,
|
|
82
|
+
size: { width: PHI_DIALOG_WIDTH_SINGLE_COLUMN },
|
|
83
|
+
// Closed, the upload stops and its session stays open: the same file picked again resumes it.
|
|
84
|
+
mountPolicy: "remount",
|
|
85
|
+
openActionKey: "upload",
|
|
86
|
+
signalRoutes: { listens: [{
|
|
87
|
+
routeKey: "admin-cdn-upload-modal-open",
|
|
88
|
+
capabilityId: "open",
|
|
89
|
+
scope: "page",
|
|
90
|
+
channel: "action",
|
|
91
|
+
action: "activate",
|
|
92
|
+
valueType: "json",
|
|
93
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction,
|
|
94
|
+
receiver: createPhiSignalAddress("cms", OVERLAY_IDS.overlayUpload),
|
|
95
|
+
}] },
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
const check = nodes.dialog({
|
|
99
|
+
id: OVERLAY_IDS.overlayCheck,
|
|
100
|
+
bodyLayoutNodeId: LAYOUT_IDS.layoutCheck,
|
|
101
|
+
sortOrder: 2,
|
|
102
|
+
label: "cdn check modal",
|
|
103
|
+
body: { label: "cdn check modal content" },
|
|
104
|
+
config: {
|
|
105
|
+
title: labels.check.title,
|
|
106
|
+
size: { width: 980 },
|
|
107
|
+
maxSize: { width: "90vw" },
|
|
108
|
+
// Every opening is a new check: the bucket is read when the Table in it mounts.
|
|
109
|
+
mountPolicy: "remount",
|
|
110
|
+
openActionKey: "check",
|
|
111
|
+
signalRoutes: { listens: [{
|
|
112
|
+
routeKey: "admin-cdn-check-modal-open",
|
|
113
|
+
capabilityId: "open",
|
|
114
|
+
scope: "page",
|
|
115
|
+
channel: "action",
|
|
116
|
+
action: "activate",
|
|
117
|
+
valueType: "json",
|
|
118
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction,
|
|
119
|
+
receiver: createPhiSignalAddress("cms", OVERLAY_IDS.overlayCheck),
|
|
120
|
+
}] },
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
page: nodes.page({ pageType: PhiCmsPageType.Standard }),
|
|
125
|
+
pageMeta: {
|
|
126
|
+
title: { msgId: 0, source: "CDN", value: labels.pageTitle },
|
|
127
|
+
description: {
|
|
128
|
+
msgId: 0,
|
|
129
|
+
source: "Files published once under the Site's name and served from its CDN host.",
|
|
130
|
+
value: labels.pageDescription,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
overlays: [
|
|
134
|
+
nodes.overlay({
|
|
135
|
+
id: OVERLAY_IDS.overlayDetail,
|
|
136
|
+
overlayType: "modal",
|
|
137
|
+
bodyLayoutNodeId: LAYOUT_IDS.layoutDetail,
|
|
138
|
+
sortOrder: 0,
|
|
139
|
+
label: "cdn file detail modal",
|
|
140
|
+
config: {
|
|
141
|
+
title: labels.detail.title,
|
|
142
|
+
size: { width: 960 },
|
|
143
|
+
mountPolicy: "lazy-keep",
|
|
144
|
+
openActionKey: "view",
|
|
145
|
+
signalRoutes: {
|
|
146
|
+
emits: [{
|
|
147
|
+
routeKey: "admin-cdn-detail-modal-open-change",
|
|
148
|
+
capabilityId: "openChange",
|
|
149
|
+
scope: "page",
|
|
150
|
+
channel: "state",
|
|
151
|
+
action: "change",
|
|
152
|
+
valueType: "boolean",
|
|
153
|
+
receiver: createPhiSignalAddress("cms", WIDGET_IDS.widgetDetail),
|
|
154
|
+
}],
|
|
155
|
+
listens: [{
|
|
156
|
+
routeKey: "admin-cdn-detail-modal-open",
|
|
157
|
+
capabilityId: "open",
|
|
158
|
+
scope: "page",
|
|
159
|
+
channel: "action",
|
|
160
|
+
action: "activate",
|
|
161
|
+
valueType: "json",
|
|
162
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction,
|
|
163
|
+
receiver: createPhiSignalAddress("cms", OVERLAY_IDS.overlayDetail),
|
|
164
|
+
}],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
}),
|
|
168
|
+
upload.overlay,
|
|
169
|
+
check.overlay,
|
|
170
|
+
],
|
|
171
|
+
regions: [scaffold.region],
|
|
172
|
+
layoutNodes: [
|
|
173
|
+
scaffold.layoutNode,
|
|
174
|
+
nodes.layout({
|
|
175
|
+
id: LAYOUT_IDS.layoutDetail,
|
|
176
|
+
parentLayoutNodeId: null,
|
|
177
|
+
creationPreset: { layoutKind: "verticalflex", preset: "panel" },
|
|
178
|
+
typeKey: "flex-vertical",
|
|
179
|
+
slotIndex: PHI_CMS_DEFAULT_SLOT_INDEX,
|
|
180
|
+
sortOrder: 0,
|
|
181
|
+
label: "cdn file detail modal content",
|
|
182
|
+
config: {
|
|
183
|
+
...PHI_DIALOG_BODY_CONFIG,
|
|
184
|
+
anchor: { horizontal: "left", vertical: "top" },
|
|
185
|
+
},
|
|
186
|
+
}),
|
|
187
|
+
...upload.layouts,
|
|
188
|
+
...check.layouts,
|
|
189
|
+
],
|
|
190
|
+
contentWidgets: [
|
|
191
|
+
nodes.widget({
|
|
192
|
+
id: WIDGET_IDS.widgetTable,
|
|
193
|
+
parentLayoutNodeId: PHI_BASE_PAGE_LAYOUT_NODE_ID,
|
|
194
|
+
typeKey: "table",
|
|
195
|
+
slotIndex: PHI_CMS_DEFAULT_SLOT_INDEX,
|
|
196
|
+
sortOrder: 0,
|
|
197
|
+
// The Module's Label Set, translated already.
|
|
198
|
+
flags: PhiCmsFlags.NoTranslate,
|
|
199
|
+
label: labels.tableLabel,
|
|
200
|
+
config: {
|
|
201
|
+
source,
|
|
202
|
+
presentation: {
|
|
203
|
+
// Fixed, so a long file name and the checksum are cut to their columns and said whole on hover.
|
|
204
|
+
layout: { mode: "fixed", overflowX: "auto" },
|
|
205
|
+
columns: [
|
|
206
|
+
{ key: "name", fieldKey: "name", title: labels.columns.name, sortable: true, ellipsis: true, sizing: { mode: "fixed", width: 140 }, sticky: "left" },
|
|
207
|
+
{ key: "version", fieldKey: "version", title: labels.columns.version, ellipsis: true, sizing: { mode: "fixed", width: 110 } },
|
|
208
|
+
{ key: "fileName", fieldKey: "fileName", title: labels.columns.file, ellipsis: true, sizing: { mode: "fill", minWidth: 200 } },
|
|
209
|
+
{ key: "size", fieldKey: "sizeLabel", title: labels.columns.size, align: "right", sizing: { mode: "fixed", width: 96 } },
|
|
210
|
+
{
|
|
211
|
+
key: "storage",
|
|
212
|
+
fieldKey: "storage",
|
|
213
|
+
title: labels.columns.storage,
|
|
214
|
+
description: labels.columns.storageHint,
|
|
215
|
+
renderer: "badge",
|
|
216
|
+
valueMap: labels.storage,
|
|
217
|
+
tagColorMap: storageColors,
|
|
218
|
+
sizing: { mode: "fixed", width: 96 },
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
key: "platform",
|
|
222
|
+
fieldKey: "platform",
|
|
223
|
+
title: labels.columns.platform,
|
|
224
|
+
renderer: "tags",
|
|
225
|
+
valueMap: platformNames,
|
|
226
|
+
sizing: { mode: "fixed", width: 160 },
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
// Cut to the column's width; the cell holds the whole checksum, so copying it copies all of it.
|
|
230
|
+
key: "sha256",
|
|
231
|
+
fieldKey: "sha256",
|
|
232
|
+
title: labels.columns.sha256,
|
|
233
|
+
description: labels.columns.sha256Hint,
|
|
234
|
+
renderer: "code",
|
|
235
|
+
ellipsis: true,
|
|
236
|
+
sizing: { mode: "fixed", width: 120 },
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
key: "state",
|
|
240
|
+
fieldKey: "state",
|
|
241
|
+
title: labels.columns.state,
|
|
242
|
+
renderer: "badge",
|
|
243
|
+
valueMap: labels.states,
|
|
244
|
+
tagColorMap: stateColors,
|
|
245
|
+
sizing: { mode: "fixed", width: 116 },
|
|
246
|
+
},
|
|
247
|
+
{ key: "origin", fieldKey: "origin", title: labels.columns.origin, valueMap: originNames, ellipsis: true, sizing: { mode: "fixed", width: 140 } },
|
|
248
|
+
{ key: "publishedAt", fieldKey: "publishedAt", title: labels.columns.published, renderer: "datetime", sortable: true, sizing: { mode: "fixed", width: 180 } },
|
|
249
|
+
],
|
|
250
|
+
emptyState: { title: labels.emptyTitle, description: labels.emptyText },
|
|
251
|
+
footer: {
|
|
252
|
+
template: labels.footer,
|
|
253
|
+
values: [
|
|
254
|
+
{ key: "rows", value: { source: "core", fieldKey: "pageRows" } },
|
|
255
|
+
{ key: "total", value: { source: "core", fieldKey: "totalRows" } },
|
|
256
|
+
],
|
|
257
|
+
},
|
|
258
|
+
controlSize: "small",
|
|
259
|
+
},
|
|
260
|
+
features: {
|
|
261
|
+
search: { enabled: true, placeholder: labels.searchPlaceholder, debounceMs: 250 },
|
|
262
|
+
filters: [{
|
|
263
|
+
key: "state",
|
|
264
|
+
type: "select",
|
|
265
|
+
label: labels.filterState,
|
|
266
|
+
defaultValue: "offered",
|
|
267
|
+
options: [
|
|
268
|
+
{ value: "offered", label: labels.states.offered },
|
|
269
|
+
{ value: "withdrawn", label: labels.states.withdrawn },
|
|
270
|
+
{ value: "deleted", label: labels.states.deleted },
|
|
271
|
+
{ value: "all", label: labels.filterStateAll },
|
|
272
|
+
],
|
|
273
|
+
}],
|
|
274
|
+
pagination: { enabled: true, pageSize: 50, pageSizes: [50, 100, 200] },
|
|
275
|
+
sorting: { mode: "single", defaultSorts: [{ key: "publishedAt", direction: "descending" }] },
|
|
276
|
+
tools: { mode: "self-contained", reload: true },
|
|
277
|
+
actions: {
|
|
278
|
+
toolbar: [
|
|
279
|
+
{ key: "upload", label: labels.actions.upload, icon: "upload", display: "icon", mode: "primary", execution: "signal" },
|
|
280
|
+
{ key: "check", label: labels.actions.check, icon: "safety-certificate", display: "icon", execution: "signal" },
|
|
281
|
+
],
|
|
282
|
+
row: [
|
|
283
|
+
{ key: "view", label: labels.actions.view, icon: "eye", display: "icon", execution: "signal" },
|
|
284
|
+
{ key: "copy-url", label: labels.actions.copy, icon: "copy", display: "icon", execution: "provider" },
|
|
285
|
+
{
|
|
286
|
+
key: "withdraw",
|
|
287
|
+
label: labels.actions.withdraw,
|
|
288
|
+
icon: "stop",
|
|
289
|
+
display: "icon",
|
|
290
|
+
mode: "danger",
|
|
291
|
+
execution: "provider",
|
|
292
|
+
confirm: {
|
|
293
|
+
title: labels.withdraw.title,
|
|
294
|
+
description: labels.withdraw.text,
|
|
295
|
+
okText: labels.withdraw.ok,
|
|
296
|
+
cancelText: labels.confirmCancel,
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
key: "delete",
|
|
301
|
+
label: labels.actions.delete,
|
|
302
|
+
icon: "delete",
|
|
303
|
+
display: "icon",
|
|
304
|
+
mode: "danger",
|
|
305
|
+
execution: "provider",
|
|
306
|
+
confirm: {
|
|
307
|
+
title: labels.delete.title,
|
|
308
|
+
description: labels.delete.text,
|
|
309
|
+
alert: { level: "info", title: labels.delete.linkNote },
|
|
310
|
+
okText: labels.delete.ok,
|
|
311
|
+
cancelText: labels.confirmCancel,
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
signalRoutes: {
|
|
318
|
+
/*
|
|
319
|
+
* One announcement, five listeners: each dialog decides by its `openActionKey`, the record by
|
|
320
|
+
* its own. Copy, Withdraw and Delete are the Provider's and go to nobody.
|
|
321
|
+
*/
|
|
322
|
+
emits: [
|
|
323
|
+
tableActionRoute("admin-cdn-table-view-detail", WIDGET_IDS.widgetDetail),
|
|
324
|
+
tableActionRoute("admin-cdn-table-open-detail", OVERLAY_IDS.overlayDetail),
|
|
325
|
+
tableActionRoute("admin-cdn-table-open-upload", OVERLAY_IDS.overlayUpload),
|
|
326
|
+
tableActionRoute("admin-cdn-table-open-check", OVERLAY_IDS.overlayCheck),
|
|
327
|
+
],
|
|
328
|
+
listens: [{
|
|
329
|
+
routeKey: "admin-cdn-table-reload",
|
|
330
|
+
capabilityId: "reload",
|
|
331
|
+
scope: "page",
|
|
332
|
+
channel: "reload",
|
|
333
|
+
action: "activate",
|
|
334
|
+
valueType: "none",
|
|
335
|
+
receiver: tableAddress,
|
|
336
|
+
}],
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
}),
|
|
340
|
+
nodes.widget({
|
|
341
|
+
id: WIDGET_IDS.widgetDetail,
|
|
342
|
+
parentLayoutNodeId: LAYOUT_IDS.layoutDetail,
|
|
343
|
+
typeKey: "record",
|
|
344
|
+
slotIndex: PHI_CMS_DEFAULT_SLOT_INDEX,
|
|
345
|
+
sortOrder: 0,
|
|
346
|
+
flags: PhiCmsFlags.NoTranslate,
|
|
347
|
+
label: "cdn file record",
|
|
348
|
+
config: {
|
|
349
|
+
source: { ...source },
|
|
350
|
+
openActionKey: "view",
|
|
351
|
+
presentation: {
|
|
352
|
+
appearance: "grid",
|
|
353
|
+
columns: 2,
|
|
354
|
+
fields: [
|
|
355
|
+
{ key: "key", fieldKey: "key", label: labels.detail.key, renderer: "code", full: true },
|
|
356
|
+
{ key: "name", fieldKey: "name", label: labels.columns.name },
|
|
357
|
+
{ key: "version", fieldKey: "version", label: labels.columns.version },
|
|
358
|
+
{ key: "fileName", fieldKey: "fileName", label: labels.columns.file },
|
|
359
|
+
{ key: "size", fieldKey: "sizeLabel", label: labels.columns.size },
|
|
360
|
+
{ key: "sizeBytes", fieldKey: "sizeBytes", label: labels.detail.sizeBytes },
|
|
361
|
+
{ key: "contentType", fieldKey: "contentType", label: labels.detail.contentType, renderer: "code" },
|
|
362
|
+
{ key: "storage", fieldKey: "storage", label: labels.columns.storage, renderer: "badge", valueMap: labels.storage, tagColorMap: storageColors },
|
|
363
|
+
{ key: "platform", fieldKey: "platform", label: labels.columns.platform, renderer: "tags", valueMap: platformNames },
|
|
364
|
+
{ key: "state", fieldKey: "state", label: labels.columns.state, renderer: "badge", valueMap: labels.states, tagColorMap: stateColors },
|
|
365
|
+
{ key: "publishedAt", fieldKey: "publishedAt", label: labels.columns.published, renderer: "datetime" },
|
|
366
|
+
{ key: "origin", fieldKey: "origin", label: labels.columns.origin, valueMap: originNames },
|
|
367
|
+
{ key: "addonId", fieldKey: "addonId", label: labels.detail.addon },
|
|
368
|
+
{ key: "actorUserId", fieldKey: "actorUserId", label: labels.detail.actor },
|
|
369
|
+
{ key: "sha256", fieldKey: "sha256", label: labels.columns.sha256, renderer: "code", full: true },
|
|
370
|
+
{ key: "url", fieldKey: "url", label: labels.detail.url, renderer: "link", full: true },
|
|
371
|
+
{ key: "sourceUrl", fieldKey: "sourceUrl", label: labels.detail.sourceUrl, renderer: "link", full: true },
|
|
372
|
+
],
|
|
373
|
+
},
|
|
374
|
+
signalRoutes: {
|
|
375
|
+
listens: [{
|
|
376
|
+
routeKey: "admin-cdn-detail-record-open",
|
|
377
|
+
capabilityId: "recordOpen",
|
|
378
|
+
scope: "page",
|
|
379
|
+
channel: "action",
|
|
380
|
+
action: "activate",
|
|
381
|
+
valueType: "json",
|
|
382
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction,
|
|
383
|
+
receiver: createPhiSignalAddress("cms", WIDGET_IDS.widgetDetail),
|
|
384
|
+
}, {
|
|
385
|
+
routeKey: "admin-cdn-detail-modal-closed",
|
|
386
|
+
capabilityId: "close",
|
|
387
|
+
scope: "page",
|
|
388
|
+
channel: "state",
|
|
389
|
+
action: "change",
|
|
390
|
+
valueType: "boolean",
|
|
391
|
+
receiver: createPhiSignalAddress("cms", WIDGET_IDS.widgetDetail),
|
|
392
|
+
}],
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
}),
|
|
396
|
+
nodes.widget({
|
|
397
|
+
id: WIDGET_IDS.widgetUpload,
|
|
398
|
+
parentLayoutNodeId: LAYOUT_IDS.layoutUpload,
|
|
399
|
+
typeKey: "cdn-upload",
|
|
400
|
+
slotIndex: PHI_CMS_DEFAULT_SLOT_INDEX,
|
|
401
|
+
sortOrder: 0,
|
|
402
|
+
label: "cdn upload",
|
|
403
|
+
config: {
|
|
404
|
+
signalRoutes: {
|
|
405
|
+
// A published file is a new row: the listing reads itself again.
|
|
406
|
+
emits: [{
|
|
407
|
+
routeKey: "admin-cdn-upload-published",
|
|
408
|
+
capabilityId: "uploaded",
|
|
409
|
+
scope: "page",
|
|
410
|
+
channel: "reload",
|
|
411
|
+
action: "activate",
|
|
412
|
+
valueType: "none",
|
|
413
|
+
receiver: tableAddress,
|
|
414
|
+
}],
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
}),
|
|
418
|
+
nodes.widget({
|
|
419
|
+
id: WIDGET_IDS.widgetCheck,
|
|
420
|
+
parentLayoutNodeId: LAYOUT_IDS.layoutCheck,
|
|
421
|
+
typeKey: "table",
|
|
422
|
+
slotIndex: PHI_CMS_DEFAULT_SLOT_INDEX,
|
|
423
|
+
sortOrder: 0,
|
|
424
|
+
flags: PhiCmsFlags.NoTranslate,
|
|
425
|
+
label: labels.check.tableLabel,
|
|
426
|
+
config: {
|
|
427
|
+
source: {
|
|
428
|
+
providerKey: PHI_CDN_RUNTIME_DATA_PROVIDER_KEYS.table,
|
|
429
|
+
resourceKey: PHI_CDN_TABLE_RESOURCE_KEYS.check,
|
|
430
|
+
params: { [PHI_CDN_TABLE_PARAM_KEYS.noCdnText]: labels.noCdn },
|
|
431
|
+
},
|
|
432
|
+
presentation: {
|
|
433
|
+
layout: { mode: "auto", overflowX: "auto" },
|
|
434
|
+
columns: [
|
|
435
|
+
{ key: "key", fieldKey: "key", title: labels.check.columns.key, renderer: "code", sizing: { mode: "fill", minWidth: 240 } },
|
|
436
|
+
{
|
|
437
|
+
key: "finding",
|
|
438
|
+
fieldKey: "finding",
|
|
439
|
+
title: labels.check.columns.finding,
|
|
440
|
+
renderer: "badge",
|
|
441
|
+
valueMap: labels.check.findings,
|
|
442
|
+
tagColorMap: { unrecorded: "warning", missing: "error", "size-mismatch": "error" },
|
|
443
|
+
sizing: { mode: "content" },
|
|
444
|
+
},
|
|
445
|
+
{ key: "size", fieldKey: "sizeLabel", title: labels.check.columns.size, align: "right", sizing: { mode: "content" } },
|
|
446
|
+
{ key: "recorded", fieldKey: "recordedLabel", title: labels.check.columns.recorded, align: "right", sizing: { mode: "content" } },
|
|
447
|
+
{ key: "reason", fieldKey: "reason", title: labels.check.columns.reason, sizing: { mode: "fill", minWidth: 160 } },
|
|
448
|
+
],
|
|
449
|
+
emptyState: { title: labels.check.empty },
|
|
450
|
+
footer: {
|
|
451
|
+
template: labels.check.footer,
|
|
452
|
+
values: [
|
|
453
|
+
{ key: "objects", value: { source: "provider", fieldKey: "objects" } },
|
|
454
|
+
{ key: "recorded", value: { source: "provider", fieldKey: "recorded" } },
|
|
455
|
+
],
|
|
456
|
+
variants: [{
|
|
457
|
+
when: { value: { source: "provider", fieldKey: "consistent" }, operator: "truthy" },
|
|
458
|
+
template: labels.check.footerConsistent,
|
|
459
|
+
values: [
|
|
460
|
+
{ key: "objects", value: { source: "provider", fieldKey: "objects" } },
|
|
461
|
+
{ key: "recorded", value: { source: "provider", fieldKey: "recorded" } },
|
|
462
|
+
],
|
|
463
|
+
}],
|
|
464
|
+
},
|
|
465
|
+
controlSize: "small",
|
|
466
|
+
},
|
|
467
|
+
features: {
|
|
468
|
+
pagination: { enabled: false },
|
|
469
|
+
sorting: { mode: "none" },
|
|
470
|
+
tools: { mode: "self-contained", reload: true },
|
|
471
|
+
actions: {
|
|
472
|
+
row: [{ key: "adopt", label: labels.actions.adopt, icon: "plus", display: "icon-label", execution: "provider" }],
|
|
473
|
+
},
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
}),
|
|
477
|
+
],
|
|
478
|
+
};
|
|
479
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PhiAreaUploadWidgetLabels } from "../../../../../components/media/media-widget-labels";
|
|
2
|
+
import type { PhiCdnUploadWidgetConfig } from "./config";
|
|
3
|
+
import type { PhiCdnUploadWidgetLabels } from "./label-types";
|
|
4
|
+
/** What is wrong with one segment as the person typed it, before Core is asked; null where nothing is. */
|
|
5
|
+
export declare function readPhiCdnSegmentProblem(value: string, kind: "name" | "version" | "fileName", labels: Pick<PhiCdnUploadWidgetLabels, "required" | "invalidSegment" | "invalidVersion" | "reservedName">): string | null;
|
|
6
|
+
export type PhiCdnUploadWidgetClientProps = {
|
|
7
|
+
config?: PhiCdnUploadWidgetConfig;
|
|
8
|
+
labels: PhiCdnUploadWidgetLabels;
|
|
9
|
+
/** The Media upload surface's own words. */
|
|
10
|
+
uploadLabels: PhiAreaUploadWidgetLabels;
|
|
11
|
+
};
|
|
12
|
+
export declare function PhiCdnUploadWidgetClient({ config, labels, uploadLabels }: PhiCdnUploadWidgetClientProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { PHIS_CDN_KEY_SEGMENT_PATTERN, PHIS_CDN_KEY_VERSION_PATTERN, } from "@phis/contracts/addon";
|
|
5
|
+
import { PhiCheckboxGroupControl } from "../../../../../components/controls/phi-checkbox-group-control";
|
|
6
|
+
import { PhiFlexControl } from "../../../../../components/controls/phi-flex-control";
|
|
7
|
+
import { PhiLabeledControl } from "../../../../../components/controls/phi-labeled-control";
|
|
8
|
+
import { PhiSelectControl } from "../../../../../components/controls/phi-select-control";
|
|
9
|
+
import { PhiTextControl } from "../../../../../components/controls/phi-text-control";
|
|
10
|
+
import { PhiAreaUploadBinding, } from "../../../../../components/media/phi-area-upload-widget";
|
|
11
|
+
import { PhiMediaUploadError, runPhiUploadSession, } from "../../../../../components/media/media-upload-flow";
|
|
12
|
+
import { emitPhiSignalCapability, usePhiSignalEmitter, } from "../../../../../components/runtime/runtime-signal-identity";
|
|
13
|
+
import { PHI_CDN_ARCH_KEYS, PHI_CDN_OS_KEYS, guessPhiCdnPlatform, readPhiCdnArchKeys, readPhiCdnOsKeys, writePhiCdnArchBits, writePhiCdnOsBits, } from "../../platform";
|
|
14
|
+
import { PHI_CDN_UPLOAD_DISCARD, createPhiCdnUploadTarget, loadPhiCdnNames, } from "../../services/upload";
|
|
15
|
+
const EMPTY_DRAFT = { name: "", version: "", fileName: "", os: [], arch: [] };
|
|
16
|
+
/** The three text fields as wide as the dialog, the label beside each (`PhiLabeledControl`'s `fill`). */
|
|
17
|
+
const FIELD_STYLE = { width: "100%" };
|
|
18
|
+
/*
|
|
19
|
+
* What a file was last started with, remembered in this browser by the file's name, size and date, so
|
|
20
|
+
* picking the same file after a reload fills the fields it was started with -- the same key, size and
|
|
21
|
+
* digests are what make Core answer with the open session and its parts. A convenience of this browser
|
|
22
|
+
* only; without storage the fields start from the file name as usual.
|
|
23
|
+
*/
|
|
24
|
+
const DRAFT_STORAGE_KEY = "phi-cdn-upload-drafts";
|
|
25
|
+
function fileIdentity(file) {
|
|
26
|
+
return `${file.name}:${file.size}:${file.lastModified}`;
|
|
27
|
+
}
|
|
28
|
+
function readStoredDraft(file) {
|
|
29
|
+
try {
|
|
30
|
+
const stored = JSON.parse(window.localStorage.getItem(DRAFT_STORAGE_KEY) ?? "{}");
|
|
31
|
+
return stored[fileIdentity(file)] ?? null;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function storeDraft(file, draft) {
|
|
38
|
+
try {
|
|
39
|
+
const stored = JSON.parse(window.localStorage.getItem(DRAFT_STORAGE_KEY) ?? "{}");
|
|
40
|
+
if (draft)
|
|
41
|
+
stored[fileIdentity(file)] = draft;
|
|
42
|
+
else
|
|
43
|
+
delete stored[fileIdentity(file)];
|
|
44
|
+
window.localStorage.setItem(DRAFT_STORAGE_KEY, JSON.stringify(stored));
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Storage refused: nothing is remembered, and the upload is not affected.
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function draftFromFile(file, name) {
|
|
51
|
+
const platform = guessPhiCdnPlatform(file.name);
|
|
52
|
+
return {
|
|
53
|
+
name,
|
|
54
|
+
version: "",
|
|
55
|
+
fileName: file.name,
|
|
56
|
+
os: readPhiCdnOsKeys(platform.os),
|
|
57
|
+
arch: readPhiCdnArchKeys(platform.arch),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** What is wrong with one segment as the person typed it, before Core is asked; null where nothing is. */
|
|
61
|
+
export function readPhiCdnSegmentProblem(value, kind, labels) {
|
|
62
|
+
const trimmed = value.trim();
|
|
63
|
+
if (!trimmed)
|
|
64
|
+
return labels.required;
|
|
65
|
+
if (kind === "version")
|
|
66
|
+
return PHIS_CDN_KEY_VERSION_PATTERN.test(trimmed) ? null : labels.invalidVersion;
|
|
67
|
+
if (!PHIS_CDN_KEY_SEGMENT_PATTERN.test(trimmed))
|
|
68
|
+
return labels.invalidSegment;
|
|
69
|
+
return kind === "name" && trimmed === "api" ? labels.reservedName : null;
|
|
70
|
+
}
|
|
71
|
+
export function PhiCdnUploadWidgetClient({ config, labels, uploadLabels }) {
|
|
72
|
+
const emitRoutes = useMemo(() => config?.signalRoutes?.emits ?? [], [config?.signalRoutes?.emits]);
|
|
73
|
+
const emitSignal = usePhiSignalEmitter();
|
|
74
|
+
const [names, setNames] = useState([]);
|
|
75
|
+
const [draft, setDraft] = useState(EMPTY_DRAFT);
|
|
76
|
+
// The draft the runner sends with, read when it starts rather than captured when it was made.
|
|
77
|
+
const draftRef = useRef(draft);
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
draftRef.current = draft;
|
|
80
|
+
}, [draft]);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
const abort = new AbortController();
|
|
83
|
+
void loadPhiCdnNames(abort.signal).then(setNames, () => undefined);
|
|
84
|
+
return () => abort.abort();
|
|
85
|
+
}, []);
|
|
86
|
+
const problems = {
|
|
87
|
+
name: readPhiCdnSegmentProblem(draft.name, "name", labels),
|
|
88
|
+
version: readPhiCdnSegmentProblem(draft.version, "version", labels),
|
|
89
|
+
fileName: readPhiCdnSegmentProblem(draft.fileName, "fileName", labels),
|
|
90
|
+
};
|
|
91
|
+
const runSession = useCallback(async (file, onProgress, _options, signal, onPhase) => {
|
|
92
|
+
const current = draftRef.current;
|
|
93
|
+
const input = {
|
|
94
|
+
name: current.name.trim(),
|
|
95
|
+
version: current.version.trim(),
|
|
96
|
+
fileName: current.fileName.trim(),
|
|
97
|
+
os: writePhiCdnOsBits(current.os),
|
|
98
|
+
arch: writePhiCdnArchBits(current.arch),
|
|
99
|
+
};
|
|
100
|
+
storeDraft(file, { ...current, name: input.name, version: input.version, fileName: input.fileName });
|
|
101
|
+
try {
|
|
102
|
+
const published = await runPhiUploadSession(createPhiCdnUploadTarget(input), file, {
|
|
103
|
+
...(onProgress ? { onProgress } : {}),
|
|
104
|
+
...(onPhase ? { onPhase } : {}),
|
|
105
|
+
...(signal ? { signal } : {}),
|
|
106
|
+
});
|
|
107
|
+
storeDraft(file, null);
|
|
108
|
+
return { asset: published };
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (signal?.aborted && signal.reason === PHI_CDN_UPLOAD_DISCARD)
|
|
112
|
+
storeDraft(file, null);
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
}, []);
|
|
116
|
+
const moduleTarget = useMemo(() => ({
|
|
117
|
+
ready: !problems.name && !problems.version && !problems.fileName,
|
|
118
|
+
startLabel: labels.start,
|
|
119
|
+
cancelLabel: labels.cancel,
|
|
120
|
+
cancelReason: PHI_CDN_UPLOAD_DISCARD,
|
|
121
|
+
phaseLabels: { checksum: labels.steps.checksum, finish: labels.steps.verify },
|
|
122
|
+
runSession,
|
|
123
|
+
readError: (error) => {
|
|
124
|
+
if (error instanceof PhiMediaUploadError && error.code === "checksum-unavailable")
|
|
125
|
+
return labels.checksumUnavailable;
|
|
126
|
+
// Core words its refusals for a person (`{ error, message }`); a transport failure says what failed.
|
|
127
|
+
return error instanceof PhiMediaUploadError && error.message ? error.message : null;
|
|
128
|
+
},
|
|
129
|
+
onFilePicked: (file) => setDraft((previous) => readStoredDraft(file) ?? draftFromFile(file, previous.name)),
|
|
130
|
+
onUploaded: () => {
|
|
131
|
+
setDraft(EMPTY_DRAFT);
|
|
132
|
+
void loadPhiCdnNames().then(setNames, () => undefined);
|
|
133
|
+
emitPhiSignalCapability(emitSignal, emitRoutes, "uploaded", null);
|
|
134
|
+
},
|
|
135
|
+
renderFields: ({ file, uploading }) => (_jsxs(PhiFlexControl, { vertical: true, gap: 12, children: [_jsx(PhiSelectControl, { label: labels.name, description: (file && problems.name) || labels.nameHint, presentation: "autocomplete", allowCustom: true, style: FIELD_STYLE, value: draft.name, options: names.map((name) => ({ value: name, label: name })), disabled: uploading, onChange: (name) => setDraft((previous) => ({ ...previous, name: typeof name === "string" ? name : "" })) }), _jsx(PhiTextControl, { label: labels.version, style: FIELD_STYLE, description: (file && problems.version) || undefined, value: draft.version, disabled: uploading, onChange: (version) => setDraft((previous) => ({ ...previous, version: version ?? "" })) }), _jsx(PhiTextControl, { label: labels.fileFileName, style: FIELD_STYLE, description: (file && problems.fileName) || undefined, value: draft.fileName, disabled: uploading || !file, onChange: (fileName) => setDraft((previous) => ({ ...previous, fileName: fileName ?? "" })) }), _jsx(PhiLabeledControl, { label: labels.os, children: _jsx(PhiCheckboxGroupControl, { value: draft.os, options: PHI_CDN_OS_KEYS.map(([key]) => ({ value: key, label: labels.osNames[key] })), disabled: uploading, onChange: (os) => setDraft((previous) => ({ ...previous, os: [...os] })) }) }), _jsx(PhiLabeledControl, { label: labels.arch, children: _jsx(PhiCheckboxGroupControl, { value: draft.arch, options: PHI_CDN_ARCH_KEYS.map(([key]) => ({ value: key, label: labels.archNames[key] })), disabled: uploading, onChange: (arch) => setDraft((previous) => ({ ...previous, arch: [...arch] })) }) })] })),
|
|
136
|
+
}), [draft, emitRoutes, emitSignal, labels, names, problems.fileName, problems.name, problems.version, runSession]);
|
|
137
|
+
return (_jsx(PhiAreaUploadBinding, { labels: uploadLabels, showFinished: false, config: { allowDelete: false, multiple: false, accept: "*/*" }, moduleTarget: moduleTarget }));
|
|
138
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type PhiSignalRouteSet } from "../../../../../types/signals";
|
|
2
|
+
import { type PhiCmsWidgetConfigBase } from "../../../../../widget-config";
|
|
3
|
+
export declare const PHI_CDN_UPLOAD_WIDGET_TYPE: string;
|
|
4
|
+
export type PhiCdnUploadWidgetConfig = PhiCmsWidgetConfigBase & {
|
|
5
|
+
signalRoutes?: PhiSignalRouteSet | null;
|
|
6
|
+
};
|
|
7
|
+
declare function parsePhiCdnUploadWidgetConfig(config: Record<string, unknown>): PhiCdnUploadWidgetConfig;
|
|
8
|
+
export declare const PHI_CDN_UPLOAD_WIDGET_DEFINITION: {
|
|
9
|
+
kind: "widget";
|
|
10
|
+
pluginKey: string;
|
|
11
|
+
typeKey: string;
|
|
12
|
+
slotSizePolicy: "fill-inline";
|
|
13
|
+
title: string;
|
|
14
|
+
category: "media";
|
|
15
|
+
description: string;
|
|
16
|
+
iconFamily: string;
|
|
17
|
+
fields: never[];
|
|
18
|
+
defaultConfig: {};
|
|
19
|
+
parseConfig: typeof parsePhiCdnUploadWidgetConfig;
|
|
20
|
+
runtimeSignals: {
|
|
21
|
+
emits: {
|
|
22
|
+
id: string;
|
|
23
|
+
action: "activate";
|
|
24
|
+
valueType: "none";
|
|
25
|
+
}[];
|
|
26
|
+
listens: never[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export {};
|