Skip to content

Commit

Permalink
Added refactored format-check script to run in pre-commit
Browse files Browse the repository at this point in the history
removed typo

added repo to test pre-commit

test pre-commit with typo

undo typo and uncomment mdlint

test pre-commit with typo

remove type

test pre-commit

uncomment format-check

test dummy format

test dummy

commit dummies to git for test git diff

test pre-commit eslint

pre-commit config to replace custom pre-commit

added directory lib to hooks

test pre-commit yarn install

yarn install logic to pre-commit

prettified pre-commit-config

added pre-push hooks

test dummy pre-push

test pre-push yarn jest

test pre-push yarn jest

test again

test pre-push again

test again

TEST CORRECTLY

test manual push

another manual test

test all pre-commit hooks

added default hooks

added pre-push test for lib

test git hooks dir

test git hooks dir

test dir with dummie

undo hook dir back to before

test git hooks

test git hooks

test git hooks

test git hooks

test git hooks

test git hooks

test git hooks

test git hooks

test git hooks

test git hooks

test git hooks

test git hooks

reset after test

test git hooks

test git hooks

test git hooks

reset after test

test git hooks

reset after test

test git hooks

test git hooks

reset after test

test git hooks

reset after test

reset after test

reset after test

reset after test

reset after test

test script for git hooks done

githook test and log for documentation

reset after test

reset after test

reset after test

reset after test

reset after test

reset after test

reset after test

reset after test

test git hooks

reset after test

test git hooks

reset after test

test git hooks

reset after test

improved test

went back to original test

test git hooks

final test script

reset after test

test git hooks

reset after test

reset after test

reset after test

reset after test

reset after test

test and log done

added new githook script and updated guide

comment out lib test hook

stage markdownlint changes

log githook run

accept prettified changes

updated run log

removed logs and test from repo

updated configure-git-hooks script and docs

updated hook to use markdownlint/markdownlint

removed unnecessary readme

added prettier config to client

undo change

non trailling commas for client and lib

undo trailing commas to test code cov

Revert "undo trailing commas to test code cov"

This reverts commit e5bf319.

undo trailling commas to test codecov

undo trailling commas in lib

undo single quote prettier

test undo semiconlons

test remove trailling commas lib

set traillingcomma all

undo prettierrc

accept prettier lib improves codecov

accept prettier client improves codecov

