Skip to content

Commit

Permalink
fixed build process
Browse files Browse the repository at this point in the history
  • Loading branch information
jigar-arc10 committed Oct 16, 2024
1 parent d91d340 commit fd62ae2
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 128 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export const ServerForm: React.FunctionComponent<ServerFormProp> = ({ currentSer
if (currentServerNumber > 0 && providerProcess?.storeInformation) {
const firstServer = providerProcess.machines[0]?.access;
if (firstServer.file) {
// Assume firstServer.file is already a base64 string
setStoredFileContent(firstServer.file);
// Ensure firstServer.file is a string (base64)
setStoredFileContent(typeof firstServer.file === 'string' ? firstServer.file : null);
form.setValue("authType", "file");
}
}
Expand Down Expand Up @@ -167,7 +167,7 @@ export const ServerForm: React.FunctionComponent<ServerFormProp> = ({ currentSer
...providerProcess,
machines,
storeInformation: currentServerNumber === 0 ? formValues.saveInformation : providerProcess?.storeInformation,
process: providerProcess.process,
process: providerProcess.process
});
onSubmit();
}
Expand All @@ -185,7 +185,7 @@ export const ServerForm: React.FunctionComponent<ServerFormProp> = ({ currentSer
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = (e) => {
reader.onload = e => {
const base64Content = e.target?.result as string;
setStoredFileContent(base64Content);
setSelectedFile(file);
Expand Down Expand Up @@ -416,4 +416,4 @@ export const ServerForm: React.FunctionComponent<ServerFormProp> = ({ currentSer
</div>
</div>
);
};
};
22 changes: 13 additions & 9 deletions apps/provider-console/src/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { cn } from "@src/utils/styleUtils";
import { UrlService } from "@src/utils/urlUtils";
import { ModeToggle } from "./ModeToggle";
import { SidebarGroupMenu } from "./SidebarGroupMenu";
import { useWallet } from "@src/context/WalletProvider";

const { publicRuntimeConfig } = getConfig();

Expand All @@ -29,6 +30,7 @@ type Props = {

export const Sidebar: React.FunctionComponent<Props> = ({ isMobileOpen, handleDrawerToggle, isNavOpen, onOpenMenuClick }) => {
const [isHovering, setIsHovering] = useState(false);
const { isProvider, isOnline } = useWallet();
const _isNavOpen = isNavOpen || isHovering;
// const [, setDeploySdl] = useAtom(sdlStore.deploySdl);
const muiTheme = useMuiTheme();
Expand Down Expand Up @@ -141,15 +143,17 @@ export const Sidebar: React.FunctionComponent<Props> = ({ isMobileOpen, handleDr
className="border-muted-foreground/20 bg-popover dark:bg-background box-border flex h-full flex-shrink-0 flex-col items-center justify-between overflow-y-auto overflow-x-hidden border-r-[1px] transition-[width] duration-300 ease-in-out md:h-[calc(100%-57px)]"
>
<div className={cn("flex w-full flex-col items-center justify-between", { ["p-2"]: _isNavOpen, ["pb-2 pt-2"]: !_isNavOpen })}>
<Link
className={cn(buttonVariants({ variant: "default", size: _isNavOpen ? "lg" : "icon" }), "h-[45px] w-full leading-4", {
["h-[45px] w-[45px] min-w-0 pb-2 pt-2"]: !_isNavOpen
})}
href="/become-provider"
>
{_isNavOpen && "Become Provider "}
<Rocket className={cn("rotate-45", { ["ml-4"]: _isNavOpen })} fontSize="small" />
</Link>
{(!isProvider || !isOnline) && (
<Link
className={cn(buttonVariants({ variant: "default", size: _isNavOpen ? "lg" : "icon" }), "h-[45px] w-full leading-4", {
["h-[45px] w-[45px] min-w-0 pb-2 pt-2"]: !_isNavOpen
})}
href="/become-provider"
>
{_isNavOpen && "Become Provider "}
<Rocket className={cn("rotate-45", { ["ml-4"]: _isNavOpen })} fontSize="small" />
</Link>
)}

{routeGroups.map((g, i) => (
<SidebarGroupMenu key={i} group={g} hasDivider={g.hasDivider} isNavOpen={_isNavOpen} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ export const WalletProvider = ({ children }) => {
} = useSelectedChain();
const { addEndpoints } = useManager();
const selectedNetwork = useSelectedNetwork();
// const { signArbitrary: keplrSignArbitrary } = useChainWallet("akash", "keplr-extension");
// const { signArbitrary: leapSignArbitrary } = useChainWallet("akash", "leap-extension");
// const {
// fee: { default: feeGranter }
// } = useAllowance();

useEffect(() => {
if (!settings.apiEndpoint || !settings.rpcEndpoint) return;

Expand Down
89 changes: 0 additions & 89 deletions apps/provider-console/src/hooks/useAllowance.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions apps/provider-console/src/pages/api/hello.ts

This file was deleted.

13 changes: 9 additions & 4 deletions apps/provider-console/src/pages/dashboard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";
import React, { useEffect, useState } from "react";
import { useQuery } from "react-query";
import { Button, Card, CardContent, CardHeader, Separator } from "@akashnetwork/ui/components";
import { Button, Card, CardContent, CardHeader, Separator, Spinner } from "@akashnetwork/ui/components";
import consoleClient from "@src/utils/consoleClient";
import { Shield, AlertTriangle } from "lucide-react";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@akashnetwork/ui/components";
Expand Down Expand Up @@ -138,7 +138,12 @@ const Dashboard: React.FC = () => {
</div>
</div>
<div className="mt-10">
<div className="text-sm">Provider Summary</div>
<div className="text-sm font-semibold">
<div className="inline-flex items-center space-x-2">
Provider Summary
{isLoadingProviderDashboard && <Spinner className="mb-2 ml-2 h-5 w-5" />}
</div>
</div>
<div className="mt-2 grid grid-cols-4 gap-4">
{isLoadingProviderDashboard ? (
<>
Expand Down Expand Up @@ -268,7 +273,7 @@ const Dashboard: React.FC = () => {
{isOnline && (
<>
<div className="mt-8">
<div className="text-sm">Resources Leased Summary</div>
<div className="text-sm font-semibold">Resources Leased Summary</div>
<div className="mt-2">
{isLoadingProviderDetails ? (
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
Expand All @@ -288,7 +293,7 @@ const Dashboard: React.FC = () => {
<Separator className="mt-10" />
<div className="mt-8">
<div className="mt-2">
<div className="text-sm">Provider Actions</div>
<div className="text-sm font-semibold">Provider Actions</div>
<ProviderActionList actions={providerActions} />
</div>
</div>
Expand Down
7 changes: 7 additions & 0 deletions apps/provider-console/src/utils/apiUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from "axios";

import { BASE_API_URL } from "./constants";
import { appendSearchParams } from "./urlUtils";
export class ApiUrlService {
static mainnetVersion() {
return `0.36.0`;
Expand All @@ -27,6 +28,12 @@ export class ApiUrlService {
static marketData() {
return `${BASE_API_URL}/v1/market-data`;
}
static blocks(limit: number) {
return `${BASE_API_URL}/v1/blocks${appendSearchParams({ limit })}`;
}
static block(apiEndpoint: string, id: string) {
return `${apiEndpoint}/blocks/${id}`;
}
}

export const mainnetNodes = ApiUrlService.mainnetNodes();
Expand Down
3 changes: 2 additions & 1 deletion apps/provider-console/src/utils/authClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// import { notification } from 'antd'
import axios from "axios";
import * as Sentry from "@sentry/nextjs";
import { BASE_API_PROVIDER_SECURITY_URL } from "./constants";

const errorNotification = (error = "Error Occurred") => {
// notification.error({
Expand All @@ -10,7 +11,7 @@ const errorNotification = (error = "Error Occurred") => {
};

const authClient = axios.create({
baseURL: `http://aisrlqh46hd27cm7o29rqo3378.ingress.hurricane.akash.pub`,
baseURL: BASE_API_PROVIDER_SECURITY_URL,
timeout: 30000
});

Expand Down
7 changes: 7 additions & 0 deletions apps/provider-console/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ export const selectedRangeValues: { [key: string]: number } = {
const productionMainnetApiUrl = "https://console-api.akash.network";
const productionTestnetApiUrl = "https://console-api-testnet.akash.network";
const productionSandboxApiUrl = "https://console-api-sandbox.akash.network";

// temp urls
const productionProviderConsoleApiUrl = "http://5cujrkcvn9e234vilf1iglkf98.ingress.hurricane.akash.pub/";
const productionProviderSecurityApiUrl = "http://aisrlqh46hd27cm7o29rqo3378.ingress.hurricane.akash.pub";

export const BASE_API_PROVIDER_CONSOLE_URL = productionProviderConsoleApiUrl;
export const BASE_API_PROVIDER_SECURITY_URL = productionProviderSecurityApiUrl;
export const BASE_API_MAINNET_URL = getApiMainnetUrl();
export const BASE_API_TESTNET_URL = getApiTestnetUrl();
export const BASE_API_SANDBOX_URL = getApiSandboxUrl();
Expand Down
3 changes: 2 additions & 1 deletion apps/provider-console/src/utils/restClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import * as Sentry from "@sentry/nextjs";

import authClient from "./authClient";
import { checkAndRefreshToken } from "./tokenUtils";
import { BASE_API_PROVIDER_CONSOLE_URL } from "./constants";

const errorNotification = (error = "Error Occurred") => {
console.log(error);
};

const restClient = axios.create({
baseURL: `http://5cujrkcvn9e234vilf1iglkf98.ingress.hurricane.akash.pub/`,
baseURL: BASE_API_PROVIDER_CONSOLE_URL,
timeout: 60000
});

Expand Down
14 changes: 14 additions & 0 deletions apps/provider-console/src/utils/urlUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ function getSelectedNetworkQueryParam() {
}
}

export function appendSearchParams(params: { [key: string]: string | number | boolean | null | undefined } = {}) {
const urlParams = new URLSearchParams("");
Object.keys(params).forEach(p => {
const value = params[p];
if (value) {
urlParams.set(p, value.toString());
}
});

const res = urlParams.toString();

return res ? `?${res}` : res;
}

export const domainName = "https://provider.akash.network";

export class UrlService {
Expand Down

0 comments on commit fd62ae2

Please sign in to comment.