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

Servicebinding #335

Merged
merged 2 commits into from
Nov 29, 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
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 @@ -11,6 +11,7 @@ import { useEffect, useRef } from 'react';
import { LoadingPlaceHolder } from '~/console/components/loading';
import Yup from '~/root/lib/server/helpers/yup';
import { DISCARD_ACTIONS, useUnsavedChanges } from '~/root/lib/client/hooks/use-unsaved-changes';
import { parseName } from '~/console/server/r-utils/common';


const SettingValues = () => {
Expand Down Expand Up @@ -130,15 +131,15 @@ const SettingValues = () => {

if (
values.activeTab === 'values' &&
path === '/values.yaml'
path === `/${parseName(readOnlyHelmChart)}-values.yaml`
) {
handleChange('values')(dummyEvent(e));
}
}}
path={
values.activeTab === 'defaults'
? 'defaults.yaml'
: 'values.yaml'
? `${parseName(readOnlyHelmChart)}-defaults.yaml`
: `${parseName(readOnlyHelmChart)}-values.yaml`
}
onMount={(e) => {
editorRef.current = e;
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