Skip to content

Commit

Permalink
fix(web): port info (#871)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeezQ authored Mar 8, 2023
1 parent b12b3b9 commit b096734
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions web/src/hooks/useAwsS3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import useGlobalStore from "@/pages/globalStore";

function useAwsS3() {
const currentApp = useGlobalStore((state) => state.currentApp);
const credentials = currentApp?.storage?.credentials!;
const credentials = currentApp?.storage?.credentials;

const s3 = new (window as any).AWS.S3({
accessKeyId: credentials.accessKeyId,
secretAccessKey: credentials.secretAccessKey,
sessionToken: credentials.sessionToken,
endpoint: credentials.endpoint,
accessKeyId: credentials?.accessKeyId,
secretAccessKey: credentials?.secretAccessKey,
sessionToken: credentials?.sessionToken,
endpoint: credentials?.endpoint,
s3ForcePathStyle: true,
signatureVersion: "v4",
});
Expand Down
1 change: 0 additions & 1 deletion web/src/pages/app/logs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export default function LogsPage() {
width={200}
size="sm"
placeholder={t("FunctionPanel.FunctionName").toString()}
bg="white"
{...register("functionName")}
/>

Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/app/storages/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const useStorageStore = create<State>()(

getOrigin: (domain: string) => {
const currentApp = useGlobalStore.getState().currentApp;
return `${currentApp?.tls ? "https" : "http"}://${domain}:${formatPort(currentApp?.port)}`;
return `${currentApp?.tls ? "https" : "http"}://${domain}${formatPort(currentApp?.port)}`;
},
})),
),
Expand Down
3 changes: 2 additions & 1 deletion web/src/pages/globalStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { devtools } from "zustand/middleware";
import { immer } from "zustand/middleware/immer";

import { APP_PHASE_STATUS } from "@/constants";
import { formatPort } from "@/utils/format";

import { TApplication, TRegion, TRuntime, TUserInfo } from "@/apis/typing";
import { ApplicationControllerRemove, ApplicationControllerUpdate } from "@/apis/v1/applications";
Expand Down Expand Up @@ -117,7 +118,7 @@ const useGlobalStore = create<State>()(
state.currentApp = app;

if (typeof state.currentApp === "object") {
const host = `${state.currentApp?.domain?.domain}:${state.currentApp.port}`;
const host = `${state.currentApp?.domain?.domain}${formatPort(state.currentApp.port)}`;
state.currentApp.host = host;
state.currentApp.origin = `${state.currentApp?.tls ? "https://" : "http://"}${host}`;
}
Expand Down
4 changes: 2 additions & 2 deletions web/src/utils/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ export function formatDateOption(): { label: string; value: number | string }[]
const optionDay = [7, 30, 60, 90];
const option: { label: string; value: string | number }[] = optionDay.map((item) => {
return {
label: `${item} ${t(" Days")}`,
label: `${item} ${t("Days")}`,
value: item * 24 * 60 * 60,
};
});
option.push({ label: t(" Custom"), value: "custom" });
option.push({ label: t("Custom"), value: "custom" });
return option;
}

Expand Down
1 change: 1 addition & 0 deletions web/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"target": "ESNext",
"composite": true,
"module": "ESNext",
"skipLibCheck": true,
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"types": ["node"]
Expand Down

0 comments on commit b096734

Please sign in to comment.