-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #756 from MetaCell/feature/CH-140
Library updates and small fixes
- Loading branch information
Showing
122 changed files
with
3,753 additions
and
10,656 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
], | ||
ignorePatterns: ['dist', '.eslintrc.cjs', 'src/rest/*'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react-refresh'], | ||
rules: { | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/favicon.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>CloudHarness sample application</title> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
|
||
</html> |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import React from 'react'; | ||
import './styles/style.less'; | ||
|
||
import RestTest from './components/RestTest'; | ||
import Version from './components/Version'; | ||
|
||
|
||
const Main = () => ( | ||
<> | ||
<img src="/assets/icon.png" /> | ||
<h1>Sample React application is working!</h1> | ||
<img src="/logo.png" width="800" /> | ||
<h1>__APP_NAME__ React application is working!</h1> | ||
<Version /> | ||
<RestTest /> | ||
<p>See api documentation <a href="/api/ui">here</a></p> | ||
<p>See api documentation <a href="/api/ui/">here</a></p> | ||
</> | ||
); | ||
) | ||
|
||
|
||
export default Main; | ||
export default Main; |
12 changes: 7 additions & 5 deletions
12
application-templates/webapp/frontend/src/components/RestTest.tsx
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,17 +1,19 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { useState, useEffect } from 'react'; | ||
|
||
|
||
import { TestApi } from '../rest/api' | ||
import { TestApi } from '../rest/apis/TestApi' | ||
const test = new TestApi(); | ||
|
||
|
||
|
||
const RestTest = () => { | ||
const [result, setResult] = useState(null); | ||
const [result, setResult] = useState<any>(null); | ||
useEffect(() => { | ||
test.ping().then(r => setResult(r), () => setResult({ data: "API error"})); | ||
test.ping().then((r) => setResult(r), () => setResult( "API error")); | ||
}, []); | ||
|
||
|
||
return result ? <p>Backend answered: { result.data } </p> : <p>Backend did not answer</p> | ||
return result ? <p>Backend answered: { result } </p> : <p>Backend did not answer</p> | ||
} | ||
|
||
export default RestTest; |
19 changes: 19 additions & 0 deletions
19
application-templates/webapp/frontend/src/components/Version.tsx
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,19 @@ | ||
import { useState, useEffect } from 'react'; | ||
|
||
|
||
|
||
const Version = () => { | ||
const [result, setResult] = useState<any>(null); | ||
useEffect(() => { | ||
fetch("/proxy/common/api/version", { | ||
headers: { | ||
'Accept': 'application/json' | ||
} | ||
}).then(r => r.json().then(j => setResult(j)), () => setResult("API error")); | ||
}, []); | ||
|
||
|
||
return result ? <p>Tag: { result?.tag } - Build: {result?.build} </p> : <p>Backend did not answer</p> | ||
} | ||
|
||
export default Version; |
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 @@ | ||
body { | ||
text-align: center; | ||
background-color: '#eeeeee'; | ||
font-family: Roboto, Helvetica, sans-serif; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 { defineConfig, loadEnv } from 'vite' | ||
import react from '@vitejs/plugin-react' | ||
|
||
|
||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig(({ mode }) => { | ||
// Load env file based on `mode` in the current working directory. | ||
// Set the third parameter to '' to load all env regardless of the `VITE_` prefix. | ||
const env = loadEnv(mode, process.cwd(), '') | ||
|
||
const theDomain = env && env.DOMAIN ? env.DOMAIN : 'localhost:5000'; | ||
|
||
console.log('Dev server address: ', theDomain); | ||
|
||
const proxyTarget = theDomain; | ||
const replaceHost = (uri: string, appName: string) => { | ||
const host = (uri.includes("samples.") && uri.replace("samples.", appName + '.')) || uri; | ||
console.log('Proxy target: ', host); | ||
return host; | ||
} | ||
|
||
|
||
return { | ||
plugins: [react()], | ||
server: { | ||
port: 9000, | ||
proxy: { | ||
'/api/': { | ||
target: replaceHost( proxyTarget, 'samples'), | ||
secure: false, | ||
changeOrigin: true, | ||
}, | ||
'/proxy/common/api': { | ||
target: replaceHost( proxyTarget, 'common'), | ||
secure: false, | ||
changeOrigin: true, | ||
rewrite: (path) => path.replace(/^\/proxy\/common\/api/, '/api') | ||
} | ||
} | ||
}}} | ||
) |
Oops, something went wrong.