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

feat: provider deployments on provider console #416

Draft
wants to merge 42 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
ebe6471
added server-access and server-form files
jigar-arc10 Aug 22, 2024
6342ed9
added wallet import page - wip, fixed issue with file upload in serve…
jigar-arc10 Aug 23, 2024
7f89ed8
added become-provider steps ui
jigar-arc10 Aug 29, 2024
58055d7
server access step added with state support
jigar-arc10 Sep 18, 2024
192d116
added provider config and provider attribute screen
jigar-arc10 Sep 19, 2024
da07743
added provider process with hoc to prevent access to pages
jigar-arc10 Oct 7, 2024
329e06c
added progress for becoming prvider for final stage
jigar-arc10 Oct 8, 2024
51e5ef0
Code clean up and added navigation logic to homecontainer
jigar-arc10 Oct 10, 2024
c977e2e
package lock updated
jigar-arc10 Oct 10, 2024
66d0f11
fixed package-lock.json merge issue
jigar-arc10 Oct 10, 2024
25ed729
more cleanup and remove general warnings
jigar-arc10 Oct 10, 2024
897066e
removed unused npm package
jigar-arc10 Oct 10, 2024
aefe70b
fix minor error on api
jigar-arc10 Oct 11, 2024
8e5eb6a
Added dashboard and actions page
jigar-arc10 Oct 11, 2024
ea30723
change status api endpoint
jigar-arc10 Oct 11, 2024
d024c0d
Merge branch 'feature/provider-console/become-provider-process' into …
jigar-arc10 Oct 11, 2024
ead4eac
added stat line and pie charts
jigar-arc10 Oct 11, 2024
f5c243f
Added console apis to get dashboard data and show appropriate details
jigar-arc10 Oct 11, 2024
4472dbd
fixed actions and changed home component
jigar-arc10 Oct 12, 2024
8df762a
token varification and refresh token fix
jigar-arc10 Oct 15, 2024
d4288b3
changed wallet connect from wallet status to wallet provider
jigar-arc10 Oct 15, 2024
6e8b289
fixed issue in loading provider status
jigar-arc10 Oct 16, 2024
44934ae
fixed home loading issue
jigar-arc10 Oct 16, 2024
d91d340
fixed refresh token, added disabled menu items
jigar-arc10 Oct 16, 2024
fd62ae2
fixed build process
jigar-arc10 Oct 16, 2024
3276a95
feat(provider): added sentry and docker
jigar-arc10 Oct 17, 2024
8f123e1
fix(provider): fixed wallet switching and getting status
jigar-arc10 Oct 18, 2024
5fa9f63
feat(provider): reduced number of events in dashboard
jigar-arc10 Oct 18, 2024
2b0d5e0
feat(provider): added docker compose changes for provider-console
jigar-arc10 Oct 18, 2024
781a99c
feat(provider): added deployments and deployment detail page
jigar-arc10 Oct 18, 2024
ee5d564
fix(provider): change hours to seconds for calculation purpose)
jigar-arc10 Oct 18, 2024
7057434
feat(provider): added auth for deployments and deployment details page
jigar-arc10 Oct 18, 2024
8648e13
feat(provider): added env and removed settingsprovider
jigar-arc10 Oct 29, 2024
f1637fd
fix(provider): fix lint errors and removed console.logs
jigar-arc10 Oct 29, 2024
614c4ba
fix(provider): become-provider looped, fixed it
jigar-arc10 Oct 30, 2024
5d08b82
fix(provider): router and reset process fixed
jigar-arc10 Oct 30, 2024
1110b35
fix(provider): removed Get Started button for now
jigar-arc10 Oct 30, 2024
f2696bf
fix(provider): removed unused import in nav
jigar-arc10 Oct 30, 2024
7344be9
fix(provider): change functions to react fc component
jigar-arc10 Oct 30, 2024
7f9da2b
fix(provider): fix lint issues
jigar-arc10 Oct 30, 2024
c9df37a
fix(provider): change functions to react fc component
jigar-arc10 Oct 31, 2024
1f2d277
fix(provider): rebased main
jigar-arc10 Oct 31, 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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,7 @@ apps/stats-web/.env
# Data Folder
data
testdata
test-results
test-results

# macos
.DS_Store
7 changes: 7 additions & 0 deletions apps/provider-console/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
.git
Empty file.
18 changes: 16 additions & 2 deletions apps/provider-console/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/** @type {import('next').NextConfig} */

