feat: implement chart line deletion functionality with UI controls and internationalization support
This commit is contained in:
14
app.js
14
app.js
@@ -525,8 +525,8 @@ class CLIProxyManager {
|
||||
const costHourBtn = document.getElementById('cost-hour-btn');
|
||||
const costDayBtn = document.getElementById('cost-day-btn');
|
||||
const addChartLineBtn = document.getElementById('add-chart-line');
|
||||
const removeChartLineBtn = document.getElementById('remove-chart-line');
|
||||
const chartLineSelects = document.querySelectorAll('.chart-line-select');
|
||||
const chartLineDeleteButtons = document.querySelectorAll('.chart-line-delete');
|
||||
const modelPriceForm = document.getElementById('model-price-form');
|
||||
const resetModelPricesBtn = document.getElementById('reset-model-prices');
|
||||
const modelPriceSelect = document.getElementById('model-price-model-select');
|
||||
@@ -555,9 +555,6 @@ class CLIProxyManager {
|
||||
if (addChartLineBtn) {
|
||||
addChartLineBtn.addEventListener('click', () => this.changeChartLineCount(1));
|
||||
}
|
||||
if (removeChartLineBtn) {
|
||||
removeChartLineBtn.addEventListener('click', () => this.changeChartLineCount(-1));
|
||||
}
|
||||
if (chartLineSelects.length) {
|
||||
chartLineSelects.forEach(select => {
|
||||
select.addEventListener('change', (event) => {
|
||||
@@ -566,6 +563,14 @@ class CLIProxyManager {
|
||||
});
|
||||
});
|
||||
}
|
||||
if (chartLineDeleteButtons.length) {
|
||||
chartLineDeleteButtons.forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const index = Number.parseInt(button.getAttribute('data-line-index'), 10);
|
||||
this.removeChartLine(Number.isNaN(index) ? -1 : index);
|
||||
});
|
||||
});
|
||||
}
|
||||
this.updateChartLineControlsUI();
|
||||
if (modelPriceForm) {
|
||||
modelPriceForm.addEventListener('submit', (event) => {
|
||||
@@ -673,6 +678,7 @@ class CLIProxyManager {
|
||||
chartLineMaxCount = 9;
|
||||
chartLineVisibleCount = 3;
|
||||
chartLineSelections = Array(3).fill('none');
|
||||
chartLineSelectionsInitialized = false;
|
||||
chartLineSelectIds = Array.from({ length: 9 }, (_, idx) => `chart-line-select-${idx}`);
|
||||
chartLineStyles = [
|
||||
{ borderColor: '#3b82f6', backgroundColor: 'rgba(59, 130, 246, 0.15)' },
|
||||
|
||||
Reference in New Issue
Block a user