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 portal/farms #1154

Merged
merged 67 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
55d72fe
Add createFarm in chain & client
zaelgohary Sep 26, 2023
7700478
Add farms page layout & route
zaelgohary Sep 26, 2023
8892985
Add getUserFarms
zaelgohary Sep 26, 2023
153d4c5
Implement addFarmIP, removeFarmIP, addPublicConfig, addStellarAddress…
zaelgohary Sep 26, 2023
63ba81b
Create grid store & set it in profile store
zaelgohary Sep 27, 2023
21b5a0c
add getUserNodes
zaelgohary Sep 28, 2023
56de559
Merge branch 'development_313' of https://github.com/threefoldtech/tf…
zaelgohary Sep 30, 2023
0df9c28
Render farm tables, route component if grid is set
zaelgohary Sep 30, 2023
395bb29
Fix expand tables, add public ips table
zaelgohary Oct 1, 2023
94aaa2f
Remove getUserNodes
zaelgohary Oct 3, 2023
bb05a53
Create add ip, create farm & public ips table. Edit user farms.
zaelgohary Oct 4, 2023
f5a46dd
Add get-ip-range package
zaelgohary Oct 4, 2023
7ac9495
Merge branch 'development_313' of https://github.com/threefoldtech/tf…
zaelgohary Oct 4, 2023
fdf0943
fix add ip
zaelgohary Oct 8, 2023
f2899c1
Merge branch 'development_313' of https://github.com/threefoldtech/tf…
zaelgohary Oct 9, 2023
3c8e128
Merge branch 'development_313' of https://github.com/threefoldtech/tf…
zaelgohary Oct 10, 2023
25efb3f
Add custom toast, fix add & delete IP
zaelgohary Oct 10, 2023
0d583a3
Add farm actions, fix addStellarAddress
zaelgohary Oct 11, 2023
ffcff15
Merge branch 'development_313' of https://github.com/threefoldtech/tf…
zaelgohary Oct 11, 2023
3954cb1
Add node details
zaelgohary Oct 11, 2023
7606321
Edit addConfig, add public config & set extra fees components
zaelgohary Oct 15, 2023
143a7ee
Fix node uptime
zaelgohary Oct 15, 2023
a44c442
Fix uptime type in node.ts
zaelgohary Oct 15, 2023
97abafc
Fix expanded in user nodes, Fix minting details
zaelgohary Oct 17, 2023
3c80ec0
Merge branch 'development_313' of https://github.com/threefoldtech/tf…
zaelgohary Oct 19, 2023
fbfe834
Fix reciept uptime
zaelgohary Oct 19, 2023
d6fb97c
Fix farms table expand, change its return type. Fix public ips values
zaelgohary Oct 19, 2023
5f09d95
Fix typo, edit farm details styling
zaelgohary Oct 19, 2023
5cf78ed
edit remove ip dialogue
zaelgohary Oct 19, 2023
6945928
Add IP validation, fix range, emit add & remove ip
zaelgohary Oct 19, 2023
1a9f880
Merge branch 'development_313' of https://github.com/threefoldtech/tf…
zaelgohary Oct 19, 2023
f467285
Fix tables
zaelgohary Oct 22, 2023
b23ffd9
EDit public cofig validation, add btns loading, edit props & addConfi…
zaelgohary Oct 22, 2023
1a92ab2
Use server side farms table, unify dialogue style, use node details, …
zaelgohary Oct 23, 2023
18c932e
Merge branch 'development_313' of https://github.com/threefoldtech/tf…
zaelgohary Oct 23, 2023
41b4ea9
Fix search farm, disable sorting, edit farms table to be server side
zaelgohary Oct 24, 2023
baee723
Resolving comments
zaelgohary Oct 30, 2023
daac875
Merge branch 'development_313' of https://github.com/threefoldtech/tf…
zaelgohary Oct 30, 2023
ee03068
Resolving comments
zaelgohary Oct 31, 2023
06ccf03
Seperating global css.
zaelgohary Oct 31, 2023
f78768c
Unify dialogue styles
zaelgohary Oct 31, 2023
fcff78c
Fixed prop types, fixed validation,
zaelgohary Oct 31, 2023
1427f11
edited public config prop type & fixed its validation.
zaelgohary Nov 1, 2023
3ddd599
Update stellar once its set
zaelgohary Nov 1, 2023
e13c77b
Added info toast once stellar is added. reload table once updated.
zaelgohary Nov 2, 2023
dfa5e65
Check for nodes before setting uptime, add button loading
zaelgohary Nov 5, 2023
3d9dc0d
Add tooltip tp add_ip inputs
zaelgohary Nov 5, 2023
055d284
Merge branches 'development_313_portal_farms' and 'development_313' o…
zaelgohary Nov 5, 2023
cb6cfde
Check balance before extrinsics, fix types in grid & chain
zaelgohary Nov 6, 2023
2d345fa
Update farms table on create farm, add loading to create btn
zaelgohary Nov 6, 2023
78d6d58
Add patchExtrinsic return type, fix config types
zaelgohary Nov 6, 2023
839b8d1
fix farm name validation, add toast on error, fix status color
zaelgohary Nov 6, 2023
2a5603f
Edit min extra fee, change expansion title color
zaelgohary Nov 6, 2023
43fe046
Edit extra fee decorators, fix delete ip dialogue
zaelgohary Nov 7, 2023
ff6506f
Fix delete ip, fix return farm type, refactor node.ts
zaelgohary Nov 7, 2023
ce0e6be
Fix add IP range, fix table update
zaelgohary Nov 7, 2023
8181338
Fix removePublicConfig, relax config validation in client, fix IPubli…
zaelgohary Nov 8, 2023
f6b7765
Edit public config validation
zaelgohary Nov 9, 2023
4c02991
Add farm minting receipts, fix node uptime
zaelgohary Nov 9, 2023
7e51be6
Edit public config validation
zaelgohary Nov 9, 2023
6a1e55f
resolving comments
zaelgohary Nov 13, 2023
624f249
Replace batch w batchAll in add ip
zaelgohary Nov 13, 2023
a99e2bf
Fix public config null error, retrive contractId in PublicIP type and…
zaelgohary Nov 13, 2023
93f28f7
Fix add/remove config
zaelgohary Nov 13, 2023
04444d7
Update config pop up on add/remove
zaelgohary Nov 14, 2023
b997ffc
Merge branch 'development_313' of https://github.com/threefoldtech/tf…
zaelgohary Nov 15, 2023
e412359
Edit addIP request on range
zaelgohary Nov 16, 2023
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
37 changes: 36 additions & 1 deletion packages/grid_client/src/modules/farms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import { TFClient } from "../clients/tf-grid/client";
import { GridClientConfig } from "../config";
import { expose } from "../helpers/expose";
import { validateInput } from "../helpers/validator";
import { FarmIdModel } from "./models";
import {
AddFarmIPModel,
AddStellarAddressToFarmModel,
CreateFarmModel,
FarmIdModel,
RemoveFarmIPModel,
} from "./models";
import { checkBalance } from "./utils";

