Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5c6b704

Browse files
committed
added analytics for api saga updates
1 parent8b98e8d commit5c6b704

File tree

5 files changed

+96
-66
lines changed

5 files changed

+96
-66
lines changed

‎app/client/src/ce/sagas/ApplicationSagas.tsx‎

Lines changed: 58 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,16 +1185,17 @@ export function* publishAnvilApplicationSaga(
11851185
exportfunction*persistAppSlugSaga(
11861186
action:ReduxAction<{slug:string;onSuccess?:()=>void}>,
11871187
){
1188-
try{
1189-
constcurrentApplication:ApplicationPayload|undefined=yieldselect(
1190-
getCurrentApplication,
1191-
);
1188+
constcurrentApplication:ApplicationPayload|undefined=yieldselect(
1189+
getCurrentApplication,
1190+
);
11921191

1193-
if(!currentApplication){
1194-
thrownewError("No current application found");
1195-
}
1192+
if(!currentApplication){
1193+
thrownewError("No current application found");
1194+
}
11961195

1197-
constapplicationId=currentApplication.id;
1196+
constapplicationId=currentApplication.id;
1197+
1198+
try{
11981199
const{ onSuccess, slug}=action.payload;
11991200

12001201
constrequest={
@@ -1224,6 +1225,11 @@ export function* persistAppSlugSaga(
12241225
},
12251226
});
12261227

1228+
AnalyticsUtil.logEvent("STATIC_URL_APP_SLUG_PERSIST_SUCCESS",{
1229+
applicationId,
1230+
slug,
1231+
});
1232+
12271233
// Call success callback if provided
12281234
if(onSuccess){
12291235
onSuccess();
@@ -1237,6 +1243,12 @@ export function* persistAppSlugSaga(
12371243
slug:action.payload.slug,
12381244
},
12391245
});
1246+
1247+
AnalyticsUtil.logEvent("STATIC_URL_APP_SLUG_PERSIST_ERROR",{
1248+
applicationId,
1249+
slug:action.payload.slug,
1250+
error:errorinstanceofError ?error.message :String(error),
1251+
});
12401252
}
12411253
}
12421254

@@ -1302,16 +1314,17 @@ export function* validateAppSlugSaga(action: ReduxAction<{ slug: string }>) {
13021314
exportfunction*enableStaticUrlSaga(
13031315
action:ReduxAction<{slug:string;onSuccess?:()=>void}>,
13041316
){
1305-
try{
1306-
constcurrentApplication:ApplicationPayload|undefined=yieldselect(
1307-
getCurrentApplication,
1308-
);
1317+
constcurrentApplication:ApplicationPayload|undefined=yieldselect(
1318+
getCurrentApplication,
1319+
);
13091320

1310-
if(!currentApplication){
1311-
thrownewError("No current application found");
1312-
}
1321+
if(!currentApplication){
1322+
thrownewError("No current application found");
1323+
}
13131324

1314-
constapplicationId=currentApplication.id;
1325+
constapplicationId=currentApplication.id;
1326+
1327+
try{
13151328
const{ onSuccess, slug}=action.payload;
13161329
constresponse:ApiResponse=yieldcall(
13171330
ApplicationApi.enableStaticUrl,
@@ -1329,6 +1342,11 @@ export function* enableStaticUrlSaga(
13291342
type:ReduxActionTypes.ENABLE_STATIC_URL_SUCCESS,
13301343
});
13311344

1345+
AnalyticsUtil.logEvent("STATIC_URL_ENABLED_SUCCESS",{
1346+
applicationId,
1347+
slug,
1348+
});
1349+
13321350
// Call success callback if provided
13331351
if(onSuccess){
13341352
onSuccess();
@@ -1341,22 +1359,29 @@ export function* enableStaticUrlSaga(
13411359
error,
13421360
},
13431361
});
1362+
1363+
AnalyticsUtil.logEvent("STATIC_URL_ENABLED_ERROR",{
1364+
applicationId,
1365+
slug:action.payload.slug,
1366+
error:errorinstanceofError ?error.message :String(error),
1367+
});
13441368
}
13451369
}
13461370

13471371
exportfunction*disableStaticUrlSaga(
13481372
action:ReduxAction<{onSuccess?:()=>void}>,
13491373
){
1350-
try{
1351-
constcurrentApplication:ApplicationPayload|undefined=yieldselect(
1352-
getCurrentApplication,
1353-
);
1374+
constcurrentApplication:ApplicationPayload|undefined=yieldselect(
1375+
getCurrentApplication,
1376+
);
13541377

1355-
if(!currentApplication){
1356-
thrownewError("No current application found");
1357-
}
1378+
if(!currentApplication){
1379+
thrownewError("No current application found");
1380+
}
13581381

1359-
constapplicationId=currentApplication.id;
1382+
constapplicationId=currentApplication.id;
1383+
1384+
try{
13601385
const{ onSuccess}=action.payload||{};
13611386

13621387
constresponse:ApiResponse=yieldcall(
@@ -1374,6 +1399,10 @@ export function* disableStaticUrlSaga(
13741399
type:ReduxActionTypes.DISABLE_STATIC_URL_SUCCESS,
13751400
});
13761401

1402+
AnalyticsUtil.logEvent("STATIC_URL_DISABLED_SUCCESS",{
1403+
applicationId,
1404+
});
1405+
13771406
// Call success callback if provided
13781407
if(onSuccess){
13791408
onSuccess();
@@ -1387,6 +1416,11 @@ export function* disableStaticUrlSaga(
13871416
message:createMessage(ERROR_IN_DISABLING_STATIC_URL),
13881417
},
13891418
});
1419+
1420+
AnalyticsUtil.logEvent("STATIC_URL_DISABLED_ERROR",{
1421+
applicationId,
1422+
error:errorinstanceofError ?error.message :String(error),
1423+
});
13901424
}
13911425
}
13921426

‎app/client/src/ce/sagas/PageSagas.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,11 @@ export function* persistPageSlugSaga(
15831583
slug:action.payload.slug,
15841584
},
15851585
});
1586+
1587+
AnalyticsUtil.logEvent("STATIC_URL_PAGE_SLUG_PERSIST_SUCCESS",{
1588+
pageId:action.payload.pageId,
1589+
slug:action.payload.slug,
1590+
});
15861591
}
15871592
}catch(error){
15881593
yieldput({
@@ -1593,6 +1598,12 @@ export function* persistPageSlugSaga(
15931598
slug:action.payload.slug,
15941599
},
15951600
});
1601+
1602+
AnalyticsUtil.logEvent("STATIC_URL_PAGE_SLUG_PERSIST_ERROR",{
1603+
pageId:action.payload.pageId,
1604+
slug:action.payload.slug,
1605+
error:errorinstanceofError ?error.message :String(error),
1606+
});
15961607
}
15971608
}
15981609