const { withSentryConfig } = require("@sentry/nextjs");
const nextConfig = {
reactStrictMode: false,
compiler: {
Expand Down Expand Up @@ -31,8 +33,20 @@ const nextConfig = {
});
config.externals.push("pino-pretty");
return config;
},
}
};

module.exports = nextConfig;
// Sentry webpack plugin configuration
const sentryWebpackPluginOptions = {
silent: true, // Suppresses all logs
dryRun: process.env.NODE_ENV !== 'production', // Only upload source maps in production
release: require("./package.json").version,
// Add Sentry auth token only for production builds
authToken: process.env.NODE_ENV === 'production' ? process.env.SENTRY_AUTH_TOKEN : undefined,
};
ygrishajev marked this conversation as resolved.
Show resolved Hide resolved

// Wrap nextConfig with Sentry configuration
module.exports = withSentryConfig(
nextConfig,
sentryWebpackPluginOptions
);
33 changes: 33 additions & 0 deletions apps/provider-console/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# nginx.conf

events {
}

http {
server {
# Redirect HTTP requests to HTTPS.
jigar-arc10 marked this conversation as resolved.
Show resolved Hide resolved
listen 80;
return 307 https://$host$request_uri;
}

server {
listen 443 ssl;

server_tokens off;

ssl_certificate /etc/nginx/ssl/my_ssl_cert.crt;
ssl_certificate_key /etc/nginx/ssl/my_ssl_key.key;

location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://127.0.0.1:3000;
proxy_buffers 8 16k;
proxy_buffer_size 16k;
proxy_cookie_path / "/; HTTPOnly; Secure";
}
}
}
29 changes: 27 additions & 2 deletions apps/provider-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,47 @@
},
"dependencies": {
"@akashnetwork/ui": "*",
"@chain-registry/types": "^0.50.1",
"@cosmos-kit/cosmostation-extension": "^2.12.2",
"@cosmos-kit/keplr": "^2.12.2",
"@cosmos-kit/leap-extension": "^2.12.2",
"@cosmos-kit/react": "^2.18.0",
"@hookform/resolvers": "^3.9.0",
"@sentry/nextjs": "^8.34.0",
"@sentry/tracing": "^7.114.0",
"@types/recharts": "^1.8.29",
"apexcharts": "^3.54.0",
"chain-registry": "^1.69.3",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"iconoir-react": "^7.9.0",
"jotai": "^2.9.0",
"jsencrypt": "^3.3.2",
"jwt-decode": "^4.0.0",
"lucide-react": "^0.395.0",
"next": "14.2.4",
"next": "^14.2.15",
"react": "^18",
"react-apexcharts": "^1.4.1",
"react-dom": "^18",
"react-hook-form": "^7.52.2",
"react-query": "^3.39.3",
"recharts": "^2.13.0",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7",
"ts-loader": "^9.5.1"
"ts-loader": "^9.5.1",
"zod": "^3.23.8",
"react-intl": "^6.4.2",
"next-themes": "^0.2.1",
"react-icons": "^5.0.1",
"react-error-boundary": "^3.1.4",
"@mui/icons-material": "^5.11.11",
"@mui/material": "^5.4.4",
"@mui/material-nextjs": "^5.15.11",
"usehooks-ts": "^2.9.1",
"geist": "^1.3.0",
"date-fns": "^2.29.3",
"@radix-ui/react-icons": "^1.3.0",
"postcss-nesting": "^12.0.2"
},
"devDependencies": {
"@akashnetwork/dev-config": "*",
Expand Down
18 changes: 18 additions & 0 deletions apps/provider-console/sentry.client.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as Sentry from "@sentry/nextjs";

console.log(process.env.SENTRY_AUTH_TOKEN);
jigar-arc10 marked this conversation as resolved.
Show resolved Hide resolved

Sentry.init({
dsn: "https://[email protected]/2",
jigar-arc10 marked this conversation as resolved.
Show resolved Hide resolved
enabled: process.env.NODE_ENV !== 'development', // Disable Sentry on localhost
jigar-arc10 marked this conversation as resolved.
Show resolved Hide resolved
integrations: [Sentry.replayIntegration()],
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0
});

const originalConsoleError = console.error;

console.error = (...args) => {
jigar-arc10 marked this conversation as resolved.
Show resolved Hide resolved
Sentry.captureMessage(args.join(" "), "error");
originalConsoleError(...args);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
"use client";
import {
Button,
FormControl,
FormField,
FormItem,
FormMessage,
Input,
Separator,
Select,
SelectItem,
SelectTrigger,
SelectContent,
Form
} from "@akashnetwork/ui/components";
import React from "react";
import { useForm, useFieldArray, Controller, SubmitHandler } from "react-hook-form";
import { PlusIcon, TrashIcon } from "lucide-react";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
import { providerAttributesFormValuesSchema } from "../../types/providerAttributes";
import { useAtom } from "jotai";
import providerProcessStore from "@src/store/providerProcessStore";
import ResetProviderForm from "./ResetProviderProcess";
ygrishajev marked this conversation as resolved.
Show resolved Hide resolved

// Extract keys from providerAttributesFormValuesSchema
jigar-arc10 marked this conversation as resolved.
Show resolved Hide resolved
const attributeKeys = Object.keys(providerAttributesFormValuesSchema.shape);

interface ProviderAttributesProps {
stepChange: () => void;
}

const providerFormSchema = z.object({
attributes: z.array(
z.object({
key: z.string().min(1, "Key is required"),
value: z.string().min(1, "Value is required"),
customKey: z.string().optional()
})
)
});

type ProviderFormValues = z.infer<typeof providerFormSchema>;

export const ProviderAttributes: React.FunctionComponent<ProviderAttributesProps> = ({ stepChange }) => {
const [providerPricing, setProviderPricing] = useAtom(providerProcessStore.providerProcessAtom);
const form = useForm<ProviderFormValues>({
resolver: zodResolver(providerFormSchema),
defaultValues: {
attributes: [{ key: "", value: "", customKey: "" }]
}
});

const { control } = form;

const { fields, append, remove } = useFieldArray({
control,
name: "attributes"
});

const onSubmit: SubmitHandler<ProviderFormValues> = async data => {
const updatedProviderPricing = {
...providerPricing,
attributes: data.attributes.map(attr => ({
...attr,
customKey: attr.customKey || "" // Provide a default empty string
}))
};
setProviderPricing(updatedProviderPricing);
stepChange();
};

return (
<div className="flex w-full flex-col items-center pt-10">
<div className="w-full max-w-2xl space-y-6">
<div>
<h3 className="text-xl font-bold">Provider Attributes</h3>
<p className="text-muted-foreground text-sm">Please enter your provider attributes.</p>
</div>
<div>
<Separator />
</div>
<div>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
<div>
<h4 className="mb-2 text-lg font-semibold">Attributes</h4>
{fields.map((field, index) => {
const selectedKeys = form.watch("attributes").map(attr => attr.key);
const availableKeys = attributeKeys.filter(key => !selectedKeys.includes(key) || key === field.key || key === "unknown-attributes");

return (
<div key={field.id} className="mb-2 flex space-x-2">
<Controller
control={form.control}
name={`attributes.${index}.key`}
render={({ field }) => (
<FormItem className="flex-1">
<FormControl>
<Select value={field.value} onValueChange={value => field.onChange(value)}>
<SelectTrigger>{field.value || "Select Key"}</SelectTrigger>
<SelectContent>
{availableKeys.map(key => (
<SelectItem key={key} value={key}>
{key}
</SelectItem>
))}
</SelectContent>
</Select>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{form.watch(`attributes.${index}.key`) === "unknown-attributes" && (
<FormField
control={form.control}
name={`attributes.${index}.customKey`}
render={({ field }) => (
<FormItem className="flex-1">
<FormControl>
<Input placeholder="Custom Key" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
<FormField
control={form.control}
name={`attributes.${index}.value`}
render={({ field }) => (
<FormItem className="flex-1">
<FormControl>
<Input placeholder="Value" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<Button type="button" variant="outline" size="icon" onClick={() => remove(index)}>
<TrashIcon className="h-4 w-4" />
</Button>
</div>
);
})}
<Button type="button" variant="outline" size="sm" onClick={() => append({ key: "", value: "", customKey: "" })}>
<PlusIcon className="mr-2 h-4 w-4" />
Add Attribute
</Button>
</div>
<div className="">
<Separator />
</div>
<div className="flex w-full justify-between">
<div className="flex justify-start">
<ResetProviderForm />
</div>
<div className="flex justify-end">
<Button type="submit">Next</Button>
</div>
</div>
</form>
</Form>
</div>
</div>
</div>
);
};
Loading