Example #1
0
    def post(self, request, *args, **kwargs):
        if self.form.is_valid():
            app_source = self.form.get_selected_source()
            url_names_map = {
                'list': 'configure_list_report',
                'chart': 'configure_chart_report',
                'table': 'configure_table_report',
                'worker': 'configure_worker_report',
                'map': 'configure_map_report',
            }
            url_name = url_names_map[self.report_type]
            get_params = {
                'report_name': self.form.cleaned_data['report_name'],
                'chart_type': self.form.cleaned_data['chart_type'],
                'application': app_source.application,
                'source_type': app_source.source_type,
                'source': app_source.source,
            }
            track_workflow(
                request.user.email,
                "Successfully submitted the first part of the Report Builder "
                "wizard where you give your report a name and choose a data source"
            )

            add_event(request, [
                "Report Builder",
                "Successful Click on Next (Data Source)",
                app_source.source_type,
            ])

            return HttpResponseRedirect(
                reverse(url_name, args=[self.domain], params=get_params)
            )
        else:
            return self.get(request, *args, **kwargs)
Example #2
0
    def post(self, request, *args, **kwargs):
        if self.form.is_valid():
            app_source = self.form.get_selected_source()
            url_names_map = {
                'list': 'configure_list_report',
                'chart': 'configure_chart_report',
                'table': 'configure_table_report',
                'worker': 'configure_worker_report',
                'map': 'configure_map_report',
            }
            url_name = url_names_map[self.report_type]
            get_params = {
                'report_name': self.form.cleaned_data['report_name'],
                'chart_type': self.form.cleaned_data['chart_type'],
                'application': app_source.application,
                'source_type': app_source.source_type,
                'source': app_source.source,
            }
            track_workflow(
                request.user.email,
                "Successfully submitted the first part of the Report Builder "
                "wizard where you give your report a name and choose a data source"
            )

            add_event(request, [
                "Report Builder",
                "Successful Click on Next (Data Source)",
                app_source.source_type,
            ])

            return HttpResponseRedirect(
                reverse(url_name, args=[self.domain], params=get_params))
        else:
            return self.get(request, *args, **kwargs)
Example #3
0
 def _track_invalid_form_events(self):
     group_by_errors = self.report_form.errors.as_data().get('group_by', [])
     if "required" in [e.code for e in group_by_errors]:
         add_event(self.request, [
             "Report Builder",
             "Click on Done (No Group By Chosen)",
             self.report_type,
         ])
Example #4
0
 def _track_invalid_form_events(self):
     group_by_errors = self.report_form.errors.as_data().get('group_by', [])
     if "required" in [e.code for e in group_by_errors]:
         add_event(self.request, [
             "Report Builder",
             "Click on Done (No Group By Chosen)",
             self.report_type,
         ])
Example #5
0
 def _track_new_report_events(self):
     track_workflow(
         self.request.user.email,
         "Successfully created a new report in the Report Builder")
     add_event(self.request, [
         "Report Builder",
         "Click On Done On New Report (Successfully)",
         self.report_type,
     ])
Example #6
0
 def _track_new_report_events(self):
     track_workflow(
         self.request.user.email,
         "Successfully created a new report in the Report Builder"
     )
     add_event(self.request, [
         "Report Builder",
         "Click On Done On New Report (Successfully)",
         self.report_type,
     ])
Example #7
0
 def _track_valid_form_events(self, existing_sum_avg_cols, report_configuration):
     if self.report_type != "chart":
         sum_avg_cols = self._get_sum_avg_columns(
             report_configuration.columns)
         # A column is "new" if there are no columns with the (property, agg) combo in the previous report
         if not set(sum_avg_cols).issubset(set(existing_sum_avg_cols)):
             add_event(self.request, [
                 "Report Builder",
                 "Changed Column Format to Sum or Average",
                 self.report_type,
             ])
Example #8
0
 def _track_valid_form_events(self, existing_sum_avg_cols,
                              report_configuration):
     if self.report_type != "chart":
         sum_avg_cols = self._get_sum_avg_columns(
             report_configuration.columns)
         # A column is "new" if there are no columns with the (property, agg) combo in the previous report
         if not set(sum_avg_cols).issubset(set(existing_sum_avg_cols)):
             add_event(self.request, [
                 "Report Builder",
                 "Changed Column Format to Sum or Average",
                 self.report_type,
             ])