Commit Graph

53 Commits

Author SHA1 Message Date
Lauryn Menard a3f6220fe4 analytics: Add summary statistic for guest users in realm.
Adds the count of users with the role of guest to the stats view
`page_params` via a database query. This information is then added
to the summary statistics section of the analytics page after being
formatted by `stats.js`.

Creates Bassanio as a guest user in the database for the analytics
realm.

Fixes #20162.
2022-10-17 11:53:59 -07:00
Lauryn Menard aaefe700b9 analytics: Remove help link at bottom of `/stats/` page.
Removes the help center article linked to on the `/stats/` page,
because it doesn't have any useful information once the user is
already viewing the analytics page.
2022-10-11 10:47:58 -07:00
Lauryn Menard fdc1335e3a analytics: Move range selector buttons and hover information.
Because some button text is much longer in different languages,
there is an existing  bug when the charts are rendered with the
range selector buttons positioned on the right side of the chart.

This positions the range selector buttons to the left side of the
chart and the hover information to the right side of the chart.

For the pie charts and horizontal bar chart, the grouping buttons
labeled "Me" and "Everyone" are moved to the top of the chart, which
matches the grouping buttons on the vertical bar charts.

Adjusts some chart margins for new positioning of buttons and hover
information. Deduplicates some shared code for rangeselector buttons
in `stats.js` for the three vertical bar charts.
2022-10-07 11:34:01 -07:00
Lauryn Menard 6c48475e3e analytics: Make the "Me" hover consistent with other categories.
The text for hovering over "Bot" or "Everyone" in the bar charts are
`<b>` HTML elements. This makes the "Me" hover consistent with the
other categories.
2022-10-07 11:34:01 -07:00
Lauryn Menard cdcef8b814 analytics: Remove "Aggregation" labels from stats page. 2022-10-07 11:34:01 -07:00
Lauryn Menard df7a1cec93 analytics: Add summary statistic for upload/storage space in use.
Adds the realm's used storage space for attachments to the stats
view `page_params`. This information is then added to the summary
statistics section of the analytics page after being formatted by
`stats.js`.

Uses the emoji test image to create an `Attachment` in the database
for the analytics realm. Even though it doesn't create a message
to claim the attachment, it still is sent as storage space used
data for the analytics `/stats/` page.
2022-10-07 10:08:09 -07:00
Lauryn Menard 842da9e10a analytics: Add messages sent in last 30 days summary statistic. 2022-09-29 09:06:29 -07:00
Lauryn Menard 954b0475fe analytics: Add total messages sent summary statistic. 2022-09-29 09:06:29 -07:00
Lauryn Menard 7f1a060c4d analytics: Add summary statistics section and user statstics.
Adds a section to the top of the stats page for organization
summary statistics. Also, adds the first two statistics to that
section for total users in the organization and users that have
been active in the past 15 days.
2022-09-29 09:06:29 -07:00
Lauryn Menard 06445dc5e1 analytics: Use flexbox for charts in stats page.
Reworks the stats page to use CSS Flexbox. Also centers the main
page header and reorganizes the order of the charts on the page.
2022-09-29 09:06:29 -07:00
Lauryn Menard 7a0d659f14 templates: Add HTML title element to templates that extend base/portico.
Adds HTML title elements to templates that extend either `base.html`,
`portico.html` or `portico_signup.html`, and that are not website
portico landing pages that will use the `PAGE_TITLE` variable to set
the HTML title element (see following commit in series).

Also, updates some templates for missing translation tags.

As a general rule, we want the title element (and page content)
translated. Exceptions that are updated in this commit are templates
used in the development environment, analytics templates that are used
by staff and templates related to Zephyr.
2022-09-19 20:17:17 -07:00
Anders Kaseorg dd3fa4ac52 templates: Mark all void tags as self-closing.
This reverses the policy that was set, but incompletely enforced, by
commit 951514dd7d.  The self-closing tag
syntax is clearer, more consistent, simpler to parse, compatible with
XML, preferred by Prettier, and (most importantly now) required by
FormatJS.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-21 09:49:34 -07:00
Aman Agrawal 2e2ff568ba stats: Show tooltips using tippyjs.
We don't want to import tippyjs module here
along with its dependencies, so we just copied
over tippyjs defaults here. They should be
work fine for /stats page even if we decide to change
defaults for the app in tippyjs and forget to do
it here.
2021-04-07 17:11:23 -07:00
Anders Kaseorg 72d6ff3c3b docs: Fix more capitalization issues.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-10-23 11:46:55 -07:00
arpit551 0c6488b284 analytics: Added frontend for messages read over time graph.
The chart added is similar to the messages sent over time chart.

