Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
78d7489
feat: Changed the constants to variables under `account/settings`
Microchesst Apr 23, 2025
0ce26dd
Migrate codeclimate to qlty (#1254)
prasadtalasila May 26, 2025
9782521
Split pipeline utilities into focused modules (#1272 and #1277)
prasadtalasila Jun 20, 2025
e5cb86d
Fix malfunctioning tests
atomicgamedeveloper Jul 14, 2025
536b601
Change Account content
atomicgamedeveloper Jul 14, 2025
84080ca
Fix conflicting branch actions
atomicgamedeveloper Jul 15, 2025
3f5f039
Highten element precision in e2e test for lower error proneness
atomicgamedeveloper Jul 15, 2025
445453a
Rebase settings PR code
atomicgamedeveloper Jul 24, 2025
b3fbb75
Merge branch 'feature/distributed-demo' of https://github.com/atomicg…
atomicgamedeveloper Jul 24, 2025
c3f8ebd
Let user change common library project name
atomicgamedeveloper Jul 24, 2025
c95f6ab
Add part of tests and fix some minor issues
atomicgamedeveloper Jul 25, 2025
2cfa3a0
Address code quality problems and add more tests
atomicgamedeveloper Jul 30, 2025
822174f
Add basic e2e settings test suite
atomicgamedeveloper Jul 30, 2025
1540b27
Formatting
atomicgamedeveloper Jul 30, 2025
fb13420
Fix broken test
atomicgamedeveloper Jul 31, 2025
8c3a6ef
Refactor constants.ts into digitalTwinConfig/settingsUtil.ts and digi…
atomicgamedeveloper Aug 18, 2025
1072a71
Cover remaining lines
atomicgamedeveloper Aug 19, 2025
7f731af
Rm duplicate test case
atomicgamedeveloper Aug 19, 2025
2d1b244
Minor improvements to tests
atomicgamedeveloper Aug 19, 2025
ce98de5
Add branch to settings, fix other review issues
atomicgamedeveloper Aug 21, 2025
4c60fea
Refactor: Update imports and file types across the project
atomicgamedeveloper Aug 25, 2025
fde0cfe
Move constants tests to digitalTwinConfig/settingsUtility.test.tsx, u…
atomicgamedeveloper Aug 26, 2025
f8f1d31
Update import paths for utility interfaces in GitlabAPI and GitlabIns…
atomicgamedeveloper Aug 26, 2025
24e78fb
Disable cache for jest tests
atomicgamedeveloper Aug 26, 2025
f35690b
Rename utilityInterfaces properly
atomicgamedeveloper Aug 26, 2025
be96710
Refactor tests to remove unnecessary jest.clearAllMocks() calls
atomicgamedeveloper Aug 28, 2025
e22bd06
Formatting
atomicgamedeveloper Aug 28, 2025
fd6f794
Last line coverage
atomicgamedeveloper Aug 28, 2025
e4cafe8
Reorganize interfaces, fix mocking problem
atomicgamedeveloper Sep 4, 2025
3753d60
Remove unnecessary type aliases for JobName and LogContent in executi…
atomicgamedeveloper Sep 4, 2025
1df49ab
Bump version to 0.9.0 in package.json
atomicgamedeveloper Sep 5, 2025
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
3 changes: 2 additions & 1 deletion client/jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
"moduleNameMapper": {
"^test/(.*)$": "<rootDir>/test/$1",
"\\.(css|less|scss)$": "<rootDir>/test/__mocks__/styleMock.ts"
}
},
"maxWorkers": 3
}
2 changes: 1 addition & 1 deletion 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.8.4",
"version": "0.9.0",
"description": "Web client for Digital Twin as a Service (DTaaS)",
"main": "index.tsx",
"author": "prasadtalasila <prasad.talasila@gmail.com> (http://prasad.talasila.in/)",
Expand Down
4 changes: 3 additions & 1 deletion client/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default defineConfig({
retries: process.env.CI ? 0 : 1, // Disable retries on Github actions for now as setup always fails
timeout: process.env.CI ? 1000 : 60 * 1000,
globalTimeout: 10 * 60 * 1000,
workers: 3,
testDir: './test/e2e/tests',
testMatch: /.*\.test\.ts/,
reporter: [
Expand All @@ -51,7 +52,7 @@ export default defineConfig({
use: {
baseURL: BASE_URI,
screenshot: 'only-on-failure',
trace: 'on-first-retry', // Wil not record trace on Github actions because of no retries
trace: 'on-first-retry', // Will not record trace on Github actions because of no retries
headless: true,
},
projects: [
Expand Down Expand Up @@ -81,4 +82,5 @@ export default defineConfig({
],
globalSetup: 'test/e2e/setup/global.setup.ts',
globalTeardown: 'test/e2e/setup/global-teardown.ts',
reportSlowTests: null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this help?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of our tests are slow so this gets rid of the warning.

});
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ the backends are connected to key objects:
await this.backend.api.createRepositoryFile(
projectToUse,
`${filePath}/${file.name}`,
'main',
getBranchName(),
file.content,
commitMessage,
);
Expand All @@ -45,7 +45,7 @@ the backends are connected to key objects:
The Instance is responsible for linking the DTaaS application to the selected backend.
This entails keeping track of logs, project ids and keeping associated backend API
instances for further operations as described below. The interface is described in
`./UtilInterfaces.ts` with a concrete implementation being `./instance.ts`. It is
`./backendInterfaces.ts` with a concrete implementation being `./instance.ts`. It is
either created on an instance basis or passed from instance to instance when
creating other instances. These then use the enriched project information to
execute API commands, as demonstrated above. Detailed Logs are kept for any
Expand All @@ -55,7 +55,7 @@ Digital Twin executions, describing the success and job processing.

The Backend communicates directly with the backend server for pipeline execution,
log retrieval, and or file management. The interface is described in
`./UtilInterfaces.ts` with a concrete implementation being `./backend.ts`. It is
`./backendInterfaces.ts` with a concrete implementation being `./backend.ts`. It is
created before the Instance to be injected and may be initialized there. After
this, it may be called through the Instance directly (e.g.
`myInstance.api.cancelPipeline(...)`). It may contain a client field from a
Expand Down Expand Up @@ -179,8 +179,12 @@ to provide the desired backend implementation.

## Data Flow

The below class diagram shows how a backend (Gitlab) is used.
![Class diagram over ./Preview/Util](./classDiagramOfPreviewUtil.png)
The basic data flow consists of a bidirectional relationship between the backend
and the application. The files can be created, deleted and triggered
from the UI changing the state of the storage backend's files and running its pipelines
on the execution backend, if they are seperated.
Statuses on pipelines are intermittently retrieved and showcased to the user
who also has the option to stop execution, as well as reading execution logs received.

## Extension Points

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ and `BackendAPI` interfaces..

This class implements the Backend interface. Its primary responsibility is to
create the backend API instance, and to obtain the private and common project IDs
from the username and the group name defined in [constants.ts](./constants.ts).
from the username and the group name defined in [constants.ts](./constants.ts)
as well as in the settings.
After this, it keeps track of execution log entries and gives high-level access
to pipeline information and execution, job traces and ids for further processing
by the Backend API, which has to be Gitlab. It is only dependent on its backend
Expand Down Expand Up @@ -91,7 +92,7 @@ Example:
Please follow [config guide](../docs/admin/client/config.md) for setting up the
configuration. You may also wish to change certain constants, like
`COMMON_LIBRARY_PROJECT_NAME` and `DT_DIRECTORY` in the [constants](./constants.ts)
file.
file or in the settings tab.

<!--
Maybe something about setting up the folder structure.
Expand Down
7 changes: 4 additions & 3 deletions client/src/model/backend/gitlab/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import { Gitlab } from '@gitbeaker/rest';
import {
BackendAPI,
ProjectId,
Pipeline,
RepositoryFile,
RepositoryTreeItem,
ProjectSummary,
JobSummary,
} from './UtilityInterfaces';
} from 'model/backend/interfaces/backendInterfaces';
import { Pipeline } from '../interfaces/execution';
import { getBranchName } from './digitalTwinConfig/settingsUtility';

export class GitlabAPI implements BackendAPI {
public client: InstanceType<typeof Gitlab>;
Expand Down Expand Up @@ -112,7 +113,7 @@ export class GitlabAPI implements BackendAPI {
public async listRepositoryFiles(
projectId: ProjectId,
path = '',
ref = 'main',
ref = getBranchName(),
recursive = false,
): Promise<RepositoryTreeItem[]> {
const items = await this.client.Repositories.allRepositoryTrees(projectId, {
Expand Down
Binary file not shown.
31 changes: 0 additions & 31 deletions client/src/model/backend/gitlab/constants.ts

This file was deleted.

29 changes: 29 additions & 0 deletions client/src/model/backend/gitlab/digitalTwinConfig/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { FileType } from 'model/backend/interfaces/sharedInterfaces';

// Default project settings
export const GROUP_NAME = 'DTaaS';
export const DT_DIRECTORY = 'digital_twins';
export const COMMON_LIBRARY_PROJECT_NAME = 'common';
export const RUNNER_TAG = 'linux';
export const BRANCH_NAME = 'master';

// Pipeline execution settings
export const MAX_EXECUTION_TIME = 10 * 60 * 1000;
export const PIPELINE_POLL_INTERVAL = 5 * 1000;

// Maps tabs to project folders (based on asset types)
export enum AssetTypes {
'Functions' = 'functions',
'Models' = 'models',
'Tools' = 'tools',
'Data' = 'data',
'Digital Twins' = 'digital_twins',
'Digital Twin' = 'digital_twin',
}

// Default initial files for new digital twins
export const defaultFiles = [
{ name: 'description.md', type: FileType.DESCRIPTION },
{ name: 'README.md', type: FileType.DESCRIPTION },
{ name: '.gitlab-ci.yml', type: FileType.CONFIGURATION },
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import store from 'store/store';

/**
* Non-hook getters for settings stored in the Redux store.
*
* - Default values are defined in ./constants.ts
* - Hook variants are in util/settingsUseHooks.ts
* - Settings can be overridden by the user in the Settings tab
*/
export const getGroupName = (): string => store.getState().settings.GROUP_NAME;
export const getDTDirectory = (): string =>
store.getState().settings.DT_DIRECTORY;
export const getCommonLibraryProjectName = (): string =>
store.getState().settings.COMMON_LIBRARY_PROJECT_NAME;
export const getRunnerTag = (): string => store.getState().settings.RUNNER_TAG;
export const getBranchName = (): string =>
store.getState().settings.BRANCH_NAME;
11 changes: 8 additions & 3 deletions client/src/model/backend/gitlab/execution/logFetching.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { JobLog } from 'model/backend/gitlab/types/executionHistory';
import { JobLog } from 'model/backend/interfaces/execution';
import cleanLog from 'model/backend/gitlab/cleanLog';
import { BackendInterface, JobSummary } from '../UtilityInterfaces';
import {
BackendInterface,
JobSummary,
} from 'model/backend/interfaces/backendInterfaces';

/**
* Fetches job logs from the backend for a specific pipeline
Expand All @@ -20,7 +23,9 @@ export const fetchJobLogs = async (

const jobs = await backend.getPipelineJobs(projectId, pipelineId);

const logPromises = jobs.map((job) => fetchSingleJobLog(backend, job));
const logPromises = jobs.map((job: JobSummary) =>
fetchSingleJobLog(backend, job),
);
return (await Promise.all(logPromises)).reverse();
};

Expand Down
2 changes: 1 addition & 1 deletion client/src/model/backend/gitlab/execution/pipelineCore.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
MAX_EXECUTION_TIME,
PIPELINE_POLL_INTERVAL,
} from 'model/backend/gitlab/constants';
} from 'model/backend/gitlab/digitalTwinConfig/constants';

/**
* Creates a delay promise for polling operations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExecutionStatus } from 'model/backend/gitlab/types/executionHistory';
import { ExecutionStatus } from 'model/backend/interfaces/execution';

/**
* Maps GitLab pipeline status to internal execution status
Expand Down
2 changes: 1 addition & 1 deletion client/src/model/backend/gitlab/gitlabFactory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import GitlabInstance from 'model/backend/gitlab/instance';
import GitlabAPI from 'model/backend/gitlab/backend';
import { BackendInterface } from 'model/backend/gitlab/UtilityInterfaces';
import { BackendInterface } from 'model/backend/interfaces/backendInterfaces';

export const createGitlabInstance = (
projectName: string,
Expand Down
18 changes: 9 additions & 9 deletions client/src/model/backend/gitlab/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
* It provides methods to initialize the instance, retrieve project IDs, and manage execution logs.
*/
import {
GROUP_NAME,
COMMON_LIBRARY_PROJECT_NAME,
} from 'model/backend/gitlab/constants';
getGroupName,
getCommonLibraryProjectName,
} from 'model/backend/gitlab/digitalTwinConfig/settingsUtility';
import GitlabAPI from 'model/backend/gitlab/backend';
import {
BackendInterface,
LogEntry,
ProjectId,
JobSummary,
Pipeline,
} from './UtilityInterfaces';
import GitlabAPI from './backend';
} from 'model/backend/interfaces/backendInterfaces';
import { Pipeline } from '../interfaces/execution';

export class GitlabInstance implements BackendInterface {
public projectName: string;
Expand Down Expand Up @@ -56,12 +56,12 @@ export class GitlabInstance implements BackendInterface {
}

private async setProjectIds(): Promise<void> {
const group = await this.api.getGroupByName(GROUP_NAME);
const group = await this.api.getGroupByName(getGroupName());
const projects = await this.api.listGroupProjects(group.id as string);
const project =
projects.find((proj) => proj.name === this.projectName) ?? null;
const commonProject =
projects.find((proj) => proj.name === COMMON_LIBRARY_PROJECT_NAME) ??
projects.find((proj) => proj.name === getCommonLibraryProjectName()) ??
null;

if (!project) {
Expand All @@ -70,7 +70,7 @@ export class GitlabInstance implements BackendInterface {

if (!commonProject) {
throw new Error(
`Common project ${COMMON_LIBRARY_PROJECT_NAME} not found`,
`Common project ${getCommonLibraryProjectName()} not found`,
);
}

Expand Down
Loading
Loading