Merge branch 'master' into release

This commit is contained in:
Nikhil Nandagopal 2020-10-07 20:48:49 +05:30
commit c5eb43915e
6 changed files with 18 additions and 13 deletions

View File

@ -4,6 +4,7 @@ import { retryPromise } from "utils/AppsmithUtils";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import AnalyticsUtil from "utils/AnalyticsUtil";
class ApplicationListLoader extends React.PureComponent<any, { Page: any }> {
constructor(props: any) {
@ -17,6 +18,7 @@ class ApplicationListLoader extends React.PureComponent<any, { Page: any }> {
componentDidMount() {
PerformanceTracker.stopTracking(PerformanceTransactionName.SIGN_UP);
PerformanceTracker.stopTracking(PerformanceTransactionName.LOGIN_CLICK);
AnalyticsUtil.logEvent("APPLICATIONS_PAGE_LOAD");
retryPromise(() =>
import(/* webpackChunkName: "applications" */ "./index"),
).then(module => {

View File

@ -9,10 +9,11 @@ import { getCurrentPageId } from "selectors/editorSelectors";
import { QueryAction } from "entities/Action";
import { Classes } from "@blueprintjs/core";
import history from "utils/history";
import { QueryTemplate } from "api/DatasourcesApi";
import { Datasource, QueryTemplate } from "api/DatasourcesApi";
import { useParams } from "react-router";
import { ExplorerURLParams } from "../helpers";
import { QUERY_EDITOR_URL_WITH_SELECTED_PAGE_ID } from "constants/routes";
import { getDatasource } from "selectors/entitiesSelector";
const Container = styled.div`
background-color: ${props => props.theme.colors.queryTemplate.bg};
@ -40,7 +41,9 @@ export const QueryTemplates = (props: QueryTemplatesProps) => {
const params = useParams<ExplorerURLParams>();
const actions = useSelector((state: AppState) => state.entities.actions);
const currentPageId = useSelector(getCurrentPageId);
const dataSource: Datasource | undefined = useSelector((state: AppState) =>
getDatasource(state, props.datasourceId),
);
const createQueryAction = useCallback(
(template: QueryTemplate) => {
const newQueryName = createNewQueryName(actions, currentPageId || "");
@ -58,6 +61,7 @@ export const QueryTemplates = (props: QueryTemplatesProps) => {
eventData: {
actionType: "Query",
from: "explorer-template",
dataSource: dataSource?.name,
},
...queryactionConfiguration,
}),

View File

@ -127,14 +127,10 @@ type QueryHomeScreenProps = {
};
class QueryHomeScreen extends React.Component<QueryHomeScreenProps> {
handleCreateNewQuery = (dataSourceId: string, params: string) => {
handleCreateNewQuery = (dataSource: Datasource, params: string) => {
const { actions, pages } = this.props;
const pageId = new URLSearchParams(params).get("importTo");
const page = pages.find(page => page.pageId === pageId);
AnalyticsUtil.logEvent("CREATE_QUERY_CLICK", {
pageName: page?.pageName ?? "",
});
if (pageId) {
const newQueryName = createNewQueryName(actions, pageId);
@ -142,11 +138,12 @@ class QueryHomeScreen extends React.Component<QueryHomeScreenProps> {
name: newQueryName,
pageId,
datasource: {
id: dataSourceId,
id: dataSource.id,
},
eventData: {
actionType: "Query",
from: "home-screen",
dataSource: dataSource.name,
},
actionConfiguration: {},
});
@ -193,7 +190,7 @@ class QueryHomeScreen extends React.Component<QueryHomeScreenProps> {
className="eachDatasourceCard"
onClick={() => {
if (dataSources.length) {
this.handleCreateNewQuery(dataSources[0].id, queryParams);
this.handleCreateNewQuery(dataSources[0], queryParams);
} else {
history.push(DATA_SOURCES_EDITOR_URL(applicationId, pageId));
}
@ -209,7 +206,7 @@ class QueryHomeScreen extends React.Component<QueryHomeScreenProps> {
className="eachDatasourceCard"
key={dataSource.id}
onClick={() =>
this.handleCreateNewQuery(dataSource.id, queryParams)
this.handleCreateNewQuery(dataSource, queryParams)
}
>
<img

View File

@ -82,8 +82,8 @@ export function* createActionSaga(actionPayload: ReduxAction<RestAction>) {
);
AnalyticsUtil.logEvent("CREATE_ACTION", {
apiId: response.data.id,
apiName: response.data.name,
id: response.data.id,
actionName: response.data.name,
pageName: pageName,
...actionPayload.payload.eventData,
});

View File

@ -387,6 +387,7 @@ function* handleCreateNewQueryActionSaga(
eventData: {
actionType: "Query",
from: action.payload.from,
dataSource: validDataSources[0].name,
},
actionConfiguration: {},
}),

View File

@ -83,6 +83,7 @@ export type EventName =
| "OPEN_HELP"
| "INVITE_USER"
| "PROPERTY_PANE_CLOSE_CLICK"
| "APPLICATIONS_PAGE_LOAD"
| "EXECUTE_ACTION";
function getApplicationId(location: Location) {
@ -161,7 +162,7 @@ class AnalyticsUtil {
})(window);
}
static logEvent(eventName: EventName, eventData: any) {
static logEvent(eventName: EventName, eventData: any = {}) {
const windowDoc: any = window;
let finalEventData = eventData;
const userData = AnalyticsUtil.user;