Fixes #15167
2020-06-20 16:52:33 -07:00
Steve Howell cf78cb0d6e templates: Use `<hr>` and `<br>` consistently.
We now prevent these variations:

    * <hr/>
    * <hr />
    * <br/>
    * <br />

We could enforce similar consistency for other void
tags, if we wished, but these two are particularly
prevalent.
2020-04-28 17:05:48 -07:00
Vishnu KS dae5f54a63 stats: Show info message in /stats page of newly created realms.
This provides a better user experience for folks joining a new Zulip
realm and visiting this page.
2020-04-03 11:59:18 -07:00
Anders Kaseorg fda70a5458 templates: Use just one webpack entry point per page.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:53:15 -07:00
Anders Kaseorg 46e562f990 bootstrap: Change tooltip html default to false.
Bootstrap v2.2.0^2~40^2~6 changes this default to false, so this is a
prerequisite to upgrading Bootstrap, and it’s also safer.

This closes an HTML injection path via user full names in the emoji
reaction tooltip.  It doesn’t appear to be exploitable for cross-site
scripting because we disallow `>` in full names, and the code happens
to be written such that the next `>` is in a different parser
invocation.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-19 20:53:10 -07:00
Anders Kaseorg 7494f1600c templates: Move page_params from an inline script to the <body> dataset.
This sidesteps tricky escaping issues, and will make it easier to
build a strict Content-Security-Policy.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-17 16:06:33 -07:00
Anders Kaseorg 9b38bcc2a6 templates: Abstract render_bundle behind a Jinja2 macro.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-17 16:06:33 -07:00
Nikhil Kumar Mishra 478674a6d6 analytics: Refactor to support more than one tooltip on same page.
While we don't actually need another tooltip on /stats right now, this
provides a clear approach for how to do that.  We've since added
tooltips in various other parts of the webapp, and that code is pretty
copy-pasteable, so I think it's reasonable to say this closes #4612.

Cleaned up by tabbott to remove a bunch of unnecessary changes.
2018-11-28 16:04:35 -08:00
Anders Kaseorg f75c0e29f4 HTML validation: Remove obsolete attributes from <script>, <style>.
<script charset=…>, <script type=…>, and <style type=…> are “obsolete
but conforming” in HTML5.  They make the validator.nu output noisier
and real problems a little harder to find.

(type was required in HTML 4, which is not relevant to us.)

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-07-13 10:27:23 +05:30
Cynthia Lin 0ed13e3631 stats: Fix incorrect data-user attribute on Everyone button.
For some reason, it was defined as "realm" instead of "everyone",
resulting in undefined value JS errors when draw_plot() was called.

Fixes #9937.
2018-07-13 10:24:13 +05:30
Rishi Gupta 2b97a9488f stats: Fix on-hover behavior of number of users.
Fixes regression introduced in fa9d79e.
2018-05-26 12:08:05 -07:00
Nikhil Kumar Mishra fa9d79e203 stats: Add 1 day actives and total users to number of users chart. 2018-05-20 10:56:16 -07:00
Rishi Gupta af758755bd stats: Rename target_realm_name to target_name in stats.html. 2018-05-18 15:12:36 -07:00
Priyank Patel 1e1b72f6c8 webpack: Transition stats.css to use webpack.
The stats.scss file is added to activity bundle.
2018-05-03 08:08:23 -07:00
Priyank Patel 50b13219a3 webpack: Combine both js and css into one portico bundle.
Combines, both portico js and css into one bundle. This for now solve
the issue of an empty js bundle being generated by webpack for the
portico-styles stylesheet.
2018-04-30 10:23:39 -07:00
Armaan Ahluwalia 93ac40105f CSS: Move portico styles to webpack compilation.
static/styles/scss/portico.scss is now compiled by webpack
and supports SCSS syntax.

Changed the server-side templates to render the portico-styles
bundle instead of directly requiring the portico stylesheet. This
allows webpack to handle stylesheet compilation and minification.

We use the mini-css-extract-plugin to extract out css from the
includes in webpack and let webpacks production mode handle
minification. Currently we're not able to use it for dev mode
because it does not support HMR so we use style-loader instead.
Once the plugin supports HMR we can go on to use it for both
dev and prod.

The downside of this is that when reloading pages in the development
environment, there's an annoying flash of unstyled content :(.

