From 36894886403e5f43754ea2c6679e8430033d78e1 Mon Sep 17 00:00:00 2001 From: Hannah Brownson Date: Mon, 15 Apr 2024 13:12:52 -0400 Subject: [PATCH 1/2] updating toggle icon changed single sort icon to two separate icons (chevron-up and chevron-down) updated toggleSortOrder to either asc or desc based on button selection added sortButtons to computed properties to calculate state of the sort buttons updated styling in order to change color of the selected sort state --- pkg/app-launcher/pages/index.vue | 62 +++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/pkg/app-launcher/pages/index.vue b/pkg/app-launcher/pages/index.vue index 7d16d6f..76d4c84 100644 --- a/pkg/app-launcher/pages/index.vue +++ b/pkg/app-launcher/pages/index.vue @@ -26,6 +26,8 @@ export default { selectedView: 'grid', favoritedServices: [], searchQuery: '', + sortOrder: 'asc', + sortButtons: 'asc' ? { asc: true, desc: false } : { asc: false, desc: true }, tableHeaders: [ { name: 'name', @@ -170,8 +172,17 @@ export default { value: cluster.id, }))]; }, - toggleSortOrder() { - this.tableHeaders[0].sortOrder = this.tableHeaders[0].sortOrder === 'asc' ? 'desc' : 'asc'; + toggleSortOrder(sortOrder) { + const column = this.tableHeaders[0]; + if (column.sortOrder === sortOrder && sortOrder === 'asc') { + return; // If already sorted in ascending order, do nothing + } + column.sortOrder = sortOrder; + if (sortOrder === 'asc') { + this.sortButtons = { asc: true, desc: false }; + } else { + this.sortButtons = { asc: false, desc: true }; + } }, getEndpoints(service) { return ( @@ -259,6 +270,9 @@ export default { return [this.selectedClusterData]; // This just remakes use of selectedClusterData for single cluster view } }, + sortButtons() { + return this.tableHeaders[0].sortOrder === 'asc' ? { asc: true, desc: false } : { asc: false, desc: true } + }, sortedApps() { if (this.selectedClusterData) { const services = this.selectedClusterData.services.map((service) => ({ @@ -337,9 +351,17 @@ export default {
- +
+
+ +
+
+

A-Z

+
+
+ +
+
-
-
+
+
-

A-Z

+

{{ aToZorZtoA }}

-
+
@@ -513,7 +502,7 @@ export default { border: none; cursor: pointer; padding: none; - color: var(--primary); + color:#555555; font-size: 1.3rem; display: flex; align-items: center; @@ -522,6 +511,7 @@ export default { .sort-label { color: var(--primary); font-size: 1rem; + cursor: pointer; } .sort-buttons { @@ -535,7 +525,7 @@ export default { } .sort-button.active { - color:#555555; + color: var(--primary); } .favorite-icon {