Skip to content

Commit 7b7d989

Browse files
committed
Add installation steps
1 parent 147ac5b commit 7b7d989

17 files changed

+195
-48
lines changed

docs_headless/src/content/docs/LockStatusBase.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22
title: "<LockStatusBase>"
33
---
44

5-
**Tip**: `ra-core-ee` is part of the [React-Admin Enterprise Edition](https://marmelab.com/ra-enterprise/), and hosted in a private npm registry. You need to subscribe to one of the Enterprise Edition plans to access this package.
5+
`<LockStatusBase>` displays the lock status of the current record. It allows to visually indicate whether the record is locked or not, by the current user or not, and provides an easy way to lock or unlock the record.
66

7-
Use the `<LockStatusBase>` component to display the lock status of the record in the nearest `RecordContext`:
7+
This feature requires a valid [Enterprise Edition](https://marmelab.com/ra-enterprise/) subscription.
8+
9+
## Installation
10+
11+
```bash
12+
npm install --save @react-admin/ra-core-ee
13+
# or
14+
yarn add @react-admin/ra-core-ee
15+
```
16+
17+
## Usage
818

919
```tsx
1020
import React from 'react';

docs_headless/src/content/docs/useGetListLive.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22
title: "useGetListLive"
33
---
44

5-
**Tip**: `ra-core-ee` is part of the [React-Admin Enterprise Edition](https://marmelab.com/ra-enterprise/), and hosted in a private npm registry. You need to subscribe to one of the Enterprise Edition plans to access this package.
5+
`useGetListLive` is an alternative to `useGetList` that subscribes to live updates on the record list.
66

7-
Alternative to `useGetList` that subscribes to live updates on the record list.
7+
This feature requires a valid [Enterprise Edition](https://marmelab.com/ra-enterprise/) subscription.
8+
9+
## Installation
10+
11+
```bash
12+
npm install --save @react-admin/ra-core-ee
13+
# or
14+
yarn add @react-admin/ra-core-ee
15+
```
16+
17+
## Usage
818

919
```tsx
1020
import { useGetListLive } from '@react-admin/ra-core-ee';

docs_headless/src/content/docs/useGetLock.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
title: "useGetLock"
33
---
44

5-
**Tip**: `ra-core-ee` is part of the [React-Admin Enterprise Edition](https://marmelab.com/ra-enterprise/), and hosted in a private npm registry. You need to subscribe to one of the Enterprise Edition plans to access this package.
5+
A hook that gets the lock status for a record. It calls `dataProvider.getLock()` on mount.
66

7-
Gets the lock status for a record. It calls `dataProvider.getLock()` on mount.
7+
This feature requires a valid [Enterprise Edition](https://marmelab.com/ra-enterprise/) subscription.
88

9-
```tsx
10-
const { data, isLoading } = useGetLock(resource, { id });
11-
```
9+
## Installation
1210

13-
Parameters description:
11+
```bash
12+
npm install --save @react-admin/ra-core-ee
13+
# or
14+
yarn add @react-admin/ra-core-ee
15+
```
1416

15-
- `resource`: the resource name (e.g. `'posts'`)
16-
- `params`: an object with the following properties:
17-
- `id`: the record id (e.g. `123`)
18-
- `meta`: Optional. an object that will be forwarded to the dataProvider (optional)
17+
## Usage
1918

2019
Here is a form toolbar that displays the lock status of the current record:
2120

@@ -45,4 +44,11 @@ const FormToolbar = () => {
4544
</div>
4645
);
4746
};
48-
```
47+
```
48+
49+
## Parameters
50+
51+
- `resource`: the resource name (e.g. `'posts'`)
52+
- `params`: an object with the following properties:
53+
- `id`: the record id (e.g. `123`)
54+
- `meta`: Optional. an object that will be forwarded to the dataProvider (optional)

docs_headless/src/content/docs/useGetLockLive.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@
22
title: "useGetLockLive"
33
---
44

5-
**Tip**: `ra-core-ee` is part of the [React-Admin Enterprise Edition](https://marmelab.com/ra-enterprise/), and hosted in a private npm registry. You need to subscribe to one of the Enterprise Edition plans to access this package.
5+
A hook that gets the lock status for a record in real time.
6+
7+
This feature requires a valid [Enterprise Edition](https://marmelab.com/ra-enterprise/) subscription.
8+
9+
## Installation
10+
11+
```bash
12+
npm install --save @react-admin/ra-core-ee
13+
# or
14+
yarn add @react-admin/ra-core-ee
15+
```
16+
17+
## Usage
618

719
Use the `useGetLockLive()` hook to get the lock status in real time. This hook calls `dataProvider.getLock()` for the current record on mount, and subscribes to live updates on the `lock/[resource]/[id]` topic.
820

docs_headless/src/content/docs/useGetLocks.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22
title: "useGetLocks"
33
---
44

5-
**Tip**: `ra-core-ee` is part of the [React-Admin Enterprise Edition](https://marmelab.com/ra-enterprise/), and hosted in a private npm registry. You need to subscribe to one of the Enterprise Edition plans to access this package.
5+
A hook that gets all the locks for a given resource. Calls `dataProvider.getLocks()` on mount.
66

7-
Get all the locks for a given resource. Calls `dataProvider.getLocks()` on mount.
7+
This feature requires a valid [Enterprise Edition](https://marmelab.com/ra-enterprise/) subscription.
88

9-
```tsx
10-
// simple Usage
11-
const { data } = useGetLocks('posts');
9+
## Installation
10+
11+
```bash
12+
npm install --save @react-admin/ra-core-ee
13+
# or
14+
yarn add @react-admin/ra-core-ee
1215
```
1316

17+
## Usage
18+
1419
Here is how to use it in a custom list, to disable edit and delete buttons for locked records:
1520

1621
```tsx

docs_headless/src/content/docs/useGetLocksLive.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,31 @@
22
title: "useGetLocksLive"
33
---
44

5-
**Tip**: `ra-core-ee` is part of the [React-Admin Enterprise Edition](https://marmelab.com/ra-enterprise/), and hosted in a private npm registry. You need to subscribe to one of the Enterprise Edition plans to access this package.
5+
Use the `useGetLocksLive` hook to get all the locks for a resource in real time.
66

7-
Use the `useGetLocksLive` hook to get the locks in real time. This hook calls `dataProvider.getLocks()` for the current resource on mount, and subscribes to live updates on the `lock/[resource]` topic.
7+
This feature requires a valid [Enterprise Edition](https://marmelab.com/ra-enterprise/) subscription.
88

9+
## Installation
10+
11+
```bash
12+
npm install --save @react-admin/ra-core-ee
13+
# or
14+
yarn add @react-admin/ra-core-ee
15+
```
16+
17+
## Usage
18+
19+
This hook calls `dataProvider.getLocks()` for the current resource on mount, and subscribes to live updates on the `lock/[resource]` topic.
920
This means that if a lock is acquired or released by another user while the current user is on the page, the return value will be updated.
1021

1122
```tsx
1223
import { useRecordContext } from 'ra-core';
1324
import { useGetLocksLive } from '@react-admin/ra-core-ee';
1425
import { Lock } from 'lucide-react';
1526

16-
export const LockField = ({ locks }) => {
27+
export const LockField = () => {
1728
const record = useRecordContext();
29+
const locks = useGetLocksLive();
1830
if (!record) return null;
1931
const lock = locks?.find(lock => lock.recordId === record?.id);
2032
if (!lock) return <span className="w-4 h-4" />;

docs_headless/src/content/docs/useGetOneLive.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22
title: "useGetOneLive"
33
---
44

5-
**Tip**: `ra-core-ee` is part of the [React-Admin Enterprise Edition](https://marmelab.com/ra-enterprise/), and hosted in a private npm registry. You need to subscribe to one of the Enterprise Edition plans to access this package.
5+
An alternative to `useGetOne()` that subscribes to live updates on the record
66

7-
Alternative to `useGetOne()` that subscribes to live updates on the record
7+
This feature requires a valid [Enterprise Edition](https://marmelab.com/ra-enterprise/) subscription.
8+
9+
## Installation
10+
11+
```bash
12+
npm install --save @react-admin/ra-core-ee
13+
# or
14+
yarn add @react-admin/ra-core-ee
15+
```
16+
17+
## Usage
818

919
```tsx
1020
import { useRecordContext } from 'ra-core';

docs_headless/src/content/docs/useLock.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22
title: "useLock"
33
---
44

5-
**Tip**: `ra-core-ee` is part of the [React-Admin Enterprise Edition](https://marmelab.com/ra-enterprise/), and hosted in a private npm registry. You need to subscribe to one of the Enterprise Edition plans to access this package.
6-
75
`useLock` is a low-level hook that returns a callback to call `dataProvider.lock()`, leveraging react-query's `useMutation`.
86

7+
This feature requires a valid [Enterprise Edition](https://marmelab.com/ra-enterprise/) subscription.
8+
9+
## Installation
10+
11+
```bash
12+
npm install --save @react-admin/ra-core-ee
13+
# or
14+
yarn add @react-admin/ra-core-ee
15+
```
16+
17+
## Usage
18+
919
```tsx
1020
const [lock, { isLoading, error }] = useLock(
1121
resource,

docs_headless/src/content/docs/useLockCallbacks.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
---
22
title: "useLockCallbacks"
33
---
4+
This utility hook allows to easily get the callbacks to **lock** and **unlock** a record, as well as the current **lock status**.
45

5-
**Tip**: `ra-core-ee` is part of the [React-Admin Enterprise Edition](https://marmelab.com/ra-enterprise/), and hosted in a private npm registry. You need to subscribe to one of the Enterprise Edition plans to access this package.
6+
This feature requires a valid [Enterprise Edition](https://marmelab.com/ra-enterprise/) subscription.
67

7-
This utility hook allows to easily get the callbacks to **lock** and **unlock** a record, as well as the current **lock status**.
8+
## Installation
9+
10+
```bash
11+
npm install --save @react-admin/ra-core-ee
12+
# or
13+
yarn add @react-admin/ra-core-ee
14+
```
815

916
## Usage
1017

docs_headless/src/content/docs/useLockOnCall.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@
22
title: "useLockOnCall"
33
---
44

5-
**Tip**: `ra-core-ee` is part of the [React-Admin Enterprise Edition](https://marmelab.com/ra-enterprise/), and hosted in a private npm registry. You need to subscribe to one of the Enterprise Edition plans to access this package.
6-
7-
Get a callback to lock a record and get a mutation state.
8-
5+
A hook that gets a callback to lock a record and its mutation state.
96
`useLockOnCall` calls `dataProvider.lock()` when the callback is called. It relies on `authProvider.getIdentity()` to get the identity of the current user. It guesses the current `resource` and `recordId` from the context (or the route) if not provided. It releases the lock when the component unmounts by calling `dataProvider.unlock()`.
107

118
<video controls autoplay playsinline muted loop>
129
<source src="https://react-admin-ee.marmelab.com/assets/useLockOnCall.mp4" type="video/mp4"/>
1310
Your browser does not support the video tag.
1411
</video>
1512

13+
This feature requires a valid [Enterprise Edition](https://marmelab.com/ra-enterprise/) subscription.
14+
15+
## Installation
16+
17+
```bash
18+
npm install --save @react-admin/ra-core-ee
19+
# or
20+
yarn add @react-admin/ra-core-ee
21+
```
22+
1623
## Usage
1724

1825
Use this hook in a toolbar, to let the user lock the record manually.

0 commit comments

Comments
 (0)