Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 16 additions & 5 deletions tools/release-plan-dashboard/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@
return store().filters.month;
}

function getSortOrder() {
return store().filters.sort || 'month';
}

function render(plans) {
detectDuplicates(plans);
const planeFilter = getGlobalPlaneFilter();
Expand All @@ -574,6 +578,12 @@
return parseReleaseMonth(a.releaseMonth) - parseReleaseMonth(b.releaseMonth);
}

function sortByReleasePlanId(a, b) {
return (a.releasePlanId || 0) - (b.releasePlanId || 0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm I don't think this is quite what we want assuming two things:

  1. releasePlanId is a string
  2. we want descending order (largest IDs first)

If (1) is true, any non-numeric strings will cause it to silently fail sorting (because they will end up as NaN). This may be fine if we truly expect IDs to be a stringified number but might as well be safe and avoid implicit casts

If (2) is true, then I think we need to flip a and b here (b - a) instead of (a - b)

I sketched out this playground to show what I mean which is hopefully helpful to clarify

}

const sortFn = getSortOrder() === 'id' ? sortByReleasePlanId : sortByReleaseMonth;

Comment thread
praveenkuttappan marked this conversation as resolved.
function splitByState(arr) {
const partial = [];
const inProgress = [];
Expand All @@ -592,14 +602,14 @@
}
}

inProgress.sort(sortByReleaseMonth);
partial.sort(sortByReleaseMonth);
newItems.sort(sortByReleaseMonth);
inProgress.sort(sortFn);
partial.sort(sortFn);
newItems.sort(sortFn);

// When filtering/searching, show all finished plans that match;
// otherwise limit to this/last month, max 20
if (isFiltering) {
finished.sort(sortByReleaseMonth);
finished.sort(sortFn);
return { inProgress, partial, newItems, finished };
}
const now = new Date();
Expand All @@ -610,7 +620,7 @@
const rm = (p.releaseMonth || "").toLowerCase();
return rm.includes(thisMonthKey) || rm.includes(lastMonthKey);
});
recentFinished.sort(sortByReleaseMonth);
recentFinished.sort(sortFn);
const cappedFinished = recentFinished.slice(0, FINISHED_DISPLAY_LIMIT);

return { inProgress, partial, newItems, finished: cappedFinished };
Expand Down Expand Up @@ -1859,6 +1869,7 @@
const _search = store().filters.search;
const _plane = store().filters.plane;
const _month = store().filters.month;
const _sort = store().filters.sort;
const _prLang = store().filters.prLang;
const _prStatus = store().filters.prStatus;
// Skip re-render if plans not loaded yet
Expand Down
6 changes: 5 additions & 1 deletion tools/release-plan-dashboard/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
stats: { total: 0, inprogress: 0, partial: 0, new: 0, finished: 0, mgmt: 0, data: 0 },
prCount: '',
user: { name: '', isPM: false },
filters: { search: '', plane: '', month: '', prLang: '', prStatus: '' },
filters: { search: '', plane: '', month: '', sort: 'month', prLang: '', prStatus: '' },
prFilterVisible: false,

// UI state — expansion/collapse keyed by ID (survives reactive re-renders)
Expand Down Expand Up @@ -118,6 +118,10 @@ <h1>Azure SDK Release Plan Dashboard</h1>
<select id="global-month-filter" class="global-month-filter" x-model="$store.app.filters.month">
<option value="">All Months</option>
</select>
<select id="global-sort-order" class="global-sort-order" x-model="$store.app.filters.sort" x-show="$store.app.activeTab === 'tab-release-plans'">
<option value="month">Sort by: SDK Release Month</option>
<option value="id">Sort by: Release Plan ID</option>
</select>
</div>

<!-- Create Release Plan Guide Modal -->
Expand Down
2 changes: 1 addition & 1 deletion tools/release-plan-dashboard/public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ header h1 { font-size: 1.25rem; font-weight: 600; }
font-size: .9rem;
width: 280px;
}
.global-plane-filter, .global-month-filter {
.global-plane-filter, .global-month-filter, .global-sort-order {
padding: 5px 10px;
border: 1px solid #d2d0ce;
border-radius: var(--radius);
Expand Down