Skip to content

Commit

Permalink
Merge pull request #1474 from rowyio/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
shamsmosowi authored Nov 8, 2023
2 parents ab6c2d5 + 46826bc commit 7aad9fd
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 14 deletions.
4 changes: 1 addition & 3 deletions src/components/CodeEditor/extensions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ type PushNotificationBody = (

type TaskBody = (context: ExtensionContext) => Promise<any>;

type BuildshipAuthenticatedTriggerBody = (
context: ExtensionContext
) => Promise<{
type BuildshipTriggerBody = (context: ExtensionContext) => Promise<{
buildshipConfig: {
projectId: string;
workflowId: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/TableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const TableBody = memo(function TableBody({

if (cell.id.includes("_rowy_select")) {
return (
<StyledCell key={cell.id} role="gridcell">
<StyledCell key={cell.id} role="gridcell" data-frozen="left">
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</StyledCell>
);
Expand Down
3 changes: 2 additions & 1 deletion src/components/Table/TableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export const TableHeader = memo(function TableHeader({
<StyledColumnHeader
key={header.id}
role="columnheader"
style={{ padding: 0 }}
style={{ padding: 0, zIndex: 11 }}
data-frozen="left"
>
{flexRender(
header.column.columnDef.header,
Expand Down
4 changes: 4 additions & 0 deletions src/components/Table/useMenuAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ export function useMenuAction(
async (e?: ClipboardEvent) => {
try {
if (!selectedCell || !selectedCol) return;

// checks which element has focus, if it is not the gridcell it won't paste the copied content inside the gridcell
if (document.activeElement?.role !== "gridcell") return;

let text: string;
// Firefox doesn't allow for reading clipboard data, hence the workaround
if (navigator.userAgent.includes("Firefox")) {
Expand Down
8 changes: 4 additions & 4 deletions src/components/TableModals/ExtensionsModal/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const extensionTypes = [
export type ExtensionType = typeof extensionTypes[number];

export const extensionNames: Record<ExtensionType, string> = {
buildshipAuthenticatedTrigger: "BuildShip Authenticated Trigger",
buildshipAuthenticatedTrigger: "Buildship Trigger",
task: "Task",
docSync: "Doc Sync",
historySnapshot: "History Snapshot",
Expand Down Expand Up @@ -63,7 +63,7 @@ export interface IRuntimeOptions {
export const triggerTypes: ExtensionTrigger[] = ["create", "update", "delete"];

const extensionBodyTemplate = {
buildshipAuthenticatedTrigger: `const extensionBody: BuildshipAuthenticatedTriggerBody = async({row, db, change, ref, logging}) => {
buildshipAuthenticatedTrigger: `const extensionBody: BuildshipTriggerBody = async({row, db, change, ref, logging}) => {
logging.log("extensionBody started")
// Put your endpoint URL and request body below.
Expand All @@ -80,8 +80,8 @@ const extensionBodyTemplate = {
path: ref.path
},
change: {
before: change.before.get(),
after: change.after.get(),
before: change.before.data(),
after: change.after.data(),
},
// Add your own payload here
})
Expand Down
19 changes: 18 additions & 1 deletion src/components/TableToolbar/TableToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import {
userRolesAtom,
compatibleRowyRunVersionAtom,
rowyRunModalAtom,
altPressAtom,
confirmDialogAtom,
} from "@src/atoms/projectScope";
import {
tableScope,
Expand Down Expand Up @@ -91,6 +93,8 @@ function RowSelectedToolBar({
}) {
const [serverDocCount] = useAtom(serverDocCountAtom, tableScope);
const deleteRow = useSetAtom(deleteRowAtom, tableScope);
const [altPress] = useAtom(altPressAtom, projectScope);
const confirm = useSetAtom(confirmDialogAtom, projectScope);

const handleDelete = async () => {
await deleteRow({ path: Object.keys(selectedRows) });
Expand All @@ -107,7 +111,20 @@ function RowSelectedToolBar({
variant="outlined"
startIcon={<DeleteIcon fontSize="small" />}
color="error"
onClick={handleDelete}
onClick={
altPress
? handleDelete
: () => {
confirm({
title: `Delete ${
Object.values(selectedRows).length
} of ${serverDocCount} selected rows?`,
confirm: "Delete",
confirmColor: "error",
handleConfirm: handleDelete,
});
}
}
>
Delete
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/components/fields/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export interface ISideDrawerFieldProps<T = any> {
/** Update the local value. Also calls onDirty */
onChange: (value: T) => void;
/** Call when user input is ready to be saved (e.g. onBlur) */
onSubmit: () => void;

onSubmit: () => void;
/** Field locked. Do NOT check `column.locked` */
disabled: boolean;

Expand Down
12 changes: 9 additions & 3 deletions src/hooks/useFirestoreCollectionWithAtom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
setDoc,
doc,
deleteDoc,
updateDoc,
deleteField,
CollectionReference,
Query,
Expand Down Expand Up @@ -263,16 +264,21 @@ export function useFirestoreCollectionWithAtom<
// set the atom’s value to a function that updates a doc in the collection
if (updateDocAtom) {
setUpdateDocAtom(
() => (path: string, update: T, deleteFields?: string[]) => {
() => async (path: string, update: T, deleteFields?: string[]) => {
const updateToDb = { ...update };

if (Array.isArray(deleteFields)) {
for (const field of deleteFields) {
set(updateToDb as any, field, deleteField());
}
}

return setDoc(doc(firebaseDb, path), updateToDb, { merge: true });
try {
return await updateDoc(doc(firebaseDb, path), updateToDb);
} catch (e) {
return await setDoc(doc(firebaseDb, path), updateToDb, {
merge: true,
});
}
}
);
}
Expand Down

0 comments on commit 7aad9fd

Please sign in to comment.