‎app/client/src/ce/utils/analyticsUtilTypes.ts‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,16 @@ export type PREMIUM_DATASOURCES_EVENTS =
483483
|"SOON_NOTIFY_REQUEST";
484484

485485
exporttypeSTATIC_URL_EVENTS=
486+
// User Actions (UI Layer)
486487
|"STATIC_URL_TOGGLE_CLICK"
487-
|"STATIC_URL_APPLY_CLICK"
488488
|"STATIC_URL_CANCEL_CLICK"
489-
|"STATIC_URL_ENABLED"
490-
|"STATIC_URL_CHANGED"
491-
|"STATIC_URL_DISABLED"
492489
|"STATIC_URL_DOCS_CLICK"
493-
|"STATIC_URL_PAGE_SLUG_CHANGED";
490+
// Backend Operations (Saga Layer)
491+
|"STATIC_URL_PAGE_SLUG_PERSIST_SUCCESS"
492+
|"STATIC_URL_PAGE_SLUG_PERSIST_ERROR"
493+
|"STATIC_URL_APP_SLUG_PERSIST_SUCCESS"
494+
|"STATIC_URL_APP_SLUG_PERSIST_ERROR"
495+
|"STATIC_URL_ENABLED_SUCCESS"
496+
|"STATIC_URL_ENABLED_ERROR"
497+
|"STATIC_URL_DISABLED_SUCCESS"
498+
|"STATIC_URL_DISABLED_ERROR";

‎app/client/src/pages/AppIDE/components/AppSettings/components/GeneralSettings.tsx‎

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,9 @@ function GeneralSettings() {
160160
);
161161

162162
constopenStaticUrlConfirmationModal=useCallback(()=>{
163-
AnalyticsUtil.logEvent("STATIC_URL_APPLY_CLICK",{
164-
applicationId,
165-
oldSlug:application?.staticUrlSettings?.uniqueSlug,
166-
newSlug:applicationSlug,
167-
});
168-
169163
setModalType("change");
170164
setIsStaticUrlConfirmationModalOpen(true);
171-
},[applicationId,application,applicationSlug]);
165+
},[]);
172166

