Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
polamoros committed Apr 15, 2024
1 parent b884ef3 commit 247baaa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/wing-console/console/app/demo/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class ApiUsersService {
});

new ui.HttpClient(
"Test POST /widgets",
"Test HttpClient UI component",
inflight () => {
return this.api.url;
},
Expand Down
15 changes: 8 additions & 7 deletions apps/wing-console/console/ui/src/ui/resource-metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ import type {
UISection,
} from "@winglang/sdk/lib/core/tree.js";
import classNames from "classnames";
import { memo, useCallback, useId, useMemo, useState } from "react";
import { memo, useCallback, useContext, useId, useMemo, useState } from "react";

import type { UIHttpClient } from "../../../../../../libs/wingsdk/lib/core/tree.js";
import { AppContext } from "../AppContext.js";
import { QueueMetadataView } from "../features/queue-metadata-view.js";
import { ResourceInteractionView } from "../features/resource-interaction-view.js";
import { trpc } from "../services/trpc.js";
Expand Down Expand Up @@ -104,6 +105,8 @@ const CustomResourceHttpClientItem = ({
getApiSpecHandler,
}: CustomResourceHttpClientItemProps) => {
const { theme } = useTheme();
const { appMode } = useContext(AppContext);

const data = trpc["app.getResourceUiHttpClient"].useQuery(
{
getUrlResourcePath: getUrlHandler,
Expand All @@ -121,16 +124,14 @@ const CustomResourceHttpClientItem = ({

return (
<div className="pl-4">
<label
htmlFor={getUrlHandler}
className={classNames("min-w-[100px]", theme.text2)}
>
{label}
</label>
<div className="mb-1">
<Attribute name="Name" value={label} noLeftPadding />
</div>
{data.data?.url && data.data?.openApiSpec && (
<ApiInteraction
resourceId={getUrlHandler}
url={data.data.url}
appMode={appMode}
openApiSpec={data.data.openApiSpec}
callFetch={callFetch}
isLoading={isLoading}
Expand Down

0 comments on commit 247baaa

Please sign in to comment.