PromucFlow_constructor/app/client/src/widgets/MapWidget.tsx

376 lines
11 KiB
TypeScript
Raw Normal View History

2020-04-15 11:42:11 +00:00
import React from "react";
import BaseWidget, { WidgetProps, WidgetState } from "./BaseWidget";
import { WidgetType } from "constants/WidgetConstants";
import MapComponent from "components/designSystems/appsmith/MapComponent";
import { ValidationTypes } from "constants/WidgetValidation";
import { EventType } from "constants/AppsmithActionConstants/ActionConstants";
Use injected configuration from Nginx at runtime instead of build time (#30) * Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-07-07 10:22:17 +00:00
import { getAppsmithConfigs } from "configs";
import styled from "styled-components";
import * as Sentry from "@sentry/react";
2020-10-06 09:01:51 +00:00
import withMeta, { WithMeta } from "./MetaHOC";
import { DEFAULT_CENTER } from "constants/WidgetConstants";
import { getBorderCSSShorthand } from "constants/DefaultTheme";
import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
2020-04-15 11:42:11 +00:00
Use injected configuration from Nginx at runtime instead of build time (#30) * Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-07-07 10:22:17 +00:00
const { google } = getAppsmithConfigs();
const DisabledContainer = styled.div`
background-color: white;
height: 100%;
text-align: center;
display: flex;
flex-direction: column;
border: ${(props) => getBorderCSSShorthand(props.theme.borders[2])};
border-radius: 0;
Use injected configuration from Nginx at runtime instead of build time (#30) * Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-07-07 10:22:17 +00:00
h1 {
margin-top: 15%;
margin-bottom: 10%;
color: #7c7c7c;
}
p {
color: #0a0b0e;
}
`;
const DefaultCenter = { ...DEFAULT_CENTER, long: DEFAULT_CENTER.lng };
type Center = {
lat: number;
long: number;
[x: string]: any;
};
2020-04-15 11:42:11 +00:00
class MapWidget extends BaseWidget<MapWidgetProps, WidgetState> {
static getPropertyPaneConfig() {
return [
{
sectionName: "General",
children: [
{
propertyName: "mapCenter",
label: "Initial location",
isJSConvertible: true,
controlType: "LOCATION_SEARCH",
isBindProperty: true,
isTriggerProperty: false,
validation: {
type: ValidationTypes.OBJECT,
params: {
required: true,
allowedKeys: [
{
name: "lat",
type: ValidationTypes.NUMBER,
params: {
min: -90,
max: 90,
default: 0,
required: true,
},
},
{
name: "long",
type: ValidationTypes.NUMBER,
params: {
min: -180,
max: 180,
default: 0,
required: true,
},
},
],
},
},
},
{
propertyName: "defaultMarkers",
label: "Default markers",
controlType: "INPUT_TEXT",
inputType: "ARRAY",
helpText: "Sets the default markers on the map",
placeholderText: 'Enter [{ "lat": "val1", "long": "val2" }]',
isBindProperty: true,
isTriggerProperty: false,
validation: {
type: ValidationTypes.ARRAY,
params: {
children: {
type: ValidationTypes.OBJECT,
params: {
required: true,
allowedKeys: [
{
name: "lat",
type: ValidationTypes.NUMBER,
params: {
min: -90,
max: 90,
default: 0,
required: true,
},
},
{
name: "long",
type: ValidationTypes.NUMBER,
params: {
min: -180,
max: 180,
default: 0,
required: true,
},
},
{
name: "title",
type: ValidationTypes.TEXT,
},
],
},
},
},
},
evaluationSubstitutionType:
EvaluationSubstitutionType.SMART_SUBSTITUTE,
},
{
propertyName: "enableSearch",
label: "Enable search location",
helpText: "Enables locaton search",
controlType: "SWITCH",
isBindProperty: false,
isTriggerProperty: false,
},
{
propertyName: "enablePickLocation",
label: "Enable pick location",
helpText: "Allows a user to pick their location",
controlType: "SWITCH",
isBindProperty: false,
isTriggerProperty: false,
},
{
propertyName: "enableCreateMarker",
label: "Create new marker",
helpText: "Allows users to mark locations on the map",
controlType: "SWITCH",
isBindProperty: false,
isTriggerProperty: false,
},
{
propertyName: "zoomLevel",
label: "Zoom Level",
controlType: "STEP",
helpText: "Changes the default zoom of the map",
stepType: "ZOOM_PERCENTAGE",
isBindProperty: false,
isTriggerProperty: false,
},
{
propertyName: "isVisible",
label: "Visible",
helpText: "Controls the visibility of the widget",
controlType: "SWITCH",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation: { type: ValidationTypes.BOOLEAN },
},
],
},
{
sectionName: "Actions",
children: [
{
propertyName: "onMarkerClick",
label: "onMarkerClick",
controlType: "ACTION_SELECTOR",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: true,
},
{
propertyName: "onCreateMarker",
label: "onCreateMarker",
controlType: "ACTION_SELECTOR",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: true,
},
],
},
];
}
2020-04-15 11:42:11 +00:00
List Widget Phase 2 (#4189) * update meta properties + default properties map * update widget registery * update get meta property * update metahoc + widgetfactory + data tree evaluator * try sending function as string to worker * revert data tree evaluator update * pass default props map from dataTreeWidget file * wip * save child meta properties * remove console.log * save meta and default map in list * update listwidget * remove console.log + unused variables * revert getMetaPropertiesMap function * fix data tree test * fix list widget test * fix entity definition test * fix overriting of item in updatedItems * remove todo comments * fix meta prop issue * revert making meta properties from undefiend to "" & fix filepicker bug * fix test case * change items to listData and updatedItems to items * remove console.log * fix test * extract derived properties to dervied.js * disabled top, left, right resize handler list widget container * add test for dervied js * add test for selectedItem * fix background color bug on hover * remove console.log * fix chart widget inside list widget * fix checkbox issue + points raised by yogesh * revert the createImmerReducer usage * fix parse derived properties * remove internal props object that fails the test * fix import typo * allow bottom resize handler * fix template height check * fix template height check * update template size check * fix the is visible invalid prop issue * fix migration of list widget phase 2 * fix migration * remove unused import * fix migration * fix migration * remove console.log * hide delete option for container in entity explorer * fix testcases * remove unused import * fix switch widget meta prop Co-authored-by: root <root@DESKTOP-9GENCK0.localdomain> Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro.local>
2021-06-18 07:42:57 +00:00
static getDefaultPropertiesMap(): Record<string, any> {
2020-04-17 16:15:09 +00:00
return {
markers: "defaultMarkers",
center: "mapCenter",
};
}
List Widget Phase 2 (#4189) * update meta properties + default properties map * update widget registery * update get meta property * update metahoc + widgetfactory + data tree evaluator * try sending function as string to worker * revert data tree evaluator update * pass default props map from dataTreeWidget file * wip * save child meta properties * remove console.log * save meta and default map in list * update listwidget * remove console.log + unused variables * revert getMetaPropertiesMap function * fix data tree test * fix list widget test * fix entity definition test * fix overriting of item in updatedItems * remove todo comments * fix meta prop issue * revert making meta properties from undefiend to "" & fix filepicker bug * fix test case * change items to listData and updatedItems to items * remove console.log * fix test * extract derived properties to dervied.js * disabled top, left, right resize handler list widget container * add test for dervied js * add test for selectedItem * fix background color bug on hover * remove console.log * fix chart widget inside list widget * fix checkbox issue + points raised by yogesh * revert the createImmerReducer usage * fix parse derived properties * remove internal props object that fails the test * fix import typo * allow bottom resize handler * fix template height check * fix template height check * update template size check * fix the is visible invalid prop issue * fix migration of list widget phase 2 * fix migration * remove unused import * fix migration * fix migration * remove console.log * hide delete option for container in entity explorer * fix testcases * remove unused import * fix switch widget meta prop Co-authored-by: root <root@DESKTOP-9GENCK0.localdomain> Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro.local>
2021-06-18 07:42:57 +00:00
static getMetaPropertiesMap(): Record<string, any> {
return {
center: undefined,
markers: undefined,
2020-10-06 09:01:51 +00:00
selectedMarker: undefined,
};
}
2020-05-07 10:51:37 +00:00
updateCenter = (lat: number, long: number) => {
2020-10-06 09:01:51 +00:00
this.props.updateWidgetMetaProperty("center", { lat, long });
2020-04-15 11:42:11 +00:00
};
2020-05-07 10:51:37 +00:00
updateMarker = (lat: number, long: number, index: number) => {
const markers: Array<MarkerProps> = [...(this.props.markers || [])].map(
2020-10-06 09:01:51 +00:00
(marker, i) => {
2020-04-29 10:29:02 +00:00
if (index === i) {
marker = { lat, long };
2020-04-29 10:29:02 +00:00
}
return marker;
2020-10-06 09:01:51 +00:00
},
2020-04-29 10:29:02 +00:00
);
2020-10-06 09:01:51 +00:00
this.disableDrag(false);
this.props.updateWidgetMetaProperty("markers", markers);
2020-04-29 10:29:02 +00:00
};
2020-05-07 10:51:37 +00:00
onCreateMarker = (lat: number, long: number) => {
this.disableDrag(true);
const marker = { lat, long, title: "" };
const markers = [];
2020-12-24 04:32:25 +00:00
(this.props.markers || []).forEach((m) => {
markers.push(m);
});
markers.push(marker);
this.props.updateWidgetMetaProperty("markers", markers);
this.props.updateWidgetMetaProperty("selectedMarker", marker, {
2021-04-23 13:50:55 +00:00
triggerPropertyName: "onCreateMarker",
dynamicString: this.props.onCreateMarker,
event: {
type: EventType.ON_CREATE_MARKER,
2020-10-06 16:47:16 +00:00
},
});
2020-04-15 11:42:11 +00:00
};
unselectMarker = () => {
this.props.updateWidgetMetaProperty("selectedMarker", undefined);
};
2020-05-07 10:51:37 +00:00
onMarkerClick = (lat: number, long: number, title: string) => {
2020-10-06 09:01:51 +00:00
this.disableDrag(true);
const selectedMarker = {
2020-04-15 11:42:11 +00:00
lat: lat,
2020-05-07 10:51:37 +00:00
long: long,
2020-04-15 11:42:11 +00:00
title: title,
2020-10-06 09:01:51 +00:00
};
2020-10-06 16:47:16 +00:00
this.props.updateWidgetMetaProperty("selectedMarker", selectedMarker, {
2021-04-23 13:50:55 +00:00
triggerPropertyName: "onMarkerClick",
2020-10-06 16:47:16 +00:00
dynamicString: this.props.onMarkerClick,
event: {
type: EventType.ON_MARKER_CLICK,
},
});
2020-04-15 11:42:11 +00:00
};
getCenter(): Center {
return this.props.center || this.props.mapCenter || DefaultCenter;
}
componentDidUpdate(prevProps: MapWidgetProps) {
//remove selectedMarker when map initial location is updated
if (
JSON.stringify(prevProps.center) !== JSON.stringify(this.props.center) &&
this.props.selectedMarker
) {
this.unselectMarker();
}
}
2020-04-15 11:42:11 +00:00
getPageView() {
return (
Use injected configuration from Nginx at runtime instead of build time (#30) * Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-07-07 10:22:17 +00:00
<>
{!google.enabled && (
<DisabledContainer>
<h1>{"Map Widget disabled"}</h1>
<p>{"Map widget requires a Google Maps API Key"}</p>
Use injected configuration from Nginx at runtime instead of build time (#30) * Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-07-07 10:22:17 +00:00
<p>
{"See our"}
Use injected configuration from Nginx at runtime instead of build time (#30) * Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-07-07 10:22:17 +00:00
<a
2021-02-03 15:15:16 +00:00
href="https://docs.appsmith.com/v/v1.2.1/setup/docker/google-maps"
rel="noopener noreferrer"
target="_blank"
Use injected configuration from Nginx at runtime instead of build time (#30) * Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-07-07 10:22:17 +00:00
>
{" documentation "}
Use injected configuration from Nginx at runtime instead of build time (#30) * Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-07-07 10:22:17 +00:00
</a>
{"to configure API Keys"}
Use injected configuration from Nginx at runtime instead of build time (#30) * Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-07-07 10:22:17 +00:00
</p>
</DisabledContainer>
)}
{google.enabled && (
<MapComponent
allowZoom={this.props.allowZoom}
apiKey={google.apiKey}
center={this.getCenter()}
enableCreateMarker={this.props.enableCreateMarker}
enableDrag={() => {
this.disableDrag(false);
}}
Use injected configuration from Nginx at runtime instead of build time (#30) * Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-07-07 10:22:17 +00:00
enablePickLocation={this.props.enablePickLocation}
enableSearch={this.props.enableSearch}
isDisabled={this.props.isDisabled}
isVisible={this.props.isVisible}
markers={this.props.markers}
Use injected configuration from Nginx at runtime instead of build time (#30) * Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-07-07 10:22:17 +00:00
saveMarker={this.onCreateMarker}
selectMarker={this.onMarkerClick}
selectedMarker={this.props.selectedMarker}
unselectMarker={this.unselectMarker}
updateCenter={this.updateCenter}
updateMarker={this.updateMarker}
widgetId={this.props.widgetId}
zoomLevel={this.props.zoomLevel}
Use injected configuration from Nginx at runtime instead of build time (#30) * Use envsubst and nginx templates to generate nginx configs which can substitute environment variables and inject into the index.html file * Fix path in dockerfile. Add .gitignore and .env.example files. Fix nginx-linux template. * Add all environment variables. Add prefix to all environment variables. Update scripts to attempt to substitute all environment variables with the prefix * Setup dockerfile to execute a bash script. use env.example for fetching environment variables in development * Toggle features based on injected configs. Fix nginx template substitution script. * Update env.example file * Remove debug code from start-nginx.sh * Fix nginx config templates by adding quotes by default. Fix sed regex to include numerals. Toggle social login buttons on Login page based on the config. * Update rapid api environment variable name. Toggle oauth buttons based on config in SignUp page. Update .env.example to be a union of server and client environment variables * Adding a Map disabled message on Map widget * Adding links to Privacy policy and TNC * Use REACT_APP_ env variables with higher priority over injected config variables for toggling features * Update netlify.toml by commenting out the build environment variables * Remove env variables not required by the client * Remove start-storybook entry from package.json * Fix netlify.toml. Fallback algolia configs * Add contexts to netlify.toml for successful deploys. Swith to using APPSMITH_MARKETPLACE_URL as the toggle for RapidAPI feature on the client. Remove comments in nginx config templates. Fix template used in dockerfile. Co-authored-by: Satbir Singh <apple@apples-MacBook-Pro.local> Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-07-07 10:22:17 +00:00
/>
)}
</>
2020-04-15 11:42:11 +00:00
);
}
getWidgetType(): WidgetType {
return "MAP_WIDGET";
}
}
export interface MarkerProps {
lat: number;
2020-05-07 10:51:37 +00:00
long: number;
2020-04-15 11:42:11 +00:00
title?: string;
description?: string;
}
2020-10-06 09:01:51 +00:00
export interface MapWidgetProps extends WidgetProps, WithMeta {
2020-04-15 11:42:11 +00:00
isDisabled?: boolean;
isVisible?: boolean;
enableSearch: boolean;
zoomLevel: number;
allowZoom: boolean;
enablePickLocation: boolean;
mapCenter: {
lat: number;
2020-05-07 10:51:37 +00:00
long: number;
title?: string;
2020-04-15 11:42:11 +00:00
};
center?: {
lat: number;
2020-05-07 10:51:37 +00:00
long: number;
2020-04-15 11:42:11 +00:00
};
defaultMarkers?: Array<MarkerProps>;
markers?: Array<MarkerProps>;
2020-04-29 10:29:02 +00:00
selectedMarker?: {
lat: number;
long: number;
title?: string;
};
2020-04-15 11:42:11 +00:00
onMarkerClick?: string;
onCreateMarker?: string;
}
export default MapWidget;
2020-10-06 09:01:51 +00:00
export const ProfiledMapWidget = Sentry.withProfiler(withMeta(MapWidget));