173167
constcloseStaticUrlConfirmationModal=useCallback(()=>{
174168
setIsStaticUrlConfirmationModalOpen(false);
@@ -185,11 +179,6 @@ function GeneralSettings() {
185179
toast.show(createMessage(STATIC_URL_CHANGE_SUCCESS),{
186180
kind:"success",
187181
});
188-
189-
AnalyticsUtil.logEvent("STATIC_URL_CHANGED",{
190-
applicationId,
191-
newSlug:applicationSlug,
192-
});
193182
};
194183

195184
if(
@@ -210,7 +199,6 @@ function GeneralSettings() {
210199
application?.staticUrlSettings?.uniqueSlug,
211200
dispatch,
212201
application?.staticUrlSettings?.enabled,
213-
applicationId,
214202
]);
215203

216204
constcancelSlugChange=useCallback(()=>{
@@ -326,11 +314,14 @@ function GeneralSettings() {
326314
return`${application?.staticUrlSettings?.uniqueSlug||""}/${pageSlug}`;
327315
}
328316
},[
317+
currentAppPage?.uniqueSlug,
318+
currentAppPage?.slug,
319+
currentAppPage?.customSlug,
329320
modalType,
330321
application?.staticUrlSettings?.uniqueSlug,
331-
application?.slug,
332322
application?.staticUrlSettings?.enabled,
333-
currentAppPage,
323+
application?.slug,
324+
currentBasePageId,
334325
]);
335326

336327
constmodalNewSlug=useMemo(()=>{
@@ -405,16 +396,10 @@ function GeneralSettings() {
405396
toast.show(createMessage(STATIC_URL_DISABLED_SUCCESS),{
406397
kind:"success",
407398
});
408-
409-
// Log analytics on successful disable
410-
AnalyticsUtil.logEvent("STATIC_URL_DISABLED",{
411-
applicationId,
412-
previousSlug:application?.staticUrlSettings?.uniqueSlug,
413-
});
414399
};
415400

416401
dispatch(disableStaticUrl(onSuccess));
417-
},[dispatch,applicationId,application]);
402+
},[dispatch]);
418403

419404
constapplicationSlugErrorMessage=useMemo(()=>{
420405
if(isFetchingAppSlugSuggestion)returnundefined;
@@ -428,12 +413,7 @@ function GeneralSettings() {
428413
}
429414

430415
returnundefined;
431-
},[
432-
isFetchingAppSlugSuggestion,
433-
applicationSlug,
434-
isClientSideSlugValid,
435-
isApplicationSlugValid,
436-
]);
416+
},[isFetchingAppSlugSuggestion,applicationSlug,isClientSideSlugValid]);
437417

438418
constisApplicationSlugInputValid=useMemo(()=>{
439419
if(isFetchingAppSlugSuggestion)returntrue;
@@ -508,7 +488,7 @@ function GeneralSettings() {
508488
/>
509489
</IconSelectorWrapper>
510490

511-
{true&&(
491+
{isStaticUrlFeatureEnabled&&(
512492
<divclassName="flex content-center justify-between pt-2">
513493
<Switch
514494
className="mb-0"

‎app/client/src/pages/AppIDE/components/AppSettings/components/PageSettings.tsx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ import { isNameValid, toValidPageName } from "utils/helpers";
5454
import{useFeatureFlag}from"utils/hooks/useFeatureFlag";
5555
import{FEATURE_FLAG}from"ee/entities/FeatureFlag";
5656
import{getHasManagePagePermission}from"ee/utils/BusinessFeatures/permissionPageHelpers";
57-
importAnalyticsUtilfrom"ee/utils/AnalyticsUtil";
5857

5958
// Patterns for pageSlug and customSlug from routes: (.*\-) followed by ID
6059
constPAGE_SLUG_WITH_MONGO_ID=/^.*\-[0-9a-f]{24}$/;
@@ -279,7 +278,14 @@ function PageSettings(props: { page: Page }) {
279278

280279
setIsPageNameSaving(true);
281280
dispatch(updatePageAction(payload));
282-
},[page.pageId,page.pageName,pageName,pageNameError]);
281+
},[
282+
canManagePages,
283+
dispatch,
284+
page.pageId,
285+
page.pageName,
286+
pageName,
287+
pageNameError,
288+
]);
283289

284290
constsaveCustomSlug=useCallback(()=>{
285291
if(!canManagePages||page.customSlug===customSlug)return;
@@ -303,12 +309,6 @@ function PageSettings(props: { page: Page }) {
303309
if(!isPageSlugValid)return;
304310

305311
dispatch(persistPageSlug(page.pageId,staticPageSlug||""));
306-
307-
AnalyticsUtil.logEvent("STATIC_URL_PAGE_SLUG_CHANGED",{
308-
pageId:page.pageId,
309-
oldSlug:page.uniqueSlug,
310-
newSlug:staticPageSlug,
311-
});
312312
},[
313313
page.pageId,
314314
page.uniqueSlug,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp