Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add audit-fix #2967

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
80605f3
Add zmount unit tests
zaelgohary Jun 6, 2024
ef86eb5
Adding planetry ip to all solutions
maayarosama Jun 6, 2024
0860e49
Add farms alert
zaelgohary Jun 6, 2024
00611b3
Merge pull request #2902 from threefoldtech/development_2.6_farms_det…
zaelgohary Jun 6, 2024
f7e01b9
Replace v-autocomplete w v-select
zaelgohary Jun 6, 2024
bbbf728
Merge pull request #2901 from threefoldtech/development_2.6_planetary
maayarosama Jun 6, 2024
90a647c
Fix public ip delete btn
samaradel Jun 6, 2024
b433d30
Merge pull request #2905 from threefoldtech/development_2.6_deleteBtn
samaradel Jun 6, 2024
6ff03ea
Merge pull request #2903 from threefoldtech/development_2.6_fix_flist…
zaelgohary Jun 6, 2024
82dc3ad
Merge pull request #2894 from threefoldtech/development_2.6_zmount_tests
zaelgohary Jun 9, 2024
f66c4fe
Adding an alert and a retry button in case of failure of retrieving n…
maayarosama Jun 9, 2024
b90af91
Change memory rules to accept decimals and edit min value
zaelgohary Jun 9, 2024
9c46686
Merge branch 'development' into development_2.6
AhmedHanafy725 Jun 9, 2024
1ed4c1d
Add branch development_2.6 to trigger the workflow
AhmedHanafy725 Jun 9, 2024
9e8bcbd
Merge pull request #2921 from threefoldtech/development_2.6_node_find…
maayarosama Jun 9, 2024
52589ac
Fix search your farms
zaelgohary Jun 9, 2024
ae31f76
Remove unused code
zaelgohary Jun 9, 2024
4392893
Merge pull request #2927 from threefoldtech/development_2.6_memory_rules
zaelgohary Jun 10, 2024
a87b0e7
Merge pull request #2938 from threefoldtech/development_2.6_search_farm
zaelgohary Jun 10, 2024
62f5da4
Fix farm finder table pagination
samaradel Jun 10, 2024
a2b967a
Fix profile manager inputs autocomplete
samaradel Jun 10, 2024
d96641b
Added a Mine filter in node finder to retrieve nodes rented by me
maayarosama Jun 10, 2024
f36b8ff
Merge pull request #2946 from threefoldtech/development_2.6_inputs
samaradel Jun 10, 2024
19da6d3
Merge pull request #2949 from threefoldtech/development_2.6_add__mine…
maayarosama Jun 11, 2024
c8aeac8
Merge pull request #2942 from threefoldtech/development_2.6_farm_finder
samaradel Jun 11, 2024
d9a3d28
feat: Enhance the contracts list page and support sorting: (#2950)
Mahmoud-Emad Jun 11, 2024
ae864d9
Merge branch 'development' into development_2.6
AhmedHanafy725 Jun 11, 2024
4b75cbc
Fix too expensive box flashing
samaradel Jun 11, 2024
b53f20f
Fix nodes last deployment timestamp
samaradel Jun 11, 2024
3fec702
rm script push by mistake
samaradel Jun 11, 2024
5b92ddd
fix check node status condition
samaradel Jun 11, 2024
539dac6
Merge pull request #2957 from threefoldtech/development_2.6_deploymen…
samaradel Jun 11, 2024
ce6cb3b
Merge pull request #2956 from threefoldtech/development_2.6_pricing_c…
samaradel Jun 11, 2024
0d9ac3f
Fix the scroll of the main page when dashboard logger is opened
samaradel Jun 11, 2024
a4f899e
Merge pull request #2959 from threefoldtech/development_2.6_logger
samaradel Jun 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Full Clients Build

on:
push:
branches: [development, development_314]
branches: [development, development_2.6]
pull_request:
branches: [development, development_314]
branches: [development, development_2.6]

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Full Clients Lint

on:
push:
branches: [development, development_314]
branches: [development, development_2.6]
pull_request:
branches: [development, development_314]
branches: [development, development_2.6]

jobs:
lint:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/playground_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:
push:
branches:
- development
- development_314
- development_2.6
paths:
- "packages/playground/**"
pull_request:
branches:
- development
- development_314
- development_2.6
paths:
- "packages/playground/**"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/stats_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ name: Stats Build

on:
push:
branches: [development, development_314]
branches: [development, development_2.6]
paths:
- "packages/stats/**"
pull_request:
branches: [development, development_314]
branches: [development, development_2.6]
paths:
- "packages/stats/**"

Expand Down
58 changes: 58 additions & 0 deletions packages/grid_client/tests/modules/zmount.test.ts
Original file line number Diff line number Diff line change
@@ -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();
});
});
8 changes: 8 additions & 0 deletions packages/playground/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -494,4 +494,12 @@ export default {
.v-theme--dark .v-btn--disabled {
color: #7b7b7b !important;
}
body {
overflow: auto;
height: 100vh;
}

html {
overflow: hidden;
}
</style>
11 changes: 9 additions & 2 deletions packages/playground/src/calculator/pricing_calculator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@
</p>
</input-tooltip>
</div>
<section class="card mt-5" v-if="priceTask.data?.dedicatedPackage.package !== 'gold'">

<section
class="card mt-5"
v-if="!priceTask.loading && priceTask.data?.dedicatedPackage.package !== 'gold'"
>
<p class="card-info pa-2">
<b>Too expensive?</b> can upgrade to <b>Gold package</b> to get discount up to 60% when you fund your
wallet with <b>{{ dedicatedUpgradePrice }}</b> TFT
Expand All @@ -198,7 +202,10 @@
</p>
</input-tooltip>
</div>
<section class="card mt-5 pa-2" v-if="priceTask.data?.sharedPackage.package !== 'gold'">
<section
class="card mt-5 pa-2"
v-if="!priceTask.loading && priceTask.data?.sharedPackage.package !== 'gold'"
>
<p class="card-info">
<b>Too expensive?</b> can upgrade to <b>Gold package</b> to get discount up to 60% when you fund your
wallet with <b>{{ sharedUpgradePrice }}</b> TFT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
show-select
@update:page="updatePage"
@update:items-per-page="updateSize"
@update:sort-by="updateSortBy"
>
<template #[`item.nodeId`]="{ item }">
<span v-if="['node', 'rent'].includes(item.type)">{{ item.details.nodeId }}</span>
Expand All @@ -41,7 +42,7 @@
<p v-else>No Data Available</p>
</template>

<template #[`item.farmId`]="{ item }">
<template #[`item.farm_id`]="{ item }">
<span v-if="['node', 'rent'].includes(item.type)">
{{ item.details.farm_id ? item.details.farm_id : "-" }}
</span>
Expand Down Expand Up @@ -352,7 +353,13 @@ const isNodeInRentContracts = computed(() => {
return false;
});

const emits = defineEmits(["update:deleted-contracts", "update:unlock-contracts", "update:page", "update:size"]);
const emits = defineEmits([
"update:deleted-contracts",
"update:unlock-contracts",
"update:page",
"update:size",
"update:sort",
]);

function updatePage(page: number) {
emits("update:page", page);
Expand All @@ -362,6 +369,10 @@ function updateSize(size: number) {
emits("update:size", size);
}

function updateSortBy(sort: { key: string; order: "asc" | "desc" }[]) {
emits("update:sort", sort);
}

const layout = ref();
const contractLocked = ref<ContractLock>();
const deleting = ref<boolean>(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export default {
}

async function getLastDeploymentTime() {
if (props.node?.id) {
if (props.node?.id && props.node?.status == "up") {
try {
const obj = await gridProxyClient.nodes.statsById(props.node.nodeId);
lastDeploymentTime.value = obj.users.last_deployment_timestamp;
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/src/components/select_vm_image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<input-tooltip
tooltip="A virtual machine (VM) image is a snapshot or template of a virtual machine that contains the necessary components to create and run a virtual instance of an operating system. It includes the operating system, installed applications, configurations, and any additional files or data required for the virtual machine, also you can put your own image/flist by choosing the other option."
>
<v-autocomplete
<v-select
label="VM Image"
:items="[...$props.images, { name: 'Other' }]"
return-object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<v-card-actions class="justify-end mb-1 mr-2">
<v-btn @click="showDialogue = false" color="anchor">Close</v-btn>
<v-btn
text="Confirm"
text="Delete"
:loading="isRemoving"
color="error"
:disabled="isRemoving"
Expand Down
25 changes: 6 additions & 19 deletions packages/playground/src/dashboard/components/user_farms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<v-alert type="warning" variant="tonal" v-if="farmsCount == 0" class="my-8">
Can't see any of your farms? Try changing your key type in your TFChain Wallet above.
</v-alert>
<v-alert type="info" variant="tonal" v-if="farmsCount > 0" class="my-8">
Click on the row to view farm details.
</v-alert>
<v-data-table-server
:loading="loading"
:items-length="farmsCount"
Expand Down Expand Up @@ -200,34 +203,18 @@ 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({
retCount: true,
twinId,
page: page.value,
size: pageSize.value,
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);
Expand Down
4 changes: 2 additions & 2 deletions packages/playground/src/utils/pricing_calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export const nuRules = _applyRules([

export const mruRules = _applyRules([
required("Memory is required."),
min("Minimum allowed Memory size is 1 GB.", 1),
isInt("Memory must be a valid integer."),
min("Minimum allowed Memory size is .5 GB.", 0.5),
isNumeric("Memory must be a valid number."),
max("Maximum allowed memory is 1024 GB.", 1024),
]);

Expand Down
2 changes: 2 additions & 0 deletions packages/playground/src/views/farms.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<view-layout>
<v-alert type="info" variant="tonal" class="mb-6"> Click on the row to view farm details. </v-alert>
<TfFiltersLayout>
<template #filters>
<TfFiltersContainer @apply="loadFarms(true)" class="mb-4" :loading="loading">
Expand Down Expand Up @@ -88,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="
Expand Down
15 changes: 15 additions & 0 deletions packages/playground/src/views/nodes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<TfFilter query-route="ipv6" v-model="filters.ipv6">
<v-switch color="primary" inset label="IPv6" v-model="filters.ipv6" density="compact" hide-details />
</TfFilter>
<TfFilter query-route="mine" v-model="filters.mine" v-if="profileManager.profile">
<v-switch color="primary" inset label="Mine" v-model="filters.mine" density="compact" hide-details />
</TfFilter>

<TfFilter class="mt-4" query-route="node-status" v-model="filters.status">
<v-select
Expand Down Expand Up @@ -413,6 +416,12 @@
<v-row>
<v-col cols="12">
<div class="table">
<VAlert type="error" class="text-body-1 mb-4" v-if="error">
Failed to load Nodes. Please try again!
<template #append>
<VBtn icon="mdi-reload" color="error" variant="plain" density="compact" @click="loadNodes(true)" />
</template>
</VAlert>
<nodes-table
v-model="nodes"
max-height="730px"
Expand Down Expand Up @@ -492,6 +501,7 @@ export default {
setup() {
const profileManager = useProfileManager();
const size = ref(window.env.PAGE_SIZE);
const error = ref(false);
const page = ref(1);
const filters = ref({
nodeId: "",
Expand All @@ -514,6 +524,7 @@ export default {
numGpu: "",
rentable: false,
ipv6: false,
mine: false,
});

const loading = ref<boolean>(true);
Expand All @@ -532,6 +543,7 @@ export default {
async function loadNodes(retCount = false) {
_nodes.value = [];
loading.value = true;
error.value = false;
if (retCount) page.value = 1;
try {
const { count, data } = await requestNodes(
Expand Down Expand Up @@ -562,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 ? filters.value.ipv6 : undefined,
rentedBy: filters.value.mine && profileManager.profile ? profileManager.profile.twinId : undefined,
},
{ loadFarm: true },
);
Expand All @@ -570,6 +583,7 @@ export default {
if (retCount) nodesCount.value = count ?? 0;
} catch (err) {
console.log(err);
error.value = true;
} finally {
loading.value = false;
}
Expand Down Expand Up @@ -615,6 +629,7 @@ export default {
UnifiedNodeStatus,
size,
page,
error,
loadNodes,
};
},
Expand Down
4 changes: 4 additions & 0 deletions packages/playground/src/weblets/profile_manager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
}"
:disabled="creatingAccount || activatingAccount || activating"
@click:append="reloadValidation"
autocomplete="off"
>
<template v-slot:prepend-inner v-if="validationProps.hint || validationProps.error">
<v-icon :color="validationProps.error ? 'red' : 'green'">
Expand Down Expand Up @@ -257,6 +258,7 @@
v-model="email"
v-bind="props"
:disabled="creatingAccount || activatingAccount || activating"
autocomplete="off"
/>
</input-validator>

Expand All @@ -283,6 +285,7 @@
v-model="password"
v-bind="{ ...passwordInputProps, ...validationProps }"
:disabled="creatingAccount || activatingAccount || activating"
autocomplete="off"
/>
</div>
</template>
Expand All @@ -305,6 +308,7 @@
...validationProps,
}"
:disabled="creatingAccount || activatingAccount || activating"
autocomplete="off"
/>
</InputValidator>
</PasswordInputWrapper>
Expand Down
Loading
Loading