Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): electron app doesn't respect reflected properties #2399

Merged
merged 3 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import {LitElement, html, css, nothing} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {classMap} from 'lit/directives/class-map.js';

import {formatBytes} from '../../../../data_formatting';

Expand Down Expand Up @@ -57,7 +58,8 @@ export class AccessKeyUsageMeter extends LitElement {
font-family: var(--access-key-usage-meter-font-family);
}

:host([dataLimitWarning]) > label {
:host([dataLimitWarning]) > label,
label.data-limit-warning {
color: var(--access-key-usage-meter-warning-text-color);
}

Expand All @@ -77,22 +79,32 @@ export class AccessKeyUsageMeter extends LitElement {
background: var(--access-key-usage-meter-color);
}

:host([dataLimitWarning]) > progress[value]::-webkit-progress-value {
:host([dataLimitWarning]) > progress[value]::-webkit-progress-value,
progress.data-limit-warning[value]::-webkit-progress-value {
background: var(--access-key-usage-meter-warning-color);
}
`;

render() {
// TODO: debug why the reflected property doesn't work in electron
return html`<progress
class=${classMap({
'data-limit-warning': this.dataLimitWarning,
})}
id="progress"
max=${this.dataLimitBytes}
value=${this.dataUsageBytes}
></progress>
<label for="progress">
<label
class=${classMap({
'data-limit-warning': this.dataLimitWarning,
})}
for="progress"
>
${formatBytes(this.dataUsageBytes, this.language)} /
${formatBytes(this.dataLimitBytes, this.language)}
${this.dataLimitWarning
? this.localize('server-view-access-keys-usage-limit')
? `(${this.localize('server-view-access-keys-usage-limit')})`
: nothing}
</label>`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ export const Example = {
dataUsageBytes: 1000000,
dataLimitBytes: 10000000,
language: 'en',
localize: () => '(80%+ used)',
localize: () => '80%+ used',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import {LitElement, html, css, nothing} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {classMap} from 'lit/directives/class-map';
import {unsafeHTML} from 'lit/directives/unsafe-html.js';

import type {ServerMetricsData} from './index';
Expand Down Expand Up @@ -158,7 +159,8 @@ export class ServerMetricsBandwidthRow extends LitElement {
font-size: var(--server-metrics-bandwidth-row-value-font-size);
}

:host([bandwidthLimitWarning]) .bandwidth-percentage {
:host([bandwidthLimitWarning]) .bandwidth-percentage,
.bandwidth-limit-warning .bandwidth-percentage {
color: var(--server-metrics-bandwidth-row-meter-warning-color);
}

Expand Down Expand Up @@ -206,15 +208,18 @@ export class ServerMetricsBandwidthRow extends LitElement {
);
}

:host([bandwidthLimitWarning]) progress[value]::-webkit-progress-value {
:host([bandwidthLimitWarning]) progress[value]::-webkit-progress-value,
.bandwidth-limit-warning progress[value]::-webkit-progress-value {
background: var(--server-metrics-bandwidth-row-meter-warning-color);
}

:host([bandwidthLimitWarning]) .bandwidth-progress-container {
:host([bandwidthLimitWarning]) .bandwidth-progress-container,
.bandwidth-limit-warning .bandwidth-progress-container {
padding: 0;
}

:host([bandwidthLimitWarning]) .bandwidth-progress-container icon-tooltip {
:host([bandwidthLimitWarning]) .bandwidth-progress-container icon-tooltip,
.bandwidth-limit-warning .bandwidth-progress-container icon-tooltip {
display: block;
}

Expand Down Expand Up @@ -296,7 +301,13 @@ export class ServerMetricsBandwidthRow extends LitElement {
'</i>'
)}
>
<div class="main-container">
<!-- TODO: debug why the reflected property doesn't work in electron -->
<div
class=${classMap({
'bandwidth-limit-warning': this.bandwidthLimitWarning,
'main-container': true,
})}
>
<div class="title-and-bandwidth-container">
<div class="title-container">
<mwc-icon>data_usage</mwc-icon>
Expand Down
Loading