mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
indecate FT cloud status
This commit is contained in:
@@ -41,7 +41,7 @@ export const FT_triggerCloudBuild = functions.https.onCall(
|
||||
const buildId = resp.metadata.build.id;
|
||||
const logUrl = resp.metadata.build.logUrl;
|
||||
|
||||
await db.doc(schemaPath).update({ cloudBuildLogs: logUrl });
|
||||
await db.doc(schemaPath).update({ cloudBuild: { logUrl, buildId } });
|
||||
console.log({ buildId, logUrl });
|
||||
|
||||
if (buildId && logUrl) {
|
||||
@@ -60,27 +60,23 @@ export const FT_triggerCloudBuild = functions.https.onCall(
|
||||
}
|
||||
);
|
||||
|
||||
// export const FT_cloudBuildUpdates = functions.pubsub
|
||||
// .topic("cloud-builds")
|
||||
// .onPublish(async (message, context) => {
|
||||
// console.log(JSON.stringify(message));
|
||||
// const { buildId, status } = message.attributes;
|
||||
// console.log(JSON.stringify({ buildId, status }));
|
||||
// //message
|
||||
// //status: "SUCCESS"
|
||||
// //buildId: "1a6d7819-aa35-486c-a29c-fb67eb39430f"
|
||||
export const FT_cloudBuildUpdates = functions.pubsub
|
||||
.topic("cloud-builds")
|
||||
.onPublish(async (message, context) => {
|
||||
console.log(JSON.stringify(message));
|
||||
const { buildId, status } = message.attributes;
|
||||
console.log(JSON.stringify({ buildId, status }));
|
||||
//message
|
||||
//status: "SUCCESS"
|
||||
//buildId: "1a6d7819-aa35-486c-a29c-fb67eb39430f"
|
||||
|
||||
// const query = await db
|
||||
// .collection("cloudFunctions")
|
||||
// .where("buildId", "==", buildId)
|
||||
// .get();
|
||||
const query = await db
|
||||
.collection("_FIRETABLE_/settings/schema")
|
||||
.where("cloudBuild.buildId", "==", buildId)
|
||||
.get();
|
||||
|
||||
// if (query.docs.length !== 0) {
|
||||
// const update = { status };
|
||||
// if (status === "SUCCESS" || status === "FAILURE") {
|
||||
// update["buildDuration.end"] = serverTimestamp();
|
||||
// }
|
||||
// await query.docs[0].ref.update(update);
|
||||
// }
|
||||
// return true;
|
||||
// });
|
||||
if (query.docs.length !== 0) {
|
||||
await query.docs[0].ref.update({ "cloudBuild.status": status });
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -18,7 +18,6 @@ import { useFiretableContext } from "contexts/FiretableContext";
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
import Form from "@antlerengineering/form-builder";
|
||||
import { newSparkForm } from "./forms";
|
||||
|
||||
const NewSpark = ({ handleAddSpark }) => {
|
||||
const { tableState } = useFiretableContext();
|
||||
const columns = Object.keys(tableState?.columns as any);
|
||||
|
||||
@@ -15,10 +15,10 @@ import {
|
||||
DialogTitle,
|
||||
DialogContentText,
|
||||
Dialog,
|
||||
Badge,
|
||||
CircularProgress,
|
||||
} from "@material-ui/core";
|
||||
|
||||
import SparkIcon from "@material-ui/icons/OfflineBolt";
|
||||
|
||||
import { SnackContext } from "contexts/SnackContext";
|
||||
import { useFiretableContext } from "contexts/FiretableContext";
|
||||
import CodeEditor from "../editors/CodeEditor";
|
||||
@@ -29,13 +29,13 @@ const useStyles = makeStyles(() =>
|
||||
padding: 0,
|
||||
minWidth: 32,
|
||||
},
|
||||
progress: { position: "absolute", marginLeft: -2, marginTop: -2.5 },
|
||||
})
|
||||
);
|
||||
|
||||
export default function SparksEditor() {
|
||||
const classes = useStyles();
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
const { tableState, tableActions } = useFiretableContext();
|
||||
const snackContext = useContext(SnackContext);
|
||||
const { requestConfirmation } = useConfirmation();
|
||||
@@ -71,19 +71,31 @@ export default function SparksEditor() {
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const cloudBuild = tableState?.config.tableConfig.doc.cloudBuild;
|
||||
return (
|
||||
<>
|
||||
<Tooltip title="Edit sparks">
|
||||
<Button
|
||||
onClick={() => setOpen(true)}
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
aria-label="Sparks"
|
||||
className={classes.button}
|
||||
>
|
||||
<SparkIcon />
|
||||
</Button>
|
||||
<div>
|
||||
{["QUEUED", "WORKING"].includes(cloudBuild?.status) && (
|
||||
<CircularProgress className={classes.progress} size={37} />
|
||||
)}
|
||||
|
||||
<Button
|
||||
onClick={() => setOpen(true)}
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
aria-label="Sparks"
|
||||
className={classes.button}
|
||||
>
|
||||
{"ERROR" === cloudBuild?.status ? (
|
||||
<Badge color={"error"}>
|
||||
<SparkIcon />
|
||||
</Badge>
|
||||
) : (
|
||||
<SparkIcon />
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
||||
<Dialog
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
import firebase from "firebase/app";
|
||||
import "firebase/auth";
|
||||
import "firebase/firestore";
|
||||
import "firebase/functions";
|
||||
import "firebase/storage";
|
||||
|
||||
export let auth: any = false;
|
||||
|
||||
export let db: any = false;
|
||||
|
||||
export let bucket: any = false;
|
||||
export let functions: any = false;
|
||||
|
||||
export let googleProvider: any = false;
|
||||
|
||||
console.log(`fetching config for ${window.location.hostname.split(".")[0]}`);
|
||||
fetch(
|
||||
`https://us-central1-firetable-magic.cloudfunctions.net/getWebAppConfig?projectId=${
|
||||
window.location.hostname.split(".")[0] ?? "antler-vc"
|
||||
}`
|
||||
)
|
||||
.then(async (response) => {
|
||||
const config = await response.json();
|
||||
console.log({ config });
|
||||
firebase.initializeApp(config);
|
||||
auth = firebase.auth();
|
||||
|
||||
db = firebase.firestore();
|
||||
// db.settings({ cacheSizeBytes: firebase.firestore.CACHE_SIZE_UNLIMITED });
|
||||
// db.enablePersistence({ synchronizeTabs: true });
|
||||
|
||||
bucket = firebase.storage();
|
||||
functions = firebase.functions();
|
||||
|
||||
googleProvider = new firebase.auth.GoogleAuthProvider().setCustomParameters(
|
||||
{
|
||||
prompt: "select_account",
|
||||
}
|
||||
);
|
||||
})
|
||||
.catch((err) => console.log(err));
|
||||
|
||||
export const deleteField = firebase.firestore.FieldValue.delete;
|
||||
Reference in New Issue
Block a user