Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:snowflake-key-pair-auth-private-key-does-not-get-removed-upon-rem… #35430

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
ebca2e5
fix:snowflake-key-pair-auth-private-key-does-not-get-removed-upon-rem…
Jagadeesh-90 Aug 6, 2024
6f13673
Merge pull request #35629 from appsmithorg/release
yatinappsmith Aug 12, 2024
8dd5a0b
fix: View mode canvas margin (#35619)
hetunandu Aug 12, 2024
3e212f4
Merge pull request #35646 from appsmithorg/cherry/view-mode-canvas-ma…
hetunandu Aug 13, 2024
b8306f4
chore: Added multiple scripts to trigger profiles (#35546)
nidhi-nair Aug 12, 2024
437fe86
Merge pull request #35648 from appsmithorg/cp/20240813
nidhi-nair Aug 13, 2024
62a3871
fix: Widget Overflow and Show Binding issue (#35651)
hetunandu Aug 13, 2024
84e4ae5
Merge pull request #35660 from appsmithorg/cherrypick/widget-scroll-bug
hetunandu Aug 13, 2024
2ffa032
chore: Add indexes for policyMap to improve query response time (#35676)
abhvsn Aug 14, 2024
0bec00f
chore: Cherry pick indexes for `policyMap` to improve query response …
abhvsn Aug 14, 2024
860fb9e
fix: changes in how themes are updated/saved after import. (#35692)
sondermanish Aug 14, 2024
c5c466e
chore: cherry-pick for themes pr to master
abhvsn Aug 15, 2024
084f3a0
20/08 Daily Promotion
abhvsn Aug 20, 2024
0500bb2
chore: Add cleanup and update stage for tenant at the server restart …
abhvsn Aug 20, 2024
4b4f726
chore: Cherry pick for fixing the policyMap migration
abhvsn Aug 20, 2024
15ff97a
21/08 Daily Promotion (#35811)
laveena-en Aug 21, 2024
27d7925
fix: Added back the pencil icon for editable text component (#35855)
albinAppsmith Aug 26, 2024
64ebe15
Merge pull request #35879 from appsmithorg/hotfix/edit-icon
nidhi-nair Aug 26, 2024
9d9524c
Merge branch 'master' of https://github.com/appsmithorg/appsmith into…
albinAppsmith Aug 27, 2024
9da8c49
chore: removed sanitise action functionality from actions span (#35884)
sneha122 Aug 27, 2024
c567b13
Merge pull request #35909 from appsmithorg/conflict/ads/editor-text
yatinappsmith Aug 28, 2024
eec7b74
test: common code change for Workflow tests (#35886)
NandanAnantharamu Aug 28, 2024
d0e5085
ci: Added code for PR comment results with repeat command (#35921)
sagar-qa007 Aug 28, 2024
4885337
ci: Only command name update (#35926)
sagar-qa007 Aug 28, 2024
5ddf6e6
feat: remove-clear-option-for-required-select-widget (#35060)
AnnaHariprasad5123 Aug 28, 2024
d79bad4
fix: API multipart spec flakiness (#35927)
AmanAgarwal041 Aug 28, 2024
09f608d
fix: mysql2 spec flakiness (#35950)
AmanAgarwal041 Aug 28, 2024
3526696
test: fix flaky binary spec (#35861)
rahulbarwal Aug 29, 2024
7cdee52
chore: adding telemetry for klona (#35918)
vsvamsi1 Aug 29, 2024
db3f356
Add a diagnostic script to assist in the debugging of issues with app…
zbuildz Aug 29, 2024
a36b45d
chore: complimentary pr for CD migration changes (#35876)
sondermanish Aug 29, 2024
ff0c613
feat: added the code to sort the collection in the proper order. (#35…
Naveen-Goud Aug 29, 2024
f3374bd
feat: Added SSH Tunnel for Postgres (#35449)
AnnaHariprasad5123 Aug 29, 2024
83326ef
chore: optimise pages API in view mode (#35915)
subrata71 Aug 29, 2024
67de8c1
test: updated tests for checkboxgroup (#35945)
NandanAnantharamu Aug 29, 2024
abce472
chore: removed value from actionExecutionRequestParamsValueMap (#35989)
NilanshBansal Aug 30, 2024
4b89c1c
chore: stability pr for changes (#35911)
sondermanish Aug 30, 2024
826a33a
fix: Prevent Errors in Debugger When Deleting List Widget (#35820)
jacquesikot Aug 30, 2024
827f22e
perf: JSONForm infinite re-rendering when field validation is set (#3…
ashit-rath Aug 30, 2024
a9ca63c
fix: Action redesign/remove container query (#36014)
albinAppsmith Aug 30, 2024
e69ca89
fix: Intercom setting anonymous user a common user id (#36017)
hetunandu Aug 30, 2024
bf5d73a
chore: Add admin email for installation complete event even if the us…
abhvsn Aug 30, 2024
bdeeea5
test: fix inline editing spec (#35986)
NandanAnantharamu Aug 30, 2024
b3c79f0
test: Fix mockdb flaky test case (#35959)
sagar-qa007 Aug 30, 2024
7c932f9
chore: reconnect ds detached from datasource editor part 1 (#35907)
sneha122 Sep 2, 2024
e501413
chore: Added threads to logging (#36042)
sondermanish Sep 2, 2024
bd8c0de
feat: add select widget (#35849)
znamenskii-ilia Sep 2, 2024
4516129
fix: postgres plugin blocking call (#36046)
NilanshBansal Sep 2, 2024
f02b448
fix: width of tooltip box is larger than text on the property panel (…
ALOK9442 Sep 3, 2024
6ad6a11
chore: Added pg branch (#36086)
sagar-qa007 Sep 3, 2024
72d1815
feat: disable create js object option in workflows editor (#36094)
ayushpahwa Sep 4, 2024
5bed1fc
chore: Enable netty metrics (#36104)
nidhi-nair Sep 4, 2024
95537e0
ci: add configs for release to pg sync (#35914)
AnaghHegde Sep 4, 2024
4a0c9e8
chore: Enable netty metrics based on env var (#36108)
nidhi-nair Sep 4, 2024
420dc9b
fix: fixed back button to redirect to applications page (#35900)
saicharan-zemoso Sep 4, 2024
2a6885a
fix: Embedded datasource persistence changes for git. (#36109)
sondermanish Sep 4, 2024
50bbc49
fix: Updating the CSS to place the meatball icon in the correct place…
ankitakinger Sep 4, 2024
7d7a601
fix: removed conditional to check for jslib files (#36115)
sondermanish Sep 4, 2024
5aa9392
feat: Action redesign: Updating the config for SMTP plugin to use sec…
ankitakinger Sep 5, 2024
65eb854
fix: Fall of the error toasts wall (#35839)
hetunandu Sep 5, 2024
75599f8
chore: Keep the copy of policies object while updating policyMap (#35…
abhvsn Sep 5, 2024
440ff13
feat: Action redesign: Updating the config for Google AI plugin to us…
ankitakinger Sep 5, 2024
b447b0f
chore: Add metrics to newRelic for update JSobject Collection (#35947)
Sep 5, 2024
1c14d69
chore: added thread logging info for plugins (#36077)
NilanshBansal Sep 5, 2024
a683747
feat: Action redesign: Updating the config for Appsmith AI plugin to …
ankitakinger Sep 5, 2024
b77e27f
chore: Enable capturing metrics at higher freq (#36133)
nidhi-nair Sep 5, 2024
578f2d4
fix: fix issue with forking (#35988)
brayn003 Sep 5, 2024
45a3d81
fix: adding new test cases for git auto-commit (#34913)
brayn003 Sep 5, 2024
4c72fbe
chore: add code for paragraph-text morphing (#36065)
jsartisan Sep 6, 2024
7f55626
fix: Fix test case for api (#36083)
sagar-qa007 Sep 6, 2024
4a7ff64
feat: action redesign, UQI upgrade AWS plugin config to dual zone for…
alex-golovanov Sep 6, 2024
f06a82b
fix: Theming Selected new Font is reverted whenever Color is removed …
jsartisan Sep 6, 2024
322c05e
chore: updated actions fetch logic for consolidated view api (#36096)
sneha122 Sep 6, 2024
7a53aff
feat: add ComboBox wds component (#36052)
znamenskii-ilia Sep 6, 2024
d37e8d2
feat: action redesign, UQI upgrade Open AI plugin config to dual zone…
alex-golovanov Sep 6, 2024
08ec688
test: remove redundant select workspace in cypres test (#36138)
AnaghHegde Sep 6, 2024
c47de98
fix: Colorpicker empty color value regression (#36157)
jsartisan Sep 6, 2024
58b07dd
chore: Update test-build-docker-image.yml to trigger the build on pg …
abhvsn Sep 6, 2024
943cccc
chore: Added logs to allow capturing request id and processing for he…
nidhi-nair Sep 9, 2024
0e601a6
chore: Added details for running local setup (#35968)
sagar-qa007 Sep 9, 2024
188e9f0
fix: Video2 spec flaky fix (#36166)
sagar-qa007 Sep 9, 2024
1b16be8
fix: NPE while creating a policies copy (#36172)
abhvsn Sep 9, 2024
60dbda4
chore: Transitions for IDE (#35714)
hetunandu Sep 9, 2024
ea6b827
chore: add delete API call for rts (#36186)
nsarupr Sep 9, 2024
aac30b6
fix: remove Select key value selects, fix default (#36158)
znamenskii-ilia Sep 9, 2024
b782bde
chore: shadow PR for external contribution #ce-35167 (#36053)
NilanshBansal Sep 9, 2024
d9a3090
Revert "chore: shadow PR for external contribution #ce-35167" (#36202)
NilanshBansal Sep 9, 2024
1cf452f
feat: Improved-error-messages-for-postgres-connection (#35167)
AnnaHariprasad5123 Sep 9, 2024
205ba07
feat: action redesign, UQI upgrade S3 plugin config to dual zone form…
alex-golovanov Sep 9, 2024
9a26066
chore: introduce caching and projection to optimise FPL (#36118)
subrata71 Sep 9, 2024
182dbe7
chore: Revert "fix: fixed back button to redirect to applications pag…
ankitakinger Sep 9, 2024
316f914
fix: updateWithoutPermission updates user instead of saving it (#36206)
nsarupr Sep 10, 2024
b8c4bbc
chore: add uuid supported path (#36221)
AnaghHegde Sep 10, 2024
ad8924d
fix: flaky mongo spec test (#36220)
AmanAgarwal041 Sep 10, 2024
c44c356
fix: Fixed flaky fork template test case (#36200)
sagar-qa007 Sep 10, 2024
70a7164
chore: Make sure each container / pod has its own stdout log files (#…
nidhi-nair Sep 10, 2024
da5d37e
chore: Migration for missing datasource configuration on default rest…
sondermanish Sep 10, 2024
294503b
fix: Remove Gsheets unauth method (#36125)
Sep 10, 2024
cac85bf
Updated Label Config
Nikhil-Nandagopal Sep 10, 2024
fef6e37
Updated Label Config
Nikhil-Nandagopal Sep 10, 2024
a77d608
chore: makeParentDependedOnChildren optimisation only affected nodes …
vsvamsi1 Sep 11, 2024
b5f4c65
chore: fix select1 spec (#36228)
jsartisan Sep 11, 2024
336bc08
feat: Action redesign: Updating the config for Databricks plugin to u…
ankitakinger Sep 11, 2024
bc59bd1
feat: Action redesign: Updating the config for MongoDB plugin to use …
ankitakinger Sep 11, 2024
89154c5
fix: RBAC errors not showing toasts (#36244)
hetunandu Sep 11, 2024
a182e74
chore: Return failure results (#36233)
sagar-qa007 Sep 11, 2024
cd7b66f
fix: Anthropic plugin config updated with better file structure (#36223)
albinAppsmith Sep 11, 2024
1c8712a
fix: fixed page data DB call getting called twice (#36247)
sneha122 Sep 11, 2024
da91a03
fix:approach1
Jagadeesh-90 Sep 11, 2024
91fd967
feat: Action redesign - changes in save and edit datasource (#36222)
albinAppsmith Sep 11, 2024
228af86
feat: Action redesign: Updating the config for Firestore plugin to us…
ankitakinger Sep 11, 2024
1ccb023
fix: Fixed Bug29566 spec with list widget (#36260)
sagar-qa007 Sep 12, 2024
373b2ad
fix:approach1
Jagadeesh-90 Sep 12, 2024
4189a70
chore: Plugin Action Editor Context (#36187)
hetunandu Sep 12, 2024
3030e5e
fix:approach1
Jagadeesh-90 Sep 12, 2024
4379e79
Merge branch 'fix/bug-snowflake-key-pair-auth-private-key-does-not-ge…
Jagadeesh-90 Sep 12, 2024
c11772b
fix:solution with approach1
Jagadeesh-90 Sep 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions app/client/src/components/formControls/FilePickerControl.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import React from "react";
import "@testing-library/jest-dom/extend-expect";
import { act, render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { Provider } from "react-redux";
import { combineReducers, createStore } from "redux";
import { ThemeProvider } from "styled-components";
import { reducer as formReducer } from "redux-form";
import { theme } from "constants/DefaultTheme"; // Adjust the path as necessary
import { BrowserRouter as Router } from "react-router-dom";
import FilePickerControl, { RenderFilePicker } from "./FilePickerControl"; // Adjust the path as necessary
import { Field, reduxForm } from "redux-form";

const rootReducer = combineReducers({
form: formReducer,
});

const mockStore = createStore(rootReducer);

const mockInput = {
value: {},
onChange: jest.fn(),
};

const mockProps = {
input: mockInput,
meta: {},
disabled: false,
onChange: jest.fn(),
};

const TestForm = reduxForm({ form: "testForm" })(() => (
<Field component={RenderFilePicker} name="filePicker" {...mockProps} />
));

const renderComponent = () =>
render(
<Provider store={mockStore}>
<Router>
<ThemeProvider theme={theme}>
<TestForm />
</ThemeProvider>
</Router>
</Provider>
);

describe("FilePickerControl Component", () => {
beforeEach(() => {
jest.clearAllMocks();
});

test("renders the component", () => {
renderComponent();
expect(screen.getByText("Select")).toBeInTheDocument();
});

test("selects a file and triggers onChange", async () => {
renderComponent();

const file = new File(["file contents"], "example.txt", {
type: "text/plain",
});

userEvent.click(screen.getByText("Select"));
userEvent.click(screen.getByText("Browse"));

const fileInput = document.querySelector('input[type="file"]') as HTMLInputElement;

await act(async () => {
if (fileInput) {
console.log('File input found, uploading file...');
await userEvent.upload(fileInput, file);
console.log('File uploaded.');
} else {
throw new Error("File input not found");
}
});

await waitFor(() => {
console.log('Waiting for file name to appear...');
expect(screen.getByText("example.txt")).toBeInTheDocument();
});

});
});
40 changes: 23 additions & 17 deletions app/client/src/components/formControls/FilePickerControl.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { useState } from "react";
import { useState, useEffect, useCallback } from "react";
import styled from "styled-components";
import type { ControlProps } from "./BaseControl";
import BaseControl from "./BaseControl";
Expand All @@ -8,7 +8,6 @@ import type { SetProgress } from "design-system-old";
import { FilePickerV2, FileType } from "design-system-old";
import type { WrappedFieldInputProps, WrappedFieldMetaProps } from "redux-form";
import { Field } from "redux-form";
import { useEffect, useCallback } from "react";
import { replayHighlightClass } from "globalStyles/portals";
import { Button, Modal, ModalBody, ModalContent } from "design-system";

Expand Down Expand Up @@ -39,50 +38,56 @@ const FilePickerContainer = styled.div`
border-radius: 0 var(--ads-v2-border-radius) var(--ads-v2-border-radius) 0 !important;
}
`;

type RenderFilePickerProps = FilePickerControlProps & {
input?: WrappedFieldInputProps;
meta?: WrappedFieldMetaProps;
disabled?: boolean;
onChange: (event: any) => void;
};

function RenderFilePicker(props: RenderFilePickerProps) {
export function RenderFilePicker(props: RenderFilePickerProps) {
const [isOpen, setIsOpen] = useState(false);
const [appFileToBeUploaded, setAppFileToBeUploaded] = useState<{
file: File;
setProgress: SetProgress;
} | null>(null);
const [fileData, setFileData] = useState<string | null>(null);

// const changeOpenState = (state: boolean) => setIsOpen(state);
const FileUploader = useCallback(
async (file: File, setProgress: SetProgress) => {
if (!!file) {
setAppFileToBeUploaded({
file,
setProgress,
});
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onloadend = () => {
const base64data = reader.result as string;
setFileData(base64data);
};
} else {
setAppFileToBeUploaded(null);
setFileData(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.

-      if (!!file) {
+      if (file) {
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
setAppFileToBeUploaded({
file,
setProgress,
});
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onloadend = () => {
const base64data = reader.result as string;
setFileData(base64data);
};
} else {
setAppFileToBeUploaded(null);
setFileData(null);
if (file) {
setAppFileToBeUploaded({
file,
setProgress,
});
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onloadend = () => {
const base64data = reader.result as string;
setFileData(base64data);
};
} else {
setAppFileToBeUploaded(null);
setFileData(null);

}
},
[],
);

const onRemoveFile = useCallback(() => setAppFileToBeUploaded(null), []);
const onRemoveFile = useCallback(() => {
setAppFileToBeUploaded(null);
setFileData(null);
}, []);

useEffect(() => {
if (appFileToBeUploaded?.file) {
const reader = new FileReader();
reader.readAsDataURL(appFileToBeUploaded?.file);
reader.onloadend = () => {
const base64data = reader.result;
props.input?.onChange({
name: appFileToBeUploaded?.file.name,
base64Content: base64data,
});
};
}
}, [appFileToBeUploaded]);
if (!isOpen && appFileToBeUploaded?.file && fileData) {
props.input?.onChange({
name: appFileToBeUploaded.file.name,
base64Content: fileData,
});
}
}, [isOpen]);

return (
<>
Expand Down Expand Up @@ -126,6 +131,7 @@ function RenderFilePicker(props: RenderFilePickerProps) {
</>
);
}

class FilePickerControl extends BaseControl<FilePickerControlProps> {
constructor(props: FilePickerControlProps) {
super(props);
Expand Down
Loading