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
|
|
@ -15,13 +15,13 @@ const initialValues = {
|
|||
password: '',
|
||||
};
|
||||
|
||||
const validate = ({ user_id, username, password }) => {
|
||||
const validate = ({ userId, username, password }) => {
|
||||
const errors = {};
|
||||
|
||||
if (!username) {
|
||||
errors.username = <FormattedMessage id="label.required" defaultMessage="Required" />;
|
||||
}
|
||||
if (!user_id && !password) {
|
||||
if (!userId && !password) {
|
||||
errors.password = <FormattedMessage id="label.required" defaultMessage="Required" />;
|
||||
}
|
||||
|
||||
|
|
@ -33,8 +33,8 @@ export default function AccountEditForm({ values, onSave, onClose }) {
|
|||
const [message, setMessage] = useState();
|
||||
|
||||
const handleSubmit = async values => {
|
||||
const { user_id } = values;
|
||||
const { ok, data } = await post(user_id ? `/accounts/${user_id}` : '/accounts', values);
|
||||
const { userId } = values;
|
||||
const { ok, data } = await post(userId ? `/accounts/${userId}` : '/accounts', values);
|
||||
|
||||
if (ok) {
|
||||
onSave();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export default function ChangePasswordForm({ values, onSave, onClose }) {
|
|||
const { user } = useUser();
|
||||
|
||||
const handleSubmit = async values => {
|
||||
const { ok, data } = await post(`/accounts/${user.user_id}/password`, values);
|
||||
const { ok, data } = await post(`/accounts/${user.userId}/password`, values);
|
||||
|
||||
if (ok) {
|
||||
onSave();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import CopyButton from 'components/common/CopyButton';
|
|||
export default function TrackingCodeForm({ values, onClose }) {
|
||||
const ref = useRef();
|
||||
const { basePath } = useRouter();
|
||||
const { name, share_id } = values;
|
||||
const { name, shareId } = values;
|
||||
|
||||
return (
|
||||
<FormLayout>
|
||||
|
|
@ -27,7 +27,7 @@ export default function TrackingCodeForm({ values, onClose }) {
|
|||
spellCheck={false}
|
||||
defaultValue={`${
|
||||
document.location.origin
|
||||
}${basePath}/share/${share_id}/${encodeURIComponent(name)}`}
|
||||
}${basePath}/share/${shareId}/${encodeURIComponent(name)}`}
|
||||
readOnly
|
||||
/>
|
||||
</FormRow>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export default function TrackingCodeForm({ values, onClose }) {
|
|||
rows={3}
|
||||
cols={60}
|
||||
spellCheck={false}
|
||||
defaultValue={`<script async defer data-website-id="${values.website_uuid}" src="${
|
||||
defaultValue={`<script async defer data-website-id="${values.websiteUuid}" src="${
|
||||
document.location.origin
|
||||
}${basePath}/${trackerScriptName ? `${trackerScriptName}.js` : 'umami.js'}"></script>`}
|
||||
readOnly
|
||||
|
|
|
|||
|
|
@ -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