From 55e356e40c490fd5b8a1e280a9736696916551ae Mon Sep 17 00:00:00 2001 From: kassem Date: Wed, 21 Jun 2023 14:51:42 +0300 Subject: [PATCH 1/9] support has_gpu filter --- .../dashboard/src/explorer/graphql/api.ts | 2 ++ .../dashboard/src/explorer/store/actions.ts | 1 + .../dashboard/src/explorer/store/getters.ts | 1 + .../dashboard/src/explorer/store/mutations.ts | 5 +++++ .../dashboard/src/explorer/store/state.ts | 3 ++- .../dashboard/src/explorer/views/Nodes.vue | 20 ++++++++++++------- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/packages/dashboard/src/explorer/graphql/api.ts b/packages/dashboard/src/explorer/graphql/api.ts index 4b94a00ee5..cf499bd0c0 100644 --- a/packages/dashboard/src/explorer/graphql/api.ts +++ b/packages/dashboard/src/explorer/graphql/api.ts @@ -94,6 +94,8 @@ export interface INode { certificationType: "Diy" | "Certified"; farmingPolicyName: string; countryFullName: string; + has_gpu?: boolean; + extra_fee?: number; } export interface INodeStatisticsUser { diff --git a/packages/dashboard/src/explorer/store/actions.ts b/packages/dashboard/src/explorer/store/actions.ts index e987cf06d8..69aebc6cf4 100644 --- a/packages/dashboard/src/explorer/store/actions.ts +++ b/packages/dashboard/src/explorer/store/actions.ts @@ -33,6 +33,7 @@ export default { if (state.nodesUpFilter) url += "&status=up"; if (state.nodesGatewayFilter) url += "&ipv4=true&domain=true"; + if (state.nodesGPUFilter) url += "&has_gpu=true"; for (const key in state.nodesFilter) { let value = state.nodesFilter[key]; diff --git a/packages/dashboard/src/explorer/store/getters.ts b/packages/dashboard/src/explorer/store/getters.ts index 6b7c4864c3..bc62c91a04 100644 --- a/packages/dashboard/src/explorer/store/getters.ts +++ b/packages/dashboard/src/explorer/store/getters.ts @@ -182,6 +182,7 @@ export default { getNodesTablePageSize: state => state.nodesTablePageSize, getNodesUpFilter: state => state.nodesUpFilter, getNodesGatewayFilter: state => state.nodesGatewayFilter, + getNodesGPUFilter: state => state.nodesGPUFilter, getNodesFilter: state => state.nodesFilter, } as GetterTree; diff --git a/packages/dashboard/src/explorer/store/mutations.ts b/packages/dashboard/src/explorer/store/mutations.ts index a07f13e61f..6b4100719a 100644 --- a/packages/dashboard/src/explorer/store/mutations.ts +++ b/packages/dashboard/src/explorer/store/mutations.ts @@ -18,6 +18,7 @@ export enum MutationTypes { SET_NODES_TABLE_PAGE_SIZE = "setNodesTablePageSize", SET_GATEWAY_FILTER = "setGatewayFilter", SET_UP_FILTER = "setUpFilter", + SET_GPU_FILTER = "setGPUFilter", SET_NODES = "setNodes", SET_NODES_FILTER = "setNodesFilter", CLEAR_NODES_FILTER = "clearNodesFilter", @@ -62,6 +63,7 @@ function fillNodesFields(state: IState, node: any, farms: any): INode { location: node.location, country: node.country, city: node.city, + has_gpu: node.has_gpu, interfaces: [ { name: "", @@ -123,6 +125,9 @@ export default { setGatewayFilter(state: IState, payload: boolean) { state.nodesGatewayFilter = payload; }, + setGPUFilter(state: IState, payload: boolean) { + state.nodesGPUFilter = payload; + }, setUpFilter(state: IState, payload: boolean) { state.nodesUpFilter = payload; }, diff --git a/packages/dashboard/src/explorer/store/state.ts b/packages/dashboard/src/explorer/store/state.ts index 4541c1c67b..0a3bfad7d3 100644 --- a/packages/dashboard/src/explorer/store/state.ts +++ b/packages/dashboard/src/explorer/store/state.ts @@ -93,6 +93,7 @@ export interface IState { nodesTablePageSize: number; nodesGatewayFilter: boolean; nodesUpFilter: boolean; + nodesGPUFilter: boolean; /* Refactored Data */ farms: IPaginationData; @@ -160,7 +161,7 @@ export default { nodesTablePageSize: 10, nodesUpFilter: true, nodesGatewayFilter: false, - + nodesGPUFilter: false, /* Refactored data */ farms: createPaginationData(), } as IState; diff --git a/packages/dashboard/src/explorer/views/Nodes.vue b/packages/dashboard/src/explorer/views/Nodes.vue index ebb3f96d58..b200eb9cc1 100644 --- a/packages/dashboard/src/explorer/views/Nodes.vue +++ b/packages/dashboard/src/explorer/views/Nodes.vue @@ -13,16 +13,12 @@ From 57279378e63ecbee1c4035e0e45e63cdcced1ed0 Mon Sep 17 00:00:00 2001 From: kassem Date: Thu, 22 Jun 2023 16:49:55 +0300 Subject: [PATCH 7/9] fix typo --- packages/dashboard/src/explorer/components/GPUDetails.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dashboard/src/explorer/components/GPUDetails.vue b/packages/dashboard/src/explorer/components/GPUDetails.vue index 184b7a70ee..9cd3317234 100644 --- a/packages/dashboard/src/explorer/components/GPUDetails.vue +++ b/packages/dashboard/src/explorer/components/GPUDetails.vue @@ -81,7 +81,7 @@ Contract ID - The contract id that reserve this GPU card + The contract id that reserves this GPU card {{ gpuItem?.contract }} From 37ab0dd7232d5d6747940f39186e091ddedb4f7e Mon Sep 17 00:00:00 2001 From: kassem Date: Fri, 23 Jun 2023 01:00:48 +0300 Subject: [PATCH 8/9] enhance code --- .../src/explorer/components/GPUDetails.vue | 77 +++++++++---------- 1 file changed, 36 insertions(+), 41 deletions(-) diff --git a/packages/dashboard/src/explorer/components/GPUDetails.vue b/packages/dashboard/src/explorer/components/GPUDetails.vue index 9cd3317234..1fab3a9465 100644 --- a/packages/dashboard/src/explorer/components/GPUDetails.vue +++ b/packages/dashboard/src/explorer/components/GPUDetails.vue @@ -15,48 +15,43 @@ - - - - Card id that's used in a deployment - - - - - - - + + + Card id that's used in a deployment + + + + + From 09d4033018b6c467846e056ca00212035b22c9f1 Mon Sep 17 00:00:00 2001 From: kassem Date: Fri, 23 Jun 2023 01:03:00 +0300 Subject: [PATCH 9/9] enhance ui --- packages/dashboard/src/explorer/components/GPUDetails.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dashboard/src/explorer/components/GPUDetails.vue b/packages/dashboard/src/explorer/components/GPUDetails.vue index 1fab3a9465..b93fd4e65d 100644 --- a/packages/dashboard/src/explorer/components/GPUDetails.vue +++ b/packages/dashboard/src/explorer/components/GPUDetails.vue @@ -31,7 +31,7 @@ Card id that's used in a deployment - +