Skip to content

Commit 1b7863f

Browse files
committed
add view reload on close action (resolves #113)
1 parent b397549 commit 1b7863f

File tree

4 files changed

+32
-36
lines changed

4 files changed

+32
-36
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ RUN cd ui/ && \
1313
export NODE_ENV=production && \
1414
npx tailwindcss build -o src/index.css -c src/tailwind.config.js && \
1515
npm run build && \
16-
mv ./build ../
16+
mv build/ gitconvex-ui/ && \
17+
mv gitconvex-ui/ ../
1718

1819
RUN cd /opt/workroom/gitconvex && \
1920
mkdir dist/ && \
2021
go build -o ./dist/ && \
21-
mv build/ dist/
22+
mv gitconvex-ui/ dist/
2223

2324
EXPOSE 9001
2425

ui/src/Components/DashBoard/Help/Help.js

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { library } from "@fortawesome/fontawesome-svg-core";
22
import { fab } from "@fortawesome/free-brands-svg-icons";
33
import { fas } from "@fortawesome/free-solid-svg-icons";
44
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
5+
import axios from "axios";
56
import firebase from "firebase/app";
67
import "firebase/database";
78
import React, { useEffect, useState } from "react";
@@ -73,38 +74,30 @@ export default function Help() {
7374
setShowUpdatePane(true);
7475
setLoading(true);
7576

76-
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
77-
const firebaseConfig = {
78-
apiKey: "AIzaSyB8KGsL5Fom0EvM3bsZYj4m08Dp7sqiLCY",
79-
authDomain: "gitconvex.firebaseapp.com",
80-
databaseURL: "https://gitconvex.firebaseio.com",
81-
projectId: "gitconvex",
82-
storageBucket: "gitconvex.appspot.com",
83-
messagingSenderId: "719815446646",
84-
appId: "1:719815446646:web:53d2d2627eb549b7120f57",
85-
measurementId: "G-ZJ3KLZT0EF",
86-
};
77+
const firebaseEndpoint =
78+
"https://us-central1-gitconvex.cloudfunctions.net/gitconvexVersion";
8779

88-
if (firebase.apps[0] && firebase.apps[0].name === "update-app") {
89-
firebase.apps[0].delete();
90-
return;
91-
}
80+
axios({
81+
url: firebaseEndpoint,
82+
method: "GET",
83+
headers: {
84+
Accept: "application/json",
85+
},
86+
})
87+
.then((res) => {
88+
const { version } = res.data;
89+
setLoading(false);
9290

93-
const app = firebase.initializeApp(firebaseConfig, "update-app");
94-
const db = app.database();
95-
const ref = db.ref("/");
96-
97-
ref.on("value", (val) => {
98-
const { version } = val.val();
99-
setLoading(false);
100-
101-
if (currentVersion === version) {
102-
setIsLatest(true);
103-
setAvailableUpdate("");
104-
} else {
105-
setAvailableUpdate(version);
106-
}
107-
});
91+
if (currentVersion === version) {
92+
setIsLatest(true);
93+
setAvailableUpdate("");
94+
} else {
95+
setAvailableUpdate(version);
96+
}
97+
})
98+
.catch((err) => {
99+
console.log(err);
100+
});
108101
}
109102

110103
return (

ui/src/Components/DashBoard/Repository/GitComponents/GitOperation/GitOperationComponent.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ export default function GitOperationComponent(props) {
429429
className="git-ops--backdrop--close"
430430
onClick={() => {
431431
setAction("");
432+
const localReload = viewReload + 1;
433+
setViewReload(localReload);
432434
}}
433435
>
434436
X

ui/src/Components/DashBoard/Repository/GitComponents/GitOperation/StageComponent.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function StageComponent(props) {
77
const { stageComponents, repoId } = props;
88

99
const [allStaged, setAllStaged] = useState(false);
10-
const [loading, setLodaing] = useState(false);
10+
const [loading, setLoading] = useState(false);
1111
const [errorInd, setErrorInd] = useState(false);
1212

1313
useEffect(() => {
@@ -17,7 +17,7 @@ export default function StageComponent(props) {
1717
}, [props]);
1818

1919
function stageAllChanges() {
20-
setLodaing(true);
20+
setLoading(true);
2121
axios({
2222
url: globalAPIEndpoint,
2323
method: "POST",
@@ -30,7 +30,7 @@ export default function StageComponent(props) {
3030
},
3131
})
3232
.then((res) => {
33-
setLodaing(false);
33+
setLoading(false);
3434
if (res.data.data && !res.data.error) {
3535
if (res.data.data.stageAllItems === "ALL_STAGED") {
3636
setAllStaged(true);
@@ -39,7 +39,7 @@ export default function StageComponent(props) {
3939
})
4040
.catch((err) => {
4141
console.log(err);
42-
setLodaing(false);
42+
setLoading(false);
4343
setErrorInd(true);
4444
});
4545
}

0 commit comments

Comments
 (0)