Swap ml-workspace container and improve docs (INTO-CPS-Association#300)

  - Replaces ml-workspace container with
    ml-workspace-minimal container. This change
    potentially improves the speed of user
    workspace.
  - Adds guide book to help with non-standard
    installation scenarios.
  - Adds MongoDB installation to services.js

---------
Co-authored-by: nichlaes <[email protected]>

Corrects docker commands and updates docs (INTO-CPS-Association#304)

  - Corrects docker run commands to always restart the containers
  - Updates diagrams in docs to include MongoDB
  - Adds yarn clean command to package.json of services.

uncomment prettier

replace deprecated code_blocks

uncomment markdownlint

fixed table mdl error

ignore url line length mdl

redo  mdl hook

ignore table line length and use .markdownlint.yaml instead

replaced by pre-commit framework

adhere to code climate linelength

Adds scope to library tabs (INTO-CPS-Association#235 and INTO-CPS-Association#321)

  - Shows the right directory for each tab in Library page
  - Adds second level tabs to Library page. These tabs separate
     private and common assets

---------
Co-authored-by: caesarv16 <[email protected]>
Co-authored-by: s88004 <[email protected]>

markdownlint disable codeblock test

test deprecated code_blocks in codeclimate

shortened comment to adhere to line_length
  • Loading branch information
lindot11 committed Dec 1, 2023
1 parent c4dc49a commit 71feb8c
Show file tree
Hide file tree
Showing 74 changed files with 1,574 additions and 376 deletions.
30 changes: 0 additions & 30 deletions .git-hooks/pre-commit

This file was deleted.

31 changes: 0 additions & 31 deletions .git-hooks/pre-push

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,7 @@ src.svg
test.svg

# config files
runner.yml
runner.yml

# Jupter Lab
.workspace
12 changes: 6 additions & 6 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Default state for all rules
default: true

# MD013/line-length - Line length
MD013:
line_length: 80
tables: false
MD033: false
MD013:
code_blocks: false
tables: true
MD046:
style: "fenced"
66 changes: 64 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,68 @@
default_install_hook_types: [pre-commit, pre-push]

repos:
- repo: local
hooks:
- id: yarn-install-client
name: yarn install client
entry: bash
language: system
files: "^client/.*"
args: ["-c", "cd client && yarn install"]
- id: yarn-install-runner
name: yarn install runner
entry: bash
language: system
files: "^servers/execution/runner/.*"
args: ["-c", "cd servers/execution/runner && yarn install"]
- id: yarn-install-lib
name: yarn install lib
entry: bash
language: system
files: "^servers/lib/.*"
args: ["-c", "cd servers/lib && yarn install"]

- id: yarn-jest-client
name: yarn jest client
entry: bash
language: system
files: "^client/.*"
args: ["-c", "cd client && yarn jest . --coverage=false"]
stages: [pre-push]
- id: yarn-test-runner
name: yarn test runner
entry: bash
language: system
files: "^servers/execution/runner/.*"
args: ["-c", "cd servers/execution/runner && yarn test:nocov"]
stages: [pre-push]
# - id: yarn-test-lib
# name: yarn test lib
# entry: bash
# language: system
# files: "^servers/lib/.*"
# args: ["-c", "cd servers/lib && yarn jest . --coverage=false"]
# stages: [pre-push]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
args: ["--ignore-path", "../.gitignore", "--write"]
files: '^(client|servers/execution/runner|servers/lib)/.*\.(ts|tsx|css|scss)$'
stages: [pre-commit]

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.54.0
hooks:
- id: eslint
args: ["--fix"]
files: "^(client|servers/execution/runner|servers/lib)/.*"
stages: [pre-commit]

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.32.2
rev: v0.37.0
hooks:
- id: markdownlint
args: ["--fix"]
files: '^(client|servers/execution/runner|servers/lib)/.*\.md$'
stages: [pre-commit]
4 changes: 4 additions & 0 deletions client/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
8 changes: 4 additions & 4 deletions client/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

* The INTO-CPS tool suite software and the INTO-CPS Association
* Public License (ICAPL) are obtained from the INTO-CPS Association, either
* from the above address, from the URLs: <http:>http://www.into-cps.org</http:> or
* from the above address, from the URLs: <http://www.into-cps.org> or
* in the INTO-CPS tool suite distribution.
* GNU version 3 is obtained from:
* <http:>http://www.gnu.org/copyleft/gpl.html</http:>.
* <http://www.gnu.org/copyleft/gpl.html>.

* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
Expand Down Expand Up @@ -291,11 +291,11 @@ This Agreement is governed by the laws of Denmark. The place of jurisdiction
for all disagreements related to this Agreement, is Aarhus, Denmark.

The EPL 1.0 license definition has been obtained from:
<http:>http://www.eclipse.org/legal/epl-v10.html</http:>.
<http://www.eclipse.org/legal/epl-v10.html>.
It is also reproduced in the INTO-CPS distribution.

The GPL Version 3 license definition has been obtained from
<http:>http://www.gnu.org/copyleft/gpl.html</http:>.
<http://www.gnu.org/copyleft/gpl.html>.
It is also reproduced in the INTO-CPS distribution.

--- End of Definition of INTO-CPS Association Public License ---
4 changes: 3 additions & 1 deletion client/public/static/css/MaterialIcon.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: local('Material Icons'), local('MaterialIcons-Regular'),
src:
local('Material Icons'),
local('MaterialIcons-Regular'),
url(/static/font/MaterialIcons-Regular.woff2) format('woff2'),
url(/static/font/MaterialIcons-Regular.woff) format('woff'),
url(/static/font/MaterialIcons-Regular.ttf) format('truetype');
Expand Down
22 changes: 0 additions & 22 deletions client/public/static/font/README.md

This file was deleted.

72 changes: 53 additions & 19 deletions client/src/components/tab/TabComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,65 @@
import * as React from 'react';
import { Paper } from '@mui/material';
import TabRender, { TabData } from './subcomponents/TabRender';
import { Tab, TabList, TabPanel, Tabs } from './subcomponents/TabStyles';

function TabComponent(props: { tabs: TabData[] }) {
export function constructURL(assetType: string, scope: string, libURL: string) {
let assetTab = assetType.toLowerCase();
let scopeTab = scope.toLowerCase();

assetTab = assetTab === 'digital twins' ? 'digital_twins' : assetTab;
scopeTab = scopeTab === 'private' ? '' : `${scopeTab}/`;

return `${libURL}tree/${scopeTab}${assetTab}`;
}

function renderScopeTabList(scope: TabData[][], subIndex: number): JSX.Element {
return (
<Paper
sx={{
p: 2,
display: 'flex',
flexDirection: 'column',
minHeight: '100%',
}}
>
<Tabs>
<TabList>
{props.tabs.map((tab, index) => (
<Tab key={index}>{tab.label}</Tab>
))}
</TabList>
{props.tabs.map((tab, index) => (
<TabList>
{scope &&
scope[subIndex] &&
scope[subIndex].map((tab, index) => <Tab key={index}>{tab.label}</Tab>)}
</TabList>
);
}

function renderScopeTabPanels(
scope: TabData[][],
subIndex: number
): JSX.Element {
return (
<>
{scope &&
scope[subIndex] &&
scope[subIndex].map((tab, index) => (
<TabPanel key={index}>
<TabRender index={index}>{tab}</TabRender>
</TabPanel>
))}
</Tabs>
</Paper>
</>
);
}

export function TabComponent(props: {
assetType: TabData[];
scope: TabData[][];
}): JSX.Element {
return (
<Tabs>
<TabList>
{props.assetType.map((tab, index) => (
<Tab key={index}>{tab.label}</Tab>
))}
</TabList>{' '}
{props.assetType.map((subtab, subIndex) => (
<TabPanel key={subIndex}>
<TabRender index={subIndex}>{subtab}</TabRender>
<Tabs>
{renderScopeTabList(props.scope, subIndex)}
{renderScopeTabPanels(props.scope, subIndex)}
</Tabs>
</TabPanel>
))}
</Tabs>
);
}

Expand Down
4 changes: 2 additions & 2 deletions client/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const router = createBrowserRouter(
],
{
basename: `/${useURLbasename()}`,
}
},
);

const root = document.getElementById('root');
Expand All @@ -68,7 +68,7 @@ if (root) {
<AppProvider>
<RouterProvider router={router} />
</AppProvider>
</React.StrictMode>
</React.StrictMode>,
);
} else {
throw Error("Couldn't find root element");
Expand Down
6 changes: 4 additions & 2 deletions client/src/route/auth/AccountTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import TabComponent from 'components/tab/TabComponent';
import { TabData } from 'components/tab/subcomponents/TabRender';

const tabs: TabData[] = [
const accountTab: TabData[] = [
{
label: 'Profile',
body: <>Profile - potentially visible to other users.</>,
Expand All @@ -13,8 +13,10 @@ const tabs: TabData[] = [
},
];

const scope: TabData[][] = [];

function AccountTabs() {
return <TabComponent tabs={tabs} />;
return <TabComponent assetType={accountTab} scope={scope} />;
}

export default AccountTabs;
14 changes: 7 additions & 7 deletions client/src/route/digitaltwins/DigitalTwins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ import tabs from './DigitalTwinTabData';
function DTContent() {
const DTurl = useURLforDT();

const tabData: TabData[] = tabs.map((tab, i) => ({
const DTTab: TabData[] = tabs.map((tab) => ({
label: tab.label,
body: (
<>
<Typography variant="body1">{tab.body}</Typography>
{i === 0 && (
<>
<Iframe title={`JupyterLight-Demo-${tab.label}`} url={DTurl} />
</>
)}
<>
{' '}
<Iframe title={`JupyterLight-Demo-${tab.label}`} url={DTurl} />{' '}
</>
</>
),
}));

return (
<Layout>
<TabComponent tabs={tabData} />
<TabComponent assetType={DTTab} scope={[]} />
</Layout>
);
}
Expand Down
Loading

0 comments on commit 71feb8c

Please sign in to comment.