mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 22:27:16 +01:00
Enable public website sharing.
This commit is contained in:
parent
48a524e09c
commit
560f1316c1
36 changed files with 294 additions and 61 deletions
|
|
@ -49,7 +49,7 @@ export default function DeleteForm({ values, onSave, onClose }) {
|
|||
Type <b>DELETE</b> in the box below to confirm.
|
||||
</p>
|
||||
<FormRow>
|
||||
<Field name="confirmation" />
|
||||
<Field name="confirmation" type="text" />
|
||||
<FormError name="confirmation" />
|
||||
</FormRow>
|
||||
<FormButtons>
|
||||
|
|
|
|||
30
components/forms/ShareUrlForm.js
Normal file
30
components/forms/ShareUrlForm.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import React, { useRef } from 'react';
|
||||
import Button from 'components/common/Button';
|
||||
import FormLayout, { FormButtons, FormRow } from 'components/layout/FormLayout';
|
||||
import CopyButton from '../common/CopyButton';
|
||||
|
||||
export default function TrackingCodeForm({ values, onClose }) {
|
||||
const ref = useRef();
|
||||
const { name, share_id } = values;
|
||||
|
||||
return (
|
||||
<FormLayout>
|
||||
<p>
|
||||
This is the public URL for <b>{values.name}</b>.
|
||||
</p>
|
||||
<FormRow>
|
||||
<textarea
|
||||
ref={ref}
|
||||
rows={3}
|
||||
cols={60}
|
||||
defaultValue={`${document.location.origin}/share/${share_id}/${name}`}
|
||||
readOnly
|
||||
/>
|
||||
</FormRow>
|
||||
<FormButtons>
|
||||
<CopyButton type="submit" variant="action" element={ref} />
|
||||
<Button onClick={onClose}>Cancel</Button>
|
||||
</FormButtons>
|
||||
</FormLayout>
|
||||
);
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ import Button from 'components/common/Button';
|
|||
import FormLayout, { FormButtons, FormRow } from 'components/layout/FormLayout';
|
||||
import CopyButton from '../common/CopyButton';
|
||||
|
||||
export default function WebsiteCodeForm({ values, onClose }) {
|
||||
export default function TrackingCodeForm({ values, onClose }) {
|
||||
const ref = useRef();
|
||||
|
||||
return (
|
||||
|
|
@ -8,10 +8,12 @@ import FormLayout, {
|
|||
FormMessage,
|
||||
FormRow,
|
||||
} from 'components/layout/FormLayout';
|
||||
import Checkbox from '../common/Checkbox';
|
||||
|
||||
const initialValues = {
|
||||
name: '',
|
||||
domain: '',
|
||||
public: false,
|
||||
};
|
||||
|
||||
const validate = ({ name, domain }) => {
|
||||
|
|
@ -43,7 +45,7 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
|
|||
return (
|
||||
<FormLayout>
|
||||
<Formik
|
||||
initialValues={{ ...initialValues, ...values }}
|
||||
initialValues={{ ...initialValues, ...values, make_public: !!values?.share_id }}
|
||||
validate={validate}
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
|
|
@ -59,6 +61,12 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
|
|||
<Field name="domain" type="text" />
|
||||
<FormError name="domain" />
|
||||
</FormRow>
|
||||
<FormRow>
|
||||
<label></label>
|
||||
<Field name="make_public">
|
||||
{({ field }) => <Checkbox {...field} label="Make public" />}
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FormButtons>
|
||||
<Button type="submit" variant="action">
|
||||
Save
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue