studiocms 0.2.0 → 0.4.0
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/CHANGELOG.md +122 -0
- package/dist/cli/add/index.d.ts +2 -2
- package/dist/cli/add/index.js +4 -3
- package/dist/cli/add/npm-utils.d.ts +6 -6
- package/dist/cli/add/tryToInstallPlugins.d.ts +1 -1
- package/dist/cli/add/tryToInstallPlugins.js +6 -5
- package/dist/cli/add/updateStudioCMSConfig.d.ts +1 -1
- package/dist/cli/add/updateStudioCMSConfig.js +3 -4
- package/dist/cli/add/validatePlugins.d.ts +1 -2
- package/dist/cli/add/validatePlugins.js +15 -9
- package/dist/cli/crypto/genJWT/index.d.ts +1 -1
- package/dist/cli/crypto/genJWT/index.js +8 -9
- package/dist/cli/crypto/index.d.ts +1 -1
- package/dist/cli/init/steps/env.js +14 -4
- package/dist/cli/init/steps/next.d.ts +1 -1
- package/dist/cli/init/steps/next.js +6 -5
- package/dist/cli/migrator/index.d.ts +1 -1
- package/dist/cli/migrator/index.js +2 -2
- package/dist/cli/users/index.d.ts +1 -1
- package/dist/cli/users/shared.js +2 -2
- package/dist/cli/users/steps/createUsers.js +7 -7
- package/dist/cli/users/steps/modifyUsers.js +2 -2
- package/dist/cli/users/steps/next.d.ts +1 -1
- package/dist/cli/utils/checkRequiredEnvVars.js +2 -2
- package/dist/cli/utils/context.d.ts +2 -4
- package/dist/cli/utils/context.js +1 -3
- package/dist/cli/utils/getCliDbClient.d.ts +1 -1
- package/dist/cli/utils/intro.d.ts +1 -1
- package/dist/cli/utils/loadConfig.d.ts +54 -49
- package/dist/cli/utils/loadConfig.js +5 -8
- package/dist/cli/utils/logger.js +3 -3
- package/dist/cli/utils/user-utils.d.ts +1 -1
- package/dist/cli/utils/user-utils.js +4 -3
- package/dist/client/apiClient.d.ts +4923 -0
- package/dist/client/apiClient.js +72 -0
- package/dist/config.d.ts +1734 -1
- package/dist/consts.d.ts +5 -5
- package/dist/consts.js +3 -2
- package/dist/db/plugins.d.ts +1 -1
- package/dist/db/plugins.js +5 -8
- package/dist/handlers/frontend/routes.d.ts +4 -18
- package/dist/handlers/frontend/routes.js +13 -152
- package/dist/handlers/frontend/types.d.ts +1 -1
- package/dist/handlers/frontend/utils.js +0 -18
- package/dist/handlers/pluginHandler.d.ts +34 -257
- package/dist/handlers/pluginHandler.js +92 -46
- package/dist/handlers/routeHandler.js +32 -11
- package/dist/handlers/setupDbStudio.d.ts +3 -1
- package/dist/handlers/setupDbStudio.js +19 -10
- package/dist/handlers/storage-manager/core/effectify-astro-context.d.ts +25 -0
- package/dist/handlers/storage-manager/core/effectify-astro-context.js +78 -0
- package/dist/handlers/storage-manager/no-op.d.ts +2 -2
- package/dist/handlers/storage-manager/no-op.js +2 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +10 -20
- package/dist/integrations/robots/index.d.ts +2 -2
- package/dist/integrations/robots/index.js +1 -3
- package/dist/integrations/robots/schema.d.ts +102 -273
- package/dist/integrations/robots/schema.js +220 -209
- package/dist/plugins/analytics/assets/schemas.d.ts +14 -9
- package/dist/plugins/analytics/assets/schemas.js +25 -17
- package/dist/plugins/analytics/db-client.d.ts +1 -1
- package/dist/plugins/analytics/index.d.ts +823 -3
- package/dist/plugins/analytics/index.js +4 -5
- package/dist/plugins/analytics/schemas.d.ts +54 -62
- package/dist/plugins/analytics/schemas.js +64 -13
- package/dist/plugins/analytics/table.d.ts +1 -1
- package/dist/plugins.d.ts +0 -1
- package/dist/schemas/config/api.d.ts +17 -0
- package/dist/schemas/config/api.js +14 -0
- package/dist/schemas/config/auth.d.ts +55 -59
- package/dist/schemas/config/auth.js +34 -11
- package/dist/schemas/config/dashboard.d.ts +43 -79
- package/dist/schemas/config/dashboard.js +43 -12
- package/dist/schemas/config/db.d.ts +15 -17
- package/dist/schemas/config/db.js +13 -5
- package/dist/schemas/config/developer.d.ts +33 -45
- package/dist/schemas/config/developer.js +22 -5
- package/dist/schemas/config/index.d.ts +398 -521
- package/dist/schemas/config/index.js +115 -57
- package/dist/schemas/config/sdk.d.ts +50 -196
- package/dist/schemas/config/sdk.js +61 -73
- package/dist/schemas/custom.d.ts +40 -0
- package/dist/schemas/custom.js +41 -0
- package/dist/schemas/external-schemas.d.ts +171 -0
- package/dist/schemas/external-schemas.js +179 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/plugins/i18n.d.ts +59 -39
- package/dist/schemas/plugins/i18n.js +42 -5
- package/dist/schemas/plugins/index.d.ts +7126 -10296
- package/dist/schemas/plugins/index.js +260 -276
- package/dist/schemas/plugins/shared.d.ts +1293 -3718
- package/dist/schemas/plugins/shared.js +320 -329
- package/dist/test-utils.d.ts +15 -4
- package/dist/test-utils.js +27 -11
- package/dist/toolbar/db-viewer/db-shared-types.d.ts +6 -6
- package/dist/toolbar/db-viewer/studio/connection.d.ts +8 -4
- package/dist/toolbar/db-viewer/studio/connection.js +2 -28
- package/dist/toolbar/db-viewer/studio/env/libsql.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/libsql.js +17 -0
- package/dist/toolbar/db-viewer/studio/env/mysql.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/mysql.js +23 -0
- package/dist/toolbar/db-viewer/studio/env/postgres.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/postgres.js +23 -0
- package/dist/toolbar/db-viewer/studio/index.js +20 -56
- package/dist/toolbar/db-viewer/studio/type.d.ts +1 -2
- package/dist/toolbar/db-viewer/studio/virtual-connection/libsql.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/libsql.js +24 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/mysql.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/mysql.js +9 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/postgres.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/postgres.js +9 -0
- package/dist/toolbar/db-viewer/viewer.js +20 -21
- package/dist/types.d.ts +30 -0
- package/dist/utils/effects/smtp.d.ts +1 -1
- package/dist/utils/lang-helper.d.ts +10 -2
- package/dist/virtual.d.ts +35 -28
- package/dist/virtuals/auth/core.d.ts +5 -5
- package/dist/virtuals/auth/verify-email.d.ts +6 -6
- package/dist/virtuals/components/Generator.astro +2 -2
- package/dist/virtuals/components/Renderer.astro +9 -1
- package/dist/virtuals/components/renderFn.d.ts +3 -1
- package/dist/virtuals/components/renderFn.js +18 -0
- package/dist/virtuals/lib/headDefaults.d.ts +4 -2
- package/dist/virtuals/lib/headDefaults.js +0 -2
- package/dist/virtuals/lib/routeMap.d.ts +0 -12
- package/dist/virtuals/lib/routeMap.js +2 -14
- package/dist/virtuals/mailer/index.d.ts +3 -3
- package/dist/virtuals/notifier/index.d.ts +5 -5
- package/dist/virtuals/plugins/dashboard-pages.d.ts +2 -64
- package/dist/virtuals/scripts/StorageFileBrowser.d.ts +1 -172
- package/dist/virtuals/scripts/StorageFileBrowser.js +216 -119
- package/dist/virtuals/template-engine/index.d.ts +4 -4
- package/frontend/components/dashboard/configuration/ConfigForm.astro +218 -110
- package/frontend/components/dashboard/content-mgmt/ContentSearch.astro +21 -22
- package/frontend/components/dashboard/content-mgmt/CreateFolder.astro +66 -54
- package/frontend/components/dashboard/content-mgmt/CreatePage.astro +58 -104
- package/frontend/components/dashboard/content-mgmt/EditFolder.astro +65 -67
- package/frontend/components/dashboard/content-mgmt/EditPage.astro +86 -134
- package/frontend/components/dashboard/content-mgmt/InnerSidebarElement.astro +0 -1
- package/frontend/components/dashboard/content-mgmt/PageHeader.astro +33 -52
- package/frontend/components/dashboard/content-mgmt/PageTypeHandler.astro +2 -2
- package/frontend/components/dashboard/profile/APITokens.astro +219 -158
- package/frontend/components/dashboard/profile/BasicInfo.astro +165 -106
- package/frontend/components/dashboard/profile/Notifications.astro +27 -18
- package/frontend/components/dashboard/profile/UpdatePassword.astro +134 -94
- package/frontend/components/dashboard/sidebar/VersionCheck.astro +31 -16
- package/frontend/components/dashboard/sidebar/VersionCheckChangelog.astro +18 -11
- package/frontend/components/dashboard/sidebar-modals/VersionModal.astro +2 -2
- package/frontend/components/dashboard/smtp-config/TemplateEditor.astro +14 -14
- package/frontend/components/dashboard/taxonomy/InnerSidebarElement.astro +0 -1
- package/frontend/components/dashboard/taxonomy/MetaContainer.astro +0 -2
- package/frontend/components/dashboard/taxonomy/PageHeader.astro +16 -24
- package/frontend/components/dashboard/taxonomy/TaxonomySearch.astro +23 -27
- package/frontend/components/dashboard/user-mgmt/InnerSidebarElement.astro +111 -104
- package/frontend/components/dashboard/user-mgmt/UserListItem.astro +9 -22
- package/frontend/components/dashboard/user-mgmt/UserListItems.astro +18 -0
- package/frontend/components/first-time-setup/snippets/{opt2-studiocms.config.diff → studiocms.config.diff} +1 -0
- package/frontend/components/shared/Code.astro +1 -4
- package/frontend/components/shared/DynamicSettingsRenderer.astro +1 -1
- package/frontend/components/shared/SSRUser.astro +2 -4
- package/frontend/components/shared/foldertree/FolderTreeNode.astro +0 -6
- package/frontend/components/shared/storage-manager/StorageCopyOutput.astro +0 -1
- package/frontend/components/shared/taxonomy/TaxonomyTreeNode.astro +0 -6
- package/frontend/layouts/DashboardLayout.astro +1 -10
- package/frontend/layouts/TaxonomyLayout.astro +0 -1
- package/frontend/middleware/index.ts +102 -61
- package/frontend/pages/404.astro +5 -9
- package/frontend/pages/[dashboard]/[...pluginPage].astro +10 -1
- package/frontend/pages/[dashboard]/configuration.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/createfolder.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/createpage.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/diff.astro +39 -14
- package/frontend/pages/[dashboard]/content-management/editfolder.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/editpage.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/index.astro +10 -1
- package/frontend/pages/[dashboard]/index.astro +10 -1
- package/frontend/pages/[dashboard]/login.astro +86 -25
- package/frontend/pages/[dashboard]/password-reset.astro +22 -16
- package/frontend/pages/[dashboard]/plugins/[plugin].astro +10 -1
- package/frontend/pages/[dashboard]/profile.astro +10 -1
- package/frontend/pages/[dashboard]/signup.astro +153 -52
- package/frontend/pages/[dashboard]/smtp-configuration.astro +77 -75
- package/frontend/pages/[dashboard]/system-management.astro +10 -1
- package/frontend/pages/[dashboard]/taxonomy/categories.astro +30 -41
- package/frontend/pages/[dashboard]/taxonomy/index.astro +10 -0
- package/frontend/pages/[dashboard]/taxonomy/tags.astro +33 -43
- package/frontend/pages/[dashboard]/unverified-email.astro +29 -21
- package/frontend/pages/[dashboard]/user-management/edit.astro +170 -90
- package/frontend/pages/[dashboard]/user-management/index.astro +10 -1
- package/frontend/pages/studiocms_api/[...all].ts +106 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/auth.ts +26 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/changelog.ts +147 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/db-studio-driver.ts +46 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/parseLogLevel.ts +27 -0
- package/frontend/pages/studiocms_api/_handlers/auth/auth.ts +459 -0
- package/frontend/pages/studiocms_api/_handlers/auth/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/auth/oauth.ts +91 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/_shared.ts +57 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/apiTokens.ts +134 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/config.ts +64 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/content.ts +741 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/create.ts +480 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/emailNotifications.ts +49 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/index.ts +45 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/mailer.ts +136 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/plugins.ts +80 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/profile.ts +275 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/resetPassword.ts +140 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/search.ts +63 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/taxonomy.ts +285 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/templates.ts +75 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/users.ts +312 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/verifyEndpoints.ts +307 -0
- package/frontend/pages/studiocms_api/_handlers/integration/dbStudio.ts +98 -0
- package/frontend/pages/studiocms_api/_handlers/integration/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/integration/storageManager.ts +107 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/index.ts +8 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/_shared.ts +41 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/public.ts +195 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/secure.ts +1726 -0
- package/frontend/pages/studiocms_api/_handlers/sdk.ts +129 -0
- package/frontend/pages/studiocms_api/_middleware/astroLocals.ts +36 -0
- package/frontend/pages/studiocms_api/_middleware/restApi.ts +56 -0
- package/frontend/pages/studiocms_api/integrations/[...all].ts +8 -0
- package/frontend/scripts/formdata.ts +219 -0
- package/frontend/setup-pages/3-done.astro +4 -20
- package/frontend/setup-pages/studiocms_api/dashboard/step-2.ts +3 -6
- package/frontend/styles/dashboard-base.css +0 -1
- package/frontend/web-vitals/endpoint.ts +2 -1
- package/package.json +35 -31
- package/dist/global.d.ts +0 -9
- package/frontend/components/dashboard/LoginChecker.astro +0 -68
- package/frontend/components/dashboard/user-mgmt/RankCheck.astro +0 -57
- package/frontend/components/first-time-setup/snippets/opt1-astro.config.diff +0 -14
- package/frontend/components/first-time-setup/snippets/opt2-astro.config.diff +0 -9
- package/frontend/middleware/_authmap.ts +0 -63
- package/frontend/pages/studiocms_api/auth/[path].ts +0 -390
- package/frontend/pages/studiocms_api/auth/[provider]/[...id].ts +0 -64
- package/frontend/pages/studiocms_api/auth/[provider]/_effects/index.ts +0 -101
- package/frontend/pages/studiocms_api/auth/_shared.ts +0 -52
- package/frontend/pages/studiocms_api/dashboard/api-tokens.ts +0 -115
- package/frontend/pages/studiocms_api/dashboard/config.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/content/diff.ts +0 -73
- package/frontend/pages/studiocms_api/dashboard/content/folder.ts +0 -220
- package/frontend/pages/studiocms_api/dashboard/content/page.ts +0 -359
- package/frontend/pages/studiocms_api/dashboard/create-reset-link.ts +0 -77
- package/frontend/pages/studiocms_api/dashboard/create-user-invite.ts +0 -231
- package/frontend/pages/studiocms_api/dashboard/create-user.ts +0 -186
- package/frontend/pages/studiocms_api/dashboard/email-notification-settings-site.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/mailer/check-email.ts +0 -75
- package/frontend/pages/studiocms_api/dashboard/mailer/config.ts +0 -136
- package/frontend/pages/studiocms_api/dashboard/plugins/[plugin].ts +0 -80
- package/frontend/pages/studiocms_api/dashboard/profile.ts +0 -245
- package/frontend/pages/studiocms_api/dashboard/resend-verify-email.ts +0 -77
- package/frontend/pages/studiocms_api/dashboard/reset-password.ts +0 -124
- package/frontend/pages/studiocms_api/dashboard/search-list.ts +0 -59
- package/frontend/pages/studiocms_api/dashboard/taxonomy-search.ts +0 -47
- package/frontend/pages/studiocms_api/dashboard/taxonomy.ts +0 -230
- package/frontend/pages/studiocms_api/dashboard/templates.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/update-user-notifications.ts +0 -86
- package/frontend/pages/studiocms_api/dashboard/users.ts +0 -236
- package/frontend/pages/studiocms_api/dashboard/verify-email.ts +0 -83
- package/frontend/pages/studiocms_api/dashboard/verify-session.ts +0 -187
- package/frontend/pages/studiocms_api/integrations/[type]/[...id].ts +0 -15
- package/frontend/pages/studiocms_api/integrations/[type]/_routes/db-studio.ts +0 -173
- package/frontend/pages/studiocms_api/integrations/[type]/_routes/storage.ts +0 -88
- package/frontend/pages/studiocms_api/partials/editor.astro +0 -74
- package/frontend/pages/studiocms_api/partials/render.astro +0 -39
- package/frontend/pages/studiocms_api/partials/user-list-items.astro +0 -43
- package/frontend/pages/studiocms_api/rest/utils/auth-token.ts +0 -59
- package/frontend/pages/studiocms_api/rest/v1/[type]/[...id].ts +0 -23
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/categories.ts +0 -267
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/folders.ts +0 -283
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/pages.ts +0 -505
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/settings.ts +0 -100
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/tags.ts +0 -229
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/users.ts +0 -553
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/[...id].ts +0 -19
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/categories.ts +0 -74
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/folders.ts +0 -85
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/pages.ts +0 -103
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/tags.ts +0 -67
- package/frontend/pages/studiocms_api/sdk/[...path].ts +0 -97
- package/frontend/pages/studiocms_api/sdk/utils/changelog.ts +0 -119
- package/frontend/scripts/auth/formListener.ts +0 -81
- package/frontend/scripts/formdata-utils.ts +0 -116
- package/frontend/utils/build-partial-schema.ts +0 -46
- package/frontend/utils/errors.ts +0 -6
- package/frontend/utils/param-extractor.ts +0 -83
- package/frontend/utils/rest-router.ts +0 -444
|
@@ -74,8 +74,8 @@ const CurrentEditorComponent = editor;
|
|
|
74
74
|
const pluginFields = pluginList
|
|
75
75
|
.flatMap(({ pageTypes }) => {
|
|
76
76
|
const pageTypeOutput: {
|
|
77
|
-
identifier: string;
|
|
78
|
-
fields?: SettingsField[];
|
|
77
|
+
readonly identifier: string;
|
|
78
|
+
readonly fields?: readonly SettingsField[];
|
|
79
79
|
}[] = [];
|
|
80
80
|
|
|
81
81
|
if (!pageTypes) {
|
|
@@ -100,10 +100,7 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-page');
|
|
|
100
100
|
data-content-management-url={Astro.locals.StudioCMS.routeMap.mainLinks
|
|
101
101
|
.contentManagement}
|
|
102
102
|
>
|
|
103
|
-
<form
|
|
104
|
-
id="edit-page-form"
|
|
105
|
-
action={Astro.locals.StudioCMS.routeMap.endpointLinks.content.page}
|
|
106
|
-
>
|
|
103
|
+
<form id="edit-page-form">
|
|
107
104
|
<Tabs variant={"starlight"}>
|
|
108
105
|
<TabItem
|
|
109
106
|
id="tab-label-basic-info"
|
|
@@ -181,11 +178,9 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-page');
|
|
|
181
178
|
label={t("select-page-categories")}
|
|
182
179
|
name="categories"
|
|
183
180
|
fullWidth
|
|
184
|
-
placeholder={
|
|
185
|
-
categories
|
|
186
|
-
|
|
187
|
-
: 'Select'
|
|
188
|
-
}
|
|
181
|
+
placeholder={categories.length === 0
|
|
182
|
+
? "No categories available"
|
|
183
|
+
: "Select"}
|
|
189
184
|
options={createSelectOptions(
|
|
190
185
|
categories.map(({ id: value, name: label }) => ({
|
|
191
186
|
label,
|
|
@@ -194,24 +189,22 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-page');
|
|
|
194
189
|
)}
|
|
195
190
|
disabled={categories.length === 0}
|
|
196
191
|
multiple
|
|
197
|
-
defaultValue={
|
|
198
|
-
(() =>
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
192
|
+
defaultValue={(() => {
|
|
193
|
+
const categories = pageData.categories.map(({ id }) =>
|
|
194
|
+
String(id),
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
if (categories.length > 0) return categories;
|
|
198
|
+
return undefined;
|
|
199
|
+
})()}
|
|
205
200
|
/>
|
|
206
201
|
<Select
|
|
207
202
|
label={t("select-page-tags")}
|
|
208
203
|
name="tags"
|
|
209
204
|
fullWidth
|
|
210
|
-
placeholder={
|
|
211
|
-
tags
|
|
212
|
-
|
|
213
|
-
: 'Select'
|
|
214
|
-
}
|
|
205
|
+
placeholder={tags.length === 0
|
|
206
|
+
? "No tags available"
|
|
207
|
+
: "Select"}
|
|
215
208
|
options={createSelectOptions(
|
|
216
209
|
tags.map(({ id: value, name: label }) => ({
|
|
217
210
|
label,
|
|
@@ -220,14 +213,12 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-page');
|
|
|
220
213
|
)}
|
|
221
214
|
disabled={tags.length === 0}
|
|
222
215
|
multiple
|
|
223
|
-
defaultValue={
|
|
224
|
-
(() =>
|
|
225
|
-
const tags = pageData.tags.map(({id}) => String(id));
|
|
216
|
+
defaultValue={(() => {
|
|
217
|
+
const tags = pageData.tags.map(({ id }) => String(id));
|
|
226
218
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
219
|
+
if (tags.length > 0) return tags;
|
|
220
|
+
return undefined;
|
|
221
|
+
})()}
|
|
231
222
|
/>
|
|
232
223
|
</div>
|
|
233
224
|
|
|
@@ -501,7 +492,7 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-page');
|
|
|
501
492
|
updateTrueFalseSelectOptions("draft", trueFalseOptions);
|
|
502
493
|
updateTrueFalseSelectOptions("show-in-nav", trueFalseOptions);
|
|
503
494
|
updateSelectOptions("cms-plugin-augments", {
|
|
504
|
-
|
|
495
|
+
"no-augments": comp["no-augments"],
|
|
505
496
|
});
|
|
506
497
|
});
|
|
507
498
|
|
|
@@ -526,22 +517,19 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-page');
|
|
|
526
517
|
</script>
|
|
527
518
|
|
|
528
519
|
<script>
|
|
529
|
-
import type { tsPageData } from "studiocms:sdk/types";
|
|
530
520
|
import { toast } from "studiocms:ui/components/toaster/client";
|
|
521
|
+
import * as Schema from "effect/Schema";
|
|
531
522
|
import {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
} from "../../../scripts/formdata
|
|
535
|
-
|
|
536
|
-
|
|
523
|
+
EditPageDataFromFormDataObjectSchema,
|
|
524
|
+
ObjectFromFormData,
|
|
525
|
+
} from "../../../scripts/formdata.js";
|
|
526
|
+
import { dashboardClient, dashboardSharedCatchTags } from "studiocms:client/apiClients";
|
|
527
|
+
import * as Effect from "effect/Effect";
|
|
537
528
|
|
|
538
529
|
// get the elements
|
|
539
530
|
const editPageForm = document.getElementById(
|
|
540
531
|
"edit-page-form",
|
|
541
532
|
) as HTMLFormElement;
|
|
542
|
-
const createContainer = document.getElementById(
|
|
543
|
-
"edit-page-container",
|
|
544
|
-
) as HTMLDivElement;
|
|
545
533
|
|
|
546
534
|
const knownFormDataKeys = [
|
|
547
535
|
"page-title",
|
|
@@ -583,100 +571,64 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-page');
|
|
|
583
571
|
|
|
584
572
|
type KnownDataKeys = (typeof knownDataKeys)[number];
|
|
585
573
|
|
|
586
|
-
const formDataKeysToPageDataKeys: Record<
|
|
587
|
-
KnownFormDataKeys,
|
|
588
|
-
keyof tsPageDataInsert | "contentId" | "content"
|
|
589
|
-
> = {
|
|
590
|
-
"page-title": "title",
|
|
591
|
-
"page-slug": "slug",
|
|
592
|
-
"page-description": "description",
|
|
593
|
-
"page-hero-image": "heroImage",
|
|
594
|
-
"page-type": "package",
|
|
595
|
-
"show-in-nav": "showOnNav",
|
|
596
|
-
"parent-folder": "parentFolder",
|
|
597
|
-
draft: "draft",
|
|
598
|
-
categories: "categories",
|
|
599
|
-
tags: "tags",
|
|
600
|
-
"show-author": "showAuthor",
|
|
601
|
-
"show-contributors": "showContributors",
|
|
602
|
-
"page-content-id": "contentId",
|
|
603
|
-
"page-content": "content",
|
|
604
|
-
"page-id": "id",
|
|
605
|
-
};
|
|
606
|
-
|
|
607
|
-
const { contentManagementUrl } = createContainer.dataset;
|
|
608
|
-
|
|
609
574
|
editPageForm.addEventListener("submit", async (e) => {
|
|
610
575
|
e.preventDefault();
|
|
611
576
|
const formData = new FormData(editPageForm);
|
|
612
577
|
|
|
613
|
-
const formDataObject = formDataToRecord(
|
|
614
|
-
formData,
|
|
615
|
-
formDataKeysToPageDataKeys,
|
|
616
|
-
);
|
|
617
|
-
|
|
618
|
-
const pluginsFormData = Object.entries(formDataObject).reduce(
|
|
619
|
-
(acc, [key, value]) => {
|
|
620
|
-
// if the key is not in the knownFormDataKeys or knownDataKeys, it's a plugin field
|
|
621
|
-
if (
|
|
622
|
-
!knownFormDataKeys.includes(key as KnownFormDataKeys) &&
|
|
623
|
-
!knownDataKeys.includes(key as KnownDataKeys)
|
|
624
|
-
) {
|
|
625
|
-
acc[key] = value;
|
|
626
|
-
delete formDataObject[key];
|
|
627
|
-
}
|
|
628
|
-
return acc;
|
|
629
|
-
},
|
|
630
|
-
{} as Record<string, FormDataEntryValue>,
|
|
631
|
-
);
|
|
632
|
-
|
|
633
578
|
const augments = [...formData.getAll("cms-plugin-augments")].filter(
|
|
634
579
|
(a) => a !== "no-augments",
|
|
635
580
|
) as string[];
|
|
636
581
|
|
|
637
|
-
const
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
582
|
+
const response = await Schema.decode(ObjectFromFormData)(formData).pipe(
|
|
583
|
+
Effect.map((data) => {
|
|
584
|
+
const pluginFields = Object.entries(data).reduce(
|
|
585
|
+
(acc, [key, value]) => {
|
|
586
|
+
// if the key is not in the knownFormDataKeys or knownDataKeys, it's a plugin field
|
|
587
|
+
if (
|
|
588
|
+
!knownFormDataKeys.includes(key as KnownFormDataKeys) &&
|
|
589
|
+
!knownDataKeys.includes(key as KnownDataKeys)
|
|
590
|
+
) {
|
|
591
|
+
acc[key] = value;
|
|
592
|
+
delete data[key];
|
|
593
|
+
}
|
|
594
|
+
return acc;
|
|
595
|
+
},
|
|
596
|
+
{} as Record<string, FormDataEntryValue>,
|
|
597
|
+
);
|
|
598
|
+
|
|
599
|
+
return {
|
|
600
|
+
...data,
|
|
601
|
+
augments,
|
|
602
|
+
pluginFields,
|
|
603
|
+
};
|
|
604
|
+
}),
|
|
605
|
+
Schema.decodeUnknown(EditPageDataFromFormDataObjectSchema),
|
|
606
|
+
Effect.flatMap((payload) =>
|
|
607
|
+
dashboardClient.pipe(
|
|
608
|
+
Effect.flatMap((client) =>
|
|
609
|
+
client.content.updatePage({
|
|
610
|
+
payload,
|
|
611
|
+
}),
|
|
612
|
+
),
|
|
613
|
+
),
|
|
614
|
+
),
|
|
615
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
616
|
+
Effect.runPromise,
|
|
617
|
+
);
|
|
662
618
|
|
|
663
|
-
if (
|
|
619
|
+
if ("error" in response) {
|
|
664
620
|
toast({
|
|
665
621
|
title: "Error",
|
|
666
|
-
description:
|
|
622
|
+
description: response.error,
|
|
667
623
|
type: "danger",
|
|
668
624
|
});
|
|
669
625
|
return;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
if (response.status === 200) {
|
|
626
|
+
} else {
|
|
673
627
|
toast({
|
|
674
628
|
title: "Success",
|
|
675
|
-
description:
|
|
629
|
+
description: response.message || "Page updated successfully",
|
|
676
630
|
type: "success",
|
|
677
631
|
});
|
|
678
|
-
if (contentManagementUrl) window.location.href = contentManagementUrl;
|
|
679
|
-
return;
|
|
680
632
|
}
|
|
681
633
|
});
|
|
682
634
|
</script>
|
|
@@ -700,29 +652,29 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-page');
|
|
|
700
652
|
height: 100%;
|
|
701
653
|
|
|
702
654
|
> .sui-tabs-container {
|
|
703
|
-
|
|
704
|
-
|
|
655
|
+
height: 100%;
|
|
656
|
+
display: flex;
|
|
705
657
|
flex-direction: column;
|
|
706
658
|
|
|
707
659
|
.sui-tab-header.active::after {
|
|
708
|
-
|
|
709
|
-
|
|
660
|
+
bottom: 1px;
|
|
661
|
+
}
|
|
710
662
|
|
|
711
663
|
> .sui-tabs-list {
|
|
712
|
-
|
|
664
|
+
overflow-y: hidden;
|
|
713
665
|
}
|
|
714
666
|
|
|
715
667
|
> .sui-tabs-content {
|
|
716
|
-
|
|
668
|
+
height: 100%;
|
|
717
669
|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
670
|
+
> sui-tab-item {
|
|
671
|
+
height: 100%;
|
|
672
|
+
flex-direction: column;
|
|
721
673
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
674
|
+
&.active {
|
|
675
|
+
display: flex;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
726
678
|
}
|
|
727
679
|
}
|
|
728
680
|
}
|
|
@@ -747,13 +699,13 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-page');
|
|
|
747
699
|
}
|
|
748
700
|
|
|
749
701
|
.form-row-booleans {
|
|
750
|
-
|
|
751
|
-
|
|
702
|
+
display: flex;
|
|
703
|
+
flex-direction: row;
|
|
752
704
|
flex-wrap: wrap;
|
|
753
705
|
gap: 0.75rem;
|
|
754
706
|
|
|
755
707
|
> * {
|
|
756
|
-
|
|
708
|
+
flex-grow: 1;
|
|
757
709
|
}
|
|
758
710
|
}
|
|
759
711
|
|
|
@@ -787,7 +739,7 @@ const t = useTranslations(lang, '@studiocms/dashboard:content-page');
|
|
|
787
739
|
}
|
|
788
740
|
|
|
789
741
|
.page-content-editor {
|
|
790
|
-
|
|
742
|
+
height: 100%;
|
|
791
743
|
margin-bottom: 2rem;
|
|
792
744
|
|
|
793
745
|
.editor-container {
|
|
@@ -90,7 +90,6 @@ const PageFolderTree = await runSDK(SDKCoreJs.GET.pageFolderTree());
|
|
|
90
90
|
class="folder-tree-search-container scrollbar"
|
|
91
91
|
id="inner-sidebar-items-search"
|
|
92
92
|
style="display: none;"
|
|
93
|
-
data-searchlist={Astro.locals.StudioCMS.routeMap.endpointLinks.searchList}
|
|
94
93
|
data-editpage={Astro.locals.StudioCMS.routeMap.mainLinks
|
|
95
94
|
.contentManagementEdit}
|
|
96
95
|
data-editfolder={Astro.locals.StudioCMS.routeMap.mainLinks
|
|
@@ -93,7 +93,7 @@ const currentMode = getCurrentMode();
|
|
|
93
93
|
<Button color='primary' id='nav-open' class='mobile-btn'>
|
|
94
94
|
<Icon name="heroicons:bars-3" height={24} width={24} slot="start-content" />
|
|
95
95
|
</Button>
|
|
96
|
-
<h1 class="page-title"
|
|
96
|
+
<h1 class="page-title">
|
|
97
97
|
{currentMode === 'none' ? (
|
|
98
98
|
<t-content-header key="title">
|
|
99
99
|
{pageTitle}
|
|
@@ -149,7 +149,6 @@ const currentMode = getCurrentMode();
|
|
|
149
149
|
<div class="modal-body">
|
|
150
150
|
<input type="hidden" name="page-id" value={currentId} />
|
|
151
151
|
<input type="hidden" name="page-slug" value={pageSlug} />
|
|
152
|
-
<input type="hidden" name="action-route" value={Astro.locals.StudioCMS.routeMap.endpointLinks.content.page} />
|
|
153
152
|
|
|
154
153
|
<span><t-content-header key="delete-modal-desc-1">
|
|
155
154
|
{t('delete-modal-desc-1')}
|
|
@@ -197,7 +196,6 @@ const currentMode = getCurrentMode();
|
|
|
197
196
|
<div class="modal-body">
|
|
198
197
|
<input type="hidden" name="folder-id" value={currentId} />
|
|
199
198
|
<input type="hidden" name="folder-name" value={folderName} />
|
|
200
|
-
<input type="hidden" name="action-route" value={Astro.locals.StudioCMS.routeMap.endpointLinks.content.folder} />
|
|
201
199
|
|
|
202
200
|
<span><t-content-header key="delete-folder-modal-desc-1">
|
|
203
201
|
{t('delete-folder-modal-desc-1')}
|
|
@@ -268,6 +266,8 @@ const currentMode = getCurrentMode();
|
|
|
268
266
|
<script>
|
|
269
267
|
import { ModalHelper } from 'studiocms:ui/components/modal/client';
|
|
270
268
|
import { toast } from "studiocms:ui/components/toaster/client";
|
|
269
|
+
import { dashboardClient, dashboardSharedCatchTags } from "studiocms:client/apiClients";
|
|
270
|
+
import * as Effect from "effect/Effect";
|
|
271
271
|
|
|
272
272
|
const mode = (document.getElementById('current-mode-selector') as HTMLDivElement).dataset.mode;
|
|
273
273
|
|
|
@@ -285,15 +285,11 @@ const currentMode = getCurrentMode();
|
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
const id = formData?.get('page-id')?.toString();
|
|
289
|
+
const slug = formData?.get('page-slug')?.toString();
|
|
288
290
|
const slugConfirm = formData?.get('slug-confirm')?.toString();
|
|
289
|
-
const action = formData.get('action-route') as string;
|
|
290
291
|
|
|
291
|
-
|
|
292
|
-
id: formData?.get('page-id')?.toString(),
|
|
293
|
-
slug: formData?.get('page-slug')?.toString(),
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (!slugConfirm) {
|
|
292
|
+
if (!id || !slug || !slugConfirm) {
|
|
297
293
|
toast({
|
|
298
294
|
title: 'Error',
|
|
299
295
|
description: 'Something went wrong',
|
|
@@ -302,16 +298,7 @@ const currentMode = getCurrentMode();
|
|
|
302
298
|
return;
|
|
303
299
|
}
|
|
304
300
|
|
|
305
|
-
if (
|
|
306
|
-
toast({
|
|
307
|
-
title: 'Error',
|
|
308
|
-
description: 'Something went wrong',
|
|
309
|
-
type: 'danger'
|
|
310
|
-
})
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
if (slugConfirm !== data.slug) {
|
|
301
|
+
if (slugConfirm !== slug) {
|
|
315
302
|
toast({
|
|
316
303
|
title: 'Error',
|
|
317
304
|
description: 'Slug does not match',
|
|
@@ -320,29 +307,28 @@ const currentMode = getCurrentMode();
|
|
|
320
307
|
return;
|
|
321
308
|
}
|
|
322
309
|
|
|
323
|
-
const response = await
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
310
|
+
const response = await dashboardClient.pipe(
|
|
311
|
+
Effect.flatMap((client) => client.content.deletePage({
|
|
312
|
+
payload: {
|
|
313
|
+
id,
|
|
314
|
+
slug
|
|
315
|
+
}
|
|
316
|
+
})),
|
|
317
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
318
|
+
Effect.runPromise
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
if ("error" in response) {
|
|
334
322
|
toast({
|
|
335
323
|
title: 'Error',
|
|
336
|
-
description:
|
|
324
|
+
description: response.error,
|
|
337
325
|
type: 'danger'
|
|
338
326
|
})
|
|
339
327
|
return;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
if (response.status === 200) {
|
|
328
|
+
} else {
|
|
343
329
|
toast({
|
|
344
330
|
title: 'Success',
|
|
345
|
-
description:
|
|
331
|
+
description: "Page deleted successfully",
|
|
346
332
|
type: 'success'
|
|
347
333
|
})
|
|
348
334
|
return;
|
|
@@ -372,7 +358,6 @@ const currentMode = getCurrentMode();
|
|
|
372
358
|
const folderName = formData.get('folder-name') as string;
|
|
373
359
|
const id = formData.get('folder-id') as string;
|
|
374
360
|
const confirmFolderName = formData?.get('confirm-folder-name');
|
|
375
|
-
const action = formData.get('action-route') as string;
|
|
376
361
|
|
|
377
362
|
if (!folderName || !confirmFolderName) {
|
|
378
363
|
toast({
|
|
@@ -398,29 +383,25 @@ const currentMode = getCurrentMode();
|
|
|
398
383
|
parentFolder: null,
|
|
399
384
|
};
|
|
400
385
|
|
|
401
|
-
const response = await
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
const res = await response.json();
|
|
386
|
+
const response = await dashboardClient.pipe(
|
|
387
|
+
Effect.flatMap((client) => client.content.deleteFolder({
|
|
388
|
+
payload: data,
|
|
389
|
+
})),
|
|
390
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
391
|
+
Effect.runPromise
|
|
392
|
+
);
|
|
410
393
|
|
|
411
|
-
if (
|
|
394
|
+
if ("error" in response) {
|
|
412
395
|
toast({
|
|
413
396
|
title: 'Error',
|
|
414
|
-
description:
|
|
397
|
+
description: response.error,
|
|
415
398
|
type: 'danger'
|
|
416
399
|
})
|
|
417
400
|
return;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
if (response.status === 200) {
|
|
401
|
+
} else {
|
|
421
402
|
toast({
|
|
422
403
|
title: 'Success',
|
|
423
|
-
description:
|
|
404
|
+
description: "Folder deleted successfully",
|
|
424
405
|
type: 'success'
|
|
425
406
|
})
|
|
426
407
|
return;
|