Skip to content

Commit

Permalink
fix(web): build error, change pnpm to npm(#520)
Browse files Browse the repository at this point in the history
* feat: function deploy

* feat: add file upload

* update: edit bucket modal

* refactor: react query best practice

* fix: add nextjs env viriable & fix next build errors

* fix:  build error, change pnpm to npm
  • Loading branch information
LeezQ authored Dec 12, 2022
1 parent 3417159 commit 6dbd5c7
Show file tree
Hide file tree
Showing 11 changed files with 642 additions and 11,359 deletions.
4 changes: 2 additions & 2 deletions web/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NEXT_PUBLIC_API_SERVER=http://localhost:3000
NEXT_PUBLIC_LOGIN_PATH=http://localhost:3000/v1/login
NEXT_PUBLIC_API_SERVER=http://api.192.168.64.6.nip.io
NEXT_PUBLIC_LOGIN_PATH=http://api.192.168.64.6.nip.io/v1/login
236 changes: 236 additions & 0 deletions web/apis/typing.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
export interface TApplication {
id: string;
name: string;
appid: string;
regionName: string;
bundleName: string;
runtimeName: string;
state: string;
phase: string;
tags: any[];
createdAt: string;
updatedAt: string;
createdBy: string;
region: Region;
bundle: Bundle;
runtime: Runtime;
configuration: Configuration;
database: Database;
oss: Oss;
gateway: Gateway;
}

export interface Region {
id: string;
name: string;
desc: any;
}

export interface Bundle {
id: string;
name: string;
displayName: string;
limitCPU: number;
limitMemory: number;
requestCPU: number;
requestMemory: number;
databaseCapacity: number;
storageCapacity: number;
networkTrafficOutbound: number;
networkTrafficInbound: any;
priority: number;
}

export interface Runtime {
id: string;
name: string;
type: string;
image: Image;
version: string;
latest: boolean;
}

export interface Image {
main: string;
init: string;
sidecar: any;
}

export interface Configuration {
id: string;
appid: string;
environments: Environment[];
createdAt: string;
updatedAt: string;
}

export interface Environment {
name: string;
value: string;
}

export interface Database {
apiVersion: string;
kind: string;
metadata: Metadata;
spec: Spec;
status: Status;
}

export interface Metadata {
creationTimestamp: string;
finalizers: string[];
generation: number;
labels: Labels;
name: string;
namespace: string;
resourceVersion: string;
uid: string;
}

export interface Labels {
"laf.dev/appid": string;
"laf.dev/database.store.name": string;
"laf.dev/database.store.namespace": string;
}

export interface Spec {
capacity: Capacity;
password: string;
provider: string;
region: string;
username: string;
}

export interface Capacity {
storage: string;
}

export interface Status {
capacity: Capacity2;
conditions: Condition[];
connectionUri: string;
storeName: string;
storeNamespace: string;
}

export interface Capacity2 {
storage: string;
}

export interface Condition {
lastTransitionTime: string;
message: string;
reason: string;
status: string;
type: string;
}

export interface Oss {
apiVersion: string;
kind: string;
metadata: Metadata2;
spec: Spec2;
status: Status2;
}

export interface Metadata2 {
creationTimestamp: string;
finalizers: string[];
generation: number;
labels: Labels2;
name: string;
namespace: string;
resourceVersion: string;
uid: string;
}

export interface Labels2 {
"laf.dev/appid": string;
"laf.dev/oss.store.name": string;
"laf.dev/oss.store.namespace": string;
}

export interface Spec2 {
appid: string;
capacity: Capacity3;
password: string;
provider: string;
region: string;
}

export interface Capacity3 {
bucketCount: number;
objectCount: number;
storage: string;
}

export interface Status2 {
accessKey: string;
capacity: Capacity4;
conditions: Condition2[];
endpoint: string;
region: string;
secretKey: string;
storeName: string;
storeNamespace: string;
}

export interface Capacity4 {
bucketCount: number;
objectCount: number;
storage: string;
}

export interface Condition2 {
lastTransitionTime: string;
message: string;
reason: string;
status: string;
type: string;
}

export interface Gateway {
apiVersion: string;
kind: string;
metadata: Metadata3;
spec: Spec3;
status: Status3;
}

export interface Metadata3 {
creationTimestamp: string;
generation: number;
labels: Labels3;
name: string;
namespace: string;
resourceVersion: string;
uid: string;
}

export interface Labels3 {
"laf.dev/appid": string;
}

export interface Spec3 {
appid: string;
}

export interface Status3 {
appRoute: AppRoute;
conditions: Condition3[];
}

export interface AppRoute {
domain: string;
domainName: string;
domainNamespace: string;
}

export interface Condition3 {
lastTransitionTime: string;
message: string;
reason: string;
status: string;
type: string;
}
2 changes: 1 addition & 1 deletion web/components/Editor/FunctionEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function FunctionEditor(props: {
verticalScrollbarSize: 6,
},
lineNumbersMinChars: 4,
fontSize: "16px",
fontSize: 16,
// fontFamily: "monospace",
scrollBeyondLastLine: false,
}}
Expand Down
4 changes: 1 addition & 3 deletions web/components/Editor/JsonEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,17 @@ export default function JsonEditor(props: { value: string | object; height?: str
}}
beforeMount={handleEditorWillMount}
options={{
lineNumber: false,
lineNumbers: "off",
guides: {
indentation: false,
},
minimap: {
enabled: false,
},
lineHighlightBackground: "red",
scrollbar: {
verticalScrollbarSize: 0,
alwaysConsumeMouseWheel: false,
},
lineNumbers: "off",
lineNumbersMinChars: 0,
fontSize: 14,
scrollBeyondLastLine: false,
Expand Down
4 changes: 2 additions & 2 deletions web/components/Layout/Function.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function FunctionLayout(props: { children: ReactNode }) {
);

useEffect(() => {
if (currentApp.appid) {
if (currentApp?.appid) {
init();
}
}, [currentApp, init]);
Expand All @@ -45,7 +45,7 @@ export default function FunctionLayout(props: { children: ReactNode }) {
position: "relative",
}}
>
{loading || !currentApp.appid ? <Spinner /> : props.children}
{loading || !currentApp?.appid ? <Spinner /> : props.children}
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion web/hooks/useOss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type Credentials = {
const useOss = (credentials: Credentials) => {
const { currentApp } = useGlobalStore();
const region = "us-east-1";
const endpoint = `http://${currentApp.name}.oss-${region}.com`;
const endpoint = `http://${currentApp?.name}.oss-${region}.com`;

AWS.config.update({
accessKeyId: "YOUR_ACCESS_KEY_HERE",
Expand Down
Loading

0 comments on commit 6dbd5c7

Please sign in to comment.