Skip to content

Commit 1d910fa

Browse files
authored
fix: tie all-time reports to project range (aqua5230#15)
Adds the All Time option to the project range selector, routed through the unified analyze bridge (projectRange='all' → _analysis_period_from_project_range('all'→'all')). Loads project rows with hours_back=0 so the All Time view shows real all-time data instead of the 720h cached entries. Adds project_range_all i18n keys for all five locales. Co-authored-by: ericweichun <ericweichun@users.noreply.github.com>
1 parent dbebe8e commit 1d910fa

14 files changed

Lines changed: 169 additions & 36 deletions

assets/panels/aquarium.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
721721
function projectRangeLabel(range) {
722722
if (range === "7d") return t("project_range_7d");
723723
if (range === "30d") return t("project_range_30d");
724+
if (range === "all") return t("project_range_all");
724725
return t("project_range_1d");
725726
}
726727

@@ -870,7 +871,9 @@ <h1 data-i18n="projects_title">Project Usage</h1>
870871
renderProjects(
871872
projectRange === "1d" ? state.projects
872873
: projectRange === "7d" ? state.projects7d
873-
: state.projects30d
874+
: projectRange === "30d" ? state.projects30d
875+
: projectRange === "all" ? state.projectsAll
876+
: state.projects
874877
);
875878
renderStatusline(state.statusline || {});
876879
applyFooter(state.footer || {});
@@ -880,13 +883,15 @@ <h1 data-i18n="projects_title">Project Usage</h1>
880883
const button = event.target.closest("[data-action]");
881884
if (!button) return;
882885
if (button.dataset.action === "toggle-project-range") {
883-
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : "1d";
886+
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : projectRange === "30d" ? "all" : "1d";
884887
button.textContent = projectRangeLabel(projectRange);
885888
if (latestState) {
886889
renderProjects(
887890
projectRange === "1d" ? latestState.projects
888891
: projectRange === "7d" ? latestState.projects7d
889-
: latestState.projects30d
892+
: projectRange === "30d" ? latestState.projects30d
893+
: projectRange === "all" ? latestState.projectsAll
894+
: latestState.projects
890895
);
891896
}
892897
return;
@@ -983,6 +988,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
983988
projects: [],
984989
projects7d: [],
985990
projects30d: [],
991+
projectsAll: [],
986992
statusline: {},
987993
footer: { rate: "Rate: --", status: "Status: Loading", today: "Today: $0.00 (0 tokens)", showInstall: false }
988994
});

assets/panels/black_hole.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
620620
function projectRangeLabel(range) {
621621
if (range === "7d") return t("project_range_7d");
622622
if (range === "30d") return t("project_range_30d");
623+
if (range === "all") return t("project_range_all");
623624
return t("project_range_1d");
624625
}
625626

@@ -766,7 +767,9 @@ <h1 data-i18n="projects_title">Project Usage</h1>
766767
renderProjects(
767768
projectRange === "1d" ? state.projects
768769
: projectRange === "7d" ? state.projects7d
769-
: state.projects30d
770+
: projectRange === "30d" ? state.projects30d
771+
: projectRange === "all" ? state.projectsAll
772+
: state.projects
770773
);
771774
renderStatusline(state.statusline || {});
772775
applyFooter(state.footer || {});
@@ -776,13 +779,15 @@ <h1 data-i18n="projects_title">Project Usage</h1>
776779
const button = event.target.closest("[data-action]");
777780
if (!button) return;
778781
if (button.dataset.action === "toggle-project-range") {
779-
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : "1d";
782+
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : projectRange === "30d" ? "all" : "1d";
780783
button.textContent = projectRangeLabel(projectRange);
781784
if (latestState) {
782785
renderProjects(
783786
projectRange === "1d" ? latestState.projects
784787
: projectRange === "7d" ? latestState.projects7d
785-
: latestState.projects30d
788+
: projectRange === "30d" ? latestState.projects30d
789+
: projectRange === "all" ? latestState.projectsAll
790+
: latestState.projects
786791
);
787792
}
788793
return;
@@ -962,6 +967,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
962967
projects: [],
963968
projects7d: [],
964969
projects30d: [],
970+
projectsAll: [],
965971
statusline: {},
966972
footer: { rate: "Rate: --", status: "Status: Loading", today: "Today: $0.00 (0 tokens)", showInstall: false }
967973
});

