mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add optional telemetry to grist-core
Summary: Adds support for optional telemetry to grist-core. A new environment variable, GRIST_TELEMETRY_LEVEL, controls the level of telemetry collected. Test Plan: Server and unit tests. Reviewers: paulfitz Reviewed By: paulfitz Subscribers: dsagal, anaisconce Differential Revision: https://phab.getgrist.com/D3880
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import {AppModel} from 'app/client/models/AppModel';
|
||||
import {DocPageModel} from 'app/client/models/DocPageModel';
|
||||
import {getLoginOrSignupUrl, getLoginUrl, getLogoutUrl, urlState} from 'app/client/models/gristUrlState';
|
||||
import {buildUserMenuBillingItem} from 'app/client/ui/BillingButtons';
|
||||
import {manageTeamUsers} from 'app/client/ui/OpenUserManager';
|
||||
import {createUserImage} from 'app/client/ui/UserImage';
|
||||
import * as viewport from 'app/client/ui/viewport';
|
||||
@@ -16,6 +15,7 @@ import {Disposable, dom, DomElementArg, styled} from 'grainjs';
|
||||
import {cssMenuItem} from 'popweasel';
|
||||
import {maybeAddSiteSwitcherSection} from 'app/client/ui/SiteSwitcher';
|
||||
import {makeT} from 'app/client/lib/localization';
|
||||
import {getGristConfig} from 'app/common/urlUtils';
|
||||
|
||||
const t = makeT('AccountWidget');
|
||||
|
||||
@@ -98,7 +98,8 @@ export class AccountWidget extends Disposable {
|
||||
// Don't show on doc pages, or for personal orgs.
|
||||
null),
|
||||
|
||||
buildUserMenuBillingItem(this._appModel),
|
||||
this._maybeBuildBillingPageMenuItem(),
|
||||
this._maybeBuildActivationPageMenuItem(),
|
||||
|
||||
mobileModeToggle,
|
||||
|
||||
@@ -141,6 +142,33 @@ export class AccountWidget extends Disposable {
|
||||
}
|
||||
this._appModel.topAppModel.initialize();
|
||||
}
|
||||
|
||||
private _maybeBuildBillingPageMenuItem() {
|
||||
const {deploymentType} = getGristConfig();
|
||||
if (deploymentType !== 'saas') { return null; }
|
||||
|
||||
const {currentValidUser, currentOrg, isTeamSite} = this._appModel;
|
||||
const isBillingManager = Boolean(currentOrg && currentOrg.billingAccount &&
|
||||
(currentOrg.billingAccount.isManager || currentValidUser?.isSupport));
|
||||
|
||||
return isTeamSite ?
|
||||
// For links, disabling with just a class is hard; easier to just not make it a link.
|
||||
// TODO weasel menus should support disabling menuItemLink.
|
||||
(isBillingManager ?
|
||||
menuItemLink(urlState().setLinkUrl({billing: 'billing'}), 'Billing Account') :
|
||||
menuItem(() => null, 'Billing Account', dom.cls('disabled', true))
|
||||
) :
|
||||
menuItem(() => this._appModel.showUpgradeModal(), 'Upgrade Plan');
|
||||
}
|
||||
|
||||
private _maybeBuildActivationPageMenuItem() {
|
||||
const {activation, deploymentType} = getGristConfig();
|
||||
if (deploymentType !== 'enterprise' || !activation?.isManager) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return menuItemLink('Activation', urlState().setLinkUrl({activation: 'activation'}));
|
||||
}
|
||||
}
|
||||
|
||||
const cssAccountWidget = styled('div', `
|
||||
|
||||
Reference in New Issue
Block a user