class Farms {
client: TFClient;
Expand All @@ -11,6 +18,34 @@ class Farms {
this.client = config.tfclient;
}

@expose
@validateInput
zaelgohary marked this conversation as resolved.
Show resolved Hide resolved
@checkBalance
async create(options: CreateFarmModel) {
return (await this.client.farms.create(options)).apply();
}

@expose
@validateInput
zaelgohary marked this conversation as resolved.
Show resolved Hide resolved
@checkBalance
async addFarmIp(options: AddFarmIPModel) {
return (await this.client.farms.addFarmIp(options)).apply();
}

@expose
@validateInput
zaelgohary marked this conversation as resolved.
Show resolved Hide resolved
@checkBalance
async removeFarmIp(options: RemoveFarmIPModel) {
return (await this.client.farms.removeFarmIp(options)).apply();
}

@expose
@validateInput
zaelgohary marked this conversation as resolved.
Show resolved Hide resolved
@checkBalance
async addStellarAddress(options: AddStellarAddressToFarmModel) {
return (await this.client.farms.addStellarAddress(options)).apply();
}

@expose
@validateInput
async getFarmByID(options: FarmIdModel) {
Expand Down
52 changes: 51 additions & 1 deletion packages/grid_client/src/modules/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,51 @@ class FarmIdModel {
@Expose() @IsInt() @IsNotEmpty() @Min(1) id: number;
}

class FarmPublicIPsModel {
@Expose() @IsNotEmpty() @IsIP() ip: string;
@Expose() @IsNotEmpty() @IsString() gw: string;
}

class AddFarmIPModel {
@Expose() @IsInt() @IsNotEmpty() @Min(1) farmId: number;
@Expose() @IsNotEmpty() @IsString() ip: string;
@Expose() @IsNotEmpty() @IsIP() gw: string;
}

class IPConfig {
@Expose() @IsNotEmpty() @IsString() ip: string;
@Expose() @IsNotEmpty() @IsIP() gw: string;
}
class PublicConfigModel {
@Expose() @IsNotEmpty() @Type(() => IPConfig) @ValidateNested() ip4: IPConfig;
@Expose() @IsOptional() ip6: IPConfig | null;
@Expose() @IsOptional() @IsString() domain: string | null;
}
class AddPublicConfig {
@Expose() @IsInt() @IsNotEmpty() @Min(1) farmId: number;
@Expose() @IsInt() @IsNotEmpty() @Min(1) nodeId: number;
@Expose() @IsOptional() @Type(() => PublicConfigModel) @ValidateNested() publicConfig?: PublicConfigModel | null;
}

class RemoveFarmIPModel {
@Expose() @IsInt() @IsNotEmpty() @Min(1) farmId: number;
@Expose() @IsNotEmpty() @IsString() ip: string;
}

class AddStellarAddressToFarmModel {
@Expose() @IsInt() @IsNotEmpty() @Min(1) farmId: number;
@Expose() @IsString() @IsNotEmpty() stellarAddress: string;
}

class CreateFarmModel {
@Expose() @IsString() @IsNotEmpty() @MaxLength(NameLength) name: string;
@Expose()
@IsOptional()
@Type(() => FarmPublicIPsModel)
@ValidateNested({ each: true })
publicIps?: FarmPublicIPsModel[];
}

class pingFarmModel {
@Expose() @IsInt() @IsNotEmpty() @Min(1) farmId: number;
}
Expand All @@ -682,7 +727,7 @@ class NetworkGetModel {

class SetDedicatedNodeExtraFeesModel {
@Expose() @IsInt() @IsNotEmpty() @Min(1) nodeId: number;
@Expose() @IsInt() @IsNotEmpty() @Min(1) extraFee: number;
@Expose() @IsNumber() @IsNotEmpty() @Min(0) extraFee: number;
}

class GetDedicatedNodePriceModel {
Expand Down Expand Up @@ -812,6 +857,7 @@ export {
ZOSNodeModel,
NodePowerModel,
FarmIdModel,
CreateFarmModel,
pingFarmModel,
CreateServiceContractModel,
ServiceContractApproveModel,
Expand All @@ -828,5 +874,9 @@ export {
GetDedicatedNodePriceModel,
SwapToStellarModel,
ListenToMintCompletedModel,
AddFarmIPModel,
RemoveFarmIPModel,
AddStellarAddressToFarmModel,
AddPublicConfig,
GetActiveContractsModel,
};
8 changes: 8 additions & 0 deletions packages/grid_client/src/modules/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { events, validateInput } from "../helpers";
import { expose } from "../helpers/expose";
import { capacity } from "./capacity";
import {
AddPublicConfig,
FilterOptions,
NodeGetModel,
NodePowerModel,
Expand Down Expand Up @@ -82,6 +83,13 @@ class Nodes {
return (await this.client.nodes.setPower(options)).apply();
}

@expose
@validateInput
@checkBalance
async addNodePublicConfig(options: AddPublicConfig) {
return (await this.client.nodes.addNodePublicConfig(options)).apply();
}

@expose
async all() {
return await this.capacity.getAllNodes();
Expand Down
1 change: 1 addition & 0 deletions packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"vue-router": "^4.1.6",
"vuetify": "^3.1.15",
"web-ssh-keygen": "^0.1.2",
"get-ip-range": "^4.0.1",
"chart.js": "^4.4.0",
"vue-chartjs": "^5.2.0",
"moment": "^2.29.4"
Expand Down
127 changes: 4 additions & 123 deletions packages/playground/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
<router-view v-slot="{ Component }">
<transition name="fade">
<div :key="$route.path">
<component :is="Component" v-if="hasActiveProfile"></component>
<component :is="Component" v-if="hasActiveProfile && hasGrid"></component>
<ConnectWalletLanding @openProfile="openProfile = true" v-else />
</div>
</transition>
Expand All @@ -179,13 +179,15 @@ import { useProfileManager } from "./stores/profile_manager";
const $route = useRoute();
const $router = useRouter();
const profileManager = useProfileManager();
const gridStore = useGrid();
const network = process.env.NETWORK || (window as any).env.NETWORK;

const openProfile = ref(true);
const hasActiveProfile = computed(() => !!profileManager.profile);
const theme = useTheme();
const navbarConfig = ref();

const hasGrid = computed(() => !!gridStore.grid);
watch(
() => $route.meta,
meta => {
Expand Down Expand Up @@ -373,6 +375,7 @@ import FundsCard from "./components/funds_card.vue";
import ProfileManagerController from "./components/profile_manager_controller.vue";
import TftSwapPrice from "./components/swap_price.vue";
import TFNotification from "./components/tf_notification.vue";
import { useGrid } from "./stores";
import ProfileManager from "./weblets/profile_manager.vue";

interface AppRoute {
Expand Down Expand Up @@ -404,125 +407,3 @@ export default {
},
};
</script>

<style lang="scss" global>
:root {
--link-color: #5695ff;
}

.app-link {
text-decoration: none;
font-weight: bold;
color: var(--link-color);
cursor: pointer;
}

.fade-leave-active,
.fade-enter-active {
position: absolute;
top: 0;
left: 0;
width: 100%;
pointer-events: none;

transition: opacity 1s;
}

.fade-enter-from,
.fade-leave-to {
opacity: 0;
}

.capitalize {
text-transform: capitalize !important;
}

.v-btn {
text-transform: capitalize !important;
font-size: 1rem !important;
}

.version {
position: absolute;
bottom: 15px;
right: 25px;
}

.v-tooltip > .v-overlay__content {
// background: var(--v-theme-surface);
border-color: rgba(var(--v-border-color), var(--v-border-opacity)) !important;
border-width: thin !important;
border-style: solid !important;
z-index: 99;
background-color: rgb(var(--v-theme-background));
color: var(--v-theme-text);
font-weight: 900;
}

a {
color: #5695ff !important;
}

.v-list-item__prepend {
width: 35px !important;
}

.v-list-item-title {
font-size: 0.875rem;
}

.v-list-item--density-default.v-list-item--one-line {
min-height: 40px;
}

.custom-toolbar-title {
max-width: 17rem !important;
}
.mosha__toast__content-wrapper {
margin-bottom: -2px;
}
.mosha__toast__slot-wrapper {
margin-bottom: -2px;
}
.mosha__icon {
margin-right: 6px !important;
margin-top: 2px;
}

.mosha__icon__dark__warning {
fill: #5d5d5d !important;
}

.mosha__icon__light__warning {
fill: #5d5d5d !important;
}

.mosha__toast__content.dark__warning {
color: #5d5d5d;
}

.mosha__toast__content.light__warning {
color: #5d5d5d;
}

.mosha__toast__close-icon.dark__warning::before {
color: #5d5d5d !important;
}

.mosha__toast__close-icon.light__warning::before {
color: #5d5d5d !important;
}

.mosha__toast {
font-size: 14px !important;
font-weight: 600 !important;
}

.font-14 {
font-size: 14px !important;
}

.v-breadcrumbs-item--disabled {
opacity: 1;
}
</style>
Loading