From 986767f0ecc21f01f8938c0b9791f0a098f4c16c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Mach?= <92859870+JMach1@users.noreply.github.com>
Date: Fri, 18 Nov 2022 13:09:29 +0100
Subject: [PATCH] List of APIs & operations collapsible by tags (#2003)
---
.../ko/runtime/api-list-tiles.html | 10 +++++--
.../list-of-apis/ko/runtime/api-list-tiles.ts | 8 ++++++
.../list-of-apis/ko/runtime/api-list.html | 10 +++++--
.../apis/list-of-apis/ko/runtime/api-list.ts | 8 ++++++
.../ko/runtime/operation-list.html | 10 +++++--
.../ko/runtime/operation-list.ts | 8 ++++++
src/themes/website/styles/tags.scss | 28 ++++++++++++++++++-
7 files changed, 75 insertions(+), 7 deletions(-)
diff --git a/src/components/apis/list-of-apis/ko/runtime/api-list-tiles.html b/src/components/apis/list-of-apis/ko/runtime/api-list-tiles.html
index 9a44a54f4..361269f2d 100644
--- a/src/components/apis/list-of-apis/ko/runtime/api-list-tiles.html
+++ b/src/components/apis/list-of-apis/ko/runtime/api-list-tiles.html
@@ -25,10 +25,15 @@
-
+
+
+
+
@@ -42,6 +47,7 @@
+
diff --git a/src/components/apis/list-of-apis/ko/runtime/api-list-tiles.ts b/src/components/apis/list-of-apis/ko/runtime/api-list-tiles.ts
index 179b386f6..d032f448c 100644
--- a/src/components/apis/list-of-apis/ko/runtime/api-list-tiles.ts
+++ b/src/components/apis/list-of-apis/ko/runtime/api-list-tiles.ts
@@ -24,6 +24,7 @@ export class ApiListTiles {
public readonly pattern: ko.Observable
;
public readonly tags: ko.Observable;
public readonly groupByTag: ko.Observable;
+ public readonly groupTagsExpanded: ko.Observable>;
public readonly pageNumber: ko.Observable;
public readonly totalPages: ko.Observable;
@@ -43,6 +44,7 @@ export class ApiListTiles {
this.apiGroups = ko.observableArray();
this.groupByTag = ko.observable(false);
this.defaultGroupByTagToEnabled = ko.observable(false);
+ this.groupTagsExpanded = ko.observable(new Set());
}
@Param()
@@ -125,6 +127,12 @@ export class ApiListTiles {
this.loadPageOfApis();
}
+ public groupTagCollapseToggle(tag: string): void {
+ const newSet = this.groupTagsExpanded();
+ newSet.has(tag) ? newSet.delete(tag) : newSet.add(tag);
+ this.groupTagsExpanded(newSet);
+ }
+
public async onTagsChange(tags: Tag[]): Promise {
this.tags(tags);
}
diff --git a/src/components/apis/list-of-apis/ko/runtime/api-list.html b/src/components/apis/list-of-apis/ko/runtime/api-list.html
index d25ba849d..9d9f392fb 100644
--- a/src/components/apis/list-of-apis/ko/runtime/api-list.html
+++ b/src/components/apis/list-of-apis/ko/runtime/api-list.html
@@ -39,9 +39,14 @@
-
+
+
+
+
@@ -69,6 +74,7 @@
+
diff --git a/src/components/apis/list-of-apis/ko/runtime/api-list.ts b/src/components/apis/list-of-apis/ko/runtime/api-list.ts
index 95f366d2a..6511be596 100644
--- a/src/components/apis/list-of-apis/ko/runtime/api-list.ts
+++ b/src/components/apis/list-of-apis/ko/runtime/api-list.ts
@@ -24,6 +24,7 @@ export class ApiList {
public readonly pattern: ko.Observable
;
public readonly tags: ko.Observable;
public readonly groupByTag: ko.Observable;
+ public readonly groupTagsExpanded: ko.Observable>;
public readonly pageNumber: ko.Observable;
public readonly totalPages: ko.Observable;
@@ -43,6 +44,7 @@ export class ApiList {
this.apiGroups = ko.observableArray();
this.groupByTag = ko.observable(false);
this.defaultGroupByTagToEnabled = ko.observable(false);
+ this.groupTagsExpanded = ko.observable(new Set());
}
@Param()
@@ -125,6 +127,12 @@ export class ApiList {
this.loadPageOfApis();
}
+ public groupTagCollapseToggle(tag: string): void {
+ const newSet = this.groupTagsExpanded();
+ newSet.has(tag) ? newSet.delete(tag) : newSet.add(tag);
+ this.groupTagsExpanded(newSet);
+ }
+
public async onTagsChange(tags: Tag[]): Promise {
this.tags(tags);
}
diff --git a/src/components/operations/operation-list/ko/runtime/operation-list.html b/src/components/operations/operation-list/ko/runtime/operation-list.html
index 541920adb..5577ea8a2 100644
--- a/src/components/operations/operation-list/ko/runtime/operation-list.html
+++ b/src/components/operations/operation-list/ko/runtime/operation-list.html
@@ -56,9 +56,14 @@
-
+
+
+
+
+
No operations found
diff --git a/src/components/operations/operation-list/ko/runtime/operation-list.ts b/src/components/operations/operation-list/ko/runtime/operation-list.ts
index 0cd0864c3..758254fac 100644
--- a/src/components/operations/operation-list/ko/runtime/operation-list.ts
+++ b/src/components/operations/operation-list/ko/runtime/operation-list.ts
@@ -27,6 +27,7 @@ export class OperationList {
public readonly operations: ko.ObservableArray
;
public readonly working: ko.Observable;
public readonly groupByTag: ko.Observable;
+ public readonly groupTagsExpanded: ko.Observable>;
public readonly operationGroups: ko.ObservableArray>;
public readonly pattern: ko.Observable;
public readonly tags: ko.Observable;
@@ -56,6 +57,7 @@ export class OperationList {
this.working = ko.observable(false);
this.groupByTag = ko.observable(false);
this.defaultGroupByTagToEnabled = ko.observable(false);
+ this.groupTagsExpanded = ko.observable(new Set());
this.pattern = ko.observable();
this.tags = ko.observable([]);
this.pageNumber = ko.observable(1);
@@ -251,6 +253,12 @@ export class OperationList {
this.tags(tags);
}
+ public groupTagCollapseToggle(tag: string): void {
+ const newSet = this.groupTagsExpanded();
+ newSet.has(tag) ? newSet.delete(tag) : newSet.add(tag);
+ this.groupTagsExpanded(newSet);
+ }
+
@OnDestroyed()
public dispose(): void {
this.router.removeRouteChangeListener(this.onRouteChange);
diff --git a/src/themes/website/styles/tags.scss b/src/themes/website/styles/tags.scss
index 1b9ac322d..4286f2e34 100644
--- a/src/themes/website/styles/tags.scss
+++ b/src/themes/website/styles/tags.scss
@@ -1,7 +1,33 @@
-.tag-group {
+.tag-group,
+.tag-group.no-border {
padding-top: 20px;
padding-bottom: 10px;
flex-basis: 100%;
+
+ &.tag-group-collapsible {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ width: 100%;
+ outline: none !important;
+ overflow: hidden;
+
+ .tag-item {
+ cursor: inherit;
+ }
+
+ .icon-emb-chevron-down {
+ transform: rotate(0);
+ transform-origin: 48% 45%;
+ transition: transform .3s ease;
+ }
+
+ &.active {
+ .icon-emb-chevron-down {
+ transform: rotate(-90deg);
+ }
+ }
+ }
}
.tag-item,