mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Feat/um 62 prisma property names (#1562)
* checkpoint * fix pg schema * fix mysql schema * change property names
This commit is contained in:
parent
36edbe2f4c
commit
78338205a3
65 changed files with 431 additions and 433 deletions
|
|
@ -14,7 +14,6 @@ import useApi from 'hooks/useApi';
|
|||
import useFetch from 'hooks/useFetch';
|
||||
import useUser from 'hooks/useUser';
|
||||
import styles from './WebsiteEditForm.module.css';
|
||||
import { getRandomChars } from 'next-basics';
|
||||
|
||||
const initialValues = {
|
||||
name: '',
|
||||
|
|
@ -42,14 +41,14 @@ const OwnerDropDown = ({ user, accounts }) => {
|
|||
const { setFieldValue, values } = useFormikContext();
|
||||
|
||||
useEffect(() => {
|
||||
if (values.user_id != null && values.owner === '') {
|
||||
setFieldValue('owner', values.user_id.toString());
|
||||
} else if (user?.user_id && values.owner === '') {
|
||||
setFieldValue('owner', user.user_id.toString());
|
||||
if (values.userId != null && values.owner === '') {
|
||||
setFieldValue('owner', values.userId.toString());
|
||||
} else if (user?.id && values.owner === '') {
|
||||
setFieldValue('owner', user.id.toString());
|
||||
}
|
||||
}, [accounts, setFieldValue, user, values]);
|
||||
|
||||
if (user?.is_admin) {
|
||||
if (user?.isAdmin) {
|
||||
return (
|
||||
<FormRow>
|
||||
<label htmlFor="owner">
|
||||
|
|
@ -58,7 +57,7 @@ const OwnerDropDown = ({ user, accounts }) => {
|
|||
<div>
|
||||
<Field as="select" name="owner" className={styles.dropdown}>
|
||||
{accounts?.map(acc => (
|
||||
<option key={acc.user_id} value={acc.user_id}>
|
||||
<option key={acc.id} value={acc.id}>
|
||||
{acc.username}
|
||||
</option>
|
||||
))}
|
||||
|
|
@ -79,11 +78,9 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
|
|||
const [message, setMessage] = useState();
|
||||
|
||||
const handleSubmit = async values => {
|
||||
const { website_id, enable_share_url, share_id } = values;
|
||||
if (enable_share_url) {
|
||||
values.share_id = share_id || getRandomChars(8);
|
||||
}
|
||||
const { ok, data } = await post(website_id ? `/websites/${website_id}` : '/websites', values);
|
||||
const { id: websiteId } = values;
|
||||
|
||||
const { ok, data } = await post(websiteId ? `/websites/${websiteId}` : '/websites', values);
|
||||
|
||||
if (ok) {
|
||||
onSave();
|
||||
|
|
@ -97,7 +94,7 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
|
|||
return (
|
||||
<FormLayout>
|
||||
<Formik
|
||||
initialValues={{ ...initialValues, ...values, enable_share_url: !!values?.share_id }}
|
||||
initialValues={{ ...initialValues, ...values, enable_share_url: !!values?.shareId }}
|
||||
validate={validate}
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
|
|
@ -121,9 +118,9 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
|
|||
name="domain"
|
||||
type="text"
|
||||
placeholder="example.com"
|
||||
spellcheck="false"
|
||||
autocapitalize="off"
|
||||
autocorrect="off"
|
||||
spellCheck="false"
|
||||
autoCapitalize="off"
|
||||
autoCorrect="off"
|
||||
/>
|
||||
<FormError name="domain" />
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue