diff options
author | Dominik Guzei <dominik.guzei@gmail.com> | 2019-03-28 12:13:27 +0100 |
---|---|---|
committer | Dominik Guzei <dominik.guzei@gmail.com> | 2019-03-28 12:13:27 +0100 |
commit | eb57e4f787d06648dab2c473830dcfbfa168e00c (patch) | |
tree | 5340f3a9f4f181aa990f7a6261a752280fac6cef /src/features | |
parent | indicate any server interaction with spinners and infoboxes (diff) | |
download | ferdium-app-eb57e4f787d06648dab2c473830dcfbfa168e00c.tar.gz ferdium-app-eb57e4f787d06648dab2c473830dcfbfa168e00c.tar.zst ferdium-app-eb57e4f787d06648dab2c473830dcfbfa168e00c.zip |
add analytic events for workspace actions
Diffstat (limited to 'src/features')
5 files changed, 29 insertions, 9 deletions
diff --git a/src/features/workspaces/components/CreateWorkspaceForm.js b/src/features/workspaces/components/CreateWorkspaceForm.js index 8b5039246..a8f07d0d5 100644 --- a/src/features/workspaces/components/CreateWorkspaceForm.js +++ b/src/features/workspaces/components/CreateWorkspaceForm.js | |||
@@ -6,6 +6,8 @@ import { Input, Button } from '@meetfranz/forms'; | |||
6 | import injectSheet from 'react-jss'; | 6 | import injectSheet from 'react-jss'; |
7 | import Form from '../../../lib/Form'; | 7 | import Form from '../../../lib/Form'; |
8 | import { required } from '../../../helpers/validation-helpers'; | 8 | import { required } from '../../../helpers/validation-helpers'; |
9 | import { gaEvent } from '../../../lib/analytics'; | ||
10 | import { GA_CATEGORY_WORKSPACES } from '../index'; | ||
9 | 11 | ||
10 | const messages = defineMessages({ | 12 | const messages = defineMessages({ |
11 | submitButton: { | 13 | submitButton: { |
@@ -63,7 +65,9 @@ class CreateWorkspaceForm extends Component { | |||
63 | form.submit({ | 65 | form.submit({ |
64 | onSuccess: async (f) => { | 66 | onSuccess: async (f) => { |
65 | const { onSubmit } = this.props; | 67 | const { onSubmit } = this.props; |
66 | onSubmit(f.values()); | 68 | const values = f.values(); |
69 | onSubmit(values); | ||
70 | gaEvent(GA_CATEGORY_WORKSPACES, 'create', values.name); | ||
67 | }, | 71 | }, |
68 | }); | 72 | }); |
69 | } | 73 | } |
diff --git a/src/features/workspaces/components/EditWorkspaceForm.js b/src/features/workspaces/components/EditWorkspaceForm.js index a9fd4d21c..e4bf44248 100644 --- a/src/features/workspaces/components/EditWorkspaceForm.js +++ b/src/features/workspaces/components/EditWorkspaceForm.js | |||
@@ -12,6 +12,8 @@ import Form from '../../../lib/Form'; | |||
12 | import { required } from '../../../helpers/validation-helpers'; | 12 | import { required } from '../../../helpers/validation-helpers'; |
13 | import ServiceListItem from './ServiceListItem'; | 13 | import ServiceListItem from './ServiceListItem'; |
14 | import Request from '../../../stores/lib/Request'; | 14 | import Request from '../../../stores/lib/Request'; |
15 | import { gaEvent } from '../../../lib/analytics'; | ||
16 | import { GA_CATEGORY_WORKSPACES } from '../index'; | ||
15 | 17 | ||
16 | const messages = defineMessages({ | 18 | const messages = defineMessages({ |
17 | buttonDelete: { | 19 | buttonDelete: { |
@@ -87,17 +89,24 @@ class EditWorkspaceForm extends Component { | |||
87 | }); | 89 | }); |
88 | } | 90 | } |
89 | 91 | ||
90 | submitForm(form) { | 92 | save(form) { |
91 | form.submit({ | 93 | form.submit({ |
92 | onSuccess: async (f) => { | 94 | onSuccess: async (f) => { |
93 | const { onSave } = this.props; | 95 | const { onSave } = this.props; |
94 | const values = f.values(); | 96 | const values = f.values(); |
95 | onSave(values); | 97 | onSave(values); |
98 | gaEvent(GA_CATEGORY_WORKSPACES, 'save'); | ||
96 | }, | 99 | }, |
97 | onError: async () => {}, | 100 | onError: async () => {}, |
98 | }); | 101 | }); |
99 | } | 102 | } |
100 | 103 | ||
104 | delete() { | ||
105 | const { onDelete } = this.props; | ||
106 | onDelete(); | ||
107 | gaEvent(GA_CATEGORY_WORKSPACES, 'delete'); | ||
108 | } | ||
109 | |||
101 | toggleService(service) { | 110 | toggleService(service) { |
102 | const servicesField = this.form.$('services'); | 111 | const servicesField = this.form.$('services'); |
103 | const serviceIds = servicesField.value; | 112 | const serviceIds = servicesField.value; |
@@ -113,7 +122,6 @@ class EditWorkspaceForm extends Component { | |||
113 | const { intl } = this.context; | 122 | const { intl } = this.context; |
114 | const { | 123 | const { |
115 | classes, | 124 | classes, |
116 | onDelete, | ||
117 | workspace, | 125 | workspace, |
118 | services, | 126 | services, |
119 | deleteWorkspaceRequest, | 127 | deleteWorkspaceRequest, |
@@ -161,7 +169,7 @@ class EditWorkspaceForm extends Component { | |||
161 | buttonType={isDeleting ? 'secondary' : 'danger'} | 169 | buttonType={isDeleting ? 'secondary' : 'danger'} |
162 | className="settings__delete-button" | 170 | className="settings__delete-button" |
163 | disabled={isDeleting} | 171 | disabled={isDeleting} |
164 | onClick={onDelete} | 172 | onClick={this.delete.bind(this)} |
165 | /> | 173 | /> |
166 | {/* ===== Save Button ===== */} | 174 | {/* ===== Save Button ===== */} |
167 | <Button | 175 | <Button |
@@ -169,7 +177,7 @@ class EditWorkspaceForm extends Component { | |||
169 | label={intl.formatMessage(messages.buttonSave)} | 177 | label={intl.formatMessage(messages.buttonSave)} |
170 | busy={isSaving} | 178 | busy={isSaving} |
171 | buttonType={isSaving ? 'secondary' : 'primary'} | 179 | buttonType={isSaving ? 'secondary' : 'primary'} |
172 | onClick={this.submitForm.bind(this, form)} | 180 | onClick={this.save.bind(this, form)} |
173 | disabled={isSaving} | 181 | disabled={isSaving} |
174 | /> | 182 | /> |
175 | </div> | 183 | </div> |
diff --git a/src/features/workspaces/components/WorkspaceDrawer.js b/src/features/workspaces/components/WorkspaceDrawer.js index 6dc779be9..4d48c45ef 100644 --- a/src/features/workspaces/components/WorkspaceDrawer.js +++ b/src/features/workspaces/components/WorkspaceDrawer.js | |||
@@ -8,7 +8,8 @@ import ReactTooltip from 'react-tooltip'; | |||
8 | 8 | ||
9 | import WorkspaceDrawerItem from './WorkspaceDrawerItem'; | 9 | import WorkspaceDrawerItem from './WorkspaceDrawerItem'; |
10 | import { workspaceActions } from '../actions'; | 10 | import { workspaceActions } from '../actions'; |
11 | import { workspaceStore } from '../index'; | 11 | import { GA_CATEGORY_WORKSPACES, workspaceStore } from '../index'; |
12 | import { gaEvent } from '../../../lib/analytics'; | ||
12 | 13 | ||
13 | const messages = defineMessages({ | 14 | const messages = defineMessages({ |
14 | headline: { | 15 | headline: { |
@@ -96,7 +97,10 @@ class WorkspaceDrawer extends Component { | |||
96 | <div className={classes.workspaces}> | 97 | <div className={classes.workspaces}> |
97 | <WorkspaceDrawerItem | 98 | <WorkspaceDrawerItem |
98 | name={intl.formatMessage(messages.allServices)} | 99 | name={intl.formatMessage(messages.allServices)} |
99 | onClick={() => workspaceActions.deactivate()} | 100 | onClick={() => { |
101 | workspaceActions.deactivate(); | ||
102 | gaEvent(GA_CATEGORY_WORKSPACES, 'switch', 'drawer'); | ||
103 | }} | ||
100 | services={getServicesForWorkspace(null)} | 104 | services={getServicesForWorkspace(null)} |
101 | isActive={actualWorkspace == null} | 105 | isActive={actualWorkspace == null} |
102 | /> | 106 | /> |
@@ -105,7 +109,10 @@ class WorkspaceDrawer extends Component { | |||
105 | key={workspace.id} | 109 | key={workspace.id} |
106 | name={workspace.name} | 110 | name={workspace.name} |
107 | isActive={actualWorkspace === workspace} | 111 | isActive={actualWorkspace === workspace} |
108 | onClick={() => workspaceActions.activate({ workspace })} | 112 | onClick={() => { |
113 | workspaceActions.activate({ workspace }); | ||
114 | gaEvent(GA_CATEGORY_WORKSPACES, 'switch', 'drawer'); | ||
115 | }} | ||
109 | services={getServicesForWorkspace(workspace)} | 116 | services={getServicesForWorkspace(workspace)} |
110 | /> | 117 | /> |
111 | ))} | 118 | ))} |
diff --git a/src/features/workspaces/components/WorkspacesDashboard.js b/src/features/workspaces/components/WorkspacesDashboard.js index b31581a5b..52c3afdcf 100644 --- a/src/features/workspaces/components/WorkspacesDashboard.js +++ b/src/features/workspaces/components/WorkspacesDashboard.js | |||
@@ -77,7 +77,6 @@ class WorkspacesDashboard extends Component { | |||
77 | workspaces, | 77 | workspaces, |
78 | } = this.props; | 78 | } = this.props; |
79 | const { intl } = this.context; | 79 | const { intl } = this.context; |
80 | console.log(deleteWorkspaceRequest.result); | ||
81 | return ( | 80 | return ( |
82 | <div className="settings__main"> | 81 | <div className="settings__main"> |
83 | <div className="settings__header"> | 82 | <div className="settings__header"> |
diff --git a/src/features/workspaces/index.js b/src/features/workspaces/index.js index 0d30cd19d..89999ab0f 100644 --- a/src/features/workspaces/index.js +++ b/src/features/workspaces/index.js | |||
@@ -4,6 +4,8 @@ import { resetApiRequests } from './api'; | |||
4 | 4 | ||
5 | const debug = require('debug')('Franz:feature:workspaces'); | 5 | const debug = require('debug')('Franz:feature:workspaces'); |
6 | 6 | ||
7 | export const GA_CATEGORY_WORKSPACES = 'workspaces'; | ||
8 | |||
7 | export const workspaceStore = new WorkspacesStore(); | 9 | export const workspaceStore = new WorkspacesStore(); |
8 | 10 | ||
9 | export default function initWorkspaces(stores, actions) { | 11 | export default function initWorkspaces(stores, actions) { |