assets/panels/classic.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
537537
function projectRangeLabel(range) {
538538
if (range === "7d") return t("project_range_7d");
539539
if (range === "30d") return t("project_range_30d");
540+
if (range === "all") return t("project_range_all");
540541
return t("project_range_1d");
541542
}
542543

@@ -656,7 +657,9 @@ <h1 data-i18n="projects_title">Project Usage</h1>
656657
renderProjects(
657658
projectRange === "1d" ? state.projects
658659
: projectRange === "7d" ? state.projects7d
659-
: state.projects30d
660+
: projectRange === "30d" ? state.projects30d
661+
: projectRange === "all" ? state.projectsAll
662+
: state.projects
660663
);
661664
renderStatusline(state.statusline || {});
662665
const rate = document.querySelector('[data-footer="rate"]');
@@ -671,13 +674,15 @@ <h1 data-i18n="projects_title">Project Usage</h1>
671674
const button = event.target.closest("[data-action]");
672675
if (!button) return;
673676
if (button.dataset.action === "toggle-project-range") {
674-
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : "1d";
677+
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : projectRange === "30d" ? "all" : "1d";
675678
button.textContent = projectRangeLabel(projectRange);
676679
if (latestState) {
677680
renderProjects(
678681
projectRange === "1d" ? latestState.projects
679682
: projectRange === "7d" ? latestState.projects7d
680-
: latestState.projects30d
683+
: projectRange === "30d" ? latestState.projects30d
684+
: projectRange === "all" ? latestState.projectsAll
685+
: latestState.projects
681686
);
682687
}
683688
return;
@@ -695,6 +700,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
695700
projects: [],
696701
projects7d: [],
697702
projects30d: [],
703+
projectsAll: [],
698704
statusline: {},
699705
footer: { rate: "Rate: --", status: "Status: Loading", today: "Today: $0.00 (0 tokens)", showInstall: false }
700706
});

assets/panels/cloud_observation.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
711711
function projectRangeLabel(range) {
712712
if (range === "7d") return t("project_range_7d");
713713
if (range === "30d") return t("project_range_30d");
714+
if (range === "all") return t("project_range_all");
714715
return t("project_range_1d");
715716
}
716717

@@ -838,7 +839,9 @@ <h1 data-i18n="projects_title">Project Usage</h1>
838839
renderProjects(
839840
projectRange === "1d" ? state.projects
840841
: projectRange === "7d" ? state.projects7d
841-
: state.projects30d
842+
: projectRange === "30d" ? state.projects30d
843+
: projectRange === "all" ? state.projectsAll
844+
: state.projects
842845
);
843846
renderStatusline(state.statusline || {});
844847
applyFooter(state.footer || {});
@@ -848,13 +851,15 @@ <h1 data-i18n="projects_title">Project Usage</h1>
848851
const button = event.target.closest("[data-action]");
849852
if (!button) return;
850853
if (button.dataset.action === "toggle-project-range") {
851-
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : "1d";
854+
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : projectRange === "30d" ? "all" : "1d";
852855
button.textContent = projectRangeLabel(projectRange);
853856
if (latestState) {
854857
renderProjects(
855858
projectRange === "1d" ? latestState.projects
856859
: projectRange === "7d" ? latestState.projects7d
857-
: latestState.projects30d
860+
: projectRange === "30d" ? latestState.projects30d
861+
: projectRange === "all" ? latestState.projectsAll
862+
: latestState.projects
858863
);
859864
}
860865
return;
@@ -872,6 +877,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
872877
projects: [],
873878
projects7d: [],
874879
projects30d: [],
880+
projectsAll: [],
875881
statusline: {},
876882
footer: { rate: "Rate: --", status: "Status: Loading", today: "Today: $0.00 (0 tokens)", showInstall: false }
877883
});

