Skip to content

Commit

Permalink
added service host
Browse files Browse the repository at this point in the history
  • Loading branch information
tulsiojha committed Nov 29, 2024
1 parent e536cea commit da72533
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions gql-queries-generator/doc/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4580,6 +4580,7 @@ query consoleListServiceBinding($envName: String!, $pagination: CursorPagination
}
}
updateTime
serviceHost
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ import { useConsoleApi } from '~/console/server/gql/api-provider';
import { IEnvironmentContext } from '../_layout';
import { useReload } from '~/root/lib/client/helpers/reloader';
import { toast } from '@kloudlite/design-system/molecule/toast';
import { CopyContentToClipboard } from '~/console/components/common-console-components';

const RESOURCE_NAME = 'managed resource';
type BaseType = ExtractNodeType<IServiceBinding>;

const parseItem = (item: BaseType) => {
console.log("svcbinding", item)
return {
name: item.spec?.serviceRef?.name || "",
serviceHost: item.serviceHost,
updateInfo: {
time: parseUpdateOrCreatedOn(item),
},
Expand Down Expand Up @@ -142,6 +145,14 @@ const InterceptPortView = ({
);
};

const ServiceView = ({ service }: { service: string }) => {
return (
<CopyContentToClipboard
content={service}
toastMessage="App service url copied successfully."
/>
);
};

interface IResource {
items: BaseType[];
Expand Down Expand Up @@ -190,6 +201,11 @@ const ListView = ({ items = [], onAction }: IResource) => {
name: 'name',
className: listClass.title,
},
{
render: () => 'Service Host',
name: 'serviceHost',
className: 'w-[300px] truncate',
},
{
render: () => '',
name: 'intercept',
Expand All @@ -212,12 +228,15 @@ const ListView = ({ items = [], onAction }: IResource) => {
},
],
rows: items.map((i) => {
const { name, updateInfo } = parseItem(i);
const { name, updateInfo, serviceHost } = parseItem(i);
return {
columns: {
name: {
render: () => <ListTitleV2 title={name} />,
},
serviceHost: {
render: () => <ServiceView service={serviceHost || ""} />
},
intercept: {
render: () =>
i.interceptStatus?.intercepted ? (
Expand All @@ -229,7 +248,6 @@ const ListView = ({ items = [], onAction }: IResource) => {
</div>
) : null,
},

updated: {
render: () => <ListItemV2 subtitle={updateInfo.time} />,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const serviceBindingQueries = (executor: IExecutor) => ({
}
}
updateTime
serviceHost
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/generated/gql/sdl.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4547,6 +4547,7 @@ type ServiceBinding {
markedForDeletion: Boolean
metadata: Metadata
recordVersion: Int!
serviceHost: String
spec: Github__com___kloudlite___operator___apis___networking___v1__ServiceBindingSpec
status: Github__com___kloudlite___operator___pkg___operator__Status
updateTime: Date!
Expand Down
1 change: 1 addition & 0 deletions src/generated/gql/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6286,6 +6286,7 @@ export type ConsoleListServiceBindingQuery = {
markedForDeletion?: boolean;
recordVersion: number;
updateTime: any;
serviceHost?: string;
interceptStatus?: {
intercepted?: boolean;
toAddr: string;
Expand Down

0 comments on commit da72533

Please sign in to comment.