Skip to content

Commit 532f8d2

Browse files
committed
Address comments.
1 parent 651d996 commit 532f8d2

3 files changed

Lines changed: 8 additions & 25 deletions

File tree

com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/Messages.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ public class Messages extends NLS {
184184
public static String usage_duration_hours;
185185
public static String usage_duration_hour;
186186
public static String usage_duration_mins;
187+
public static String usage_duration_less_than_min;
187188

188189
static {
189190
// initialize resource bundle

com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/UsageStatusPreferencePage.java

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import java.time.ZonedDateTime;
77
import java.time.format.DateTimeFormatter;
88
import java.time.format.DateTimeParseException;
9-
import java.util.ArrayList;
10-
import java.util.List;
119
import java.util.Locale;
1210

1311
import org.apache.commons.lang3.StringUtils;
@@ -58,7 +56,6 @@ public class UsageStatusPreferencePage extends PreferencePage implements IWorkbe
5856
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("MMMM d", Locale.getDefault());
5957

6058
private Composite mainComposite;
61-
private final List<CopilotUsageBar> usageBars = new ArrayList<>();
6259

6360
@Override
6461
public void init(IWorkbench workbench) {
@@ -79,16 +76,6 @@ protected Control createContents(Composite parent) {
7976
return mainComposite;
8077
}
8178

82-
@Override
83-
public boolean performOk() {
84-
for (CopilotUsageBar bar : usageBars) {
85-
if (!bar.isDisposed()) {
86-
bar.refreshBar();
87-
}
88-
}
89-
return super.performOk();
90-
}
91-
9279
private void scheduleQuotaLoad() {
9380
Job job = new Job("Loading usage...") {
9481
@Override
@@ -246,7 +233,6 @@ private void createLimitCompound(Composite parent, String title, String tooltip,
246233
CopilotUsageBar usageBar = new CopilotUsageBar(limitCompound, SWT.NONE);
247234
usageBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
248235
usageBar.setPercentage(percentUsed);
249-
usageBars.add(usageBar);
250236

251237
Label percentLabel = new Label(limitCompound, SWT.RIGHT);
252238
percentLabel.setText(NLS.bind(Messages.usage_percentage_suffix, percentUsed));
@@ -268,18 +254,11 @@ private void createOverageLabel(Composite parent, TbbQuota sessionQuota, TbbQuot
268254
overageLabel.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, true, false));
269255
boolean overagePermitted = (sessionQuota != null && sessionQuota.isOveragePermitted())
270256
|| (weeklyQuota != null && weeklyQuota.isOveragePermitted());
271-
int totalOverageCount = 0;
272-
if (sessionQuota != null) {
273-
totalOverageCount += sessionQuota.getOverageCount();
274-
}
275-
if (weeklyQuota != null) {
276-
totalOverageCount += weeklyQuota.getOverageCount();
277-
}
278257

279258
if (overagePermitted) {
280259
overageLabel.setText(Messages.usage_overage_configured);
281260
overageLabel.setForeground(CssConstants.getInputPlaceHolderColor(parent.getDisplay()));
282-
} else if (totalOverageCount == 0) {
261+
} else {
283262
overageLabel.setText(Messages.usage_overage_not_configured);
284263
overageLabel.setForeground(CssConstants.getInputPlaceHolderColor(parent.getDisplay()));
285264
}
@@ -376,8 +355,10 @@ private static String formatSessionReset(String utcTimestamp) {
376355
duration = NLS.bind(Messages.usage_duration_hours, hours);
377356
} else if (hours == 1) {
378357
duration = Messages.usage_duration_hour;
379-
} else {
358+
} else if (mins > 0) {
380359
duration = NLS.bind(Messages.usage_duration_mins, mins);
360+
} else {
361+
duration = Messages.usage_duration_less_than_min;
381362
}
382363
return NLS.bind(Messages.usage_resets_in, duration);
383364
});

com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/messages.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ usage_monthly_limit=Monthly Limit
164164
usage_monthly_limit_description=Usage limit per billing cycle, resets on billing cycle date.\nContinue uninterrupted with pay-as-you-go overage\nwhen monthly limit is hit.
165165
usage_overage_spend_tooltip=Pay-as-you-go spend on additional usage when you \nhit session and weekly limits.\nSet a budget to cap your maximum monthly spend.
166166
usage_percentage_suffix={0}% used
167-
usage_overage_not_configured=No overage fund set
168-
usage_overage_configured=Overage fund enabled
167+
usage_overage_not_configured=Overage not configured
168+
usage_overage_configured=Overage enabled
169169
usage_not_signed_in=Sign in to GitHub to access usage.
170170
usage_no_monthly_limit=You have no monthly limit on AI credit usage set by your organization.
171171
usage_no_session_limit=You have no session limit on AI credit usage.
@@ -178,3 +178,4 @@ usage_duration_hour_mins=1 hour {0} mins
178178
usage_duration_hours={0} hours
179179
usage_duration_hour=1 hour
180180
usage_duration_mins={0} mins
181+
usage_duration_less_than_min=less than a minute

0 commit comments

Comments
 (0)