assets/panels/matrix.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ <h1 data-i18n="projects_title"></h1>
595595
function projectRangeLabel(range) {
596596
if (range === "7d") return t("project_range_7d");
597597
if (range === "30d") return t("project_range_30d");
598+
if (range === "all") return t("project_range_all");
598599
return t("project_range_1d");
599600
}
600601

@@ -714,7 +715,9 @@ <h1 data-i18n="projects_title"></h1>
714715
renderProjects(
715716
projectRange === "1d" ? state.projects
716717
: projectRange === "7d" ? state.projects7d
717-
: state.projects30d
718+
: projectRange === "30d" ? state.projects30d
719+
: projectRange === "all" ? state.projectsAll
720+
: state.projects
718721
);
719722
renderStatusline(state.statusline || {});
720723
const rate = document.querySelector('[data-footer="rate"]');
@@ -729,13 +732,15 @@ <h1 data-i18n="projects_title"></h1>
729732
const button = event.target.closest("[data-action]");
730733
if (!button) return;
731734
if (button.dataset.action === "toggle-project-range") {
732-
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : "1d";
735+
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : projectRange === "30d" ? "all" : "1d";
733736
button.textContent = projectRangeLabel(projectRange);
734737
if (latestState) {
735738
renderProjects(
736739
projectRange === "1d" ? latestState.projects
737740
: projectRange === "7d" ? latestState.projects7d
738-
: latestState.projects30d
741+
: projectRange === "30d" ? latestState.projects30d
742+
: projectRange === "all" ? latestState.projectsAll
743+
: latestState.projects
739744
);
740745
}
741746
return;
@@ -759,6 +764,7 @@ <h1 data-i18n="projects_title"></h1>
759764
projects: [],
760765
projects7d: [],
761766
projects30d: [],
767+
projectsAll: [],
762768
statusline: {},
763769
footer: {
764770
rate: t("rate_text", { value: "--" }),

assets/panels/newspaper.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
573573
function projectRangeLabel(range) {
574574
if (range === "7d") return t("project_range_7d");
575575
if (range === "30d") return t("project_range_30d");
576+
if (range === "all") return t("project_range_all");
576577
return t("project_range_1d");
577578
}
578579

@@ -692,7 +693,9 @@ <h1 data-i18n="projects_title">Project Usage</h1>
692693
renderProjects(
693694
projectRange === "1d" ? state.projects
694695
: projectRange === "7d" ? state.projects7d
695-
: state.projects30d
696+
: projectRange === "30d" ? state.projects30d
697+
: projectRange === "all" ? state.projectsAll
698+
: state.projects
696699
);
697700
renderStatusline(state.statusline || {});
698701
const rate = document.querySelector('[data-footer="rate"]');
@@ -707,13 +710,15 @@ <h1 data-i18n="projects_title">Project Usage</h1>
707710
const button = event.target.closest("[data-action]");
708711
if (!button) return;
709712
if (button.dataset.action === "toggle-project-range") {
710-
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : "1d";
713+
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : projectRange === "30d" ? "all" : "1d";
711714
button.textContent = projectRangeLabel(projectRange);
712715
if (latestState) {
713716
renderProjects(
714717
projectRange === "1d" ? latestState.projects
715718
: projectRange === "7d" ? latestState.projects7d
716-
: latestState.projects30d
719+
: projectRange === "30d" ? latestState.projects30d
720+
: projectRange === "all" ? latestState.projectsAll
721+
: latestState.projects
717722
);
718723
}
719724
return;
@@ -731,6 +736,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
731736
projects: [],
732737
projects7d: [],
733738
projects30d: [],
739+
projectsAll: [],
734740
statusline: {},
735741
footer: { rate: "Rate: --", status: "Status: Loading", today: "Today: $0.00 (0 tokens)", showInstall: false }
736742
});

assets/panels/prism_arcade.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
650650
function projectRangeLabel(range) {
651651
if (range === "7d") return t("project_range_7d");
652652
if (range === "30d") return t("project_range_30d");
653+
if (range === "all") return t("project_range_all");
653654
return t("project_range_1d");
654655
}
655656

@@ -796,7 +797,9 @@ <h1 data-i18n="projects_title">Project Usage</h1>
796797
renderProjects(
797798
projectRange === "1d" ? state.projects
798799
: projectRange === "7d" ? state.projects7d
799-
: state.projects30d
800+
: projectRange === "30d" ? state.projects30d
801+
: projectRange === "all" ? state.projectsAll
802+
: state.projects
800803
);
801804
renderStatusline(state.statusline || {});
802805
applyFooter(state.footer || {});
@@ -806,13 +809,15 @@ <h1 data-i18n="projects_title">Project Usage</h1>
806809
const button = event.target.closest("[data-action]");
807810
if (!button) return;
808811
if (button.dataset.action === "toggle-project-range") {
809-
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : "1d";
812+
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : projectRange === "30d" ? "all" : "1d";
810813
button.textContent = projectRangeLabel(projectRange);
811814
if (latestState) {
812815
renderProjects(
813816
projectRange === "1d" ? latestState.projects
814817
: projectRange === "7d" ? latestState.projects7d
815-
: latestState.projects30d
818+
: projectRange === "30d" ? latestState.projects30d
819+
: projectRange === "all" ? latestState.projectsAll
820+
: latestState.projects
816821
);
817822
}
818823
return;
@@ -962,6 +967,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
962967
projects: [],
963968
projects7d: [],
964969
projects30d: [],
970+
projectsAll: [],
965971
statusline: {},
966972
footer: { rate: "Rate: --", status: "Status: Loading", today: "Today: $0.00 (0 tokens)", showInstall: false }
967973
});

