mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add a query param for filtering port forwards by clusterId (#4441)
* Add a query param for filtering port forwards by clusterId Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * pass clusterId query as param Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * pass queries as params for other apiBase calls, for consistency Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
1 parent
406f595011
commit
0673c98f4e
2 files changed
+25
-24
No files matched your search
@@ -189,9 +189,10 @@ export class PortForwardRoute {
|
||||
}
|
||||
|
||||
static async routeAllPortForwards(request: LensApiRequest) {
|
||||
const { response } = request;
|
||||
const { query, response } = request;
|
||||
const clusterId = query.get("clusterId");
|
||||
|
||||
const portForwards: PortForwardArgs[] = PortForward.portForwards.map(f => (
|
||||
let portForwards: PortForwardArgs[] = PortForward.portForwards.map(f => (
|
||||
{
|
||||
clusterId: f.clusterId,
|
||||
kind: f.kind,
|
||||
@@ -203,6 +204,12 @@ export class PortForwardRoute {
|
||||
}),
|
||||
);
|
||||
|
||||
if (clusterId) {
|
||||
// filter out any not for this cluster
|
||||
portForwards = portForwards.filter(pf => pf.clusterId == clusterId);
|
||||
|
||||
}
|
||||
|
||||
respondJson(response, { portForwards });
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user