It is now possible to make a change in any of the styles included
by static/styles/scss/portico.scss and see the code reload live
in the browser. This is because style-loader which we currently
use has the module.accept code built-in.
2018-04-27 09:04:50 -07:00
Shubham Dhama b26c38bc47 analytics: Make stats of all realms accessible to server admins.
In this commit:
Two new URLs are added, to make all realms accessible for server
admins. One is for the stats page itself and another for getting
chart data i.e. chart data API requests.
For the above two new URLs corresponding two view functions are
added.
2018-04-18 11:06:50 -07:00
Aditya Bansal 642e27d2b7 analytics/stats.html: Clean up to use 4 space indentation. 2018-01-27 23:06:59 +05:30
Utkarsh Patil 10149b75cc stats: Add per-graph loading indicator
This commit ensures that size of each graph is the same before and
after the data is loaded. It also adds a loading indicator to each
graph until the data is loaded.

Fixes https://github.com/zulip/zulip/issues/6490
2017-12-13 14:44:28 -06:00
Nalin Bhardwaj 73de273726 stats: Remove hourly data from messages sent over time.
Fixes #6564.
2017-10-01 22:10:43 -07:00
Cynthia Lin 60ca87a3e1 analytics: Add link to Analytics user docs. 2017-08-23 17:34:08 -07:00
Vishnu Ks 06fee494c6 analytics: Include translation bundle in stats.html.
This should make it possible to use i18n in stats.js.
2017-07-16 16:20:11 -07:00
Vishnu Ks a99c60ce07 analytics: Add translation tags to stats.html. 2017-07-16 16:16:43 -07:00
Brock Whittaker 626c5ef55e analytics: Restyle and refactor /stats page.
This completes a major redesign of the /stats page.
2017-07-07 18:22:32 -07:00
Harshit Bansal 3953734a1c webpack: Migrate `stats.js` bundle to webpack static asset pipeline. 2017-06-20 09:45:26 -04:00
Rishi Gupta cf90fed418 stats: Remove users_today from Active Users.
It's technically the number of users yesterday. Also, "number of active
users today" suggests something like daily actives today, whereas this graph
currently shows 2-week actives.
2017-04-28 16:15:07 -07:00
Rishi Gupta b99e5aeb0b stats: Change title for Number of Users graph.
This stat used to have the total number of users, but was changed in f595f4f
to be the number of 2-week actives.
2017-04-28 16:15:07 -07:00
Italo Batista d77d7dc493 analytics: Add a 'me' option for messages_sent_over_time.
With some tweaked by Rishi Gupta.

Fixes #3630.
2017-04-17 22:18:24 -07:00
Archana BS a6b5b03122 stats: Change time ranges for bar graph and pie chart.
- Change templates/analytics/stats.html to use 'Last
  Week', 'Last Month', 'Last Year' time ranges instead
  of 'Last 10 days', 'Last 30 days'.
- Change static/styles/stats.css to not set background
  color for default time option, for messages sent by
  client and message by recipient type.
- Change static/js/stats/stats.js to show only available
  time range options, and set background color for the
  default. The default is Last Month if it exists, and
  otherwise All Time.

Fixes: #3856
2017-03-07 17:25:58 -08:00
Raghav Jajodia d52e08a25c analytics: Add a "Last updated" to the bottom of the stats page.
Fixes #3857.
2017-03-07 16:02:27 -08:00
Rishi Gupta bf6415cf72 analytics: Remove sidebar from /stats.
It's currently broken (e.g. see Issue #3713) and non-responsive. The whole
page needs to be styled anyway, so these can be added back once that
happens.
2017-02-28 15:50:57 -08:00
Rishi Gupta cf3ae2eafe stats: Turn messages_sent_by_client into a bar chart.
Also includes a number of changes to messages_sent_by_recipient_type that
were convenient to do at the same time, since the two charts share a lot of
code.
2017-02-10 14:41:18 -08:00
Rishi Gupta 18508ca02c stats.js: Clean up code for the number of users chart. 2017-02-07 18:55:35 -08:00
Rishi Gupta e0cb009f1b analytics: Refactor and clean up messages_sent_over_time. 2017-02-07 15:35:43 -08:00
Tim Abbott ec52322ae1 stats: Include Zulip and realm name in heading. 2017-02-07 11:22:57 -08:00
Rishi Gupta cd2205ac94 analytics: Remove portico header and footer from stats.html. 2017-02-07 10:49:57 -08:00