@@ -7,22 +7,8 @@ included in the LICENSE file.
77<template >
88 <div class =" flex flex-col w-full gap-4" >
99 <page-header title =" All Nodes" />
10- <div class =" flex gap-2" >
11- <t-input
12- primary
13- class =" flex-1"
14- placeholder =" Search..."
15- v-model =" searchOption"
16- />
17- <t-select-list
18- title =" Status"
19- :defaultValue =" NodesViewFilterOptions.ALL"
20- :values =" filterOptions"
21- @checkedValue =" setFilterOption"
22- />
23- </div >
24- <watch :opts =" opts" spinner noRecordsAlert errorsAlert >
25- <template #default =" { items } " >
10+ <t-list :opts =" opts" search pagination >
11+ <template #default =" { items , searchQuery } " >
2612 <div class =" nodes-list" >
2713 <div class =" nodes-list-heading" >
2814 <p >Name</p >
@@ -33,45 +19,32 @@ included in the LICENSE file.
3319 </div >
3420 <t-group-animation >
3521 <nodes-item
36- v-for =" item in filterItems( items) "
22+ v-for =" item in items"
3723 :key =" item.metadata.id!"
3824 :item =" item"
39- :searchOption =" searchOption "
25+ :searchOption =" searchQuery "
4026 />
4127 </t-group-animation >
4228 </div >
4329 </template >
44- </watch >
30+ </t-list >
4531 </div >
4632</template >
4733
4834<script setup lang="ts">
4935import { getContext } from " @/context" ;
5036import { kubernetes , ClusterMachineStatusType , LabelCluster , ClusterMachineStatusLabelNodeName , TalosMemberType , TalosClusterNamespace } from " @/api/resources" ;
5137import { Runtime } from " @/api/common/omni.pb" ;
52- import { Resource , ResourceTyped } from " @/api/grpc" ;
5338import { ClusterMachineStatusSpec } from " @/api/omni/specs/omni.pb" ;
5439import { useRoute } from " vue-router" ;
5540import { DefaultNamespace } from " @/api/resources" ;
56- import { Node , NodeSpec , NodeStatus } from " kubernetes-types/core/v1" ;
57- import { NodesViewFilterOptions } from " @/constants" ;
58- import { ref } from " vue" ;
59- import { getStatus } from " @/methods" ;
41+ import { Node } from " kubernetes-types/core/v1" ;
6042
61- import Watch from " @/components/common/Watch/Watch .vue" ;
43+ import TList from " @/components/common/List/TList .vue" ;
6244import PageHeader from " @/components/common/PageHeader.vue" ;
6345import NodesItem from " @/views/cluster/Nodes/components/NodesItem.vue" ;
6446import TGroupAnimation from " @/components/common/Animation/TGroupAnimation.vue" ;
65- import TInput from " @/components/common/TInput/TInput.vue" ;
66- import TSelectList from " @/components/common/SelectList/TSelectList.vue" ;
67-
68- const filterOption = ref (" All" );
69- const searchOption = ref (" " );
70- const setFilterOption = (data : string ) => {
71- filterOption .value = data ;
72- };
73-
74- const filterOptions = Object .keys (NodesViewFilterOptions ).map (key => NodesViewFilterOptions [key ]);
47+ import { Resource } from " @/api/v1alpha1/resource.pb" ;
7548
7649const route = useRoute ();
7750const context = getContext ();
@@ -86,7 +59,7 @@ const opts = [
8659 selectors: [
8760 ` ${LabelCluster }=${route .params .cluster } `
8861 ],
89- idFunc : (item : ResourceTyped <ClusterMachineStatusSpec >): string => {
62+ idFunc : (item : Resource <ClusterMachineStatusSpec >): string => {
9063 return (item ?.metadata ?.labels ?? {})[ClusterMachineStatusLabelNodeName ] ?? item .metadata .id ;
9164 }
9265},
@@ -111,38 +84,6 @@ const opts = [
11184 return item .metadata .id ;
11285 }
11386}];
114-
115- type MemberSpec = {
116- operatingSystem: string ,
117- addresses: string [],
118- }
119-
120- const filterItems = (items : Resource <ClusterMachineStatusSpec & NodeSpec & MemberSpec , NodeStatus >[]) => {
121- return items .filter ((elem : any ) => {
122- const searchFields = [
123- (elem ?.metadata .labels || {})[ClusterMachineStatusLabelNodeName ],
124- elem ?.metadata .id ,
125- elem ?.spec .operatingSystem ,
126- (elem ?.spec ?.addresses ?? {})[0 ] ?? " "
127- ];
128-
129- if (getStatus (elem ) !== filterOption ?.value && filterOption ?.value !== NodesViewFilterOptions .ALL ) {
130- return false ;
131- }
132-
133- if (searchOption ?.value === " " ) {
134- return true ;
135- }
136-
137- for (const value of searchFields ) {
138- if (value .includes (searchOption ?.value )) {
139- return true ;
140- }
141- }
142-
143- return false ;
144- })
145- };
14687 </script >
14788
14889<style scoped>
0 commit comments