Skip to content

Commit fd566de

Browse files
authored
Merge pull request #14 from sharadregoti/v0.5.1
V0.5.1
2 parents b7ab535 + f005632 commit fd566de

31 files changed

+1418
-337
lines changed
+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Go
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
- v*
7+
8+
jobs:
9+
v2:
10+
name: "Version Relase"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Setup stage golang environment
14+
uses: actions/setup-go@v4
15+
with:
16+
go-version: stable
17+
id: go
18+
19+
- name: Check out code into the Go module directory
20+
uses: actions/checkout@v3
21+
22+
- name: Cache Go Modules
23+
uses: actions/cache@v1
24+
with:
25+
path: ~/go/pkg/mod
26+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
27+
restore-keys: |
28+
${{ runner.os }}-go-
29+
30+
- name: Setup Nodejs and npm
31+
uses: actions/setup-node@v2
32+
with:
33+
node-version: "16"
34+
35+
# - name: Build Frontend
36+
# run: |
37+
# cd devops-frontend
38+
# yarn install --frozen-lockfile
39+
# yarn build
40+
41+
- name: Install goreleaser
42+
run: |
43+
wget -q https://github.com/goreleaser/goreleaser/releases/download/v1.17.2/goreleaser_Linux_x86_64.tar.gz
44+
tar -xzf goreleaser_Linux_x86_64.tar.gz
45+
sudo mv goreleaser /usr/local/bin/
46+
47+
- uses: ypicard/get-branch-name-github-action@v1
48+
id: current-branch
49+
50+
- name: Set up Google Application Credentials
51+
run: |
52+
echo '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}' > credentials.json
53+
echo 'GOOGLE_APPLICATION_CREDENTIALS=${{ github.workspace }}/credentials.json' >> $GITHUB_ENV
54+
55+
- name: Run Build and Release script
56+
run: |
57+
# Download Go Releaser
58+
echo "Echo: Current branch is ${{ steps.current-branch.outputs.branch}}"
59+
60+
# echo "Creating tag..."
61+
git config --global user.email "[email protected]"
62+
git config --global user.name "sharadregoti"
63+
git fetch origin ${{ steps.current-branch.outputs.branch}}:${{ steps.current-branch.outputs.branch}}
64+
git checkout ${{ steps.current-branch.outputs.branch}}
65+
git checkout -b "temp-branch"
66+
TIMESTAMP=$(date +%s)
67+
git tag -a "v0.5.1" -m "dummy tag"
68+
echo "TIMESTAMP=$TIMESTAMP" >> $GITHUB_ENV
69+
70+
echo "Running script..."
71+
bash release.sh
72+
73+
# - name: Run Build and Release script
74+
# run: |
75+
# # Download Go Releaser
76+
# echo "Echo: Current branch is ${{ steps.current-branch.outputs.branch}}"
77+
78+
# # echo "Creating tag..."
79+
# git config --global user.email "[email protected]"
80+
# git config --global user.name "sharadregoti"
81+
# git fetch origin ${{ steps.current-branch.outputs.branch}}:${{ steps.current-branch.outputs.branch}}
82+
# git checkout ${{ steps.current-branch.outputs.branch}}
83+
# git tag -a ${{ steps.current-branch.outputs.branch}} -m "dummy tag"
84+
# echo "TIMESTAMP=$TIMESTAMP" >> $GITHUB_ENV
85+
86+
# echo "Running script..."
87+
# bash release.sh

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,5 @@ dist-ssr
4646
*.njsproj
4747
*.sln
4848
*.sw?
49+
50+
gcs-storage-admin.json

.goreleaser.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ before:
33
- go mod tidy
44
builds:
55
- id: devops-core
6+
env:
7+
- CGO_ENABLED=0
68
flags:
79
- -tags=release
810
main: ./cmd/devops
@@ -46,3 +48,4 @@ blobs:
4648
- devops-core
4749
extra_files:
4850
- glob: ./install.sh
51+
- glob: devops-frontend/ui.tar.gz

