Merge pull request #4433 from appsmithorg/fix/-filePicker-widget-property-cleanup

fix: remove uploadedFileUrls property from FilePicker
This commit is contained in:
Somangshu Goswami 2021-05-31 20:07:16 +05:30 committed by GitHub
commit fd7db3356e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 36 deletions

View File

@ -135,7 +135,6 @@ const FIELD_VALUES: Record<
allowedFileTypes: "Array<string>",
isRequired: "boolean",
isVisible: "boolean",
uploadedFileUrls: "string",
// onFilesSelected: "Function Call",
},
CHECKBOX_WIDGET: {

View File

@ -231,7 +231,6 @@ export const entityDefinitions = {
isVisible: isVisible,
files: "[file]",
isDisabled: "bool",
uploadedFileUrls: "string",
},
LIST_WIDGET: (widget: any) => ({
"!doc":

View File

@ -8,10 +8,7 @@ import Webcam from "@uppy/webcam";
import Url from "@uppy/url";
import OneDrive from "@uppy/onedrive";
import { VALIDATION_TYPES } from "constants/WidgetValidation";
import {
EventType,
ExecutionResult,
} from "constants/AppsmithActionConstants/ActionConstants";
import { EventType } from "constants/AppsmithActionConstants/ActionConstants";
import { DerivedPropertiesMap } from "utils/WidgetFactory";
import Dashboard from "@uppy/dashboard";
import shallowequal from "shallowequal";
@ -157,17 +154,6 @@ class FilePickerWidget extends BaseWidget<
isTriggerProperty: false,
validation: VALIDATION_TYPES.BOOLEAN,
},
{
propertyName: "uploadedFileUrlPaths",
helpText:
"Stores the url of the uploaded file so that it can be referenced in an action later",
label: "Uploaded File URLs",
controlType: "INPUT_TEXT",
placeholderText: 'Enter [ "url1", "url2" ]',
inputType: "TEXT",
isBindProperty: true,
isTriggerProperty: false,
},
{
propertyName: "isDisabled",
label: "Disable",
@ -185,7 +171,7 @@ class FilePickerWidget extends BaseWidget<
children: [
{
helpText:
"Triggers an action when the user selects a file. Upload files to a CDN here and store their urls in uploadedFileUrls",
"Triggers an action when the user selects a file. Upload files to a CDN and stores their URLs in filepicker.files",
propertyName: "onFilesSelected",
label: "onFilesSelected",
controlType: "ACTION_SELECTOR",
@ -385,7 +371,6 @@ class FilePickerWidget extends BaseWidget<
dynamicString: this.props.onFilesSelected,
event: {
type: EventType.ON_FILES_SELECTED,
callback: this.handleFileUploaded,
},
});
@ -393,22 +378,6 @@ class FilePickerWidget extends BaseWidget<
}
};
/**
* sets uploadFilesUrl in meta propety and sets isLoading to false
*
* @param result
*/
handleFileUploaded = (result: ExecutionResult) => {
if (result.success) {
this.props.updateWidgetMetaProperty(
"uploadedFileUrls",
this.props.uploadedFileUrlPaths,
);
this.setState({ isLoading: false });
}
};
componentDidUpdate(prevProps: FilePickerWidgetProps) {
super.componentDidUpdate(prevProps);
if (
@ -469,7 +438,6 @@ export interface FilePickerWidgetProps extends WidgetProps, WithMeta {
onFilesSelected?: string;
fileDataType: FileDataTypes;
isRequired?: boolean;
uploadedFileUrlPaths?: string;
}
export default FilePickerWidget;