-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update public ip table with vuetify server side table #3946
Open
samaradel
wants to merge
10
commits into
development
Choose a base branch
from
development_publicIPs_table
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
72a3b82
Add Server side table to public ip table
samaradel 6dbd290
Update dashboard with public ips comes from gridproxy
samaradel b8eb83d
Fix contract_id in the public ips table
samaradel ba97c0f
Fix type
samaradel f96a0c6
Fix pagination
samaradel 2856845
Limit retcount request
samaradel c57c704
Add retcount param on watch function
samaradel 6e84899
Update Adding IP toast
samaradel 7b73b6c
Set timeout for getting farm IP
samaradel d967228
Fix pagination
samaradel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { assertBoolean, assertId, assertNatural, assertString } from "../utils"; | ||
import { AbstractBuilder, BuilderMapper, BuilderMethods, BuilderValidator } from "./abstract_builder"; | ||
import { SortBy, SortOrder } from "./nodes"; | ||
|
||
export interface PublicIpQuery { | ||
page: number; | ||
size: number; | ||
retCount: boolean; | ||
randomize: boolean; | ||
sortBy: SortBy; | ||
sortOrder: SortOrder; | ||
farmIds: number; | ||
ip: string; | ||
gateway: string; | ||
free: boolean; | ||
} | ||
|
||
const PUBLICIPS_MAPPER: BuilderMapper<PublicIpQuery> = { | ||
page: "page", | ||
size: "size", | ||
retCount: "ret_count", | ||
randomize: "randomize", | ||
sortBy: "sort_by", | ||
sortOrder: "sort_order", | ||
farmIds: "farm_ids", | ||
ip: "ip", | ||
gateway: "gateway", | ||
free: "free", | ||
}; | ||
|
||
const PUBLICIPS_VALIDATOR: BuilderValidator<PublicIpQuery> = { | ||
page: assertNatural, | ||
size: assertNatural, | ||
retCount: assertBoolean, | ||
randomize: assertBoolean, | ||
sortBy: assertString, | ||
sortOrder: assertString, | ||
farmIds: assertId, | ||
ip: assertString, | ||
gateway: assertString, | ||
free: assertBoolean, | ||
}; | ||
|
||
export class PublicIpBuilder extends AbstractBuilder<PublicIpQuery> { | ||
constructor(public uri: string, queries: Partial<PublicIpQuery> = {}) { | ||
super({ | ||
mapper: PUBLICIPS_MAPPER, | ||
validator: PUBLICIPS_VALIDATOR, | ||
queries, | ||
}); | ||
} | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface PublicIpBuilder extends BuilderMethods<PublicIpQuery, PublicIpBuilder> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import type { Pagination } from "../builders/abstract_builder"; | ||
import { PublicIpBuilder, PublicIpQuery } from "../builders/public_api"; | ||
import { resolvePaginator } from "../utils"; | ||
import { AbstractClient } from "./abstract_client"; | ||
import { PublicIp } from "./farms"; | ||
|
||
export class PublicIpsClient extends AbstractClient<PublicIpBuilder, PublicIpQuery> { | ||
constructor(uri: string) { | ||
super({ | ||
uri, | ||
Builder: PublicIpBuilder, | ||
}); | ||
} | ||
|
||
public async list(queries: Partial<PublicIpQuery> = {}) { | ||
const res = await this.builder(queries).build("/public_ips"); | ||
return resolvePaginator<PublicIp[]>(res); | ||
} | ||
|
||
public async listAll(queries: Partial<PublicIpQuery> = {}) { | ||
const { count } = await this.list({ | ||
...queries, | ||
size: 50, | ||
page: 1, | ||
retCount: true, | ||
}); | ||
const promises: Promise<Pagination<PublicIp[]>>[] = []; | ||
const pages = Math.ceil(count! / 50); | ||
for (let i = 0; i < pages; i++) { | ||
promises.push(this.list({ ...queries, size: 50, page: i + 1 })); | ||
} | ||
const publicIps = await Promise.all(promises); | ||
return publicIps.map(node => node.data).flat(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after changing the counts to 5 it is not changed and stay at 10