cmd/devops/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"github.com/spf13/viper"
2525
)
2626

27-
const VERSION = "0.5.0"
27+
const VERSION = "0.5.1"
2828

2929
// @title NEW Devops API
3030
// @version v0.1.0

devops-frontend/package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsc && vite build",
8+
"build": "vite build",
99
"preview": "vite preview",
1010
"codegen": "rm -rf src/generated-sources/openapi; openapi-generator-cli generate -i ./json-placeholder-api.yaml -o src/generated-sources/openapi -g typescript-fetch --additional-properties=supportsES6=true,npmVersion=6.9.0,typescriptThreePlus=true"
1111
},
1212
"dependencies": {
1313
"@monaco-editor/react": "^4.4.6",
14-
"@reduxjs/toolkit": "^1.9.1",
14+
"@reduxjs/toolkit": "^1.9.3",
15+
"@types/react-router-dom": "^5.3.3",
1516
"antd": "^5.1.6",
1617
"axios": "^1.2.3",
1718
"fuse.js": "^6.6.2",
@@ -21,6 +22,7 @@
2122
"react-dom": "^18.2.0",
2223
"react-fuzzy": "^1.3.0",
2324
"react-redux": "^8.0.5",
25+
"react-router-dom": "^6.10.0",
2426
"react-use-websocket": "^4.3.1",
2527
"redux": "^4.2.0",
2628
"redux-thunk": "^2.4.2",
@@ -41,4 +43,4 @@
4143
"typescript": "^4.9.3",
4244
"vite": "^4.0.0"
4345
}
44-
}
46+
}

devops-frontend/src/App.tsx

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
import Home from './pages/Home'
2+
import PluginSelector from './pages/PluginSelector'
23
import { ConfigProvider, theme } from 'antd'
34
import './App.css'
5+
import { BrowserRouter as Router, Route, Routes, useParams } from 'react-router-dom';
6+
import { Provider } from 'react-redux';
7+
import store from './redux/store';
48

59
function App() {
6-
710
return (
811
<ConfigProvider
912
theme={{
1013
algorithm: theme.defaultAlgorithm,
1114
}}
1215
>
13-
<Home />
16+
<Provider store={store}>
17+
<Router>
18+
<Routes>
19+
<Route path="/" element={<PluginSelector />} />
20+
<Route path="/plugin/:pluginName/session/:sessionId/:authId/:contextId" element={<Home />} />
21+
{/* <Route path="/project/:projectId" element={<Project />} />
22+
<Route path="/project" element={<ProjectSelector />} /> */}
23+
</Routes>
24+
</Router>
25+
</Provider>
1426
</ConfigProvider>
1527
)
1628
}

devops-frontend/src/components/infoCard/InfoCard.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ const InfoCard: React.FC<InfoCardPropsTypes> = ({ title, content }) => {
3030
Object.entries(content).map(([key, value]: [string, string]) => (
3131
// Object.entries(content).slice(0, 4).map(([key, value]: [string, string]) => (
3232
<span style={keyValueStyle} key={key} title={`${key}: ${value}`}>
33-
{key}: {value}
33+
{/* {key}: {value} */}
34+
{value}
3435
</span>
3536
))}
3637
</Card>

devops-frontend/src/components/isolator/Isolator.tsx

