feat(next): adds support for resetting preferences (#10304)
This PR adds a button to the `/account` view which allows users to reset their preferences on-demand. This is to that editors can quickly reset their preferences via the admin ui without the need of accessing the db directly, which was simply not possible before. To do this, we add a new button at the bottom of the account view which performs a standard `DELETE` request using the REST API to the `'payload-preferences'` collection. Related: #9949 Demo: [Posts-reset-prefs--Payload.webm](https://github.com/user-attachments/assets/560cbbe3-06ef-4b7c-b3c2-9702883b1fc6)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
@import '../../../../scss/styles.scss';
|
||||
|
||||
@layer payload-default {
|
||||
.reset-preferences-modal {
|
||||
@include blur-bg;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
|
||||
&__wrapper {
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: base(2);
|
||||
padding: base(2);
|
||||
}
|
||||
|
||||
&__content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: base(1);
|
||||
|
||||
> * {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__controls {
|
||||
display: flex;
|
||||
gap: base(0.4);
|
||||
|
||||
.btn {
|
||||
margin: 0;
|
||||
margin-block: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
'use client'
|
||||
import { Button, Modal, useModal, useTranslation } from '@payloadcms/ui'
|
||||
|
||||
import './index.scss'
|
||||
|
||||
const baseClass = 'reset-preferences-modal'
|
||||
|
||||
export const ConfirmResetModal: React.FC<{
|
||||
readonly onConfirm: () => void
|
||||
readonly slug: string
|
||||
}> = ({ slug, onConfirm }) => {
|
||||
const { closeModal } = useModal()
|
||||
const { t } = useTranslation()
|
||||
|
||||
const handleClose = () => closeModal(slug)
|
||||
|
||||
const handleConfirm = () => {
|
||||
handleClose()
|
||||
if (typeof onConfirm === 'function') {
|
||||
onConfirm()
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal className={baseClass} slug={slug}>
|
||||
<div className={`${baseClass}__wrapper`}>
|
||||
<div className={`${baseClass}__content`}>
|
||||
<h1>{t('general:resetPreferences')}?</h1>
|
||||
<p>{t('general:resetPreferencesDescription')}</p>
|
||||
</div>
|
||||
<div className={`${baseClass}__controls`}>
|
||||
<Button buttonStyle="secondary" onClick={handleClose} size="large">
|
||||
{t('general:cancel')}
|
||||
</Button>
|
||||
<Button onClick={handleConfirm} size="large">
|
||||
{t('general:confirm')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
76
packages/next/src/views/Account/ResetPreferences/index.tsx
Normal file
76
packages/next/src/views/Account/ResetPreferences/index.tsx
Normal file
@@ -0,0 +1,76 @@
|
||||
'use client'
|
||||
import type { User } from 'payload'
|
||||
|
||||
import { Button, LoadingOverlay, toast, useModal, useTranslation } from '@payloadcms/ui'
|
||||
import * as qs from 'qs-esm'
|
||||
import { Fragment, useCallback, useState } from 'react'
|
||||
|
||||
import { ConfirmResetModal } from './ConfirmResetModal/index.js'
|
||||
|
||||
const confirmResetModalSlug = 'confirm-reset-modal'
|
||||
|
||||
export const ResetPreferences: React.FC<{
|
||||
readonly apiRoute: string
|
||||
readonly user?: User
|
||||
}> = ({ apiRoute, user }) => {
|
||||
const { openModal } = useModal()
|
||||
const { t } = useTranslation()
|
||||
|
||||
const [loading, setLoading] = useState(false)
|
||||
|
||||
const handleResetPreferences = useCallback(async () => {
|
||||
if (!user || loading) {
|
||||
return
|
||||
}
|
||||
setLoading(true)
|
||||
|
||||
const stringifiedQuery = qs.stringify(
|
||||
{
|
||||
depth: 0,
|
||||
where: {
|
||||
user: {
|
||||
id: {
|
||||
equals: user.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{ addQueryPrefix: true },
|
||||
)
|
||||
|
||||
try {
|
||||
const res = await fetch(`${apiRoute}/payload-preferences${stringifiedQuery}`, {
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: 'DELETE',
|
||||
})
|
||||
|
||||
const json = await res.json()
|
||||
const message = json.message
|
||||
|
||||
if (res.ok) {
|
||||
toast.success(message)
|
||||
} else {
|
||||
toast.error(message)
|
||||
}
|
||||
} catch (e) {
|
||||
// swallow error
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [apiRoute, loading, user])
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<div>
|
||||
<Button buttonStyle="secondary" onClick={() => openModal(confirmResetModalSlug)}>
|
||||
{t('general:resetPreferences')}
|
||||
</Button>
|
||||
</div>
|
||||
<ConfirmResetModal onConfirm={handleResetPreferences} slug={confirmResetModalSlug} />
|
||||
{loading && <LoadingOverlay loadingText={t('general:resettingPreferences')} />}
|
||||
</Fragment>
|
||||
)
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
import type { I18n } from '@payloadcms/translations'
|
||||
import type { Config, LanguageOptions } from 'payload'
|
||||
import type { BasePayload, Config, LanguageOptions, User } from 'payload'
|
||||
|
||||
import { FieldLabel } from '@payloadcms/ui'
|
||||
import React from 'react'
|
||||
|
||||
import { ToggleTheme } from '../ToggleTheme/index.js'
|
||||
import { ResetPreferences } from '../ResetPreferences/index.js'
|
||||
import './index.scss'
|
||||
import { ToggleTheme } from '../ToggleTheme/index.js'
|
||||
import { LanguageSelector } from './LanguageSelector.js'
|
||||
|
||||
const baseClass = 'payload-settings'
|
||||
@@ -14,9 +15,13 @@ export const Settings: React.FC<{
|
||||
readonly className?: string
|
||||
readonly i18n: I18n
|
||||
readonly languageOptions: LanguageOptions
|
||||
readonly payload: BasePayload
|
||||
readonly theme: Config['admin']['theme']
|
||||
readonly user?: User
|
||||
}> = (props) => {
|
||||
const { className, i18n, languageOptions, theme } = props
|
||||
const { className, i18n, languageOptions, payload, theme, user } = props
|
||||
|
||||
const apiRoute = payload.config.routes.api
|
||||
|
||||
return (
|
||||
<div className={[baseClass, className].filter(Boolean).join(' ')}>
|
||||
@@ -26,6 +31,7 @@ export const Settings: React.FC<{
|
||||
<LanguageSelector languageOptions={languageOptions} />
|
||||
</div>
|
||||
{theme === 'all' && <ToggleTheme />}
|
||||
<ResetPreferences apiRoute={apiRoute} user={user} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -111,7 +111,15 @@ export const Account: React.FC<AdminViewProps> = async ({
|
||||
|
||||
return (
|
||||
<DocumentInfoProvider
|
||||
AfterFields={<Settings i18n={i18n} languageOptions={languageOptions} theme={theme} />}
|
||||
AfterFields={
|
||||
<Settings
|
||||
i18n={i18n}
|
||||
languageOptions={languageOptions}
|
||||
payload={payload}
|
||||
theme={theme}
|
||||
user={user}
|
||||
/>
|
||||
}
|
||||
apiURL={`${serverURL}${api}/${userSlug}${user?.id ? `/${user.id}` : ''}`}
|
||||
collectionSlug={userSlug}
|
||||
currentEditor={currentEditor}
|
||||
|
||||
@@ -236,6 +236,9 @@ export const clientTranslationKeys = createClientTranslationKeys([
|
||||
'general:reindexingAll',
|
||||
'general:remove',
|
||||
'general:reset',
|
||||
'general:resetPreferences',
|
||||
'general:resetPreferencesDescription',
|
||||
'general:resettingPreferences',
|
||||
'general:row',
|
||||
'general:rows',
|
||||
'general:save',
|
||||
|
||||
@@ -295,6 +295,10 @@ export const arTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'جاري إعادة فهرسة جميع {{collections}}.',
|
||||
remove: 'إزالة',
|
||||
reset: 'إعادة تعيين',
|
||||
resetPreferences: 'إعادة تعيين التفضيلات',
|
||||
resetPreferencesDescription:
|
||||
'سيؤدي ذلك إلى إعادة تعيين جميع تفضيلاتك إلى الإعدادات الافتراضية.',
|
||||
resettingPreferences: 'إعادة تعيين التفضيلات.',
|
||||
row: 'سطر',
|
||||
rows: 'أسطُر',
|
||||
save: 'حفظ',
|
||||
|
||||
@@ -299,6 +299,9 @@ export const azTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Bütün {{collections}} yenidən indekslənir.',
|
||||
remove: 'Sil',
|
||||
reset: 'Yenidən başlat',
|
||||
resetPreferences: 'Təhlükəsizlik parametrlərini sıfırlamaq',
|
||||
resetPreferencesDescription: 'Bu, bütün parametrlərinizi standart vəziyyətlərinə sıfırlayacaq.',
|
||||
resettingPreferences: 'Təhlükəsizlik parametrləri sıfırlanır.',
|
||||
row: 'Sətir',
|
||||
rows: 'Sətirlər',
|
||||
save: 'Saxla',
|
||||
|
||||
@@ -298,6 +298,10 @@ export const bgTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Преиндексиране на всички {{collections}}.',
|
||||
remove: 'Премахни',
|
||||
reset: 'Нулиране',
|
||||
resetPreferences: 'Нулиране на предпочитанията',
|
||||
resetPreferencesDescription:
|
||||
'Това ще нулира всички ваши предпочитания до техните настройки по подразбиране.',
|
||||
resettingPreferences: 'Нулиране на предпочитанията.',
|
||||
row: 'ред',
|
||||
rows: 'Редове',
|
||||
save: 'Запази',
|
||||
|
||||
@@ -299,6 +299,10 @@ export const caTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Reindexa tots el {{collections}}.',
|
||||
remove: 'Elimina',
|
||||
reset: 'Restableix',
|
||||
resetPreferences: 'Restablir les preferències',
|
||||
resetPreferencesDescription:
|
||||
'Això restablirà totes les teves preferències a les configuracions per defecte.',
|
||||
resettingPreferences: 'Restablint les preferències.',
|
||||
row: 'Fila',
|
||||
rows: 'Files',
|
||||
save: 'Desa',
|
||||
|
||||
@@ -297,6 +297,9 @@ export const csTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Přeindexování všech {{collections}}.',
|
||||
remove: 'Odstranit',
|
||||
reset: 'Resetovat',
|
||||
resetPreferences: 'Obnovit nastavení',
|
||||
resetPreferencesDescription: 'Toto obnoví všechna vaše nastavení na výchozí hodnoty.',
|
||||
resettingPreferences: 'Obnovování nastavení.',
|
||||
row: 'Řádek',
|
||||
rows: 'Řádky',
|
||||
save: 'Uložit',
|
||||
|
||||
@@ -297,6 +297,10 @@ export const daTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Genindekserer alle {{collections}}.',
|
||||
remove: 'Fjern',
|
||||
reset: 'Nulstil',
|
||||
resetPreferences: 'Nulstil præferencer',
|
||||
resetPreferencesDescription:
|
||||
'Dette vil nulstille alle dine præferencer til standardindstillingerne.',
|
||||
resettingPreferences: 'Nulstiller præferencer.',
|
||||
row: 'Række',
|
||||
rows: 'Rækker',
|
||||
save: 'Gem',
|
||||
|
||||
@@ -303,6 +303,9 @@ export const deTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Alle {{collections}} werden neu indiziert.',
|
||||
remove: 'Entfernen',
|
||||
reset: 'Zurücksetzen',
|
||||
resetPreferences: 'Präferenzen zurücksetzen',
|
||||
resetPreferencesDescription: 'Dies setzt alle Ihre Präferenzen auf die Standardwerte zurück.',
|
||||
resettingPreferences: 'Präferenzen werden zurückgesetzt.',
|
||||
row: 'Zeile',
|
||||
rows: 'Zeilen',
|
||||
save: 'Speichern',
|
||||
|
||||
@@ -299,6 +299,10 @@ export const enTranslations = {
|
||||
reindexingAll: 'Reindexing all {{collections}}.',
|
||||
remove: 'Remove',
|
||||
reset: 'Reset',
|
||||
resetPreferences: 'Reset Preferences',
|
||||
resetPreferencesDescription:
|
||||
'This will reset all of your preferences to their default settings.',
|
||||
resettingPreferences: 'Resetting Preferences.',
|
||||
row: 'Row',
|
||||
rows: 'Rows',
|
||||
save: 'Save',
|
||||
|
||||
@@ -303,6 +303,10 @@ export const esTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Reindexando todas las {{collections}}.',
|
||||
remove: 'Remover',
|
||||
reset: 'Reiniciar',
|
||||
resetPreferences: 'Restablecer preferencias',
|
||||
resetPreferencesDescription:
|
||||
'Esto restablecerá todas tus preferencias a la configuración predeterminada.',
|
||||
resettingPreferences: 'Restableciendo preferencias.',
|
||||
row: 'Fila',
|
||||
rows: 'Filas',
|
||||
save: 'Guardar',
|
||||
|
||||
@@ -296,6 +296,9 @@ export const etTranslations = {
|
||||
reindexingAll: 'Indekseerin uuesti kõik {{collections}}.',
|
||||
remove: 'Eemalda',
|
||||
reset: 'Lähtesta',
|
||||
resetPreferences: 'Lähtesta eelistused',
|
||||
resetPreferencesDescription: 'See lähtestab kõik teie eelistused vaikeväärtustele.',
|
||||
resettingPreferences: 'Lähtestan eelistusi.',
|
||||
row: 'Rida',
|
||||
rows: 'Read',
|
||||
save: 'Salvesta',
|
||||
|
||||
@@ -297,6 +297,9 @@ export const faTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'در حال بازایندکس همه {{collections}}.',
|
||||
remove: 'برداشتن',
|
||||
reset: 'بازنشانی',
|
||||
resetPreferences: 'بازنشانی تنظیمات',
|
||||
resetPreferencesDescription: 'این تمام تنظیمات شما را به تنظیمات پیشفرض بازنشانی خواهد کرد.',
|
||||
resettingPreferences: 'در حال بازنشانی تنظیمات.',
|
||||
row: 'ردیف',
|
||||
rows: 'ردیفها',
|
||||
save: 'ذخیره',
|
||||
|
||||
@@ -306,6 +306,10 @@ export const frTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Réindexation de toutes les {{collections}}.',
|
||||
remove: 'Retirer',
|
||||
reset: 'Réinitialiser',
|
||||
resetPreferences: 'Réinitialiser les préférences',
|
||||
resetPreferencesDescription:
|
||||
'Cela réinitialisera toutes vos préférences aux paramètres par défaut.',
|
||||
resettingPreferences: 'Réinitialisation des préférences.',
|
||||
row: 'Ligne',
|
||||
rows: 'Lignes',
|
||||
save: 'Sauvegarder',
|
||||
|
||||
@@ -292,6 +292,9 @@ export const heTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'החזרת אינדקס לכל {{collections}}.',
|
||||
remove: 'הסר',
|
||||
reset: 'איפוס',
|
||||
resetPreferences: 'איפוס העדפות',
|
||||
resetPreferencesDescription: 'זאת תאפס את כל ההעדפות שלך להגדרות ברירת המחדל.',
|
||||
resettingPreferences: 'מאפס העדפות.',
|
||||
row: 'שורה',
|
||||
rows: 'שורות',
|
||||
save: 'שמירה',
|
||||
|
||||
@@ -299,6 +299,9 @@ export const hrTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Ponovno indeksiranje svih {{collections}}.',
|
||||
remove: 'Ukloni',
|
||||
reset: 'Ponovno postavi',
|
||||
resetPreferences: 'Ponovno postavljanje postavki',
|
||||
resetPreferencesDescription: 'Ovo će vratiti sve vaše postavke na zadane vrijednosti.',
|
||||
resettingPreferences: 'Ponovno postavljanje postavki.',
|
||||
row: 'Red',
|
||||
rows: 'Redovi',
|
||||
save: 'Spremi',
|
||||
|
||||
@@ -301,6 +301,10 @@ export const huTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Az összes {{collections}} újraindexálása folyamatban.',
|
||||
remove: 'Törlés',
|
||||
reset: 'Visszaállítás',
|
||||
resetPreferences: 'Beállítások visszaállítása',
|
||||
resetPreferencesDescription:
|
||||
'Ez visszaállítja az összes beállítást az alapértelmezett értékekre.',
|
||||
resettingPreferences: 'Beállítások visszaállítása.',
|
||||
row: 'Sor',
|
||||
rows: 'Sorok',
|
||||
save: 'Mentés',
|
||||
|
||||
@@ -302,6 +302,10 @@ export const itTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: "Rifacendo l'indice di tutte le {{collections}}.",
|
||||
remove: 'Rimuovi',
|
||||
reset: 'Ripristina',
|
||||
resetPreferences: 'Ripristina le preferenze',
|
||||
resetPreferencesDescription:
|
||||
'Questo ripristinerà tutte le tue preferenze alle impostazioni predefinite.',
|
||||
resettingPreferences: 'Ripristinando le preferenze.',
|
||||
row: 'Riga',
|
||||
rows: 'Righe',
|
||||
save: 'Salva',
|
||||
|
||||
@@ -299,6 +299,9 @@ export const jaTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'すべての{{collections}}を再インデックスしています。',
|
||||
remove: '削除',
|
||||
reset: 'リセット',
|
||||
resetPreferences: '設定をリセット',
|
||||
resetPreferencesDescription: 'これにより、すべての設定がデフォルト設定にリセットされます。',
|
||||
resettingPreferences: '設定をリセットしています。',
|
||||
row: '列',
|
||||
rows: '列',
|
||||
save: '保存',
|
||||
|
||||
@@ -297,6 +297,9 @@ export const koTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: '모든 {{collections}}를 다시 인덱싱하는 중입니다.',
|
||||
remove: '제거',
|
||||
reset: '초기화',
|
||||
resetPreferences: '기본 설정으로 재설정',
|
||||
resetPreferencesDescription: '이렇게 하면 모든 기본 설정이 기본값으로 재설정됩니다.',
|
||||
resettingPreferences: '기본 설정을 재설정하는 중.',
|
||||
row: '행',
|
||||
rows: '행',
|
||||
save: '저장',
|
||||
|
||||
@@ -301,6 +301,10 @@ export const myTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'အပေါ် {{collections}} အားလုံးကို ထပ်လိပ်နေပါသည်။',
|
||||
remove: 'ဖယ်ရှားမည်။',
|
||||
reset: 'Tetapkan semula',
|
||||
resetPreferences: 'ကြိုတင်သတ်မှတ်ချက်များ ပြန်လည်တပ်ဆင်မည်',
|
||||
resetPreferencesDescription:
|
||||
'ဤသည်သည် သင့်၏အကြိုက်များအားလုံးကို အခြားတပ်ဆင်မှုများမှ ပြန်လည်သတ်မှတ်ပေးပါလိမ့်မည်။',
|
||||
resettingPreferences: 'ကြိုတင်သတ်မှတ်ချက်များ ပြန်လည်တပ်ဆင်နေပါသည်။',
|
||||
row: 'အတန်း',
|
||||
rows: 'Rows',
|
||||
save: 'သိမ်းဆည်းမည်။',
|
||||
|
||||
@@ -299,6 +299,10 @@ export const nbTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Reindekserer alle {{collections}}.',
|
||||
remove: 'Fjern',
|
||||
reset: 'Tilbakestill',
|
||||
resetPreferences: 'Tilbakestill preferanser',
|
||||
resetPreferencesDescription:
|
||||
'Dette vil tilbakestille alle preferansene dine til standardinnstillingene.',
|
||||
resettingPreferences: 'Tilbakestiller preferanser.',
|
||||
row: 'Rad',
|
||||
rows: 'Rader',
|
||||
save: 'Lagre',
|
||||
|
||||
@@ -302,6 +302,10 @@ export const nlTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Bezig met het opnieuw indexeren van alle {{collections}}.',
|
||||
remove: 'Verwijderen',
|
||||
reset: 'Resetten',
|
||||
resetPreferences: 'Voorkeuren resetten',
|
||||
resetPreferencesDescription:
|
||||
'Dit zal al je voorkeuren terugzetten naar de standaardinstellingen.',
|
||||
resettingPreferences: 'Voorkeuren worden gereset.',
|
||||
row: 'Rij',
|
||||
rows: 'Rijen',
|
||||
save: 'Bewaar',
|
||||
|
||||
@@ -299,6 +299,9 @@ export const plTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Ponowne indeksowanie wszystkich {{collections}}.',
|
||||
remove: 'Usuń',
|
||||
reset: 'Zresetuj',
|
||||
resetPreferences: 'Zresetuj preferencje',
|
||||
resetPreferencesDescription: 'To zresetuje wszystkie Twoje preferencje do ustawień domyślnych.',
|
||||
resettingPreferences: 'Resetowanie preferencji.',
|
||||
row: 'Wiersz',
|
||||
rows: 'Wiersze',
|
||||
save: 'Zapisz',
|
||||
|
||||
@@ -299,6 +299,10 @@ export const ptTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Reindexando todas as {{collections}}.',
|
||||
remove: 'Remover',
|
||||
reset: 'Redefinir',
|
||||
resetPreferences: 'Redefinir preferências',
|
||||
resetPreferencesDescription:
|
||||
'Isso redefinirá todas as suas preferências para as configurações padrão.',
|
||||
resettingPreferences: 'Redefinindo preferências.',
|
||||
row: 'Linha',
|
||||
rows: 'Linhas',
|
||||
save: 'Salvar',
|
||||
|
||||
@@ -303,6 +303,9 @@ export const roTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Reindexarea tuturor {{collections}}.',
|
||||
remove: 'Eliminați',
|
||||
reset: 'Resetare',
|
||||
resetPreferences: 'Resetare preferințe',
|
||||
resetPreferencesDescription: 'Aceasta va reseta toate preferințele tale la setările implicite.',
|
||||
resettingPreferences: 'Resetare preferințe.',
|
||||
row: 'Rând',
|
||||
rows: 'Rânduri',
|
||||
save: 'Salvează',
|
||||
|
||||
@@ -299,6 +299,9 @@ export const rsTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Ponovno indeksiranje svih {{collections}}.',
|
||||
remove: 'Уклони',
|
||||
reset: 'Поново постави',
|
||||
resetPreferences: 'Поништи подешавања',
|
||||
resetPreferencesDescription: 'Ово ће поништити сва ваша подешавања на подразумеване вредности.',
|
||||
resettingPreferences: 'Поништавање подешавања.',
|
||||
row: 'Ред',
|
||||
rows: 'Редови',
|
||||
save: 'Сачувај',
|
||||
|
||||
@@ -299,6 +299,10 @@ export const rsLatinTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Ponovno indeksiranje svih {{collections}}.',
|
||||
remove: 'Ukloni',
|
||||
reset: 'Ponovo postavi',
|
||||
resetPreferences: 'Poništi podešavanja',
|
||||
resetPreferencesDescription:
|
||||
'Ovo će poništiti sva vaša podešavanja na podrazumevane vrednosti.',
|
||||
resettingPreferences: 'Poništavanje podešavanja.',
|
||||
row: 'Red',
|
||||
rows: 'Redovi',
|
||||
save: 'Sačuvaj',
|
||||
|
||||
@@ -301,6 +301,9 @@ export const ruTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Переиндексирование всех {{collections}}.',
|
||||
remove: 'Удалить',
|
||||
reset: 'Сброс',
|
||||
resetPreferences: 'Сбросить настройки',
|
||||
resetPreferencesDescription: 'Это сбросит все ваши настройки до значений по умолчанию.',
|
||||
resettingPreferences: 'Сброс настроек.',
|
||||
row: 'Строка',
|
||||
rows: 'Строки',
|
||||
save: 'Сохранить',
|
||||
|
||||
@@ -300,6 +300,9 @@ export const skTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Znova sa indexujú všetky {{collections}}.',
|
||||
remove: 'Odstrániť',
|
||||
reset: 'Resetovať',
|
||||
resetPreferences: 'Obnoviť nastavenia',
|
||||
resetPreferencesDescription: 'Týmto sa všetky vaše nastavenia vrátia na predvolené hodnoty.',
|
||||
resettingPreferences: 'Obnovovanie nastavení.',
|
||||
row: 'Riadok',
|
||||
rows: 'Riadky',
|
||||
save: 'Uložiť',
|
||||
|
||||
@@ -298,6 +298,9 @@ export const slTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Ponovno indeksiranje vseh {{collections}}.',
|
||||
remove: 'Odstrani',
|
||||
reset: 'Ponastavi',
|
||||
resetPreferences: 'Ponastavi nastavitve',
|
||||
resetPreferencesDescription: 'To bo ponastavilo vse vaše nastavitve na privzete vrednosti.',
|
||||
resettingPreferences: 'Ponastavitev nastavitve.',
|
||||
row: 'Vrstica',
|
||||
rows: 'Vrstice',
|
||||
save: 'Shrani',
|
||||
|
||||
@@ -299,6 +299,10 @@ export const svTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Omindexerar alla {{collections}}.',
|
||||
remove: 'Ta bort',
|
||||
reset: 'Återställ',
|
||||
resetPreferences: 'Återställ preferenser',
|
||||
resetPreferencesDescription:
|
||||
'Detta kommer att återställa alla dina preferenser till standardinställningarna.',
|
||||
resettingPreferences: 'Återställer preferenser.',
|
||||
row: 'Rad',
|
||||
rows: 'Rader',
|
||||
save: 'Spara',
|
||||
|
||||
@@ -295,6 +295,9 @@ export const thTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'กำลังทำการจัดทำดัชนีใหม่ทั้งหมดใน {{collections}}.',
|
||||
remove: 'ลบ',
|
||||
reset: 'รีเซ็ต',
|
||||
resetPreferences: 'รีเซ็ตการตั้งค่า',
|
||||
resetPreferencesDescription: 'การกระทำนี้จะรีเซ็ตการตั้งค่าทั้งหมดของคุณเป็นค่าเริ่มต้น',
|
||||
resettingPreferences: 'กำลังรีเซ็ตการตั้งค่า',
|
||||
row: 'แถว',
|
||||
rows: 'แถว',
|
||||
save: 'บันทึก',
|
||||
|
||||
@@ -302,6 +302,10 @@ export const trTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Tüm {{collections}} yeniden dizine alınıyor.',
|
||||
remove: 'Kaldır',
|
||||
reset: 'Sıfırla',
|
||||
resetPreferences: 'Tercihleri sıfırla',
|
||||
resetPreferencesDescription:
|
||||
'Bu, tüm tercihlerinizin varsayılan ayarlara sıfırlanmasını sağlar.',
|
||||
resettingPreferences: 'Tercihler sıfırlanıyor.',
|
||||
row: 'Satır',
|
||||
rows: 'Satır',
|
||||
save: 'Kaydet',
|
||||
|
||||
@@ -298,6 +298,9 @@ export const ukTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Перебудова індексів для всіх {{collections}}.',
|
||||
remove: 'Видалити',
|
||||
reset: 'Скидання',
|
||||
resetPreferences: 'Скинути налаштування',
|
||||
resetPreferencesDescription: 'Це скине всі ваші налаштування до значень за замовчуванням.',
|
||||
resettingPreferences: 'Скидання налаштувань.',
|
||||
row: 'Рядок',
|
||||
rows: 'Рядки',
|
||||
save: 'Зберегти',
|
||||
|
||||
@@ -298,6 +298,9 @@ export const viTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: 'Đang tái lập chỉ mục tất cả {{collections}}.',
|
||||
remove: 'Loại bỏ',
|
||||
reset: 'Đặt lại',
|
||||
resetPreferences: 'Đặt lại sở thích',
|
||||
resetPreferencesDescription: 'Điều này sẽ đặt lại tất cả sở thích của bạn về cài đặt mặc định.',
|
||||
resettingPreferences: 'Đang đặt lại sở thích.',
|
||||
row: 'Hàng',
|
||||
rows: 'Những hàng',
|
||||
save: 'Luu',
|
||||
|
||||
@@ -288,6 +288,9 @@ export const zhTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: '正在重新索引所有{{collections}}。',
|
||||
remove: '移除',
|
||||
reset: '重置',
|
||||
resetPreferences: '重置偏好设置',
|
||||
resetPreferencesDescription: '这将把您的所有偏好设置恢复为默认值。',
|
||||
resettingPreferences: '正在重置偏好设置。',
|
||||
row: '行',
|
||||
rows: '行',
|
||||
save: '保存',
|
||||
|
||||
@@ -288,6 +288,9 @@ export const zhTwTranslations: DefaultTranslationsObject = {
|
||||
reindexingAll: '正在重新索引所有{{collections}}。',
|
||||
remove: '移除',
|
||||
reset: '重設',
|
||||
resetPreferences: '重設偏好設定',
|
||||
resetPreferencesDescription: '這將把您的所有偏好設定恢復為預設值。',
|
||||
resettingPreferences: '正在重設偏好設定。',
|
||||
row: '行',
|
||||
rows: '行',
|
||||
save: '儲存',
|
||||
|
||||
@@ -922,6 +922,22 @@ describe('General', () => {
|
||||
await expect(modalContainer).toHaveClass(/payload__modal-container--exitDone/)
|
||||
})
|
||||
})
|
||||
|
||||
describe('preferences', () => {
|
||||
test('should successfully reset prefs after clicking reset button', async () => {
|
||||
await page.goto(`${serverURL}/admin/account`)
|
||||
const resetPrefsButton = page.locator('.payload-settings > div > button.btn')
|
||||
await expect(resetPrefsButton).toBeVisible()
|
||||
await resetPrefsButton.click()
|
||||
const confirmModal = page.locator('dialog#confirm-reset-modal')
|
||||
await expect(confirmModal).toBeVisible()
|
||||
const confirmButton = confirmModal.locator('button.btn--style-primary')
|
||||
await expect(confirmButton).toContainText('Confirm')
|
||||
await confirmButton.click()
|
||||
const toast = page.locator('li.payload-toast-item.toast-success')
|
||||
await expect(toast).toBeVisible()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
async function deleteAllPosts() {
|
||||
|
||||
Reference in New Issue
Block a user