Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Execute' tab to Digital Twins page preview #903

Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
699a0dc
manual rebase in progress
prasadtalasila Sep 9, 2024
25158f3
manual rebase in progress
prasadtalasila Sep 9, 2024
3dcbd9b
completes manual rebase
prasadtalasila Sep 9, 2024
eccae19
Delete old components
Sep 10, 2024
4b54723
Add properties to gitlabDigitalTwin
Sep 10, 2024
e3bce4c
Add unit tests
Sep 10, 2024
3ab550f
Complete documentation
Sep 10, 2024
447ff03
Fix codeclimate issues
Sep 10, 2024
2f5d458
Refactor ExecutionFunctions
Sep 10, 2024
656ca9a
Remove strip-ansi and add instructions to gitlab-runner
VanessaScherma Sep 12, 2024
5ba4ebf
Apply comments
Sep 13, 2024
b56730b
Start unit testing and use preview folders
Sep 14, 2024
a43f972
Add Manage tab files
Sep 10, 2024
577b320
Change components and use redux
Sep 11, 2024
39d8deb
Update unit tests
Sep 11, 2024
afe4d4f
Format
Sep 11, 2024
34a9709
Fix codeclimate issues
Sep 11, 2024
38c0329
Use remarkable library
Sep 15, 2024
f3bb71d
Add Reconfigure Dialog
Sep 16, 2024
3b66b29
Complete Reconfigure dialog
Sep 18, 2024
684b4f2
Unit testing
Sep 21, 2024
cbe3946
Add unit tests and refactor
VanessaScherma Sep 24, 2024
be7d442
Deletes unused DT manage code
prasadtalasila Sep 24, 2024
94bded4
Update unit testing
Sep 27, 2024
4d9f2d3
Add integration tests
Sep 29, 2024
7c43821
Fix codeclimate issues
VanessaScherma Sep 30, 2024
556b807
Add integration tests
VanessaScherma Oct 1, 2024
749f344
Add integration tests
Oct 3, 2024
c24958e
Fix codeclimate issue
Oct 3, 2024
bbf071b
Checkout files from feature/distributed-demo
Oct 3, 2024
30088d6
Resolve conflicts
Oct 3, 2024
10fef9e
Resolve conflicts
Oct 3, 2024
6465b26
Resolve conflicts
Oct 3, 2024
3552dfe
Resolve yarn.lock conflict
Oct 3, 2024
c892111
Resolve yarn.lock conflict
Oct 3, 2024
eae696e
Checkout yarn.lock
Oct 3, 2024
388d36f
Resolve review comments
Oct 4, 2024
4ce2ff4
Checkout files from feature/distributed-demo branch
Oct 5, 2024
458eb2f
Use pipeline names instead of pipeline id in stop function
Oct 5, 2024
2935ecd
Update unit test
Oct 5, 2024
9e6a62c
Move gitlabDriver.ts into preview folder
Oct 5, 2024
76709d5
Configuration fix
Oct 5, 2024
acb33e0
Configuration fix
Oct 5, 2024
60d6723
Checkout yarn.lock
Oct 5, 2024
44b3038
Merge branch 'feature/distributed-demo' into execute-DTs-on-gitlab
VanessaScherma Oct 5, 2024
a3d1925
Little fix in gitlabDriver.ts
Oct 5, 2024
a445cf5
Update .eslintignore
Oct 6, 2024
9938e33
Update package.json and jest.config.json
Oct 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions client/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ if (typeof window !== 'undefined') {
REACT_APP_WORKBENCHLINK_VSCODE: '/tools/vscode/',
REACT_APP_WORKBENCHLINK_JUPYTERLAB: '/lab',
REACT_APP_WORKBENCHLINK_JUPYTERNOTEBOOK: '',
REACT_APP_WORKBENCHLINK_DT_PREVIEW: '/preview/digitaltwins',

REACT_APP_CLIENT_ID: '1be55736756190b3ace4c2c4fb19bde386d1dcc748d20b47ea8cfb5935b8446c',
REACT_APP_AUTH_AUTHORITY: 'https://gitlab.com/',
Expand Down Expand Up @@ -140,6 +141,7 @@ if (typeof window !== 'undefined') {
REACT_APP_WORKBENCHLINK_VSCODE: '/tools/vscode/',
REACT_APP_WORKBENCHLINK_JUPYTERLAB: '/lab',
REACT_APP_WORKBENCHLINK_JUPYTERNOTEBOOK: '',
REACT_APP_WORKBENCHLINK_DT_PREVIEW: '/preview/digitaltwins',

REACT_APP_CLIENT_ID: '1be55736756190b3ace4c2c4fb19bde386d1dcc748d20b47ea8cfb5935b8446c',
REACT_APP_AUTH_AUTHORITY: 'https://gitlab.com/',
Expand Down Expand Up @@ -197,6 +199,12 @@ api, read_api, read_user, create_runner, k8s_proxy, read_repository, write_repos

The token information needs to be updated in `config/gitlab.json`.

In addition to the personal access token, you also need to create a
[pipeline trigger token](https://archives.docs.gitlab.com/16.4/ee/ci/triggers/index.html).
This token is required to trigger pipelines by using the API.
You can create this token in your GitLab project's CI/CD settings under
the *Pipeline trigger tokens* section.

Once the token configuration is in place, the gitlab code can be developed
and tested using the following yarn commands.

Expand Down Expand Up @@ -230,3 +238,11 @@ Execution Logs: [
}
]
```

## Digital Twins page preview

In the Workbench section, there is a link to preview the **Digital Twins**
page. The GitLab account used as OAuth provider must have a *DTaaS* group,
a project under your username, and a *digital_twins* folder which contains
the Digital Twins. From this interface, you can start or stop execution of
Digital Twins, and once the execution is complete, view the complete logs.
35 changes: 35 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,38 @@ This error is expected.
If you would like to try the complete DTaaS application, please see
localhost installation in
[docs](https://into-cps-association.github.io/DTaaS/development/admin/localhost.html).

## Gitlab Runner configuration

To properly use the Digital Twins page preview, you need to configure at least
one project runner in your GitLab profile. Follow the steps below:

1. Login to the GitLab profile that will be used as the OAuth provider.

1. Navigate to the *DTaaS* group and select the project named after your
GitLab username.

1. In the project menu, go to Settings and select CI/CD.

1. Expand the **Runners** section and click on *New project runner*. Follow the
configuration instructions carefully:
- Add **linux** as a tag during configuration.
- Click on *Create runner*.
- Ensure GitLab Runner is installed before proceeding. Depending on your
environment, you will be shown the correct command to install GitLab Runner.
- Once GitLab Runner is installed, follow these steps to register the runner:
- Copy and paste the command shown in the GitLab interface into your command
line to register the runner. It includes a URL and a token for your specific
GitLab instance.
- Choose *docker* as executor when prompted by the command line.
- Choose the default docker image. You must use an image based on Linux,
like the default one (*ruby:2.7*).

You can manually verify that the runner is available to pick up jobs by running
the following command:

```bash
sudo gitlab-runner run
```

It can also be used to reactivate offline runners during subsequent sessions.
1 change: 1 addition & 0 deletions client/config/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if (typeof window !== 'undefined') {
REACT_APP_WORKBENCHLINK_VSCODE: '/tools/vscode/',
REACT_APP_WORKBENCHLINK_JUPYTERLAB: '/lab',
REACT_APP_WORKBENCHLINK_JUPYTERNOTEBOOK: '',
REACT_APP_WORKBENCHLINK_DT_PREVIEW: '/preview/digitaltwins',

REACT_APP_CLIENT_ID: '1be55736756190b3ace4c2c4fb19bde386d1dcc748d20b47ea8cfb5935b8446c',
REACT_APP_AUTH_AUTHORITY: 'https://gitlab.foo.com/',
Expand Down
1 change: 1 addition & 0 deletions client/config/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if (typeof window !== 'undefined') {
REACT_APP_WORKBENCHLINK_VSCODE: '/tools/vscode/',
REACT_APP_WORKBENCHLINK_JUPYTERLAB: '/lab',
REACT_APP_WORKBENCHLINK_JUPYTERNOTEBOOK: '',
REACT_APP_WORKBENCHLINK_DT_PREVIEW: '/preview/digitaltwins',

REACT_APP_CLIENT_ID: '1be55736756190b3ace4c2c4fb19bde386d1dcc748d20b47ea8cfb5935b8446c',
REACT_APP_AUTH_AUTHORITY: 'https://gitlab.com/',
Expand Down
1 change: 1 addition & 0 deletions client/config/prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if (typeof window !== 'undefined') {
REACT_APP_WORKBENCHLINK_VSCODE: '/tools/vscode/',
REACT_APP_WORKBENCHLINK_JUPYTERLAB: '/lab',
REACT_APP_WORKBENCHLINK_JUPYTERNOTEBOOK: '',
REACT_APP_WORKBENCHLINK_DT_PREVIEW: '/preview/digitaltwins',

REACT_APP_CLIENT_ID: '1be55736756190b3ace4c2c4fb19bde386d1dcc748d20b47ea8cfb5935b8446c',
REACT_APP_AUTH_AUTHORITY: 'https://gitlab.com/',
Expand Down
5 changes: 3 additions & 2 deletions client/config/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ if (typeof window !== 'undefined') {
REACT_APP_WORKBENCHLINK_VSCODE: '/tools/vscode/',
REACT_APP_WORKBENCHLINK_JUPYTERLAB: '/lab',
REACT_APP_WORKBENCHLINK_JUPYTERNOTEBOOK: '',
REACT_APP_WORKBENCHLINK_DT_PREVIEW: '/preview/digitaltwins',

REACT_APP_CLIENT_ID: '1be55736756190b3ace4c2c4fb19bde386d1dcc748d20b47ea8cfb5935b8446c',
REACT_APP_AUTH_AUTHORITY: 'https://gitlab.com/',
REACT_APP_CLIENT_ID: '38bf4764fad5ebb2ebbf49b4f57c7720145b61266f13bf4891ff7851dd5c6563',
VanessaScherma marked this conversation as resolved.
Show resolved Hide resolved
REACT_APP_AUTH_AUTHORITY: 'https://maestro.cps.digit.au.dk/gitlab',
REACT_APP_REDIRECT_URI: 'http://localhost:4000/Library',
REACT_APP_LOGOUT_REDIRECT_URI: 'http://localhost:4000/',
REACT_APP_GITLAB_SCOPES: 'openid profile read_user read_repository api',
Expand Down
1 change: 1 addition & 0 deletions client/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ declare global {
REACT_APP_WORKBENCHLINK_VSCODE: string;
REACT_APP_WORKBENCHLINK_JUPYTERLAB: string;
REACT_APP_WORKBENCHLINK_JUPYTERNOTEBOOK: string;
REACT_APP_WORKBENCHLINK_DT_PREVIEW: string;

REACT_APP_CLIENT_ID: string;
REACT_APP_AUTH_AUTHORITY: string;
Expand Down
3 changes: 1 addition & 2 deletions client/jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
"build",
"src/index.tsx",
"src/AppProvider.tsx",
"src/store/store.ts",
"src/util/gitlabDriver.ts"
"src/store/store.ts"
],
"modulePathIgnorePatterns": [
"test/e2e",
Expand Down
5 changes: 3 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@into-cps-association/dtaas-web",
"version": "0.4.0",
"version": "0.4.2",
"description": "Web client for Digital Twin as a Service (DTaaS)",
"main": "index.tsx",
"author": "prasadtalasila <[email protected]> (http://prasad.talasila.in/)",
Expand Down Expand Up @@ -46,7 +46,7 @@
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@fontsource/roboto": "^5.0.8",
"@gitbeaker/rest": "^40.1.2",
"@gitbeaker/rest": "^40.1.3",
"@mui/icons-material": "^5.14.8",
"@mui/material": "^5.14.8",
"@reduxjs/toolkit": "^1.9.7",
Expand Down Expand Up @@ -75,6 +75,7 @@
"redux": "^4.2.1",
"resize-observer-polyfill": "^1.5.1",
"serve": "^14.2.1",
"strip-ansi": "^7.1.0",
"styled-components": "^6.1.1",
"typescript": "^4.9.5"
},
Expand Down
5 changes: 5 additions & 0 deletions client/src/components/LinkIconsLib.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import NoteAltOutlinedIcon from '@mui/icons-material/NoteAltOutlined';
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
import GitHubIcon from '@mui/icons-material/GitHub';
import HelpOutlineIcon from '@mui/icons-material/HelpOutline';
import TabIcon from '@mui/icons-material/Tab';

type LinkIconsType = {
[key: string]: { icon: React.ReactElement; name: string | undefined };
Expand All @@ -28,6 +29,10 @@ const LinkIcons: LinkIconsType = {
icon: <NoteAltOutlinedIcon />,
name: 'Jupyter Notebook',
},
DT_PREVIEW: {
icon: <TabIcon />,
name: 'Digital Twins page preview',
},
GITHUB: {
icon: <GitHubIcon />,
name: 'ToolbarIcon',
Expand Down
5 changes: 5 additions & 0 deletions client/src/components/asset/Asset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface Asset {
name: string;
description?: string;
path: string;
}
51 changes: 51 additions & 0 deletions client/src/components/asset/AssetBoard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import * as React from 'react';
import { Grid } from '@mui/material';
import { GitlabInstance } from 'util/gitlab';
import { Asset } from './Asset';
import AssetCardExecute from './AssetCard';

const outerGridContainerProps = {
container: true,
spacing: 2,
sx: {
justifyContent: 'flex-start',
overflow: 'auto',
maxHeight: 'inherent',
marginTop: 2,
},
};

/**
* 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: {
subfolders: Asset[];
gitlabInstance: GitlabInstance;
error: string | null;
}) {
if (props.error) {
return <em style={{ textAlign: 'center' }}>{props.error}</em>;
}

return (
<Grid {...outerGridContainerProps}>
{props.subfolders.map((asset) => (
<Grid
key={asset.path}
item
xs={12}
sm={6}
md={4}
lg={3}
sx={{ minWidth: 250 }}
>
<AssetCardExecute asset={asset} />
</Grid>
))}
</Grid>
);
}

export default AssetBoard;
Loading
Loading