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

fix(portal): restore seller api to default & some minor UI issues #146

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const APIServerDrawer = ({ item, isOpen, onClose }: Props) => {
render: (item: Record<string, any>) => {
const linkKey = findLinkedComponent(item.metadata.key);
return (
<Flex justify="start">
<Flex justify="start" align="center">
<RequestMethod method={item.facets.trigger?.method} />

<Tooltip title={linkKey ? null : "This use case does not exist."}>
Expand Down Expand Up @@ -130,6 +130,7 @@ const APIServerDrawer = ({ item, isOpen, onClose }: Props) => {
].length > 0 ? (
<Table
columns={columns}
rowKey='id'
dataSource={
componentDetail.endpointUsage[
key as keyof typeof componentDetail.endpointUsage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.disabled {
background: #f5f5f5 !important;
color: #595959 !important;
}
.requestMethod {
height: fit-content;

&.disabled {
background: #f5f5f5 !important;
color: #595959 !important;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Tag } from "antd";
import { useMemo } from "react";
import styles from "./index.module.scss";
import classNames from "classnames";

const RequestMethod = ({ method = "", noSpace = false, disabled = false }) => {
const methodColor = useMemo(() => {
Expand All @@ -21,7 +22,7 @@ const RequestMethod = ({ method = "", noSpace = false, disabled = false }) => {
return (
<Tag
data-testid="method"
className={disabled ? styles.disabled : ""}
className={classNames(styles.requestMethod, disabled && styles.disabled)}
bordered={false}
color={methodColor}
style={noSpace ? { marginRight: 0 } : {}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import TitleIcon from "@/assets/title-icon.svg";
import DeleteApiButton from "@/components/DeleteApiButton";
import SpecDrawer from "@/components/SpecDrawer";
import { Text } from "@/components/Text";
import { SecondaryText, Text } from "@/components/Text";
import { useDeleteApiServer } from "@/hooks/product";
import { useAppStore } from "@/stores/app.store";
import { IComponent } from "@/utils/types/component.type";
Expand Down Expand Up @@ -87,19 +87,15 @@ const APIServerCard = ({ item, refetchList }: Props) => {
title={
<Flex justify="space-between" gap={12} align="center">
<Flex gap={8}>
<Flex align="center">
<Text.NormalLarge>
{get(item, "metadata.name", "")}
</Text.NormalLarge>
</Flex>
<Text.NormalLarge>
{get(item, "metadata.name", "")}
</Text.NormalLarge>
<div onMouseEnter={trueHover} onMouseLeave={falseHover}>
{isHover && isApiInUse ? (
<Button
style={{ padding: "0px" }}
type="link"
onClick={() => {
setOpenMappingDrawer(true);
}}
onClick={() => setOpenMappingDrawer(true)}
>
Check details
</Button>
Expand All @@ -112,7 +108,7 @@ const APIServerCard = ({ item, refetchList }: Props) => {
)}
</div>
</Flex>
<Flex gap={12}>
<Flex>
<Button type="link" onClick={handleEdit}>
Edit
</Button>
Expand All @@ -127,102 +123,95 @@ const APIServerCard = ({ item, refetchList }: Props) => {
</Flex>
}
>
<Row>
<Col lg={8} md={12}>
<Flex gap={8} justify="flex-start" align="center">
<TitleIcon />
<Text.NormalLarge>Seller API Server basics</Text.NormalLarge>
</Flex>
<Flex vertical gap={12} style={{ marginTop: 12 }}>
<Flex vertical align="flex-start" gap={8}>
<Text.LightMedium color="#00000073">
Application name
</Text.LightMedium>
<Typography.Text
ellipsis={{
tooltip: { title: get(item, "metadata.name") },
}}
>
{get(item, "metadata.name")}
</Typography.Text>
<Text.LightMedium></Text.LightMedium>
</Flex>
<Flex vertical align="flex-start" gap={8}>
<Text.LightMedium color="#00000073">
Online API document link
</Text.LightMedium>
<Typography.Text
ellipsis={{
tooltip: { title: get(item, "facets.baseSpec.path", "-") },
}}
>
{get(item, "facets.baseSpec.path", "-")}
</Typography.Text>
</Flex>
<Flex vertical align="flex-start" gap={8}>
<Text.LightMedium color="#00000073">
Description
</Text.LightMedium>
<Typography.Text
ellipsis={{
tooltip: {
title: get(item, "metadata.description", "description"),
},
}}
>
{get(item, "metadata.description", "description")}
</Typography.Text>
</Flex>
<Row gutter={[16, 16]}>
<Group title="Seller API Server basics">
<Flex vertical align="flex-start" gap={8}>
<Text.LightMedium color="#00000073">
Application name
</Text.LightMedium>
<Typography.Text
ellipsis={{
tooltip: { title: get(item, "metadata.name") },
}}
>
{get(item, "metadata.name")}
</Typography.Text>
</Flex>
</Col>
<Col lg={8} md={12}>
<Flex gap={8} justify="flex-start" align="center">
<TitleIcon />
<Text.NormalLarge>
Base URL for environment variables
</Text.NormalLarge>
</Flex>
<Flex vertical gap={8} align="flex-start" style={{ marginTop: 12 }}>
{environmentData?.map((e) => (
<Flex gap={8} justify="flex-start" key={e.name} align="center">
<Text.LightMedium style={{ display: 'inline-block', width: 120, textAlign: 'left' }}>
{e.name}
</Text.LightMedium>
<Typography.Text style={{ whiteSpace: "break-spaces" }}>
URL: {e.url}
</Typography.Text>
</Flex>
))}
<Flex vertical align="flex-start" gap={8}>
<Text.LightMedium color="#00000073">
Online API document link
</Text.LightMedium>
<Typography.Text
ellipsis={{
tooltip: { title: get(item, "facets.baseSpec.path", "-") },
}}
>
{get(item, "facets.baseSpec.path", "-")}
</Typography.Text>
</Flex>
</Col>
<Col lg={8} md={24}>
<Flex gap={8} justify="flex-start" align="center">
<TitleIcon />
<Text.NormalLarge>API spec</Text.NormalLarge>
<Flex vertical align="flex-start" gap={8}>
<Text.LightMedium color="#00000073">
Description
</Text.LightMedium>
<Typography.Text
ellipsis={{
tooltip: {
title: get(item, "metadata.description", "description"),
},
}}
>
{get(item, "metadata.description", "description")}
</Typography.Text>
</Flex>
<Flex vertical align="flex-start" gap={6} style={{ marginTop: 12 }}>
<Flex gap={8}>
<Text.NormalMedium color="#000000D9">
API spec in yaml format
</Text.NormalMedium>
</Flex>
<Flex gap={9} justify="flex-start">
<PaperClipOutlined />
<Text.LightMedium
color="#2962FF"
style={{ cursor: "pointer" }}
role="none"
onClick={openDrawer}
>
{fileName}
</Text.LightMedium>
</Group>

<Group title="Base URL for environment variables">
{environmentData?.map((e) => (
<Flex gap={8} vertical justify="flex-start" key={e.name}>
<SecondaryText.LightNormal style={{ textTransform: 'capitalize' }}>
{e.name} URL
</SecondaryText.LightNormal>
<Typography.Text style={{ whiteSpace: "break-spaces" }}>
{e.url}
</Typography.Text>
</Flex>
))}
</Group>

<Group title="API spec">
<Flex vertical gap={8}>
<Text.NormalMedium color="#000000D9">
API spec in yaml format
</Text.NormalMedium>

<Text.LightMedium
color="#2962FF"
style={{ cursor: "pointer" }}
role="none"
onClick={openDrawer}
>
<PaperClipOutlined style={{ color: "#000000D9" }} /> {fileName}
</Text.LightMedium>
</Flex>
</Col>
</Group>
</Row>
</Card>
</Spin>
);
};

export default APIServerCard;

function Group({ title, children }: Readonly<React.PropsWithChildren<{ title?: React.ReactNode }>>) {
return (
<Col lg={8} md={24}>
<Flex gap={8} justify="flex-start" align="center">
<TitleIcon />
<Text.NormalLarge>{title}</Text.NormalLarge>
</Flex>
<Flex vertical align="flex-start" gap={20} style={{ marginTop: 12 }}>
{children}
</Flex>
</Col>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const APIServerList = () => {
<Flex
flexDirection="column"
alignItems="flex-start"
gap={26}
gap={16}
style={{ width: "100%" }}
>
{dataList?.data?.map((item: IComponent) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
display: flex;
flex: 1;

.blank {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
}

.flexOne {
flex: 1;
}
Expand Down
Loading
Loading