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 rentableOrRentedBy query in dedicated filter #3740

Draft
wants to merge 4 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ on:
push:
branches:
- development
- development_2.7

pull_request:
branches:
- development
- development_2.7

jobs:
build:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ on:
push:
branches:
- development
- development_2.7
pull_request:
branches:
- development
- development_2.7

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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/playground_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
branches:
- development
- development_313
- development_2.7
paths:
- "packages/playground/**"
workflow_dispatch:
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_2.6]
branches: [development, development_2.7]
paths:
- "packages/stats/**"
pull_request:
branches: [development, development_2.6]
branches: [development, development_2.7]
paths:
- "packages/stats/**"

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/threefold_ui_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ on:
push:
branches:
- development
- development_2.7
paths:
- "packages/UI/**"
pull_request:
branches:
- development
- development_2.7
paths:
- "packages/UI/**"

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/yarn_audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ on:
push:
branches:
- development
- development_2.7
pull_request:
branches:
- development
- development_2.7

jobs:
audit-and-open-issue:
Expand Down
13 changes: 13 additions & 0 deletions packages/grid_client/src/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ function formatErrorMessage(prefix: string, error: Error) {
return `${prefix}\n\t ${error.message}`;
}

/**
* Generates a random hexadecimal seed of a specified length.
*
* This function uses the `crypto` module to generate a sequence of random bytes,
* which are then converted to a hexadecimal string representation. The length of
* the output string will be twice the specified byte length, as each byte is
* represented by two hexadecimal characters.
*
* @param {number} length - The number of random bytes to generate. The resulting
* hexadecimal string will be 2 * length characters long.
* @returns {string} A random hexadecimal string of the specified length.
*/

function generateRandomHexSeed(length: number) {
const bytes = crypto.randomBytes(length);
return bytes.toString("hex");
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/src/modules/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ class FilterOptions {
@Expose() @IsOptional() @Transform(({ value }) => NodeStatus[value]) @IsEnum(NodeStatus) status?: NodeStatus;
@Expose() @IsOptional() @IsString() region?: string;
@Expose() @IsOptional() @IsBoolean() healthy?: boolean;
@Expose() @IsOptional() @IsInt() rentableOrRentedBy?: number;
}

enum CertificationType {
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/src/primitives/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ class Nodes {
healthy: options.healthy,
sort_by: SortBy.FreeCRU,
sort_order: SortOrder.Desc,
rentable_or_rented_by: options.rentableOrRentedBy,
};

if (options.gateway) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@
>
<span>Filters</span>
<VSpacer />
<VBtn
variant="outlined"
:disabled="loading || !valid || empty"
@click.stop="clear"
text="Clear"
density="compact"
/>
<VBtn variant="outlined" :disabled="loading || empty" @click.stop="clear" text="Clear" density="compact" />
<VBtn
variant="outlined"
color="secondary"
Expand Down
1 change: 0 additions & 1 deletion packages/playground/src/components/smtp_server.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
placeholder="[email protected]"
v-model="$props.modelValue.email"
v-bind="props"
autofocus
/>
</input-tooltip>
</input-validator>
Expand Down
1 change: 1 addition & 0 deletions packages/playground/src/types/nodeSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface SelectionDetailsFilters {
certified?: boolean;
dedicated?: boolean;
exclusiveFor?: string;
rentable_or_rented_by?: number;
}

export interface NumericValidator {
Expand Down
3 changes: 1 addition & 2 deletions packages/playground/src/utils/nodeSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,12 @@ export function normalizeNodeFilters(
publicIPs: filters.ipv4 || undefined,
hasIPv6: filters.ipv6 || undefined,
hasGPU: filters.hasGPU || undefined,
rentedBy: filters.dedicated ? options.twinId : undefined,
certified: filters.certified || undefined,
availableFor: options.twinId,
region: options.location.region ? options.location.region : options.location.subregion,
country: options.location.country,
gateway: options.gateway,
healthy: true,
rentableOrRentedBy: filters.dedicated ? options.twinId : undefined,
};
}

Expand Down
Loading