mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
build logs
This commit is contained in:
@@ -130,6 +130,7 @@ export default function FieldSettings(props: IMenuModalProps) {
|
||||
body: {
|
||||
tablePath: tableState?.tablePath,
|
||||
pathname: window.location.pathname,
|
||||
tableConfigPath: tableState?.config.tableConfig.path,
|
||||
},
|
||||
params: [],
|
||||
});
|
||||
|
||||
@@ -92,6 +92,7 @@ export default function ExtensionsEditor() {
|
||||
body: {
|
||||
tablePath: tableState?.tablePath,
|
||||
pathname: window.location.pathname,
|
||||
tableConfigPath: tableState?.config.tableConfig.path,
|
||||
},
|
||||
});
|
||||
analytics.logEvent("deployed_extensions");
|
||||
|
||||
@@ -3,10 +3,8 @@ import useRouter from "hooks/useRouter";
|
||||
import useCollection from "hooks/useCollection";
|
||||
import { useProjectContext } from "contexts/ProjectContext";
|
||||
import useStateRef from "react-usestateref";
|
||||
import { db } from "../../../firebase";
|
||||
import { useSnackLogContext } from "contexts/SnackLogContext";
|
||||
import { isCollectionGroup } from "utils/fns";
|
||||
|
||||
import _throttle from "lodash/throttle";
|
||||
import { format } from "date-fns";
|
||||
import moment from "moment";
|
||||
@@ -390,42 +388,25 @@ function SnackLog({ log, onClose, onOpenPanel }) {
|
||||
export default function TableLogs() {
|
||||
const router = useRouter();
|
||||
const { tableState } = useProjectContext();
|
||||
|
||||
const classes = useStyles();
|
||||
const [panalOpen, setPanelOpen] = useState(false);
|
||||
const [buildURLConfigured, setBuildURLConfigured] = useState(true);
|
||||
const [tabIndex, setTabIndex] = React.useState(0);
|
||||
const snackLogContext = useSnackLogContext();
|
||||
const functionConfigPath = tableState?.config.functionConfigPath;
|
||||
console.log(functionConfigPath);
|
||||
|
||||
const [collectionState, collectionDispatch] = useCollection({});
|
||||
useEffect(() => {
|
||||
checkBuildURL();
|
||||
}, []);
|
||||
|
||||
const checkBuildURL = async () => {
|
||||
const settingsDoc = await db.doc(SETTINGS).get();
|
||||
const buildUrl = settingsDoc.get("buildUrl");
|
||||
if (!buildUrl) {
|
||||
setBuildURLConfigured(false);
|
||||
if (functionConfigPath) {
|
||||
const path = `${functionConfigPath}/buildLogs`;
|
||||
console.log(path);
|
||||
collectionDispatch({
|
||||
path,
|
||||
orderBy: [{ key: "startTimeStamp", direction: "desc" }],
|
||||
limit: 30,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const tableCollection = decodeURIComponent(router.match.params.id);
|
||||
const buildStreamID =
|
||||
(isCollectionGroup() ? TABLE_GROUP_SCHEMAS : TABLE_SCHEMAS) +
|
||||
"/" +
|
||||
tableCollection
|
||||
.split("/")
|
||||
.filter(function (_, i) {
|
||||
// replace IDs with subTables that appears at even indexes
|
||||
return i % 2 === 0;
|
||||
})
|
||||
.join("/subTables/");
|
||||
|
||||
const [collectionState] = useCollection({
|
||||
path: `${buildStreamID}/buildLogs`,
|
||||
orderBy: [{ key: "startTimeStamp", direction: "desc" }],
|
||||
limit: 30,
|
||||
});
|
||||
}, [functionConfigPath]);
|
||||
const latestLog = collectionState?.documents?.[0];
|
||||
const latestStatus = latestLog?.status;
|
||||
const latestActiveLog =
|
||||
@@ -491,7 +472,7 @@ export default function TableLogs() {
|
||||
}
|
||||
children={
|
||||
<>
|
||||
{!latestStatus && buildURLConfigured && (
|
||||
{!latestStatus && (
|
||||
<EmptyState
|
||||
message="No Logs Found"
|
||||
description={
|
||||
@@ -499,26 +480,6 @@ export default function TableLogs() {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!latestStatus && !buildURLConfigured && (
|
||||
<EmptyState
|
||||
message="Need Configuration"
|
||||
description={
|
||||
<>
|
||||
<Typography>
|
||||
Function builder is not currently setup.{" "}
|
||||
</Typography>
|
||||
<Button
|
||||
component={"a"}
|
||||
href={routes.projectSettings}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Go to Settings
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{latestStatus && (
|
||||
<div className={classes.root}>
|
||||
<Tabs
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import useTableData from "./useTableData";
|
||||
import useTableConfig from "./useTableConfig";
|
||||
|
||||
export type TableActions = {
|
||||
// TODO: Stricter types here
|
||||
column: {
|
||||
@@ -31,6 +30,7 @@ export type TableState = {
|
||||
sparks: string;
|
||||
compiledExtension: string;
|
||||
extensionObjects?: any[];
|
||||
functionConfigPath?: string;
|
||||
};
|
||||
columns: any[];
|
||||
rows: { [key: string]: any }[];
|
||||
@@ -77,6 +77,7 @@ export default function useTable() {
|
||||
sparks: tableConfig.doc?.sparks,
|
||||
compiledExtension: tableConfig.doc?.compiledExtension,
|
||||
extensionObjects: tableConfig.doc?.extensionObjects,
|
||||
functionConfigPath: tableConfig.doc?.functionConfigPath,
|
||||
tableConfig,
|
||||
},
|
||||
rows: tableState.rows,
|
||||
|
||||
@@ -27,7 +27,7 @@ const useTableConfig = (tablePath?: string) => {
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const { doc, columns, rowHeight } = tableConfigState;
|
||||
const { doc, columns, rowHeight, functionConfigPath } = tableConfigState;
|
||||
// TODO: REMOVE THIS
|
||||
// Copy columns, rowHeight to tableConfigState
|
||||
if (doc && columns !== doc.columns) {
|
||||
@@ -36,6 +36,9 @@ const useTableConfig = (tablePath?: string) => {
|
||||
if (doc && rowHeight !== doc.rowHeight) {
|
||||
documentDispatch({ rowHeight: doc.rowHeight });
|
||||
}
|
||||
if (doc && functionConfigPath !== doc.functionConfigPath) {
|
||||
documentDispatch({ functionConfigPath: doc.functionConfigPath });
|
||||
}
|
||||
}, [tableConfigState.doc]);
|
||||
/** used for specifying the table in use
|
||||
* @param table firestore collection path
|
||||
|
||||
Reference in New Issue
Block a user