From 80605f3b743285e03f4cfd8e6f122941cca19752 Mon Sep 17 00:00:00 2001 From: zaelgohary Date: Thu, 6 Jun 2024 13:47:18 +0300 Subject: [PATCH 01/73] Add zmount unit tests --- .../grid_client/tests/modules/zmount.test.ts | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 packages/grid_client/tests/modules/zmount.test.ts diff --git a/packages/grid_client/tests/modules/zmount.test.ts b/packages/grid_client/tests/modules/zmount.test.ts new file mode 100644 index 0000000000..81ee902ba9 --- /dev/null +++ b/packages/grid_client/tests/modules/zmount.test.ts @@ -0,0 +1,58 @@ +import { Zmount } from "../../src"; + +let zmount: Zmount; + +beforeEach(() => { + zmount = new Zmount(); +}); +describe("Zmount module", () => { + test("Zmount instance is of type Zmount.", () => { + expect(zmount).toBeInstanceOf(Zmount); + }); + + test("Min value for size.", () => { + const size = 100 * 1025 ** 2; + + zmount.size = size; + + const result = () => zmount.challenge(); + + expect(result).toThrow(); + }); + + test("Max value for size.", () => { + const size = 100 * 1025 ** 4; + + zmount.size = size; + + const result = () => zmount.challenge(); + + expect(result).toThrow(); + }); + + test("Size doesn't accept decimal value.", () => { + const size = 1.5; + + zmount.size = size; + + const result = () => zmount.challenge(); + + expect(result).toThrow(); + }); + + test("Size empty value.", () => { + const result = () => zmount.challenge(); + + expect(result).toThrow(); + }); + + test("Size negative value.", () => { + const negative_size = -1; + + zmount.size = negative_size; + + const result = () => zmount.challenge(); + + expect(result).toThrow(); + }); +}); From ef86eb50f3122ea160f554a63a5073d149745bc1 Mon Sep 17 00:00:00 2001 From: mayar osama Date: Thu, 6 Jun 2024 15:51:59 +0300 Subject: [PATCH 02/73] Adding planetry ip to all solutions --- packages/playground/src/weblets/tf_algorand.vue | 7 +++---- packages/playground/src/weblets/tf_casperlabs.vue | 4 +++- packages/playground/src/weblets/tf_discourse.vue | 5 +++-- packages/playground/src/weblets/tf_funkwhale.vue | 4 +++- packages/playground/src/weblets/tf_mattermost.vue | 5 +++-- packages/playground/src/weblets/tf_nextcloud.vue | 4 +++- packages/playground/src/weblets/tf_peertube.vue | 5 +++-- packages/playground/src/weblets/tf_staticwebsite.vue | 4 +++- packages/playground/src/weblets/tf_subsquid.vue | 4 +++- packages/playground/src/weblets/tf_taiga.vue | 5 +++-- packages/playground/src/weblets/tf_wordpress.vue | 4 +++- 11 files changed, 33 insertions(+), 18 deletions(-) diff --git a/packages/playground/src/weblets/tf_algorand.vue b/packages/playground/src/weblets/tf_algorand.vue index 3f0cf97b2f..50440698b0 100644 --- a/packages/playground/src/weblets/tf_algorand.vue +++ b/packages/playground/src/weblets/tf_algorand.vue @@ -28,9 +28,7 @@ - - - + ; const memory = ref() as Ref; @@ -173,7 +172,7 @@ async function deploy() { rootFilesystemSize: rootFilesystemSize.value, publicIpv4: ipv4.value, mycelium: mycelium.value, - planetary: true, + planetary: planetary.value, nodeId: selectionDetails.value!.node!.nodeId, rentedBy: dedicated.value ? grid!.twinId : undefined, certified: certified.value, diff --git a/packages/playground/src/weblets/tf_casperlabs.vue b/packages/playground/src/weblets/tf_casperlabs.vue index ad4d996449..bedba6134c 100644 --- a/packages/playground/src/weblets/tf_casperlabs.vue +++ b/packages/playground/src/weblets/tf_casperlabs.vue @@ -37,7 +37,7 @@ :large="{ cpu: 8, memory: 32, disk: 1000 }" /> - + @@ -98,6 +98,7 @@ const dedicated = ref(false); const certified = ref(false); const ipv4 = ref(false); const mycelium = ref(true); +const planetary = ref(false); const rootFilesystemSize = computed(() => rootFs(solution.value?.cpu ?? 0, solution.value?.memory ?? 0)); const selectionDetails = ref(); const selectedSSHKeys = ref(""); @@ -149,6 +150,7 @@ async function deploy() { entryPoint: flist.entryPoint, publicIpv4: ipv4.value, mycelium: mycelium.value, + planetary: planetary.value, envs: [ { key: "SSH_KEY", value: selectedSSHKeys.value }, { key: "CASPERLABS_HOSTNAME", value: domain }, diff --git a/packages/playground/src/weblets/tf_discourse.vue b/packages/playground/src/weblets/tf_discourse.vue index 731433179f..444d8899ca 100644 --- a/packages/playground/src/weblets/tf_discourse.vue +++ b/packages/playground/src/weblets/tf_discourse.vue @@ -58,7 +58,7 @@ :medium="{ cpu: 2, memory: 4, disk: 50 }" :large="{ cpu: 4, memory: 16, disk: 100 }" /> - + @@ -124,6 +124,7 @@ const email = ref(profileManager.profile?.email || ""); const solution = ref() as Ref; const ipv4 = ref(false); const mycelium = ref(true); +const planetary = ref(true); const smtp = ref(createSMTPServer()); const dedicated = ref(false); const certified = ref(false); @@ -181,7 +182,7 @@ async function deploy() { entryPoint: flist.entryPoint, rootFilesystemSize: rootFilesystemSize.value, publicIpv4: ipv4.value, - planetary: true, + planetary: planetary.value, mycelium: mycelium.value, envs: [ { key: "SSH_KEY", value: selectedSSHKeys.value }, diff --git a/packages/playground/src/weblets/tf_funkwhale.vue b/packages/playground/src/weblets/tf_funkwhale.vue index 8d6d62120d..f27fbd36bf 100644 --- a/packages/playground/src/weblets/tf_funkwhale.vue +++ b/packages/playground/src/weblets/tf_funkwhale.vue @@ -89,7 +89,7 @@ :small="{ cpu: 1, memory: 2, disk: 50 }" :medium="{ cpu: 2, memory: 4, disk: 100 }" /> - + @@ -153,6 +153,7 @@ const dedicated = ref(false); const certified = ref(false); const ipv4 = ref(false); const mycelium = ref(true); +const planetary = ref(false); const selectionDetails = ref(); const gridStore = useGrid(); const grid = gridStore.client as GridClient; @@ -207,6 +208,7 @@ async function deploy() { entryPoint: flist.entryPoint, publicIpv4: ipv4.value, mycelium: mycelium.value, + planetary: planetary.value, envs: [ { key: "SSH_KEY", value: selectedSSHKeys.value }, { key: "FUNKWHALE_HOSTNAME", value: domain }, diff --git a/packages/playground/src/weblets/tf_mattermost.vue b/packages/playground/src/weblets/tf_mattermost.vue index 0a8a805d7d..0fb205e970 100644 --- a/packages/playground/src/weblets/tf_mattermost.vue +++ b/packages/playground/src/weblets/tf_mattermost.vue @@ -42,7 +42,7 @@ :medium="{ cpu: 2, memory: 4, disk: 50 }" :large="{ cpu: 4, memory: 16, disk: 100 }" /> - + @@ -106,6 +106,7 @@ const flist: Flist = { const dedicated = ref(false); const certified = ref(false); const ipv4 = ref(false); +const planetary = ref(true); const smtp = ref(createSMTPServer()); const rootFilesystemSize = computed(() => rootFs(solution.value?.cpu ?? 0, solution.value?.memory ?? 0)); const selectionDetails = ref(); @@ -164,7 +165,7 @@ async function deploy() { entryPoint: flist.entryPoint, rootFilesystemSize: rootFilesystemSize.value, publicIpv4: ipv4.value, - planetary: true, + planetary: planetary.value, mycelium: mycelium.value, envs: [ { key: "SSH_KEY", value: selectedSSHKeys.value }, diff --git a/packages/playground/src/weblets/tf_nextcloud.vue b/packages/playground/src/weblets/tf_nextcloud.vue index ac56cd57c1..fe1d29f655 100644 --- a/packages/playground/src/weblets/tf_nextcloud.vue +++ b/packages/playground/src/weblets/tf_nextcloud.vue @@ -36,7 +36,7 @@ :large="{ cpu: 4, memory: 16, disk: 1000 }" v-model="solution" /> - + @@ -97,6 +97,7 @@ const dedicated = ref(false); const certified = ref(false); const ipv4 = ref(false); const mycelium = ref(true); +const planetary = ref(false); const rootFilesystemSize = computed(() => rootFs(solution.value?.cpu ?? 0, solution.value?.memory ?? 0)); const selectionDetails = ref(); const selectedSSHKeys = ref(""); @@ -158,6 +159,7 @@ async function deploy() { flist: flist.value, entryPoint: flist.entryPoint, publicIpv4: ipv4.value, + planetary: planetary.value, mycelium: mycelium.value, envs: [ { key: "SSH_KEY", value: selectedSSHKeys.value }, diff --git a/packages/playground/src/weblets/tf_peertube.vue b/packages/playground/src/weblets/tf_peertube.vue index d891978123..755c91abcc 100644 --- a/packages/playground/src/weblets/tf_peertube.vue +++ b/packages/playground/src/weblets/tf_peertube.vue @@ -63,7 +63,7 @@ - + @@ -126,6 +126,7 @@ const ipv4 = ref(false); const rootFilesystemSize = computed(() => rootFs(solution.value?.cpu ?? 0, solution.value?.memory ?? 0)); const selectionDetails = ref(); const mycelium = ref(true); +const planetary = ref(true); const selectedSSHKeys = ref(""); const gridStore = useGrid(); const grid = gridStore.client as GridClient; @@ -177,7 +178,7 @@ async function deploy() { flist: flist.value, entryPoint: flist.entryPoint, publicIpv4: ipv4.value, - planetary: true, + planetary: planetary.value, mycelium: mycelium.value, envs: [ { key: "SSH_KEY", value: selectedSSHKeys.value }, diff --git a/packages/playground/src/weblets/tf_staticwebsite.vue b/packages/playground/src/weblets/tf_staticwebsite.vue index 2430344b85..5e9afa0b9d 100644 --- a/packages/playground/src/weblets/tf_staticwebsite.vue +++ b/packages/playground/src/weblets/tf_staticwebsite.vue @@ -62,7 +62,7 @@ :medium="{ cpu: 2, memory: 4, disk: 100 }" /> - + ; const flist: Flist = { // Should be upgraded to an oficial Flist @@ -193,6 +194,7 @@ async function deploy() { entryPoint: flist.entryPoint, publicIpv4: ipv4.value, mycelium: mycelium.value, + planetary: planetary.value, envs: [ { key: "SSH_KEY", value: selectedSSHKeys.value }, { key: "GITHUB_URL", value: gitUrl.value }, diff --git a/packages/playground/src/weblets/tf_subsquid.vue b/packages/playground/src/weblets/tf_subsquid.vue index 5fc458e08a..d332b63104 100644 --- a/packages/playground/src/weblets/tf_subsquid.vue +++ b/packages/playground/src/weblets/tf_subsquid.vue @@ -51,7 +51,7 @@ :medium="{ cpu: 2, memory: 4, disk: 100 }" /> - + @@ -104,6 +104,7 @@ const profileManager = useProfileManager(); const name = ref(generateName({ prefix: "ss" })); const endpoint = ref(""); const ipv4 = ref(false); +const planetary = ref(false); const mycelium = ref(true); const solution = ref() as Ref; const flist: Flist = { @@ -168,6 +169,7 @@ async function deploy() { entryPoint: flist.entryPoint, publicIpv4: ipv4.value, mycelium: mycelium.value, + planetary: planetary.value, envs: [ { key: "SSH_KEY", value: selectedSSHKeys.value }, { key: "CHAIN_ENDPOINT", value: endpoint.value }, diff --git a/packages/playground/src/weblets/tf_taiga.vue b/packages/playground/src/weblets/tf_taiga.vue index e85d812a75..f3821870e5 100644 --- a/packages/playground/src/weblets/tf_taiga.vue +++ b/packages/playground/src/weblets/tf_taiga.vue @@ -90,7 +90,7 @@ :small="{ cpu: 2, memory: 4, disk: 100 }" :medium="{ cpu: 4, memory: 8, disk: 150 }" /> - + @@ -161,6 +161,7 @@ const dedicated = ref(false); const certified = ref(false); const ipv4 = ref(false); const mycelium = ref(true); +const planetary = ref(true); const smtp = ref(createSMTPServer()); const rootFilesystemSize = computed(() => rootFs(solution.value?.cpu ?? 0, solution.value?.memory ?? 0)); const selectionDetails = ref(); @@ -218,7 +219,7 @@ async function deploy() { entryPoint: flist.entryPoint, rootFilesystemSize: rootFilesystemSize.value, publicIpv4: ipv4.value, - planetary: true, + planetary: planetary.value, mycelium: mycelium.value, envs: [ { key: "SSH_KEY", value: selectedSSHKeys.value }, diff --git a/packages/playground/src/weblets/tf_wordpress.vue b/packages/playground/src/weblets/tf_wordpress.vue index 8d2ea73c51..6d6e46626f 100644 --- a/packages/playground/src/weblets/tf_wordpress.vue +++ b/packages/playground/src/weblets/tf_wordpress.vue @@ -90,7 +90,7 @@ :large="{ cpu: 4, memory: 16, disk: 100 }" /> - + @@ -154,6 +154,7 @@ const dedicated = ref(false); const certified = ref(false); const ipv4 = ref(false); const mycelium = ref(true); +const planetary = ref(false); const rootFilesystemSize = computed(() => rootFs(solution.value?.cpu ?? 0, solution.value?.memory ?? 0)); const selectionDetails = ref(); const selectedSSHKeys = ref(""); @@ -206,6 +207,7 @@ async function deploy() { entryPoint: flist.entryPoint, publicIpv4: ipv4.value, mycelium: mycelium.value, + planetary: planetary.value, envs: [ { key: "SSH_KEY", value: selectedSSHKeys.value }, { key: "MYSQL_USER", value: username.value }, From 0860e49350852e5adcf553490baea5db17aa8c62 Mon Sep 17 00:00:00 2001 From: zaelgohary Date: Thu, 6 Jun 2024 16:03:38 +0300 Subject: [PATCH 03/73] Add farms alert --- packages/playground/src/dashboard/components/user_farms.vue | 3 +++ packages/playground/src/views/farms.vue | 1 + 2 files changed, 4 insertions(+) diff --git a/packages/playground/src/dashboard/components/user_farms.vue b/packages/playground/src/dashboard/components/user_farms.vue index d1ee5bbaa8..a4afd9d527 100644 --- a/packages/playground/src/dashboard/components/user_farms.vue +++ b/packages/playground/src/dashboard/components/user_farms.vue @@ -10,6 +10,9 @@ Can't see any of your farms? Try changing your key type in your TFChain Wallet above. + + Click on the row to view farm details. + + Click on the row to view farm details. + + + + + + From 52589ace490ce65888b6e85c4654efa204bf0e7e Mon Sep 17 00:00:00 2001 From: zaelgohary Date: Sun, 9 Jun 2024 22:24:35 +0300 Subject: [PATCH 13/73] Fix search your farms --- packages/playground/src/dashboard/components/user_farms.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/playground/src/dashboard/components/user_farms.vue b/packages/playground/src/dashboard/components/user_farms.vue index a4afd9d527..899809636f 100644 --- a/packages/playground/src/dashboard/components/user_farms.vue +++ b/packages/playground/src/dashboard/components/user_farms.vue @@ -226,6 +226,7 @@ export default { twinId, page: page.value, size: pageSize.value, + nameContains: search.value, }); const filteredFarms = filter(data); From ae31f76d2fa18194cffbf36288efd5a913343ed6 Mon Sep 17 00:00:00 2001 From: zaelgohary Date: Sun, 9 Jun 2024 22:31:13 +0300 Subject: [PATCH 14/73] Remove unused code --- .../src/dashboard/components/user_farms.vue | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/packages/playground/src/dashboard/components/user_farms.vue b/packages/playground/src/dashboard/components/user_farms.vue index 899809636f..8fca6b6bf5 100644 --- a/packages/playground/src/dashboard/components/user_farms.vue +++ b/packages/playground/src/dashboard/components/user_farms.vue @@ -203,22 +203,6 @@ export default { const refreshPublicIPs = ref(false); const reloadFarms = debounce(getUserFarms, 20000); - function filter(items: Farm[]) { - const start = (page.value - 1) * pageSize.value; - const end = start + pageSize.value; - - let filteredItems; - if (search.value) { - filteredItems = items.filter( - item => item.name.toLowerCase().includes(search.value!.toLowerCase()) || item.farmId == +search.value!, - ); - } - - const paginated = filteredItems ? filteredItems.slice(start, end) : items; - - return paginated; - } - async function getUserFarms() { try { const { data, count } = await gridProxyClient.farms.list({ @@ -229,9 +213,8 @@ export default { nameContains: search.value, }); - const filteredFarms = filter(data); - farms.value = filteredFarms as unknown as Farm[]; - farmsCount.value = count || filteredFarms.length; + farms.value = data as Farm[]; + farmsCount.value = count || farms.value.length; } catch (error) { console.log(error); createCustomToast("Failed to get user farms!", ToastType.danger); From 62f5da43de395c67fb65638bddff170c27aabb86 Mon Sep 17 00:00:00 2001 From: samaradel Date: Mon, 10 Jun 2024 13:11:58 +0300 Subject: [PATCH 15/73] Fix farm finder table pagination --- packages/playground/src/views/farms.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/playground/src/views/farms.vue b/packages/playground/src/views/farms.vue index 1e2301c207..49c6f3f2db 100644 --- a/packages/playground/src/views/farms.vue +++ b/packages/playground/src/views/farms.vue @@ -89,6 +89,7 @@ { value: 5, title: '5' }, { value: 10, title: '10' }, { value: 15, title: '15' }, + { value: 50, title: '50' }, ]" :items-per-page="size" @update:items-per-page=" From a2b967a61930fc437a45fc9ea45d89f06a33b515 Mon Sep 17 00:00:00 2001 From: samaradel Date: Mon, 10 Jun 2024 14:45:36 +0300 Subject: [PATCH 16/73] Fix profile manager inputs autocomplete --- packages/playground/src/weblets/profile_manager.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/playground/src/weblets/profile_manager.vue b/packages/playground/src/weblets/profile_manager.vue index 5acece2b69..2c36454672 100644 --- a/packages/playground/src/weblets/profile_manager.vue +++ b/packages/playground/src/weblets/profile_manager.vue @@ -153,6 +153,7 @@ }" :disabled="creatingAccount || activatingAccount || activating" @click:append="reloadValidation" + autocomplete="off" > @@ -305,6 +308,7 @@ ...validationProps, }" :disabled="creatingAccount || activatingAccount || activating" + autocomplete="off" /> From d96641b598f37f46a7a1af0cec6438c82b97f7f7 Mon Sep 17 00:00:00 2001 From: mayar osama Date: Mon, 10 Jun 2024 15:21:04 +0300 Subject: [PATCH 17/73] Added a Mine filter in node finder to retrieve nodes rented by me --- packages/playground/src/views/nodes.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/playground/src/views/nodes.vue b/packages/playground/src/views/nodes.vue index 1ef0fe9722..978576f010 100644 --- a/packages/playground/src/views/nodes.vue +++ b/packages/playground/src/views/nodes.vue @@ -41,6 +41,9 @@ + + + (true); @@ -570,6 +574,7 @@ export default { rentable: filters.value.rentable && profileManager.profile ? filters.value.rentable : undefined, availableFor: filters.value.rentable && profileManager.profile ? profileManager.profile.twinId : undefined, hasIPv6: filters.value.ipv6, + rentedBy: filters.value.mine && profileManager.profile ? profileManager.profile.twinId : undefined, }, { loadFarm: true }, ); From d9a3d288d811a28d33ac48c2cf1486624f201c85 Mon Sep 17 00:00:00 2001 From: Thunder Date: Tue, 11 Jun 2024 12:39:18 +0300 Subject: [PATCH 18/73] feat: Enhance the contracts list page and support sorting: (#2950) - The column key was changed from 'farmId' to 'farm_id' to match the field name returned from the grid proxy and to support sorting by it. - A new event emitter was created to sort the contracts based on the 'key' and the 'order'. - A new function called 'sortContracts' was created to sort the contracts of type based on the specified requirements. --- .../contracts_list/contracts_table.vue | 15 +++++- .../src/weblets/tf_contracts_list.vue | 46 +++++++++++++++---- 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/packages/playground/src/components/contracts_list/contracts_table.vue b/packages/playground/src/components/contracts_list/contracts_table.vue index c319801afe..b672823eb0 100644 --- a/packages/playground/src/components/contracts_list/contracts_table.vue +++ b/packages/playground/src/components/contracts_list/contracts_table.vue @@ -25,6 +25,7 @@ show-select @update:page="updatePage" @update:items-per-page="updateSize" + @update:sort-by="updateSortBy" > -