2022-04-01 18:17:06 +00:00
|
|
|
import {DocPageModel} from 'app/client/models/DocPageModel';
|
2022-05-03 05:20:31 +00:00
|
|
|
import {urlState} from 'app/client/models/gristUrlState';
|
2022-04-01 18:17:06 +00:00
|
|
|
import {docListHeader} from 'app/client/ui/DocMenuCss';
|
2022-10-19 23:06:05 +00:00
|
|
|
import {GristTooltips, TooltipContentFunc} from 'app/client/ui/GristTooltips';
|
|
|
|
import {withInfoTooltip} from 'app/client/ui/tooltips';
|
2022-09-06 01:51:57 +00:00
|
|
|
import {mediaXSmall, theme} from 'app/client/ui2018/cssVars';
|
2022-04-01 18:17:06 +00:00
|
|
|
import {icon} from 'app/client/ui2018/icons';
|
2022-08-11 15:09:03 +00:00
|
|
|
import {loadingDots, loadingSpinner} from 'app/client/ui2018/loaders';
|
2022-05-03 05:20:31 +00:00
|
|
|
import {APPROACHING_LIMIT_RATIO, DataLimitStatus} from 'app/common/DocUsage';
|
2022-07-26 17:49:35 +00:00
|
|
|
import {Features, isFreePlan} from 'app/common/Features';
|
2022-04-21 17:57:33 +00:00
|
|
|
import {capitalizeFirstWord} from 'app/common/gutil';
|
2022-05-26 06:47:26 +00:00
|
|
|
import {canUpgradeOrg} from 'app/common/roles';
|
2022-04-21 17:57:33 +00:00
|
|
|
import {Computed, Disposable, dom, DomContents, DomElementArg, makeTestId, styled} from 'grainjs';
|
2022-10-28 16:11:08 +00:00
|
|
|
import {makeT} from 'app/client/lib/localization';
|
|
|
|
|
|
|
|
const t = makeT('components.DocumentUsage');
|
2022-04-01 18:17:06 +00:00
|
|
|
|
2022-04-21 17:57:33 +00:00
|
|
|
const testId = makeTestId('test-doc-usage-');
|
|
|
|
|
|
|
|
// Default used by the progress bar to visually indicate row usage.
|
|
|
|
const DEFAULT_MAX_ROWS = 20000;
|
|
|
|
|
2022-05-03 05:20:31 +00:00
|
|
|
// Default used by the progress bar to visually indicate data size usage.
|
|
|
|
const DEFAULT_MAX_DATA_SIZE = DEFAULT_MAX_ROWS * 2 * 1024; // 40MB (2KiB per row)
|
|
|
|
|
|
|
|
// Default used by the progress bar to visually indicate attachments size usage.
|
|
|
|
const DEFAULT_MAX_ATTACHMENTS_SIZE = 1 * 1024 * 1024 * 1024; // 1GiB
|
|
|
|
|
2022-04-01 18:17:06 +00:00
|
|
|
/**
|
|
|
|
* Displays statistics about document usage, such as number of rows used.
|
|
|
|
*/
|
|
|
|
export class DocumentUsage extends Disposable {
|
2022-04-21 17:57:33 +00:00
|
|
|
private readonly _currentDoc = this._docPageModel.currentDoc;
|
2022-05-16 17:41:12 +00:00
|
|
|
private readonly _currentDocUsage = this._docPageModel.currentDocUsage;
|
|
|
|
private readonly _currentOrg = this._docPageModel.currentOrg;
|
2022-06-06 16:21:26 +00:00
|
|
|
private readonly _currentProduct = this._docPageModel.currentProduct;
|
2022-04-21 17:57:33 +00:00
|
|
|
|
2022-08-11 15:09:03 +00:00
|
|
|
// TODO: Update this whenever the rest of the UI is internationalized.
|
|
|
|
private readonly _rowCountFormatter = new Intl.NumberFormat('en-US');
|
|
|
|
|
2022-05-16 17:41:12 +00:00
|
|
|
private readonly _dataLimitStatus = Computed.create(this, this._currentDocUsage, (_use, usage) => {
|
|
|
|
return usage?.dataLimitStatus ?? null;
|
|
|
|
});
|
|
|
|
|
|
|
|
private readonly _rowCount = Computed.create(this, this._currentDocUsage, (_use, usage) => {
|
|
|
|
return usage?.rowCount;
|
|
|
|
});
|
|
|
|
|
|
|
|
private readonly _dataSizeBytes = Computed.create(this, this._currentDocUsage, (_use, usage) => {
|
|
|
|
return usage?.dataSizeBytes;
|
|
|
|
});
|
|
|
|
|
|
|
|
private readonly _attachmentsSizeBytes = Computed.create(this, this._currentDocUsage, (_use, usage) => {
|
|
|
|
return usage?.attachmentsSizeBytes;
|
2022-04-21 17:57:33 +00:00
|
|
|
});
|
|
|
|
|
2022-08-11 15:09:03 +00:00
|
|
|
private readonly _rowMetricOptions: Computed<MetricOptions> =
|
2022-06-06 16:21:26 +00:00
|
|
|
Computed.create(this, this._currentProduct, this._rowCount, (_use, product, rowCount) => {
|
2022-08-11 15:09:03 +00:00
|
|
|
const maxRows = product?.features.baseMaxRowsPerDocument;
|
2022-04-21 17:57:33 +00:00
|
|
|
// Invalid row limits are currently treated as if they are undefined.
|
|
|
|
const maxValue = maxRows && maxRows > 0 ? maxRows : undefined;
|
|
|
|
return {
|
2022-12-06 13:40:02 +00:00
|
|
|
name: t("Rows"),
|
2022-08-11 15:09:03 +00:00
|
|
|
currentValue: typeof rowCount !== 'object' ? undefined : rowCount.total,
|
2022-04-21 17:57:33 +00:00
|
|
|
maximumValue: maxValue ?? DEFAULT_MAX_ROWS,
|
|
|
|
unit: 'rows',
|
|
|
|
shouldHideLimits: maxValue === undefined,
|
2022-08-11 15:09:03 +00:00
|
|
|
formatValue: (val) => this._rowCountFormatter.format(val),
|
2022-04-21 17:57:33 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2022-08-11 15:09:03 +00:00
|
|
|
private readonly _dataSizeMetricOptions: Computed<MetricOptions> =
|
2022-06-06 16:21:26 +00:00
|
|
|
Computed.create(this, this._currentProduct, this._dataSizeBytes, (_use, product, dataSize) => {
|
2022-08-11 15:09:03 +00:00
|
|
|
const maxSize = product?.features.baseMaxDataSizePerDocument;
|
2022-05-03 05:20:31 +00:00
|
|
|
// Invalid data size limits are currently treated as if they are undefined.
|
|
|
|
const maxValue = maxSize && maxSize > 0 ? maxSize : undefined;
|
|
|
|
return {
|
2022-12-06 13:40:02 +00:00
|
|
|
name: t("Data Size"),
|
2022-08-11 15:09:03 +00:00
|
|
|
currentValue: typeof dataSize !== 'number' ? undefined : dataSize,
|
2022-05-03 05:20:31 +00:00
|
|
|
maximumValue: maxValue ?? DEFAULT_MAX_DATA_SIZE,
|
|
|
|
unit: 'MB',
|
|
|
|
shouldHideLimits: maxValue === undefined,
|
2022-10-19 23:06:05 +00:00
|
|
|
tooltipContentFunc: GristTooltips.dataSize,
|
2022-05-03 05:20:31 +00:00
|
|
|
formatValue: (val) => {
|
|
|
|
// To display a nice, round number for `maximumValue`, we first convert
|
|
|
|
// to KiBs (base-2), and then convert to MBs (base-10). Normally, we wouldn't
|
|
|
|
// mix conversions like this, but to display something that matches our
|
|
|
|
// marketing limits (e.g. 40MB for Pro plan), we need to bend conversions a bit.
|
|
|
|
return ((val / 1024) / 1000).toFixed(2);
|
|
|
|
},
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2022-08-11 15:09:03 +00:00
|
|
|
private readonly _attachmentsSizeMetricOptions: Computed<MetricOptions> =
|
2022-06-06 16:21:26 +00:00
|
|
|
Computed.create(this, this._currentProduct, this._attachmentsSizeBytes, (_use, product, attachmentsSize) => {
|
2022-08-11 15:09:03 +00:00
|
|
|
const maxSize = product?.features.baseMaxAttachmentsBytesPerDocument;
|
2022-05-03 05:20:31 +00:00
|
|
|
// Invalid attachments size limits are currently treated as if they are undefined.
|
|
|
|
const maxValue = maxSize && maxSize > 0 ? maxSize : undefined;
|
|
|
|
return {
|
2022-12-06 13:40:02 +00:00
|
|
|
name: t("Attachments Size"),
|
2022-08-11 15:09:03 +00:00
|
|
|
currentValue: typeof attachmentsSize !== 'number' ? undefined : attachmentsSize,
|
2022-05-03 05:20:31 +00:00
|
|
|
maximumValue: maxValue ?? DEFAULT_MAX_ATTACHMENTS_SIZE,
|
|
|
|
unit: 'GB',
|
|
|
|
shouldHideLimits: maxValue === undefined,
|
|
|
|
formatValue: (val) => (val / (1024 * 1024 * 1024)).toFixed(2),
|
|
|
|
};
|
2022-04-21 17:57:33 +00:00
|
|
|
});
|
|
|
|
|
2022-08-11 15:09:03 +00:00
|
|
|
private readonly _areAllMetricsPending: Computed<boolean> =
|
2022-05-03 05:20:31 +00:00
|
|
|
Computed.create(
|
|
|
|
this, this._currentDoc, this._rowCount, this._dataSizeBytes, this._attachmentsSizeBytes,
|
|
|
|
(_use, doc, rowCount, dataSize, attachmentsSize) => {
|
2022-08-11 15:09:03 +00:00
|
|
|
const hasNonPendingMetrics = [rowCount, dataSize, attachmentsSize]
|
|
|
|
.some(metric => metric !== 'pending' && metric !== undefined);
|
|
|
|
return !doc || !hasNonPendingMetrics;
|
2022-05-03 05:20:31 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2022-04-21 17:57:33 +00:00
|
|
|
private readonly _isAccessDenied: Computed<boolean | null> =
|
2022-08-11 15:09:03 +00:00
|
|
|
Computed.create(this, this._areAllMetricsPending, this._currentDoc, this._rowCount,
|
|
|
|
this._dataSizeBytes, this._attachmentsSizeBytes,
|
2022-05-03 05:20:31 +00:00
|
|
|
(_use, isLoading, doc, rowCount, dataSize, attachmentsSize) => {
|
2022-04-21 17:57:33 +00:00
|
|
|
if (isLoading) { return null; }
|
|
|
|
|
|
|
|
const {access} = doc!.workspace.org;
|
|
|
|
const isPublicUser = access === 'guests' || access === null;
|
2022-08-11 15:09:03 +00:00
|
|
|
const hasHiddenMetrics = [rowCount, dataSize, attachmentsSize].some(metric => metric === 'hidden');
|
|
|
|
return isPublicUser || hasHiddenMetrics;
|
2022-04-21 17:57:33 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2022-04-01 18:17:06 +00:00
|
|
|
constructor(private _docPageModel: DocPageModel) {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
public buildDom() {
|
|
|
|
return dom('div',
|
2022-12-06 13:40:02 +00:00
|
|
|
cssHeader(t("Usage"), testId('heading')),
|
2022-08-11 15:09:03 +00:00
|
|
|
dom.domComputed(this._areAllMetricsPending, (isLoading) => {
|
2022-04-21 17:57:33 +00:00
|
|
|
if (isLoading) { return cssSpinner(loadingSpinner(), testId('loading')); }
|
|
|
|
|
|
|
|
return [this._buildMessage(), this._buildMetrics()];
|
2022-04-01 18:17:06 +00:00
|
|
|
}),
|
2022-04-21 17:57:33 +00:00
|
|
|
testId('container'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
private _buildMessage() {
|
|
|
|
return dom.domComputed((use) => {
|
|
|
|
const isAccessDenied = use(this._isAccessDenied);
|
|
|
|
if (isAccessDenied === null) { return null; }
|
2022-12-06 13:40:02 +00:00
|
|
|
if (isAccessDenied) { return buildMessage(t("Usage statistics are only available to users with full access to the document data.")); }
|
2022-04-21 17:57:33 +00:00
|
|
|
|
|
|
|
const org = use(this._currentOrg);
|
2022-06-06 16:21:26 +00:00
|
|
|
const product = use(this._currentProduct);
|
2022-04-21 17:57:33 +00:00
|
|
|
const status = use(this._dataLimitStatus);
|
|
|
|
if (!org || !status) { return null; }
|
|
|
|
|
|
|
|
return buildMessage([
|
2022-05-26 06:47:26 +00:00
|
|
|
buildLimitStatusMessage(status, product?.features, {
|
2022-05-03 05:20:31 +00:00
|
|
|
disableRawDataLink: true
|
|
|
|
}),
|
2022-07-26 17:49:35 +00:00
|
|
|
(product && isFreePlan(product.name)
|
|
|
|
? [' ', buildUpgradeMessage(
|
|
|
|
canUpgradeOrg(org),
|
|
|
|
'long',
|
|
|
|
() => this._docPageModel.appModel.showUpgradeModal()
|
|
|
|
)]
|
2022-05-26 06:47:26 +00:00
|
|
|
: null
|
|
|
|
),
|
2022-04-21 17:57:33 +00:00
|
|
|
]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private _buildMetrics() {
|
|
|
|
return dom.maybe(use => use(this._isAccessDenied) === false, () =>
|
2022-04-01 18:17:06 +00:00
|
|
|
cssUsageMetrics(
|
2022-08-11 15:09:03 +00:00
|
|
|
dom.domComputed(this._rowMetricOptions, (metrics) =>
|
2022-04-21 17:57:33 +00:00
|
|
|
buildUsageMetric(metrics, testId('rows')),
|
|
|
|
),
|
2022-08-11 15:09:03 +00:00
|
|
|
dom.domComputed(this._dataSizeMetricOptions, (metrics) =>
|
2022-05-03 05:20:31 +00:00
|
|
|
buildUsageMetric(metrics, testId('data-size')),
|
|
|
|
),
|
2022-08-11 15:09:03 +00:00
|
|
|
dom.domComputed(this._attachmentsSizeMetricOptions, (metrics) =>
|
2022-05-03 05:20:31 +00:00
|
|
|
buildUsageMetric(metrics, testId('attachments-size')),
|
|
|
|
),
|
2022-04-21 17:57:33 +00:00
|
|
|
testId('metrics'),
|
|
|
|
),
|
2022-04-01 18:17:06 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-03 05:20:31 +00:00
|
|
|
export function buildLimitStatusMessage(
|
|
|
|
status: NonNullable<DataLimitStatus>,
|
|
|
|
features?: Features,
|
|
|
|
options: {
|
|
|
|
disableRawDataLink?: boolean;
|
|
|
|
} = {}
|
|
|
|
) {
|
|
|
|
const {disableRawDataLink = false} = options;
|
|
|
|
switch (status) {
|
|
|
|
case 'approachingLimit': {
|
|
|
|
return [
|
|
|
|
'This document is ',
|
|
|
|
disableRawDataLink ? 'approaching' : buildRawDataPageLink('approaching'),
|
|
|
|
' free plan limits.'
|
|
|
|
];
|
|
|
|
}
|
|
|
|
case 'gracePeriod': {
|
|
|
|
const gracePeriodDays = features?.gracePeriodDays;
|
|
|
|
if (!gracePeriodDays) {
|
|
|
|
return [
|
|
|
|
'Document limits ',
|
|
|
|
disableRawDataLink ? 'exceeded' : buildRawDataPageLink('exceeded'),
|
|
|
|
'.'
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
return [
|
|
|
|
'Document limits ',
|
|
|
|
disableRawDataLink ? 'exceeded' : buildRawDataPageLink('exceeded'),
|
|
|
|
`. In ${gracePeriodDays} days, this document will be read-only.`
|
|
|
|
];
|
|
|
|
}
|
|
|
|
case 'deleteOnly': {
|
|
|
|
return [
|
|
|
|
'This document ',
|
|
|
|
disableRawDataLink ? 'exceeded' : buildRawDataPageLink('exceeded'),
|
|
|
|
' free plan limits and is now read-only, but you can delete rows.'
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-26 17:49:35 +00:00
|
|
|
export function buildUpgradeMessage(
|
|
|
|
canUpgrade: boolean,
|
|
|
|
variant: 'short' | 'long',
|
|
|
|
onUpgrade: () => void,
|
|
|
|
) {
|
2022-12-06 13:40:02 +00:00
|
|
|
if (!canUpgrade) { return t("Contact the site owner to upgrade the plan to raise limits."); }
|
2022-05-03 05:20:31 +00:00
|
|
|
|
2022-12-06 13:40:02 +00:00
|
|
|
const upgradeLinkText = t("start your 30-day free trial of the Pro plan.")
|
2022-10-28 16:11:08 +00:00
|
|
|
// TODO i18next
|
2022-05-03 05:20:31 +00:00
|
|
|
return [
|
2022-12-06 13:40:02 +00:00
|
|
|
variant === 'short' ? null : t("For higher limits, "),
|
2022-07-26 17:49:35 +00:00
|
|
|
buildUpgradeLink(
|
|
|
|
variant === 'short' ? capitalizeFirstWord(upgradeLinkText) : upgradeLinkText,
|
|
|
|
() => onUpgrade(),
|
|
|
|
),
|
2022-05-03 05:20:31 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2022-07-26 17:49:35 +00:00
|
|
|
function buildUpgradeLink(linkText: string, onClick: () => void) {
|
|
|
|
return cssUnderlinedLink(linkText, dom.on('click', () => onClick()));
|
2022-05-03 05:20:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function buildRawDataPageLink(linkText: string) {
|
|
|
|
return cssUnderlinedLink(linkText, urlState().setLinkUrl({docPage: 'data'}));
|
2022-04-21 17:57:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface MetricOptions {
|
|
|
|
name: string;
|
2022-08-11 15:09:03 +00:00
|
|
|
// If undefined, loading dots will be shown.
|
|
|
|
currentValue?: number;
|
2022-04-21 17:57:33 +00:00
|
|
|
// If undefined or non-positive (i.e. invalid), no limits will be assumed.
|
|
|
|
maximumValue?: number;
|
|
|
|
unit?: string;
|
|
|
|
// If true, limits will always be hidden, even if `maximumValue` is a positive number.
|
|
|
|
shouldHideLimits?: boolean;
|
2022-06-06 16:21:26 +00:00
|
|
|
// Shows an icon next to the metric name that displays a tooltip on hover.
|
2022-10-19 23:06:05 +00:00
|
|
|
tooltipContentFunc?: TooltipContentFunc;
|
2022-05-03 05:20:31 +00:00
|
|
|
formatValue?(value: number): string;
|
2022-04-21 17:57:33 +00:00
|
|
|
}
|
|
|
|
|
2022-04-01 18:17:06 +00:00
|
|
|
/**
|
|
|
|
* Builds a component which displays the current and maximum values for
|
2022-04-21 17:57:33 +00:00
|
|
|
* a particular metric (e.g. row count), and a progress meter showing how
|
2022-04-01 18:17:06 +00:00
|
|
|
* close `currentValue` is to hitting `maximumValue`.
|
|
|
|
*/
|
2022-04-21 17:57:33 +00:00
|
|
|
function buildUsageMetric(options: MetricOptions, ...domArgs: DomElementArg[]) {
|
2022-10-19 23:06:05 +00:00
|
|
|
const {name, tooltipContentFunc} = options;
|
2022-04-01 18:17:06 +00:00
|
|
|
return cssUsageMetric(
|
2022-06-06 16:21:26 +00:00
|
|
|
cssMetricName(
|
2022-10-19 23:06:05 +00:00
|
|
|
tooltipContentFunc
|
|
|
|
? withInfoTooltip(
|
|
|
|
cssOverflowableText(name, testId('name')),
|
|
|
|
tooltipContentFunc()
|
|
|
|
)
|
|
|
|
: cssOverflowableText(name, testId('name')),
|
2022-06-06 16:21:26 +00:00
|
|
|
),
|
2022-08-11 15:09:03 +00:00
|
|
|
buildUsageProgressBar(options),
|
|
|
|
...domArgs,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function buildUsageProgressBar(options: MetricOptions) {
|
|
|
|
const {
|
|
|
|
currentValue,
|
|
|
|
maximumValue,
|
|
|
|
shouldHideLimits,
|
|
|
|
unit,
|
|
|
|
formatValue = (n) => n.toString()
|
|
|
|
} = options;
|
|
|
|
|
|
|
|
let ratioUsed: number;
|
|
|
|
let percentUsed: number;
|
|
|
|
if (currentValue === undefined) {
|
|
|
|
ratioUsed = 0;
|
|
|
|
percentUsed = 0;
|
|
|
|
} else {
|
|
|
|
ratioUsed = currentValue / (maximumValue || Infinity);
|
|
|
|
percentUsed = Math.min(100, Math.floor(ratioUsed * 100));
|
|
|
|
}
|
|
|
|
|
|
|
|
return [
|
2022-04-01 18:17:06 +00:00
|
|
|
cssProgressBarContainer(
|
|
|
|
cssProgressBarFill(
|
2022-04-21 17:57:33 +00:00
|
|
|
{style: `width: ${percentUsed}%`},
|
|
|
|
// Change progress bar to red if close to limit, unless limits are hidden.
|
|
|
|
shouldHideLimits || ratioUsed <= APPROACHING_LIMIT_RATIO
|
|
|
|
? null
|
|
|
|
: cssProgressBarFill.cls('-approaching-limit'),
|
|
|
|
testId('progress-fill'),
|
|
|
|
),
|
2022-04-01 18:17:06 +00:00
|
|
|
),
|
2022-04-21 17:57:33 +00:00
|
|
|
dom('div',
|
2022-08-11 15:09:03 +00:00
|
|
|
currentValue === undefined ? ['Loading ', cssLoadingDots()] : formatValue(currentValue)
|
2022-05-03 05:20:31 +00:00
|
|
|
+ (shouldHideLimits || !maximumValue ? '' : ' of ' + formatValue(maximumValue))
|
2022-04-21 17:57:33 +00:00
|
|
|
+ (unit ? ` ${unit}` : ''),
|
|
|
|
testId('value'),
|
2022-04-01 18:17:06 +00:00
|
|
|
),
|
2022-08-11 15:09:03 +00:00
|
|
|
];
|
2022-04-01 18:17:06 +00:00
|
|
|
}
|
|
|
|
|
2022-05-03 05:20:31 +00:00
|
|
|
function buildMessage(message: DomContents) {
|
|
|
|
return cssWarningMessage(
|
|
|
|
cssIcon('Idea'),
|
|
|
|
cssLightlyBoldedText(message, testId('message-text')),
|
|
|
|
testId('message'),
|
|
|
|
);
|
2022-04-21 17:57:33 +00:00
|
|
|
}
|
|
|
|
|
2022-04-01 18:17:06 +00:00
|
|
|
const cssLightlyBoldedText = styled('div', `
|
|
|
|
font-weight: 500;
|
|
|
|
`);
|
|
|
|
|
2022-09-06 01:51:57 +00:00
|
|
|
const cssWarningMessage = styled('div', `
|
|
|
|
color: ${theme.text};
|
|
|
|
--icon-color: ${theme.text};
|
2022-04-01 18:17:06 +00:00
|
|
|
display: flex;
|
|
|
|
gap: 16px;
|
|
|
|
margin-top: 16px;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssIcon = styled(icon, `
|
|
|
|
flex-shrink: 0;
|
|
|
|
width: 16px;
|
|
|
|
height: 16px;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssMetricName = styled('div', `
|
2022-06-06 16:21:26 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
gap: 8px;
|
2022-04-01 18:17:06 +00:00
|
|
|
font-weight: 700;
|
|
|
|
`);
|
|
|
|
|
2022-06-06 16:21:26 +00:00
|
|
|
const cssOverflowableText = styled('span', `
|
|
|
|
overflow: hidden;
|
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
`);
|
|
|
|
|
2022-04-01 18:17:06 +00:00
|
|
|
const cssHeader = styled(docListHeader, `
|
|
|
|
margin-bottom: 0px;
|
|
|
|
`);
|
|
|
|
|
2022-07-26 17:49:35 +00:00
|
|
|
const cssUnderlinedLink = styled('span', `
|
|
|
|
cursor: pointer;
|
2022-04-01 18:17:06 +00:00
|
|
|
color: unset;
|
|
|
|
text-decoration: underline;
|
|
|
|
|
|
|
|
&:hover, &:focus {
|
|
|
|
color: unset;
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssUsageMetrics = styled('div', `
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
margin-top: 24px;
|
2022-05-03 05:20:31 +00:00
|
|
|
row-gap: 24px;
|
|
|
|
column-gap: 54px;
|
2022-04-01 18:17:06 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssUsageMetric = styled('div', `
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.text};
|
2022-04-01 18:17:06 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
width: 180px;
|
|
|
|
gap: 8px;
|
|
|
|
|
|
|
|
@media ${mediaXSmall} {
|
|
|
|
& {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssProgressBarContainer = styled('div', `
|
|
|
|
width: 100%;
|
|
|
|
height: 4px;
|
|
|
|
border-radius: 5px;
|
2022-09-06 01:51:57 +00:00
|
|
|
background: ${theme.progressBarBg};
|
2022-04-01 18:17:06 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssProgressBarFill = styled(cssProgressBarContainer, `
|
2022-09-06 01:51:57 +00:00
|
|
|
background: ${theme.progressBarFg};
|
2022-04-01 18:17:06 +00:00
|
|
|
|
|
|
|
&-approaching-limit {
|
2022-09-06 01:51:57 +00:00
|
|
|
background: ${theme.progressBarErrorFg};
|
2022-04-01 18:17:06 +00:00
|
|
|
}
|
|
|
|
`);
|
2022-04-21 17:57:33 +00:00
|
|
|
|
|
|
|
const cssSpinner = styled('div', `
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
margin-top: 32px;
|
|
|
|
`);
|
2022-06-06 16:21:26 +00:00
|
|
|
|
2022-08-11 15:09:03 +00:00
|
|
|
const cssLoadingDots = styled(loadingDots, `
|
|
|
|
--dot-size: 8px;
|
|
|
|
`);
|