authscape 1.0.622 → 1.0.626

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,259 +0,0 @@
1
- import React, {useEffect, useState, useRef} from 'react';
2
- // import {apiService, authService, StripeConnect, ReactDraft, EditableDatagrid, FileUploader} from 'authscape';
3
- import Button from '@mui/material/Button';
4
- import { Box } from '@mui/system';
5
- import Dialog from '@mui/material/Dialog';
6
- import DialogActions from '@mui/material/DialogActions';
7
- import DialogContent from '@mui/material/DialogContent';
8
- import DialogContentText from '@mui/material/DialogContentText';
9
- import DialogTitle from '@mui/material/DialogTitle';
10
- import TextField from '@mui/material/TextField';
11
- import InputLabel from '@mui/material/InputLabel';
12
- import MenuItem from '@mui/material/MenuItem';
13
- import FormControl from '@mui/material/FormControl';
14
- import Select from '@mui/material/Select';
15
- import Radio from '@mui/material/Radio';
16
- import RadioGroup from '@mui/material/RadioGroup';
17
- import FormControlLabel from '@mui/material/FormControlLabel';
18
- import FormLabel from '@mui/material/FormLabel';
19
-
20
- export function Datasources({disableTraining = false}) {
21
-
22
- const documentColumns = [
23
- { field: 'name', headerName: 'Name', width: 150, editable: false },
24
- {
25
- field: "type",
26
- type: "actions",
27
- width: 200,
28
- flex:1,
29
- headerName: "Data Source",
30
- getActions: ({ id, row }) => {
31
- return [
32
- <Box sx={{textAlign:"left"}}>
33
- {row.type == 0 ? "Database" : ""}
34
- {row.type == 1 ? "Dynamic Mapping" : ""}
35
- {row.type == 2 ? "Custom Model" : ""}
36
- </Box>,
37
- ];
38
- },
39
- },
40
- {
41
- field: "Detail",
42
- type: "actions",
43
- width: 200,
44
- flex:1,
45
- headerName: "Mapping To",
46
- getActions: ({ id, row }) => {
47
- return [
48
- <Box sx={{textAlign:"left"}}>
49
-
50
- {row.type == 0 ?
51
- <>Table: {row.tableName}</>
52
- :
53
- ""
54
- }
55
-
56
- {row.type == 1 ?
57
- <>Database driven mapping</>
58
- :
59
- ""
60
- }
61
-
62
- {row.type == 2 ?
63
- <>Type Name: {row.typeName}
64
- <br/> Assembly Fullname: {row.assemblyFullName}</>
65
- :
66
- ""
67
- }
68
-
69
- </Box>,
70
- ];
71
- },
72
- },
73
- // {
74
- // field: "actions",
75
- // type: "actions",
76
- // width: 200,
77
- // headerName: "Archive",
78
- // cellClassName: "actions",
79
- // getActions: ({ id, row }) => {
80
- // return [
81
- // <GridActionsCellItem key={id}
82
- // icon={<DeleteRoundedIcon />}
83
- // label="Archive"
84
- // className="textPrimary"
85
- // onClick={async () => {
86
-
87
- // let documentMappingId = "";
88
- // let documentComponentId = "";
89
-
90
- // // archive the column
91
- // await apiService().delete("/DocumentMapping/RemoveColumnFromDocumentComponent?documentMappingId=" + documentMappingId + "&documentComponentId=" + documentComponentId)
92
-
93
- // }}
94
- // />,
95
- // ];
96
- // },
97
- // }
98
-
99
- ];
100
-
101
- const refDatabaseTableSelect = useRef(null);
102
- const refNewDocTypeName = useRef(null);
103
-
104
- const [dataGridRefreshKey, setDataGridRefreshKey] = useState(0);
105
-
106
- const [document, setDocument] = useState(null);
107
- const [showDatasource, setShowDatasource] = useState(false);
108
- const [databaseTables, setDatabaseTables] = useState(null);
109
-
110
- const [mappingType, setMappingType] = useState("database");
111
-
112
-
113
- const refTypeName = useRef(null);
114
- const refAssemblyFullName = useRef(null);
115
-
116
-
117
-
118
- useEffect(() => {
119
-
120
- let fetchData = async () => {
121
- let response = await apiService().get("/DocumentMapping/GetTablesFromDatabase");
122
- if (response != null && response.status == 200)
123
- {
124
- setDatabaseTables(response.data);
125
- }
126
- }
127
-
128
- fetchData();
129
-
130
- }, [])
131
-
132
- return (
133
- <Box sx={{marginTop:6}}>
134
- <Box>
135
- {!disableTraining &&
136
- <Box sx={{textAlign:"right", marginBottom:2}}>
137
- <Button variant="contained" onClick={() => {
138
- setShowDatasource(true);
139
- }}>Add Data Source</Button>
140
- </Box>
141
- }
142
- <EditableDatagrid key={dataGridRefreshKey} loadedUser={true} url={"/DocumentMapping/GetDocumentTypes"} columns={documentColumns}/>
143
- </Box>
144
-
145
- <Dialog
146
- open={showDatasource}
147
- onClose={() => {
148
- setShowDatasource(false);
149
- }}
150
- aria-labelledby="alert-dialog-title"
151
- aria-describedby="alert-dialog-description"
152
- >
153
- <DialogTitle id="alert-dialog-title">
154
- {"Data Source"}
155
- </DialogTitle>
156
- <DialogContent>
157
- <DialogContentText id="alert-dialog-description">
158
- A data source is a place or system where data is stored and collected. It can be a database, file, web service, or sensor. Data is extracted, transformed, and used for analysis and other purposes. Managing data sources is crucial for data-driven decision-making.
159
- </DialogContentText>
160
-
161
- <Box sx={{marginTop:3}}>
162
- <TextField inputRef={refNewDocTypeName} label="Name for data source" variant="outlined" fullWidth={true} />
163
- </Box>
164
-
165
- <Box sx={{marginTop:2}}>
166
- <FormControl>
167
- <FormLabel id="demo-row-radio-buttons-group-label">How the data will connect:</FormLabel>
168
- <RadioGroup value={mappingType} row aria-labelledby="demo-row-radio-buttons-group-label" name="row-radio-buttons-group" onChange={(env) => {
169
- setMappingType(env.currentTarget.value);
170
- }}>
171
- <FormControlLabel value="database" control={<Radio />} label="Database" />
172
- <FormControlLabel value="mappingTable" control={<Radio />} label="Dynamic Mapping Table" />
173
- <FormControlLabel value="customModelMapping" control={<Radio />} label="Custom Model" />
174
- </RadioGroup>
175
- </FormControl>
176
- </Box>
177
-
178
- {mappingType == "database" &&
179
- <Box sx={{marginTop:2}}>
180
- <Box sx={{ minWidth: 120 }}>
181
- <FormControl fullWidth>
182
- <InputLabel id="demo-simple-select-label">Database Tables</InputLabel>
183
- <Select
184
- inputRef={refDatabaseTableSelect}
185
- labelId="demo-simple-select-label"
186
- label="Age">
187
- {databaseTables != null && databaseTables.map((table, index) => {
188
- return (<MenuItem value={table.tableName}>{table.tableName}</MenuItem>)
189
- })}
190
- </Select>
191
- </FormControl>
192
- </Box>
193
- </Box>
194
- }
195
-
196
- {mappingType == "customModelMapping" &&
197
-
198
- <Box sx={{marginTop:2}}>
199
- <Box sx={{ minWidth: 120 }}>
200
- <TextField inputRef={refTypeName} label="Type Name (Example: API.Controllers.InvoiceUpload)" variant="outlined" fullWidth={true} sx={{marginTop:1}} />
201
- <TextField inputRef={refAssemblyFullName} label="Assembly Full Name (Example: API)" variant="outlined" fullWidth={true} sx={{marginTop:1}} />
202
- </Box>
203
- </Box>
204
- }
205
-
206
- </DialogContent>
207
- <DialogActions>
208
- <Button onClick={() => {
209
- setShowDatasource(false);
210
- }}>Cancel</Button>
211
- <Button onClick={async () => {
212
-
213
- if (mappingType == "customModelMapping")
214
- {
215
- let response = await apiService().post("/DocumentMapping/AddDataSource", {
216
- name: refNewDocTypeName.current.value,
217
- dataTable: refNewDocTypeName.current.value,
218
- documentType: 2,
219
- typeName: refTypeName.current.value,
220
- assemblyFullName: refAssemblyFullName.current.value
221
- });
222
-
223
- if (response != null && response.data.error != null)
224
- {
225
- alert(response.data.error);
226
- }
227
- else
228
- {
229
- if (response != null && (response.status == 204 || response.status == 200))
230
- {
231
- setDataGridRefreshKey(dataGridRefreshKey + 1);
232
- setShowDatasource(false);
233
- }
234
- }
235
- }
236
- else
237
- {
238
- let response = await apiService().post("/DocumentMapping/AddDataSource", {
239
- name: refNewDocTypeName.current.value,
240
- dataTable: refDatabaseTableSelect.current != null ? refDatabaseTableSelect.current.value : "",
241
- documentType: (mappingType == "database" ? 0 : 1)
242
- });
243
-
244
- if (response != null && (response.status == 204 || response.status == 200))
245
- {
246
- setDataGridRefreshKey(dataGridRefreshKey + 1);
247
- setShowDatasource(false);
248
- }
249
- }
250
-
251
- }}>
252
- Add Data Source
253
- </Button>
254
- </DialogActions>
255
- </Dialog>
256
-
257
- </Box>
258
- )
259
- }
@@ -1,72 +0,0 @@
1
- import React, {useEffect, useState, useRef} from 'react';
2
- import { Box } from '@mui/system';
3
- // import ManageMappingDocuments from './manageMappingDocuments';
4
- // import AssignMapping from './AssignMapping';
5
-
6
- export function FileMapping({currentUser, fileUploadName = "Upload Document", hideDocumentManager = false, setIsLoading = null, documentTypeId = null, onOpened = null, onPublished = null, onCanceled = null, onArchived = null}) {
7
-
8
- const [documentComponentId, setDocumentComponentId] = useState(null);
9
-
10
- useEffect(() => {
11
-
12
- if (documentComponentId != null)
13
- {
14
- if (onOpened != null)
15
- {
16
- onOpened(documentComponentId);
17
- }
18
- }
19
-
20
- }, [documentComponentId]);
21
-
22
- return (
23
- <Box>
24
- {documentComponentId == null &&
25
- <ManageMappingDocuments
26
- fileUploadName={fileUploadName}
27
- documentTypeId={documentTypeId}
28
- hideDocumentManager={hideDocumentManager}
29
- companyId={currentUser != null ? currentUser.companyId : null}
30
- onManageField={(documentComponentId) => {
31
-
32
- setDocumentComponentId(documentComponentId);
33
-
34
- }}
35
- onArchive={(documentComponentId) => {
36
-
37
- //alert(documentComponentId);
38
- if (onArchived != null)
39
- {
40
- onArchived(documentComponentId);
41
- }
42
-
43
- }}
44
- />
45
- }
46
-
47
- {documentComponentId != null &&
48
- <AssignMapping currentUser={currentUser} setIsLoading={setIsLoading} documentComponentId={documentComponentId}
49
- onCancel={() => {
50
-
51
- setDocumentComponentId(null);
52
-
53
- if (onCanceled != null)
54
- {
55
- onCanceled(documentComponentId);
56
- }
57
-
58
- }}
59
- onPublished={() => {
60
- setDocumentComponentId(null);
61
-
62
- if (onPublished != null)
63
- {
64
- onPublished(documentComponentId);
65
- }
66
- }} />
67
- }
68
-
69
-
70
- </Box>
71
- )
72
- }