This repository was archived by the owner on Apr 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathdev.js
62 lines (57 loc) · 1.61 KB
/
dev.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { Button } from "./components/Common/Button/Button";
const API_GATEWAY = process.env.API_GATEWAY || process.env.NX_API_GATEWAY;
const LS_ACCESS_TOKEN = process.env.LS_ACCESS_TOKEN || process.env.NX_LS_ACCESS_TOKEN;
/**
* @param {import("../src/sdk/dm-sdk").DataManager} DataManager
*/
export const initDevApp = async (DataManager) => {
const gatewayAPI = API_GATEWAY ?? "http://localhost:8081/api/dm";
const useExternalSource = !!gatewayAPI;
const dm = new DataManager({
root: document.getElementById("app"),
toolbar: "actions columns filters ordering review-button label-button loading-possum error-box | refresh view-toggle",
apiGateway: gatewayAPI,
apiVersion: 2,
apiMockDisabled: useExternalSource,
apiHeaders: {
Authorization: `Token ${LS_ACCESS_TOKEN}`,
},
interfaces: {
groundTruth: true,
},
labelStudio: {
user: {
pk: 1,
firstName: "James",
lastName: "Dean",
},
},
table: {
hiddenColumns: {
explore: ["tasks:completed_at", "tasks:data"],
},
visibleColumns: {
labeling: [
"tasks:id",
"tasks:was_cancelled",
"tasks:data.image",
"tasks:data.text",
"annotations:id",
"annotations:task_id",
],
},
},
instruments: {
'review-button': () => {
return () => <Button style={{ width: 105 }}>Review</Button>;
},
},
type: 'dm',
});
dm.on("lsf:groundTruth", () => {
console.log('lsf ground truth set');
});
dm.on("taskSelected", () => {
console.log('task selected');
});
};