+32-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,34 @@ export type InfoCardPropsTypes = {
1717

1818
const IsolatorCard: React.FC<InfoCardPropsTypes> = ({ currentIsolator, defaultIsolator, isolators, frequentlyUsed, appConfig, onNamespaceChange }) => {
1919
const onChange = (e: RadioChangeEvent) => {
20-
console.log("Namespace change 1", e.target.value);
2120
onNamespaceChange(e.target.value)
2221
};
2322

23+
const [selectWidth, setSelectWidth] = useState()
24+
25+
function getTextWidth(text, font) {
26+
const canvas = document.createElement('canvas');
27+
const context = canvas.getContext('2d');
28+
context.font = font;
29+
const metrics = context.measureText(text);
30+
return metrics.width;
31+
}
32+
33+
useEffect(() => {
34+
if (isolators.length === 0) {
35+
return
36+
}
37+
38+
const longestIsolatorName = isolators
39+
? isolators.reduce((longest, isolator) => {
40+
return isolator.length > longest.length ? isolator : longest;
41+
}, '')
42+
: '';
43+
44+
const selectWidth = getTextWidth(longestIsolatorName, '16px Arial') + 50; // 50px extra for padding and dropdown arrow
45+
setSelectWidth(selectWidth);
46+
}, [isolators])
47+
2448
return (
2549
<>
2650
<Row>
@@ -31,13 +55,17 @@ const IsolatorCard: React.FC<InfoCardPropsTypes> = ({ currentIsolator, defaultIs
3155
<Select
3256
defaultValue={defaultIsolator}
3357
showSearch
34-
style={{ width: "150px", margin: "5px" }}
58+
value={currentIsolator}
59+
style={{ width: selectWidth, margin: "5px" }}
3560
onChange={(value: string) => onNamespaceChange(value)}
36-
options={isolators.map((val) => ({ "value": val, "label": val }))}
61+
filterSort={(optionA, optionB) => optionA.value.localeCompare(optionB.value)}
62+
options={isolators.map((val) => {
63+
return { "value": val, "label": val }
64+
})}
3765
/>
3866
</Col>
3967
</Row>
40-
<Row>
68+
<Row style={{ width: selectWidth }}>
4169
<Col flex={""} >
4270
<Radio.Group onChange={onChange} value={currentIsolator}>
4371
{/* <Space direction="vertical"> */}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import React, { useState } from "react";
2+
import { Card, Descriptions, Space, Typography } from "antd";
3+
import { Action, General, Plugins } from "../../types/InfoCardTypes";
4+
// import './InfoCard.css'
5+
import CheckableTag from "antd/es/tag/CheckableTag";
6+
7+
type RecentlyUsedPropsTypes = {
8+
title: string;
9+
recentlyUsedItems: string[];
10+
// Define an async function
11+
onSearch: (value: string) => void
12+
// onSearch: async (value: string) => {
13+
// content: Action | Plugins | General | { 0: string } | {};
14+
}
15+
16+
const RecentlyUsed: React.FC<RecentlyUsedPropsTypes> = ({ title, recentlyUsedItems, onSearch }) => {
17+
const keyValueStyle = {
18+
display: "block",
19+
maxWidth: "40ch",
20+
whiteSpace: "nowrap",
21+
overflow: "hidden",
22+
textOverflow: "ellipsis",
23+
lineHeight: "1.5",
24+
paddingRight: "1ch",
25+
// display: "block",
26+
};
27+
28+
const [selectedTags, setSelectedTags] = useState<string[]>(['Books']);
29+
30+
const handleChange = (tag: string, checked: boolean) => {
31+
const nextSelectedTags = checked
32+
? [tag]
33+
: selectedTags.filter((t) => t !== tag);
34+
console.log('You are interested in: ', nextSelectedTags);
35+
setSelectedTags(nextSelectedTags);
36+
37+
if (checked) {
38+
onSearch(tag);
39+
}
40+
};
41+
42+
// const tagsData = ['Movies', 'Books', 'Music', 'Sports'];
43+
44+
return (
45+
<>
46+
<Card
47+
title={title}
48+
size="small"
49+
>
50+
<>
51+
{/* <span style={{ marginRight: 8 }}>Categories:</span> */}
52+
{/* <Space size={[0, 8]} wrap> */}
53+
{recentlyUsedItems.map((tag) => (
54+
<CheckableTag
55+
key={tag}
56+
checked={selectedTags.includes(tag)}
57+
onChange={(checked) => handleChange(tag, checked)}
58+
>
59+
{tag}
60+
</CheckableTag>
61+
))}
62+
{/* </Space> */}
63+
</>
64+
</Card>
65+
</>
66+
);
67+
}
68+
69+
70+
export default RecentlyUsed;

0 commit comments

Comments
 (0)