-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- The library page now loads assets from an external source and allows users to select their combination. - It introduces error handling if the username is not a repository found on the endpoint. - All shared states are now using Redux via `Access` modules. - Correct use of naming convention in react hooks in the `envUtil` module. - Introduces graphQL schema in `client/src/schema.graphql` - Improved unit testing structure. - Playwright now uses a time limit of 200ms on non API click events for E2E testing. --------- Co-authored-by: Mathias Brændgaard <[email protected]> Co-authored-by: Asger <[email protected]>
- Loading branch information
Showing
74 changed files
with
1,988 additions
and
215 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.graphql.ts auto eol=lf |
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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,10 @@ | ||
{ | ||
"src": "./src", | ||
"language": "typescript", | ||
"schema": "./src/schema.graphql", | ||
"exclude": [ | ||
"**/node_modules/**", | ||
"**/__mocks__/**", | ||
"**/__generated__/**" | ||
] | ||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/bash | ||
yarn install --frozen-lockfile | ||
npx playwright install-deps | ||
yarn playwright install --with-deps |
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,42 @@ | ||
import { | ||
Environment, | ||
Network, | ||
RecordSource, | ||
Store, | ||
FetchFunction, | ||
} from 'relay-runtime'; | ||
import axios from 'axios'; | ||
import { getGitlabURL } from 'util/envUtil'; | ||
|
||
const HTTP_ENDPOINT = getGitlabURL(); | ||
|
||
const fetchFn: FetchFunction = async (request, variables) => { | ||
const resp = await axios.post( | ||
HTTP_ENDPOINT, | ||
{ | ||
query: request.text, | ||
variables, | ||
}, | ||
{ | ||
headers: { | ||
Accept: | ||
'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8', | ||
'Content-Type': 'application/json', | ||
'Access-Control-Allow-Origin': '*', | ||
// <-- Additional headers like 'Authorization' would go here | ||
}, | ||
} | ||
); | ||
|
||
return resp.data; | ||
}; | ||
|
||
function createRelayEnvironment() { | ||
return new Environment({ | ||
network: Network.create(fetchFn), | ||
store: new Store(new RecordSource()), | ||
}); | ||
} | ||
|
||
const RelayEnvironment = createRelayEnvironment(); | ||
export default RelayEnvironment; |
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,24 @@ | ||
import * as React from 'react'; | ||
import { Button } from '@mui/material'; | ||
import { Asset } from 'components/asset/Asset'; | ||
import useCart from 'store/CartAccess'; | ||
|
||
function AddButton(asset: Asset) { | ||
const { state, actions } = useCart(); | ||
return ( | ||
<Button | ||
variant="contained" | ||
fullWidth | ||
disabled={!!state.assets.find((a) => a.path === asset.path)} | ||
size="small" | ||
color="primary" | ||
onClick={() => { | ||
actions.add(asset); | ||
}} | ||
> | ||
Select | ||
</Button> | ||
); | ||
} | ||
|
||
export default AddButton; |
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,5 @@ | ||
export interface Asset { | ||
name: string; | ||
description?: string; | ||
path: string; | ||
} |
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,45 @@ | ||
import * as React from 'react'; | ||
import { Grid } from '@mui/material'; | ||
import useAssets from 'util/apiUtil'; | ||
import AssetCard from './AssetCard'; | ||
|
||
const outerGridContainerProps = { | ||
container: true, | ||
spacing: 2, | ||
sx: { | ||
justifyContent: 'flex-start', | ||
overflow: 'auto', | ||
maxHeight: 'inherent', | ||
}, | ||
}; | ||
|
||
// TODO: Make it not capital letters.! | ||
|
||
/** | ||
* Displays a board with navigational properties to locate and select assets for DT configuration. | ||
* @param props Takes relative path to Assets. E.g `Functions` for function assets. | ||
* @returns | ||
*/ | ||
function AssetBoard(props: { pathToAssets: string; privateRepo?: boolean }) { | ||
// eslint-disable-next-line no-console | ||
console.log(props.pathToAssets); | ||
const assetsFetched = useAssets(props.pathToAssets, props.privateRepo); | ||
|
||
if (!assetsFetched.data.length) { | ||
return ( | ||
<em style={{ textAlign: 'center' }}>{assetsFetched.errorMessage}</em> | ||
); | ||
} | ||
|
||
return ( | ||
<Grid {...outerGridContainerProps}> | ||
{assetsFetched.data.map((asset, i) => ( | ||
<Grid key={i} item xs={12} sm={6} md={4} lg={3} sx={{ minWidth: 250 }}> | ||
<AssetCard asset={asset} /> | ||
</Grid> | ||
))} | ||
</Grid> | ||
); | ||
} | ||
|
||
export default AssetBoard; |
Oops, something went wrong.