assets/panels/win95.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
540540
function projectRangeLabel(range) {
541541
if (range === "7d") return t("project_range_7d");
542542
if (range === "30d") return t("project_range_30d");
543+
if (range === "all") return t("project_range_all");
543544
return t("project_range_1d");
544545
}
545546

@@ -659,7 +660,9 @@ <h1 data-i18n="projects_title">Project Usage</h1>
659660
renderProjects(
660661
projectRange === "1d" ? state.projects
661662
: projectRange === "7d" ? state.projects7d
662-
: state.projects30d
663+
: projectRange === "30d" ? state.projects30d
664+
: projectRange === "all" ? state.projectsAll
665+
: state.projects
663666
);
664667
renderStatusline(state.statusline || {});
665668
const rate = document.querySelector('[data-footer="rate"]');
@@ -674,13 +677,15 @@ <h1 data-i18n="projects_title">Project Usage</h1>
674677
const button = event.target.closest("[data-action]");
675678
if (!button) return;
676679
if (button.dataset.action === "toggle-project-range") {
677-
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : "1d";
680+
projectRange = projectRange === "1d" ? "7d" : projectRange === "7d" ? "30d" : projectRange === "30d" ? "all" : "1d";
678681
button.textContent = projectRangeLabel(projectRange);
679682
if (latestState) {
680683
renderProjects(
681684
projectRange === "1d" ? latestState.projects
682685
: projectRange === "7d" ? latestState.projects7d
683-
: latestState.projects30d
686+
: projectRange === "30d" ? latestState.projects30d
687+
: projectRange === "all" ? latestState.projectsAll
688+
: latestState.projects
684689
);
685690
}
686691
return;
@@ -698,6 +703,7 @@ <h1 data-i18n="projects_title">Project Usage</h1>
698703
projects: [],
699704
projects7d: [],
700705
projects30d: [],
706+
projectsAll: [],
701707
statusline: {},
702708
footer: { rate: "Rate: --", status: "Status: Loading", today: "Today: $0.00 (0 tokens)", showInstall: false }
703709
});

0 commit comments

Comments
 (0)