-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOP-20134] Implement dataset grid & show pages
- Loading branch information
Showing
14 changed files
with
189 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ReactElement } from "react"; | ||
import { List, Datagrid, TextField } from "react-admin"; | ||
|
||
const DatasetGrid = (): ReactElement => { | ||
return ( | ||
<List> | ||
<Datagrid bulkActionButtons={false}> | ||
<TextField source="name" /> | ||
<TextField source="location.type" /> | ||
<TextField source="location.name" /> | ||
</Datagrid> | ||
</List> | ||
); | ||
}; | ||
|
||
export default DatasetGrid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ReactElement } from "react"; | ||
import { Show, SimpleShowLayout, TextField, WithRecord } from "react-admin"; | ||
|
||
const DatasetShow = (): ReactElement => { | ||
return ( | ||
<Show> | ||
<SimpleShowLayout> | ||
<TextField source="id" /> | ||
<TextField source="name" /> | ||
<TextField source="location.type" /> | ||
<TextField source="location.name" /> | ||
<WithRecord | ||
render={(record) => | ||
record.format && <TextField source="format" /> | ||
} | ||
/> | ||
</SimpleShowLayout> | ||
</Show> | ||
); | ||
}; | ||
|
||
export default DatasetShow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import DatasetShow from "./DatasetShow"; | ||
import DatasetGrid from "./DatasetGrid"; | ||
|
||
export { DatasetShow, DatasetGrid }; |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Login from "./Login"; | ||
|
||
export { Login }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { RaRecord } from "react-admin"; | ||
|
||
interface AddressResponseV1 { | ||
url: string; | ||
} | ||
|
||
interface LocationResponseV1 { | ||
type: string; | ||
name: string; | ||
adresses: AddressResponseV1[]; | ||
} | ||
|
||
interface DatasetResponseV1 extends RaRecord { | ||
id: number; | ||
type: string; | ||
name: string; | ||
location: LocationResponseV1; | ||
} | ||
|
||
export type { LocationResponseV1, DatasetResponseV1 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const BACKEND_SERVER_URL = "http://localhost:8000"; | ||
|
||
export default BACKEND_SERVER_URL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { HttpError } from "react-admin"; | ||
|
||
const parseResponse = (response: any) => | ||
response.text().then((text: string) => ({ | ||
status: response.status, | ||
statusText: response.statusText, | ||
headers: response.headers, | ||
body: text, | ||
})); | ||
|
||
const parseJSON = ( | ||
status: number, | ||
body: string, | ||
reject: (error: any) => void, | ||
) => { | ||
let json; | ||
try { | ||
json = JSON.parse(body); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
if (status < 200 || status >= 400) { | ||
reject(new HttpError((json && json.message) || body, status, json)); | ||
} | ||
return json; | ||
}; | ||
|
||
export { parseResponse, parseJSON }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters