From 95b7e2ab50bbb964d9a17f2b8514bed24ab6239d Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 30 Jul 2023 10:50:52 +0300 Subject: [PATCH 001/374] WIP --- frontend/webapp/app/overview/sources/page.tsx | 7 ++- frontend/webapp/containers/overview/index.tsx | 1 + .../overview/sources/sources.styled.tsx | 7 +++ .../containers/overview/sources/sources.tsx | 51 +++++++++++++++++++ 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 frontend/webapp/containers/overview/sources/sources.styled.tsx create mode 100644 frontend/webapp/containers/overview/sources/sources.tsx diff --git a/frontend/webapp/app/overview/sources/page.tsx b/frontend/webapp/app/overview/sources/page.tsx index 42e001585..454db1e18 100644 --- a/frontend/webapp/app/overview/sources/page.tsx +++ b/frontend/webapp/app/overview/sources/page.tsx @@ -1,6 +1,11 @@ "use client"; +import { SourcesContainer } from "@/containers/overview"; import React from "react"; export default function SourcesOverviewPage() { - return
SourcesOverviewPage
; + return ( + <> + + + ); } diff --git a/frontend/webapp/containers/overview/index.tsx b/frontend/webapp/containers/overview/index.tsx index 0bd20bd08..2a26e3504 100644 --- a/frontend/webapp/containers/overview/index.tsx +++ b/frontend/webapp/containers/overview/index.tsx @@ -1,2 +1,3 @@ export { OverviewContainer } from "./overview/overview"; export { DestinationContainer } from "./destination/destination"; +export { SourcesContainer } from "./sources/sources"; diff --git a/frontend/webapp/containers/overview/sources/sources.styled.tsx b/frontend/webapp/containers/overview/sources/sources.styled.tsx new file mode 100644 index 000000000..4c8ff6466 --- /dev/null +++ b/frontend/webapp/containers/overview/sources/sources.styled.tsx @@ -0,0 +1,7 @@ +import styled from "styled-components"; + +export const SourcesContainerWrapper = styled.div` + height: 100vh; + width: 100%; + overflow-y: scroll; +`; diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx new file mode 100644 index 000000000..7124c8208 --- /dev/null +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -0,0 +1,51 @@ +"use client"; +import React, { useEffect, useState } from "react"; +import { KeyvalLoader } from "@/design.system"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { useQuery } from "react-query"; +import { getSources } from "@/services"; +import { OverviewHeader } from "@/components/overview"; +import { useNotification } from "@/hooks"; +import { SourcesContainerWrapper } from "./sources.styled"; + +export function SourcesContainer() { + const { show, Notification } = useNotification(); + + const { + data: sources, + refetch, + isLoading, + } = useQuery([QUERIES.API_SOURCES], getSources); + + useEffect(() => { + console.log({ sources }); + }, [sources]); + + function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { + refetch(); + + show({ + type: NOTIFICATION.SUCCESS, + message, + }); + } + + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + + if (isLoading) { + return ; + } + + return ( + + + + + ); +} From 3f0700a90cdd81b24a269cde73c8f6c401765944 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 30 Jul 2023 12:38:53 +0300 Subject: [PATCH 002/374] WIP --- .../containers/overview/sources/sources.tsx | 29 ++----------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index 7124c8208..541fb8d21 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -1,43 +1,19 @@ "use client"; -import React, { useEffect, useState } from "react"; +import React from "react"; import { KeyvalLoader } from "@/design.system"; -import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { OVERVIEW, QUERIES } from "@/utils/constants"; import { useQuery } from "react-query"; import { getSources } from "@/services"; import { OverviewHeader } from "@/components/overview"; -import { useNotification } from "@/hooks"; import { SourcesContainerWrapper } from "./sources.styled"; export function SourcesContainer() { - const { show, Notification } = useNotification(); - const { data: sources, refetch, isLoading, } = useQuery([QUERIES.API_SOURCES], getSources); - useEffect(() => { - console.log({ sources }); - }, [sources]); - - function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { - refetch(); - - show({ - type: NOTIFICATION.SUCCESS, - message, - }); - } - - function onError({ response }) { - const message = response?.data?.message; - show({ - type: NOTIFICATION.ERROR, - message, - }); - } - if (isLoading) { return ; } @@ -45,7 +21,6 @@ export function SourcesContainer() { return ( - ); } From 9e4a5ace4946cc0f8ff97a066461f18285321c39 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 30 Jul 2023 13:46:02 +0300 Subject: [PATCH 003/374] source manage card --- frontend/webapp/assets/images/index.tsx | 1 + .../images/sources.card/sources.card.tsx | 6 +++ frontend/webapp/components/overview/index.tsx | 1 + .../sources.manage.card.tsx | 49 +++++++++++++++++++ .../sources.manage.list.tsx | 24 +++++++++ .../sources.manage.styled.tsx | 38 ++++++++++++++ .../setup/sources/source.card/source.card.tsx | 6 +-- .../containers/overview/sources/sources.tsx | 4 +- frontend/webapp/styles/global.tsx | 5 ++ frontend/webapp/types/sources.tsx | 11 +++++ 10 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 frontend/webapp/assets/images/index.tsx create mode 100644 frontend/webapp/assets/images/sources.card/sources.card.tsx create mode 100644 frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx create mode 100644 frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx create mode 100644 frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx create mode 100644 frontend/webapp/styles/global.tsx create mode 100644 frontend/webapp/types/sources.tsx diff --git a/frontend/webapp/assets/images/index.tsx b/frontend/webapp/assets/images/index.tsx new file mode 100644 index 000000000..9e85a0357 --- /dev/null +++ b/frontend/webapp/assets/images/index.tsx @@ -0,0 +1 @@ +export { SOURCES_LOGOS } from "./sources.card/sources.card"; diff --git a/frontend/webapp/assets/images/sources.card/sources.card.tsx b/frontend/webapp/assets/images/sources.card/sources.card.tsx new file mode 100644 index 000000000..d2f593fb7 --- /dev/null +++ b/frontend/webapp/assets/images/sources.card/sources.card.tsx @@ -0,0 +1,6 @@ +export const SOURCES_LOGOS = { + java: "https://odigos-sources.s3.amazonaws.com/java.svg", + go: "https://odigos-sources.s3.amazonaws.com/go.svg", + javascript: "https://odigos-sources.s3.amazonaws.com/nodejs.svg", + python: "https://odigos-sources.s3.amazonaws.com/python.svg", +}; diff --git a/frontend/webapp/components/overview/index.tsx b/frontend/webapp/components/overview/index.tsx index 8e1f401d6..799574495 100644 --- a/frontend/webapp/components/overview/index.tsx +++ b/frontend/webapp/components/overview/index.tsx @@ -1,3 +1,4 @@ export { OverviewHeader } from "./overview.header/overview.header"; export { ManageDestination } from "./destination/manage.destination/manage.destination"; export { DestinationsManagedList } from "./destination/destination.list/destinations.managed.list"; +export { SourcesManagedList } from "./sources/sources.manage.list/sources.manage.list"; diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx new file mode 100644 index 000000000..dbd8fe628 --- /dev/null +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx @@ -0,0 +1,49 @@ +import React from "react"; +import { KeyvalImage, KeyvalTag, KeyvalText } from "@/design.system"; +import { CardWrapper } from "./sources.manage.styled"; +import theme from "@/styles/palette"; +import { KIND_COLORS } from "@/styles/global"; +import { SOURCES_LOGOS } from "@/assets/images"; +import { ManagedSource } from "@/types/sources"; + +const TEXT_STYLE: React.CSSProperties = { + textOverflow: "ellipsis", + whiteSpace: "nowrap", + overflow: "hidden", + width: 224, + textAlign: "center", +}; +const LOGO_STYLE: React.CSSProperties = { + padding: 4, + backgroundColor: theme.colors.white, +}; + +interface SourceManagedCardProps { + item: ManagedSource | null; +} +const DEPLOYMENT = "Deployment"; +export default function SourceManagedCard({ + item = null, +}: SourceManagedCardProps) { + return ( + + + + {item?.name} + + + + {item?.namespace} + + + ); +} diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx new file mode 100644 index 000000000..9d7b4bded --- /dev/null +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx @@ -0,0 +1,24 @@ +import React from "react"; +import { ManagedListWrapper, EmptyListWrapper } from "./sources.manage.styled"; +import Empty from "@/assets/images/empty-list.svg"; +import SourceManagedCard from "./sources.manage.card"; + +export function SourcesManagedList({ data = [1, 1, 1, 1] }) { + function renderDestinations() { + return data.map((source: any) => ); + } + + return ( + <> + + {data?.length === 0 ? ( + + + + ) : ( + renderDestinations() + )} + + + ); +} diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx new file mode 100644 index 000000000..cb4f81c3a --- /dev/null +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx @@ -0,0 +1,38 @@ +import { styled } from "styled-components"; + +export const CardWrapper = styled.div` + display: flex; + width: 272px; + height: 152px; + padding-top: 32px; + padding-bottom: 24px; + border-radius: 24px; + border: 1px solid var(--dark-mode-dark-3, #203548); + background: var(--dark-mode-dark-1, #07111a); + align-items: center; + flex-direction: column; + gap: 10px; + cursor: pointer; + &:hover { + background: var(--dark-mode-dark-1, #07111a81); + } +`; + +export const EmptyListWrapper = styled.div` + width: 100%; + margin-top: 130px; + display: flex; + justify-content: center; + align-items: center; +`; + +export const ManagedListWrapper = styled.div` + width: 100%; + display: flex; + flex-wrap: wrap; + gap: 24px; + overflow-y: scroll; + padding: 0px 36px; + padding-bottom: 50px; + margin-top: 88px; +`; diff --git a/frontend/webapp/components/setup/sources/source.card/source.card.tsx b/frontend/webapp/components/setup/sources/source.card/source.card.tsx index 7f36f2877..2aa3dc664 100644 --- a/frontend/webapp/components/setup/sources/source.card/source.card.tsx +++ b/frontend/webapp/components/setup/sources/source.card/source.card.tsx @@ -12,11 +12,7 @@ import { } from "./source.card.styled"; import Logo from "assets/logos/code-sandbox-logo.svg"; import { SETUP } from "@/utils/constants"; - -const KIND_COLORS = { - deployment: "#203548", - DaemonSet: "#033869", -}; +import { KIND_COLORS } from "@/styles/global"; const TEXT_STYLE = { textOverflow: "ellipsis", diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index 541fb8d21..9164e2704 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -4,7 +4,7 @@ import { KeyvalLoader } from "@/design.system"; import { OVERVIEW, QUERIES } from "@/utils/constants"; import { useQuery } from "react-query"; import { getSources } from "@/services"; -import { OverviewHeader } from "@/components/overview"; +import { OverviewHeader, SourcesManagedList } from "@/components/overview"; import { SourcesContainerWrapper } from "./sources.styled"; export function SourcesContainer() { @@ -17,10 +17,12 @@ export function SourcesContainer() { if (isLoading) { return ; } + console.log({ sources }); return ( + ); } diff --git a/frontend/webapp/styles/global.tsx b/frontend/webapp/styles/global.tsx new file mode 100644 index 000000000..67bd1e72b --- /dev/null +++ b/frontend/webapp/styles/global.tsx @@ -0,0 +1,5 @@ +export const KIND_COLORS = { + deployment: "#203548", + Deployment: "#203548", + DaemonSet: "#033869", +}; diff --git a/frontend/webapp/types/sources.tsx b/frontend/webapp/types/sources.tsx new file mode 100644 index 000000000..53f44fe6e --- /dev/null +++ b/frontend/webapp/types/sources.tsx @@ -0,0 +1,11 @@ +export interface ManagedSource { + kind: string; + name: string; + namespace: string; + languages: [ + { + container_name: string; + language: string; + } + ]; +} From 0c4b42edc4b76f289d7d2c7851ebc38576c6deb1 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 30 Jul 2023 13:57:20 +0300 Subject: [PATCH 004/374] fixed pr comments --- frontend/webapp/assets/images/sources.card/sources.card.tsx | 1 + .../sources/sources.manage.list/sources.manage.card.tsx | 4 ++-- .../components/setup/sources/source.card/source.card.tsx | 5 ++++- frontend/webapp/styles/global.tsx | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/webapp/assets/images/sources.card/sources.card.tsx b/frontend/webapp/assets/images/sources.card/sources.card.tsx index d2f593fb7..2316a3529 100644 --- a/frontend/webapp/assets/images/sources.card/sources.card.tsx +++ b/frontend/webapp/assets/images/sources.card/sources.card.tsx @@ -3,4 +3,5 @@ export const SOURCES_LOGOS = { go: "https://odigos-sources.s3.amazonaws.com/go.svg", javascript: "https://odigos-sources.s3.amazonaws.com/nodejs.svg", python: "https://odigos-sources.s3.amazonaws.com/python.svg", + dotnet: "https://odigos-sources.s3.amazonaws.com/dotnet.svg", }; diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx index dbd8fe628..d22c3e18e 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx @@ -21,7 +21,7 @@ const LOGO_STYLE: React.CSSProperties = { interface SourceManagedCardProps { item: ManagedSource | null; } -const DEPLOYMENT = "Deployment"; +const DEPLOYMENT = "deployment"; export default function SourceManagedCard({ item = null, }: SourceManagedCardProps) { @@ -39,7 +39,7 @@ export default function SourceManagedCard({ {item?.namespace} diff --git a/frontend/webapp/components/setup/sources/source.card/source.card.tsx b/frontend/webapp/components/setup/sources/source.card/source.card.tsx index 2aa3dc664..e61fb01c6 100644 --- a/frontend/webapp/components/setup/sources/source.card/source.card.tsx +++ b/frontend/webapp/components/setup/sources/source.card/source.card.tsx @@ -33,7 +33,10 @@ export function SourceCard({ item, onClick, focus }: any) { {item.name} - + {`${item?.instances} ${SETUP.RUNNING_INSTANCES}`} diff --git a/frontend/webapp/styles/global.tsx b/frontend/webapp/styles/global.tsx index 67bd1e72b..74df89a53 100644 --- a/frontend/webapp/styles/global.tsx +++ b/frontend/webapp/styles/global.tsx @@ -1,5 +1,5 @@ export const KIND_COLORS = { deployment: "#203548", - Deployment: "#203548", - DaemonSet: "#033869", + daemonSet: "#033869", + statefulset: "#0F2C3F", }; From d5fe6309cc3c1cc944629ddff242bd21eac54034 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 30 Jul 2023 14:00:43 +0300 Subject: [PATCH 005/374] fixed pr comments --- .../sources/sources.manage.list/sources.manage.card.tsx | 6 +++--- frontend/webapp/containers/overview/sources/sources.tsx | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx index d22c3e18e..c59ebf307 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx @@ -19,11 +19,11 @@ const LOGO_STYLE: React.CSSProperties = { }; interface SourceManagedCardProps { - item: ManagedSource | null; + item: ManagedSource; } const DEPLOYMENT = "deployment"; export default function SourceManagedCard({ - item = null, + item = {} as ManagedSource, }: SourceManagedCardProps) { return ( @@ -38,7 +38,7 @@ export default function SourceManagedCard({ {item?.name} diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index 9164e2704..146e2849c 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -17,7 +17,6 @@ export function SourcesContainer() { if (isLoading) { return ; } - console.log({ sources }); return ( From 55043486a3dec9bcf2fba8d26e9e3be7eea1192c Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 30 Jul 2023 14:33:49 +0300 Subject: [PATCH 006/374] sources list display --- .../sources.manage.card.tsx | 4 +- .../sources.manage.list.tsx | 43 ++++++++++++------- .../sources.manage.styled.tsx | 15 ++++--- .../overview/sources/sources.styled.tsx | 2 +- .../containers/overview/sources/sources.tsx | 2 +- 5 files changed, 41 insertions(+), 25 deletions(-) diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx index c59ebf307..09327bf95 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx @@ -28,7 +28,7 @@ export default function SourceManagedCard({ return ( {item?.namespace} diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx index 9d7b4bded..143798d1d 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx @@ -1,24 +1,35 @@ import React from "react"; -import { ManagedListWrapper, EmptyListWrapper } from "./sources.manage.styled"; +import { + ManagedListWrapper, + EmptyListWrapper, + ManagedContainer, +} from "./sources.manage.styled"; import Empty from "@/assets/images/empty-list.svg"; import SourceManagedCard from "./sources.manage.card"; +import { ManagedSource } from "@/types/sources"; +import { KeyvalText } from "@/design.system"; +import { OVERVIEW } from "@/utils/constants"; -export function SourcesManagedList({ data = [1, 1, 1, 1] }) { - function renderDestinations() { - return data.map((source: any) => ); +interface SourcesManagedListProps { + data: ManagedSource[]; +} + +export function SourcesManagedList({ data = [] }: SourcesManagedListProps) { + function renderSources() { + return data.map((source: ManagedSource) => ( + + )); } - return ( - <> - - {data?.length === 0 ? ( - - - - ) : ( - renderDestinations() - )} - - + return data?.length === 0 ? ( + + + + ) : ( + + {`${data.length} ${OVERVIEW.MENU.SOURCES}`} +
+ {renderSources()} +
); } diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx index cb4f81c3a..12350c2a4 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx @@ -12,10 +12,10 @@ export const CardWrapper = styled.div` align-items: center; flex-direction: column; gap: 10px; - cursor: pointer; + /* cursor: pointer; &:hover { background: var(--dark-mode-dark-1, #07111a81); - } + } */ `; export const EmptyListWrapper = styled.div` @@ -27,12 +27,17 @@ export const EmptyListWrapper = styled.div` `; export const ManagedListWrapper = styled.div` - width: 100%; + height: 80%; display: flex; flex-wrap: wrap; gap: 24px; + padding: 0 36px 0 0; overflow-y: scroll; +`; + +export const ManagedContainer = styled.div` + width: 100%; + height: 100%; + margin-top: 120px; padding: 0px 36px; - padding-bottom: 50px; - margin-top: 88px; `; diff --git a/frontend/webapp/containers/overview/sources/sources.styled.tsx b/frontend/webapp/containers/overview/sources/sources.styled.tsx index 4c8ff6466..c361682ec 100644 --- a/frontend/webapp/containers/overview/sources/sources.styled.tsx +++ b/frontend/webapp/containers/overview/sources/sources.styled.tsx @@ -3,5 +3,5 @@ import styled from "styled-components"; export const SourcesContainerWrapper = styled.div` height: 100vh; width: 100%; - overflow-y: scroll; + overflow: hidden; `; diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index 146e2849c..784be7026 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -21,7 +21,7 @@ export function SourcesContainer() { return ( - + ); } From ae80c0a3abf1c0cf597ea4ef49898ac2dd0055ac Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 30 Jul 2023 14:54:49 +0300 Subject: [PATCH 007/374] change image url to cloud front --- .../assets/images/sources.card/sources.card.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/webapp/assets/images/sources.card/sources.card.tsx b/frontend/webapp/assets/images/sources.card/sources.card.tsx index 2316a3529..6cbc10d4c 100644 --- a/frontend/webapp/assets/images/sources.card/sources.card.tsx +++ b/frontend/webapp/assets/images/sources.card/sources.card.tsx @@ -1,7 +1,9 @@ +const BASE_URL = "https://d1n7d4xz7fr8b4.cloudfront.net/"; + export const SOURCES_LOGOS = { - java: "https://odigos-sources.s3.amazonaws.com/java.svg", - go: "https://odigos-sources.s3.amazonaws.com/go.svg", - javascript: "https://odigos-sources.s3.amazonaws.com/nodejs.svg", - python: "https://odigos-sources.s3.amazonaws.com/python.svg", - dotnet: "https://odigos-sources.s3.amazonaws.com/dotnet.svg", + java: `${BASE_URL}java.svg`, + go: `${BASE_URL}go.svg`, + javascript: `${BASE_URL}nodejs.svg`, + python: `${BASE_URL}python.svg`, + dotnet: `${BASE_URL}dotnet.svg`, }; From 79f2c537aff57792f29c1d74ee3b51253c7950d8 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 30 Jul 2023 15:24:09 +0300 Subject: [PATCH 008/374] fixed pr comments --- frontend/webapp/assets/images/index.tsx | 2 +- frontend/webapp/assets/images/sources.card/sources.card.tsx | 2 +- .../sources/sources.manage.list/sources.manage.card.tsx | 4 ++-- .../sources/sources.manage.list/sources.manage.list.tsx | 2 +- .../components/setup/sources/source.card/source.card.tsx | 2 +- frontend/webapp/styles/global.tsx | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/webapp/assets/images/index.tsx b/frontend/webapp/assets/images/index.tsx index 9e85a0357..7f87c490b 100644 --- a/frontend/webapp/assets/images/index.tsx +++ b/frontend/webapp/assets/images/index.tsx @@ -1 +1 @@ -export { SOURCES_LOGOS } from "./sources.card/sources.card"; +export { LANGUAGES_LOGOS } from "./sources.card/sources.card"; diff --git a/frontend/webapp/assets/images/sources.card/sources.card.tsx b/frontend/webapp/assets/images/sources.card/sources.card.tsx index 6cbc10d4c..ac83faf6f 100644 --- a/frontend/webapp/assets/images/sources.card/sources.card.tsx +++ b/frontend/webapp/assets/images/sources.card/sources.card.tsx @@ -1,6 +1,6 @@ const BASE_URL = "https://d1n7d4xz7fr8b4.cloudfront.net/"; -export const SOURCES_LOGOS = { +export const LANGUAGES_LOGOS = { java: `${BASE_URL}java.svg`, go: `${BASE_URL}go.svg`, javascript: `${BASE_URL}nodejs.svg`, diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx index 09327bf95..1aa8f559b 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx @@ -3,7 +3,7 @@ import { KeyvalImage, KeyvalTag, KeyvalText } from "@/design.system"; import { CardWrapper } from "./sources.manage.styled"; import theme from "@/styles/palette"; import { KIND_COLORS } from "@/styles/global"; -import { SOURCES_LOGOS } from "@/assets/images"; +import { LANGUAGES_LOGOS } from "@/assets/images"; import { ManagedSource } from "@/types/sources"; const TEXT_STYLE: React.CSSProperties = { @@ -28,7 +28,7 @@ export default function SourceManagedCard({ return ( diff --git a/frontend/webapp/components/setup/sources/source.card/source.card.tsx b/frontend/webapp/components/setup/sources/source.card/source.card.tsx index e61fb01c6..44e56dd19 100644 --- a/frontend/webapp/components/setup/sources/source.card/source.card.tsx +++ b/frontend/webapp/components/setup/sources/source.card/source.card.tsx @@ -35,7 +35,7 @@ export function SourceCard({ item, onClick, focus }: any) { {`${item?.instances} ${SETUP.RUNNING_INSTANCES}`} diff --git a/frontend/webapp/styles/global.tsx b/frontend/webapp/styles/global.tsx index 74df89a53..1f138e123 100644 --- a/frontend/webapp/styles/global.tsx +++ b/frontend/webapp/styles/global.tsx @@ -1,5 +1,5 @@ export const KIND_COLORS = { deployment: "#203548", - daemonSet: "#033869", + daemonset: "#033869", statefulset: "#0F2C3F", }; From 5fffc40d44a40588873cc390eb8cca6099cfb3bb Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 30 Jul 2023 16:03:56 +0300 Subject: [PATCH 009/374] add new action menu --- frontend/webapp/components/overview/index.tsx | 1 + .../sources.action.menu.styled.tsx | 12 +++++++++ .../action.menu/sources.action.menu.tsx | 25 +++++++++++++++++++ .../sources.manage.styled.tsx | 3 +-- .../overview/sources/sources.styled.tsx | 4 +++ .../containers/overview/sources/sources.tsx | 12 +++++++-- frontend/webapp/utils/constants/string.tsx | 1 + 7 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx create mode 100644 frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx diff --git a/frontend/webapp/components/overview/index.tsx b/frontend/webapp/components/overview/index.tsx index 799574495..d6c9f8384 100644 --- a/frontend/webapp/components/overview/index.tsx +++ b/frontend/webapp/components/overview/index.tsx @@ -2,3 +2,4 @@ export { OverviewHeader } from "./overview.header/overview.header"; export { ManageDestination } from "./destination/manage.destination/manage.destination"; export { DestinationsManagedList } from "./destination/destination.list/destinations.managed.list"; export { SourcesManagedList } from "./sources/sources.manage.list/sources.manage.list"; +export { SourcesActionMenu } from "./sources/action.menu/sources.action.menu"; diff --git a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx new file mode 100644 index 000000000..9d6007d42 --- /dev/null +++ b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx @@ -0,0 +1,12 @@ +import styled from "styled-components"; + +export const SourcesMenuWrapper = styled.div` + width: 100%; + height: 68px; + padding-top: 88px; + display: flex; + align-items: center; + justify-content: space-between; +`; + +export const InputsWrapper = styled.div``; diff --git a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx new file mode 100644 index 000000000..2f373f499 --- /dev/null +++ b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx @@ -0,0 +1,25 @@ +import React from "react"; +import { + InputsWrapper, + SourcesMenuWrapper, +} from "./sources.action.menu.styled"; +import { KeyvalButton, KeyvalText } from "@/design.system"; +import { Plus } from "@/assets/icons/overview"; +import { OVERVIEW } from "@/utils/constants"; +import theme from "@/styles/palette"; +const BUTTON_STYLES = { gap: 10, height: 40 }; +export function SourcesActionMenu() { + return ( + + + + + + + + {OVERVIEW.ADD_NEW_SOURCE} + + + + ); +} diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx index 12350c2a4..ffbdffed2 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx @@ -27,7 +27,7 @@ export const EmptyListWrapper = styled.div` `; export const ManagedListWrapper = styled.div` - height: 80%; + height: 75%; display: flex; flex-wrap: wrap; gap: 24px; @@ -38,6 +38,5 @@ export const ManagedListWrapper = styled.div` export const ManagedContainer = styled.div` width: 100%; height: 100%; - margin-top: 120px; padding: 0px 36px; `; diff --git a/frontend/webapp/containers/overview/sources/sources.styled.tsx b/frontend/webapp/containers/overview/sources/sources.styled.tsx index c361682ec..d65459093 100644 --- a/frontend/webapp/containers/overview/sources/sources.styled.tsx +++ b/frontend/webapp/containers/overview/sources/sources.styled.tsx @@ -5,3 +5,7 @@ export const SourcesContainerWrapper = styled.div` width: 100%; overflow: hidden; `; + +export const MenuWrapper = styled.div` + padding: 0 32px; +`; diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index 784be7026..256c57981 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -4,8 +4,12 @@ import { KeyvalLoader } from "@/design.system"; import { OVERVIEW, QUERIES } from "@/utils/constants"; import { useQuery } from "react-query"; import { getSources } from "@/services"; -import { OverviewHeader, SourcesManagedList } from "@/components/overview"; -import { SourcesContainerWrapper } from "./sources.styled"; +import { + OverviewHeader, + SourcesActionMenu, + SourcesManagedList, +} from "@/components/overview"; +import { SourcesContainerWrapper, MenuWrapper } from "./sources.styled"; export function SourcesContainer() { const { @@ -21,6 +25,10 @@ export function SourcesContainer() { return ( + + + + ); diff --git a/frontend/webapp/utils/constants/string.tsx b/frontend/webapp/utils/constants/string.tsx index b16b6a9eb..8591b7e1a 100644 --- a/frontend/webapp/utils/constants/string.tsx +++ b/frontend/webapp/utils/constants/string.tsx @@ -62,6 +62,7 @@ export const OVERVIEW = { SOURCES: "Sources", DESTINATIONS: "Destinations", }, + ADD_NEW_SOURCE: "Add New Source", ADD_NEW_DESTINATION: "Add New Destination", DESTINATION_UPDATE_SUCCESS: "Destination updated successfully", DESTINATION_CREATED_SUCCESS: "Destination created successfully", From 18cd5c427a5c29f2d22d0cfaf08e0e9f770203d2 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 30 Jul 2023 17:25:10 +0300 Subject: [PATCH 010/374] on add btn click --- .../sources.action.menu.styled.tsx | 3 +-- .../action.menu/sources.action.menu.tsx | 12 ++++----- .../overview/sources/new.source.flow.tsx | 27 +++++++++++++++++++ .../overview/sources/sources.styled.tsx | 14 ++++++++++ .../containers/overview/sources/sources.tsx | 24 ++++++++++++----- 5 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 frontend/webapp/containers/overview/sources/new.source.flow.tsx diff --git a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx index 9d6007d42..610dedddb 100644 --- a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx +++ b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx @@ -2,10 +2,9 @@ import styled from "styled-components"; export const SourcesMenuWrapper = styled.div` width: 100%; - height: 68px; + margin-top: 32px; padding-top: 88px; display: flex; - align-items: center; justify-content: space-between; `; diff --git a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx index 2f373f499..7d13296f9 100644 --- a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx +++ b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx @@ -7,14 +7,14 @@ import { KeyvalButton, KeyvalText } from "@/design.system"; import { Plus } from "@/assets/icons/overview"; import { OVERVIEW } from "@/utils/constants"; import theme from "@/styles/palette"; -const BUTTON_STYLES = { gap: 10, height: 40 }; -export function SourcesActionMenu() { + +const BUTTON_STYLES = { gap: 10, height: 36 }; + +export function SourcesActionMenu({ onAddClick }) { return ( - - - - + + {OVERVIEW.ADD_NEW_SOURCE} diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx new file mode 100644 index 000000000..79657962d --- /dev/null +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -0,0 +1,27 @@ +import React from "react"; +import { useSectionData } from "@/hooks"; +import { SourcesSectionWrapper, ButtonWrapper } from "./sources.styled"; +import { SourcesSection } from "@/containers/setup/sources/sources.section"; +import { KeyvalButton, KeyvalText } from "@/design.system"; +import theme from "@/styles/palette"; +import { SETUP } from "@/utils/constants"; + +export function NewSourceFlow() { + const { sectionData, setSectionData, totalSelected } = useSectionData({}); + return ( + + + {`${totalSelected} ${SETUP.SELECTED}`} + + + Connect + + + + + + ); +} diff --git a/frontend/webapp/containers/overview/sources/sources.styled.tsx b/frontend/webapp/containers/overview/sources/sources.styled.tsx index d65459093..c3fa07df0 100644 --- a/frontend/webapp/containers/overview/sources/sources.styled.tsx +++ b/frontend/webapp/containers/overview/sources/sources.styled.tsx @@ -9,3 +9,17 @@ export const SourcesContainerWrapper = styled.div` export const MenuWrapper = styled.div` padding: 0 32px; `; + +export const SourcesSectionWrapper = styled(MenuWrapper)` + margin-top: 88px; + position: relative; +`; + +export const ButtonWrapper = styled.div` + position: absolute; + display: flex; + align-items: center; + gap: 16px; + right: 32px; + top: 40px; +`; diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index 256c57981..1849c2c33 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -1,5 +1,5 @@ "use client"; -import React from "react"; +import React, { useState } from "react"; import { KeyvalLoader } from "@/design.system"; import { OVERVIEW, QUERIES } from "@/utils/constants"; import { useQuery } from "react-query"; @@ -10,14 +10,21 @@ import { SourcesManagedList, } from "@/components/overview"; import { SourcesContainerWrapper, MenuWrapper } from "./sources.styled"; +import { NewSourceFlow } from "./new.source.flow"; export function SourcesContainer() { + const [newFlow, setNewFlow] = useState(false); + const { data: sources, refetch, isLoading, } = useQuery([QUERIES.API_SOURCES], getSources); + function renderNewSourceFlow() { + return ; + } + if (isLoading) { return ; } @@ -25,11 +32,16 @@ export function SourcesContainer() { return ( - - - - - + {newFlow ? ( + renderNewSourceFlow() + ) : ( + <> + + setNewFlow(true)} /> + + + + )} ); } From ab642bdbe3c4b4eeed1ac9442365f2ed0a56a81d Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 30 Jul 2023 17:30:19 +0300 Subject: [PATCH 011/374] WIP --- .../overview/sources/new.source.flow.tsx | 1 + .../containers/overview/sources/sources.tsx | 24 ++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx index 79657962d..c77035124 100644 --- a/frontend/webapp/containers/overview/sources/new.source.flow.tsx +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -8,6 +8,7 @@ import { SETUP } from "@/utils/constants"; export function NewSourceFlow() { const { sectionData, setSectionData, totalSelected } = useSectionData({}); + return ( diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index 1849c2c33..2d3af77cb 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -13,7 +13,7 @@ import { SourcesContainerWrapper, MenuWrapper } from "./sources.styled"; import { NewSourceFlow } from "./new.source.flow"; export function SourcesContainer() { - const [newFlow, setNewFlow] = useState(false); + const [displayNewSourceFlow, setDisplayNewSourceFlow] = useState(false); const { data: sources, @@ -25,6 +25,17 @@ export function SourcesContainer() { return ; } + function renderSources() { + return ( + <> + + setDisplayNewSourceFlow(true)} /> + + + + ); + } + if (isLoading) { return ; } @@ -32,16 +43,7 @@ export function SourcesContainer() { return ( - {newFlow ? ( - renderNewSourceFlow() - ) : ( - <> - - setNewFlow(true)} /> - - - - )} + {displayNewSourceFlow ? renderNewSourceFlow() : renderSources()} ); } From 64c31c44236c0a8b9e0c0e9c88761fbc0cab26db Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 31 Jul 2023 10:04:00 +0300 Subject: [PATCH 012/374] restructe source filter option --- .../action.sources.options.tsx | 45 +++++++++++ .../filter.sources.options.tsx | 32 ++++++++ .../sources.option.menu.styled.tsx | 4 + .../sources.option.menu.tsx | 76 ++++--------------- .../overview/sources/new.source.flow.tsx | 27 ++++++- 5 files changed, 120 insertions(+), 64 deletions(-) create mode 100644 frontend/webapp/components/setup/sources/sources.option.menu/action.sources.options.tsx create mode 100644 frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/action.sources.options.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/action.sources.options.tsx new file mode 100644 index 000000000..41df23b50 --- /dev/null +++ b/frontend/webapp/components/setup/sources/sources.option.menu/action.sources.options.tsx @@ -0,0 +1,45 @@ +import React, { useEffect, useState } from "react"; +import { CheckboxWrapper, SwitcherWrapper } from "./sources.option.menu.styled"; +import { KeyvalCheckbox, KeyvalSwitch, KeyvalTooltip } from "@/design.system"; +import { SETUP } from "@/utils/constants"; + +export function ActionSourcesOptions({ + onSelectAllChange, + selectedApplications, + currentNamespace, + onFutureApplyChange, +}: any) { + const [checked, setChecked] = useState(false); + const [toggle, setToggle] = useState(false); + + useEffect(() => { + setToggle(selectedApplications[currentNamespace?.name]?.selected_all); + setChecked(selectedApplications[currentNamespace?.name]?.future_selected); + }, [currentNamespace, selectedApplications]); + + const handleToggleChange = () => { + onSelectAllChange(!toggle); + setToggle(!toggle); + }; + + return ( + <> + + + + + onFutureApplyChange(!checked)} + disabled={!toggle} + /> + + + + ); +} diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx new file mode 100644 index 000000000..d39fa2e7a --- /dev/null +++ b/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx @@ -0,0 +1,32 @@ +import React from "react"; +import { DropdownWrapper } from "./sources.option.menu.styled"; +import { KeyvalDropDown, KeyvalSearchInput, KeyvalText } from "@/design.system"; +import { SETUP } from "@/utils/constants"; + +export function FilterSourcesOptions({ + setCurrentItem, + data, + searchFilter, + setSearchFilter, +}: any) { + function handleDropDownChange(item: any) { + setCurrentItem({ id: item?.id, name: item.label }); + } + + return ( + <> + setSearchFilter(e.target.value)} + /> + + {SETUP.MENU.NAMESPACES} + + + + ); +} diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx index ea3d424b1..8add463bc 100644 --- a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx +++ b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx @@ -5,6 +5,10 @@ export const SourcesOptionMenuWrapper = styled.section` align-items: center; gap: 24px; padding: 40px 0 0 0; + @media screen and (max-width: 1400px) { + flex-wrap: wrap; + width: 90%; + } `; export const DropdownWrapper = styled.div` diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.tsx index 090e3b7e8..978a69c40 100644 --- a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.tsx +++ b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.tsx @@ -1,19 +1,7 @@ -import React, { useEffect, useState } from "react"; -import { - DropdownWrapper, - SourcesOptionMenuWrapper, - CheckboxWrapper, - SwitcherWrapper, -} from "./sources.option.menu.styled"; -import { - KeyvalCheckbox, - KeyvalDropDown, - KeyvalSearchInput, - KeyvalSwitch, - KeyvalText, - KeyvalTooltip, -} from "@/design.system"; -import { SETUP } from "@/utils/constants"; +import React from "react"; +import { SourcesOptionMenuWrapper } from "./sources.option.menu.styled"; +import { FilterSourcesOptions } from "./filter.sources.options"; +import { ActionSourcesOptions } from "./action.sources.options"; export function SourcesOptionMenu({ setCurrentItem, @@ -25,54 +13,20 @@ export function SourcesOptionMenu({ currentNamespace, onFutureApplyChange, }: any) { - const [checked, setChecked] = useState(false); - const [toggle, setToggle] = useState(false); - - useEffect(() => { - setToggle(selectedApplications[currentNamespace?.name]?.selected_all); - setChecked(selectedApplications[currentNamespace?.name]?.future_selected); - }, [currentNamespace, selectedApplications]); - - const handleToggleChange = () => { - onSelectAllChange(!toggle); - setToggle(!toggle); - }; - - function handleDropDownChange(item: any) { - setCurrentItem({ id: item?.id, name: item.label }); - } - return ( - setSearchFilter(e.target.value)} + + - - - {SETUP.MENU.NAMESPACES} - - - - - - - onFutureApplyChange(!checked)} - disabled={!toggle} - /> - - ); } diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx index c77035124..a43290b5e 100644 --- a/frontend/webapp/containers/overview/sources/new.source.flow.tsx +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -1,19 +1,39 @@ import React from "react"; -import { useSectionData } from "@/hooks"; +import { useNotification, useSectionData } from "@/hooks"; import { SourcesSectionWrapper, ButtonWrapper } from "./sources.styled"; import { SourcesSection } from "@/containers/setup/sources/sources.section"; import { KeyvalButton, KeyvalText } from "@/design.system"; import theme from "@/styles/palette"; -import { SETUP } from "@/utils/constants"; +import { NOTIFICATION, SETUP } from "@/utils/constants"; +import { useMutation } from "react-query"; +import { setNamespaces } from "@/services"; export function NewSourceFlow() { const { sectionData, setSectionData, totalSelected } = useSectionData({}); + const { mutate } = useMutation((body) => setNamespaces(body)); + const { show, Notification } = useNotification(); + + function handleNewSource() { + mutate(sectionData, { + onSuccess: () => { + setSectionData({}); + }, + onError: ({ response }) => { + const message = response?.data?.message || SETUP.ERROR; + console.log({ response }); + show({ + type: NOTIFICATION.ERROR, + message, + }); + }, + }); + } return ( {`${totalSelected} ${SETUP.SELECTED}`} - + Connect @@ -23,6 +43,7 @@ export function NewSourceFlow() { sectionData={sectionData} setSectionData={setSectionData} /> + ); } From 419228952ded21b560939783bef3419e44296a52 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 31 Jul 2023 11:19:08 +0300 Subject: [PATCH 013/374] filters --- .../sources.action.menu.styled.tsx | 7 +- .../action.menu/sources.action.menu.tsx | 18 ++++- .../filter.sources.options.tsx | 9 ++- .../sources.option.menu.styled.tsx | 7 ++ .../overview/sources/manage.sources.tsx | 78 +++++++++++++++++++ .../containers/overview/sources/sources.tsx | 33 ++------ .../design.system/drop.down/drop.down.tsx | 4 + 7 files changed, 121 insertions(+), 35 deletions(-) create mode 100644 frontend/webapp/containers/overview/sources/manage.sources.tsx diff --git a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx index 610dedddb..dbf2e0d97 100644 --- a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx +++ b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx @@ -2,10 +2,13 @@ import styled from "styled-components"; export const SourcesMenuWrapper = styled.div` width: 100%; - margin-top: 32px; + margin: 32px 0; padding-top: 88px; display: flex; justify-content: space-between; `; -export const InputsWrapper = styled.div``; +export const InputsWrapper = styled.div` + display: flex; + gap: 16px; +`; diff --git a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx index 7d13296f9..bc1b0faa8 100644 --- a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx +++ b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx @@ -7,13 +7,27 @@ import { KeyvalButton, KeyvalText } from "@/design.system"; import { Plus } from "@/assets/icons/overview"; import { OVERVIEW } from "@/utils/constants"; import theme from "@/styles/palette"; +import { FilterSourcesOptions } from "@/components/setup/sources/sources.option.menu/filter.sources.options"; const BUTTON_STYLES = { gap: 10, height: 36 }; -export function SourcesActionMenu({ onAddClick }) { +export function SourcesActionMenu({ + onAddClick, + setCurrentItem, + data = [], + searchFilter, + setSearchFilter, +}) { return ( - + + + diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx index d39fa2e7a..9b5934c2b 100644 --- a/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx +++ b/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx @@ -1,5 +1,8 @@ import React from "react"; -import { DropdownWrapper } from "./sources.option.menu.styled"; +import { + DropdownWrapper, + FilterMenuWrapper, +} from "./sources.option.menu.styled"; import { KeyvalDropDown, KeyvalSearchInput, KeyvalText } from "@/design.system"; import { SETUP } from "@/utils/constants"; @@ -14,7 +17,7 @@ export function FilterSourcesOptions({ } return ( - <> + setSearchFilter(e.target.value)} @@ -27,6 +30,6 @@ export function FilterSourcesOptions({ onChange={handleDropDownChange} /> - + ); } diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx index 8add463bc..33ae15b5f 100644 --- a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx +++ b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx @@ -5,6 +5,13 @@ export const SourcesOptionMenuWrapper = styled.section` align-items: center; gap: 24px; padding: 40px 0 0 0; +`; + +export const FilterMenuWrapper = styled.div` + display: flex; + gap: 16px; + align-items: center; + @media screen and (max-width: 1400px) { flex-wrap: wrap; width: 90%; diff --git a/frontend/webapp/containers/overview/sources/manage.sources.tsx b/frontend/webapp/containers/overview/sources/manage.sources.tsx new file mode 100644 index 000000000..85fbef48e --- /dev/null +++ b/frontend/webapp/containers/overview/sources/manage.sources.tsx @@ -0,0 +1,78 @@ +"use client"; +import React, { useEffect, useMemo, useState } from "react"; +import { KeyvalLoader } from "@/design.system"; +import { QUERIES } from "@/utils/constants"; +import { useQuery } from "react-query"; +import { getNamespaces, getSources } from "@/services"; +import { SourcesActionMenu, SourcesManagedList } from "@/components/overview"; +import { MenuWrapper } from "./sources.styled"; +import { ManagedSource } from "@/types/sources"; + +export function ManageSources({ setDisplayNewSourceFlow }) { + const [searchFilter, setSearchFilter] = useState(""); + const [currentNamespace, setCurrentNamespace] = useState(null); + + const { data: namespaces } = useQuery( + [QUERIES.API_NAMESPACES], + getNamespaces + ); + + useEffect(() => { + setSearchFilter(""); + }, [currentNamespace]); + + const namespacesList = useMemo( + () => + namespaces?.namespaces?.map((item: any, index: number) => ({ + id: index, + label: item.name, + })), + [namespaces] + ); + + const { + data: sources, + refetch, + isLoading, + } = useQuery([QUERIES.API_SOURCES], getSources); + + function filterByNamespace() { + return currentNamespace + ? sources?.filter( + (item: ManagedSource) => item.namespace === currentNamespace.name + ) + : sources; + } + + function filterBySearchQuery(data) { + return searchFilter + ? data?.filter((item: ManagedSource) => + item.name.toLowerCase().includes(searchFilter.toLowerCase()) + ) + : data; + } + + function filterSources() { + let data = filterByNamespace(); + return filterBySearchQuery(data); + } + + if (isLoading) { + return ; + } + + return ( + <> + + setDisplayNewSourceFlow(true)} + setCurrentItem={setCurrentNamespace} + /> + + + + ); +} diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index 2d3af77cb..d48cacf72 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -1,43 +1,20 @@ "use client"; import React, { useState } from "react"; -import { KeyvalLoader } from "@/design.system"; -import { OVERVIEW, QUERIES } from "@/utils/constants"; -import { useQuery } from "react-query"; -import { getSources } from "@/services"; -import { - OverviewHeader, - SourcesActionMenu, - SourcesManagedList, -} from "@/components/overview"; -import { SourcesContainerWrapper, MenuWrapper } from "./sources.styled"; +import { OVERVIEW } from "@/utils/constants"; +import { OverviewHeader } from "@/components/overview"; +import { SourcesContainerWrapper } from "./sources.styled"; import { NewSourceFlow } from "./new.source.flow"; +import { ManageSources } from "./manage.sources"; export function SourcesContainer() { const [displayNewSourceFlow, setDisplayNewSourceFlow] = useState(false); - const { - data: sources, - refetch, - isLoading, - } = useQuery([QUERIES.API_SOURCES], getSources); - function renderNewSourceFlow() { return ; } function renderSources() { - return ( - <> - - setDisplayNewSourceFlow(true)} /> - - - - ); - } - - if (isLoading) { - return ; + return ; } return ( diff --git a/frontend/webapp/design.system/drop.down/drop.down.tsx b/frontend/webapp/design.system/drop.down/drop.down.tsx index 78cf1bb68..201b176b4 100644 --- a/frontend/webapp/design.system/drop.down/drop.down.tsx +++ b/frontend/webapp/design.system/drop.down/drop.down.tsx @@ -44,6 +44,10 @@ export function KeyvalDropDown({ const containerRef = useRef(null); + useEffect(() => { + value && setSelectedItem(value); + }, [value]); + useEffect(() => { document.addEventListener("click", handleClickOutside, true); return () => { From 1006d4436a6f5ea65e293a1066baff3bf5bdf04b Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 31 Jul 2023 11:50:14 +0300 Subject: [PATCH 014/374] WIP --- .../destination.list.styled.tsx | 1 - .../overview.header/overview.header.tsx | 27 ++++++++++++++----- .../sources.action.menu.styled.tsx | 1 - .../destination/destination.styled.tsx | 1 - .../overview/overview/overview.styled.tsx | 1 - .../overview/sources/new.source.flow.tsx | 4 +-- .../overview/sources/sources.styled.tsx | 1 - frontend/webapp/utils/constants/string.tsx | 1 + 8 files changed, 24 insertions(+), 13 deletions(-) diff --git a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx index 2ed90d51b..c06fdca16 100644 --- a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx @@ -15,7 +15,6 @@ export const MenuWrapper = styled.div` justify-content: space-between; align-items: center; padding: 20px 36px; - margin-top: 88px; `; export const CardWrapper = styled.div` diff --git a/frontend/webapp/components/overview/overview.header/overview.header.tsx b/frontend/webapp/components/overview/overview.header/overview.header.tsx index aa0f9d3ff..a515ec21f 100644 --- a/frontend/webapp/components/overview/overview.header/overview.header.tsx +++ b/frontend/webapp/components/overview/overview.header/overview.header.tsx @@ -1,27 +1,42 @@ import React from "react"; import styled from "styled-components"; import { KeyvalText } from "@/design.system"; +import { Back } from "@/assets/icons/overview"; +import { SETUP } from "@/utils/constants"; export interface OverviewHeaderProps { title?: string; - onClick?: any; + onBackClick?: any; isDisabled?: boolean; } const OverviewHeaderContainer = styled.div` - position: fixed; display: flex; + flex-direction: column; width: 100%; - height: 88px; - align-items: center; - padding: 0 24px; + padding: 24px; border-bottom: 2px solid rgba(255, 255, 255, 0.08); background: ${({ theme }) => theme.colors.light_dark}; `; -export function OverviewHeader({ title }: OverviewHeaderProps) { +const BackButtonWrapper = styled.div` + display: flex; + margin-bottom: 8px; + cursor: pointer; + p { + cursor: pointer !important; + } +`; + +export function OverviewHeader({ title, onBackClick }: OverviewHeaderProps) { return ( + {onBackClick && ( + + + {SETUP.BACK} + + )} {title} diff --git a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx index dbf2e0d97..ee4c046ad 100644 --- a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx +++ b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx @@ -3,7 +3,6 @@ import styled from "styled-components"; export const SourcesMenuWrapper = styled.div` width: 100%; margin: 32px 0; - padding-top: 88px; display: flex; justify-content: space-between; `; diff --git a/frontend/webapp/containers/overview/destination/destination.styled.tsx b/frontend/webapp/containers/overview/destination/destination.styled.tsx index 7933933c5..fd3764d16 100644 --- a/frontend/webapp/containers/overview/destination/destination.styled.tsx +++ b/frontend/webapp/containers/overview/destination/destination.styled.tsx @@ -8,7 +8,6 @@ export const DestinationContainerWrapper = styled.div` export const NewDestinationContainer = styled.div` padding: 20px 36px; - margin-top: 88px; `; export const ManageDestinationWrapper = styled.div` diff --git a/frontend/webapp/containers/overview/overview/overview.styled.tsx b/frontend/webapp/containers/overview/overview/overview.styled.tsx index 59d7a09d1..c152e7642 100644 --- a/frontend/webapp/containers/overview/overview/overview.styled.tsx +++ b/frontend/webapp/containers/overview/overview/overview.styled.tsx @@ -3,5 +3,4 @@ import styled from "styled-components"; export const OverviewDataFlowWrapper = styled.div` width: 100%; height: 100%; - margin-top: 88px; `; diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx index a43290b5e..77f763455 100644 --- a/frontend/webapp/containers/overview/sources/new.source.flow.tsx +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -4,7 +4,7 @@ import { SourcesSectionWrapper, ButtonWrapper } from "./sources.styled"; import { SourcesSection } from "@/containers/setup/sources/sources.section"; import { KeyvalButton, KeyvalText } from "@/design.system"; import theme from "@/styles/palette"; -import { NOTIFICATION, SETUP } from "@/utils/constants"; +import { NOTIFICATION, OVERVIEW, SETUP } from "@/utils/constants"; import { useMutation } from "react-query"; import { setNamespaces } from "@/services"; @@ -35,7 +35,7 @@ export function NewSourceFlow() { {`${totalSelected} ${SETUP.SELECTED}`} - Connect + {OVERVIEW.CONNECT} diff --git a/frontend/webapp/containers/overview/sources/sources.styled.tsx b/frontend/webapp/containers/overview/sources/sources.styled.tsx index c3fa07df0..d07f83647 100644 --- a/frontend/webapp/containers/overview/sources/sources.styled.tsx +++ b/frontend/webapp/containers/overview/sources/sources.styled.tsx @@ -11,7 +11,6 @@ export const MenuWrapper = styled.div` `; export const SourcesSectionWrapper = styled(MenuWrapper)` - margin-top: 88px; position: relative; `; diff --git a/frontend/webapp/utils/constants/string.tsx b/frontend/webapp/utils/constants/string.tsx index 8591b7e1a..eb57020dd 100644 --- a/frontend/webapp/utils/constants/string.tsx +++ b/frontend/webapp/utils/constants/string.tsx @@ -74,6 +74,7 @@ export const OVERVIEW = { DELETE_MODAL_SUBTITLE: "This action cannot be undone. This will permanently delete the destination and all associated data.", DELETE_BUTTON: "I want to delete this destination", + CONNECT: "Connect", }; export const NOTIFICATION = { From 537aa7528d89a41c57f6bf53d2f72de720c1931f Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 31 Jul 2023 13:08:58 +0300 Subject: [PATCH 015/374] new back button --- .../manage.destination/manage.destination.tsx | 12 ++++++----- .../destination/new.destination.flow.tsx | 20 ++++++++++--------- .../containers/overview/sources/sources.tsx | 7 ++++++- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx index 6a1c0ecdd..d129dea5f 100644 --- a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx +++ b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx @@ -11,7 +11,7 @@ import FormDangerZone from "./form.danger.zone"; interface ManageDestinationProps { destinationType: DestinationType; selectedDestination: any; - onBackClick: () => void; + onBackClick?: () => void; onSubmit: (data: any) => void; onDelete?: () => void; } @@ -34,10 +34,12 @@ export function ManageDestination({ }: ManageDestinationProps) { return ( <> - - - {SETUP.BACK} - + {onBackClick && ( + + + {SETUP.BACK} + + )} { - setManaged(false); - setSectionData(null); - }} /> ); } @@ -60,10 +56,6 @@ export function NewDestinationFlow({ onBackClick, onSuccess, onError }) { function renderSelectNewDestination() { return ( <> - - - {SETUP.BACK} - { @@ -77,7 +69,17 @@ export function NewDestinationFlow({ onBackClick, onSuccess, onError }) { return ( <> - + { + setManaged(false); + setSectionData(null); + } + : onBackClick + } + /> {managed && sectionData ? renderNewDestinationForm() diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index d48cacf72..58bc728b3 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -19,7 +19,12 @@ export function SourcesContainer() { return ( - + setDisplayNewSourceFlow(false) : null + } + /> {displayNewSourceFlow ? renderNewSourceFlow() : renderSources()} ); From ab32b46a5db9e8662c4dc012fd475117fa04fa07 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 31 Jul 2023 13:13:30 +0300 Subject: [PATCH 016/374] WIP --- .../destination/new.destination.flow.tsx | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx index a2f674271..7a75a32c0 100644 --- a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx @@ -1,24 +1,13 @@ "use client"; import React, { useState } from "react"; -import { KeyvalText } from "@/design.system"; -import { OVERVIEW, QUERIES, SETUP } from "@/utils/constants"; +import { OVERVIEW, QUERIES } from "@/utils/constants"; import { useMutation, useQuery } from "react-query"; import { getDestination, setDestination } from "@/services"; import { ManageDestination, OverviewHeader } from "@/components/overview"; import { useSectionData } from "@/hooks"; import { DestinationSection } from "@/containers/setup/destination/destination.section"; import { NewDestinationContainer } from "./destination.styled"; -import { Back } from "@/assets/icons/overview"; -import { styled } from "styled-components"; -const BackButtonWrapper = styled.div` - display: flex; - align-items: center; - cursor: pointer; - p { - cursor: pointer !important; - } -`; export function NewDestinationFlow({ onBackClick, onSuccess, onError }) { const { sectionData, setSectionData } = useSectionData(null); const [managed, setManaged] = useState(null); @@ -43,6 +32,15 @@ export function NewDestinationFlow({ onBackClick, onSuccess, onError }) { }); } + function handleBackPress() { + if (managed && sectionData) { + setManaged(false); + setSectionData(null); + return; + } + onBackClick(); + } + function renderNewDestinationForm() { return ( { - setManaged(false); - setSectionData(null); - } - : onBackClick - } + onBackClick={handleBackPress} /> {managed && sectionData From 0d97d64ce65629635b2778d553c8b91beced8431 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 31 Jul 2023 13:52:09 +0300 Subject: [PATCH 017/374] filter instromented apps --- .../overview/sources/new.source.flow.tsx | 1 - .../setup/sources/sources.section.tsx | 20 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx index 77f763455..eddcbbe8b 100644 --- a/frontend/webapp/containers/overview/sources/new.source.flow.tsx +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -20,7 +20,6 @@ export function NewSourceFlow() { }, onError: ({ response }) => { const message = response?.data?.message || SETUP.ERROR; - console.log({ response }); show({ type: NOTIFICATION.ERROR, message, diff --git a/frontend/webapp/containers/setup/sources/sources.section.tsx b/frontend/webapp/containers/setup/sources/sources.section.tsx index b765fd13c..2328b61c2 100644 --- a/frontend/webapp/containers/setup/sources/sources.section.tsx +++ b/frontend/webapp/containers/setup/sources/sources.section.tsx @@ -37,19 +37,25 @@ export function SourcesSection({ sectionData, setSectionData }: any) { }); }, [isError]); - const namespacesList = useMemo(() => { - return data?.namespaces?.map((item: any, index: number) => { - return { id: index, label: item.name }; - }); - }, [data]); + const namespacesList = useMemo( + () => + data?.namespaces?.map((item: any, index: number) => ({ + id: index, + label: item.name, + })), + [data] + ); const sourceData = useMemo(() => { - const namespace = sectionData[currentNamespace?.name]; - return searchFilter + let namespace = sectionData[currentNamespace?.name]; + //filter by search query + namespace = searchFilter ? namespace?.objects.filter((item: any) => item.name.toLowerCase().includes(searchFilter.toLowerCase()) ) : namespace?.objects; + //remove instrumented applications + return namespace?.filter((item: any) => !item.instrumentation_effective); }, [searchFilter, currentNamespace, sectionData]); async function onNameSpaceChange() { From f38568b3cacbbbb2b551ce27028fe990d107097b Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 31 Jul 2023 14:43:05 +0300 Subject: [PATCH 018/374] WIP --- frontend/webapp/app/page.tsx | 3 +-- .../overview/sources/new.source.flow.tsx | 6 ++---- .../webapp/containers/overview/sources/sources.tsx | 14 ++++++++++++-- frontend/webapp/utils/constants/string.tsx | 3 +++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/frontend/webapp/app/page.tsx b/frontend/webapp/app/page.tsx index 1b259b2ed..20d26031b 100644 --- a/frontend/webapp/app/page.tsx +++ b/frontend/webapp/app/page.tsx @@ -4,7 +4,6 @@ import { useEffect } from "react"; import { getConfig } from "@/services/config"; import { useRouter } from "next/navigation"; import { ROUTES, CONFIG, QUERIES } from "@/utils/constants"; -import { KeyvalLoader } from "@/design.system"; export default function App() { const router = useRouter(); @@ -16,7 +15,6 @@ export default function App() { function renderCurrentPage() { const { installation } = data; - const state = installation === CONFIG.APPS_SELECTED ? `?state=${CONFIG.APPS_SELECTED}` @@ -25,6 +23,7 @@ export default function App() { case CONFIG.NEW: case CONFIG.APPS_SELECTED: router.push(`${ROUTES.SETUP}${state}`); + break; case CONFIG.FINISHED: router.push(ROUTES.OVERVIEW); } diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx index eddcbbe8b..dfaacb325 100644 --- a/frontend/webapp/containers/overview/sources/new.source.flow.tsx +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -8,16 +8,14 @@ import { NOTIFICATION, OVERVIEW, SETUP } from "@/utils/constants"; import { useMutation } from "react-query"; import { setNamespaces } from "@/services"; -export function NewSourceFlow() { +export function NewSourceFlow({ onSuccess }) { const { sectionData, setSectionData, totalSelected } = useSectionData({}); const { mutate } = useMutation((body) => setNamespaces(body)); const { show, Notification } = useNotification(); function handleNewSource() { mutate(sectionData, { - onSuccess: () => { - setSectionData({}); - }, + onSuccess, onError: ({ response }) => { const message = response?.data?.message || SETUP.ERROR; show({ diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index 58bc728b3..7b90707b0 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -1,16 +1,25 @@ "use client"; import React, { useState } from "react"; -import { OVERVIEW } from "@/utils/constants"; +import { NOTIFICATION, OVERVIEW } from "@/utils/constants"; import { OverviewHeader } from "@/components/overview"; import { SourcesContainerWrapper } from "./sources.styled"; import { NewSourceFlow } from "./new.source.flow"; import { ManageSources } from "./manage.sources"; +import { useNotification } from "@/hooks"; export function SourcesContainer() { const [displayNewSourceFlow, setDisplayNewSourceFlow] = useState(false); + const { show, Notification } = useNotification(); + function onNewSourceSuccess() { + setDisplayNewSourceFlow(false); + show({ + type: NOTIFICATION.SUCCESS, + message: OVERVIEW.SOURCE_CREATED_SUCCESS, + }); + } function renderNewSourceFlow() { - return ; + return ; } function renderSources() { @@ -26,6 +35,7 @@ export function SourcesContainer() { } /> {displayNewSourceFlow ? renderNewSourceFlow() : renderSources()} +
); } diff --git a/frontend/webapp/utils/constants/string.tsx b/frontend/webapp/utils/constants/string.tsx index eb57020dd..53903e8c5 100644 --- a/frontend/webapp/utils/constants/string.tsx +++ b/frontend/webapp/utils/constants/string.tsx @@ -67,6 +67,9 @@ export const OVERVIEW = { DESTINATION_UPDATE_SUCCESS: "Destination updated successfully", DESTINATION_CREATED_SUCCESS: "Destination created successfully", DESTINATION_DELETED_SUCCESS: "Destination deleted successfully", + SOURCE_UPDATE_SUCCESS: "Source updated successfully", + SOURCE_CREATED_SUCCESS: "Source created successfully", + SOURCE_DELETED_SUCCESS: "Source deleted successfully", MANAGE: "Manage", DELETE: "Delete", DELETE_DESTINATION: "Delete Destination", From d57d024c149a2056393f97eb705e9ecde0208f4c Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 31 Jul 2023 16:07:12 +0300 Subject: [PATCH 019/374] WIP --- .../overview/sources/manage.sources.tsx | 23 ++++++++++--------- .../overview/sources/new.source.flow.tsx | 23 ++++++++++++++++--- .../containers/overview/sources/sources.tsx | 19 ++++++++++++--- .../setup/setup.section/setup.section.tsx | 5 +++- frontend/webapp/services/sources.tsx | 3 ++- frontend/webapp/types/sources.tsx | 16 +++++++++++++ 6 files changed, 70 insertions(+), 19 deletions(-) diff --git a/frontend/webapp/containers/overview/sources/manage.sources.tsx b/frontend/webapp/containers/overview/sources/manage.sources.tsx index 85fbef48e..affc022ba 100644 --- a/frontend/webapp/containers/overview/sources/manage.sources.tsx +++ b/frontend/webapp/containers/overview/sources/manage.sources.tsx @@ -8,15 +8,22 @@ import { SourcesActionMenu, SourcesManagedList } from "@/components/overview"; import { MenuWrapper } from "./sources.styled"; import { ManagedSource } from "@/types/sources"; -export function ManageSources({ setDisplayNewSourceFlow }) { +const DEFAULT_FILTER = { name: "default" }; + +export function ManageSources({ setDisplayNewSourceFlow, sources }) { const [searchFilter, setSearchFilter] = useState(""); - const [currentNamespace, setCurrentNamespace] = useState(null); + const [currentNamespace, setCurrentNamespace] = useState(DEFAULT_FILTER); const { data: namespaces } = useQuery( [QUERIES.API_NAMESPACES], getNamespaces ); + // const { data: sources, isLoading } = useQuery( + // [QUERIES.API_SOURCES], + // getSources + // ); + // console.log({ sources }); useEffect(() => { setSearchFilter(""); }, [currentNamespace]); @@ -30,12 +37,6 @@ export function ManageSources({ setDisplayNewSourceFlow }) { [namespaces] ); - const { - data: sources, - refetch, - isLoading, - } = useQuery([QUERIES.API_SOURCES], getSources); - function filterByNamespace() { return currentNamespace ? sources?.filter( @@ -57,9 +58,9 @@ export function ManageSources({ setDisplayNewSourceFlow }) { return filterBySearchQuery(data); } - if (isLoading) { - return ; - } + // if (isLoading) { + // return ; + // } return ( <> diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx index dfaacb325..4e1212738 100644 --- a/frontend/webapp/containers/overview/sources/new.source.flow.tsx +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -7,14 +7,31 @@ import theme from "@/styles/palette"; import { NOTIFICATION, OVERVIEW, SETUP } from "@/utils/constants"; import { useMutation } from "react-query"; import { setNamespaces } from "@/services"; +import { SelectedSources } from "@/types/sources"; -export function NewSourceFlow({ onSuccess }) { +export function NewSourceFlow({ onSuccess, sources }) { const { sectionData, setSectionData, totalSelected } = useSectionData({}); - const { mutate } = useMutation((body) => setNamespaces(body)); + const { mutate } = useMutation((body: SelectedSources) => + setNamespaces(body) + ); const { show, Notification } = useNotification(); function handleNewSource() { - mutate(sectionData, { + const newData: SelectedSources = {}; + + for (const key in sectionData) { + newData[key] = { + ...sectionData[key], + objects: sectionData[key].objects.map((item) => ({ + ...item, + selected: + item?.selected || + sources.some((source) => source.name === item.name), + })), + }; + } + + mutate(newData, { onSuccess, onError: ({ response }) => { const message = response?.data?.message || SETUP.ERROR; diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index 7b90707b0..ff89b21c1 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -1,15 +1,23 @@ "use client"; import React, { useState } from "react"; -import { NOTIFICATION, OVERVIEW } from "@/utils/constants"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; import { OverviewHeader } from "@/components/overview"; import { SourcesContainerWrapper } from "./sources.styled"; import { NewSourceFlow } from "./new.source.flow"; import { ManageSources } from "./manage.sources"; import { useNotification } from "@/hooks"; +import { useQuery } from "react-query"; +import { getSources } from "@/services"; export function SourcesContainer() { const [displayNewSourceFlow, setDisplayNewSourceFlow] = useState(false); const { show, Notification } = useNotification(); + + const { data: sources, isLoading } = useQuery( + [QUERIES.API_SOURCES], + getSources + ); + function onNewSourceSuccess() { setDisplayNewSourceFlow(false); show({ @@ -19,11 +27,16 @@ export function SourcesContainer() { } function renderNewSourceFlow() { - return ; + return ; } function renderSources() { - return ; + return ( + + ); } return ( diff --git a/frontend/webapp/containers/setup/setup.section/setup.section.tsx b/frontend/webapp/containers/setup/setup.section/setup.section.tsx index c50a2581f..53da583c3 100644 --- a/frontend/webapp/containers/setup/setup.section/setup.section.tsx +++ b/frontend/webapp/containers/setup/setup.section/setup.section.tsx @@ -18,6 +18,7 @@ import { STEPS, Step } from "./utils"; import { setNamespaces } from "@/services"; import { useSearchParams } from "next/navigation"; import { useMutation } from "react-query"; +import { SelectedSources } from "@/types/sources"; const STATE = "state"; @@ -30,7 +31,9 @@ const sectionComponents = { export function SetupSection() { const [currentStep, setCurrentStep] = useState(STEPS[0]); const { sectionData, setSectionData, totalSelected } = useSectionData({}); - const { mutate } = useMutation((body) => setNamespaces(body)); + const { mutate } = useMutation((body: SelectedSources) => + setNamespaces(body) + ); const { show, Notification } = useNotification(); const searchParams = useSearchParams(); diff --git a/frontend/webapp/services/sources.tsx b/frontend/webapp/services/sources.tsx index 3f6f32148..eb50b72a2 100644 --- a/frontend/webapp/services/sources.tsx +++ b/frontend/webapp/services/sources.tsx @@ -1,5 +1,6 @@ import { API } from "@/utils/constants"; import { get, post } from "./api"; +import { SelectedSources } from "@/types/sources"; export async function getNamespaces() { return await get(API.NAMESPACES); @@ -9,7 +10,7 @@ export async function getApplication(id: string) { return await get(`${API.APPLICATIONS}/${id}`); } -export async function setNamespaces(body: any) { +export async function setNamespaces(body: SelectedSources): Promise { return await post(API.NAMESPACES, body); } diff --git a/frontend/webapp/types/sources.tsx b/frontend/webapp/types/sources.tsx index 53f44fe6e..dac37b7eb 100644 --- a/frontend/webapp/types/sources.tsx +++ b/frontend/webapp/types/sources.tsx @@ -9,3 +9,19 @@ export interface ManagedSource { } ]; } + +export interface SelectedSources { + [key: string]: { + objects: { + name: string; + selected: boolean; + kind: string; + app_instrumentation_labeled: boolean | null; + ns_instrumentation_labeled: boolean | null; + instrumentation_effective: boolean | null; + instances: number; + }; + selected_all: boolean; + future_selected: boolean; + }; +} From 6b1a81268633fe59112bd458f41d83521a102ff1 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 31 Jul 2023 16:14:26 +0300 Subject: [PATCH 020/374] WIP --- .../overview/sources/manage.sources.tsx | 23 ++++++------------- frontend/webapp/types/sources.tsx | 6 +++++ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/frontend/webapp/containers/overview/sources/manage.sources.tsx b/frontend/webapp/containers/overview/sources/manage.sources.tsx index affc022ba..af0e0daa9 100644 --- a/frontend/webapp/containers/overview/sources/manage.sources.tsx +++ b/frontend/webapp/containers/overview/sources/manage.sources.tsx @@ -1,36 +1,31 @@ "use client"; import React, { useEffect, useMemo, useState } from "react"; -import { KeyvalLoader } from "@/design.system"; import { QUERIES } from "@/utils/constants"; import { useQuery } from "react-query"; -import { getNamespaces, getSources } from "@/services"; +import { getNamespaces } from "@/services"; import { SourcesActionMenu, SourcesManagedList } from "@/components/overview"; import { MenuWrapper } from "./sources.styled"; -import { ManagedSource } from "@/types/sources"; +import { ManagedSource, Namespace } from "@/types/sources"; -const DEFAULT_FILTER = { name: "default" }; +const DEFAULT_FILTER = { name: "default", selected: false, totalApps: 0 }; export function ManageSources({ setDisplayNewSourceFlow, sources }) { const [searchFilter, setSearchFilter] = useState(""); - const [currentNamespace, setCurrentNamespace] = useState(DEFAULT_FILTER); + const [currentNamespace, setCurrentNamespace] = + useState(DEFAULT_FILTER); const { data: namespaces } = useQuery( [QUERIES.API_NAMESPACES], getNamespaces ); - // const { data: sources, isLoading } = useQuery( - // [QUERIES.API_SOURCES], - // getSources - // ); - // console.log({ sources }); useEffect(() => { setSearchFilter(""); }, [currentNamespace]); const namespacesList = useMemo( () => - namespaces?.namespaces?.map((item: any, index: number) => ({ + namespaces?.namespaces?.map((item: Namespace, index: number) => ({ id: index, label: item.name, })), @@ -45,7 +40,7 @@ export function ManageSources({ setDisplayNewSourceFlow, sources }) { : sources; } - function filterBySearchQuery(data) { + function filterBySearchQuery(data: ManagedSource[]) { return searchFilter ? data?.filter((item: ManagedSource) => item.name.toLowerCase().includes(searchFilter.toLowerCase()) @@ -58,10 +53,6 @@ export function ManageSources({ setDisplayNewSourceFlow, sources }) { return filterBySearchQuery(data); } - // if (isLoading) { - // return ; - // } - return ( <> diff --git a/frontend/webapp/types/sources.tsx b/frontend/webapp/types/sources.tsx index dac37b7eb..7906c4733 100644 --- a/frontend/webapp/types/sources.tsx +++ b/frontend/webapp/types/sources.tsx @@ -10,6 +10,12 @@ export interface ManagedSource { ]; } +export interface Namespace { + name: string; + selected: boolean; + totalApps: number; +} + export interface SelectedSources { [key: string]: { objects: { From d6e9f6fc570c4c42bce8f4ddf2974c6ac2274e0e Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 31 Jul 2023 16:21:58 +0300 Subject: [PATCH 021/374] WIP --- .../sources.option.menu/filter.sources.options.tsx | 4 ++-- .../sources.option.menu/sources.option.menu.styled.tsx | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx index 9b5934c2b..def2c8da1 100644 --- a/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx +++ b/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx @@ -17,7 +17,7 @@ export function FilterSourcesOptions({ } return ( - + <> setSearchFilter(e.target.value)} @@ -30,6 +30,6 @@ export function FilterSourcesOptions({ onChange={handleDropDownChange} /> - + ); } diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx index 33ae15b5f..7befad872 100644 --- a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx +++ b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx @@ -5,17 +5,16 @@ export const SourcesOptionMenuWrapper = styled.section` align-items: center; gap: 24px; padding: 40px 0 0 0; + @media screen and (max-width: 1500px) { + flex-wrap: wrap; + width: 70%; + } `; export const FilterMenuWrapper = styled.div` display: flex; gap: 16px; align-items: center; - - @media screen and (max-width: 1400px) { - flex-wrap: wrap; - width: 90%; - } `; export const DropdownWrapper = styled.div` From 7c655a0eb479abd92d7334aaf15d46ff98f31ea4 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 31 Jul 2023 16:24:36 +0300 Subject: [PATCH 022/374] WIP --- .../sources/sources.manage.list/sources.manage.styled.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx index ffbdffed2..3fd4cad8d 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx @@ -27,7 +27,7 @@ export const EmptyListWrapper = styled.div` `; export const ManagedListWrapper = styled.div` - height: 75%; + max-height: 72%; display: flex; flex-wrap: wrap; gap: 24px; From fbe55040b8a88c25de699b78865802963603a4f7 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 1 Aug 2023 11:37:34 +0300 Subject: [PATCH 023/374] WIP --- frontend/webapp/app/layout.tsx | 17 +++++++------ .../sources.manage.list.tsx | 2 +- .../filter.sources.options.tsx | 5 +--- .../sources.option.menu.styled.tsx | 6 ----- .../containers/overview/sources/sources.tsx | 24 ++++++++++++++++--- frontend/webapp/design.system/image/image.tsx | 2 ++ 6 files changed, 33 insertions(+), 23 deletions(-) diff --git a/frontend/webapp/app/layout.tsx b/frontend/webapp/app/layout.tsx index efe4c8326..3b6d45a7a 100644 --- a/frontend/webapp/app/layout.tsx +++ b/frontend/webapp/app/layout.tsx @@ -11,21 +11,20 @@ const LAYOUT_STYLE: React.CSSProperties = { width: "100vw", height: "100vh", }; +export const queryClient = new QueryClient({ + defaultOptions: { + queries: { + staleTime: 10000, + refetchOnWindowFocus: false, + }, + }, +}); export default function RootLayout({ children, }: { children: React.ReactNode; }) { - const queryClient = new QueryClient({ - defaultOptions: { - queries: { - staleTime: 10000, - refetchOnWindowFocus: false, - }, - }, - }); - return ( diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx index fa63eda5a..b5a82fad5 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx @@ -17,7 +17,7 @@ interface SourcesManagedListProps { export function SourcesManagedList({ data = [] }: SourcesManagedListProps) { function renderSources() { return data.map((source: ManagedSource) => ( - + )); } diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx index def2c8da1..d39fa2e7a 100644 --- a/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx +++ b/frontend/webapp/components/setup/sources/sources.option.menu/filter.sources.options.tsx @@ -1,8 +1,5 @@ import React from "react"; -import { - DropdownWrapper, - FilterMenuWrapper, -} from "./sources.option.menu.styled"; +import { DropdownWrapper } from "./sources.option.menu.styled"; import { KeyvalDropDown, KeyvalSearchInput, KeyvalText } from "@/design.system"; import { SETUP } from "@/utils/constants"; diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx index 7befad872..256d9c55e 100644 --- a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx +++ b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx @@ -11,12 +11,6 @@ export const SourcesOptionMenuWrapper = styled.section` } `; -export const FilterMenuWrapper = styled.div` - display: flex; - gap: 16px; - align-items: center; -`; - export const DropdownWrapper = styled.div` display: flex; position: inherit; diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index ff89b21c1..c23a8447d 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -1,5 +1,5 @@ "use client"; -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; import { OverviewHeader } from "@/components/overview"; import { SourcesContainerWrapper } from "./sources.styled"; @@ -10,14 +10,32 @@ import { useQuery } from "react-query"; import { getSources } from "@/services"; export function SourcesContainer() { - const [displayNewSourceFlow, setDisplayNewSourceFlow] = useState(false); + const [displayNewSourceFlow, setDisplayNewSourceFlow] = useState< + boolean | null + >(null); const { show, Notification } = useNotification(); - const { data: sources, isLoading } = useQuery( + const { data: sources, refetch } = useQuery( [QUERIES.API_SOURCES], getSources ); + useEffect(() => { + refetchSources(); + }, [displayNewSourceFlow]); + + useEffect(() => { + console.log({ sources }); + }, [sources]); + + async function refetchSources() { + if (displayNewSourceFlow !== null && displayNewSourceFlow === false) { + setTimeout(async () => { + refetch(); + }, 1000); + } + } + function onNewSourceSuccess() { setDisplayNewSourceFlow(false); show({ diff --git a/frontend/webapp/design.system/image/image.tsx b/frontend/webapp/design.system/image/image.tsx index 1a7b30cf7..31be01ccf 100644 --- a/frontend/webapp/design.system/image/image.tsx +++ b/frontend/webapp/design.system/image/image.tsx @@ -27,6 +27,8 @@ export function KeyvalImage({ width={width} height={height} style={{ ...IMAGE_STYLE, ...style }} + placeholder={"empty"} + blurDataURL={src} /> ); } From 8a93e8a72ffe9c18ded5a4c7e3bd636cf6699955 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 1 Aug 2023 11:47:14 +0300 Subject: [PATCH 024/374] fixed pr comments --- frontend/webapp/app/layout.tsx | 17 +++++++++-------- .../containers/overview/sources/sources.tsx | 4 ---- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/frontend/webapp/app/layout.tsx b/frontend/webapp/app/layout.tsx index 3b6d45a7a..efe4c8326 100644 --- a/frontend/webapp/app/layout.tsx +++ b/frontend/webapp/app/layout.tsx @@ -11,20 +11,21 @@ const LAYOUT_STYLE: React.CSSProperties = { width: "100vw", height: "100vh", }; -export const queryClient = new QueryClient({ - defaultOptions: { - queries: { - staleTime: 10000, - refetchOnWindowFocus: false, - }, - }, -}); export default function RootLayout({ children, }: { children: React.ReactNode; }) { + const queryClient = new QueryClient({ + defaultOptions: { + queries: { + staleTime: 10000, + refetchOnWindowFocus: false, + }, + }, + }); + return ( diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index c23a8447d..b78b57200 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -24,10 +24,6 @@ export function SourcesContainer() { refetchSources(); }, [displayNewSourceFlow]); - useEffect(() => { - console.log({ sources }); - }, [sources]); - async function refetchSources() { if (displayNewSourceFlow !== null && displayNewSourceFlow === false) { setTimeout(async () => { From d9958c808f1936243d22b1057c0d3ac040ee6224 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 1 Aug 2023 13:02:56 +0300 Subject: [PATCH 025/374] fixed pr comments --- .../sources.option.menu.styled.tsx | 5 ++-- .../overview/sources/new.source.flow.tsx | 29 +++++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx index 256d9c55e..88d0a54b4 100644 --- a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx +++ b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx @@ -5,9 +5,9 @@ export const SourcesOptionMenuWrapper = styled.section` align-items: center; gap: 24px; padding: 40px 0 0 0; - @media screen and (max-width: 1500px) { + @media screen and (max-width: 1600px) { flex-wrap: wrap; - width: 70%; + width: 74%; } `; @@ -27,5 +27,4 @@ export const CheckboxWrapper = styled.div` export const SwitcherWrapper = styled.div` min-width: 90px; - margin-left: 24px; `; diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx index 4e1212738..5152767ba 100644 --- a/frontend/webapp/containers/overview/sources/new.source.flow.tsx +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -16,22 +16,24 @@ export function NewSourceFlow({ onSuccess, sources }) { ); const { show, Notification } = useNotification(); - function handleNewSource() { - const newData: SelectedSources = {}; + function updateSectionDataWithSources() { + const sourceNamesSet = new Set(sources.map((source) => source.name)); + const updatedSectionData: SelectedSources = {}; for (const key in sectionData) { - newData[key] = { - ...sectionData[key], - objects: sectionData[key].objects.map((item) => ({ - ...item, - selected: - item?.selected || - sources.some((source) => source.name === item.name), - })), + const { objects, ...rest } = sectionData[key]; + const updatedObjects = objects.map((item) => ({ + ...item, + selected: item?.selected || sourceNamesSet.has(item.name), + })); + + updatedSectionData[key] = { + ...rest, + objects: updatedObjects, }; } - mutate(newData, { + mutate(updatedSectionData, { onSuccess, onError: ({ response }) => { const message = response?.data?.message || SETUP.ERROR; @@ -47,7 +49,10 @@ export function NewSourceFlow({ onSuccess, sources }) { {`${totalSelected} ${SETUP.SELECTED}`} - + {OVERVIEW.CONNECT} From 89dc8ae6d3d155ccbea13f7b42d3c8436bcb70b8 Mon Sep 17 00:00:00 2001 From: Alon Braymok <138359965+alonkeyval@users.noreply.github.com> Date: Tue, 1 Aug 2023 13:06:37 +0300 Subject: [PATCH 026/374] Task 158 back button (#360) --- .../destination.list.styled.tsx | 1 - .../manage.destination/manage.destination.tsx | 12 ++++--- .../overview.header/overview.header.tsx | 27 ++++++++++---- .../sources.action.menu.styled.tsx | 1 - .../destination/destination.styled.tsx | 1 - .../destination/new.destination.flow.tsx | 35 ++++++++----------- .../overview/overview/overview.styled.tsx | 1 - .../overview/sources/new.source.flow.tsx | 4 +-- .../overview/sources/sources.styled.tsx | 1 - .../containers/overview/sources/sources.tsx | 7 +++- frontend/webapp/utils/constants/string.tsx | 1 + 11 files changed, 51 insertions(+), 40 deletions(-) diff --git a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx index 2ed90d51b..c06fdca16 100644 --- a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx @@ -15,7 +15,6 @@ export const MenuWrapper = styled.div` justify-content: space-between; align-items: center; padding: 20px 36px; - margin-top: 88px; `; export const CardWrapper = styled.div` diff --git a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx index 6a1c0ecdd..d129dea5f 100644 --- a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx +++ b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx @@ -11,7 +11,7 @@ import FormDangerZone from "./form.danger.zone"; interface ManageDestinationProps { destinationType: DestinationType; selectedDestination: any; - onBackClick: () => void; + onBackClick?: () => void; onSubmit: (data: any) => void; onDelete?: () => void; } @@ -34,10 +34,12 @@ export function ManageDestination({ }: ManageDestinationProps) { return ( <> - - - {SETUP.BACK} - + {onBackClick && ( + + + {SETUP.BACK} + + )} theme.colors.light_dark}; `; -export function OverviewHeader({ title }: OverviewHeaderProps) { +const BackButtonWrapper = styled.div` + display: flex; + margin-bottom: 8px; + cursor: pointer; + p { + cursor: pointer !important; + } +`; + +export function OverviewHeader({ title, onBackClick }: OverviewHeaderProps) { return ( + {onBackClick && ( + + + {SETUP.BACK} + + )} {title} diff --git a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx index dbf2e0d97..ee4c046ad 100644 --- a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx +++ b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx @@ -3,7 +3,6 @@ import styled from "styled-components"; export const SourcesMenuWrapper = styled.div` width: 100%; margin: 32px 0; - padding-top: 88px; display: flex; justify-content: space-between; `; diff --git a/frontend/webapp/containers/overview/destination/destination.styled.tsx b/frontend/webapp/containers/overview/destination/destination.styled.tsx index 7933933c5..fd3764d16 100644 --- a/frontend/webapp/containers/overview/destination/destination.styled.tsx +++ b/frontend/webapp/containers/overview/destination/destination.styled.tsx @@ -8,7 +8,6 @@ export const DestinationContainerWrapper = styled.div` export const NewDestinationContainer = styled.div` padding: 20px 36px; - margin-top: 88px; `; export const ManageDestinationWrapper = styled.div` diff --git a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx index 6a213f539..7a75a32c0 100644 --- a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx @@ -1,24 +1,13 @@ "use client"; import React, { useState } from "react"; -import { KeyvalText } from "@/design.system"; -import { OVERVIEW, QUERIES, SETUP } from "@/utils/constants"; +import { OVERVIEW, QUERIES } from "@/utils/constants"; import { useMutation, useQuery } from "react-query"; import { getDestination, setDestination } from "@/services"; import { ManageDestination, OverviewHeader } from "@/components/overview"; import { useSectionData } from "@/hooks"; import { DestinationSection } from "@/containers/setup/destination/destination.section"; import { NewDestinationContainer } from "./destination.styled"; -import { Back } from "@/assets/icons/overview"; -import { styled } from "styled-components"; -const BackButtonWrapper = styled.div` - display: flex; - align-items: center; - cursor: pointer; - p { - cursor: pointer !important; - } -`; export function NewDestinationFlow({ onBackClick, onSuccess, onError }) { const { sectionData, setSectionData } = useSectionData(null); const [managed, setManaged] = useState(null); @@ -43,16 +32,21 @@ export function NewDestinationFlow({ onBackClick, onSuccess, onError }) { }); } + function handleBackPress() { + if (managed && sectionData) { + setManaged(false); + setSectionData(null); + return; + } + onBackClick(); + } + function renderNewDestinationForm() { return ( { - setManaged(false); - setSectionData(null); - }} /> ); } @@ -60,10 +54,6 @@ export function NewDestinationFlow({ onBackClick, onSuccess, onError }) { function renderSelectNewDestination() { return ( <> - - - {SETUP.BACK} - { @@ -77,7 +67,10 @@ export function NewDestinationFlow({ onBackClick, onSuccess, onError }) { return ( <> - + {managed && sectionData ? renderNewDestinationForm() diff --git a/frontend/webapp/containers/overview/overview/overview.styled.tsx b/frontend/webapp/containers/overview/overview/overview.styled.tsx index 59d7a09d1..c152e7642 100644 --- a/frontend/webapp/containers/overview/overview/overview.styled.tsx +++ b/frontend/webapp/containers/overview/overview/overview.styled.tsx @@ -3,5 +3,4 @@ import styled from "styled-components"; export const OverviewDataFlowWrapper = styled.div` width: 100%; height: 100%; - margin-top: 88px; `; diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx index a43290b5e..77f763455 100644 --- a/frontend/webapp/containers/overview/sources/new.source.flow.tsx +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -4,7 +4,7 @@ import { SourcesSectionWrapper, ButtonWrapper } from "./sources.styled"; import { SourcesSection } from "@/containers/setup/sources/sources.section"; import { KeyvalButton, KeyvalText } from "@/design.system"; import theme from "@/styles/palette"; -import { NOTIFICATION, SETUP } from "@/utils/constants"; +import { NOTIFICATION, OVERVIEW, SETUP } from "@/utils/constants"; import { useMutation } from "react-query"; import { setNamespaces } from "@/services"; @@ -35,7 +35,7 @@ export function NewSourceFlow() { {`${totalSelected} ${SETUP.SELECTED}`} - Connect + {OVERVIEW.CONNECT} diff --git a/frontend/webapp/containers/overview/sources/sources.styled.tsx b/frontend/webapp/containers/overview/sources/sources.styled.tsx index c3fa07df0..d07f83647 100644 --- a/frontend/webapp/containers/overview/sources/sources.styled.tsx +++ b/frontend/webapp/containers/overview/sources/sources.styled.tsx @@ -11,7 +11,6 @@ export const MenuWrapper = styled.div` `; export const SourcesSectionWrapper = styled(MenuWrapper)` - margin-top: 88px; position: relative; `; diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index d48cacf72..58bc728b3 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -19,7 +19,12 @@ export function SourcesContainer() { return ( - + setDisplayNewSourceFlow(false) : null + } + /> {displayNewSourceFlow ? renderNewSourceFlow() : renderSources()} ); diff --git a/frontend/webapp/utils/constants/string.tsx b/frontend/webapp/utils/constants/string.tsx index 8591b7e1a..eb57020dd 100644 --- a/frontend/webapp/utils/constants/string.tsx +++ b/frontend/webapp/utils/constants/string.tsx @@ -74,6 +74,7 @@ export const OVERVIEW = { DELETE_MODAL_SUBTITLE: "This action cannot be undone. This will permanently delete the destination and all associated data.", DELETE_BUTTON: "I want to delete this destination", + CONNECT: "Connect", }; export const NOTIFICATION = { From 5d5bf9be22cb878886b6cc8b714542961fd2d8e6 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 1 Aug 2023 13:08:08 +0300 Subject: [PATCH 027/374] fixed pr comments --- frontend/webapp/containers/setup/sources/sources.section.tsx | 4 ++-- frontend/webapp/design.system/image/image.tsx | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/frontend/webapp/containers/setup/sources/sources.section.tsx b/frontend/webapp/containers/setup/sources/sources.section.tsx index 2328b61c2..6eb6af810 100644 --- a/frontend/webapp/containers/setup/sources/sources.section.tsx +++ b/frontend/webapp/containers/setup/sources/sources.section.tsx @@ -3,7 +3,7 @@ import { SourcesList, SourcesOptionMenu } from "@/components/setup"; import { getApplication, getNamespaces } from "@/services"; import { LoaderWrapper } from "./sources.section.styled"; import { useQuery } from "react-query"; -import { QUERIES } from "@/utils/constants"; +import { NOTIFICATION, QUERIES } from "@/utils/constants"; import { KeyvalLoader } from "@/design.system"; import { useNotification } from "@/hooks"; @@ -32,7 +32,7 @@ export function SourcesSection({ sectionData, setSectionData }: any) { useEffect(() => { isError && show({ - type: "error", + type: NOTIFICATION.ERROR, message: error, }); }, [isError]); diff --git a/frontend/webapp/design.system/image/image.tsx b/frontend/webapp/design.system/image/image.tsx index 31be01ccf..1a7b30cf7 100644 --- a/frontend/webapp/design.system/image/image.tsx +++ b/frontend/webapp/design.system/image/image.tsx @@ -27,8 +27,6 @@ export function KeyvalImage({ width={width} height={height} style={{ ...IMAGE_STYLE, ...style }} - placeholder={"empty"} - blurDataURL={src} /> ); } From a13161436c53eb03b734c190919b0fc6255c5ac1 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 1 Aug 2023 14:02:08 +0300 Subject: [PATCH 028/374] fixed pr comments --- .../overview/sources/action.menu/sources.action.menu.styled.tsx | 1 + frontend/webapp/containers/overview/sources/sources.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx index ee4c046ad..146df0a97 100644 --- a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx +++ b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx @@ -4,6 +4,7 @@ export const SourcesMenuWrapper = styled.div` width: 100%; margin: 32px 0; display: flex; + align-items: center; justify-content: space-between; `; diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index b78b57200..fa2191caf 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -25,7 +25,7 @@ export function SourcesContainer() { }, [displayNewSourceFlow]); async function refetchSources() { - if (displayNewSourceFlow !== null && displayNewSourceFlow === false) { + if (displayNewSourceFlow === false) { setTimeout(async () => { refetch(); }, 1000); From 180fd5de2c348f212d4ece09f7c03da39c545b0b Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 1 Aug 2023 14:13:48 +0300 Subject: [PATCH 029/374] hide checkboxs --- .../create.connection.form.tsx | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx b/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx index c5cfd3bc7..fb3bf5bf3 100644 --- a/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx +++ b/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx @@ -134,19 +134,21 @@ export function CreateConnectionForm({ ? SETUP.UPDATE_CONNECTION : SETUP.CREATE_CONNECTION}
- - {SETUP.CONNECTION_MONITORS} - - {selectedMonitors.map((checkbox) => ( - handleCheckboxChange(checkbox?.id)} - label={checkbox?.label} - /> - ))} - - + {selectedMonitors?.length > 1 && ( + + {SETUP.CONNECTION_MONITORS} + + {selectedMonitors.map((checkbox) => ( + handleCheckboxChange(checkbox?.id)} + label={checkbox?.label} + /> + ))} + + + )} Date: Tue, 1 Aug 2023 16:38:09 +0300 Subject: [PATCH 030/374] WIP --- .../manage.destination.header.tsx | 6 +----- .../create.connection.form.tsx | 13 +++++++++---- .../sources/source.card/source.card.styled.tsx | 9 ++++++--- .../setup/sources/source.card/source.card.tsx | 12 +++++++----- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/frontend/webapp/components/overview/destination/manage.destination.header/manage.destination.header.tsx b/frontend/webapp/components/overview/destination/manage.destination.header/manage.destination.header.tsx index e38dff4e7..59bc496cd 100644 --- a/frontend/webapp/components/overview/destination/manage.destination.header/manage.destination.header.tsx +++ b/frontend/webapp/components/overview/destination/manage.destination.header/manage.destination.header.tsx @@ -26,9 +26,7 @@ const IMAGE_STYLE: React.CSSProperties = { marginLeft: 16, }; -export function ManageDestinationHeader({ - data: { image_url, display_name, type }, -}) { +export function ManageDestinationHeader({ data: { image_url, display_name } }) { return ( @@ -36,8 +34,6 @@ export function ManageDestinationHeader({ {display_name} - - {type} ); diff --git a/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx b/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx index fb3bf5bf3..107063fd8 100644 --- a/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx +++ b/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx @@ -105,11 +105,16 @@ export function CreateConnectionForm({ } function isFormValid() { - const dynamicFieldsValues = Object.values(dynamicFields); + const areDynamicFieldsFilled = Object.values(dynamicFields).every( + (field) => field + ); + + const isFieldLengthMatching = + (fields?.length ?? 0) === + (dynamicFields ? Object.keys(dynamicFields).length : 0); + const isValid = - !!destinationName && - dynamicFieldsValues.every((field: Field) => field) && - dynamicFieldsValues.length === fields?.length; + !!destinationName && areDynamicFieldsFilled && isFieldLengthMatching; setIsCreateButtonDisabled(!isValid); } diff --git a/frontend/webapp/components/setup/sources/source.card/source.card.styled.tsx b/frontend/webapp/components/setup/sources/source.card/source.card.styled.tsx index 5ea1ad3e9..9ef556c81 100644 --- a/frontend/webapp/components/setup/sources/source.card/source.card.styled.tsx +++ b/frontend/webapp/components/setup/sources/source.card/source.card.styled.tsx @@ -11,7 +11,7 @@ export const SourceCardWrapper = styled.div` display: flex; align-items: center; flex-direction: column; - gap: 14px; + /* gap: 14px; */ cursor: pointer; .p { cursor: pointer !important; @@ -19,7 +19,10 @@ export const SourceCardWrapper = styled.div` `; export const ApplicationNameWrapper = styled.div` - display: inline-block; - text-overflow: ellipsis; + display: flex; + text-align: center; + justify-content: center; + align-items: center; + height: 60px; max-width: 224px; `; diff --git a/frontend/webapp/components/setup/sources/source.card/source.card.tsx b/frontend/webapp/components/setup/sources/source.card/source.card.tsx index 44e56dd19..f5628250c 100644 --- a/frontend/webapp/components/setup/sources/source.card/source.card.tsx +++ b/frontend/webapp/components/setup/sources/source.card/source.card.tsx @@ -15,9 +15,7 @@ import { SETUP } from "@/utils/constants"; import { KIND_COLORS } from "@/styles/global"; const TEXT_STYLE = { - textOverflow: "ellipsis", - whiteSpace: "nowrap", - overflow: "hidden", + overflowWrap: "break-word", }; export function SourceCard({ item, onClick, focus }: any) { @@ -29,8 +27,12 @@ export function SourceCard({ item, onClick, focus }: any) { - - {item.name} + 20 ? 16 : 20} + weight={700} + style={TEXT_STYLE} + > + {item?.name} Date: Tue, 1 Aug 2023 16:43:31 +0300 Subject: [PATCH 031/374] WIP --- .../destination.card/destination.card.styled.tsx | 4 +++- .../destination.card/destination.card.tsx | 5 ++--- .../setup/sources/source.card/source.card.styled.tsx | 9 +++------ .../setup/sources/source.card/source.card.tsx | 12 +++++------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/frontend/webapp/components/setup/destination/destination.card/destination.card.styled.tsx b/frontend/webapp/components/setup/destination/destination.card/destination.card.styled.tsx index a2854b3bd..17e6a2a89 100644 --- a/frontend/webapp/components/setup/destination/destination.card/destination.card.styled.tsx +++ b/frontend/webapp/components/setup/destination/destination.card/destination.card.styled.tsx @@ -10,7 +10,9 @@ export const DestinationCardWrapper = styled.div` `; export const ApplicationNameWrapper = styled.div` - display: inline-block; + display: flex; + align-items: center; text-overflow: ellipsis; max-width: 224px; + height: 40px; `; diff --git a/frontend/webapp/components/setup/destination/destination.card/destination.card.tsx b/frontend/webapp/components/setup/destination/destination.card/destination.card.tsx index b36bf93f5..316f81939 100644 --- a/frontend/webapp/components/setup/destination/destination.card/destination.card.tsx +++ b/frontend/webapp/components/setup/destination/destination.card/destination.card.tsx @@ -8,9 +8,8 @@ import { } from "./destination.card.styled"; const TEXT_STYLE: React.CSSProperties = { - textOverflow: "ellipsis", - whiteSpace: "nowrap", - overflow: "hidden", + overflowWrap: "break-word", + textAlign: "center", }; const LOGO_STYLE: React.CSSProperties = { padding: 4, backgroundColor: "#fff" }; const TAP_STYLE: React.CSSProperties = { padding: "4px 8px", gap: 4 }; diff --git a/frontend/webapp/components/setup/sources/source.card/source.card.styled.tsx b/frontend/webapp/components/setup/sources/source.card/source.card.styled.tsx index 9ef556c81..5ea1ad3e9 100644 --- a/frontend/webapp/components/setup/sources/source.card/source.card.styled.tsx +++ b/frontend/webapp/components/setup/sources/source.card/source.card.styled.tsx @@ -11,7 +11,7 @@ export const SourceCardWrapper = styled.div` display: flex; align-items: center; flex-direction: column; - /* gap: 14px; */ + gap: 14px; cursor: pointer; .p { cursor: pointer !important; @@ -19,10 +19,7 @@ export const SourceCardWrapper = styled.div` `; export const ApplicationNameWrapper = styled.div` - display: flex; - text-align: center; - justify-content: center; - align-items: center; - height: 60px; + display: inline-block; + text-overflow: ellipsis; max-width: 224px; `; diff --git a/frontend/webapp/components/setup/sources/source.card/source.card.tsx b/frontend/webapp/components/setup/sources/source.card/source.card.tsx index f5628250c..44e56dd19 100644 --- a/frontend/webapp/components/setup/sources/source.card/source.card.tsx +++ b/frontend/webapp/components/setup/sources/source.card/source.card.tsx @@ -15,7 +15,9 @@ import { SETUP } from "@/utils/constants"; import { KIND_COLORS } from "@/styles/global"; const TEXT_STYLE = { - overflowWrap: "break-word", + textOverflow: "ellipsis", + whiteSpace: "nowrap", + overflow: "hidden", }; export function SourceCard({ item, onClick, focus }: any) { @@ -27,12 +29,8 @@ export function SourceCard({ item, onClick, focus }: any) { - 20 ? 16 : 20} - weight={700} - style={TEXT_STYLE} - > - {item?.name} + + {item.name} Date: Tue, 1 Aug 2023 16:58:10 +0300 Subject: [PATCH 032/374] fixed pr comments --- .../sources.option.menu/sources.option.menu.styled.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx index 88d0a54b4..0c05c9c59 100644 --- a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx +++ b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx @@ -5,9 +5,9 @@ export const SourcesOptionMenuWrapper = styled.section` align-items: center; gap: 24px; padding: 40px 0 0 0; - @media screen and (max-width: 1600px) { - flex-wrap: wrap; - width: 74%; + flex-wrap: wrap; + @media screen and (max-width: 1650px) { + width: 85%; } `; From b1f12e7626d63998d651d5fb40c865cefa63038e Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 1 Aug 2023 17:39:13 +0300 Subject: [PATCH 033/374] remove scrollbars --- .../destination.list.styled.tsx | 1 - .../overview.header/overview.header.tsx | 18 +++++++++++++----- .../destination.list.styled.tsx | 6 +++++- .../destination/destination.styled.tsx | 9 +++++++-- .../destination/destination.section.styled.tsx | 1 - 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx index c06fdca16..006130e5d 100644 --- a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx @@ -5,7 +5,6 @@ export const ManagedListWrapper = styled.div` display: flex; flex-wrap: wrap; gap: 24px; - overflow-y: scroll; padding: 0px 36px; padding-bottom: 50px; `; diff --git a/frontend/webapp/components/overview/overview.header/overview.header.tsx b/frontend/webapp/components/overview/overview.header/overview.header.tsx index a515ec21f..c492495c2 100644 --- a/frontend/webapp/components/overview/overview.header/overview.header.tsx +++ b/frontend/webapp/components/overview/overview.header/overview.header.tsx @@ -14,20 +14,26 @@ const OverviewHeaderContainer = styled.div` display: flex; flex-direction: column; width: 100%; - padding: 24px; border-bottom: 2px solid rgba(255, 255, 255, 0.08); background: ${({ theme }) => theme.colors.light_dark}; `; const BackButtonWrapper = styled.div` display: flex; - margin-bottom: 8px; + margin: 24px; + margin-bottom: 0; cursor: pointer; p { cursor: pointer !important; } `; +const TextWrapper = styled.div` + margin-top: 24px; + margin-left: 24px; + margin-bottom: 24px; +`; + export function OverviewHeader({ title, onBackClick }: OverviewHeaderProps) { return ( @@ -37,9 +43,11 @@ export function OverviewHeader({ title, onBackClick }: OverviewHeaderProps) { {SETUP.BACK} )} - - {title} - + + + {title} + + ); } diff --git a/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx index 5895538c2..5657d2d96 100644 --- a/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx @@ -13,7 +13,11 @@ export const DestinationListWrapper = styled.div` display: flex; flex-wrap: wrap; gap: 24px; - overflow-y: scroll; + ::-webkit-scrollbar { + display: none; + } + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ `; export const EmptyListWrapper = styled.div` diff --git a/frontend/webapp/containers/overview/destination/destination.styled.tsx b/frontend/webapp/containers/overview/destination/destination.styled.tsx index fd3764d16..2c038975e 100644 --- a/frontend/webapp/containers/overview/destination/destination.styled.tsx +++ b/frontend/webapp/containers/overview/destination/destination.styled.tsx @@ -2,8 +2,13 @@ import styled from "styled-components"; export const DestinationContainerWrapper = styled.div` height: 100vh; - width: 100%; - overflow-y: scroll; + /* width: 100%; */ + overflow-y: hidden; + ::-webkit-scrollbar { + display: none; + } + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ `; export const NewDestinationContainer = styled.div` diff --git a/frontend/webapp/containers/setup/destination/destination.section.styled.tsx b/frontend/webapp/containers/setup/destination/destination.section.styled.tsx index 78f97cbdd..000d3870c 100644 --- a/frontend/webapp/containers/setup/destination/destination.section.styled.tsx +++ b/frontend/webapp/containers/setup/destination/destination.section.styled.tsx @@ -6,7 +6,6 @@ export const DestinationListContainer = styled.div` padding-bottom: 300px; margin-top: 24px; overflow: scroll; - scrollbar-width: none; `; export const EmptyListWrapper = styled.div` From f81d618aec261934f1d77de7cbee0deaf962a9bc Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 1 Aug 2023 17:43:08 +0300 Subject: [PATCH 034/374] WIP --- .../destination/destination.list/destination.list.styled.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx index 006130e5d..f172a32f9 100644 --- a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx @@ -1,7 +1,6 @@ import { styled } from "styled-components"; export const ManagedListWrapper = styled.div` - width: 100%; display: flex; flex-wrap: wrap; gap: 24px; From 5e68cdd9895b34406c38a7530d79c8e5eb70243e Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 2 Aug 2023 09:49:00 +0300 Subject: [PATCH 035/374] added quick help --- .../manage.destination/manage.destination.tsx | 50 ++++++++++++++----- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx index d129dea5f..51fd8d3cb 100644 --- a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx +++ b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx @@ -1,7 +1,7 @@ -import React from "react"; +import React, { useMemo } from "react"; import { styled } from "styled-components"; import { Back } from "@/assets/icons/overview"; -import { CreateConnectionForm } from "@/components/setup"; +import { CreateConnectionForm, QuickHelp } from "@/components/setup"; import { KeyvalText } from "@/design.system"; import { SETUP } from "@/utils/constants"; import { ManageDestinationHeader } from "../manage.destination.header/manage.destination.header"; @@ -25,6 +25,13 @@ const BackButtonWrapper = styled.div` } `; +const CreateConnectionWrapper = styled.div` + display: flex; + gap: 200px; + overflow: scroll; + scrollbar-width: none; +`; + export function ManageDestination({ destinationType, selectedDestination, @@ -32,6 +39,18 @@ export function ManageDestination({ onSubmit, onDelete, }: ManageDestinationProps) { + const videoList = useMemo( + () => + destinationType?.fields + ?.filter((field) => field?.video_url) + ?.map((field) => ({ + name: field.display_name, + src: field.video_url, + thumbnail_url: field.thumbnail_url, + })), + [destinationType] + ); + return ( <> {onBackClick && ( @@ -41,17 +60,22 @@ export function ManageDestination({ )} - onSubmit(data)} - /> - {onDelete && ( - - )} + +
+ onSubmit(data)} + /> + {onDelete && ( + + )} +
+ {videoList?.length > 0 && } +
); } From 32bec3d7a30429404ff3d737ae65ed5fd7fc40de Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 2 Aug 2023 09:56:41 +0300 Subject: [PATCH 036/374] WIP --- .../destination/destination.list/destination.list.styled.tsx | 4 ++-- .../containers/overview/destination/destination.styled.tsx | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx index 5657d2d96..1515a8416 100644 --- a/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx @@ -16,8 +16,8 @@ export const DestinationListWrapper = styled.div` ::-webkit-scrollbar { display: none; } - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ + -ms-overflow-style: none; + scrollbar-width: none; `; export const EmptyListWrapper = styled.div` diff --git a/frontend/webapp/containers/overview/destination/destination.styled.tsx b/frontend/webapp/containers/overview/destination/destination.styled.tsx index 2c038975e..cac5196dd 100644 --- a/frontend/webapp/containers/overview/destination/destination.styled.tsx +++ b/frontend/webapp/containers/overview/destination/destination.styled.tsx @@ -2,13 +2,12 @@ import styled from "styled-components"; export const DestinationContainerWrapper = styled.div` height: 100vh; - /* width: 100%; */ overflow-y: hidden; ::-webkit-scrollbar { display: none; } - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ + -ms-overflow-style: none; + scrollbar-width: none; `; export const NewDestinationContainer = styled.div` From f91d3576199f6494faf9e2d11e736dace2be9c0f Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 2 Aug 2023 10:54:12 +0300 Subject: [PATCH 037/374] create destinaion flow match url --- .../app/overview/destinations/create/page.tsx | 36 +++++++++++++++++++ .../manage.destination/manage.destination.tsx | 1 + .../webapp/components/side.menu/menu/menu.tsx | 3 +- .../overview/destination/destination.tsx | 27 ++++---------- 4 files changed, 46 insertions(+), 21 deletions(-) create mode 100644 frontend/webapp/app/overview/destinations/create/page.tsx diff --git a/frontend/webapp/app/overview/destinations/create/page.tsx b/frontend/webapp/app/overview/destinations/create/page.tsx new file mode 100644 index 000000000..3a0cf9a91 --- /dev/null +++ b/frontend/webapp/app/overview/destinations/create/page.tsx @@ -0,0 +1,36 @@ +"use client"; +import React from "react"; +import { NOTIFICATION, OVERVIEW } from "@/utils/constants"; +import { useNotification } from "@/hooks"; +import { NewDestinationFlow } from "@/containers/overview/destination/new.destination.flow"; +import { useRouter } from "next/navigation"; + +export default function CreateDestinationPage() { + const { show, Notification } = useNotification(); + const router = useRouter(); + function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { + show({ + type: NOTIFICATION.SUCCESS, + message, + }); + } + + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + + return ( +
+ router.back()} + /> + +
+ ); +} diff --git a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx index 51fd8d3cb..32e3321de 100644 --- a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx +++ b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx @@ -28,6 +28,7 @@ const BackButtonWrapper = styled.div` const CreateConnectionWrapper = styled.div` display: flex; gap: 200px; + height: 530px; overflow: scroll; scrollbar-width: none; `; diff --git a/frontend/webapp/components/side.menu/menu/menu.tsx b/frontend/webapp/components/side.menu/menu/menu.tsx index 8f83912ec..e17eb8022 100644 --- a/frontend/webapp/components/side.menu/menu/menu.tsx +++ b/frontend/webapp/components/side.menu/menu/menu.tsx @@ -35,8 +35,9 @@ export function Menu() { } function handleMenuItemClick(item) { + if (!item) return; setCurrentMenuItem(item); - router.push(item?.navigate); + router?.push(item?.navigate); } function renderMenuItemsList() { diff --git a/frontend/webapp/containers/overview/destination/destination.tsx b/frontend/webapp/containers/overview/destination/destination.tsx index 162b174a6..3dbf5ed33 100644 --- a/frontend/webapp/containers/overview/destination/destination.tsx +++ b/frontend/webapp/containers/overview/destination/destination.tsx @@ -6,14 +6,13 @@ import { useQuery } from "react-query"; import { getDestinations } from "@/services"; import { OverviewHeader, DestinationsManagedList } from "@/components/overview"; import { DestinationContainerWrapper } from "./destination.styled"; -import { NewDestinationFlow } from "./new.destination.flow"; import { UpdateDestinationFlow } from "./update.destination.flow"; import { useNotification } from "@/hooks"; +import { useRouter } from "next/navigation"; export function DestinationContainer() { const [selectedDestination, setSelectedDestination] = useState(null); - const [displayNewDestination, setDisplayNewDestination] = - useState(false); + const { show, Notification } = useNotification(); const { isLoading: destinationLoading, @@ -21,10 +20,12 @@ export function DestinationContainer() { refetch, } = useQuery([QUERIES.API_DESTINATIONS], getDestinations); + const router = useRouter(); + function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { refetch(); setSelectedDestination(null); - setDisplayNewDestination(false); + router.push("destinations"); show({ type: NOTIFICATION.SUCCESS, message, @@ -39,18 +40,6 @@ export function DestinationContainer() { }); } - function renderNewDestinationFlow() { - return ( - { - setDisplayNewDestination(false); - }} - /> - ); - } - function renderUpdateDestinationFlow() { return ( setDisplayNewDestination(true)} + onMenuButtonClick={() => router.push("destinations/create")} /> ); @@ -81,9 +70,7 @@ export function DestinationContainer() { return ( - {displayNewDestination - ? renderNewDestinationFlow() - : selectedDestination + {selectedDestination ? renderUpdateDestinationFlow() : renderDestinationList()} From f0e6d64791921a76a5488c67679cda32b281e260 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 2 Aug 2023 11:49:53 +0300 Subject: [PATCH 038/374] new dest flow --- .../destinations/create/[id]/page.tsx | 87 +++++++++++++++++++ .../app/overview/destinations/create/page.tsx | 10 +-- .../app/overview/destinations/manage/page.tsx | 43 +++++++++ .../webapp/app/overview/destinations/page.tsx | 15 +++- .../destination/destination.styled.tsx | 10 --- .../overview/destination/destination.tsx | 28 ++---- .../destination/new.destination.flow.tsx | 59 ++++--------- 7 files changed, 168 insertions(+), 84 deletions(-) create mode 100644 frontend/webapp/app/overview/destinations/create/[id]/page.tsx create mode 100644 frontend/webapp/app/overview/destinations/manage/page.tsx diff --git a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx new file mode 100644 index 000000000..db9aa3786 --- /dev/null +++ b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx @@ -0,0 +1,87 @@ +"use client"; +import React, { useEffect, useState } from "react"; +import { OVERVIEW, QUERIES } from "@/utils/constants"; +import { useMutation, useQuery } from "react-query"; +import { + getDestination, + getDestinationsTypes, + setDestination, +} from "@/services"; +import { ManageDestination, OverviewHeader } from "@/components/overview"; +import { useSectionData } from "@/hooks"; +import { useRouter, useSearchParams } from "next/navigation"; +import { styled } from "styled-components"; + +const NewDestinationContainer = styled.div` + padding: 20px 36px; +`; + +export default function NewDestinationFlow({ onSuccess, onError }) { + const { sectionData, setSectionData } = useSectionData(null); + const searchParams = useSearchParams(); + const { data: destinationType } = useQuery( + [QUERIES.API_DESTINATION_TYPE, sectionData?.type], + () => getDestination(sectionData?.type), + { + enabled: !!sectionData, + } + ); + + const { isLoading, data } = useQuery( + [QUERIES.API_DESTINATION_TYPES], + getDestinationsTypes + ); + + const { mutate } = useMutation((body) => setDestination(body)); + const router = useRouter(); + + useEffect(() => { + const search = searchParams.get("dest"); + let currentData = null; + data?.categories.forEach((item) => { + const filterItem = item.items.filter((dest) => dest?.type === search); + if (filterItem.length) { + currentData = filterItem[0]; + } + }); + setSectionData(currentData); + }, [data]); + + function onSubmit(newDestination) { + const destination = { + ...newDestination, + type: sectionData.type, + }; + + mutate(destination, { + onSuccess: () => onSuccess(OVERVIEW.DESTINATION_CREATED_SUCCESS), + onError, + }); + } + + function handleBackPress() { + router.back(); + } + + if (isLoading) { + return; + } + + return ( + <> + + {destinationType && sectionData && ( + + + + )} + + ); +} diff --git a/frontend/webapp/app/overview/destinations/create/page.tsx b/frontend/webapp/app/overview/destinations/create/page.tsx index 3a0cf9a91..a6e4964b5 100644 --- a/frontend/webapp/app/overview/destinations/create/page.tsx +++ b/frontend/webapp/app/overview/destinations/create/page.tsx @@ -24,13 +24,9 @@ export default function CreateDestinationPage() { } return ( -
- router.back()} - /> + <> + -
+ ); } diff --git a/frontend/webapp/app/overview/destinations/manage/page.tsx b/frontend/webapp/app/overview/destinations/manage/page.tsx new file mode 100644 index 000000000..1fb2b1cc7 --- /dev/null +++ b/frontend/webapp/app/overview/destinations/manage/page.tsx @@ -0,0 +1,43 @@ +"use client"; +import React, { useState } from "react"; +import { NOTIFICATION, OVERVIEW } from "@/utils/constants"; +import { useNotification } from "@/hooks"; +import { useRouter } from "next/navigation"; +import { UpdateDestinationFlow } from "@/containers/overview/destination/update.destination.flow"; + +export function ManageDestinationPage() { + const [selectedDestination, setSelectedDestination] = useState(null); + + const { show, Notification } = useNotification(); + + const router = useRouter(); + + function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { + setSelectedDestination(null); + router.push("destinations"); + show({ + type: NOTIFICATION.SUCCESS, + message, + }); + } + + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + + return ( + <> + + + + ); +} diff --git a/frontend/webapp/app/overview/destinations/page.tsx b/frontend/webapp/app/overview/destinations/page.tsx index 7056885ed..bb83b2d78 100644 --- a/frontend/webapp/app/overview/destinations/page.tsx +++ b/frontend/webapp/app/overview/destinations/page.tsx @@ -1,11 +1,22 @@ "use client"; import { DestinationContainer } from "@/containers/overview"; import React from "react"; +import { styled } from "styled-components"; + +const DestinationContainerWrapper = styled.div` + height: 100vh; + overflow-y: hidden; + ::-webkit-scrollbar { + display: none; + } + -ms-overflow-style: none; + scrollbar-width: none; +`; export default function DestinationDashboardPage() { return ( - <> + - + ); } diff --git a/frontend/webapp/containers/overview/destination/destination.styled.tsx b/frontend/webapp/containers/overview/destination/destination.styled.tsx index cac5196dd..008ad16f7 100644 --- a/frontend/webapp/containers/overview/destination/destination.styled.tsx +++ b/frontend/webapp/containers/overview/destination/destination.styled.tsx @@ -1,15 +1,5 @@ import styled from "styled-components"; -export const DestinationContainerWrapper = styled.div` - height: 100vh; - overflow-y: hidden; - ::-webkit-scrollbar { - display: none; - } - -ms-overflow-style: none; - scrollbar-width: none; -`; - export const NewDestinationContainer = styled.div` padding: 20px 36px; `; diff --git a/frontend/webapp/containers/overview/destination/destination.tsx b/frontend/webapp/containers/overview/destination/destination.tsx index 3dbf5ed33..4b86c417d 100644 --- a/frontend/webapp/containers/overview/destination/destination.tsx +++ b/frontend/webapp/containers/overview/destination/destination.tsx @@ -1,18 +1,14 @@ "use client"; -import React, { useState } from "react"; +import React from "react"; import { KeyvalLoader } from "@/design.system"; import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; import { useQuery } from "react-query"; import { getDestinations } from "@/services"; import { OverviewHeader, DestinationsManagedList } from "@/components/overview"; -import { DestinationContainerWrapper } from "./destination.styled"; -import { UpdateDestinationFlow } from "./update.destination.flow"; import { useNotification } from "@/hooks"; import { useRouter } from "next/navigation"; export function DestinationContainer() { - const [selectedDestination, setSelectedDestination] = useState(null); - const { show, Notification } = useNotification(); const { isLoading: destinationLoading, @@ -24,7 +20,6 @@ export function DestinationContainer() { function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { refetch(); - setSelectedDestination(null); router.push("destinations"); show({ type: NOTIFICATION.SUCCESS, @@ -40,24 +35,13 @@ export function DestinationContainer() { }); } - function renderUpdateDestinationFlow() { - return ( - - ); - } - function renderDestinationList() { return ( <> {}} onMenuButtonClick={() => router.push("destinations/create")} /> @@ -69,11 +53,9 @@ export function DestinationContainer() { } return ( - - {selectedDestination - ? renderUpdateDestinationFlow() - : renderDestinationList()} + <> + {renderDestinationList()} - + ); } diff --git a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx index 7a75a32c0..a8e1315cd 100644 --- a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx @@ -1,24 +1,19 @@ "use client"; -import React, { useState } from "react"; -import { OVERVIEW, QUERIES } from "@/utils/constants"; -import { useMutation, useQuery } from "react-query"; -import { getDestination, setDestination } from "@/services"; -import { ManageDestination, OverviewHeader } from "@/components/overview"; +import React from "react"; +import { OVERVIEW } from "@/utils/constants"; +import { useMutation } from "react-query"; +import { setDestination } from "@/services"; +import { OverviewHeader } from "@/components/overview"; import { useSectionData } from "@/hooks"; import { DestinationSection } from "@/containers/setup/destination/destination.section"; import { NewDestinationContainer } from "./destination.styled"; +import { useRouter } from "next/navigation"; -export function NewDestinationFlow({ onBackClick, onSuccess, onError }) { +export function NewDestinationFlow({ onSuccess, onError }) { const { sectionData, setSectionData } = useSectionData(null); - const [managed, setManaged] = useState(null); - const { data: destinationType } = useQuery( - [QUERIES.API_DESTINATION_TYPE, sectionData?.type], - () => getDestination(sectionData?.type), - { - enabled: !!sectionData, - } - ); + const { mutate } = useMutation((body) => setDestination(body)); + const router = useRouter(); function onSubmit(newDestination) { const destination = { @@ -33,35 +28,17 @@ export function NewDestinationFlow({ onBackClick, onSuccess, onError }) { } function handleBackPress() { - if (managed && sectionData) { - setManaged(false); - setSectionData(null); - return; - } - onBackClick(); - } - - function renderNewDestinationForm() { - return ( - - ); + router.back(); } function renderSelectNewDestination() { return ( - <> - { - setSectionData(data); - setManaged(true); - }} - /> - + { + router.push(`/overview/destinations/create/manage?dest=${data.type}`); + }} + /> ); } @@ -72,9 +49,7 @@ export function NewDestinationFlow({ onBackClick, onSuccess, onError }) { onBackClick={handleBackPress} /> - {managed && sectionData - ? renderNewDestinationForm() - : renderSelectNewDestination()} + {renderSelectNewDestination()} ); From 0a30a2330c762e380639e8e67e3ad5156948d4e2 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 2 Aug 2023 13:36:47 +0300 Subject: [PATCH 039/374] manage dest flow --- .../app/overview/destinations/create/page.tsx | 3 +- .../app/overview/destinations/manage/page.tsx | 56 +++++++++++++------ .../overview/destination/destination.tsx | 30 +++------- .../destination/new.destination.flow.tsx | 20 +++---- .../destination/update.destination.flow.tsx | 8 ++- .../notification/notification.tsx | 21 ++++--- .../notification/portal.notification.tsx | 46 +++++++++++++++ 7 files changed, 121 insertions(+), 63 deletions(-) create mode 100644 frontend/webapp/design.system/notification/portal.notification.tsx diff --git a/frontend/webapp/app/overview/destinations/create/page.tsx b/frontend/webapp/app/overview/destinations/create/page.tsx index a6e4964b5..83b9316b3 100644 --- a/frontend/webapp/app/overview/destinations/create/page.tsx +++ b/frontend/webapp/app/overview/destinations/create/page.tsx @@ -1,5 +1,5 @@ "use client"; -import React from "react"; +import React, { useEffect } from "react"; import { NOTIFICATION, OVERVIEW } from "@/utils/constants"; import { useNotification } from "@/hooks"; import { NewDestinationFlow } from "@/containers/overview/destination/new.destination.flow"; @@ -8,6 +8,7 @@ import { useRouter } from "next/navigation"; export default function CreateDestinationPage() { const { show, Notification } = useNotification(); const router = useRouter(); + function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { show({ type: NOTIFICATION.SUCCESS, diff --git a/frontend/webapp/app/overview/destinations/manage/page.tsx b/frontend/webapp/app/overview/destinations/manage/page.tsx index 1fb2b1cc7..6f0456d9b 100644 --- a/frontend/webapp/app/overview/destinations/manage/page.tsx +++ b/frontend/webapp/app/overview/destinations/manage/page.tsx @@ -1,20 +1,37 @@ "use client"; -import React, { useState } from "react"; -import { NOTIFICATION, OVERVIEW } from "@/utils/constants"; +import React, { useEffect, useState } from "react"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; import { useNotification } from "@/hooks"; -import { useRouter } from "next/navigation"; -import { UpdateDestinationFlow } from "@/containers/overview/destination/update.destination.flow"; +import { useRouter, useSearchParams } from "next/navigation"; +import UpdateDestinationFlow from "@/containers/overview/destination/update.destination.flow"; +import { getDestinations } from "@/services"; +import { useQuery } from "react-query"; -export function ManageDestinationPage() { +export default function ManageDestinationPage() { const [selectedDestination, setSelectedDestination] = useState(null); const { show, Notification } = useNotification(); - + const { + isLoading: destinationLoading, + data: destinationList, + refetch, + } = useQuery([QUERIES.API_DESTINATIONS], getDestinations); const router = useRouter(); + const searchParams = useSearchParams(); + + useEffect(() => { + const search = searchParams.get("dest"); + const currentDestination = destinationList?.filter( + (item) => item?.id === search + ); + if (currentDestination?.length) { + setSelectedDestination(currentDestination[0]); + } + }, [searchParams, destinationList]); function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { - setSelectedDestination(null); - router.push("destinations"); + router.back(); + refetch(); show({ type: NOTIFICATION.SUCCESS, message, @@ -29,15 +46,20 @@ export function ManageDestinationPage() { }); } + if (destinationLoading) { + return; + } + return ( - <> - - - + selectedDestination && ( + <> + + + + ) ); } diff --git a/frontend/webapp/containers/overview/destination/destination.tsx b/frontend/webapp/containers/overview/destination/destination.tsx index 4b86c417d..946c0ba33 100644 --- a/frontend/webapp/containers/overview/destination/destination.tsx +++ b/frontend/webapp/containers/overview/destination/destination.tsx @@ -10,38 +10,22 @@ import { useRouter } from "next/navigation"; export function DestinationContainer() { const { show, Notification } = useNotification(); - const { - isLoading: destinationLoading, - data: destinationList, - refetch, - } = useQuery([QUERIES.API_DESTINATIONS], getDestinations); + const { isLoading: destinationLoading, data: destinationList } = useQuery( + [QUERIES.API_DESTINATIONS], + getDestinations + ); const router = useRouter(); - function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { - refetch(); - router.push("destinations"); - show({ - type: NOTIFICATION.SUCCESS, - message, - }); - } - - function onError({ response }) { - const message = response?.data?.message; - show({ - type: NOTIFICATION.ERROR, - message, - }); - } - function renderDestinationList() { return ( <> {}} + onItemClick={({ id }) => + router.push(`destinations/manage?dest=${id}`) + } onMenuButtonClick={() => router.push("destinations/create")} /> diff --git a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx index a8e1315cd..cb89ac339 100644 --- a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx @@ -15,17 +15,17 @@ export function NewDestinationFlow({ onSuccess, onError }) { const { mutate } = useMutation((body) => setDestination(body)); const router = useRouter(); - function onSubmit(newDestination) { - const destination = { - ...newDestination, - type: sectionData.type, - }; + // function onSubmit(newDestination) { + // const destination = { + // ...newDestination, + // type: sectionData.type, + // }; - mutate(destination, { - onSuccess: () => onSuccess(OVERVIEW.DESTINATION_CREATED_SUCCESS), - onError, - }); - } + // mutate(destination, { + // onSuccess: () => onSuccess(OVERVIEW.DESTINATION_CREATED_SUCCESS), + // onError, + // }); + // } function handleBackPress() { router.back(); diff --git a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx b/frontend/webapp/containers/overview/destination/update.destination.flow.tsx index 8eb710a29..d95fe7ac4 100644 --- a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/update.destination.flow.tsx @@ -7,13 +7,15 @@ import { getDestination, updateDestination } from "@/services"; import { ManageDestination } from "@/components/overview"; import { deleteDestination } from "@/services/destinations"; import { ManageDestinationWrapper } from "./destination.styled"; +import { useRouter } from "next/navigation"; -export function UpdateDestinationFlow({ +export default function UpdateDestinationFlow({ selectedDestination, - setSelectedDestination, onSuccess, onError, }) { + const router = useRouter(); + const manageData = useMemo(() => { return { ...selectedDestination, @@ -60,7 +62,7 @@ export function UpdateDestinationFlow({ ) : ( setSelectedDestination(null)} + onBackClick={() => router.back()} destinationType={destinationType} selectedDestination={manageData} onSubmit={onSubmit} diff --git a/frontend/webapp/design.system/notification/notification.tsx b/frontend/webapp/design.system/notification/notification.tsx index a8d53e169..bd8af8ad0 100644 --- a/frontend/webapp/design.system/notification/notification.tsx +++ b/frontend/webapp/design.system/notification/notification.tsx @@ -7,6 +7,7 @@ import { KeyvalText } from "../text/text"; import CloseIcon from "@/assets/icons/X-blue.svg"; import SuccessIcon from "@/assets/icons/success-notification.svg"; import ErrorIcon from "@/assets/icons/error-notification.svg"; +import PortalNotification from "./portal.notification"; interface KeyvalNotificationProps { type: "success" | "error" | "warning" | "info"; message: string; @@ -47,14 +48,16 @@ export function KeyvalNotification({ } return ( - - - {getIcon()} - - {message} - - - - + + + + {getIcon()} + + {message} + + + + + ); } diff --git a/frontend/webapp/design.system/notification/portal.notification.tsx b/frontend/webapp/design.system/notification/portal.notification.tsx new file mode 100644 index 000000000..d220c0fa8 --- /dev/null +++ b/frontend/webapp/design.system/notification/portal.notification.tsx @@ -0,0 +1,46 @@ +import { useState, useLayoutEffect } from "react"; +import { createPortal } from "react-dom"; + +interface Props { + children: JSX.Element; + wrapperId: string; +} + +const PortalNotification = ({ children, wrapperId }: Props) => { + const [portalElement, setPortalElement] = useState(null); + + useLayoutEffect(() => { + let element = document.getElementById(wrapperId) as HTMLElement; + let portalCreated = false; + // if element is not found with wrapperId or wrapperId is not provided, + // create and append to body + if (!element) { + element = createWrapperAndAppendToBody(wrapperId); + portalCreated = true; + } + + setPortalElement(element); + + // cleaning up the portal element + return () => { + // delete the programatically created element + if (portalCreated && element.parentNode) { + element.parentNode.removeChild(element); + } + }; + }, [wrapperId]); + + const createWrapperAndAppendToBody = (elementId: string) => { + const element = document.createElement("div"); + element.setAttribute("id", elementId); + document.body.appendChild(element); + return element; + }; + + // portalElement state will be null on the very first render. + if (!portalElement) return null; + + return createPortal(children, portalElement); +}; + +export default PortalNotification; From 71e52b79f47ec88503c3395612d7c7f15ec971de Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 2 Aug 2023 13:47:25 +0300 Subject: [PATCH 040/374] fixed pr comments --- .../destinations/create/[id]/page.tsx | 26 ++++++++++++++---- .../app/overview/destinations/create/page.tsx | 26 ++---------------- .../app/overview/destinations/manage/page.tsx | 5 ++-- .../overview/destination/destination.tsx | 27 +++++-------------- .../destination/new.destination.flow.tsx | 16 +---------- 5 files changed, 33 insertions(+), 67 deletions(-) diff --git a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx index db9aa3786..beea208f5 100644 --- a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx +++ b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx @@ -1,6 +1,6 @@ "use client"; -import React, { useEffect, useState } from "react"; -import { OVERVIEW, QUERIES } from "@/utils/constants"; +import React, { useEffect } from "react"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; import { useMutation, useQuery } from "react-query"; import { getDestination, @@ -8,7 +8,7 @@ import { setDestination, } from "@/services"; import { ManageDestination, OverviewHeader } from "@/components/overview"; -import { useSectionData } from "@/hooks"; +import { useNotification, useSectionData } from "@/hooks"; import { useRouter, useSearchParams } from "next/navigation"; import { styled } from "styled-components"; @@ -16,7 +16,7 @@ const NewDestinationContainer = styled.div` padding: 20px 36px; `; -export default function NewDestinationFlow({ onSuccess, onError }) { +export default function NewDestinationFlow() { const { sectionData, setSectionData } = useSectionData(null); const searchParams = useSearchParams(); const { data: destinationType } = useQuery( @@ -31,7 +31,7 @@ export default function NewDestinationFlow({ onSuccess, onError }) { [QUERIES.API_DESTINATION_TYPES], getDestinationsTypes ); - + const { show, Notification } = useNotification(); const { mutate } = useMutation((body) => setDestination(body)); const router = useRouter(); @@ -47,6 +47,21 @@ export default function NewDestinationFlow({ onSuccess, onError }) { setSectionData(currentData); }, [data]); + function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { + show({ + type: NOTIFICATION.SUCCESS, + message, + }); + } + + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + function onSubmit(newDestination) { const destination = { ...newDestination, @@ -82,6 +97,7 @@ export default function NewDestinationFlow({ onSuccess, onError }) { /> )} + ); } diff --git a/frontend/webapp/app/overview/destinations/create/page.tsx b/frontend/webapp/app/overview/destinations/create/page.tsx index 83b9316b3..c50719655 100644 --- a/frontend/webapp/app/overview/destinations/create/page.tsx +++ b/frontend/webapp/app/overview/destinations/create/page.tsx @@ -1,33 +1,11 @@ "use client"; -import React, { useEffect } from "react"; -import { NOTIFICATION, OVERVIEW } from "@/utils/constants"; -import { useNotification } from "@/hooks"; +import React from "react"; import { NewDestinationFlow } from "@/containers/overview/destination/new.destination.flow"; -import { useRouter } from "next/navigation"; export default function CreateDestinationPage() { - const { show, Notification } = useNotification(); - const router = useRouter(); - - function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { - show({ - type: NOTIFICATION.SUCCESS, - message, - }); - } - - function onError({ response }) { - const message = response?.data?.message; - show({ - type: NOTIFICATION.ERROR, - message, - }); - } - return ( <> - - + ); } diff --git a/frontend/webapp/app/overview/destinations/manage/page.tsx b/frontend/webapp/app/overview/destinations/manage/page.tsx index 6f0456d9b..1a1b99b7b 100644 --- a/frontend/webapp/app/overview/destinations/manage/page.tsx +++ b/frontend/webapp/app/overview/destinations/manage/page.tsx @@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react"; import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; import { useNotification } from "@/hooks"; -import { useRouter, useSearchParams } from "next/navigation"; +import { useSearchParams } from "next/navigation"; import UpdateDestinationFlow from "@/containers/overview/destination/update.destination.flow"; import { getDestinations } from "@/services"; import { useQuery } from "react-query"; @@ -16,7 +16,7 @@ export default function ManageDestinationPage() { data: destinationList, refetch, } = useQuery([QUERIES.API_DESTINATIONS], getDestinations); - const router = useRouter(); + const searchParams = useSearchParams(); useEffect(() => { @@ -30,7 +30,6 @@ export default function ManageDestinationPage() { }, [searchParams, destinationList]); function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { - router.back(); refetch(); show({ type: NOTIFICATION.SUCCESS, diff --git a/frontend/webapp/containers/overview/destination/destination.tsx b/frontend/webapp/containers/overview/destination/destination.tsx index 946c0ba33..1b0361712 100644 --- a/frontend/webapp/containers/overview/destination/destination.tsx +++ b/frontend/webapp/containers/overview/destination/destination.tsx @@ -1,15 +1,13 @@ "use client"; import React from "react"; import { KeyvalLoader } from "@/design.system"; -import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { OVERVIEW, QUERIES } from "@/utils/constants"; import { useQuery } from "react-query"; import { getDestinations } from "@/services"; import { OverviewHeader, DestinationsManagedList } from "@/components/overview"; -import { useNotification } from "@/hooks"; import { useRouter } from "next/navigation"; export function DestinationContainer() { - const { show, Notification } = useNotification(); const { isLoading: destinationLoading, data: destinationList } = useQuery( [QUERIES.API_DESTINATIONS], getDestinations @@ -17,29 +15,18 @@ export function DestinationContainer() { const router = useRouter(); - function renderDestinationList() { - return ( - <> - - - router.push(`destinations/manage?dest=${id}`) - } - onMenuButtonClick={() => router.push("destinations/create")} - /> - - ); - } - if (destinationLoading) { return ; } return ( <> - {renderDestinationList()} - + + router.push(`destinations/manage?dest=${id}`)} + onMenuButtonClick={() => router.push("destinations/create")} + /> ); } diff --git a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx index cb89ac339..2f48b1a05 100644 --- a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx @@ -9,24 +9,10 @@ import { DestinationSection } from "@/containers/setup/destination/destination.s import { NewDestinationContainer } from "./destination.styled"; import { useRouter } from "next/navigation"; -export function NewDestinationFlow({ onSuccess, onError }) { +export function NewDestinationFlow() { const { sectionData, setSectionData } = useSectionData(null); - - const { mutate } = useMutation((body) => setDestination(body)); const router = useRouter(); - // function onSubmit(newDestination) { - // const destination = { - // ...newDestination, - // type: sectionData.type, - // }; - - // mutate(destination, { - // onSuccess: () => onSuccess(OVERVIEW.DESTINATION_CREATED_SUCCESS), - // onError, - // }); - // } - function handleBackPress() { router.back(); } From 55cae09ab350ae6f8220e7d8f409c91152784e9f Mon Sep 17 00:00:00 2001 From: Alon Braymok <138359965+alonkeyval@users.noreply.github.com> Date: Wed, 2 Aug 2023 13:47:47 +0300 Subject: [PATCH 041/374] Overview sources (#364) --- frontend/webapp/app/page.tsx | 3 +- .../destination.list.styled.tsx | 2 - .../manage.destination.header.tsx | 6 +-- .../manage.destination/manage.destination.tsx | 50 ++++++++++++++----- .../overview.header/overview.header.tsx | 18 +++++-- .../sources.action.menu.styled.tsx | 1 + .../sources.manage.list.tsx | 2 +- .../sources.manage.styled.tsx | 2 +- .../create.connection.form.tsx | 41 ++++++++------- .../destination.card.styled.tsx | 4 +- .../destination.card/destination.card.tsx | 5 +- .../destination.list.styled.tsx | 6 ++- .../filter.sources.options.tsx | 9 ++-- .../sources.option.menu.styled.tsx | 14 ++---- .../destination/destination.styled.tsx | 8 ++- .../overview/sources/manage.sources.tsx | 26 ++++------ .../overview/sources/new.source.flow.tsx | 37 ++++++++++---- .../containers/overview/sources/sources.tsx | 47 +++++++++++++++-- .../destination.section.styled.tsx | 1 - .../setup/setup.section/setup.section.tsx | 5 +- .../setup/sources/sources.section.tsx | 24 +++++---- frontend/webapp/services/sources.tsx | 3 +- frontend/webapp/types/sources.tsx | 22 ++++++++ frontend/webapp/utils/constants/string.tsx | 3 ++ 24 files changed, 226 insertions(+), 113 deletions(-) diff --git a/frontend/webapp/app/page.tsx b/frontend/webapp/app/page.tsx index 1b259b2ed..20d26031b 100644 --- a/frontend/webapp/app/page.tsx +++ b/frontend/webapp/app/page.tsx @@ -4,7 +4,6 @@ import { useEffect } from "react"; import { getConfig } from "@/services/config"; import { useRouter } from "next/navigation"; import { ROUTES, CONFIG, QUERIES } from "@/utils/constants"; -import { KeyvalLoader } from "@/design.system"; export default function App() { const router = useRouter(); @@ -16,7 +15,6 @@ export default function App() { function renderCurrentPage() { const { installation } = data; - const state = installation === CONFIG.APPS_SELECTED ? `?state=${CONFIG.APPS_SELECTED}` @@ -25,6 +23,7 @@ export default function App() { case CONFIG.NEW: case CONFIG.APPS_SELECTED: router.push(`${ROUTES.SETUP}${state}`); + break; case CONFIG.FINISHED: router.push(ROUTES.OVERVIEW); } diff --git a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx index c06fdca16..f172a32f9 100644 --- a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx @@ -1,11 +1,9 @@ import { styled } from "styled-components"; export const ManagedListWrapper = styled.div` - width: 100%; display: flex; flex-wrap: wrap; gap: 24px; - overflow-y: scroll; padding: 0px 36px; padding-bottom: 50px; `; diff --git a/frontend/webapp/components/overview/destination/manage.destination.header/manage.destination.header.tsx b/frontend/webapp/components/overview/destination/manage.destination.header/manage.destination.header.tsx index e38dff4e7..59bc496cd 100644 --- a/frontend/webapp/components/overview/destination/manage.destination.header/manage.destination.header.tsx +++ b/frontend/webapp/components/overview/destination/manage.destination.header/manage.destination.header.tsx @@ -26,9 +26,7 @@ const IMAGE_STYLE: React.CSSProperties = { marginLeft: 16, }; -export function ManageDestinationHeader({ - data: { image_url, display_name, type }, -}) { +export function ManageDestinationHeader({ data: { image_url, display_name } }) { return ( @@ -36,8 +34,6 @@ export function ManageDestinationHeader({ {display_name} - - {type} ); diff --git a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx index d129dea5f..51fd8d3cb 100644 --- a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx +++ b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx @@ -1,7 +1,7 @@ -import React from "react"; +import React, { useMemo } from "react"; import { styled } from "styled-components"; import { Back } from "@/assets/icons/overview"; -import { CreateConnectionForm } from "@/components/setup"; +import { CreateConnectionForm, QuickHelp } from "@/components/setup"; import { KeyvalText } from "@/design.system"; import { SETUP } from "@/utils/constants"; import { ManageDestinationHeader } from "../manage.destination.header/manage.destination.header"; @@ -25,6 +25,13 @@ const BackButtonWrapper = styled.div` } `; +const CreateConnectionWrapper = styled.div` + display: flex; + gap: 200px; + overflow: scroll; + scrollbar-width: none; +`; + export function ManageDestination({ destinationType, selectedDestination, @@ -32,6 +39,18 @@ export function ManageDestination({ onSubmit, onDelete, }: ManageDestinationProps) { + const videoList = useMemo( + () => + destinationType?.fields + ?.filter((field) => field?.video_url) + ?.map((field) => ({ + name: field.display_name, + src: field.video_url, + thumbnail_url: field.thumbnail_url, + })), + [destinationType] + ); + return ( <> {onBackClick && ( @@ -41,17 +60,22 @@ export function ManageDestination({ )} - onSubmit(data)} - /> - {onDelete && ( - - )} + +
+ onSubmit(data)} + /> + {onDelete && ( + + )} +
+ {videoList?.length > 0 && } +
); } diff --git a/frontend/webapp/components/overview/overview.header/overview.header.tsx b/frontend/webapp/components/overview/overview.header/overview.header.tsx index a515ec21f..c492495c2 100644 --- a/frontend/webapp/components/overview/overview.header/overview.header.tsx +++ b/frontend/webapp/components/overview/overview.header/overview.header.tsx @@ -14,20 +14,26 @@ const OverviewHeaderContainer = styled.div` display: flex; flex-direction: column; width: 100%; - padding: 24px; border-bottom: 2px solid rgba(255, 255, 255, 0.08); background: ${({ theme }) => theme.colors.light_dark}; `; const BackButtonWrapper = styled.div` display: flex; - margin-bottom: 8px; + margin: 24px; + margin-bottom: 0; cursor: pointer; p { cursor: pointer !important; } `; +const TextWrapper = styled.div` + margin-top: 24px; + margin-left: 24px; + margin-bottom: 24px; +`; + export function OverviewHeader({ title, onBackClick }: OverviewHeaderProps) { return ( @@ -37,9 +43,11 @@ export function OverviewHeader({ title, onBackClick }: OverviewHeaderProps) { {SETUP.BACK} )} - - {title} - + + + {title} + + ); } diff --git a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx index ee4c046ad..146df0a97 100644 --- a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx +++ b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx @@ -4,6 +4,7 @@ export const SourcesMenuWrapper = styled.div` width: 100%; margin: 32px 0; display: flex; + align-items: center; justify-content: space-between; `; diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx index fa63eda5a..b5a82fad5 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx @@ -17,7 +17,7 @@ interface SourcesManagedListProps { export function SourcesManagedList({ data = [] }: SourcesManagedListProps) { function renderSources() { return data.map((source: ManagedSource) => ( - + )); } diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx index ffbdffed2..3fd4cad8d 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx @@ -27,7 +27,7 @@ export const EmptyListWrapper = styled.div` `; export const ManagedListWrapper = styled.div` - height: 75%; + max-height: 72%; display: flex; flex-wrap: wrap; gap: 24px; diff --git a/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx b/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx index c5cfd3bc7..107063fd8 100644 --- a/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx +++ b/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx @@ -105,11 +105,16 @@ export function CreateConnectionForm({ } function isFormValid() { - const dynamicFieldsValues = Object.values(dynamicFields); + const areDynamicFieldsFilled = Object.values(dynamicFields).every( + (field) => field + ); + + const isFieldLengthMatching = + (fields?.length ?? 0) === + (dynamicFields ? Object.keys(dynamicFields).length : 0); + const isValid = - !!destinationName && - dynamicFieldsValues.every((field: Field) => field) && - dynamicFieldsValues.length === fields?.length; + !!destinationName && areDynamicFieldsFilled && isFieldLengthMatching; setIsCreateButtonDisabled(!isValid); } @@ -134,19 +139,21 @@ export function CreateConnectionForm({ ? SETUP.UPDATE_CONNECTION : SETUP.CREATE_CONNECTION} - - {SETUP.CONNECTION_MONITORS} - - {selectedMonitors.map((checkbox) => ( - handleCheckboxChange(checkbox?.id)} - label={checkbox?.label} - /> - ))} - - + {selectedMonitors?.length > 1 && ( + + {SETUP.CONNECTION_MONITORS} + + {selectedMonitors.map((checkbox) => ( + handleCheckboxChange(checkbox?.id)} + label={checkbox?.label} + /> + ))} + + + )} + <> setSearchFilter(e.target.value)} @@ -30,6 +27,6 @@ export function FilterSourcesOptions({ onChange={handleDropDownChange} /> - + ); } diff --git a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx index 33ae15b5f..0c05c9c59 100644 --- a/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx +++ b/frontend/webapp/components/setup/sources/sources.option.menu/sources.option.menu.styled.tsx @@ -5,16 +5,9 @@ export const SourcesOptionMenuWrapper = styled.section` align-items: center; gap: 24px; padding: 40px 0 0 0; -`; - -export const FilterMenuWrapper = styled.div` - display: flex; - gap: 16px; - align-items: center; - - @media screen and (max-width: 1400px) { - flex-wrap: wrap; - width: 90%; + flex-wrap: wrap; + @media screen and (max-width: 1650px) { + width: 85%; } `; @@ -34,5 +27,4 @@ export const CheckboxWrapper = styled.div` export const SwitcherWrapper = styled.div` min-width: 90px; - margin-left: 24px; `; diff --git a/frontend/webapp/containers/overview/destination/destination.styled.tsx b/frontend/webapp/containers/overview/destination/destination.styled.tsx index fd3764d16..cac5196dd 100644 --- a/frontend/webapp/containers/overview/destination/destination.styled.tsx +++ b/frontend/webapp/containers/overview/destination/destination.styled.tsx @@ -2,8 +2,12 @@ import styled from "styled-components"; export const DestinationContainerWrapper = styled.div` height: 100vh; - width: 100%; - overflow-y: scroll; + overflow-y: hidden; + ::-webkit-scrollbar { + display: none; + } + -ms-overflow-style: none; + scrollbar-width: none; `; export const NewDestinationContainer = styled.div` diff --git a/frontend/webapp/containers/overview/sources/manage.sources.tsx b/frontend/webapp/containers/overview/sources/manage.sources.tsx index 85fbef48e..af0e0daa9 100644 --- a/frontend/webapp/containers/overview/sources/manage.sources.tsx +++ b/frontend/webapp/containers/overview/sources/manage.sources.tsx @@ -1,16 +1,18 @@ "use client"; import React, { useEffect, useMemo, useState } from "react"; -import { KeyvalLoader } from "@/design.system"; import { QUERIES } from "@/utils/constants"; import { useQuery } from "react-query"; -import { getNamespaces, getSources } from "@/services"; +import { getNamespaces } from "@/services"; import { SourcesActionMenu, SourcesManagedList } from "@/components/overview"; import { MenuWrapper } from "./sources.styled"; -import { ManagedSource } from "@/types/sources"; +import { ManagedSource, Namespace } from "@/types/sources"; -export function ManageSources({ setDisplayNewSourceFlow }) { +const DEFAULT_FILTER = { name: "default", selected: false, totalApps: 0 }; + +export function ManageSources({ setDisplayNewSourceFlow, sources }) { const [searchFilter, setSearchFilter] = useState(""); - const [currentNamespace, setCurrentNamespace] = useState(null); + const [currentNamespace, setCurrentNamespace] = + useState(DEFAULT_FILTER); const { data: namespaces } = useQuery( [QUERIES.API_NAMESPACES], @@ -23,19 +25,13 @@ export function ManageSources({ setDisplayNewSourceFlow }) { const namespacesList = useMemo( () => - namespaces?.namespaces?.map((item: any, index: number) => ({ + namespaces?.namespaces?.map((item: Namespace, index: number) => ({ id: index, label: item.name, })), [namespaces] ); - const { - data: sources, - refetch, - isLoading, - } = useQuery([QUERIES.API_SOURCES], getSources); - function filterByNamespace() { return currentNamespace ? sources?.filter( @@ -44,7 +40,7 @@ export function ManageSources({ setDisplayNewSourceFlow }) { : sources; } - function filterBySearchQuery(data) { + function filterBySearchQuery(data: ManagedSource[]) { return searchFilter ? data?.filter((item: ManagedSource) => item.name.toLowerCase().includes(searchFilter.toLowerCase()) @@ -57,10 +53,6 @@ export function ManageSources({ setDisplayNewSourceFlow }) { return filterBySearchQuery(data); } - if (isLoading) { - return ; - } - return ( <> diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx index 77f763455..5152767ba 100644 --- a/frontend/webapp/containers/overview/sources/new.source.flow.tsx +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -7,20 +7,36 @@ import theme from "@/styles/palette"; import { NOTIFICATION, OVERVIEW, SETUP } from "@/utils/constants"; import { useMutation } from "react-query"; import { setNamespaces } from "@/services"; +import { SelectedSources } from "@/types/sources"; -export function NewSourceFlow() { +export function NewSourceFlow({ onSuccess, sources }) { const { sectionData, setSectionData, totalSelected } = useSectionData({}); - const { mutate } = useMutation((body) => setNamespaces(body)); + const { mutate } = useMutation((body: SelectedSources) => + setNamespaces(body) + ); const { show, Notification } = useNotification(); - function handleNewSource() { - mutate(sectionData, { - onSuccess: () => { - setSectionData({}); - }, + function updateSectionDataWithSources() { + const sourceNamesSet = new Set(sources.map((source) => source.name)); + const updatedSectionData: SelectedSources = {}; + + for (const key in sectionData) { + const { objects, ...rest } = sectionData[key]; + const updatedObjects = objects.map((item) => ({ + ...item, + selected: item?.selected || sourceNamesSet.has(item.name), + })); + + updatedSectionData[key] = { + ...rest, + objects: updatedObjects, + }; + } + + mutate(updatedSectionData, { + onSuccess, onError: ({ response }) => { const message = response?.data?.message || SETUP.ERROR; - console.log({ response }); show({ type: NOTIFICATION.ERROR, message, @@ -33,7 +49,10 @@ export function NewSourceFlow() { {`${totalSelected} ${SETUP.SELECTED}`} - + {OVERVIEW.CONNECT} diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index 58bc728b3..fa2191caf 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -1,20 +1,56 @@ "use client"; -import React, { useState } from "react"; -import { OVERVIEW } from "@/utils/constants"; +import React, { useEffect, useState } from "react"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; import { OverviewHeader } from "@/components/overview"; import { SourcesContainerWrapper } from "./sources.styled"; import { NewSourceFlow } from "./new.source.flow"; import { ManageSources } from "./manage.sources"; +import { useNotification } from "@/hooks"; +import { useQuery } from "react-query"; +import { getSources } from "@/services"; export function SourcesContainer() { - const [displayNewSourceFlow, setDisplayNewSourceFlow] = useState(false); + const [displayNewSourceFlow, setDisplayNewSourceFlow] = useState< + boolean | null + >(null); + const { show, Notification } = useNotification(); + + const { data: sources, refetch } = useQuery( + [QUERIES.API_SOURCES], + getSources + ); + + useEffect(() => { + refetchSources(); + }, [displayNewSourceFlow]); + + async function refetchSources() { + if (displayNewSourceFlow === false) { + setTimeout(async () => { + refetch(); + }, 1000); + } + } + + function onNewSourceSuccess() { + setDisplayNewSourceFlow(false); + show({ + type: NOTIFICATION.SUCCESS, + message: OVERVIEW.SOURCE_CREATED_SUCCESS, + }); + } function renderNewSourceFlow() { - return ; + return ; } function renderSources() { - return ; + return ( + + ); } return ( @@ -26,6 +62,7 @@ export function SourcesContainer() { } /> {displayNewSourceFlow ? renderNewSourceFlow() : renderSources()} + ); } diff --git a/frontend/webapp/containers/setup/destination/destination.section.styled.tsx b/frontend/webapp/containers/setup/destination/destination.section.styled.tsx index 78f97cbdd..000d3870c 100644 --- a/frontend/webapp/containers/setup/destination/destination.section.styled.tsx +++ b/frontend/webapp/containers/setup/destination/destination.section.styled.tsx @@ -6,7 +6,6 @@ export const DestinationListContainer = styled.div` padding-bottom: 300px; margin-top: 24px; overflow: scroll; - scrollbar-width: none; `; export const EmptyListWrapper = styled.div` diff --git a/frontend/webapp/containers/setup/setup.section/setup.section.tsx b/frontend/webapp/containers/setup/setup.section/setup.section.tsx index c50a2581f..53da583c3 100644 --- a/frontend/webapp/containers/setup/setup.section/setup.section.tsx +++ b/frontend/webapp/containers/setup/setup.section/setup.section.tsx @@ -18,6 +18,7 @@ import { STEPS, Step } from "./utils"; import { setNamespaces } from "@/services"; import { useSearchParams } from "next/navigation"; import { useMutation } from "react-query"; +import { SelectedSources } from "@/types/sources"; const STATE = "state"; @@ -30,7 +31,9 @@ const sectionComponents = { export function SetupSection() { const [currentStep, setCurrentStep] = useState(STEPS[0]); const { sectionData, setSectionData, totalSelected } = useSectionData({}); - const { mutate } = useMutation((body) => setNamespaces(body)); + const { mutate } = useMutation((body: SelectedSources) => + setNamespaces(body) + ); const { show, Notification } = useNotification(); const searchParams = useSearchParams(); diff --git a/frontend/webapp/containers/setup/sources/sources.section.tsx b/frontend/webapp/containers/setup/sources/sources.section.tsx index b765fd13c..6eb6af810 100644 --- a/frontend/webapp/containers/setup/sources/sources.section.tsx +++ b/frontend/webapp/containers/setup/sources/sources.section.tsx @@ -3,7 +3,7 @@ import { SourcesList, SourcesOptionMenu } from "@/components/setup"; import { getApplication, getNamespaces } from "@/services"; import { LoaderWrapper } from "./sources.section.styled"; import { useQuery } from "react-query"; -import { QUERIES } from "@/utils/constants"; +import { NOTIFICATION, QUERIES } from "@/utils/constants"; import { KeyvalLoader } from "@/design.system"; import { useNotification } from "@/hooks"; @@ -32,24 +32,30 @@ export function SourcesSection({ sectionData, setSectionData }: any) { useEffect(() => { isError && show({ - type: "error", + type: NOTIFICATION.ERROR, message: error, }); }, [isError]); - const namespacesList = useMemo(() => { - return data?.namespaces?.map((item: any, index: number) => { - return { id: index, label: item.name }; - }); - }, [data]); + const namespacesList = useMemo( + () => + data?.namespaces?.map((item: any, index: number) => ({ + id: index, + label: item.name, + })), + [data] + ); const sourceData = useMemo(() => { - const namespace = sectionData[currentNamespace?.name]; - return searchFilter + let namespace = sectionData[currentNamespace?.name]; + //filter by search query + namespace = searchFilter ? namespace?.objects.filter((item: any) => item.name.toLowerCase().includes(searchFilter.toLowerCase()) ) : namespace?.objects; + //remove instrumented applications + return namespace?.filter((item: any) => !item.instrumentation_effective); }, [searchFilter, currentNamespace, sectionData]); async function onNameSpaceChange() { diff --git a/frontend/webapp/services/sources.tsx b/frontend/webapp/services/sources.tsx index 3f6f32148..eb50b72a2 100644 --- a/frontend/webapp/services/sources.tsx +++ b/frontend/webapp/services/sources.tsx @@ -1,5 +1,6 @@ import { API } from "@/utils/constants"; import { get, post } from "./api"; +import { SelectedSources } from "@/types/sources"; export async function getNamespaces() { return await get(API.NAMESPACES); @@ -9,7 +10,7 @@ export async function getApplication(id: string) { return await get(`${API.APPLICATIONS}/${id}`); } -export async function setNamespaces(body: any) { +export async function setNamespaces(body: SelectedSources): Promise { return await post(API.NAMESPACES, body); } diff --git a/frontend/webapp/types/sources.tsx b/frontend/webapp/types/sources.tsx index 53f44fe6e..7906c4733 100644 --- a/frontend/webapp/types/sources.tsx +++ b/frontend/webapp/types/sources.tsx @@ -9,3 +9,25 @@ export interface ManagedSource { } ]; } + +export interface Namespace { + name: string; + selected: boolean; + totalApps: number; +} + +export interface SelectedSources { + [key: string]: { + objects: { + name: string; + selected: boolean; + kind: string; + app_instrumentation_labeled: boolean | null; + ns_instrumentation_labeled: boolean | null; + instrumentation_effective: boolean | null; + instances: number; + }; + selected_all: boolean; + future_selected: boolean; + }; +} diff --git a/frontend/webapp/utils/constants/string.tsx b/frontend/webapp/utils/constants/string.tsx index eb57020dd..53903e8c5 100644 --- a/frontend/webapp/utils/constants/string.tsx +++ b/frontend/webapp/utils/constants/string.tsx @@ -67,6 +67,9 @@ export const OVERVIEW = { DESTINATION_UPDATE_SUCCESS: "Destination updated successfully", DESTINATION_CREATED_SUCCESS: "Destination created successfully", DESTINATION_DELETED_SUCCESS: "Destination deleted successfully", + SOURCE_UPDATE_SUCCESS: "Source updated successfully", + SOURCE_CREATED_SUCCESS: "Source created successfully", + SOURCE_DELETED_SUCCESS: "Source deleted successfully", MANAGE: "Manage", DELETE: "Delete", DELETE_DESTINATION: "Delete Destination", From 60a61ee0fbf8b5d4898fda3c7bdeb9f3d2b1c99c Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 2 Aug 2023 14:26:19 +0300 Subject: [PATCH 042/374] WIP --- .../destinations/create/[id]/page.tsx | 10 ++++-- .../app/overview/destinations/manage/page.tsx | 34 ++++++++++--------- .../manage.destination/manage.destination.tsx | 6 ++-- .../overview/destination/destination.tsx | 8 +++-- .../destination/new.destination.flow.tsx | 29 ++++------------ .../setup/destination/destination.section.tsx | 7 ++-- frontend/webapp/utils/constants/routes.tsx | 3 ++ 7 files changed, 45 insertions(+), 52 deletions(-) diff --git a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx index beea208f5..9a0269686 100644 --- a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx +++ b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx @@ -12,6 +12,8 @@ import { useNotification, useSectionData } from "@/hooks"; import { useRouter, useSearchParams } from "next/navigation"; import { styled } from "styled-components"; +const DEST = "dest"; + const NewDestinationContainer = styled.div` padding: 20px 36px; `; @@ -35,8 +37,10 @@ export default function NewDestinationFlow() { const { mutate } = useMutation((body) => setDestination(body)); const router = useRouter(); - useEffect(() => { - const search = searchParams.get("dest"); + useEffect(onPageLoad, [data]); + + function onPageLoad() { + const search = searchParams.get(DEST); let currentData = null; data?.categories.forEach((item) => { const filterItem = item.items.filter((dest) => dest?.type === search); @@ -45,7 +49,7 @@ export default function NewDestinationFlow() { } }); setSectionData(currentData); - }, [data]); + } function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { show({ diff --git a/frontend/webapp/app/overview/destinations/manage/page.tsx b/frontend/webapp/app/overview/destinations/manage/page.tsx index 1a1b99b7b..2b20da8cd 100644 --- a/frontend/webapp/app/overview/destinations/manage/page.tsx +++ b/frontend/webapp/app/overview/destinations/manage/page.tsx @@ -7,10 +7,12 @@ import UpdateDestinationFlow from "@/containers/overview/destination/update.dest import { getDestinations } from "@/services"; import { useQuery } from "react-query"; +const DEST = "dest"; + export default function ManageDestinationPage() { const [selectedDestination, setSelectedDestination] = useState(null); - const { show, Notification } = useNotification(); + const { isLoading: destinationLoading, data: destinationList, @@ -19,15 +21,17 @@ export default function ManageDestinationPage() { const searchParams = useSearchParams(); - useEffect(() => { - const search = searchParams.get("dest"); + useEffect(onPageLoad, [searchParams, destinationList]); + + function onPageLoad() { + const search = searchParams.get(DEST); const currentDestination = destinationList?.filter( - (item) => item?.id === search + ({ id }) => id === search ); if (currentDestination?.length) { setSelectedDestination(currentDestination[0]); } - }, [searchParams, destinationList]); + } function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { refetch(); @@ -45,20 +49,18 @@ export default function ManageDestinationPage() { }); } - if (destinationLoading) { + if (destinationLoading || !selectedDestination) { return; } return ( - selectedDestination && ( - <> - - - - ) + <> + + + ); } diff --git a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx index 32e3321de..839e5e635 100644 --- a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx +++ b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx @@ -25,10 +25,10 @@ const BackButtonWrapper = styled.div` } `; -const CreateConnectionWrapper = styled.div` +const CreateConnectionWrapper = styled.div<{ expand: boolean | undefined }>` display: flex; gap: 200px; - height: 530px; + height: ${({ expand }) => (expand ? 630 : 530)}px; overflow: scroll; scrollbar-width: none; `; @@ -61,7 +61,7 @@ export function ManageDestination({ )} - +
router.push(`destinations/manage?dest=${id}`)} - onMenuButtonClick={() => router.push("destinations/create")} + onItemClick={({ id }) => + router.push(`${ROUTES.UPDATE_DESTINATION}${id}`) + } + onMenuButtonClick={() => router.push(ROUTES.CREATE_DESTINATION)} /> ); diff --git a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx index 2f48b1a05..27c0dddc7 100644 --- a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx @@ -1,41 +1,26 @@ "use client"; import React from "react"; -import { OVERVIEW } from "@/utils/constants"; -import { useMutation } from "react-query"; -import { setDestination } from "@/services"; +import { OVERVIEW, ROUTES } from "@/utils/constants"; import { OverviewHeader } from "@/components/overview"; -import { useSectionData } from "@/hooks"; import { DestinationSection } from "@/containers/setup/destination/destination.section"; import { NewDestinationContainer } from "./destination.styled"; import { useRouter } from "next/navigation"; export function NewDestinationFlow() { - const { sectionData, setSectionData } = useSectionData(null); const router = useRouter(); - function handleBackPress() { - router.back(); - } - - function renderSelectNewDestination() { - return ( - { - router.push(`/overview/destinations/create/manage?dest=${data.type}`); - }} - /> - ); - } - return ( <> router.back()} /> - {renderSelectNewDestination()} + { + router.push(`${ROUTES.MANAGE_DESTINATION}${data.type}`); + }} + /> ); diff --git a/frontend/webapp/containers/setup/destination/destination.section.tsx b/frontend/webapp/containers/setup/destination/destination.section.tsx index e8dd0a051..a7e4440c6 100644 --- a/frontend/webapp/containers/setup/destination/destination.section.tsx +++ b/frontend/webapp/containers/setup/destination/destination.section.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from "react"; import { useQuery } from "react-query"; -import { QUERIES, SETUP } from "@/utils/constants"; +import { NOTIFICATION, QUERIES, SETUP } from "@/utils/constants"; import { MONITORING_OPTIONS } from "@/components/setup/destination/utils"; import { DestinationList, DestinationOptionMenu } from "@/components/setup"; import Empty from "@/assets/images/empty-list.svg"; @@ -20,12 +20,10 @@ import { useNotification } from "@/hooks"; import { getDestinationsTypes } from "@/services"; type DestinationSectionProps = { - sectionData: any; setSectionData: (data: any) => void; }; export function DestinationSection({ - sectionData, setSectionData, }: DestinationSectionProps) { const [searchFilter, setSearchFilter] = useState(""); @@ -42,7 +40,7 @@ export function DestinationSection({ useEffect(() => { isError && show({ - type: "error", + type: NOTIFICATION.ERROR, message: error, }); }, [isError]); @@ -72,7 +70,6 @@ export function DestinationSection({ setSectionData(item)} /> ) diff --git a/frontend/webapp/utils/constants/routes.tsx b/frontend/webapp/utils/constants/routes.tsx index a27e3f561..571975b38 100644 --- a/frontend/webapp/utils/constants/routes.tsx +++ b/frontend/webapp/utils/constants/routes.tsx @@ -4,4 +4,7 @@ export const ROUTES = { SOURCES: "/overview/sources", DESTINATIONS: "/overview/destinations", NEW_DESTINATION: "/setup?state=destinations", + MANAGE_DESTINATION: "/overview/destinations/create/manage?dest=", + UPDATE_DESTINATION: "destinations/manage?dest=", + CREATE_DESTINATION: "destinations/create", }; From c44837e17f314678bdd4d146cc9720717f4ad890 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 2 Aug 2023 14:35:39 +0300 Subject: [PATCH 043/374] WIP --- .../webapp/components/side.menu/menu/menu.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/webapp/components/side.menu/menu/menu.tsx b/frontend/webapp/components/side.menu/menu/menu.tsx index e17eb8022..bbef40e4b 100644 --- a/frontend/webapp/components/side.menu/menu/menu.tsx +++ b/frontend/webapp/components/side.menu/menu/menu.tsx @@ -4,7 +4,7 @@ import { MenuContainer, LogoWrapper, MenuItemsWrapper } from "./menu.styled"; import { KeyvalText } from "@/design.system"; import MenuItem from "../menu.item/menu.item"; import { useRouter } from "next/navigation"; -import { OVERVIEW } from "@/utils/constants"; +import { OVERVIEW, ROUTES } from "@/utils/constants"; import { MENU_ITEMS } from "./items"; export interface MenuItem { @@ -26,12 +26,13 @@ export function Menu() { useEffect(onLoad, []); function onLoad() { - const currentItem = MENU_ITEMS.find((item) => { - return item.navigate === window.location.pathname; - }); - if (currentItem?.id !== currentMenuItem.id) { - handleMenuItemClick(currentItem); - } + const currentItem = MENU_ITEMS.find( + ({ navigate }) => + navigate !== ROUTES.OVERVIEW && + window.location.pathname.includes(navigate) + ); + + currentItem && setCurrentMenuItem(currentItem); } function handleMenuItemClick(item) { From 924cee2c18d612f7348f49b3511e1977e3e4a642 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 2 Aug 2023 15:27:34 +0300 Subject: [PATCH 044/374] fixed pr comments --- .../destinations/create/[id]/page.tsx | 28 ++++++----- .../app/overview/destinations/create/page.tsx | 8 +--- .../app/overview/destinations/manage/page.tsx | 3 +- .../webapp/components/side.menu/menu/menu.tsx | 3 +- frontend/webapp/containers/overview/index.tsx | 1 + .../notification/notification.tsx | 22 ++++----- .../notification/portal.notification.tsx | 46 ------------------- 7 files changed, 32 insertions(+), 79 deletions(-) delete mode 100644 frontend/webapp/design.system/notification/portal.notification.tsx diff --git a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx index 9a0269686..f4082de12 100644 --- a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx +++ b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx @@ -20,7 +20,11 @@ const NewDestinationContainer = styled.div` export default function NewDestinationFlow() { const { sectionData, setSectionData } = useSectionData(null); + const { show, Notification } = useNotification(); + const { mutate } = useMutation((body) => setDestination(body)); const searchParams = useSearchParams(); + const router = useRouter(); + const { data: destinationType } = useQuery( [QUERIES.API_DESTINATION_TYPE, sectionData?.type], () => getDestination(sectionData?.type), @@ -29,25 +33,29 @@ export default function NewDestinationFlow() { } ); - const { isLoading, data } = useQuery( + const { data: destinationsList } = useQuery( [QUERIES.API_DESTINATION_TYPES], getDestinationsTypes ); - const { show, Notification } = useNotification(); - const { mutate } = useMutation((body) => setDestination(body)); - const router = useRouter(); - useEffect(onPageLoad, [data]); + useEffect(onPageLoad, [destinationsList]); function onPageLoad() { const search = searchParams.get(DEST); + if (!destinationsList || !search) return; + let currentData = null; - data?.categories.forEach((item) => { - const filterItem = item.items.filter((dest) => dest?.type === search); + + for (const category of destinationsList.categories) { + if (currentData) { + break; + } + const filterItem = category.items.filter(({ type }) => type === search); if (filterItem.length) { currentData = filterItem[0]; } - }); + } + setSectionData(currentData); } @@ -82,10 +90,6 @@ export default function NewDestinationFlow() { router.back(); } - if (isLoading) { - return; - } - return ( <> - - - ); + return ; } diff --git a/frontend/webapp/app/overview/destinations/manage/page.tsx b/frontend/webapp/app/overview/destinations/manage/page.tsx index 2b20da8cd..cd92c828f 100644 --- a/frontend/webapp/app/overview/destinations/manage/page.tsx +++ b/frontend/webapp/app/overview/destinations/manage/page.tsx @@ -6,6 +6,7 @@ import { useSearchParams } from "next/navigation"; import UpdateDestinationFlow from "@/containers/overview/destination/update.destination.flow"; import { getDestinations } from "@/services"; import { useQuery } from "react-query"; +import { KeyvalLoader } from "@/design.system"; const DEST = "dest"; @@ -50,7 +51,7 @@ export default function ManageDestinationPage() { } if (destinationLoading || !selectedDestination) { - return; + return ; } return ( diff --git a/frontend/webapp/components/side.menu/menu/menu.tsx b/frontend/webapp/components/side.menu/menu/menu.tsx index bbef40e4b..814885343 100644 --- a/frontend/webapp/components/side.menu/menu/menu.tsx +++ b/frontend/webapp/components/side.menu/menu/menu.tsx @@ -36,9 +36,8 @@ export function Menu() { } function handleMenuItemClick(item) { - if (!item) return; setCurrentMenuItem(item); - router?.push(item?.navigate); + router.push(item?.navigate); } function renderMenuItemsList() { diff --git a/frontend/webapp/containers/overview/index.tsx b/frontend/webapp/containers/overview/index.tsx index 2a26e3504..e7895d4e4 100644 --- a/frontend/webapp/containers/overview/index.tsx +++ b/frontend/webapp/containers/overview/index.tsx @@ -1,3 +1,4 @@ export { OverviewContainer } from "./overview/overview"; export { DestinationContainer } from "./destination/destination"; export { SourcesContainer } from "./sources/sources"; +export { NewDestinationFlow } from "./destination/new.destination.flow"; diff --git a/frontend/webapp/design.system/notification/notification.tsx b/frontend/webapp/design.system/notification/notification.tsx index bd8af8ad0..c0352b40e 100644 --- a/frontend/webapp/design.system/notification/notification.tsx +++ b/frontend/webapp/design.system/notification/notification.tsx @@ -7,7 +7,7 @@ import { KeyvalText } from "../text/text"; import CloseIcon from "@/assets/icons/X-blue.svg"; import SuccessIcon from "@/assets/icons/success-notification.svg"; import ErrorIcon from "@/assets/icons/error-notification.svg"; -import PortalNotification from "./portal.notification"; + interface KeyvalNotificationProps { type: "success" | "error" | "warning" | "info"; message: string; @@ -48,16 +48,14 @@ export function KeyvalNotification({ } return ( - - - - {getIcon()} - - {message} - - - - - + + + {getIcon()} + + {message} + + + + ); } diff --git a/frontend/webapp/design.system/notification/portal.notification.tsx b/frontend/webapp/design.system/notification/portal.notification.tsx deleted file mode 100644 index d220c0fa8..000000000 --- a/frontend/webapp/design.system/notification/portal.notification.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { useState, useLayoutEffect } from "react"; -import { createPortal } from "react-dom"; - -interface Props { - children: JSX.Element; - wrapperId: string; -} - -const PortalNotification = ({ children, wrapperId }: Props) => { - const [portalElement, setPortalElement] = useState(null); - - useLayoutEffect(() => { - let element = document.getElementById(wrapperId) as HTMLElement; - let portalCreated = false; - // if element is not found with wrapperId or wrapperId is not provided, - // create and append to body - if (!element) { - element = createWrapperAndAppendToBody(wrapperId); - portalCreated = true; - } - - setPortalElement(element); - - // cleaning up the portal element - return () => { - // delete the programatically created element - if (portalCreated && element.parentNode) { - element.parentNode.removeChild(element); - } - }; - }, [wrapperId]); - - const createWrapperAndAppendToBody = (elementId: string) => { - const element = document.createElement("div"); - element.setAttribute("id", elementId); - document.body.appendChild(element); - return element; - }; - - // portalElement state will be null on the very first render. - if (!portalElement) return null; - - return createPortal(children, portalElement); -}; - -export default PortalNotification; From 004ca63fbd8fddeaf9ac5de0a23dab7e1af714ac Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 2 Aug 2023 16:25:12 +0300 Subject: [PATCH 045/374] restruce file system --- .../app/overview/sources/create/page.tsx | 33 ++++++++++ .../app/overview/sources/manage/page.tsx | 10 +++ frontend/webapp/app/overview/sources/page.tsx | 6 +- .../overview/sources/manage.sources.tsx | 4 +- .../containers/overview/sources/sources.tsx | 62 +++---------------- frontend/webapp/utils/constants/routes.tsx | 1 + 6 files changed, 56 insertions(+), 60 deletions(-) create mode 100644 frontend/webapp/app/overview/sources/create/page.tsx create mode 100644 frontend/webapp/app/overview/sources/manage/page.tsx diff --git a/frontend/webapp/app/overview/sources/create/page.tsx b/frontend/webapp/app/overview/sources/create/page.tsx new file mode 100644 index 000000000..617b81251 --- /dev/null +++ b/frontend/webapp/app/overview/sources/create/page.tsx @@ -0,0 +1,33 @@ +"use client"; +import React from "react"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { OverviewHeader } from "@/components/overview"; +import { useNotification } from "@/hooks"; +import { useQuery } from "react-query"; +import { getSources } from "@/services"; +import { NewSourceFlow } from "@/containers/overview/sources/new.source.flow"; +import { useRouter } from "next/navigation"; + +export default function CreateNewSourcesPage() { + const { show, Notification } = useNotification(); + const router = useRouter(); + const { data: sources } = useQuery([QUERIES.API_SOURCES], getSources); + + function onNewSourceSuccess() { + show({ + type: NOTIFICATION.SUCCESS, + message: OVERVIEW.SOURCE_CREATED_SUCCESS, + }); + } + + return ( + <> + router.back()} + /> + + + + ); +} diff --git a/frontend/webapp/app/overview/sources/manage/page.tsx b/frontend/webapp/app/overview/sources/manage/page.tsx new file mode 100644 index 000000000..7eef5dc57 --- /dev/null +++ b/frontend/webapp/app/overview/sources/manage/page.tsx @@ -0,0 +1,10 @@ +"use client"; +import React from "react"; + +export default function ManageSourcePage() { + return ( + <> +
ManageSourcePage
+ + ); +} diff --git a/frontend/webapp/app/overview/sources/page.tsx b/frontend/webapp/app/overview/sources/page.tsx index 454db1e18..77d0c32f2 100644 --- a/frontend/webapp/app/overview/sources/page.tsx +++ b/frontend/webapp/app/overview/sources/page.tsx @@ -3,9 +3,5 @@ import { SourcesContainer } from "@/containers/overview"; import React from "react"; export default function SourcesOverviewPage() { - return ( - <> - - - ); + return ; } diff --git a/frontend/webapp/containers/overview/sources/manage.sources.tsx b/frontend/webapp/containers/overview/sources/manage.sources.tsx index af0e0daa9..1b3339cac 100644 --- a/frontend/webapp/containers/overview/sources/manage.sources.tsx +++ b/frontend/webapp/containers/overview/sources/manage.sources.tsx @@ -9,7 +9,7 @@ import { ManagedSource, Namespace } from "@/types/sources"; const DEFAULT_FILTER = { name: "default", selected: false, totalApps: 0 }; -export function ManageSources({ setDisplayNewSourceFlow, sources }) { +export function ManageSources({ onAddClick, sources }) { const [searchFilter, setSearchFilter] = useState(""); const [currentNamespace, setCurrentNamespace] = useState(DEFAULT_FILTER); @@ -60,7 +60,7 @@ export function ManageSources({ setDisplayNewSourceFlow, sources }) { searchFilter={searchFilter} setSearchFilter={setSearchFilter} data={namespacesList} - onAddClick={() => setDisplayNewSourceFlow(true)} + onAddClick={onAddClick} setCurrentItem={setCurrentNamespace} /> diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx index fa2191caf..1eed8288a 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -1,68 +1,24 @@ "use client"; -import React, { useEffect, useState } from "react"; -import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import React from "react"; +import { OVERVIEW, QUERIES, ROUTES } from "@/utils/constants"; import { OverviewHeader } from "@/components/overview"; import { SourcesContainerWrapper } from "./sources.styled"; -import { NewSourceFlow } from "./new.source.flow"; import { ManageSources } from "./manage.sources"; -import { useNotification } from "@/hooks"; import { useQuery } from "react-query"; import { getSources } from "@/services"; +import { useRouter } from "next/navigation"; export function SourcesContainer() { - const [displayNewSourceFlow, setDisplayNewSourceFlow] = useState< - boolean | null - >(null); - const { show, Notification } = useNotification(); - - const { data: sources, refetch } = useQuery( - [QUERIES.API_SOURCES], - getSources - ); - - useEffect(() => { - refetchSources(); - }, [displayNewSourceFlow]); - - async function refetchSources() { - if (displayNewSourceFlow === false) { - setTimeout(async () => { - refetch(); - }, 1000); - } - } - - function onNewSourceSuccess() { - setDisplayNewSourceFlow(false); - show({ - type: NOTIFICATION.SUCCESS, - message: OVERVIEW.SOURCE_CREATED_SUCCESS, - }); - } - - function renderNewSourceFlow() { - return ; - } - - function renderSources() { - return ( - - ); - } + const router = useRouter(); + const { data: sources } = useQuery([QUERIES.API_SOURCES], getSources); return ( - setDisplayNewSourceFlow(false) : null - } + + router.push(ROUTES.CREATE_SOURCE)} + sources={sources} /> - {displayNewSourceFlow ? renderNewSourceFlow() : renderSources()} - ); } diff --git a/frontend/webapp/utils/constants/routes.tsx b/frontend/webapp/utils/constants/routes.tsx index 571975b38..b51803d47 100644 --- a/frontend/webapp/utils/constants/routes.tsx +++ b/frontend/webapp/utils/constants/routes.tsx @@ -7,4 +7,5 @@ export const ROUTES = { MANAGE_DESTINATION: "/overview/destinations/create/manage?dest=", UPDATE_DESTINATION: "destinations/manage?dest=", CREATE_DESTINATION: "destinations/create", + CREATE_SOURCE: "/overview/sources/create", }; From cf77635bdb6725fe41ee49050c93bdf26f723166 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 2 Aug 2023 16:36:49 +0300 Subject: [PATCH 046/374] wip --- .../app/overview/sources/manage/page.tsx | 22 +++++++++++++++++-- .../sources.manage.card.tsx | 4 +++- .../sources.manage.list.tsx | 12 ++++++++-- .../sources.manage.styled.tsx | 4 ++-- frontend/webapp/utils/constants/routes.tsx | 1 + 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/frontend/webapp/app/overview/sources/manage/page.tsx b/frontend/webapp/app/overview/sources/manage/page.tsx index 7eef5dc57..39a5e7dc4 100644 --- a/frontend/webapp/app/overview/sources/manage/page.tsx +++ b/frontend/webapp/app/overview/sources/manage/page.tsx @@ -1,10 +1,28 @@ "use client"; -import React from "react"; +import { getSources } from "@/services"; +import { QUERIES } from "@/utils/constants"; +import { useSearchParams } from "next/navigation"; +import React, { useEffect, useState } from "react"; +import { useQuery } from "react-query"; + +const SOURCE = "source"; export default function ManageSourcePage() { + const [currentSource, setCurrentSource] = useState(null); + const searchParams = useSearchParams(); + + const { data: sources } = useQuery([QUERIES.API_SOURCES], getSources); + + useEffect(onPageLoad, [sources]); + function onPageLoad() { + const search = searchParams.get(SOURCE); + const source = sources?.find((item) => item.name === search); + source && setCurrentSource(source); + } + return ( <> -
ManageSourcePage
+
{currentSource?.name}
); } diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx index 1aa8f559b..a2a695f41 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx @@ -20,13 +20,15 @@ const LOGO_STYLE: React.CSSProperties = { interface SourceManagedCardProps { item: ManagedSource; + onClick?: () => void; } const DEPLOYMENT = "deployment"; export default function SourceManagedCard({ item = {} as ManagedSource, + onClick, }: SourceManagedCardProps) { return ( - + ( - + + router.push(`${ROUTES.MANAGE_SOURCE}?source=${source?.name}`) + } + /> )); } diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx index 3fd4cad8d..9a36b4efa 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx @@ -12,10 +12,10 @@ export const CardWrapper = styled.div` align-items: center; flex-direction: column; gap: 10px; - /* cursor: pointer; + cursor: pointer; &:hover { background: var(--dark-mode-dark-1, #07111a81); - } */ + } `; export const EmptyListWrapper = styled.div` diff --git a/frontend/webapp/utils/constants/routes.tsx b/frontend/webapp/utils/constants/routes.tsx index b51803d47..6a074d899 100644 --- a/frontend/webapp/utils/constants/routes.tsx +++ b/frontend/webapp/utils/constants/routes.tsx @@ -8,4 +8,5 @@ export const ROUTES = { UPDATE_DESTINATION: "destinations/manage?dest=", CREATE_DESTINATION: "destinations/create", CREATE_SOURCE: "/overview/sources/create", + MANAGE_SOURCE: "/overview/sources/manage", }; From 4616dcfa419eaf7dab69778f04d536a5883afeab Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 2 Aug 2023 17:55:36 +0300 Subject: [PATCH 047/374] add pen icon and danger zone --- .../app/overview/sources/manage/page.tsx | 42 ++++++++++-- .../app/overview/sources/manage/styled.tsx | 14 ++++ .../webapp/assets/icons/overview/index.tsx | 3 +- frontend/webapp/assets/icons/overview/pen.svg | 3 + frontend/webapp/components/overview/index.tsx | 1 + .../sources/delete.source/delete.source.tsx | 67 +++++++++++++++++++ .../manage.source.header.tsx | 61 +++++++++++++++++ frontend/webapp/utils/constants/string.tsx | 5 ++ 8 files changed, 188 insertions(+), 8 deletions(-) create mode 100644 frontend/webapp/app/overview/sources/manage/styled.tsx create mode 100644 frontend/webapp/assets/icons/overview/pen.svg create mode 100644 frontend/webapp/components/overview/sources/delete.source/delete.source.tsx create mode 100644 frontend/webapp/components/overview/sources/manage.source.header/manage.source.header.tsx diff --git a/frontend/webapp/app/overview/sources/manage/page.tsx b/frontend/webapp/app/overview/sources/manage/page.tsx index 39a5e7dc4..66ade9994 100644 --- a/frontend/webapp/app/overview/sources/manage/page.tsx +++ b/frontend/webapp/app/overview/sources/manage/page.tsx @@ -1,19 +1,29 @@ "use client"; +import { ManageSourceHeader } from "@/components/overview/sources/manage.source.header/manage.source.header"; import { getSources } from "@/services"; -import { QUERIES } from "@/utils/constants"; -import { useSearchParams } from "next/navigation"; +import { QUERIES, SETUP } from "@/utils/constants"; +import { useRouter, useSearchParams } from "next/navigation"; import React, { useEffect, useState } from "react"; import { useQuery } from "react-query"; +import { ManageSourcePageContainer, BackButtonWrapper } from "./styled"; +import { LANGUAGES_LOGOS } from "@/assets/images"; +import { Back } from "@/assets/icons/overview"; +import { KeyvalText } from "@/design.system"; +import { ManagedSource } from "@/types/sources"; +import { DeleteSource } from "@/components/overview"; const SOURCE = "source"; export default function ManageSourcePage() { - const [currentSource, setCurrentSource] = useState(null); + const [currentSource, setCurrentSource] = useState( + null + ); const searchParams = useSearchParams(); - + const router = useRouter(); const { data: sources } = useQuery([QUERIES.API_SOURCES], getSources); useEffect(onPageLoad, [sources]); + function onPageLoad() { const search = searchParams.get(SOURCE); const source = sources?.find((item) => item.name === search); @@ -21,8 +31,26 @@ export default function ManageSourcePage() { } return ( - <> -
{currentSource?.name}
- + + router.back()}> + + {SETUP.BACK} + + {currentSource && ( + + )} + {}} + name={currentSource?.name} + image_url={ + LANGUAGES_LOGOS[currentSource?.languages?.[0].language || ""] + } + /> + ); } diff --git a/frontend/webapp/app/overview/sources/manage/styled.tsx b/frontend/webapp/app/overview/sources/manage/styled.tsx new file mode 100644 index 000000000..0f67fc4e6 --- /dev/null +++ b/frontend/webapp/app/overview/sources/manage/styled.tsx @@ -0,0 +1,14 @@ +import styled from "styled-components"; + +export const ManageSourcePageContainer = styled.div` + padding: 32px; +`; + +export const BackButtonWrapper = styled.div` + display: flex; + align-items: center; + cursor: pointer; + p { + cursor: pointer !important; + } +`; diff --git a/frontend/webapp/assets/icons/overview/index.tsx b/frontend/webapp/assets/icons/overview/index.tsx index f9254c49d..68481e5ca 100644 --- a/frontend/webapp/assets/icons/overview/index.tsx +++ b/frontend/webapp/assets/icons/overview/index.tsx @@ -1,6 +1,7 @@ import KeyvalMiddleware from "./middleware.svg"; import Folder from "./folder.svg"; import Plus from "./plus.svg"; +import Pen from "./pen.svg"; import Back from "./back.svg"; -export { KeyvalMiddleware, Folder, Plus, Back }; +export { KeyvalMiddleware, Folder, Plus, Back, Pen }; diff --git a/frontend/webapp/assets/icons/overview/pen.svg b/frontend/webapp/assets/icons/overview/pen.svg new file mode 100644 index 000000000..03494bea2 --- /dev/null +++ b/frontend/webapp/assets/icons/overview/pen.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/webapp/components/overview/index.tsx b/frontend/webapp/components/overview/index.tsx index d6c9f8384..d231bd943 100644 --- a/frontend/webapp/components/overview/index.tsx +++ b/frontend/webapp/components/overview/index.tsx @@ -3,3 +3,4 @@ export { ManageDestination } from "./destination/manage.destination/manage.desti export { DestinationsManagedList } from "./destination/destination.list/destinations.managed.list"; export { SourcesManagedList } from "./sources/sources.manage.list/sources.manage.list"; export { SourcesActionMenu } from "./sources/action.menu/sources.action.menu"; +export { DeleteSource } from "./sources/delete.source/delete.source"; diff --git a/frontend/webapp/components/overview/sources/delete.source/delete.source.tsx b/frontend/webapp/components/overview/sources/delete.source/delete.source.tsx new file mode 100644 index 000000000..173a17bde --- /dev/null +++ b/frontend/webapp/components/overview/sources/delete.source/delete.source.tsx @@ -0,0 +1,67 @@ +import React, { useState } from "react"; +import { styled } from "styled-components"; +import { ConnectionsIcons } from "@/components/setup"; +import { DangerZone, KeyvalModal, KeyvalText } from "@/design.system"; +import { ModalPositionX, ModalPositionY } from "@/design.system/modal/types"; +import theme from "@/styles/palette"; +import { OVERVIEW } from "@/utils/constants"; + +const FieldWrapper = styled.div` + margin-top: 32px; + width: 348px; +`; + +const IMAGE_STYLE = { border: "solid 1px #ededed" }; +export function DeleteSource({ + onDelete, + name, + image_url, +}: { + onDelete: () => void; + name: string | undefined; + image_url: string; +}) { + const [showModal, setShowModal] = useState(false); + + const modalConfig = { + title: OVERVIEW.DELETE_SOURCE, + showHeader: true, + showOverlay: true, + positionX: ModalPositionX.center, + positionY: ModalPositionY.center, + padding: "20px", + footer: { + primaryBtnText: OVERVIEW.CONFIRM_SOURCE_DELETE, + primaryBtnAction: () => { + setShowModal(false); + }, + }, + }; + + return ( + <> + + setShowModal(true)} + /> + + {showModal && ( + setShowModal(false)} + config={modalConfig} + > +
+ +
+ + {`${OVERVIEW.DELETE} ${name}`} + +
+ )} + + ); +} diff --git a/frontend/webapp/components/overview/sources/manage.source.header/manage.source.header.tsx b/frontend/webapp/components/overview/sources/manage.source.header/manage.source.header.tsx new file mode 100644 index 000000000..136f44552 --- /dev/null +++ b/frontend/webapp/components/overview/sources/manage.source.header/manage.source.header.tsx @@ -0,0 +1,61 @@ +import React, { useState } from "react"; +import styled from "styled-components"; +import { KeyvalImage, KeyvalText, KeyvalTooltip } from "@/design.system"; +import { Pen } from "@/assets/icons/overview"; + +const ManageSourceHeaderWrapper = styled.div` + display: flex; + width: 100%; + height: 104px; + align-items: center; + border-radius: 25px; + margin: 24px 0; + background: radial-gradient( + 78.09% 72.18% at 100% -0%, + rgba(150, 242, 255, 0.4) 0%, + rgba(150, 242, 255, 0) 61.91% + ), + linear-gradient(180deg, #2e4c55 0%, #303355 100%); +`; + +const TextWrapper = styled.div` + margin-left: 12px; + margin-right: 12px; +`; + +const EditIconWrapper = styled.div` + width: 20px; + height: 40px; + display: flex; + align-items: center; + + :hover { + cursor: pointer; + fill: ${({ theme }) => theme.colors.secondary}; + } +`; +const IMAGE_STYLE: React.CSSProperties = { + backgroundColor: "#fff", + padding: 4, + marginRight: 16, + marginLeft: 16, +}; + +export function ManageSourceHeader({ image_url, display_name }) { + const [showEditInput, setShowEditInput] = useState(true); + return ( + + + + + {display_name} + + + {showEditInput ? ( + setShowEditInput(false)}> + + + ) : null} + + ); +} diff --git a/frontend/webapp/utils/constants/string.tsx b/frontend/webapp/utils/constants/string.tsx index 53903e8c5..b2537973d 100644 --- a/frontend/webapp/utils/constants/string.tsx +++ b/frontend/webapp/utils/constants/string.tsx @@ -73,10 +73,15 @@ export const OVERVIEW = { MANAGE: "Manage", DELETE: "Delete", DELETE_DESTINATION: "Delete Destination", + DELETE_SOURCE: "Delete Source", + SOURCE_DANGER_ZONE_TITLE: "Delete this source", + SOURCE_DANGER_ZONE_SUBTITLE: + "This action cannot be undone. This will permanently delete the source and all associated data.", DELETE_MODAL_TITLE: "Delete this destination", DELETE_MODAL_SUBTITLE: "This action cannot be undone. This will permanently delete the destination and all associated data.", DELETE_BUTTON: "I want to delete this destination", + CONFIRM_SOURCE_DELETE: "I want to delete this source", CONNECT: "Connect", }; From 5d85d7cc6ba50666ac47472f09cd980f1e224bf4 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 10:57:52 +0300 Subject: [PATCH 048/374] manage delete source --- .../app/overview/sources/create/page.tsx | 9 +++- .../app/overview/sources/manage/page.tsx | 53 +++++++++++++++++-- .../sources/delete.source/delete.source.tsx | 1 + .../overview/sources/new.source.flow.tsx | 6 ++- frontend/webapp/services/sources.tsx | 12 ++++- 5 files changed, 73 insertions(+), 8 deletions(-) diff --git a/frontend/webapp/app/overview/sources/create/page.tsx b/frontend/webapp/app/overview/sources/create/page.tsx index 617b81251..9c83bfc82 100644 --- a/frontend/webapp/app/overview/sources/create/page.tsx +++ b/frontend/webapp/app/overview/sources/create/page.tsx @@ -11,9 +11,16 @@ import { useRouter } from "next/navigation"; export default function CreateNewSourcesPage() { const { show, Notification } = useNotification(); const router = useRouter(); - const { data: sources } = useQuery([QUERIES.API_SOURCES], getSources); + const { data: sources, refetch } = useQuery( + [QUERIES.API_SOURCES], + getSources + ); function onNewSourceSuccess() { + setTimeout(() => { + router.back(); + refetch(); + }, 1000); show({ type: NOTIFICATION.SUCCESS, message: OVERVIEW.SOURCE_CREATED_SUCCESS, diff --git a/frontend/webapp/app/overview/sources/manage/page.tsx b/frontend/webapp/app/overview/sources/manage/page.tsx index 66ade9994..cd5eef166 100644 --- a/frontend/webapp/app/overview/sources/manage/page.tsx +++ b/frontend/webapp/app/overview/sources/manage/page.tsx @@ -1,16 +1,24 @@ "use client"; import { ManageSourceHeader } from "@/components/overview/sources/manage.source.header/manage.source.header"; import { getSources } from "@/services"; -import { QUERIES, SETUP } from "@/utils/constants"; +import { + NOTIFICATION, + OVERVIEW, + QUERIES, + ROUTES, + SETUP, +} from "@/utils/constants"; import { useRouter, useSearchParams } from "next/navigation"; import React, { useEffect, useState } from "react"; -import { useQuery } from "react-query"; +import { useMutation, useQuery } from "react-query"; import { ManageSourcePageContainer, BackButtonWrapper } from "./styled"; import { LANGUAGES_LOGOS } from "@/assets/images"; import { Back } from "@/assets/icons/overview"; import { KeyvalText } from "@/design.system"; import { ManagedSource } from "@/types/sources"; import { DeleteSource } from "@/components/overview"; +import { deleteSource } from "@/services/sources"; +import { useNotification } from "@/hooks"; const SOURCE = "source"; @@ -20,8 +28,18 @@ export default function ManageSourcePage() { ); const searchParams = useSearchParams(); const router = useRouter(); - const { data: sources } = useQuery([QUERIES.API_SOURCES], getSources); - + const { data: sources, refetch } = useQuery( + [QUERIES.API_SOURCES], + getSources + ); + const { show, Notification } = useNotification(); + const { mutate } = useMutation(() => + deleteSource( + currentSource?.namespace || "", + currentSource?.kind || "", + currentSource?.name || "" + ) + ); useEffect(onPageLoad, [sources]); function onPageLoad() { @@ -29,6 +47,30 @@ export default function ManageSourcePage() { const source = sources?.find((item) => item.name === search); source && setCurrentSource(source); } + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + + function onSuccess() { + setTimeout(() => { + router.back(); + refetch(); + }, 1000); + show({ + type: NOTIFICATION.SUCCESS, + message: OVERVIEW.SOURCE_DELETED_SUCCESS, + }); + } + function onDelete() { + mutate(undefined, { + onSuccess, + onError, + }); + } return ( @@ -45,12 +87,13 @@ export default function ManageSourcePage() { /> )} {}} + onDelete={onDelete} name={currentSource?.name} image_url={ LANGUAGES_LOGOS[currentSource?.languages?.[0].language || ""] } /> + ); } diff --git a/frontend/webapp/components/overview/sources/delete.source/delete.source.tsx b/frontend/webapp/components/overview/sources/delete.source/delete.source.tsx index 173a17bde..2520989cd 100644 --- a/frontend/webapp/components/overview/sources/delete.source/delete.source.tsx +++ b/frontend/webapp/components/overview/sources/delete.source/delete.source.tsx @@ -34,6 +34,7 @@ export function DeleteSource({ primaryBtnText: OVERVIEW.CONFIRM_SOURCE_DELETE, primaryBtnAction: () => { setShowModal(false); + onDelete(); }, }, }; diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx index 5152767ba..3b5468b9a 100644 --- a/frontend/webapp/containers/overview/sources/new.source.flow.tsx +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -17,7 +17,9 @@ export function NewSourceFlow({ onSuccess, sources }) { const { show, Notification } = useNotification(); function updateSectionDataWithSources() { - const sourceNamesSet = new Set(sources.map((source) => source.name)); + const sourceNamesSet = new Set( + sources.map((source: SelectedSources) => source.name) + ); const updatedSectionData: SelectedSources = {}; for (const key in sectionData) { @@ -50,6 +52,7 @@ export function NewSourceFlow({ onSuccess, sources }) { {`${totalSelected} ${SETUP.SELECTED}`} @@ -58,6 +61,7 @@ export function NewSourceFlow({ onSuccess, sources }) { + { export async function getSources() { return await get(API.SOURCES); } + +export async function deleteSource( + namespace: string, + kind: string, + name: string +) { + return await httpDelete( + `${API.SOURCES}/namespace/${namespace}/kind/${kind}/name/${name}` + ); +} From b655e1842d534da9a28138d449dcc51734d50f46 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 13:50:08 +0300 Subject: [PATCH 049/374] WIP --- .../app/overview/sources/manage/page.tsx | 6 +- .../app/overview/sources/manage/styled.tsx | 1 + .../manage.source.header.tsx | 67 +++++++++++++++---- .../setup/destination/destination.section.tsx | 3 + frontend/webapp/design.system/index.tsx | 1 + .../design.system/input/action.input.tsx | 42 ++++++++++++ .../design.system/input/input.styled.tsx | 19 ++++++ frontend/webapp/utils/constants/index.tsx | 2 +- frontend/webapp/utils/constants/string.tsx | 4 ++ 9 files changed, 130 insertions(+), 15 deletions(-) create mode 100644 frontend/webapp/design.system/input/action.input.tsx diff --git a/frontend/webapp/app/overview/sources/manage/page.tsx b/frontend/webapp/app/overview/sources/manage/page.tsx index cd5eef166..a8de98f08 100644 --- a/frontend/webapp/app/overview/sources/manage/page.tsx +++ b/frontend/webapp/app/overview/sources/manage/page.tsx @@ -42,6 +42,10 @@ export default function ManageSourcePage() { ); useEffect(onPageLoad, [sources]); + useEffect(() => { + console.log({ currentSource }); + }, [currentSource]); + function onPageLoad() { const search = searchParams.get(SOURCE); const source = sources?.find((item) => item.name === search); @@ -80,7 +84,7 @@ export default function ManageSourcePage() { {currentSource && ( theme.colors.secondary}; } `; + +const ActionInputWrapper = styled.div` + width: 80%; + height: 49px; +`; + const IMAGE_STYLE: React.CSSProperties = { backgroundColor: "#fff", padding: 4, @@ -41,21 +54,49 @@ const IMAGE_STYLE: React.CSSProperties = { marginLeft: 16, }; -export function ManageSourceHeader({ image_url, display_name }) { +export function ManageSourceHeader({ image_url, name }) { const [showEditInput, setShowEditInput] = useState(true); + const [inputValue, setInputValue] = useState(name); + const containerRef = useRef(null); + const handleClickOutside = () => { + !showEditInput && handleSave(); + }; + + useOnClickOutside(containerRef, handleClickOutside); + + function handleSave() { + setShowEditInput(true); + } + + function handleInputChange(value) { + setInputValue(value); + } + return ( - + - - - {display_name} - - + {showEditInput ? ( - setShowEditInput(false)}> - - - ) : null} + <> + + + {name} + + + + setShowEditInput(false)}> + + + + ) : ( + + handleInputChange(e)} + onAction={handleSave} + /> + + )} ); } diff --git a/frontend/webapp/containers/setup/destination/destination.section.tsx b/frontend/webapp/containers/setup/destination/destination.section.tsx index a7e4440c6..854edd779 100644 --- a/frontend/webapp/containers/setup/destination/destination.section.tsx +++ b/frontend/webapp/containers/setup/destination/destination.section.tsx @@ -20,10 +20,12 @@ import { useNotification } from "@/hooks"; import { getDestinationsTypes } from "@/services"; type DestinationSectionProps = { + sectionData?: any; setSectionData: (data: any) => void; }; export function DestinationSection({ + sectionData, setSectionData, }: DestinationSectionProps) { const [searchFilter, setSearchFilter] = useState(""); @@ -68,6 +70,7 @@ export function DestinationSection({ return ( displayItem && ( setSectionData(item)} diff --git a/frontend/webapp/design.system/index.tsx b/frontend/webapp/design.system/index.tsx index 7885d1a19..c1b3be3ce 100644 --- a/frontend/webapp/design.system/index.tsx +++ b/frontend/webapp/design.system/index.tsx @@ -15,6 +15,7 @@ export { KeyvalLink } from "./link/link"; export { KeyvalTooltip } from "./tooltip/tooltip"; export { KeyvalImage } from "./image/image"; export { KeyvalInput } from "./input/input"; +export { KeyvalActionInput } from "./input/action.input"; export { KeyvalVideo } from "./video/video"; export { KeyvalLoader } from "./loader/loader"; export { KeyvalNotification } from "./notification/notification"; diff --git a/frontend/webapp/design.system/input/action.input.tsx b/frontend/webapp/design.system/input/action.input.tsx new file mode 100644 index 000000000..4bede03d6 --- /dev/null +++ b/frontend/webapp/design.system/input/action.input.tsx @@ -0,0 +1,42 @@ +import React, { ChangeEvent } from "react"; +import { StyledActionInputContainer, StyledActionInput } from "./input.styled"; +import { KeyvalButton } from "../button/button"; +import { KeyvalText } from "../text/text"; +import theme from "@/styles/palette"; +import { ACTION } from "@/utils/constants"; + +interface InputProps { + value: string; + onAction: () => void; + onChange: (value: string) => void; + type?: string; + style?: React.CSSProperties; +} + +export function KeyvalActionInput({ + value, + onChange, + style = {}, +}: InputProps): JSX.Element { + function handleChange(event: ChangeEvent): void { + onChange(event.target.value); + } + + return ( + <> + + + + + + {ACTION.SAVE} + + + + + ); +} diff --git a/frontend/webapp/design.system/input/input.styled.tsx b/frontend/webapp/design.system/input/input.styled.tsx index 25b200005..bff06430f 100644 --- a/frontend/webapp/design.system/input/input.styled.tsx +++ b/frontend/webapp/design.system/input/input.styled.tsx @@ -32,6 +32,19 @@ export const StyledInputContainer = styled.div` } `; +export const StyledActionInputContainer = styled.div` + position: relative; + display: flex; + width: 100%; + padding: 0px 12px; + height: 100%; + align-items: center; + justify-content: space-between; + gap: 10px; + border-radius: 4px; + border: ${({ theme }) => `1px solid ${theme.colors.secondary}`}; +`; + export const StyledInput = styled.input` background: transparent; border: none; @@ -40,6 +53,12 @@ export const StyledInput = styled.input` color: ${({ theme }) => theme.text.white}; `; +export const StyledActionInput = styled(StyledInput)` + color: var(--dark-mode-white, #fff); + font-family: Inter; + font-size: 24px; +`; + export const LabelWrapper = styled.div` margin-bottom: 8px; `; diff --git a/frontend/webapp/utils/constants/index.tsx b/frontend/webapp/utils/constants/index.tsx index 11dd91a8d..90fdf2c71 100644 --- a/frontend/webapp/utils/constants/index.tsx +++ b/frontend/webapp/utils/constants/index.tsx @@ -1,4 +1,4 @@ export { ROUTES } from "./routes"; export { CONFIG } from "./config"; -export { SETUP, OVERVIEW, NOTIFICATION } from "./string"; +export { SETUP, OVERVIEW, NOTIFICATION, ACTION } from "./string"; export { API, QUERIES } from "./urls"; diff --git a/frontend/webapp/utils/constants/string.tsx b/frontend/webapp/utils/constants/string.tsx index b2537973d..3227c2b95 100644 --- a/frontend/webapp/utils/constants/string.tsx +++ b/frontend/webapp/utils/constants/string.tsx @@ -85,6 +85,10 @@ export const OVERVIEW = { CONNECT: "Connect", }; +export const ACTION = { + SAVE: "Save", +}; + export const NOTIFICATION = { ERROR: "error", SUCCESS: "success", From 592be7e741cc8cf6fd4750a4322512cad0f896e9 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 13:55:35 +0300 Subject: [PATCH 050/374] WIP --- .../sources/action.menu/sources.action.menu.styled.tsx | 1 + .../overview/sources/action.menu/sources.action.menu.tsx | 2 +- .../sources/manage.source.header/manage.source.header.tsx | 8 +------- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx index 146df0a97..3c0c8b9bb 100644 --- a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx +++ b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.tsx @@ -10,5 +10,6 @@ export const SourcesMenuWrapper = styled.div` export const InputsWrapper = styled.div` display: flex; + flex-wrap: wrap; gap: 16px; `; diff --git a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx index bc1b0faa8..947f13c33 100644 --- a/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx +++ b/frontend/webapp/components/overview/sources/action.menu/sources.action.menu.tsx @@ -9,7 +9,7 @@ import { OVERVIEW } from "@/utils/constants"; import theme from "@/styles/palette"; import { FilterSourcesOptions } from "@/components/setup/sources/sources.option.menu/filter.sources.options"; -const BUTTON_STYLES = { gap: 10, height: 36 }; +const BUTTON_STYLES = { gap: 10, height: 36, width: 200 }; export function SourcesActionMenu({ onAddClick, diff --git a/frontend/webapp/components/overview/sources/manage.source.header/manage.source.header.tsx b/frontend/webapp/components/overview/sources/manage.source.header/manage.source.header.tsx index a8cbcbfec..5fbcec042 100644 --- a/frontend/webapp/components/overview/sources/manage.source.header/manage.source.header.tsx +++ b/frontend/webapp/components/overview/sources/manage.source.header/manage.source.header.tsx @@ -1,11 +1,6 @@ import React, { useRef, useState } from "react"; import styled from "styled-components"; -import { - KeyvalActionInput, - KeyvalImage, - KeyvalText, - KeyvalTooltip, -} from "@/design.system"; +import { KeyvalActionInput, KeyvalImage, KeyvalText } from "@/design.system"; import { Pen } from "@/assets/icons/overview"; import { useOnClickOutside } from "@/hooks"; @@ -75,7 +70,6 @@ export function ManageSourceHeader({ image_url, name }) { return ( - {showEditInput ? ( <> From ef93cc648ee98979ac4b4f747c10fbf713692bd4 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 15:32:56 +0300 Subject: [PATCH 051/374] WIP --- frontend/webapp/app/layout.tsx | 4 ++++ frontend/webapp/app/overview/layout.tsx | 6 +++++- frontend/webapp/assets/logos/logo.png | Bin 0 -> 3528 bytes .../webapp/design.system/text/text.styled.tsx | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 frontend/webapp/assets/logos/logo.png diff --git a/frontend/webapp/app/layout.tsx b/frontend/webapp/app/layout.tsx index efe4c8326..050b0c95c 100644 --- a/frontend/webapp/app/layout.tsx +++ b/frontend/webapp/app/layout.tsx @@ -3,6 +3,7 @@ import React from "react"; import { ThemeProvider } from "styled-components"; import theme from "@/styles/palette"; import { QueryClient, QueryClientProvider } from "react-query"; +import Head from "next/head"; const LAYOUT_STYLE: React.CSSProperties = { margin: 0, @@ -30,6 +31,9 @@ export default function RootLayout({ + + Odigos + {children} diff --git a/frontend/webapp/app/overview/layout.tsx b/frontend/webapp/app/overview/layout.tsx index dc76e1c7f..2159907df 100644 --- a/frontend/webapp/app/overview/layout.tsx +++ b/frontend/webapp/app/overview/layout.tsx @@ -1,6 +1,7 @@ -"use client"; +// "use client"; import { Menu } from "@/components/side.menu"; import theme from "@/styles/palette"; +import { Metadata } from "next"; import React from "react"; const LAYOUT_STYLE = { @@ -14,6 +15,9 @@ const CHILDREN_STYLE = { width: "100%", height: "93%", }; +export const metadata: Metadata = { + title: "Odigos", +}; export default function Layout({ children }: { children: React.ReactNode }) { return ( diff --git a/frontend/webapp/assets/logos/logo.png b/frontend/webapp/assets/logos/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..5caa468e0ebc565ab66104a95d8f4b649015dd52 GIT binary patch literal 3528 zcmd6qX*k>I7Ql5{s+J)#LbYnW%t#|*TD@aQTVkuC1`)BRMeMXCYHhVNiM_Q}F^$qC zg6O|eJDr3<%fwPjEVYZRK@nBC>2p8d`|&>a!+Xwo&UxPV{cz6to%bbOv9pwxP?8W4 z5s|jGLj5ixatJ0|dg5Y2&oot=D)eVsqb@o{A6gxEAbJpr+jxo2?#YjUw`(l`>FcNg zD_++0*Ky<1ZsAx7(`36y&_<2j1LQTjqOF>h>QY8d=n+T%c=6L8E_+K#zD}3jdh*XZ zx0A|Ax9aG9IId$Ump^WOIavSKg$d4$h5dtt%{$lWy#Ua>6DwE{2ucO@3kR`;1SgRP zyQo7}DB!jeO47>w|5G8I#ezF~k9Ko7Ya5@-WYRquVUy^(Nk+()M11&{=AE7)>UzFS zepOD-y5}znXn4i}Cu{tMpxNlW&S5zRET^^lblhs81E5+&9B~UPfeSXdOBcn0_1KSM z;|Tn1g7CyA5dVa|82*8c_EGt2ZkfCWbw&^g7!Rja{(&|l4{M+Qy7aZhMMpmWwqQpf zaBJBrPt?8g%Hw_0%D$t0PS7y&=lmjm^&@AaenWOz6+~tYs(0pm;CzFpaa`r#%LY7a zZpyxQe}p4{H|m9JKwQkhNA_P-1LxHNvUhXDTBSE4I-*{&G+BwU?j%p!%>;sm%|tPh z!}jO|_drKm0QaL!%~Tl6xsz93R<7mzE`X);>BU@rkLL8F^HqYxgL!^!OgtkZeN$u> zoF9e2lHoI*k9LheR{m(m<+Btl#?%9|kXSm^L|2lqq8LVqy%$jL>g$S(#6GoBo0yUG zO7vR|%{Vr(?iCkZMc#?oi^n3ilnK-E<@^pl*QLcFfuG9gxv!FdQN1hPo9yLrdf^c@ z33HR|fN?A3znjcW-0f^t`4$@W!V-(| zmX{DSV~=%4gbO5-%+KP$0q>mCuX6e>tCTATq#JeXzonpOGTt04-LZ7+3laKQJpB;X z$vkfds$xX**$(%i={p<-Ll|h@Y#c&Ee~#Gxd%!CpYD?lZc@@Mf#J@U>L`u>h6gYQh zqurJ2JT}rDgqs`LkdizXFz;hmoQPjHezh>DmE|+{+R$LI-48eEGgkjH0%;cia3gKE zj+DFa7nad5#=@g*R{W|eW~jgU*J?g{R`cJgq(l2 zt-h8B3-!GYD&5u4UC8q^{KzFtr#9FE+xs>X+34QiXnC8iu6E&R{A6(M_+a5yVxXTnJ7C9TfXwEka0xz~*e=Dqx+2rD5)d3~lIweT+595t4pL;dG zu>+YYy#@_wE@|`INQ2234K=A;e6Ie7V_8qA(X5lB?ZS#W_lm5*Da7Y?x%e?9{p^8? z3r*fps30;^vOycGEDK-Ez(-m&dGDcu#F&y5mVlpC)6^R214I^H@E9MW#!KRn&@w~? zKpShK?kT*ID|CG!p)*Me96LZx7XHQ>kORSGX*tYPH871SlyWo)qJo(^RvrXTxd7;B zdJbL&bhJDNtpKqLP0vYqX=1d)VYZSgPyJW6k{(Z8gKgR*B-$>Nr+%0{Z7^+KN`frQ z!S}3yk(_9@HpM(>+FXSQxeA8YJ-{OnJRFn=A=ow*{DX}PWTv{x!Yb^V79Zf*$9WV< ziunRFH9!vLXVFw3#>UMvQybN=!N++xISMNe4DV3GZly%CQ}Aq~X_f^lbwUolh5{B% zc++T#xze<`EUX_??E{AO%T@cx!TQ0~J|NgjHP1g)u}+pvTrI4VO%qoW>tx@=RmV!D zL=RmA6i@QHZ2`s8yl!hi(U{k54oo#5JC{da%SZ&FB#{-FyoRl{+_y^Xq)1fLL`!(+ zmZ9xK<}z#jB(xF)8)@5K9qSgdqHH)I=tQ-KZA}^w+VF4SKj6=lCQfn}kb-(RuvcG~ zXp*x0*Qcw#{Gowz8>1-WD?h6I=5#99Q{#bZ*+-a?V}mC5J#3Kr6K-cEGR_k2h4)_s`FmBP{UDi+uaIuy~T>i!<_sNWT|ogZ|jk3~-x%uv_s*K6$4fGQ&nlbe3S-|~~(>1mVCvyS#@r@}$i zTlev2AuZeQ77N_oJdD=Kgx4O((rO_vjQx?G*r(@F)XMk1?G}C!7RIYYNEUg>4DSQ! z0}-FOCT_O1=$~W60x`#*m3KHyq2Yo&e7lyq>Vlzh^BJ7HTgcj$=JM{1h?i9}ZDH4M ziJu^Pvk)AQ#~>9tIk#&B&EtrHztL+$CcbD1({(e_B5n*bu493#jJPGP0;ZGep9Y+t zy;j!K_8!yRWc@wS9bB;@w=g-FSalzLI*P*bCOO+tSW`sjP@zq9Rz{_ANzNXq)IgGR zvCt+uj|*+$kRB1TL>j6gLIOxbdL+maaj1p_2_VW}6qX|WdntyIY!8jIL4u%Co_bvz<3nOeSRs)lal!Jw8ptlO~JQtj~7$q5#O~y+X zV6wCE(pi}7LSeIFzBj7~ouWl?M$jo16lXO$#gF0)qT|F-)E{uHEFv0*W66@xrb3&9 zR>z4_a+5Iawv?f(I8g?ec1jM4DaC&wV%q0X)T2y^Q7{driPl51M}NSHJ_OT_%R%47 zQqCU6i4JIBmF1uXNH+I2<|5%cqa=ika#Tg@8BvDbM6KSfjsIGwuS-w*2&Q$E6RLCS zI|+<~Tl6HF1~y&%Z_bSWxo`DVIQjX~7|LU8!Yv9&MXF0%qD&li7BRXgNc=v`RXmPB zEil@784?h{`)TBOKk1?G-0R_VmU?)%Kgch0G0UFycOAjt-`??4_6H_O{BM(rG=d_2$i0|$e;SVVhq zd$+w;m@+P9DR}c#z}4Zh)e0q?jwbb`B{p_`biH}>60dJ_AM&m|+pIFUG~hVR65E^U z8E+5xaZP)kTwjUro~HTbZlucerF*6~5O>)~1OwobAf<8q5dxm7z`g$=)#|3HL%3g-pKl~!f;>Q|wdcUp2b)60Y^1MvO z_xxuDkK~gEbtcAU9!u%>`ajF;w^;7rUUG{ttJUy&{@!%61c~U#MY%t@)^bLwbbsa9 z`d3eDuFU(^{bYpcPj0H}QLX$hVUpJrG%8&Z!s99@NkdC3Zh^mBLR%2HA8J>1r#@E; z>KMi&`*x@KqcY|eW9wsRPyYJM+~17t%rCKs?m#02j{goPalJS55)Q#W=v_y5da9*O zu^i4o{XOlQjS4;yF|f7Cb8K>S(`4zv#;YZ`wAmg$xq!MSoS?qH(wB*;n?QT>>+SqgBu_yR*@QG6)$oN@Zw7cp<;vnN-leKZzCBZ2W9RirT z4|Hm@;g+HwOFz%D4OaRleBmL8jV3R#CLF630?A)V_l+Qne3L)8*`jnA2qi|dGNwl= z7Y@C+_7fqTS$wkRnVrlA8fZ6PMuTW0!}6P+ybHH?CtXXX%)Y5xMG!2SItF@Y+;@iN vBNrLP(uUXz$Pzv2{|xp22K@h7Eb&ky`=OYt{R?T~4^70{+zwS`>Yem2(BH`^ literal 0 HcmV?d00001 diff --git a/frontend/webapp/design.system/text/text.styled.tsx b/frontend/webapp/design.system/text/text.styled.tsx index f400cfe94..a68573fc4 100644 --- a/frontend/webapp/design.system/text/text.styled.tsx +++ b/frontend/webapp/design.system/text/text.styled.tsx @@ -3,7 +3,7 @@ import styled from "styled-components"; export const TextWrapper = styled.p` color: ${({ theme }) => theme.text.white}; margin: 0; - font-family: ${({ theme }) => theme.font_family.primary}; + font-family: ${({ theme }) => theme.font_family.primary}, sans-serif; font-size: 16px; font-weight: 400; `; From 9e322bf127d10dc67479184aac94982ef6f20ab9 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 15:33:13 +0300 Subject: [PATCH 052/374] WIP --- frontend/webapp/assets/logos/logo.png | Bin 3528 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 frontend/webapp/assets/logos/logo.png diff --git a/frontend/webapp/assets/logos/logo.png b/frontend/webapp/assets/logos/logo.png deleted file mode 100644 index 5caa468e0ebc565ab66104a95d8f4b649015dd52..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3528 zcmd6qX*k>I7Ql5{s+J)#LbYnW%t#|*TD@aQTVkuC1`)BRMeMXCYHhVNiM_Q}F^$qC zg6O|eJDr3<%fwPjEVYZRK@nBC>2p8d`|&>a!+Xwo&UxPV{cz6to%bbOv9pwxP?8W4 z5s|jGLj5ixatJ0|dg5Y2&oot=D)eVsqb@o{A6gxEAbJpr+jxo2?#YjUw`(l`>FcNg zD_++0*Ky<1ZsAx7(`36y&_<2j1LQTjqOF>h>QY8d=n+T%c=6L8E_+K#zD}3jdh*XZ zx0A|Ax9aG9IId$Ump^WOIavSKg$d4$h5dtt%{$lWy#Ua>6DwE{2ucO@3kR`;1SgRP zyQo7}DB!jeO47>w|5G8I#ezF~k9Ko7Ya5@-WYRquVUy^(Nk+()M11&{=AE7)>UzFS zepOD-y5}znXn4i}Cu{tMpxNlW&S5zRET^^lblhs81E5+&9B~UPfeSXdOBcn0_1KSM z;|Tn1g7CyA5dVa|82*8c_EGt2ZkfCWbw&^g7!Rja{(&|l4{M+Qy7aZhMMpmWwqQpf zaBJBrPt?8g%Hw_0%D$t0PS7y&=lmjm^&@AaenWOz6+~tYs(0pm;CzFpaa`r#%LY7a zZpyxQe}p4{H|m9JKwQkhNA_P-1LxHNvUhXDTBSE4I-*{&G+BwU?j%p!%>;sm%|tPh z!}jO|_drKm0QaL!%~Tl6xsz93R<7mzE`X);>BU@rkLL8F^HqYxgL!^!OgtkZeN$u> zoF9e2lHoI*k9LheR{m(m<+Btl#?%9|kXSm^L|2lqq8LVqy%$jL>g$S(#6GoBo0yUG zO7vR|%{Vr(?iCkZMc#?oi^n3ilnK-E<@^pl*QLcFfuG9gxv!FdQN1hPo9yLrdf^c@ z33HR|fN?A3znjcW-0f^t`4$@W!V-(| zmX{DSV~=%4gbO5-%+KP$0q>mCuX6e>tCTATq#JeXzonpOGTt04-LZ7+3laKQJpB;X z$vkfds$xX**$(%i={p<-Ll|h@Y#c&Ee~#Gxd%!CpYD?lZc@@Mf#J@U>L`u>h6gYQh zqurJ2JT}rDgqs`LkdizXFz;hmoQPjHezh>DmE|+{+R$LI-48eEGgkjH0%;cia3gKE zj+DFa7nad5#=@g*R{W|eW~jgU*J?g{R`cJgq(l2 zt-h8B3-!GYD&5u4UC8q^{KzFtr#9FE+xs>X+34QiXnC8iu6E&R{A6(M_+a5yVxXTnJ7C9TfXwEka0xz~*e=Dqx+2rD5)d3~lIweT+595t4pL;dG zu>+YYy#@_wE@|`INQ2234K=A;e6Ie7V_8qA(X5lB?ZS#W_lm5*Da7Y?x%e?9{p^8? z3r*fps30;^vOycGEDK-Ez(-m&dGDcu#F&y5mVlpC)6^R214I^H@E9MW#!KRn&@w~? zKpShK?kT*ID|CG!p)*Me96LZx7XHQ>kORSGX*tYPH871SlyWo)qJo(^RvrXTxd7;B zdJbL&bhJDNtpKqLP0vYqX=1d)VYZSgPyJW6k{(Z8gKgR*B-$>Nr+%0{Z7^+KN`frQ z!S}3yk(_9@HpM(>+FXSQxeA8YJ-{OnJRFn=A=ow*{DX}PWTv{x!Yb^V79Zf*$9WV< ziunRFH9!vLXVFw3#>UMvQybN=!N++xISMNe4DV3GZly%CQ}Aq~X_f^lbwUolh5{B% zc++T#xze<`EUX_??E{AO%T@cx!TQ0~J|NgjHP1g)u}+pvTrI4VO%qoW>tx@=RmV!D zL=RmA6i@QHZ2`s8yl!hi(U{k54oo#5JC{da%SZ&FB#{-FyoRl{+_y^Xq)1fLL`!(+ zmZ9xK<}z#jB(xF)8)@5K9qSgdqHH)I=tQ-KZA}^w+VF4SKj6=lCQfn}kb-(RuvcG~ zXp*x0*Qcw#{Gowz8>1-WD?h6I=5#99Q{#bZ*+-a?V}mC5J#3Kr6K-cEGR_k2h4)_s`FmBP{UDi+uaIuy~T>i!<_sNWT|ogZ|jk3~-x%uv_s*K6$4fGQ&nlbe3S-|~~(>1mVCvyS#@r@}$i zTlev2AuZeQ77N_oJdD=Kgx4O((rO_vjQx?G*r(@F)XMk1?G}C!7RIYYNEUg>4DSQ! z0}-FOCT_O1=$~W60x`#*m3KHyq2Yo&e7lyq>Vlzh^BJ7HTgcj$=JM{1h?i9}ZDH4M ziJu^Pvk)AQ#~>9tIk#&B&EtrHztL+$CcbD1({(e_B5n*bu493#jJPGP0;ZGep9Y+t zy;j!K_8!yRWc@wS9bB;@w=g-FSalzLI*P*bCOO+tSW`sjP@zq9Rz{_ANzNXq)IgGR zvCt+uj|*+$kRB1TL>j6gLIOxbdL+maaj1p_2_VW}6qX|WdntyIY!8jIL4u%Co_bvz<3nOeSRs)lal!Jw8ptlO~JQtj~7$q5#O~y+X zV6wCE(pi}7LSeIFzBj7~ouWl?M$jo16lXO$#gF0)qT|F-)E{uHEFv0*W66@xrb3&9 zR>z4_a+5Iawv?f(I8g?ec1jM4DaC&wV%q0X)T2y^Q7{driPl51M}NSHJ_OT_%R%47 zQqCU6i4JIBmF1uXNH+I2<|5%cqa=ika#Tg@8BvDbM6KSfjsIGwuS-w*2&Q$E6RLCS zI|+<~Tl6HF1~y&%Z_bSWxo`DVIQjX~7|LU8!Yv9&MXF0%qD&li7BRXgNc=v`RXmPB zEil@784?h{`)TBOKk1?G-0R_VmU?)%Kgch0G0UFycOAjt-`??4_6H_O{BM(rG=d_2$i0|$e;SVVhq zd$+w;m@+P9DR}c#z}4Zh)e0q?jwbb`B{p_`biH}>60dJ_AM&m|+pIFUG~hVR65E^U z8E+5xaZP)kTwjUro~HTbZlucerF*6~5O>)~1OwobAf<8q5dxm7z`g$=)#|3HL%3g-pKl~!f;>Q|wdcUp2b)60Y^1MvO z_xxuDkK~gEbtcAU9!u%>`ajF;w^;7rUUG{ttJUy&{@!%61c~U#MY%t@)^bLwbbsa9 z`d3eDuFU(^{bYpcPj0H}QLX$hVUpJrG%8&Z!s99@NkdC3Zh^mBLR%2HA8J>1r#@E; z>KMi&`*x@KqcY|eW9wsRPyYJM+~17t%rCKs?m#02j{goPalJS55)Q#W=v_y5da9*O zu^i4o{XOlQjS4;yF|f7Cb8K>S(`4zv#;YZ`wAmg$xq!MSoS?qH(wB*;n?QT>>+SqgBu_yR*@QG6)$oN@Zw7cp<;vnN-leKZzCBZ2W9RirT z4|Hm@;g+HwOFz%D4OaRleBmL8jV3R#CLF630?A)V_l+Qne3L)8*`jnA2qi|dGNwl= z7Y@C+_7fqTS$wkRnVrlA8fZ6PMuTW0!}6P+ybHH?CtXXX%)Y5xMG!2SItF@Y+;@iN vBNrLP(uUXz$Pzv2{|xp22K@h7Eb&ky`=OYt{R?T~4^70{+zwS`>Yem2(BH`^ From 5ad8d1d33948a7f52620530bfb75a532086dee74 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 15:46:00 +0300 Subject: [PATCH 053/374] WIP --- frontend/webapp/design.system/drop.down/drop.down.styled.tsx | 2 +- frontend/webapp/design.system/input/input.styled.tsx | 2 +- .../webapp/design.system/search.input/search.input.styled.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/webapp/design.system/drop.down/drop.down.styled.tsx b/frontend/webapp/design.system/drop.down/drop.down.styled.tsx index fccd64123..49282f3d6 100644 --- a/frontend/webapp/design.system/drop.down/drop.down.styled.tsx +++ b/frontend/webapp/design.system/drop.down/drop.down.styled.tsx @@ -32,7 +32,7 @@ export const DropdownHeader = styled.div` align-items: center; color: ${({ theme }) => theme.text.white}; font-size: 14px; - font-family: ${({ theme }) => theme.font_family.primary}; + font-family: ${({ theme }) => theme.font_family.primary}, sans-serif; font-weight: 400; `; diff --git a/frontend/webapp/design.system/input/input.styled.tsx b/frontend/webapp/design.system/input/input.styled.tsx index bff06430f..808fdeffe 100644 --- a/frontend/webapp/design.system/input/input.styled.tsx +++ b/frontend/webapp/design.system/input/input.styled.tsx @@ -55,7 +55,7 @@ export const StyledInput = styled.input` export const StyledActionInput = styled(StyledInput)` color: var(--dark-mode-white, #fff); - font-family: Inter; + font-family: Inter, sans-serif; font-size: 24px; `; diff --git a/frontend/webapp/design.system/search.input/search.input.styled.tsx b/frontend/webapp/design.system/search.input/search.input.styled.tsx index f99e986d9..39ee4f362 100644 --- a/frontend/webapp/design.system/search.input/search.input.styled.tsx +++ b/frontend/webapp/design.system/search.input/search.input.styled.tsx @@ -29,7 +29,7 @@ export const StyledSearchInput = styled.input` color: ${({ active, theme }) => `${active ? theme.colors.white : theme.text.grey}`}; font-size: 14px; - font-family: ${({ theme }) => theme.font_family.primary}; + font-family: ${({ theme }) => theme.font_family.primary}, sans-serif; font-weight: 400; &:focus { color: ${({ theme }) => `solid 1px ${theme.colors.white}`}; From 26033f71afd6e313c722132a58a22aa99f78ae9e Mon Sep 17 00:00:00 2001 From: Alon Braymok <138359965+alonkeyval@users.noreply.github.com> Date: Thu, 3 Aug 2023 15:52:44 +0300 Subject: [PATCH 054/374] Task 165 manage source (#368) --- frontend/webapp/app/layout.tsx | 4 + .../destinations/create/[id]/page.tsx | 111 ++++++++++++++++++ .../app/overview/destinations/create/page.tsx | 7 ++ .../app/overview/destinations/manage/page.tsx | 67 +++++++++++ .../webapp/app/overview/destinations/page.tsx | 15 ++- frontend/webapp/app/overview/layout.tsx | 6 +- .../app/overview/sources/create/page.tsx | 40 +++++++ .../app/overview/sources/manage/page.tsx | 103 ++++++++++++++++ .../app/overview/sources/manage/styled.tsx | 15 +++ frontend/webapp/app/overview/sources/page.tsx | 6 +- .../webapp/assets/icons/overview/index.tsx | 3 +- frontend/webapp/assets/icons/overview/pen.svg | 3 + .../manage.destination/manage.destination.tsx | 6 +- frontend/webapp/components/overview/index.tsx | 1 + .../sources.action.menu.styled.tsx | 1 + .../action.menu/sources.action.menu.tsx | 2 +- .../sources/delete.source/delete.source.tsx | 68 +++++++++++ .../manage.source.header.tsx | 96 +++++++++++++++ .../sources.manage.card.tsx | 4 +- .../sources.manage.list.tsx | 12 +- .../sources.manage.styled.tsx | 4 +- .../webapp/components/side.menu/menu/menu.tsx | 15 +-- .../destination/destination.styled.tsx | 10 -- .../overview/destination/destination.tsx | 94 +++------------ .../destination/new.destination.flow.tsx | 78 ++---------- .../destination/update.destination.flow.tsx | 8 +- frontend/webapp/containers/overview/index.tsx | 1 + .../overview/sources/manage.sources.tsx | 4 +- .../overview/sources/new.source.flow.tsx | 6 +- .../containers/overview/sources/sources.tsx | 62 ++-------- .../setup/destination/destination.section.tsx | 8 +- .../drop.down/drop.down.styled.tsx | 2 +- frontend/webapp/design.system/index.tsx | 1 + .../design.system/input/action.input.tsx | 42 +++++++ .../design.system/input/input.styled.tsx | 19 +++ .../notification/notification.tsx | 1 + .../search.input/search.input.styled.tsx | 2 +- .../webapp/design.system/text/text.styled.tsx | 2 +- frontend/webapp/services/sources.tsx | 12 +- frontend/webapp/utils/constants/index.tsx | 2 +- frontend/webapp/utils/constants/routes.tsx | 5 + frontend/webapp/utils/constants/string.tsx | 9 ++ 42 files changed, 713 insertions(+), 244 deletions(-) create mode 100644 frontend/webapp/app/overview/destinations/create/[id]/page.tsx create mode 100644 frontend/webapp/app/overview/destinations/create/page.tsx create mode 100644 frontend/webapp/app/overview/destinations/manage/page.tsx create mode 100644 frontend/webapp/app/overview/sources/create/page.tsx create mode 100644 frontend/webapp/app/overview/sources/manage/page.tsx create mode 100644 frontend/webapp/app/overview/sources/manage/styled.tsx create mode 100644 frontend/webapp/assets/icons/overview/pen.svg create mode 100644 frontend/webapp/components/overview/sources/delete.source/delete.source.tsx create mode 100644 frontend/webapp/components/overview/sources/manage.source.header/manage.source.header.tsx create mode 100644 frontend/webapp/design.system/input/action.input.tsx diff --git a/frontend/webapp/app/layout.tsx b/frontend/webapp/app/layout.tsx index efe4c8326..050b0c95c 100644 --- a/frontend/webapp/app/layout.tsx +++ b/frontend/webapp/app/layout.tsx @@ -3,6 +3,7 @@ import React from "react"; import { ThemeProvider } from "styled-components"; import theme from "@/styles/palette"; import { QueryClient, QueryClientProvider } from "react-query"; +import Head from "next/head"; const LAYOUT_STYLE: React.CSSProperties = { margin: 0, @@ -30,6 +31,9 @@ export default function RootLayout({ + + Odigos + {children} diff --git a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx new file mode 100644 index 000000000..f4082de12 --- /dev/null +++ b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx @@ -0,0 +1,111 @@ +"use client"; +import React, { useEffect } from "react"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { useMutation, useQuery } from "react-query"; +import { + getDestination, + getDestinationsTypes, + setDestination, +} from "@/services"; +import { ManageDestination, OverviewHeader } from "@/components/overview"; +import { useNotification, useSectionData } from "@/hooks"; +import { useRouter, useSearchParams } from "next/navigation"; +import { styled } from "styled-components"; + +const DEST = "dest"; + +const NewDestinationContainer = styled.div` + padding: 20px 36px; +`; + +export default function NewDestinationFlow() { + const { sectionData, setSectionData } = useSectionData(null); + const { show, Notification } = useNotification(); + const { mutate } = useMutation((body) => setDestination(body)); + const searchParams = useSearchParams(); + const router = useRouter(); + + const { data: destinationType } = useQuery( + [QUERIES.API_DESTINATION_TYPE, sectionData?.type], + () => getDestination(sectionData?.type), + { + enabled: !!sectionData, + } + ); + + const { data: destinationsList } = useQuery( + [QUERIES.API_DESTINATION_TYPES], + getDestinationsTypes + ); + + useEffect(onPageLoad, [destinationsList]); + + function onPageLoad() { + const search = searchParams.get(DEST); + if (!destinationsList || !search) return; + + let currentData = null; + + for (const category of destinationsList.categories) { + if (currentData) { + break; + } + const filterItem = category.items.filter(({ type }) => type === search); + if (filterItem.length) { + currentData = filterItem[0]; + } + } + + setSectionData(currentData); + } + + function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { + show({ + type: NOTIFICATION.SUCCESS, + message, + }); + } + + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + + function onSubmit(newDestination) { + const destination = { + ...newDestination, + type: sectionData.type, + }; + + mutate(destination, { + onSuccess: () => onSuccess(OVERVIEW.DESTINATION_CREATED_SUCCESS), + onError, + }); + } + + function handleBackPress() { + router.back(); + } + + return ( + <> + + {destinationType && sectionData && ( + + + + )} + + + ); +} diff --git a/frontend/webapp/app/overview/destinations/create/page.tsx b/frontend/webapp/app/overview/destinations/create/page.tsx new file mode 100644 index 000000000..3b9a92b41 --- /dev/null +++ b/frontend/webapp/app/overview/destinations/create/page.tsx @@ -0,0 +1,7 @@ +"use client"; +import React from "react"; +import { NewDestinationFlow } from "@/containers/overview"; + +export default function CreateDestinationPage() { + return ; +} diff --git a/frontend/webapp/app/overview/destinations/manage/page.tsx b/frontend/webapp/app/overview/destinations/manage/page.tsx new file mode 100644 index 000000000..cd92c828f --- /dev/null +++ b/frontend/webapp/app/overview/destinations/manage/page.tsx @@ -0,0 +1,67 @@ +"use client"; +import React, { useEffect, useState } from "react"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { useNotification } from "@/hooks"; +import { useSearchParams } from "next/navigation"; +import UpdateDestinationFlow from "@/containers/overview/destination/update.destination.flow"; +import { getDestinations } from "@/services"; +import { useQuery } from "react-query"; +import { KeyvalLoader } from "@/design.system"; + +const DEST = "dest"; + +export default function ManageDestinationPage() { + const [selectedDestination, setSelectedDestination] = useState(null); + const { show, Notification } = useNotification(); + + const { + isLoading: destinationLoading, + data: destinationList, + refetch, + } = useQuery([QUERIES.API_DESTINATIONS], getDestinations); + + const searchParams = useSearchParams(); + + useEffect(onPageLoad, [searchParams, destinationList]); + + function onPageLoad() { + const search = searchParams.get(DEST); + const currentDestination = destinationList?.filter( + ({ id }) => id === search + ); + if (currentDestination?.length) { + setSelectedDestination(currentDestination[0]); + } + } + + function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { + refetch(); + show({ + type: NOTIFICATION.SUCCESS, + message, + }); + } + + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + + if (destinationLoading || !selectedDestination) { + return ; + } + + return ( + <> + + + + ); +} diff --git a/frontend/webapp/app/overview/destinations/page.tsx b/frontend/webapp/app/overview/destinations/page.tsx index 7056885ed..bb83b2d78 100644 --- a/frontend/webapp/app/overview/destinations/page.tsx +++ b/frontend/webapp/app/overview/destinations/page.tsx @@ -1,11 +1,22 @@ "use client"; import { DestinationContainer } from "@/containers/overview"; import React from "react"; +import { styled } from "styled-components"; + +const DestinationContainerWrapper = styled.div` + height: 100vh; + overflow-y: hidden; + ::-webkit-scrollbar { + display: none; + } + -ms-overflow-style: none; + scrollbar-width: none; +`; export default function DestinationDashboardPage() { return ( - <> + - + ); } diff --git a/frontend/webapp/app/overview/layout.tsx b/frontend/webapp/app/overview/layout.tsx index dc76e1c7f..2159907df 100644 --- a/frontend/webapp/app/overview/layout.tsx +++ b/frontend/webapp/app/overview/layout.tsx @@ -1,6 +1,7 @@ -"use client"; +// "use client"; import { Menu } from "@/components/side.menu"; import theme from "@/styles/palette"; +import { Metadata } from "next"; import React from "react"; const LAYOUT_STYLE = { @@ -14,6 +15,9 @@ const CHILDREN_STYLE = { width: "100%", height: "93%", }; +export const metadata: Metadata = { + title: "Odigos", +}; export default function Layout({ children }: { children: React.ReactNode }) { return ( diff --git a/frontend/webapp/app/overview/sources/create/page.tsx b/frontend/webapp/app/overview/sources/create/page.tsx new file mode 100644 index 000000000..9c83bfc82 --- /dev/null +++ b/frontend/webapp/app/overview/sources/create/page.tsx @@ -0,0 +1,40 @@ +"use client"; +import React from "react"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { OverviewHeader } from "@/components/overview"; +import { useNotification } from "@/hooks"; +import { useQuery } from "react-query"; +import { getSources } from "@/services"; +import { NewSourceFlow } from "@/containers/overview/sources/new.source.flow"; +import { useRouter } from "next/navigation"; + +export default function CreateNewSourcesPage() { + const { show, Notification } = useNotification(); + const router = useRouter(); + const { data: sources, refetch } = useQuery( + [QUERIES.API_SOURCES], + getSources + ); + + function onNewSourceSuccess() { + setTimeout(() => { + router.back(); + refetch(); + }, 1000); + show({ + type: NOTIFICATION.SUCCESS, + message: OVERVIEW.SOURCE_CREATED_SUCCESS, + }); + } + + return ( + <> + router.back()} + /> + + + + ); +} diff --git a/frontend/webapp/app/overview/sources/manage/page.tsx b/frontend/webapp/app/overview/sources/manage/page.tsx new file mode 100644 index 000000000..a8de98f08 --- /dev/null +++ b/frontend/webapp/app/overview/sources/manage/page.tsx @@ -0,0 +1,103 @@ +"use client"; +import { ManageSourceHeader } from "@/components/overview/sources/manage.source.header/manage.source.header"; +import { getSources } from "@/services"; +import { + NOTIFICATION, + OVERVIEW, + QUERIES, + ROUTES, + SETUP, +} from "@/utils/constants"; +import { useRouter, useSearchParams } from "next/navigation"; +import React, { useEffect, useState } from "react"; +import { useMutation, useQuery } from "react-query"; +import { ManageSourcePageContainer, BackButtonWrapper } from "./styled"; +import { LANGUAGES_LOGOS } from "@/assets/images"; +import { Back } from "@/assets/icons/overview"; +import { KeyvalText } from "@/design.system"; +import { ManagedSource } from "@/types/sources"; +import { DeleteSource } from "@/components/overview"; +import { deleteSource } from "@/services/sources"; +import { useNotification } from "@/hooks"; + +const SOURCE = "source"; + +export default function ManageSourcePage() { + const [currentSource, setCurrentSource] = useState( + null + ); + const searchParams = useSearchParams(); + const router = useRouter(); + const { data: sources, refetch } = useQuery( + [QUERIES.API_SOURCES], + getSources + ); + const { show, Notification } = useNotification(); + const { mutate } = useMutation(() => + deleteSource( + currentSource?.namespace || "", + currentSource?.kind || "", + currentSource?.name || "" + ) + ); + useEffect(onPageLoad, [sources]); + + useEffect(() => { + console.log({ currentSource }); + }, [currentSource]); + + function onPageLoad() { + const search = searchParams.get(SOURCE); + const source = sources?.find((item) => item.name === search); + source && setCurrentSource(source); + } + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + + function onSuccess() { + setTimeout(() => { + router.back(); + refetch(); + }, 1000); + show({ + type: NOTIFICATION.SUCCESS, + message: OVERVIEW.SOURCE_DELETED_SUCCESS, + }); + } + function onDelete() { + mutate(undefined, { + onSuccess, + onError, + }); + } + + return ( + + router.back()}> + + {SETUP.BACK} + + {currentSource && ( + + )} + + + + ); +} diff --git a/frontend/webapp/app/overview/sources/manage/styled.tsx b/frontend/webapp/app/overview/sources/manage/styled.tsx new file mode 100644 index 000000000..4face21f0 --- /dev/null +++ b/frontend/webapp/app/overview/sources/manage/styled.tsx @@ -0,0 +1,15 @@ +import styled from "styled-components"; + +export const ManageSourcePageContainer = styled.div` + padding: 32px; +`; + +export const BackButtonWrapper = styled.div` + display: flex; + width: fit-content; + align-items: center; + cursor: pointer; + p { + cursor: pointer !important; + } +`; diff --git a/frontend/webapp/app/overview/sources/page.tsx b/frontend/webapp/app/overview/sources/page.tsx index 454db1e18..77d0c32f2 100644 --- a/frontend/webapp/app/overview/sources/page.tsx +++ b/frontend/webapp/app/overview/sources/page.tsx @@ -3,9 +3,5 @@ import { SourcesContainer } from "@/containers/overview"; import React from "react"; export default function SourcesOverviewPage() { - return ( - <> - - - ); + return ; } diff --git a/frontend/webapp/assets/icons/overview/index.tsx b/frontend/webapp/assets/icons/overview/index.tsx index f9254c49d..68481e5ca 100644 --- a/frontend/webapp/assets/icons/overview/index.tsx +++ b/frontend/webapp/assets/icons/overview/index.tsx @@ -1,6 +1,7 @@ import KeyvalMiddleware from "./middleware.svg"; import Folder from "./folder.svg"; import Plus from "./plus.svg"; +import Pen from "./pen.svg"; import Back from "./back.svg"; -export { KeyvalMiddleware, Folder, Plus, Back }; +export { KeyvalMiddleware, Folder, Plus, Back, Pen }; diff --git a/frontend/webapp/assets/icons/overview/pen.svg b/frontend/webapp/assets/icons/overview/pen.svg new file mode 100644 index 000000000..03494bea2 --- /dev/null +++ b/frontend/webapp/assets/icons/overview/pen.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx index 51fd8d3cb..5dc79074a 100644 --- a/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx +++ b/frontend/webapp/components/overview/destination/manage.destination/manage.destination.tsx @@ -25,9 +25,10 @@ const BackButtonWrapper = styled.div` } `; -const CreateConnectionWrapper = styled.div` +const CreateConnectionWrapper = styled.div<{ expand: boolean | undefined }>` display: flex; gap: 200px; + height: ${({ expand }) => (expand ? 630 : 530)}px; overflow: scroll; scrollbar-width: none; `; @@ -60,7 +61,8 @@ export function ManageDestination({ )} - + +
void; + name: string | undefined; + image_url: string; +}) { + const [showModal, setShowModal] = useState(false); + + const modalConfig = { + title: OVERVIEW.DELETE_SOURCE, + showHeader: true, + showOverlay: true, + positionX: ModalPositionX.center, + positionY: ModalPositionY.center, + padding: "20px", + footer: { + primaryBtnText: OVERVIEW.CONFIRM_SOURCE_DELETE, + primaryBtnAction: () => { + setShowModal(false); + onDelete(); + }, + }, + }; + + return ( + <> + + setShowModal(true)} + /> + + {showModal && ( + setShowModal(false)} + config={modalConfig} + > +
+ +
+ + {`${OVERVIEW.DELETE} ${name}`} + +
+ )} + + ); +} diff --git a/frontend/webapp/components/overview/sources/manage.source.header/manage.source.header.tsx b/frontend/webapp/components/overview/sources/manage.source.header/manage.source.header.tsx new file mode 100644 index 000000000..5fbcec042 --- /dev/null +++ b/frontend/webapp/components/overview/sources/manage.source.header/manage.source.header.tsx @@ -0,0 +1,96 @@ +import React, { useRef, useState } from "react"; +import styled from "styled-components"; +import { KeyvalActionInput, KeyvalImage, KeyvalText } from "@/design.system"; +import { Pen } from "@/assets/icons/overview"; +import { useOnClickOutside } from "@/hooks"; + +const ManageSourceHeaderWrapper = styled.div` + display: flex; + width: 100%; + min-width: 686px; + height: 104px; + align-items: center; + border-radius: 25px; + margin: 24px 0; + background: radial-gradient( + 78.09% 72.18% at 100% -0%, + rgba(150, 242, 255, 0.4) 0%, + rgba(150, 242, 255, 0) 61.91% + ), + linear-gradient(180deg, #2e4c55 0%, #303355 100%); +`; + +const TextWrapper = styled.div` + margin-left: 12px; + margin-right: 12px; +`; + +const EditIconWrapper = styled.div` + width: 20px; + height: 40px; + display: flex; + align-items: center; + + :hover { + cursor: pointer; + fill: ${({ theme }) => theme.colors.secondary}; + } +`; + +const ActionInputWrapper = styled.div` + width: 80%; + height: 49px; +`; + +const IMAGE_STYLE: React.CSSProperties = { + backgroundColor: "#fff", + padding: 4, + marginRight: 16, + marginLeft: 16, +}; + +export function ManageSourceHeader({ image_url, name }) { + const [showEditInput, setShowEditInput] = useState(true); + const [inputValue, setInputValue] = useState(name); + const containerRef = useRef(null); + const handleClickOutside = () => { + !showEditInput && handleSave(); + }; + + useOnClickOutside(containerRef, handleClickOutside); + + function handleSave() { + setShowEditInput(true); + } + + function handleInputChange(value) { + setInputValue(value); + } + + return ( + + + {showEditInput ? ( + <> + + + {name} + + + + setShowEditInput(false)}> + + + + ) : ( + + handleInputChange(e)} + onAction={handleSave} + /> + + )} + + ); +} diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx index 1aa8f559b..a2a695f41 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx @@ -20,13 +20,15 @@ const LOGO_STYLE: React.CSSProperties = { interface SourceManagedCardProps { item: ManagedSource; + onClick?: () => void; } const DEPLOYMENT = "deployment"; export default function SourceManagedCard({ item = {} as ManagedSource, + onClick, }: SourceManagedCardProps) { return ( - + ( - + + router.push(`${ROUTES.MANAGE_SOURCE}?source=${source?.name}`) + } + /> )); } diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx index 3fd4cad8d..9a36b4efa 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx @@ -12,10 +12,10 @@ export const CardWrapper = styled.div` align-items: center; flex-direction: column; gap: 10px; - /* cursor: pointer; + cursor: pointer; &:hover { background: var(--dark-mode-dark-1, #07111a81); - } */ + } `; export const EmptyListWrapper = styled.div` diff --git a/frontend/webapp/components/side.menu/menu/menu.tsx b/frontend/webapp/components/side.menu/menu/menu.tsx index 8f83912ec..814885343 100644 --- a/frontend/webapp/components/side.menu/menu/menu.tsx +++ b/frontend/webapp/components/side.menu/menu/menu.tsx @@ -4,7 +4,7 @@ import { MenuContainer, LogoWrapper, MenuItemsWrapper } from "./menu.styled"; import { KeyvalText } from "@/design.system"; import MenuItem from "../menu.item/menu.item"; import { useRouter } from "next/navigation"; -import { OVERVIEW } from "@/utils/constants"; +import { OVERVIEW, ROUTES } from "@/utils/constants"; import { MENU_ITEMS } from "./items"; export interface MenuItem { @@ -26,12 +26,13 @@ export function Menu() { useEffect(onLoad, []); function onLoad() { - const currentItem = MENU_ITEMS.find((item) => { - return item.navigate === window.location.pathname; - }); - if (currentItem?.id !== currentMenuItem.id) { - handleMenuItemClick(currentItem); - } + const currentItem = MENU_ITEMS.find( + ({ navigate }) => + navigate !== ROUTES.OVERVIEW && + window.location.pathname.includes(navigate) + ); + + currentItem && setCurrentMenuItem(currentItem); } function handleMenuItemClick(item) { diff --git a/frontend/webapp/containers/overview/destination/destination.styled.tsx b/frontend/webapp/containers/overview/destination/destination.styled.tsx index cac5196dd..008ad16f7 100644 --- a/frontend/webapp/containers/overview/destination/destination.styled.tsx +++ b/frontend/webapp/containers/overview/destination/destination.styled.tsx @@ -1,15 +1,5 @@ import styled from "styled-components"; -export const DestinationContainerWrapper = styled.div` - height: 100vh; - overflow-y: hidden; - ::-webkit-scrollbar { - display: none; - } - -ms-overflow-style: none; - scrollbar-width: none; -`; - export const NewDestinationContainer = styled.div` padding: 20px 36px; `; diff --git a/frontend/webapp/containers/overview/destination/destination.tsx b/frontend/webapp/containers/overview/destination/destination.tsx index 162b174a6..8ed985640 100644 --- a/frontend/webapp/containers/overview/destination/destination.tsx +++ b/frontend/webapp/containers/overview/destination/destination.tsx @@ -1,92 +1,34 @@ "use client"; -import React, { useState } from "react"; +import React from "react"; import { KeyvalLoader } from "@/design.system"; -import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { OVERVIEW, QUERIES, ROUTES } from "@/utils/constants"; import { useQuery } from "react-query"; import { getDestinations } from "@/services"; import { OverviewHeader, DestinationsManagedList } from "@/components/overview"; -import { DestinationContainerWrapper } from "./destination.styled"; -import { NewDestinationFlow } from "./new.destination.flow"; -import { UpdateDestinationFlow } from "./update.destination.flow"; -import { useNotification } from "@/hooks"; +import { useRouter } from "next/navigation"; export function DestinationContainer() { - const [selectedDestination, setSelectedDestination] = useState(null); - const [displayNewDestination, setDisplayNewDestination] = - useState(false); - const { show, Notification } = useNotification(); - const { - isLoading: destinationLoading, - data: destinationList, - refetch, - } = useQuery([QUERIES.API_DESTINATIONS], getDestinations); - - function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { - refetch(); - setSelectedDestination(null); - setDisplayNewDestination(false); - show({ - type: NOTIFICATION.SUCCESS, - message, - }); - } - - function onError({ response }) { - const message = response?.data?.message; - show({ - type: NOTIFICATION.ERROR, - message, - }); - } - - function renderNewDestinationFlow() { - return ( - { - setDisplayNewDestination(false); - }} - /> - ); - } - - function renderUpdateDestinationFlow() { - return ( - - ); - } + const { isLoading: destinationLoading, data: destinationList } = useQuery( + [QUERIES.API_DESTINATIONS], + getDestinations + ); - function renderDestinationList() { - return ( - <> - - setDisplayNewDestination(true)} - /> - - ); - } + const router = useRouter(); if (destinationLoading) { return ; } return ( - - {displayNewDestination - ? renderNewDestinationFlow() - : selectedDestination - ? renderUpdateDestinationFlow() - : renderDestinationList()} - - + <> + + + router.push(`${ROUTES.UPDATE_DESTINATION}${id}`) + } + onMenuButtonClick={() => router.push(ROUTES.CREATE_DESTINATION)} + /> + ); } diff --git a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx index 7a75a32c0..27c0dddc7 100644 --- a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/new.destination.flow.tsx @@ -1,80 +1,26 @@ "use client"; -import React, { useState } from "react"; -import { OVERVIEW, QUERIES } from "@/utils/constants"; -import { useMutation, useQuery } from "react-query"; -import { getDestination, setDestination } from "@/services"; -import { ManageDestination, OverviewHeader } from "@/components/overview"; -import { useSectionData } from "@/hooks"; +import React from "react"; +import { OVERVIEW, ROUTES } from "@/utils/constants"; +import { OverviewHeader } from "@/components/overview"; import { DestinationSection } from "@/containers/setup/destination/destination.section"; import { NewDestinationContainer } from "./destination.styled"; +import { useRouter } from "next/navigation"; -export function NewDestinationFlow({ onBackClick, onSuccess, onError }) { - const { sectionData, setSectionData } = useSectionData(null); - const [managed, setManaged] = useState(null); - const { data: destinationType } = useQuery( - [QUERIES.API_DESTINATION_TYPE, sectionData?.type], - () => getDestination(sectionData?.type), - { - enabled: !!sectionData, - } - ); - const { mutate } = useMutation((body) => setDestination(body)); - - function onSubmit(newDestination) { - const destination = { - ...newDestination, - type: sectionData.type, - }; - - mutate(destination, { - onSuccess: () => onSuccess(OVERVIEW.DESTINATION_CREATED_SUCCESS), - onError, - }); - } - - function handleBackPress() { - if (managed && sectionData) { - setManaged(false); - setSectionData(null); - return; - } - onBackClick(); - } - - function renderNewDestinationForm() { - return ( - - ); - } - - function renderSelectNewDestination() { - return ( - <> - { - setSectionData(data); - setManaged(true); - }} - /> - - ); - } +export function NewDestinationFlow() { + const router = useRouter(); return ( <> router.back()} /> - {managed && sectionData - ? renderNewDestinationForm() - : renderSelectNewDestination()} + { + router.push(`${ROUTES.MANAGE_DESTINATION}${data.type}`); + }} + /> ); diff --git a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx b/frontend/webapp/containers/overview/destination/update.destination.flow.tsx index 8eb710a29..d95fe7ac4 100644 --- a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/update.destination.flow.tsx @@ -7,13 +7,15 @@ import { getDestination, updateDestination } from "@/services"; import { ManageDestination } from "@/components/overview"; import { deleteDestination } from "@/services/destinations"; import { ManageDestinationWrapper } from "./destination.styled"; +import { useRouter } from "next/navigation"; -export function UpdateDestinationFlow({ +export default function UpdateDestinationFlow({ selectedDestination, - setSelectedDestination, onSuccess, onError, }) { + const router = useRouter(); + const manageData = useMemo(() => { return { ...selectedDestination, @@ -60,7 +62,7 @@ export function UpdateDestinationFlow({ ) : ( setSelectedDestination(null)} + onBackClick={() => router.back()} destinationType={destinationType} selectedDestination={manageData} onSubmit={onSubmit} diff --git a/frontend/webapp/containers/overview/index.tsx b/frontend/webapp/containers/overview/index.tsx index 2a26e3504..e7895d4e4 100644 --- a/frontend/webapp/containers/overview/index.tsx +++ b/frontend/webapp/containers/overview/index.tsx @@ -1,3 +1,4 @@ export { OverviewContainer } from "./overview/overview"; export { DestinationContainer } from "./destination/destination"; export { SourcesContainer } from "./sources/sources"; +export { NewDestinationFlow } from "./destination/new.destination.flow"; diff --git a/frontend/webapp/containers/overview/sources/manage.sources.tsx b/frontend/webapp/containers/overview/sources/manage.sources.tsx index af0e0daa9..1b3339cac 100644 --- a/frontend/webapp/containers/overview/sources/manage.sources.tsx +++ b/frontend/webapp/containers/overview/sources/manage.sources.tsx @@ -9,7 +9,7 @@ import { ManagedSource, Namespace } from "@/types/sources"; const DEFAULT_FILTER = { name: "default", selected: false, totalApps: 0 }; -export function ManageSources({ setDisplayNewSourceFlow, sources }) { +export function ManageSources({ onAddClick, sources }) { const [searchFilter, setSearchFilter] = useState(""); const [currentNamespace, setCurrentNamespace] = useState(DEFAULT_FILTER); @@ -60,7 +60,7 @@ export function ManageSources({ setDisplayNewSourceFlow, sources }) { searchFilter={searchFilter} setSearchFilter={setSearchFilter} data={namespacesList} - onAddClick={() => setDisplayNewSourceFlow(true)} + onAddClick={onAddClick} setCurrentItem={setCurrentNamespace} /> diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx index 5152767ba..3b5468b9a 100644 --- a/frontend/webapp/containers/overview/sources/new.source.flow.tsx +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -17,7 +17,9 @@ export function NewSourceFlow({ onSuccess, sources }) { const { show, Notification } = useNotification(); function updateSectionDataWithSources() { - const sourceNamesSet = new Set(sources.map((source) => source.name)); + const sourceNamesSet = new Set( + sources.map((source: SelectedSources) => source.name) + ); const updatedSectionData: SelectedSources = {}; for (const key in sectionData) { @@ -50,6 +52,7 @@ export function NewSourceFlow({ onSuccess, sources }) { {`${totalSelected} ${SETUP.SELECTED}`} @@ -58,6 +61,7 @@ export function NewSourceFlow({ onSuccess, sources }) { + (null); - const { show, Notification } = useNotification(); - - const { data: sources, refetch } = useQuery( - [QUERIES.API_SOURCES], - getSources - ); - - useEffect(() => { - refetchSources(); - }, [displayNewSourceFlow]); - - async function refetchSources() { - if (displayNewSourceFlow === false) { - setTimeout(async () => { - refetch(); - }, 1000); - } - } - - function onNewSourceSuccess() { - setDisplayNewSourceFlow(false); - show({ - type: NOTIFICATION.SUCCESS, - message: OVERVIEW.SOURCE_CREATED_SUCCESS, - }); - } - - function renderNewSourceFlow() { - return ; - } - - function renderSources() { - return ( - - ); - } + const router = useRouter(); + const { data: sources } = useQuery([QUERIES.API_SOURCES], getSources); return ( - setDisplayNewSourceFlow(false) : null - } + + router.push(ROUTES.CREATE_SOURCE)} + sources={sources} /> - {displayNewSourceFlow ? renderNewSourceFlow() : renderSources()} - ); } diff --git a/frontend/webapp/containers/setup/destination/destination.section.tsx b/frontend/webapp/containers/setup/destination/destination.section.tsx index e8dd0a051..854edd779 100644 --- a/frontend/webapp/containers/setup/destination/destination.section.tsx +++ b/frontend/webapp/containers/setup/destination/destination.section.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from "react"; import { useQuery } from "react-query"; -import { QUERIES, SETUP } from "@/utils/constants"; +import { NOTIFICATION, QUERIES, SETUP } from "@/utils/constants"; import { MONITORING_OPTIONS } from "@/components/setup/destination/utils"; import { DestinationList, DestinationOptionMenu } from "@/components/setup"; import Empty from "@/assets/images/empty-list.svg"; @@ -20,7 +20,7 @@ import { useNotification } from "@/hooks"; import { getDestinationsTypes } from "@/services"; type DestinationSectionProps = { - sectionData: any; + sectionData?: any; setSectionData: (data: any) => void; }; @@ -42,7 +42,7 @@ export function DestinationSection({ useEffect(() => { isError && show({ - type: "error", + type: NOTIFICATION.ERROR, message: error, }); }, [isError]); @@ -70,9 +70,9 @@ export function DestinationSection({ return ( displayItem && ( setSectionData(item)} /> ) diff --git a/frontend/webapp/design.system/drop.down/drop.down.styled.tsx b/frontend/webapp/design.system/drop.down/drop.down.styled.tsx index fccd64123..49282f3d6 100644 --- a/frontend/webapp/design.system/drop.down/drop.down.styled.tsx +++ b/frontend/webapp/design.system/drop.down/drop.down.styled.tsx @@ -32,7 +32,7 @@ export const DropdownHeader = styled.div` align-items: center; color: ${({ theme }) => theme.text.white}; font-size: 14px; - font-family: ${({ theme }) => theme.font_family.primary}; + font-family: ${({ theme }) => theme.font_family.primary}, sans-serif; font-weight: 400; `; diff --git a/frontend/webapp/design.system/index.tsx b/frontend/webapp/design.system/index.tsx index 7885d1a19..c1b3be3ce 100644 --- a/frontend/webapp/design.system/index.tsx +++ b/frontend/webapp/design.system/index.tsx @@ -15,6 +15,7 @@ export { KeyvalLink } from "./link/link"; export { KeyvalTooltip } from "./tooltip/tooltip"; export { KeyvalImage } from "./image/image"; export { KeyvalInput } from "./input/input"; +export { KeyvalActionInput } from "./input/action.input"; export { KeyvalVideo } from "./video/video"; export { KeyvalLoader } from "./loader/loader"; export { KeyvalNotification } from "./notification/notification"; diff --git a/frontend/webapp/design.system/input/action.input.tsx b/frontend/webapp/design.system/input/action.input.tsx new file mode 100644 index 000000000..4bede03d6 --- /dev/null +++ b/frontend/webapp/design.system/input/action.input.tsx @@ -0,0 +1,42 @@ +import React, { ChangeEvent } from "react"; +import { StyledActionInputContainer, StyledActionInput } from "./input.styled"; +import { KeyvalButton } from "../button/button"; +import { KeyvalText } from "../text/text"; +import theme from "@/styles/palette"; +import { ACTION } from "@/utils/constants"; + +interface InputProps { + value: string; + onAction: () => void; + onChange: (value: string) => void; + type?: string; + style?: React.CSSProperties; +} + +export function KeyvalActionInput({ + value, + onChange, + style = {}, +}: InputProps): JSX.Element { + function handleChange(event: ChangeEvent): void { + onChange(event.target.value); + } + + return ( + <> + + + + + + {ACTION.SAVE} + + + + + ); +} diff --git a/frontend/webapp/design.system/input/input.styled.tsx b/frontend/webapp/design.system/input/input.styled.tsx index 25b200005..808fdeffe 100644 --- a/frontend/webapp/design.system/input/input.styled.tsx +++ b/frontend/webapp/design.system/input/input.styled.tsx @@ -32,6 +32,19 @@ export const StyledInputContainer = styled.div` } `; +export const StyledActionInputContainer = styled.div` + position: relative; + display: flex; + width: 100%; + padding: 0px 12px; + height: 100%; + align-items: center; + justify-content: space-between; + gap: 10px; + border-radius: 4px; + border: ${({ theme }) => `1px solid ${theme.colors.secondary}`}; +`; + export const StyledInput = styled.input` background: transparent; border: none; @@ -40,6 +53,12 @@ export const StyledInput = styled.input` color: ${({ theme }) => theme.text.white}; `; +export const StyledActionInput = styled(StyledInput)` + color: var(--dark-mode-white, #fff); + font-family: Inter, sans-serif; + font-size: 24px; +`; + export const LabelWrapper = styled.div` margin-bottom: 8px; `; diff --git a/frontend/webapp/design.system/notification/notification.tsx b/frontend/webapp/design.system/notification/notification.tsx index a8d53e169..c0352b40e 100644 --- a/frontend/webapp/design.system/notification/notification.tsx +++ b/frontend/webapp/design.system/notification/notification.tsx @@ -7,6 +7,7 @@ import { KeyvalText } from "../text/text"; import CloseIcon from "@/assets/icons/X-blue.svg"; import SuccessIcon from "@/assets/icons/success-notification.svg"; import ErrorIcon from "@/assets/icons/error-notification.svg"; + interface KeyvalNotificationProps { type: "success" | "error" | "warning" | "info"; message: string; diff --git a/frontend/webapp/design.system/search.input/search.input.styled.tsx b/frontend/webapp/design.system/search.input/search.input.styled.tsx index f99e986d9..39ee4f362 100644 --- a/frontend/webapp/design.system/search.input/search.input.styled.tsx +++ b/frontend/webapp/design.system/search.input/search.input.styled.tsx @@ -29,7 +29,7 @@ export const StyledSearchInput = styled.input` color: ${({ active, theme }) => `${active ? theme.colors.white : theme.text.grey}`}; font-size: 14px; - font-family: ${({ theme }) => theme.font_family.primary}; + font-family: ${({ theme }) => theme.font_family.primary}, sans-serif; font-weight: 400; &:focus { color: ${({ theme }) => `solid 1px ${theme.colors.white}`}; diff --git a/frontend/webapp/design.system/text/text.styled.tsx b/frontend/webapp/design.system/text/text.styled.tsx index f400cfe94..a68573fc4 100644 --- a/frontend/webapp/design.system/text/text.styled.tsx +++ b/frontend/webapp/design.system/text/text.styled.tsx @@ -3,7 +3,7 @@ import styled from "styled-components"; export const TextWrapper = styled.p` color: ${({ theme }) => theme.text.white}; margin: 0; - font-family: ${({ theme }) => theme.font_family.primary}; + font-family: ${({ theme }) => theme.font_family.primary}, sans-serif; font-size: 16px; font-weight: 400; `; diff --git a/frontend/webapp/services/sources.tsx b/frontend/webapp/services/sources.tsx index eb50b72a2..fc7fd5050 100644 --- a/frontend/webapp/services/sources.tsx +++ b/frontend/webapp/services/sources.tsx @@ -1,5 +1,5 @@ import { API } from "@/utils/constants"; -import { get, post } from "./api"; +import { get, post, httpDelete } from "./api"; import { SelectedSources } from "@/types/sources"; export async function getNamespaces() { @@ -17,3 +17,13 @@ export async function setNamespaces(body: SelectedSources): Promise { export async function getSources() { return await get(API.SOURCES); } + +export async function deleteSource( + namespace: string, + kind: string, + name: string +) { + return await httpDelete( + `${API.SOURCES}/namespace/${namespace}/kind/${kind}/name/${name}` + ); +} diff --git a/frontend/webapp/utils/constants/index.tsx b/frontend/webapp/utils/constants/index.tsx index 11dd91a8d..90fdf2c71 100644 --- a/frontend/webapp/utils/constants/index.tsx +++ b/frontend/webapp/utils/constants/index.tsx @@ -1,4 +1,4 @@ export { ROUTES } from "./routes"; export { CONFIG } from "./config"; -export { SETUP, OVERVIEW, NOTIFICATION } from "./string"; +export { SETUP, OVERVIEW, NOTIFICATION, ACTION } from "./string"; export { API, QUERIES } from "./urls"; diff --git a/frontend/webapp/utils/constants/routes.tsx b/frontend/webapp/utils/constants/routes.tsx index a27e3f561..6a074d899 100644 --- a/frontend/webapp/utils/constants/routes.tsx +++ b/frontend/webapp/utils/constants/routes.tsx @@ -4,4 +4,9 @@ export const ROUTES = { SOURCES: "/overview/sources", DESTINATIONS: "/overview/destinations", NEW_DESTINATION: "/setup?state=destinations", + MANAGE_DESTINATION: "/overview/destinations/create/manage?dest=", + UPDATE_DESTINATION: "destinations/manage?dest=", + CREATE_DESTINATION: "destinations/create", + CREATE_SOURCE: "/overview/sources/create", + MANAGE_SOURCE: "/overview/sources/manage", }; diff --git a/frontend/webapp/utils/constants/string.tsx b/frontend/webapp/utils/constants/string.tsx index 53903e8c5..3227c2b95 100644 --- a/frontend/webapp/utils/constants/string.tsx +++ b/frontend/webapp/utils/constants/string.tsx @@ -73,13 +73,22 @@ export const OVERVIEW = { MANAGE: "Manage", DELETE: "Delete", DELETE_DESTINATION: "Delete Destination", + DELETE_SOURCE: "Delete Source", + SOURCE_DANGER_ZONE_TITLE: "Delete this source", + SOURCE_DANGER_ZONE_SUBTITLE: + "This action cannot be undone. This will permanently delete the source and all associated data.", DELETE_MODAL_TITLE: "Delete this destination", DELETE_MODAL_SUBTITLE: "This action cannot be undone. This will permanently delete the destination and all associated data.", DELETE_BUTTON: "I want to delete this destination", + CONFIRM_SOURCE_DELETE: "I want to delete this source", CONNECT: "Connect", }; +export const ACTION = { + SAVE: "Save", +}; + export const NOTIFICATION = { ERROR: "error", SUCCESS: "success", From 4e02ce6da11d1abd5572fc93bf1391c476c9590e Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 16:28:38 +0300 Subject: [PATCH 055/374] WIP --- frontend/webapp/app/layout.tsx | 5 +---- frontend/webapp/app/overview/layout.tsx | 7 ++----- frontend/webapp/app/setup/layout.tsx | 8 ++++++++ frontend/webapp/utils/constants/config.tsx | 5 +++++ frontend/webapp/utils/constants/index.tsx | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 frontend/webapp/app/setup/layout.tsx diff --git a/frontend/webapp/app/layout.tsx b/frontend/webapp/app/layout.tsx index 050b0c95c..33abda923 100644 --- a/frontend/webapp/app/layout.tsx +++ b/frontend/webapp/app/layout.tsx @@ -3,7 +3,7 @@ import React from "react"; import { ThemeProvider } from "styled-components"; import theme from "@/styles/palette"; import { QueryClient, QueryClientProvider } from "react-query"; -import Head from "next/head"; +import { Metadata } from "next"; const LAYOUT_STYLE: React.CSSProperties = { margin: 0, @@ -31,9 +31,6 @@ export default function RootLayout({ - - Odigos - {children} diff --git a/frontend/webapp/app/overview/layout.tsx b/frontend/webapp/app/overview/layout.tsx index 2159907df..ba1d6a895 100644 --- a/frontend/webapp/app/overview/layout.tsx +++ b/frontend/webapp/app/overview/layout.tsx @@ -1,6 +1,6 @@ -// "use client"; import { Menu } from "@/components/side.menu"; import theme from "@/styles/palette"; +import { METADATA } from "@/utils/constants"; import { Metadata } from "next"; import React from "react"; @@ -15,10 +15,7 @@ const CHILDREN_STYLE = { width: "100%", height: "93%", }; -export const metadata: Metadata = { - title: "Odigos", -}; - +export const metadata: Metadata = METADATA; export default function Layout({ children }: { children: React.ReactNode }) { return (
diff --git a/frontend/webapp/app/setup/layout.tsx b/frontend/webapp/app/setup/layout.tsx new file mode 100644 index 000000000..a4ee950c2 --- /dev/null +++ b/frontend/webapp/app/setup/layout.tsx @@ -0,0 +1,8 @@ +import { METADATA } from "@/utils/constants"; +import { Metadata } from "next"; + +export const metadata: Metadata = METADATA; + +export default function Layout({ children }: { children: React.ReactNode }) { + return
{children}
; +} diff --git a/frontend/webapp/utils/constants/config.tsx b/frontend/webapp/utils/constants/config.tsx index f3aebd36f..0cda26a5d 100644 --- a/frontend/webapp/utils/constants/config.tsx +++ b/frontend/webapp/utils/constants/config.tsx @@ -3,3 +3,8 @@ export const CONFIG = { APPS_SELECTED: "APPS_SELECTED", FINISHED: "FINISHED", }; + +export const METADATA = { + title: "Odigos", + icons: "https://d2q89wckrml3k4.cloudfront.net/logo.png", +}; diff --git a/frontend/webapp/utils/constants/index.tsx b/frontend/webapp/utils/constants/index.tsx index 90fdf2c71..253c82b8a 100644 --- a/frontend/webapp/utils/constants/index.tsx +++ b/frontend/webapp/utils/constants/index.tsx @@ -1,4 +1,4 @@ export { ROUTES } from "./routes"; -export { CONFIG } from "./config"; +export { CONFIG, METADATA } from "./config"; export { SETUP, OVERVIEW, NOTIFICATION, ACTION } from "./string"; export { API, QUERIES } from "./urls"; From b49275e5e804180dd1abf5dffff82f06efccad44 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 16:33:40 +0300 Subject: [PATCH 056/374] delete files --- frontend/webapp/app/layout.tsx | 1 - frontend/webapp/public/favicon.ico | Bin 25931 -> 0 bytes frontend/webapp/public/next.svg | 1 - frontend/webapp/public/vercel.svg | 1 - 4 files changed, 3 deletions(-) delete mode 100644 frontend/webapp/public/favicon.ico delete mode 100644 frontend/webapp/public/next.svg delete mode 100644 frontend/webapp/public/vercel.svg diff --git a/frontend/webapp/app/layout.tsx b/frontend/webapp/app/layout.tsx index 33abda923..efe4c8326 100644 --- a/frontend/webapp/app/layout.tsx +++ b/frontend/webapp/app/layout.tsx @@ -3,7 +3,6 @@ import React from "react"; import { ThemeProvider } from "styled-components"; import theme from "@/styles/palette"; import { QueryClient, QueryClientProvider } from "react-query"; -import { Metadata } from "next"; const LAYOUT_STYLE: React.CSSProperties = { margin: 0, diff --git a/frontend/webapp/public/favicon.ico b/frontend/webapp/public/favicon.ico deleted file mode 100644 index 718d6fea4835ec2d246af9800eddb7ffb276240c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25931 zcmeHv30#a{`}aL_*G&7qml|y<+KVaDM2m#dVr!KsA!#An?kSQM(q<_dDNCpjEux83 zLb9Z^XxbDl(w>%i@8hT6>)&Gu{h#Oeyszu?xtw#Zb1mO{pgX9699l+Qppw7jXaYf~-84xW z)w4x8?=youko|}Vr~(D$UXIbiXABHh`p1?nn8Po~fxRJv}|0e(BPs|G`(TT%kKVJAdg5*Z|x0leQq0 zkdUBvb#>9F()jo|T~kx@OM8$9wzs~t2l;K=woNssA3l6|sx2r3+kdfVW@e^8e*E}v zA1y5{bRi+3Z`uD3{F7LgFJDdvm;nJilkzDku>BwXH(8ItVCXk*-lSJnR?-2UN%hJ){&rlvg`CDTj z)Bzo!3v7Ou#83zEDEFcKt(f1E0~=rqeEbTnMvWR#{+9pg%7G8y>u1OVRUSoox-ovF z2Ydma(;=YuBY(eI|04{hXzZD6_f(v~H;C~y5=DhAC{MMS>2fm~1H_t2$56pc$NH8( z5bH|<)71dV-_oCHIrzrT`2s-5w_+2CM0$95I6X8p^r!gHp+j_gd;9O<1~CEQQGS8) zS9Qh3#p&JM-G8rHekNmKVewU;pJRcTAog68KYo^dRo}(M>36U4Us zfgYWSiHZL3;lpWT=zNAW>Dh#mB!_@Lg%$ms8N-;aPqMn+C2HqZgz&9~Eu z4|Kp<`$q)Uw1R?y(~S>ePdonHxpV1#eSP1B;Ogo+-Pk}6#0GsZZ5!||ev2MGdh}_m z{DeR7?0-1^zVs&`AV6Vt;r3`I`OI_wgs*w=eO%_#7Kepl{B@xiyCANc(l zzIyd4y|c6PXWq9-|KM8(zIk8LPk(>a)zyFWjhT!$HJ$qX1vo@d25W<fvZQ2zUz5WRc(UnFMKHwe1| zWmlB1qdbiA(C0jmnV<}GfbKtmcu^2*P^O?MBLZKt|As~ge8&AAO~2K@zbXelK|4T<{|y4`raF{=72kC2Kn(L4YyenWgrPiv z@^mr$t{#X5VuIMeL!7Ab6_kG$&#&5p*Z{+?5U|TZ`B!7llpVmp@skYz&n^8QfPJzL z0G6K_OJM9x+Wu2gfN45phANGt{7=C>i34CV{Xqlx(fWpeAoj^N0Biu`w+MVcCUyU* zDZuzO0>4Z6fbu^T_arWW5n!E45vX8N=bxTVeFoep_G#VmNlQzAI_KTIc{6>c+04vr zx@W}zE5JNSU>!THJ{J=cqjz+4{L4A{Ob9$ZJ*S1?Ggg3klFp!+Y1@K+pK1DqI|_gq z5ZDXVpge8-cs!o|;K73#YXZ3AShj50wBvuq3NTOZ`M&qtjj#GOFfgExjg8Gn8>Vq5 z`85n+9|!iLCZF5$HJ$Iu($dm?8~-ofu}tEc+-pyke=3!im#6pk_Wo8IA|fJwD&~~F zc16osQ)EBo58U7XDuMexaPRjU@h8tXe%S{fA0NH3vGJFhuyyO!Uyl2^&EOpX{9As0 zWj+P>{@}jxH)8|r;2HdupP!vie{sJ28b&bo!8`D^x}TE$%zXNb^X1p@0PJ86`dZyj z%ce7*{^oo+6%&~I!8hQy-vQ7E)0t0ybH4l%KltWOo~8cO`T=157JqL(oq_rC%ea&4 z2NcTJe-HgFjNg-gZ$6!Y`SMHrlj}Etf7?r!zQTPPSv}{so2e>Fjs1{gzk~LGeesX%r(Lh6rbhSo_n)@@G-FTQy93;l#E)hgP@d_SGvyCp0~o(Y;Ee8{ zdVUDbHm5`2taPUOY^MAGOw*>=s7=Gst=D+p+2yON!0%Hk` zz5mAhyT4lS*T3LS^WSxUy86q&GnoHxzQ6vm8)VS}_zuqG?+3td68_x;etQAdu@sc6 zQJ&5|4(I?~3d-QOAODHpZ=hlSg(lBZ!JZWCtHHSj`0Wh93-Uk)_S%zsJ~aD>{`A0~ z9{AG(e|q3g5B%wYKRxiL2Y$8(4w6bzchKuloQW#e&S3n+P- z8!ds-%f;TJ1>)v)##>gd{PdS2Oc3VaR`fr=`O8QIO(6(N!A?pr5C#6fc~Ge@N%Vvu zaoAX2&(a6eWy_q&UwOhU)|P3J0Qc%OdhzW=F4D|pt0E4osw;%<%Dn58hAWD^XnZD= z>9~H(3bmLtxpF?a7su6J7M*x1By7YSUbxGi)Ot0P77`}P3{)&5Un{KD?`-e?r21!4vTTnN(4Y6Lin?UkSM z`MXCTC1@4A4~mvz%Rh2&EwY))LeoT=*`tMoqcEXI>TZU9WTP#l?uFv+@Dn~b(>xh2 z;>B?;Tz2SR&KVb>vGiBSB`@U7VIWFSo=LDSb9F{GF^DbmWAfpms8Sx9OX4CnBJca3 zlj9(x!dIjN?OG1X4l*imJNvRCk}F%!?SOfiOq5y^mZW)jFL@a|r-@d#f7 z2gmU8L3IZq0ynIws=}~m^#@&C%J6QFo~Mo4V`>v7MI-_!EBMMtb%_M&kvAaN)@ZVw z+`toz&WG#HkWDjnZE!6nk{e-oFdL^$YnbOCN}JC&{$#$O27@|Tn-skXr)2ml2~O!5 zX+gYoxhoc7qoU?C^3~&!U?kRFtnSEecWuH0B0OvLodgUAi}8p1 zrO6RSXHH}DMc$&|?D004DiOVMHV8kXCP@7NKB zgaZq^^O<7PoKEp72kby@W0Z!Y*Ay{&vfg#C&gG@YVR9g?FEocMUi1gSN$+V+ayF45{a zuDZDTN}mS|;BO%gEf}pjBfN2-gIrU#G5~cucA;dokXW89%>AyXJJI z9X4UlIWA|ZYHgbI z5?oFk@A=Ik7lrEQPDH!H+b`7_Y~aDb_qa=B2^Y&Ow41cU=4WDd40dp5(QS-WMN-=Y z9g;6_-JdNU;|6cPwf$ak*aJIcwL@1n$#l~zi{c{EW?T;DaW*E8DYq?Umtz{nJ&w-M zEMyTDrC&9K$d|kZe2#ws6)L=7K+{ zQw{XnV6UC$6-rW0emqm8wJoeZK)wJIcV?dST}Z;G0Arq{dVDu0&4kd%N!3F1*;*pW zR&qUiFzK=@44#QGw7k1`3t_d8&*kBV->O##t|tonFc2YWrL7_eqg+=+k;!F-`^b8> z#KWCE8%u4k@EprxqiV$VmmtiWxDLgnGu$Vs<8rppV5EajBXL4nyyZM$SWVm!wnCj-B!Wjqj5-5dNXukI2$$|Bu3Lrw}z65Lc=1G z^-#WuQOj$hwNGG?*CM_TO8Bg-1+qc>J7k5c51U8g?ZU5n?HYor;~JIjoWH-G>AoUP ztrWWLbRNqIjW#RT*WqZgPJXU7C)VaW5}MiijYbABmzoru6EmQ*N8cVK7a3|aOB#O& zBl8JY2WKfmj;h#Q!pN%9o@VNLv{OUL?rixHwOZuvX7{IJ{(EdPpuVFoQqIOa7giLVkBOKL@^smUA!tZ1CKRK}#SSM)iQHk)*R~?M!qkCruaS!#oIL1c z?J;U~&FfH#*98^G?i}pA{ z9Jg36t4=%6mhY(quYq*vSxptes9qy|7xSlH?G=S@>u>Ebe;|LVhs~@+06N<4CViBk zUiY$thvX;>Tby6z9Y1edAMQaiH zm^r3v#$Q#2T=X>bsY#D%s!bhs^M9PMAcHbCc0FMHV{u-dwlL;a1eJ63v5U*?Q_8JO zT#50!RD619#j_Uf))0ooADz~*9&lN!bBDRUgE>Vud-i5ck%vT=r^yD*^?Mp@Q^v+V zG#-?gKlr}Eeqifb{|So?HM&g91P8|av8hQoCmQXkd?7wIJwb z_^v8bbg`SAn{I*4bH$u(RZ6*xUhuA~hc=8czK8SHEKTzSxgbwi~9(OqJB&gwb^l4+m`k*Q;_?>Y-APi1{k zAHQ)P)G)f|AyjSgcCFps)Fh6Bca*Xznq36!pV6Az&m{O8$wGFD? zY&O*3*J0;_EqM#jh6^gMQKpXV?#1?>$ml1xvh8nSN>-?H=V;nJIwB07YX$e6vLxH( zqYwQ>qxwR(i4f)DLd)-$P>T-no_c!LsN@)8`e;W@)-Hj0>nJ-}Kla4-ZdPJzI&Mce zv)V_j;(3ERN3_@I$N<^|4Lf`B;8n+bX@bHbcZTopEmDI*Jfl)-pFDvo6svPRoo@(x z);_{lY<;);XzT`dBFpRmGrr}z5u1=pC^S-{ce6iXQlLGcItwJ^mZx{m$&DA_oEZ)B{_bYPq-HA zcH8WGoBG(aBU_j)vEy+_71T34@4dmSg!|M8Vf92Zj6WH7Q7t#OHQqWgFE3ARt+%!T z?oLovLVlnf?2c7pTc)~cc^($_8nyKwsN`RA-23ed3sdj(ys%pjjM+9JrctL;dy8a( z@en&CQmnV(()bu|Y%G1-4a(6x{aLytn$T-;(&{QIJB9vMox11U-1HpD@d(QkaJdEb zG{)+6Dos_L+O3NpWo^=gR?evp|CqEG?L&Ut#D*KLaRFOgOEK(Kq1@!EGcTfo+%A&I z=dLbB+d$u{sh?u)xP{PF8L%;YPPW53+@{>5W=Jt#wQpN;0_HYdw1{ksf_XhO4#2F= zyPx6Lx2<92L-;L5PD`zn6zwIH`Jk($?Qw({erA$^bC;q33hv!d!>%wRhj# zal^hk+WGNg;rJtb-EB(?czvOM=H7dl=vblBwAv>}%1@{}mnpUznfq1cE^sgsL0*4I zJ##!*B?=vI_OEVis5o+_IwMIRrpQyT_Sq~ZU%oY7c5JMIADzpD!Upz9h@iWg_>>~j zOLS;wp^i$-E?4<_cp?RiS%Rd?i;f*mOz=~(&3lo<=@(nR!_Rqiprh@weZlL!t#NCc zO!QTcInq|%#>OVgobj{~ixEUec`E25zJ~*DofsQdzIa@5^nOXj2T;8O`l--(QyU^$t?TGY^7#&FQ+2SS3B#qK*k3`ye?8jUYSajE5iBbJls75CCc(m3dk{t?- zopcER9{Z?TC)mk~gpi^kbbu>b-+a{m#8-y2^p$ka4n60w;Sc2}HMf<8JUvhCL0B&Btk)T`ctE$*qNW8L$`7!r^9T+>=<=2qaq-;ll2{`{Rg zc5a0ZUI$oG&j-qVOuKa=*v4aY#IsoM+1|c4Z)<}lEDvy;5huB@1RJPquU2U*U-;gu z=En2m+qjBzR#DEJDO`WU)hdd{Vj%^0V*KoyZ|5lzV87&g_j~NCjwv0uQVqXOb*QrQ zy|Qn`hxx(58c70$E;L(X0uZZ72M1!6oeg)(cdKO ze0gDaTz+ohR-#d)NbAH4x{I(21yjwvBQfmpLu$)|m{XolbgF!pmsqJ#D}(ylp6uC> z{bqtcI#hT#HW=wl7>p!38sKsJ`r8}lt-q%Keqy%u(xk=yiIJiUw6|5IvkS+#?JTBl z8H5(Q?l#wzazujH!8o>1xtn8#_w+397*_cy8!pQGP%K(Ga3pAjsaTbbXJlQF_+m+-UpUUent@xM zg%jqLUExj~o^vQ3Gl*>wh=_gOr2*|U64_iXb+-111aH}$TjeajM+I20xw(((>fej-@CIz4S1pi$(#}P7`4({6QS2CaQS4NPENDp>sAqD z$bH4KGzXGffkJ7R>V>)>tC)uax{UsN*dbeNC*v}#8Y#OWYwL4t$ePR?VTyIs!wea+ z5Urmc)X|^`MG~*dS6pGSbU+gPJoq*^a=_>$n4|P^w$sMBBy@f*Z^Jg6?n5?oId6f{ z$LW4M|4m502z0t7g<#Bx%X;9<=)smFolV&(V^(7Cv2-sxbxopQ!)*#ZRhTBpx1)Fc zNm1T%bONzv6@#|dz(w02AH8OXe>kQ#1FMCzO}2J_mST)+ExmBr9cva-@?;wnmWMOk z{3_~EX_xadgJGv&H@zK_8{(x84`}+c?oSBX*Ge3VdfTt&F}yCpFP?CpW+BE^cWY0^ zb&uBN!Ja3UzYHK-CTyA5=L zEMW{l3Usky#ly=7px648W31UNV@K)&Ub&zP1c7%)`{);I4b0Q<)B}3;NMG2JH=X$U zfIW4)4n9ZM`-yRj67I)YSLDK)qfUJ_ij}a#aZN~9EXrh8eZY2&=uY%2N0UFF7<~%M zsB8=erOWZ>Ct_#^tHZ|*q`H;A)5;ycw*IcmVxi8_0Xk}aJA^ath+E;xg!x+As(M#0=)3!NJR6H&9+zd#iP(m0PIW8$ z1Y^VX`>jm`W!=WpF*{ioM?C9`yOR>@0q=u7o>BP-eSHqCgMDj!2anwH?s%i2p+Q7D zzszIf5XJpE)IG4;d_(La-xenmF(tgAxK`Y4sQ}BSJEPs6N_U2vI{8=0C_F?@7<(G; zo$~G=8p+076G;`}>{MQ>t>7cm=zGtfbdDXm6||jUU|?X?CaE?(<6bKDYKeHlz}DA8 zXT={X=yp_R;HfJ9h%?eWvQ!dRgz&Su*JfNt!Wu>|XfU&68iRikRrHRW|ZxzRR^`eIGt zIeiDgVS>IeExKVRWW8-=A=yA`}`)ZkWBrZD`hpWIxBGkh&f#ijr449~m`j6{4jiJ*C!oVA8ZC?$1RM#K(_b zL9TW)kN*Y4%^-qPpMP7d4)o?Nk#>aoYHT(*g)qmRUb?**F@pnNiy6Fv9rEiUqD(^O zzyS?nBrX63BTRYduaG(0VVG2yJRe%o&rVrLjbxTaAFTd8s;<<@Qs>u(<193R8>}2_ zuwp{7;H2a*X7_jryzriZXMg?bTuegABb^87@SsKkr2)0Gyiax8KQWstw^v#ix45EVrcEhr>!NMhprl$InQMzjSFH54x5k9qHc`@9uKQzvL4ihcq{^B zPrVR=o_ic%Y>6&rMN)hTZsI7I<3&`#(nl+3y3ys9A~&^=4?PL&nd8)`OfG#n zwAMN$1&>K++c{^|7<4P=2y(B{jJsQ0a#U;HTo4ZmWZYvI{+s;Td{Yzem%0*k#)vjpB zia;J&>}ICate44SFYY3vEelqStQWFihx%^vQ@Do(sOy7yR2@WNv7Y9I^yL=nZr3mb zXKV5t@=?-Sk|b{XMhA7ZGB@2hqsx}4xwCW!in#C zI@}scZlr3-NFJ@NFaJlhyfcw{k^vvtGl`N9xSo**rDW4S}i zM9{fMPWo%4wYDG~BZ18BD+}h|GQKc-g^{++3MY>}W_uq7jGHx{mwE9fZiPCoxN$+7 zrODGGJrOkcPQUB(FD5aoS4g~7#6NR^ma7-!>mHuJfY5kTe6PpNNKC9GGRiu^L31uG z$7v`*JknQHsYB!Tm_W{a32TM099djW%5e+j0Ve_ct}IM>XLF1Ap+YvcrLV=|CKo6S zb+9Nl3_YdKP6%Cxy@6TxZ>;4&nTneadr z_ES90ydCev)LV!dN=#(*f}|ZORFdvkYBni^aLbUk>BajeWIOcmHP#8S)*2U~QKI%S zyrLmtPqb&TphJ;>yAxri#;{uyk`JJqODDw%(Z=2`1uc}br^V%>j!gS)D*q*f_-qf8&D;W1dJgQMlaH5er zN2U<%Smb7==vE}dDI8K7cKz!vs^73o9f>2sgiTzWcwY|BMYHH5%Vn7#kiw&eItCqa zIkR2~Q}>X=Ar8W|^Ms41Fm8o6IB2_j60eOeBB1Br!boW7JnoeX6Gs)?7rW0^5psc- zjS16yb>dFn>KPOF;imD}e!enuIniFzv}n$m2#gCCv4jM#ArwlzZ$7@9&XkFxZ4n!V zj3dyiwW4Ki2QG{@i>yuZXQizw_OkZI^-3otXC{!(lUpJF33gI60ak;Uqitp74|B6I zgg{b=Iz}WkhCGj1M=hu4#Aw173YxIVbISaoc z-nLZC*6Tgivd5V`K%GxhBsp@SUU60-rfc$=wb>zdJzXS&-5(NRRodFk;Kxk!S(O(a0e7oY=E( zAyS;Ow?6Q&XA+cnkCb{28_1N8H#?J!*$MmIwLq^*T_9-z^&UE@A(z9oGYtFy6EZef LrJugUA?W`A8`#=m diff --git a/frontend/webapp/public/next.svg b/frontend/webapp/public/next.svg deleted file mode 100644 index 5174b28c5..000000000 --- a/frontend/webapp/public/next.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/webapp/public/vercel.svg b/frontend/webapp/public/vercel.svg deleted file mode 100644 index d2f842227..000000000 --- a/frontend/webapp/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From beb029fa1b6e188c3789baa232645fd49525ed23 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 16:45:47 +0300 Subject: [PATCH 057/374] WIP --- frontend/webapp/containers/overview/overview/overview.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/webapp/containers/overview/overview/overview.tsx b/frontend/webapp/containers/overview/overview/overview.tsx index 4be89af7f..04a979706 100644 --- a/frontend/webapp/containers/overview/overview/overview.tsx +++ b/frontend/webapp/containers/overview/overview/overview.tsx @@ -47,7 +47,9 @@ export function OverviewContainer() { containerHeight, destinations, "destination", - DESTINATION_NODE_HEIGHT, + destinations?.length > 1 + ? DESTINATION_NODE_HEIGHT + : NAMESPACE_NODE_HEIGHT, DESTINATION_NODE_POSITION ), [destinations, containerHeight] From 4c2847220a06aabfc0410105af75160631640742 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 16:52:40 +0300 Subject: [PATCH 058/374] move page logic to container --- .../destinations/create/[id]/page.tsx | 112 +----------------- .../destination/new.destination.form.tsx | 111 +++++++++++++++++ frontend/webapp/containers/overview/index.tsx | 1 + 3 files changed, 116 insertions(+), 108 deletions(-) create mode 100644 frontend/webapp/containers/overview/destination/new.destination.form.tsx diff --git a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx index f4082de12..3f30557fc 100644 --- a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx +++ b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx @@ -1,111 +1,7 @@ "use client"; -import React, { useEffect } from "react"; -import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; -import { useMutation, useQuery } from "react-query"; -import { - getDestination, - getDestinationsTypes, - setDestination, -} from "@/services"; -import { ManageDestination, OverviewHeader } from "@/components/overview"; -import { useNotification, useSectionData } from "@/hooks"; -import { useRouter, useSearchParams } from "next/navigation"; -import { styled } from "styled-components"; +import React from "react"; +import { NewDestinationForm } from "@/containers/overview"; -const DEST = "dest"; - -const NewDestinationContainer = styled.div` - padding: 20px 36px; -`; - -export default function NewDestinationFlow() { - const { sectionData, setSectionData } = useSectionData(null); - const { show, Notification } = useNotification(); - const { mutate } = useMutation((body) => setDestination(body)); - const searchParams = useSearchParams(); - const router = useRouter(); - - const { data: destinationType } = useQuery( - [QUERIES.API_DESTINATION_TYPE, sectionData?.type], - () => getDestination(sectionData?.type), - { - enabled: !!sectionData, - } - ); - - const { data: destinationsList } = useQuery( - [QUERIES.API_DESTINATION_TYPES], - getDestinationsTypes - ); - - useEffect(onPageLoad, [destinationsList]); - - function onPageLoad() { - const search = searchParams.get(DEST); - if (!destinationsList || !search) return; - - let currentData = null; - - for (const category of destinationsList.categories) { - if (currentData) { - break; - } - const filterItem = category.items.filter(({ type }) => type === search); - if (filterItem.length) { - currentData = filterItem[0]; - } - } - - setSectionData(currentData); - } - - function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { - show({ - type: NOTIFICATION.SUCCESS, - message, - }); - } - - function onError({ response }) { - const message = response?.data?.message; - show({ - type: NOTIFICATION.ERROR, - message, - }); - } - - function onSubmit(newDestination) { - const destination = { - ...newDestination, - type: sectionData.type, - }; - - mutate(destination, { - onSuccess: () => onSuccess(OVERVIEW.DESTINATION_CREATED_SUCCESS), - onError, - }); - } - - function handleBackPress() { - router.back(); - } - - return ( - <> - - {destinationType && sectionData && ( - - - - )} - - - ); +export default function CreateNewDestinationPage() { + return ; } diff --git a/frontend/webapp/containers/overview/destination/new.destination.form.tsx b/frontend/webapp/containers/overview/destination/new.destination.form.tsx new file mode 100644 index 000000000..c88928126 --- /dev/null +++ b/frontend/webapp/containers/overview/destination/new.destination.form.tsx @@ -0,0 +1,111 @@ +"use client"; +import React, { useEffect } from "react"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { useMutation, useQuery } from "react-query"; +import { + getDestination, + getDestinationsTypes, + setDestination, +} from "@/services"; +import { ManageDestination, OverviewHeader } from "@/components/overview"; +import { useNotification, useSectionData } from "@/hooks"; +import { useRouter, useSearchParams } from "next/navigation"; +import { styled } from "styled-components"; + +const DEST = "dest"; + +const NewDestinationContainer = styled.div` + padding: 20px 36px; +`; + +export function NewDestinationForm() { + const { sectionData, setSectionData } = useSectionData(null); + const { show, Notification } = useNotification(); + const { mutate } = useMutation((body) => setDestination(body)); + const searchParams = useSearchParams(); + const router = useRouter(); + + const { data: destinationType } = useQuery( + [QUERIES.API_DESTINATION_TYPE, sectionData?.type], + () => getDestination(sectionData?.type), + { + enabled: !!sectionData, + } + ); + + const { data: destinationsList } = useQuery( + [QUERIES.API_DESTINATION_TYPES], + getDestinationsTypes + ); + + useEffect(onPageLoad, [destinationsList]); + + function onPageLoad() { + const search = searchParams.get(DEST); + if (!destinationsList || !search) return; + + let currentData = null; + + for (const category of destinationsList.categories) { + if (currentData) { + break; + } + const filterItem = category.items.filter(({ type }) => type === search); + if (filterItem.length) { + currentData = filterItem[0]; + } + } + + setSectionData(currentData); + } + + function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { + show({ + type: NOTIFICATION.SUCCESS, + message, + }); + } + + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + + function onSubmit(newDestination) { + const destination = { + ...newDestination, + type: sectionData.type, + }; + + mutate(destination, { + onSuccess: () => onSuccess(OVERVIEW.DESTINATION_CREATED_SUCCESS), + onError, + }); + } + + function handleBackPress() { + router.back(); + } + + return ( + <> + + {destinationType && sectionData && ( + + + + )} + + + ); +} diff --git a/frontend/webapp/containers/overview/index.tsx b/frontend/webapp/containers/overview/index.tsx index e7895d4e4..15c133c5d 100644 --- a/frontend/webapp/containers/overview/index.tsx +++ b/frontend/webapp/containers/overview/index.tsx @@ -2,3 +2,4 @@ export { OverviewContainer } from "./overview/overview"; export { DestinationContainer } from "./destination/destination"; export { SourcesContainer } from "./sources/sources"; export { NewDestinationFlow } from "./destination/new.destination.flow"; +export { NewDestinationForm } from "./destination/new.destination.form"; From 5eb73615dcb46fe09d0bf881e695db1fdc31cb7e Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 16:59:19 +0300 Subject: [PATCH 059/374] move page logic to container --- .../destinations/create/[id]/page.tsx | 2 - .../app/overview/destinations/create/page.tsx | 2 - .../app/overview/destinations/manage/page.tsx | 66 +------------------ .../destination/update.destination.flow.tsx | 60 ++++++++++++++--- frontend/webapp/containers/overview/index.tsx | 1 + 5 files changed, 54 insertions(+), 77 deletions(-) diff --git a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx index 3f30557fc..0a4722ee6 100644 --- a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx +++ b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx @@ -1,5 +1,3 @@ -"use client"; -import React from "react"; import { NewDestinationForm } from "@/containers/overview"; export default function CreateNewDestinationPage() { diff --git a/frontend/webapp/app/overview/destinations/create/page.tsx b/frontend/webapp/app/overview/destinations/create/page.tsx index 3b9a92b41..3ec5946ca 100644 --- a/frontend/webapp/app/overview/destinations/create/page.tsx +++ b/frontend/webapp/app/overview/destinations/create/page.tsx @@ -1,5 +1,3 @@ -"use client"; -import React from "react"; import { NewDestinationFlow } from "@/containers/overview"; export default function CreateDestinationPage() { diff --git a/frontend/webapp/app/overview/destinations/manage/page.tsx b/frontend/webapp/app/overview/destinations/manage/page.tsx index cd92c828f..ebe6d6220 100644 --- a/frontend/webapp/app/overview/destinations/manage/page.tsx +++ b/frontend/webapp/app/overview/destinations/manage/page.tsx @@ -1,67 +1,5 @@ -"use client"; -import React, { useEffect, useState } from "react"; -import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; -import { useNotification } from "@/hooks"; -import { useSearchParams } from "next/navigation"; -import UpdateDestinationFlow from "@/containers/overview/destination/update.destination.flow"; -import { getDestinations } from "@/services"; -import { useQuery } from "react-query"; -import { KeyvalLoader } from "@/design.system"; - -const DEST = "dest"; +import { UpdateDestinationFlow } from "@/containers/overview"; export default function ManageDestinationPage() { - const [selectedDestination, setSelectedDestination] = useState(null); - const { show, Notification } = useNotification(); - - const { - isLoading: destinationLoading, - data: destinationList, - refetch, - } = useQuery([QUERIES.API_DESTINATIONS], getDestinations); - - const searchParams = useSearchParams(); - - useEffect(onPageLoad, [searchParams, destinationList]); - - function onPageLoad() { - const search = searchParams.get(DEST); - const currentDestination = destinationList?.filter( - ({ id }) => id === search - ); - if (currentDestination?.length) { - setSelectedDestination(currentDestination[0]); - } - } - - function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { - refetch(); - show({ - type: NOTIFICATION.SUCCESS, - message, - }); - } - - function onError({ response }) { - const message = response?.data?.message; - show({ - type: NOTIFICATION.ERROR, - message, - }); - } - - if (destinationLoading || !selectedDestination) { - return ; - } - - return ( - <> - - - - ); + return ; } diff --git a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx b/frontend/webapp/containers/overview/destination/update.destination.flow.tsx index d95fe7ac4..cc06ab91b 100644 --- a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/update.destination.flow.tsx @@ -1,20 +1,22 @@ "use client"; -import React, { useMemo } from "react"; +import React, { useEffect, useMemo, useState } from "react"; import { KeyvalLoader } from "@/design.system"; -import { OVERVIEW, QUERIES } from "@/utils/constants"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; import { useMutation, useQuery } from "react-query"; import { getDestination, updateDestination } from "@/services"; import { ManageDestination } from "@/components/overview"; -import { deleteDestination } from "@/services/destinations"; +import { deleteDestination, getDestinations } from "@/services/destinations"; import { ManageDestinationWrapper } from "./destination.styled"; -import { useRouter } from "next/navigation"; +import { useRouter, useSearchParams } from "next/navigation"; +import { useNotification } from "@/hooks"; +const DEST = "dest"; + +export function UpdateDestinationFlow({}) { + const [selectedDestination, setSelectedDestination] = useState(null); -export default function UpdateDestinationFlow({ - selectedDestination, - onSuccess, - onError, -}) { const router = useRouter(); + const searchParams = useSearchParams(); + const { show, Notification } = useNotification(); const manageData = useMemo(() => { return { @@ -22,6 +24,7 @@ export default function UpdateDestinationFlow({ ...selectedDestination?.destination_type, }; }, [selectedDestination]); + const { isLoading: destinationTypeLoading, data: destinationType } = useQuery( [QUERIES.API_DESTINATION_TYPE, selectedDestination?.type], () => getDestination(selectedDestination?.type), @@ -30,6 +33,12 @@ export default function UpdateDestinationFlow({ } ); + const { + isLoading: destinationLoading, + data: destinationList, + refetch, + } = useQuery([QUERIES.API_DESTINATIONS], getDestinations); + const { mutate: handleUpdateDestination } = useMutation((body) => updateDestination(body, selectedDestination?.id) ); @@ -38,6 +47,8 @@ export default function UpdateDestinationFlow({ deleteDestination(selectedDestination?.id) ); + useEffect(onPageLoad, [searchParams, destinationList]); + function onDelete() { handleDeleteDestination(selectedDestination.id, { onSuccess: () => onSuccess(OVERVIEW.DESTINATION_DELETED_SUCCESS), @@ -57,6 +68,36 @@ export default function UpdateDestinationFlow({ }); } + function onPageLoad() { + const search = searchParams.get(DEST); + const currentDestination = destinationList?.filter( + ({ id }) => id === search + ); + if (currentDestination?.length) { + setSelectedDestination(currentDestination[0]); + } + } + + function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { + refetch(); + show({ + type: NOTIFICATION.SUCCESS, + message, + }); + } + + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + + if (destinationLoading || !selectedDestination) { + return ; + } + return destinationTypeLoading ? ( ) : ( @@ -68,6 +109,7 @@ export default function UpdateDestinationFlow({ onSubmit={onSubmit} onDelete={onDelete} /> + ); } diff --git a/frontend/webapp/containers/overview/index.tsx b/frontend/webapp/containers/overview/index.tsx index 15c133c5d..dc0b77e01 100644 --- a/frontend/webapp/containers/overview/index.tsx +++ b/frontend/webapp/containers/overview/index.tsx @@ -3,3 +3,4 @@ export { DestinationContainer } from "./destination/destination"; export { SourcesContainer } from "./sources/sources"; export { NewDestinationFlow } from "./destination/new.destination.flow"; export { NewDestinationForm } from "./destination/new.destination.form"; +export { UpdateDestinationFlow } from "./destination/update.destination.flow"; From 5fe763a44a6f506eeb8107e1e5d417a7f826b074 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 17:00:39 +0300 Subject: [PATCH 060/374] WIP --- frontend/webapp/app/overview/destinations/page.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/webapp/app/overview/destinations/page.tsx b/frontend/webapp/app/overview/destinations/page.tsx index bb83b2d78..09f95a0aa 100644 --- a/frontend/webapp/app/overview/destinations/page.tsx +++ b/frontend/webapp/app/overview/destinations/page.tsx @@ -1,6 +1,5 @@ "use client"; import { DestinationContainer } from "@/containers/overview"; -import React from "react"; import { styled } from "styled-components"; const DestinationContainerWrapper = styled.div` From bfb54d8888c7b9ee314e41527a620f6c0392e920 Mon Sep 17 00:00:00 2001 From: Alon Braymok <138359965+alonkeyval@users.noreply.github.com> Date: Thu, 3 Aug 2023 17:46:21 +0300 Subject: [PATCH 061/374] Task 168 refactor (#370) --- .../destinations/create/[id]/page.tsx | 112 +----------------- .../app/overview/destinations/create/page.tsx | 2 - .../app/overview/destinations/manage/page.tsx | 66 +---------- .../webapp/app/overview/destinations/page.tsx | 1 - frontend/webapp/app/overview/layout.tsx | 7 +- frontend/webapp/app/setup/layout.tsx | 8 ++ .../destination/new.destination.form.tsx | 111 +++++++++++++++++ .../destination/update.destination.flow.tsx | 60 ++++++++-- frontend/webapp/containers/overview/index.tsx | 3 + .../containers/overview/overview/overview.tsx | 4 +- frontend/webapp/public/favicon.ico | Bin 25931 -> 0 bytes frontend/webapp/public/next.svg | 1 - frontend/webapp/public/vercel.svg | 1 - frontend/webapp/utils/constants/config.tsx | 5 + frontend/webapp/utils/constants/index.tsx | 2 +- 15 files changed, 190 insertions(+), 193 deletions(-) create mode 100644 frontend/webapp/app/setup/layout.tsx create mode 100644 frontend/webapp/containers/overview/destination/new.destination.form.tsx delete mode 100644 frontend/webapp/public/favicon.ico delete mode 100644 frontend/webapp/public/next.svg delete mode 100644 frontend/webapp/public/vercel.svg diff --git a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx index f4082de12..0a4722ee6 100644 --- a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx +++ b/frontend/webapp/app/overview/destinations/create/[id]/page.tsx @@ -1,111 +1,5 @@ -"use client"; -import React, { useEffect } from "react"; -import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; -import { useMutation, useQuery } from "react-query"; -import { - getDestination, - getDestinationsTypes, - setDestination, -} from "@/services"; -import { ManageDestination, OverviewHeader } from "@/components/overview"; -import { useNotification, useSectionData } from "@/hooks"; -import { useRouter, useSearchParams } from "next/navigation"; -import { styled } from "styled-components"; +import { NewDestinationForm } from "@/containers/overview"; -const DEST = "dest"; - -const NewDestinationContainer = styled.div` - padding: 20px 36px; -`; - -export default function NewDestinationFlow() { - const { sectionData, setSectionData } = useSectionData(null); - const { show, Notification } = useNotification(); - const { mutate } = useMutation((body) => setDestination(body)); - const searchParams = useSearchParams(); - const router = useRouter(); - - const { data: destinationType } = useQuery( - [QUERIES.API_DESTINATION_TYPE, sectionData?.type], - () => getDestination(sectionData?.type), - { - enabled: !!sectionData, - } - ); - - const { data: destinationsList } = useQuery( - [QUERIES.API_DESTINATION_TYPES], - getDestinationsTypes - ); - - useEffect(onPageLoad, [destinationsList]); - - function onPageLoad() { - const search = searchParams.get(DEST); - if (!destinationsList || !search) return; - - let currentData = null; - - for (const category of destinationsList.categories) { - if (currentData) { - break; - } - const filterItem = category.items.filter(({ type }) => type === search); - if (filterItem.length) { - currentData = filterItem[0]; - } - } - - setSectionData(currentData); - } - - function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { - show({ - type: NOTIFICATION.SUCCESS, - message, - }); - } - - function onError({ response }) { - const message = response?.data?.message; - show({ - type: NOTIFICATION.ERROR, - message, - }); - } - - function onSubmit(newDestination) { - const destination = { - ...newDestination, - type: sectionData.type, - }; - - mutate(destination, { - onSuccess: () => onSuccess(OVERVIEW.DESTINATION_CREATED_SUCCESS), - onError, - }); - } - - function handleBackPress() { - router.back(); - } - - return ( - <> - - {destinationType && sectionData && ( - - - - )} - - - ); +export default function CreateNewDestinationPage() { + return ; } diff --git a/frontend/webapp/app/overview/destinations/create/page.tsx b/frontend/webapp/app/overview/destinations/create/page.tsx index 3b9a92b41..3ec5946ca 100644 --- a/frontend/webapp/app/overview/destinations/create/page.tsx +++ b/frontend/webapp/app/overview/destinations/create/page.tsx @@ -1,5 +1,3 @@ -"use client"; -import React from "react"; import { NewDestinationFlow } from "@/containers/overview"; export default function CreateDestinationPage() { diff --git a/frontend/webapp/app/overview/destinations/manage/page.tsx b/frontend/webapp/app/overview/destinations/manage/page.tsx index cd92c828f..ebe6d6220 100644 --- a/frontend/webapp/app/overview/destinations/manage/page.tsx +++ b/frontend/webapp/app/overview/destinations/manage/page.tsx @@ -1,67 +1,5 @@ -"use client"; -import React, { useEffect, useState } from "react"; -import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; -import { useNotification } from "@/hooks"; -import { useSearchParams } from "next/navigation"; -import UpdateDestinationFlow from "@/containers/overview/destination/update.destination.flow"; -import { getDestinations } from "@/services"; -import { useQuery } from "react-query"; -import { KeyvalLoader } from "@/design.system"; - -const DEST = "dest"; +import { UpdateDestinationFlow } from "@/containers/overview"; export default function ManageDestinationPage() { - const [selectedDestination, setSelectedDestination] = useState(null); - const { show, Notification } = useNotification(); - - const { - isLoading: destinationLoading, - data: destinationList, - refetch, - } = useQuery([QUERIES.API_DESTINATIONS], getDestinations); - - const searchParams = useSearchParams(); - - useEffect(onPageLoad, [searchParams, destinationList]); - - function onPageLoad() { - const search = searchParams.get(DEST); - const currentDestination = destinationList?.filter( - ({ id }) => id === search - ); - if (currentDestination?.length) { - setSelectedDestination(currentDestination[0]); - } - } - - function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { - refetch(); - show({ - type: NOTIFICATION.SUCCESS, - message, - }); - } - - function onError({ response }) { - const message = response?.data?.message; - show({ - type: NOTIFICATION.ERROR, - message, - }); - } - - if (destinationLoading || !selectedDestination) { - return ; - } - - return ( - <> - - - - ); + return ; } diff --git a/frontend/webapp/app/overview/destinations/page.tsx b/frontend/webapp/app/overview/destinations/page.tsx index bb83b2d78..09f95a0aa 100644 --- a/frontend/webapp/app/overview/destinations/page.tsx +++ b/frontend/webapp/app/overview/destinations/page.tsx @@ -1,6 +1,5 @@ "use client"; import { DestinationContainer } from "@/containers/overview"; -import React from "react"; import { styled } from "styled-components"; const DestinationContainerWrapper = styled.div` diff --git a/frontend/webapp/app/overview/layout.tsx b/frontend/webapp/app/overview/layout.tsx index 2159907df..64ff4dd3b 100644 --- a/frontend/webapp/app/overview/layout.tsx +++ b/frontend/webapp/app/overview/layout.tsx @@ -1,6 +1,6 @@ -// "use client"; import { Menu } from "@/components/side.menu"; import theme from "@/styles/palette"; +import { METADATA } from "@/utils/constants"; import { Metadata } from "next"; import React from "react"; @@ -15,9 +15,8 @@ const CHILDREN_STYLE = { width: "100%", height: "93%", }; -export const metadata: Metadata = { - title: "Odigos", -}; + +export const metadata: Metadata = METADATA; export default function Layout({ children }: { children: React.ReactNode }) { return ( diff --git a/frontend/webapp/app/setup/layout.tsx b/frontend/webapp/app/setup/layout.tsx new file mode 100644 index 000000000..a4ee950c2 --- /dev/null +++ b/frontend/webapp/app/setup/layout.tsx @@ -0,0 +1,8 @@ +import { METADATA } from "@/utils/constants"; +import { Metadata } from "next"; + +export const metadata: Metadata = METADATA; + +export default function Layout({ children }: { children: React.ReactNode }) { + return
{children}
; +} diff --git a/frontend/webapp/containers/overview/destination/new.destination.form.tsx b/frontend/webapp/containers/overview/destination/new.destination.form.tsx new file mode 100644 index 000000000..c88928126 --- /dev/null +++ b/frontend/webapp/containers/overview/destination/new.destination.form.tsx @@ -0,0 +1,111 @@ +"use client"; +import React, { useEffect } from "react"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { useMutation, useQuery } from "react-query"; +import { + getDestination, + getDestinationsTypes, + setDestination, +} from "@/services"; +import { ManageDestination, OverviewHeader } from "@/components/overview"; +import { useNotification, useSectionData } from "@/hooks"; +import { useRouter, useSearchParams } from "next/navigation"; +import { styled } from "styled-components"; + +const DEST = "dest"; + +const NewDestinationContainer = styled.div` + padding: 20px 36px; +`; + +export function NewDestinationForm() { + const { sectionData, setSectionData } = useSectionData(null); + const { show, Notification } = useNotification(); + const { mutate } = useMutation((body) => setDestination(body)); + const searchParams = useSearchParams(); + const router = useRouter(); + + const { data: destinationType } = useQuery( + [QUERIES.API_DESTINATION_TYPE, sectionData?.type], + () => getDestination(sectionData?.type), + { + enabled: !!sectionData, + } + ); + + const { data: destinationsList } = useQuery( + [QUERIES.API_DESTINATION_TYPES], + getDestinationsTypes + ); + + useEffect(onPageLoad, [destinationsList]); + + function onPageLoad() { + const search = searchParams.get(DEST); + if (!destinationsList || !search) return; + + let currentData = null; + + for (const category of destinationsList.categories) { + if (currentData) { + break; + } + const filterItem = category.items.filter(({ type }) => type === search); + if (filterItem.length) { + currentData = filterItem[0]; + } + } + + setSectionData(currentData); + } + + function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { + show({ + type: NOTIFICATION.SUCCESS, + message, + }); + } + + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + + function onSubmit(newDestination) { + const destination = { + ...newDestination, + type: sectionData.type, + }; + + mutate(destination, { + onSuccess: () => onSuccess(OVERVIEW.DESTINATION_CREATED_SUCCESS), + onError, + }); + } + + function handleBackPress() { + router.back(); + } + + return ( + <> + + {destinationType && sectionData && ( + + + + )} + + + ); +} diff --git a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx b/frontend/webapp/containers/overview/destination/update.destination.flow.tsx index d95fe7ac4..66259fe3e 100644 --- a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/update.destination.flow.tsx @@ -1,20 +1,22 @@ "use client"; -import React, { useMemo } from "react"; +import React, { useEffect, useMemo, useState } from "react"; import { KeyvalLoader } from "@/design.system"; -import { OVERVIEW, QUERIES } from "@/utils/constants"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; import { useMutation, useQuery } from "react-query"; import { getDestination, updateDestination } from "@/services"; import { ManageDestination } from "@/components/overview"; -import { deleteDestination } from "@/services/destinations"; +import { deleteDestination, getDestinations } from "@/services/destinations"; import { ManageDestinationWrapper } from "./destination.styled"; -import { useRouter } from "next/navigation"; +import { useRouter, useSearchParams } from "next/navigation"; +import { useNotification } from "@/hooks"; +const DEST = "dest"; + +export function UpdateDestinationFlow() { + const [selectedDestination, setSelectedDestination] = useState(null); -export default function UpdateDestinationFlow({ - selectedDestination, - onSuccess, - onError, -}) { const router = useRouter(); + const searchParams = useSearchParams(); + const { show, Notification } = useNotification(); const manageData = useMemo(() => { return { @@ -22,6 +24,7 @@ export default function UpdateDestinationFlow({ ...selectedDestination?.destination_type, }; }, [selectedDestination]); + const { isLoading: destinationTypeLoading, data: destinationType } = useQuery( [QUERIES.API_DESTINATION_TYPE, selectedDestination?.type], () => getDestination(selectedDestination?.type), @@ -30,6 +33,12 @@ export default function UpdateDestinationFlow({ } ); + const { + isLoading: destinationLoading, + data: destinationList, + refetch, + } = useQuery([QUERIES.API_DESTINATIONS], getDestinations); + const { mutate: handleUpdateDestination } = useMutation((body) => updateDestination(body, selectedDestination?.id) ); @@ -38,6 +47,8 @@ export default function UpdateDestinationFlow({ deleteDestination(selectedDestination?.id) ); + useEffect(onPageLoad, [searchParams, destinationList]); + function onDelete() { handleDeleteDestination(selectedDestination.id, { onSuccess: () => onSuccess(OVERVIEW.DESTINATION_DELETED_SUCCESS), @@ -57,6 +68,36 @@ export default function UpdateDestinationFlow({ }); } + function onPageLoad() { + const search = searchParams.get(DEST); + const currentDestination = destinationList?.filter( + ({ id }) => id === search + ); + if (currentDestination?.length) { + setSelectedDestination(currentDestination[0]); + } + } + + function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { + refetch(); + show({ + type: NOTIFICATION.SUCCESS, + message, + }); + } + + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + + if (destinationLoading || !selectedDestination) { + return ; + } + return destinationTypeLoading ? ( ) : ( @@ -68,6 +109,7 @@ export default function UpdateDestinationFlow({ onSubmit={onSubmit} onDelete={onDelete} /> + ); } diff --git a/frontend/webapp/containers/overview/index.tsx b/frontend/webapp/containers/overview/index.tsx index e7895d4e4..9c57b45c8 100644 --- a/frontend/webapp/containers/overview/index.tsx +++ b/frontend/webapp/containers/overview/index.tsx @@ -2,3 +2,6 @@ export { OverviewContainer } from "./overview/overview"; export { DestinationContainer } from "./destination/destination"; export { SourcesContainer } from "./sources/sources"; export { NewDestinationFlow } from "./destination/new.destination.flow"; +export { NewDestinationForm } from "./destination/new.destination.form"; +export { UpdateDestinationFlow } from "./destination/update.destination.flow"; + diff --git a/frontend/webapp/containers/overview/overview/overview.tsx b/frontend/webapp/containers/overview/overview/overview.tsx index 4be89af7f..04a979706 100644 --- a/frontend/webapp/containers/overview/overview/overview.tsx +++ b/frontend/webapp/containers/overview/overview/overview.tsx @@ -47,7 +47,9 @@ export function OverviewContainer() { containerHeight, destinations, "destination", - DESTINATION_NODE_HEIGHT, + destinations?.length > 1 + ? DESTINATION_NODE_HEIGHT + : NAMESPACE_NODE_HEIGHT, DESTINATION_NODE_POSITION ), [destinations, containerHeight] diff --git a/frontend/webapp/public/favicon.ico b/frontend/webapp/public/favicon.ico deleted file mode 100644 index 718d6fea4835ec2d246af9800eddb7ffb276240c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25931 zcmeHv30#a{`}aL_*G&7qml|y<+KVaDM2m#dVr!KsA!#An?kSQM(q<_dDNCpjEux83 zLb9Z^XxbDl(w>%i@8hT6>)&Gu{h#Oeyszu?xtw#Zb1mO{pgX9699l+Qppw7jXaYf~-84xW z)w4x8?=youko|}Vr~(D$UXIbiXABHh`p1?nn8Po~fxRJv}|0e(BPs|G`(TT%kKVJAdg5*Z|x0leQq0 zkdUBvb#>9F()jo|T~kx@OM8$9wzs~t2l;K=woNssA3l6|sx2r3+kdfVW@e^8e*E}v zA1y5{bRi+3Z`uD3{F7LgFJDdvm;nJilkzDku>BwXH(8ItVCXk*-lSJnR?-2UN%hJ){&rlvg`CDTj z)Bzo!3v7Ou#83zEDEFcKt(f1E0~=rqeEbTnMvWR#{+9pg%7G8y>u1OVRUSoox-ovF z2Ydma(;=YuBY(eI|04{hXzZD6_f(v~H;C~y5=DhAC{MMS>2fm~1H_t2$56pc$NH8( z5bH|<)71dV-_oCHIrzrT`2s-5w_+2CM0$95I6X8p^r!gHp+j_gd;9O<1~CEQQGS8) zS9Qh3#p&JM-G8rHekNmKVewU;pJRcTAog68KYo^dRo}(M>36U4Us zfgYWSiHZL3;lpWT=zNAW>Dh#mB!_@Lg%$ms8N-;aPqMn+C2HqZgz&9~Eu z4|Kp<`$q)Uw1R?y(~S>ePdonHxpV1#eSP1B;Ogo+-Pk}6#0GsZZ5!||ev2MGdh}_m z{DeR7?0-1^zVs&`AV6Vt;r3`I`OI_wgs*w=eO%_#7Kepl{B@xiyCANc(l zzIyd4y|c6PXWq9-|KM8(zIk8LPk(>a)zyFWjhT!$HJ$qX1vo@d25W<fvZQ2zUz5WRc(UnFMKHwe1| zWmlB1qdbiA(C0jmnV<}GfbKtmcu^2*P^O?MBLZKt|As~ge8&AAO~2K@zbXelK|4T<{|y4`raF{=72kC2Kn(L4YyenWgrPiv z@^mr$t{#X5VuIMeL!7Ab6_kG$&#&5p*Z{+?5U|TZ`B!7llpVmp@skYz&n^8QfPJzL z0G6K_OJM9x+Wu2gfN45phANGt{7=C>i34CV{Xqlx(fWpeAoj^N0Biu`w+MVcCUyU* zDZuzO0>4Z6fbu^T_arWW5n!E45vX8N=bxTVeFoep_G#VmNlQzAI_KTIc{6>c+04vr zx@W}zE5JNSU>!THJ{J=cqjz+4{L4A{Ob9$ZJ*S1?Ggg3klFp!+Y1@K+pK1DqI|_gq z5ZDXVpge8-cs!o|;K73#YXZ3AShj50wBvuq3NTOZ`M&qtjj#GOFfgExjg8Gn8>Vq5 z`85n+9|!iLCZF5$HJ$Iu($dm?8~-ofu}tEc+-pyke=3!im#6pk_Wo8IA|fJwD&~~F zc16osQ)EBo58U7XDuMexaPRjU@h8tXe%S{fA0NH3vGJFhuyyO!Uyl2^&EOpX{9As0 zWj+P>{@}jxH)8|r;2HdupP!vie{sJ28b&bo!8`D^x}TE$%zXNb^X1p@0PJ86`dZyj z%ce7*{^oo+6%&~I!8hQy-vQ7E)0t0ybH4l%KltWOo~8cO`T=157JqL(oq_rC%ea&4 z2NcTJe-HgFjNg-gZ$6!Y`SMHrlj}Etf7?r!zQTPPSv}{so2e>Fjs1{gzk~LGeesX%r(Lh6rbhSo_n)@@G-FTQy93;l#E)hgP@d_SGvyCp0~o(Y;Ee8{ zdVUDbHm5`2taPUOY^MAGOw*>=s7=Gst=D+p+2yON!0%Hk` zz5mAhyT4lS*T3LS^WSxUy86q&GnoHxzQ6vm8)VS}_zuqG?+3td68_x;etQAdu@sc6 zQJ&5|4(I?~3d-QOAODHpZ=hlSg(lBZ!JZWCtHHSj`0Wh93-Uk)_S%zsJ~aD>{`A0~ z9{AG(e|q3g5B%wYKRxiL2Y$8(4w6bzchKuloQW#e&S3n+P- z8!ds-%f;TJ1>)v)##>gd{PdS2Oc3VaR`fr=`O8QIO(6(N!A?pr5C#6fc~Ge@N%Vvu zaoAX2&(a6eWy_q&UwOhU)|P3J0Qc%OdhzW=F4D|pt0E4osw;%<%Dn58hAWD^XnZD= z>9~H(3bmLtxpF?a7su6J7M*x1By7YSUbxGi)Ot0P77`}P3{)&5Un{KD?`-e?r21!4vTTnN(4Y6Lin?UkSM z`MXCTC1@4A4~mvz%Rh2&EwY))LeoT=*`tMoqcEXI>TZU9WTP#l?uFv+@Dn~b(>xh2 z;>B?;Tz2SR&KVb>vGiBSB`@U7VIWFSo=LDSb9F{GF^DbmWAfpms8Sx9OX4CnBJca3 zlj9(x!dIjN?OG1X4l*imJNvRCk}F%!?SOfiOq5y^mZW)jFL@a|r-@d#f7 z2gmU8L3IZq0ynIws=}~m^#@&C%J6QFo~Mo4V`>v7MI-_!EBMMtb%_M&kvAaN)@ZVw z+`toz&WG#HkWDjnZE!6nk{e-oFdL^$YnbOCN}JC&{$#$O27@|Tn-skXr)2ml2~O!5 zX+gYoxhoc7qoU?C^3~&!U?kRFtnSEecWuH0B0OvLodgUAi}8p1 zrO6RSXHH}DMc$&|?D004DiOVMHV8kXCP@7NKB zgaZq^^O<7PoKEp72kby@W0Z!Y*Ay{&vfg#C&gG@YVR9g?FEocMUi1gSN$+V+ayF45{a zuDZDTN}mS|;BO%gEf}pjBfN2-gIrU#G5~cucA;dokXW89%>AyXJJI z9X4UlIWA|ZYHgbI z5?oFk@A=Ik7lrEQPDH!H+b`7_Y~aDb_qa=B2^Y&Ow41cU=4WDd40dp5(QS-WMN-=Y z9g;6_-JdNU;|6cPwf$ak*aJIcwL@1n$#l~zi{c{EW?T;DaW*E8DYq?Umtz{nJ&w-M zEMyTDrC&9K$d|kZe2#ws6)L=7K+{ zQw{XnV6UC$6-rW0emqm8wJoeZK)wJIcV?dST}Z;G0Arq{dVDu0&4kd%N!3F1*;*pW zR&qUiFzK=@44#QGw7k1`3t_d8&*kBV->O##t|tonFc2YWrL7_eqg+=+k;!F-`^b8> z#KWCE8%u4k@EprxqiV$VmmtiWxDLgnGu$Vs<8rppV5EajBXL4nyyZM$SWVm!wnCj-B!Wjqj5-5dNXukI2$$|Bu3Lrw}z65Lc=1G z^-#WuQOj$hwNGG?*CM_TO8Bg-1+qc>J7k5c51U8g?ZU5n?HYor;~JIjoWH-G>AoUP ztrWWLbRNqIjW#RT*WqZgPJXU7C)VaW5}MiijYbABmzoru6EmQ*N8cVK7a3|aOB#O& zBl8JY2WKfmj;h#Q!pN%9o@VNLv{OUL?rixHwOZuvX7{IJ{(EdPpuVFoQqIOa7giLVkBOKL@^smUA!tZ1CKRK}#SSM)iQHk)*R~?M!qkCruaS!#oIL1c z?J;U~&FfH#*98^G?i}pA{ z9Jg36t4=%6mhY(quYq*vSxptes9qy|7xSlH?G=S@>u>Ebe;|LVhs~@+06N<4CViBk zUiY$thvX;>Tby6z9Y1edAMQaiH zm^r3v#$Q#2T=X>bsY#D%s!bhs^M9PMAcHbCc0FMHV{u-dwlL;a1eJ63v5U*?Q_8JO zT#50!RD619#j_Uf))0ooADz~*9&lN!bBDRUgE>Vud-i5ck%vT=r^yD*^?Mp@Q^v+V zG#-?gKlr}Eeqifb{|So?HM&g91P8|av8hQoCmQXkd?7wIJwb z_^v8bbg`SAn{I*4bH$u(RZ6*xUhuA~hc=8czK8SHEKTzSxgbwi~9(OqJB&gwb^l4+m`k*Q;_?>Y-APi1{k zAHQ)P)G)f|AyjSgcCFps)Fh6Bca*Xznq36!pV6Az&m{O8$wGFD? zY&O*3*J0;_EqM#jh6^gMQKpXV?#1?>$ml1xvh8nSN>-?H=V;nJIwB07YX$e6vLxH( zqYwQ>qxwR(i4f)DLd)-$P>T-no_c!LsN@)8`e;W@)-Hj0>nJ-}Kla4-ZdPJzI&Mce zv)V_j;(3ERN3_@I$N<^|4Lf`B;8n+bX@bHbcZTopEmDI*Jfl)-pFDvo6svPRoo@(x z);_{lY<;);XzT`dBFpRmGrr}z5u1=pC^S-{ce6iXQlLGcItwJ^mZx{m$&DA_oEZ)B{_bYPq-HA zcH8WGoBG(aBU_j)vEy+_71T34@4dmSg!|M8Vf92Zj6WH7Q7t#OHQqWgFE3ARt+%!T z?oLovLVlnf?2c7pTc)~cc^($_8nyKwsN`RA-23ed3sdj(ys%pjjM+9JrctL;dy8a( z@en&CQmnV(()bu|Y%G1-4a(6x{aLytn$T-;(&{QIJB9vMox11U-1HpD@d(QkaJdEb zG{)+6Dos_L+O3NpWo^=gR?evp|CqEG?L&Ut#D*KLaRFOgOEK(Kq1@!EGcTfo+%A&I z=dLbB+d$u{sh?u)xP{PF8L%;YPPW53+@{>5W=Jt#wQpN;0_HYdw1{ksf_XhO4#2F= zyPx6Lx2<92L-;L5PD`zn6zwIH`Jk($?Qw({erA$^bC;q33hv!d!>%wRhj# zal^hk+WGNg;rJtb-EB(?czvOM=H7dl=vblBwAv>}%1@{}mnpUznfq1cE^sgsL0*4I zJ##!*B?=vI_OEVis5o+_IwMIRrpQyT_Sq~ZU%oY7c5JMIADzpD!Upz9h@iWg_>>~j zOLS;wp^i$-E?4<_cp?RiS%Rd?i;f*mOz=~(&3lo<=@(nR!_Rqiprh@weZlL!t#NCc zO!QTcInq|%#>OVgobj{~ixEUec`E25zJ~*DofsQdzIa@5^nOXj2T;8O`l--(QyU^$t?TGY^7#&FQ+2SS3B#qK*k3`ye?8jUYSajE5iBbJls75CCc(m3dk{t?- zopcER9{Z?TC)mk~gpi^kbbu>b-+a{m#8-y2^p$ka4n60w;Sc2}HMf<8JUvhCL0B&Btk)T`ctE$*qNW8L$`7!r^9T+>=<=2qaq-;ll2{`{Rg zc5a0ZUI$oG&j-qVOuKa=*v4aY#IsoM+1|c4Z)<}lEDvy;5huB@1RJPquU2U*U-;gu z=En2m+qjBzR#DEJDO`WU)hdd{Vj%^0V*KoyZ|5lzV87&g_j~NCjwv0uQVqXOb*QrQ zy|Qn`hxx(58c70$E;L(X0uZZ72M1!6oeg)(cdKO ze0gDaTz+ohR-#d)NbAH4x{I(21yjwvBQfmpLu$)|m{XolbgF!pmsqJ#D}(ylp6uC> z{bqtcI#hT#HW=wl7>p!38sKsJ`r8}lt-q%Keqy%u(xk=yiIJiUw6|5IvkS+#?JTBl z8H5(Q?l#wzazujH!8o>1xtn8#_w+397*_cy8!pQGP%K(Ga3pAjsaTbbXJlQF_+m+-UpUUent@xM zg%jqLUExj~o^vQ3Gl*>wh=_gOr2*|U64_iXb+-111aH}$TjeajM+I20xw(((>fej-@CIz4S1pi$(#}P7`4({6QS2CaQS4NPENDp>sAqD z$bH4KGzXGffkJ7R>V>)>tC)uax{UsN*dbeNC*v}#8Y#OWYwL4t$ePR?VTyIs!wea+ z5Urmc)X|^`MG~*dS6pGSbU+gPJoq*^a=_>$n4|P^w$sMBBy@f*Z^Jg6?n5?oId6f{ z$LW4M|4m502z0t7g<#Bx%X;9<=)smFolV&(V^(7Cv2-sxbxopQ!)*#ZRhTBpx1)Fc zNm1T%bONzv6@#|dz(w02AH8OXe>kQ#1FMCzO}2J_mST)+ExmBr9cva-@?;wnmWMOk z{3_~EX_xadgJGv&H@zK_8{(x84`}+c?oSBX*Ge3VdfTt&F}yCpFP?CpW+BE^cWY0^ zb&uBN!Ja3UzYHK-CTyA5=L zEMW{l3Usky#ly=7px648W31UNV@K)&Ub&zP1c7%)`{);I4b0Q<)B}3;NMG2JH=X$U zfIW4)4n9ZM`-yRj67I)YSLDK)qfUJ_ij}a#aZN~9EXrh8eZY2&=uY%2N0UFF7<~%M zsB8=erOWZ>Ct_#^tHZ|*q`H;A)5;ycw*IcmVxi8_0Xk}aJA^ath+E;xg!x+As(M#0=)3!NJR6H&9+zd#iP(m0PIW8$ z1Y^VX`>jm`W!=WpF*{ioM?C9`yOR>@0q=u7o>BP-eSHqCgMDj!2anwH?s%i2p+Q7D zzszIf5XJpE)IG4;d_(La-xenmF(tgAxK`Y4sQ}BSJEPs6N_U2vI{8=0C_F?@7<(G; zo$~G=8p+076G;`}>{MQ>t>7cm=zGtfbdDXm6||jUU|?X?CaE?(<6bKDYKeHlz}DA8 zXT={X=yp_R;HfJ9h%?eWvQ!dRgz&Su*JfNt!Wu>|XfU&68iRikRrHRW|ZxzRR^`eIGt zIeiDgVS>IeExKVRWW8-=A=yA`}`)ZkWBrZD`hpWIxBGkh&f#ijr449~m`j6{4jiJ*C!oVA8ZC?$1RM#K(_b zL9TW)kN*Y4%^-qPpMP7d4)o?Nk#>aoYHT(*g)qmRUb?**F@pnNiy6Fv9rEiUqD(^O zzyS?nBrX63BTRYduaG(0VVG2yJRe%o&rVrLjbxTaAFTd8s;<<@Qs>u(<193R8>}2_ zuwp{7;H2a*X7_jryzriZXMg?bTuegABb^87@SsKkr2)0Gyiax8KQWstw^v#ix45EVrcEhr>!NMhprl$InQMzjSFH54x5k9qHc`@9uKQzvL4ihcq{^B zPrVR=o_ic%Y>6&rMN)hTZsI7I<3&`#(nl+3y3ys9A~&^=4?PL&nd8)`OfG#n zwAMN$1&>K++c{^|7<4P=2y(B{jJsQ0a#U;HTo4ZmWZYvI{+s;Td{Yzem%0*k#)vjpB zia;J&>}ICate44SFYY3vEelqStQWFihx%^vQ@Do(sOy7yR2@WNv7Y9I^yL=nZr3mb zXKV5t@=?-Sk|b{XMhA7ZGB@2hqsx}4xwCW!in#C zI@}scZlr3-NFJ@NFaJlhyfcw{k^vvtGl`N9xSo**rDW4S}i zM9{fMPWo%4wYDG~BZ18BD+}h|GQKc-g^{++3MY>}W_uq7jGHx{mwE9fZiPCoxN$+7 zrODGGJrOkcPQUB(FD5aoS4g~7#6NR^ma7-!>mHuJfY5kTe6PpNNKC9GGRiu^L31uG z$7v`*JknQHsYB!Tm_W{a32TM099djW%5e+j0Ve_ct}IM>XLF1Ap+YvcrLV=|CKo6S zb+9Nl3_YdKP6%Cxy@6TxZ>;4&nTneadr z_ES90ydCev)LV!dN=#(*f}|ZORFdvkYBni^aLbUk>BajeWIOcmHP#8S)*2U~QKI%S zyrLmtPqb&TphJ;>yAxri#;{uyk`JJqODDw%(Z=2`1uc}br^V%>j!gS)D*q*f_-qf8&D;W1dJgQMlaH5er zN2U<%Smb7==vE}dDI8K7cKz!vs^73o9f>2sgiTzWcwY|BMYHH5%Vn7#kiw&eItCqa zIkR2~Q}>X=Ar8W|^Ms41Fm8o6IB2_j60eOeBB1Br!boW7JnoeX6Gs)?7rW0^5psc- zjS16yb>dFn>KPOF;imD}e!enuIniFzv}n$m2#gCCv4jM#ArwlzZ$7@9&XkFxZ4n!V zj3dyiwW4Ki2QG{@i>yuZXQizw_OkZI^-3otXC{!(lUpJF33gI60ak;Uqitp74|B6I zgg{b=Iz}WkhCGj1M=hu4#Aw173YxIVbISaoc z-nLZC*6Tgivd5V`K%GxhBsp@SUU60-rfc$=wb>zdJzXS&-5(NRRodFk;Kxk!S(O(a0e7oY=E( zAyS;Ow?6Q&XA+cnkCb{28_1N8H#?J!*$MmIwLq^*T_9-z^&UE@A(z9oGYtFy6EZef LrJugUA?W`A8`#=m diff --git a/frontend/webapp/public/next.svg b/frontend/webapp/public/next.svg deleted file mode 100644 index 5174b28c5..000000000 --- a/frontend/webapp/public/next.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/webapp/public/vercel.svg b/frontend/webapp/public/vercel.svg deleted file mode 100644 index d2f842227..000000000 --- a/frontend/webapp/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/webapp/utils/constants/config.tsx b/frontend/webapp/utils/constants/config.tsx index f3aebd36f..0cda26a5d 100644 --- a/frontend/webapp/utils/constants/config.tsx +++ b/frontend/webapp/utils/constants/config.tsx @@ -3,3 +3,8 @@ export const CONFIG = { APPS_SELECTED: "APPS_SELECTED", FINISHED: "FINISHED", }; + +export const METADATA = { + title: "Odigos", + icons: "https://d2q89wckrml3k4.cloudfront.net/logo.png", +}; diff --git a/frontend/webapp/utils/constants/index.tsx b/frontend/webapp/utils/constants/index.tsx index 90fdf2c71..253c82b8a 100644 --- a/frontend/webapp/utils/constants/index.tsx +++ b/frontend/webapp/utils/constants/index.tsx @@ -1,4 +1,4 @@ export { ROUTES } from "./routes"; -export { CONFIG } from "./config"; +export { CONFIG, METADATA } from "./config"; export { SETUP, OVERVIEW, NOTIFICATION, ACTION } from "./string"; export { API, QUERIES } from "./urls"; From f15d28d7181c338b51642014e09eacac88014078 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 3 Aug 2023 17:57:55 +0300 Subject: [PATCH 062/374] WIP --- frontend/webapp/app/layout.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/frontend/webapp/app/layout.tsx b/frontend/webapp/app/layout.tsx index 050b0c95c..efe4c8326 100644 --- a/frontend/webapp/app/layout.tsx +++ b/frontend/webapp/app/layout.tsx @@ -3,7 +3,6 @@ import React from "react"; import { ThemeProvider } from "styled-components"; import theme from "@/styles/palette"; import { QueryClient, QueryClientProvider } from "react-query"; -import Head from "next/head"; const LAYOUT_STYLE: React.CSSProperties = { margin: 0, @@ -31,9 +30,6 @@ export default function RootLayout({ - - Odigos - {children} From c9d170e31e6b0a25bce15c2c51c5f6ea9c4baddf Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 6 Aug 2023 21:04:35 +0300 Subject: [PATCH 063/374] edit resource name --- .../app/overview/sources/manage/page.tsx | 104 ++++++++++++------ .../app/overview/sources/manage/styled.tsx | 12 ++ .../manage.source.header.tsx | 70 +----------- .../sources.manage.list.tsx | 4 +- .../design.system/input/action.input.tsx | 3 +- frontend/webapp/services/api.tsx | 4 + frontend/webapp/services/sources.tsx | 20 +++- frontend/webapp/types/sources.tsx | 1 + frontend/webapp/utils/constants/string.tsx | 1 + 9 files changed, 118 insertions(+), 101 deletions(-) diff --git a/frontend/webapp/app/overview/sources/manage/page.tsx b/frontend/webapp/app/overview/sources/manage/page.tsx index a8de98f08..6d47bf8d4 100644 --- a/frontend/webapp/app/overview/sources/manage/page.tsx +++ b/frontend/webapp/app/overview/sources/manage/page.tsx @@ -1,56 +1,80 @@ "use client"; import { ManageSourceHeader } from "@/components/overview/sources/manage.source.header/manage.source.header"; -import { getSources } from "@/services"; -import { - NOTIFICATION, - OVERVIEW, - QUERIES, - ROUTES, - SETUP, -} from "@/utils/constants"; +import { ACTION, NOTIFICATION, OVERVIEW, SETUP } from "@/utils/constants"; import { useRouter, useSearchParams } from "next/navigation"; import React, { useEffect, useState } from "react"; -import { useMutation, useQuery } from "react-query"; -import { ManageSourcePageContainer, BackButtonWrapper } from "./styled"; +import { useMutation } from "react-query"; +import { + ManageSourcePageContainer, + BackButtonWrapper, + FieldWrapper, + ButtonWrapper, +} from "./styled"; import { LANGUAGES_LOGOS } from "@/assets/images"; import { Back } from "@/assets/icons/overview"; -import { KeyvalText } from "@/design.system"; -import { ManagedSource } from "@/types/sources"; +import { + KeyvalButton, + KeyvalInput, + KeyvalLoader, + KeyvalText, +} from "@/design.system"; import { DeleteSource } from "@/components/overview"; -import { deleteSource } from "@/services/sources"; +import { deleteSource, getSource, patchSources } from "@/services/sources"; import { useNotification } from "@/hooks"; - -const SOURCE = "source"; +import theme from "@/styles/palette"; +import { ManagedSource } from "@/types/sources"; export default function ManageSourcePage() { - const [currentSource, setCurrentSource] = useState( - null - ); + const [inputValue, setInputValue] = useState(""); + const [currentSource, setCurrentSource] = useState(); const searchParams = useSearchParams(); const router = useRouter(); - const { data: sources, refetch } = useQuery( - [QUERIES.API_SOURCES], - getSources - ); + const { show, Notification } = useNotification(); - const { mutate } = useMutation(() => + const { mutate: handleDeleteSource } = useMutation(() => deleteSource( currentSource?.namespace || "", currentSource?.kind || "", currentSource?.name || "" ) ); - useEffect(onPageLoad, [sources]); + + const { mutate: editSource } = useMutation(() => + patchSources( + currentSource?.namespace || "", + currentSource?.kind || "", + currentSource?.name || "", + { reported_name: inputValue } + ) + ); + useEffect(() => { + onPageLoad(); + }, [searchParams]); useEffect(() => { - console.log({ currentSource }); + setInputValue(currentSource?.reported_name || ""); }, [currentSource]); - function onPageLoad() { - const search = searchParams.get(SOURCE); - const source = sources?.find((item) => item.name === search); - source && setCurrentSource(source); + async function onPageLoad() { + const name = searchParams.get("name") || ""; + const kind = searchParams.get("kind") || ""; + const namespace = searchParams.get("namespace") || ""; + + const currentSource = await getSource(namespace, kind, name); + setCurrentSource(currentSource); + } + + function onSaveClick(newName) { + editSource(newName, { + onError, + onSuccess: () => + show({ + type: NOTIFICATION.SUCCESS, + message: OVERVIEW.SOURCE_UPDATE_SUCCESS, + }), + }); } + function onError({ response }) { const message = response?.data?.message; show({ @@ -62,7 +86,6 @@ export default function ManageSourcePage() { function onSuccess() { setTimeout(() => { router.back(); - refetch(); }, 1000); show({ type: NOTIFICATION.SUCCESS, @@ -70,12 +93,16 @@ export default function ManageSourcePage() { }); } function onDelete() { - mutate(undefined, { + handleDeleteSource(undefined, { onSuccess, onError, }); } + if (!currentSource) { + return ; + } + return ( router.back()}> @@ -84,12 +111,25 @@ export default function ManageSourcePage() { {currentSource && ( )} + + setInputValue(e)} + /> + + + + + {ACTION.SAVE} + + + theme.colors.secondary}; - } -`; - -const ActionInputWrapper = styled.div` - width: 80%; - height: 49px; -`; - const IMAGE_STYLE: React.CSSProperties = { backgroundColor: "#fff", padding: 4, @@ -49,48 +25,10 @@ const IMAGE_STYLE: React.CSSProperties = { marginLeft: 16, }; -export function ManageSourceHeader({ image_url, name }) { - const [showEditInput, setShowEditInput] = useState(true); - const [inputValue, setInputValue] = useState(name); - const containerRef = useRef(null); - const handleClickOutside = () => { - !showEditInput && handleSave(); - }; - - useOnClickOutside(containerRef, handleClickOutside); - - function handleSave() { - setShowEditInput(true); - } - - function handleInputChange(value) { - setInputValue(value); - } - +export function ManageSourceHeader({ image_url }) { return ( - + - {showEditInput ? ( - <> - - - {name} - - - - setShowEditInput(false)}> - - - - ) : ( - - handleInputChange(e)} - onAction={handleSave} - /> - - )} ); } diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx index dff5f790f..30515591f 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx @@ -23,7 +23,9 @@ export function SourcesManagedList({ data = [] }: SourcesManagedListProps) { key={source?.name} item={source} onClick={() => - router.push(`${ROUTES.MANAGE_SOURCE}?source=${source?.name}`) + router.push( + `${ROUTES.MANAGE_SOURCE}?name=${source?.name}&kind=${source?.kind}&namespace=${source?.namespace}` + ) } /> )); diff --git a/frontend/webapp/design.system/input/action.input.tsx b/frontend/webapp/design.system/input/action.input.tsx index 4bede03d6..308468194 100644 --- a/frontend/webapp/design.system/input/action.input.tsx +++ b/frontend/webapp/design.system/input/action.input.tsx @@ -17,6 +17,7 @@ export function KeyvalActionInput({ value, onChange, style = {}, + onAction, }: InputProps): JSX.Element { function handleChange(event: ChangeEvent): void { onChange(event.target.value); @@ -31,7 +32,7 @@ export function KeyvalActionInput({ autoComplete="off" /> - + {ACTION.SAVE} diff --git a/frontend/webapp/services/api.tsx b/frontend/webapp/services/api.tsx index d30c758c3..354663e64 100644 --- a/frontend/webapp/services/api.tsx +++ b/frontend/webapp/services/api.tsx @@ -30,3 +30,7 @@ export async function httpDelete(url: string) { return data; } } + +export async function patch(url: string, body: any) { + await axios.patch(url, body); +} diff --git a/frontend/webapp/services/sources.tsx b/frontend/webapp/services/sources.tsx index fc7fd5050..87e0aedf7 100644 --- a/frontend/webapp/services/sources.tsx +++ b/frontend/webapp/services/sources.tsx @@ -1,5 +1,5 @@ import { API } from "@/utils/constants"; -import { get, post, httpDelete } from "./api"; +import { get, post, httpDelete, patch } from "./api"; import { SelectedSources } from "@/types/sources"; export async function getNamespaces() { @@ -18,6 +18,12 @@ export async function getSources() { return await get(API.SOURCES); } +export async function getSource(namespace: string, kind: string, name: string) { + return await get( + `${API.SOURCES}/namespace/${namespace}/kind/${kind}/name/${name}` + ); +} + export async function deleteSource( namespace: string, kind: string, @@ -27,3 +33,15 @@ export async function deleteSource( `${API.SOURCES}/namespace/${namespace}/kind/${kind}/name/${name}` ); } + +export async function patchSources( + namespace: string, + kind: string, + name: string, + body: any +) { + patch( + `${API.SOURCES}/namespace/${namespace}/kind/${kind}/name/${name}`, + body + ); +} diff --git a/frontend/webapp/types/sources.tsx b/frontend/webapp/types/sources.tsx index 7906c4733..b52c0cea0 100644 --- a/frontend/webapp/types/sources.tsx +++ b/frontend/webapp/types/sources.tsx @@ -2,6 +2,7 @@ export interface ManagedSource { kind: string; name: string; namespace: string; + reported_name?: string; languages: [ { container_name: string; diff --git a/frontend/webapp/utils/constants/string.tsx b/frontend/webapp/utils/constants/string.tsx index 3227c2b95..f5070b409 100644 --- a/frontend/webapp/utils/constants/string.tsx +++ b/frontend/webapp/utils/constants/string.tsx @@ -83,6 +83,7 @@ export const OVERVIEW = { DELETE_BUTTON: "I want to delete this destination", CONFIRM_SOURCE_DELETE: "I want to delete this source", CONNECT: "Connect", + REPORTED_NAME: "Reported Name", }; export const ACTION = { From 3b8983c51787cd46bc648248191da2eeaa9cf370 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 6 Aug 2023 21:17:43 +0300 Subject: [PATCH 064/374] refactor sources| --- .../app/overview/sources/create/page.tsx | 39 +---- .../app/overview/sources/manage/page.tsx | 143 +---------------- frontend/webapp/containers/overview/index.tsx | 3 +- .../overview/sources/new.source.flow.tsx | 2 +- .../sources/sources.list.container.tsx | 40 +++++ .../overview/sources/sources.styled.tsx | 26 +++ .../overview/sources/update.source.form.tsx | 149 ++++++++++++++++++ 7 files changed, 223 insertions(+), 179 deletions(-) create mode 100644 frontend/webapp/containers/overview/sources/sources.list.container.tsx create mode 100644 frontend/webapp/containers/overview/sources/update.source.form.tsx diff --git a/frontend/webapp/app/overview/sources/create/page.tsx b/frontend/webapp/app/overview/sources/create/page.tsx index 9c83bfc82..5267b45b7 100644 --- a/frontend/webapp/app/overview/sources/create/page.tsx +++ b/frontend/webapp/app/overview/sources/create/page.tsx @@ -1,40 +1,5 @@ -"use client"; -import React from "react"; -import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; -import { OverviewHeader } from "@/components/overview"; -import { useNotification } from "@/hooks"; -import { useQuery } from "react-query"; -import { getSources } from "@/services"; -import { NewSourceFlow } from "@/containers/overview/sources/new.source.flow"; -import { useRouter } from "next/navigation"; +import { SourcesListContainer } from "@/containers/overview"; export default function CreateNewSourcesPage() { - const { show, Notification } = useNotification(); - const router = useRouter(); - const { data: sources, refetch } = useQuery( - [QUERIES.API_SOURCES], - getSources - ); - - function onNewSourceSuccess() { - setTimeout(() => { - router.back(); - refetch(); - }, 1000); - show({ - type: NOTIFICATION.SUCCESS, - message: OVERVIEW.SOURCE_CREATED_SUCCESS, - }); - } - - return ( - <> - router.back()} - /> - - - - ); + return ; } diff --git a/frontend/webapp/app/overview/sources/manage/page.tsx b/frontend/webapp/app/overview/sources/manage/page.tsx index 6d47bf8d4..386d1629f 100644 --- a/frontend/webapp/app/overview/sources/manage/page.tsx +++ b/frontend/webapp/app/overview/sources/manage/page.tsx @@ -1,143 +1,6 @@ -"use client"; -import { ManageSourceHeader } from "@/components/overview/sources/manage.source.header/manage.source.header"; -import { ACTION, NOTIFICATION, OVERVIEW, SETUP } from "@/utils/constants"; -import { useRouter, useSearchParams } from "next/navigation"; -import React, { useEffect, useState } from "react"; -import { useMutation } from "react-query"; -import { - ManageSourcePageContainer, - BackButtonWrapper, - FieldWrapper, - ButtonWrapper, -} from "./styled"; -import { LANGUAGES_LOGOS } from "@/assets/images"; -import { Back } from "@/assets/icons/overview"; -import { - KeyvalButton, - KeyvalInput, - KeyvalLoader, - KeyvalText, -} from "@/design.system"; -import { DeleteSource } from "@/components/overview"; -import { deleteSource, getSource, patchSources } from "@/services/sources"; -import { useNotification } from "@/hooks"; -import theme from "@/styles/palette"; -import { ManagedSource } from "@/types/sources"; +import React from "react"; +import { UpdateSourceForm } from "@/containers/overview"; export default function ManageSourcePage() { - const [inputValue, setInputValue] = useState(""); - const [currentSource, setCurrentSource] = useState(); - const searchParams = useSearchParams(); - const router = useRouter(); - - const { show, Notification } = useNotification(); - const { mutate: handleDeleteSource } = useMutation(() => - deleteSource( - currentSource?.namespace || "", - currentSource?.kind || "", - currentSource?.name || "" - ) - ); - - const { mutate: editSource } = useMutation(() => - patchSources( - currentSource?.namespace || "", - currentSource?.kind || "", - currentSource?.name || "", - { reported_name: inputValue } - ) - ); - useEffect(() => { - onPageLoad(); - }, [searchParams]); - - useEffect(() => { - setInputValue(currentSource?.reported_name || ""); - }, [currentSource]); - - async function onPageLoad() { - const name = searchParams.get("name") || ""; - const kind = searchParams.get("kind") || ""; - const namespace = searchParams.get("namespace") || ""; - - const currentSource = await getSource(namespace, kind, name); - setCurrentSource(currentSource); - } - - function onSaveClick(newName) { - editSource(newName, { - onError, - onSuccess: () => - show({ - type: NOTIFICATION.SUCCESS, - message: OVERVIEW.SOURCE_UPDATE_SUCCESS, - }), - }); - } - - function onError({ response }) { - const message = response?.data?.message; - show({ - type: NOTIFICATION.ERROR, - message, - }); - } - - function onSuccess() { - setTimeout(() => { - router.back(); - }, 1000); - show({ - type: NOTIFICATION.SUCCESS, - message: OVERVIEW.SOURCE_DELETED_SUCCESS, - }); - } - function onDelete() { - handleDeleteSource(undefined, { - onSuccess, - onError, - }); - } - - if (!currentSource) { - return ; - } - - return ( - - router.back()}> - - {SETUP.BACK} - - {currentSource && ( - - )} - - setInputValue(e)} - /> - - - - - {ACTION.SAVE} - - - - - - - ); + return ; } diff --git a/frontend/webapp/containers/overview/index.tsx b/frontend/webapp/containers/overview/index.tsx index 9c57b45c8..61a3731ef 100644 --- a/frontend/webapp/containers/overview/index.tsx +++ b/frontend/webapp/containers/overview/index.tsx @@ -4,4 +4,5 @@ export { SourcesContainer } from "./sources/sources"; export { NewDestinationFlow } from "./destination/new.destination.flow"; export { NewDestinationForm } from "./destination/new.destination.form"; export { UpdateDestinationFlow } from "./destination/update.destination.flow"; - +export { UpdateSourceForm } from "./sources/update.source.form"; +export { SourcesListContainer } from "./sources/sources.list.container"; diff --git a/frontend/webapp/containers/overview/sources/new.source.flow.tsx b/frontend/webapp/containers/overview/sources/new.source.flow.tsx index 3b5468b9a..3c0dd61a0 100644 --- a/frontend/webapp/containers/overview/sources/new.source.flow.tsx +++ b/frontend/webapp/containers/overview/sources/new.source.flow.tsx @@ -9,7 +9,7 @@ import { useMutation } from "react-query"; import { setNamespaces } from "@/services"; import { SelectedSources } from "@/types/sources"; -export function NewSourceFlow({ onSuccess, sources }) { +export function NewSourcesList({ onSuccess, sources }) { const { sectionData, setSectionData, totalSelected } = useSectionData({}); const { mutate } = useMutation((body: SelectedSources) => setNamespaces(body) diff --git a/frontend/webapp/containers/overview/sources/sources.list.container.tsx b/frontend/webapp/containers/overview/sources/sources.list.container.tsx new file mode 100644 index 000000000..6d87ff086 --- /dev/null +++ b/frontend/webapp/containers/overview/sources/sources.list.container.tsx @@ -0,0 +1,40 @@ +"use client"; +import React from "react"; +import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { OverviewHeader } from "@/components/overview"; +import { useNotification } from "@/hooks"; +import { useQuery } from "react-query"; +import { getSources } from "@/services"; +import { NewSourcesList } from "@/containers/overview/sources/new.source.flow"; +import { useRouter } from "next/navigation"; + +export function SourcesListContainer() { + const { show, Notification } = useNotification(); + const router = useRouter(); + const { data: sources, refetch } = useQuery( + [QUERIES.API_SOURCES], + getSources + ); + + function onNewSourceSuccess() { + setTimeout(() => { + router.back(); + refetch(); + }, 1000); + show({ + type: NOTIFICATION.SUCCESS, + message: OVERVIEW.SOURCE_CREATED_SUCCESS, + }); + } + + return ( + <> + router.back()} + /> + + + + ); +} diff --git a/frontend/webapp/containers/overview/sources/sources.styled.tsx b/frontend/webapp/containers/overview/sources/sources.styled.tsx index d07f83647..705f4b2e7 100644 --- a/frontend/webapp/containers/overview/sources/sources.styled.tsx +++ b/frontend/webapp/containers/overview/sources/sources.styled.tsx @@ -22,3 +22,29 @@ export const ButtonWrapper = styled.div` right: 32px; top: 40px; `; + +export const ManageSourcePageContainer = styled.div` + padding: 32px; +`; + +export const BackButtonWrapper = styled.div` + display: flex; + width: fit-content; + align-items: center; + cursor: pointer; + p { + cursor: pointer !important; + } +`; + +export const FieldWrapper = styled.div` + height: 36px; + width: 348px; + margin-bottom: 64px; +`; + +export const SaveSourceButtonWrapper = styled.div` + margin-top: 48px; + height: 36px; + width: 362px; +`; diff --git a/frontend/webapp/containers/overview/sources/update.source.form.tsx b/frontend/webapp/containers/overview/sources/update.source.form.tsx new file mode 100644 index 000000000..e563177c7 --- /dev/null +++ b/frontend/webapp/containers/overview/sources/update.source.form.tsx @@ -0,0 +1,149 @@ +"use client"; +import { ManageSourceHeader } from "@/components/overview/sources/manage.source.header/manage.source.header"; +import { ACTION, NOTIFICATION, OVERVIEW, SETUP } from "@/utils/constants"; +import { useRouter, useSearchParams } from "next/navigation"; +import React, { useEffect, useState } from "react"; +import { useMutation } from "react-query"; +import { + ManageSourcePageContainer, + BackButtonWrapper, + FieldWrapper, + SaveSourceButtonWrapper, +} from "./sources.styled"; +import { LANGUAGES_LOGOS } from "@/assets/images"; +import { Back } from "@/assets/icons/overview"; +import { + KeyvalButton, + KeyvalInput, + KeyvalLoader, + KeyvalText, +} from "@/design.system"; +import { DeleteSource } from "@/components/overview"; +import { deleteSource, getSource, patchSources } from "@/services/sources"; +import { useNotification } from "@/hooks"; +import theme from "@/styles/palette"; +import { ManagedSource } from "@/types/sources"; + +const NAME = "name"; +const KIND = "kind"; +const NAMESPACE = "namespace"; + +export function UpdateSourceForm() { + const [inputValue, setInputValue] = useState(""); + const [currentSource, setCurrentSource] = useState(); + + const searchParams = useSearchParams(); + const router = useRouter(); + const { show, Notification } = useNotification(); + + const { mutate: handleDeleteSource } = useMutation(() => + deleteSource( + currentSource?.namespace || "", + currentSource?.kind || "", + currentSource?.name || "" + ) + ); + + const { mutate: editSource } = useMutation(() => + patchSources( + currentSource?.namespace || "", + currentSource?.kind || "", + currentSource?.name || "", + { reported_name: inputValue } + ) + ); + useEffect(() => { + onPageLoad(); + }, [searchParams]); + + useEffect(() => { + setInputValue(currentSource?.reported_name || ""); + }, [currentSource]); + + async function onPageLoad() { + const name = searchParams.get(NAME) || ""; + const kind = searchParams.get(KIND) || ""; + const namespace = searchParams.get(NAMESPACE) || ""; + + const currentSource = await getSource(namespace, kind, name); + setCurrentSource(currentSource); + } + + function onSaveClick(newName) { + editSource(newName, { + onError, + onSuccess: () => + show({ + type: NOTIFICATION.SUCCESS, + message: OVERVIEW.SOURCE_UPDATE_SUCCESS, + }), + }); + } + + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } + + function onSuccess() { + setTimeout(() => { + router.back(); + }, 1000); + show({ + type: NOTIFICATION.SUCCESS, + message: OVERVIEW.SOURCE_DELETED_SUCCESS, + }); + } + + function onDelete() { + handleDeleteSource(undefined, { + onSuccess, + onError, + }); + } + + if (!currentSource) { + return ; + } + + return ( + + router.back()}> + + {SETUP.BACK} + + {currentSource && ( + + )} + + setInputValue(e)} + /> + + + + + {ACTION.SAVE} + + + + + + + ); +} From 0dbc53da9be6a13c501b7c98aaf62fdb8e6162d0 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 7 Aug 2023 09:21:22 +0300 Subject: [PATCH 065/374] change files names --- frontend/webapp/app/overview/destinations/create/page.tsx | 4 ++-- .../{new.destination.flow.tsx => new.destination.list.tsx} | 2 +- frontend/webapp/containers/overview/index.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename frontend/webapp/containers/overview/destination/{new.destination.flow.tsx => new.destination.list.tsx} (95%) diff --git a/frontend/webapp/app/overview/destinations/create/page.tsx b/frontend/webapp/app/overview/destinations/create/page.tsx index 3ec5946ca..516b69bf0 100644 --- a/frontend/webapp/app/overview/destinations/create/page.tsx +++ b/frontend/webapp/app/overview/destinations/create/page.tsx @@ -1,5 +1,5 @@ -import { NewDestinationFlow } from "@/containers/overview"; +import { NewDestinationList } from "@/containers/overview"; export default function CreateDestinationPage() { - return ; + return ; } diff --git a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx b/frontend/webapp/containers/overview/destination/new.destination.list.tsx similarity index 95% rename from frontend/webapp/containers/overview/destination/new.destination.flow.tsx rename to frontend/webapp/containers/overview/destination/new.destination.list.tsx index 27c0dddc7..3f8821ed7 100644 --- a/frontend/webapp/containers/overview/destination/new.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/new.destination.list.tsx @@ -6,7 +6,7 @@ import { DestinationSection } from "@/containers/setup/destination/destination.s import { NewDestinationContainer } from "./destination.styled"; import { useRouter } from "next/navigation"; -export function NewDestinationFlow() { +export function NewDestinationList() { const router = useRouter(); return ( diff --git a/frontend/webapp/containers/overview/index.tsx b/frontend/webapp/containers/overview/index.tsx index 61a3731ef..6fe210b98 100644 --- a/frontend/webapp/containers/overview/index.tsx +++ b/frontend/webapp/containers/overview/index.tsx @@ -1,7 +1,7 @@ export { OverviewContainer } from "./overview/overview"; export { DestinationContainer } from "./destination/destination"; export { SourcesContainer } from "./sources/sources"; -export { NewDestinationFlow } from "./destination/new.destination.flow"; +export { NewDestinationList } from "./destination/new.destination.list"; export { NewDestinationForm } from "./destination/new.destination.form"; export { UpdateDestinationFlow } from "./destination/update.destination.flow"; export { UpdateSourceForm } from "./sources/update.source.form"; From bb9c9d51b1156b748af4110fb2a956393c96065a Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 7 Aug 2023 09:33:39 +0300 Subject: [PATCH 066/374] change files names --- frontend/webapp/app/overview/sources/page.tsx | 4 ++-- frontend/webapp/containers/overview/index.tsx | 2 +- .../sources/{sources.tsx => instrumented.sources.tsx} | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename frontend/webapp/containers/overview/sources/{sources.tsx => instrumented.sources.tsx} (93%) diff --git a/frontend/webapp/app/overview/sources/page.tsx b/frontend/webapp/app/overview/sources/page.tsx index 77d0c32f2..07a0ac7cb 100644 --- a/frontend/webapp/app/overview/sources/page.tsx +++ b/frontend/webapp/app/overview/sources/page.tsx @@ -1,7 +1,7 @@ "use client"; -import { SourcesContainer } from "@/containers/overview"; +import { InstrumentedSourcesContainer } from "@/containers/overview"; import React from "react"; export default function SourcesOverviewPage() { - return ; + return ; } diff --git a/frontend/webapp/containers/overview/index.tsx b/frontend/webapp/containers/overview/index.tsx index 6fe210b98..60d3d1c17 100644 --- a/frontend/webapp/containers/overview/index.tsx +++ b/frontend/webapp/containers/overview/index.tsx @@ -1,6 +1,6 @@ export { OverviewContainer } from "./overview/overview"; export { DestinationContainer } from "./destination/destination"; -export { SourcesContainer } from "./sources/sources"; +export { InstrumentedSourcesContainer } from "./sources/instrumented.sources"; export { NewDestinationList } from "./destination/new.destination.list"; export { NewDestinationForm } from "./destination/new.destination.form"; export { UpdateDestinationFlow } from "./destination/update.destination.flow"; diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/instrumented.sources.tsx similarity index 93% rename from frontend/webapp/containers/overview/sources/sources.tsx rename to frontend/webapp/containers/overview/sources/instrumented.sources.tsx index 1eed8288a..17c7ecdbe 100644 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ b/frontend/webapp/containers/overview/sources/instrumented.sources.tsx @@ -8,7 +8,7 @@ import { useQuery } from "react-query"; import { getSources } from "@/services"; import { useRouter } from "next/navigation"; -export function SourcesContainer() { +export function InstrumentedSourcesContainer() { const router = useRouter(); const { data: sources } = useQuery([QUERIES.API_SOURCES], getSources); From c2e13cd3d22d72d42c5724e9ffb9eee627907e34 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 7 Aug 2023 09:51:17 +0300 Subject: [PATCH 067/374] delete dest fixed --- .../overview/destination/destination.tsx | 24 ++++++++++++++++--- .../destination/update.destination.flow.tsx | 4 ++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/frontend/webapp/containers/overview/destination/destination.tsx b/frontend/webapp/containers/overview/destination/destination.tsx index 8ed985640..2c7aab1f4 100644 --- a/frontend/webapp/containers/overview/destination/destination.tsx +++ b/frontend/webapp/containers/overview/destination/destination.tsx @@ -1,11 +1,12 @@ "use client"; -import React from "react"; +import React, { useEffect } from "react"; import { KeyvalLoader } from "@/design.system"; -import { OVERVIEW, QUERIES, ROUTES } from "@/utils/constants"; +import { NOTIFICATION, OVERVIEW, QUERIES, ROUTES } from "@/utils/constants"; import { useQuery } from "react-query"; import { getDestinations } from "@/services"; import { OverviewHeader, DestinationsManagedList } from "@/components/overview"; -import { useRouter } from "next/navigation"; +import { useRouter, useSearchParams } from "next/navigation"; +import { useNotification } from "@/hooks"; export function DestinationContainer() { const { isLoading: destinationLoading, data: destinationList } = useQuery( @@ -13,8 +14,24 @@ export function DestinationContainer() { getDestinations ); + const searchParams = useSearchParams(); + const { show, Notification } = useNotification(); + const router = useRouter(); + useEffect(onPageLoad, [searchParams, destinationList]); + + function onPageLoad() { + const status = searchParams.get("status"); + if (status === "deleted") { + show({ + type: NOTIFICATION.SUCCESS, + message: OVERVIEW.DESTINATION_DELETED_SUCCESS, + }); + router.push(ROUTES.DESTINATIONS); + } + } + if (destinationLoading) { return ; } @@ -29,6 +46,7 @@ export function DestinationContainer() { } onMenuButtonClick={() => router.push(ROUTES.CREATE_DESTINATION)} /> + ); } diff --git a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx b/frontend/webapp/containers/overview/destination/update.destination.flow.tsx index 66259fe3e..2f0bfa0be 100644 --- a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/update.destination.flow.tsx @@ -1,7 +1,7 @@ "use client"; import React, { useEffect, useMemo, useState } from "react"; import { KeyvalLoader } from "@/design.system"; -import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { NOTIFICATION, OVERVIEW, QUERIES, ROUTES } from "@/utils/constants"; import { useMutation, useQuery } from "react-query"; import { getDestination, updateDestination } from "@/services"; import { ManageDestination } from "@/components/overview"; @@ -51,7 +51,7 @@ export function UpdateDestinationFlow() { function onDelete() { handleDeleteDestination(selectedDestination.id, { - onSuccess: () => onSuccess(OVERVIEW.DESTINATION_DELETED_SUCCESS), + onSuccess: () => router.push(`${ROUTES.DESTINATIONS}?status=deleted`), onError, }); } From 61183a4cec9aefe21bde1596b9ddf34fbd603abe Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 7 Aug 2023 10:02:00 +0300 Subject: [PATCH 068/374] WIP --- .../overview/destination/destination.tsx | 22 +++++++---- .../overview/sources/instrumented.sources.tsx | 33 ++++++++++++++-- .../overview/sources/update.source.form.tsx | 39 ++++++++----------- frontend/webapp/utils/constants/index.tsx | 2 +- frontend/webapp/utils/constants/string.tsx | 5 +++ 5 files changed, 67 insertions(+), 34 deletions(-) diff --git a/frontend/webapp/containers/overview/destination/destination.tsx b/frontend/webapp/containers/overview/destination/destination.tsx index 2c7aab1f4..f8020223d 100644 --- a/frontend/webapp/containers/overview/destination/destination.tsx +++ b/frontend/webapp/containers/overview/destination/destination.tsx @@ -1,7 +1,13 @@ "use client"; import React, { useEffect } from "react"; import { KeyvalLoader } from "@/design.system"; -import { NOTIFICATION, OVERVIEW, QUERIES, ROUTES } from "@/utils/constants"; +import { + NOTIFICATION, + OVERVIEW, + PARAMS, + QUERIES, + ROUTES, +} from "@/utils/constants"; import { useQuery } from "react-query"; import { getDestinations } from "@/services"; import { OverviewHeader, DestinationsManagedList } from "@/components/overview"; @@ -9,10 +15,11 @@ import { useRouter, useSearchParams } from "next/navigation"; import { useNotification } from "@/hooks"; export function DestinationContainer() { - const { isLoading: destinationLoading, data: destinationList } = useQuery( - [QUERIES.API_DESTINATIONS], - getDestinations - ); + const { + isLoading: destinationLoading, + data: destinationList, + refetch: refetchDestinations, + } = useQuery([QUERIES.API_DESTINATIONS], getDestinations); const searchParams = useSearchParams(); const { show, Notification } = useNotification(); @@ -22,8 +29,9 @@ export function DestinationContainer() { useEffect(onPageLoad, [searchParams, destinationList]); function onPageLoad() { - const status = searchParams.get("status"); - if (status === "deleted") { + const status = searchParams.get(PARAMS.STATUS); + if (status === PARAMS.DELETED) { + refetchDestinations(); show({ type: NOTIFICATION.SUCCESS, message: OVERVIEW.DESTINATION_DELETED_SUCCESS, diff --git a/frontend/webapp/containers/overview/sources/instrumented.sources.tsx b/frontend/webapp/containers/overview/sources/instrumented.sources.tsx index 17c7ecdbe..03ec2695f 100644 --- a/frontend/webapp/containers/overview/sources/instrumented.sources.tsx +++ b/frontend/webapp/containers/overview/sources/instrumented.sources.tsx @@ -1,17 +1,41 @@ "use client"; -import React from "react"; -import { OVERVIEW, QUERIES, ROUTES } from "@/utils/constants"; +import React, { useEffect } from "react"; +import { + NOTIFICATION, + OVERVIEW, + PARAMS, + QUERIES, + ROUTES, +} from "@/utils/constants"; import { OverviewHeader } from "@/components/overview"; import { SourcesContainerWrapper } from "./sources.styled"; import { ManageSources } from "./manage.sources"; import { useQuery } from "react-query"; import { getSources } from "@/services"; -import { useRouter } from "next/navigation"; +import { useRouter, useSearchParams } from "next/navigation"; +import { useNotification } from "@/hooks"; export function InstrumentedSourcesContainer() { const router = useRouter(); - const { data: sources } = useQuery([QUERIES.API_SOURCES], getSources); + const searchParams = useSearchParams(); + const { show, Notification } = useNotification(); + const { data: sources, refetch: refetchSources } = useQuery( + [QUERIES.API_SOURCES], + getSources + ); + useEffect(onPageLoad, [searchParams]); + function onPageLoad() { + const status = searchParams.get(PARAMS.STATUS); + if (status === PARAMS.DELETED) { + refetchSources(); + show({ + type: NOTIFICATION.SUCCESS, + message: OVERVIEW.SOURCE_DELETED_SUCCESS, + }); + router.push(ROUTES.SOURCES); + } + } return ( @@ -19,6 +43,7 @@ export function InstrumentedSourcesContainer() { onAddClick={() => router.push(ROUTES.CREATE_SOURCE)} sources={sources} /> + ); } diff --git a/frontend/webapp/containers/overview/sources/update.source.form.tsx b/frontend/webapp/containers/overview/sources/update.source.form.tsx index e563177c7..19d67bed5 100644 --- a/frontend/webapp/containers/overview/sources/update.source.form.tsx +++ b/frontend/webapp/containers/overview/sources/update.source.form.tsx @@ -1,6 +1,12 @@ "use client"; import { ManageSourceHeader } from "@/components/overview/sources/manage.source.header/manage.source.header"; -import { ACTION, NOTIFICATION, OVERVIEW, SETUP } from "@/utils/constants"; +import { + ACTION, + NOTIFICATION, + OVERVIEW, + ROUTES, + SETUP, +} from "@/utils/constants"; import { useRouter, useSearchParams } from "next/navigation"; import React, { useEffect, useState } from "react"; import { useMutation } from "react-query"; @@ -68,6 +74,13 @@ export function UpdateSourceForm() { const currentSource = await getSource(namespace, kind, name); setCurrentSource(currentSource); } + function onError({ response }) { + const message = response?.data?.message; + show({ + type: NOTIFICATION.ERROR, + message, + }); + } function onSaveClick(newName) { editSource(newName, { @@ -80,27 +93,9 @@ export function UpdateSourceForm() { }); } - function onError({ response }) { - const message = response?.data?.message; - show({ - type: NOTIFICATION.ERROR, - message, - }); - } - - function onSuccess() { - setTimeout(() => { - router.back(); - }, 1000); - show({ - type: NOTIFICATION.SUCCESS, - message: OVERVIEW.SOURCE_DELETED_SUCCESS, - }); - } - - function onDelete() { + function onSourceDelete() { handleDeleteSource(undefined, { - onSuccess, + onSuccess: () => router.push(`${ROUTES.SOURCES}?status=deleted`), onError, }); } @@ -137,7 +132,7 @@ export function UpdateSourceForm() { Date: Mon, 7 Aug 2023 10:15:11 +0300 Subject: [PATCH 069/374] refactor services --- frontend/webapp/services/api.tsx | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/frontend/webapp/services/api.tsx b/frontend/webapp/services/api.tsx index 354663e64..326084fd4 100644 --- a/frontend/webapp/services/api.tsx +++ b/frontend/webapp/services/api.tsx @@ -7,30 +7,18 @@ export async function get(url: string) { } } -export async function post(url: string, body: any) { - const { data, status } = await axios.post(url, body); - - if (status === 200) { - return data; - } +export function post(url: string, body: any) { + axios.post(url, body); } -export async function put(url: string, body: any) { - const { data, status } = await axios.put(url, body); - - if (status === 200) { - return data; - } +export function put(url: string, body: any) { + axios.put(url, body); } -export async function httpDelete(url: string) { - const { data, status } = await axios.delete(url); - - if (status === 200) { - return data; - } +export function httpDelete(url: string) { + axios.delete(url); } -export async function patch(url: string, body: any) { - await axios.patch(url, body); +export function patch(url: string, body: any) { + axios.patch(url, body); } From f1618a5be5bb0418c800f0e586cbf7ba3516762e Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 7 Aug 2023 14:21:43 +0300 Subject: [PATCH 070/374] WIP --- .../overview/destination/update.destination.flow.tsx | 4 ++-- frontend/webapp/services/api.tsx | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx b/frontend/webapp/containers/overview/destination/update.destination.flow.tsx index 2f0bfa0be..4addddb1d 100644 --- a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destination/update.destination.flow.tsx @@ -63,7 +63,7 @@ export function UpdateDestinationFlow() { }; handleUpdateDestination(newDestinations, { - onSuccess, + onSuccess: () => onSuccess(OVERVIEW.DESTINATION_UPDATE_SUCCESS), onError, }); } @@ -78,7 +78,7 @@ export function UpdateDestinationFlow() { } } - function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { + function onSuccess(message: string) { refetch(); show({ type: NOTIFICATION.SUCCESS, diff --git a/frontend/webapp/services/api.tsx b/frontend/webapp/services/api.tsx index 990b1f888..326084fd4 100644 --- a/frontend/webapp/services/api.tsx +++ b/frontend/webapp/services/api.tsx @@ -22,7 +22,3 @@ export function httpDelete(url: string) { export function patch(url: string, body: any) { axios.patch(url, body); } - -export async function patch(url: string, body: any) { - await axios.patch(url, body); -} From fd269a6e8059ccd9f0f2fe0d69bc2d39491521b9 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 7 Aug 2023 14:58:27 +0300 Subject: [PATCH 071/374] change file names --- .../overview/destinations/create/{[id] => form}/page.tsx | 0 .../destinations.styled.tsx} | 0 .../destination.tsx => destinations/destinations.tsx} | 0 .../new.destination.form.tsx | 0 .../new.destination.list.tsx | 2 +- .../update.destination.flow.tsx | 2 +- frontend/webapp/containers/overview/index.tsx | 8 ++++---- frontend/webapp/utils/constants/routes.tsx | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename frontend/webapp/app/overview/destinations/create/{[id] => form}/page.tsx (100%) rename frontend/webapp/containers/overview/{destination/destination.styled.tsx => destinations/destinations.styled.tsx} (100%) rename frontend/webapp/containers/overview/{destination/destination.tsx => destinations/destinations.tsx} (100%) rename frontend/webapp/containers/overview/{destination => destinations}/new.destination.form.tsx (100%) rename frontend/webapp/containers/overview/{destination => destinations}/new.destination.list.tsx (91%) rename frontend/webapp/containers/overview/{destination => destinations}/update.destination.flow.tsx (97%) diff --git a/frontend/webapp/app/overview/destinations/create/[id]/page.tsx b/frontend/webapp/app/overview/destinations/create/form/page.tsx similarity index 100% rename from frontend/webapp/app/overview/destinations/create/[id]/page.tsx rename to frontend/webapp/app/overview/destinations/create/form/page.tsx diff --git a/frontend/webapp/containers/overview/destination/destination.styled.tsx b/frontend/webapp/containers/overview/destinations/destinations.styled.tsx similarity index 100% rename from frontend/webapp/containers/overview/destination/destination.styled.tsx rename to frontend/webapp/containers/overview/destinations/destinations.styled.tsx diff --git a/frontend/webapp/containers/overview/destination/destination.tsx b/frontend/webapp/containers/overview/destinations/destinations.tsx similarity index 100% rename from frontend/webapp/containers/overview/destination/destination.tsx rename to frontend/webapp/containers/overview/destinations/destinations.tsx diff --git a/frontend/webapp/containers/overview/destination/new.destination.form.tsx b/frontend/webapp/containers/overview/destinations/new.destination.form.tsx similarity index 100% rename from frontend/webapp/containers/overview/destination/new.destination.form.tsx rename to frontend/webapp/containers/overview/destinations/new.destination.form.tsx diff --git a/frontend/webapp/containers/overview/destination/new.destination.list.tsx b/frontend/webapp/containers/overview/destinations/new.destination.list.tsx similarity index 91% rename from frontend/webapp/containers/overview/destination/new.destination.list.tsx rename to frontend/webapp/containers/overview/destinations/new.destination.list.tsx index 3f8821ed7..4482533f5 100644 --- a/frontend/webapp/containers/overview/destination/new.destination.list.tsx +++ b/frontend/webapp/containers/overview/destinations/new.destination.list.tsx @@ -3,7 +3,7 @@ import React from "react"; import { OVERVIEW, ROUTES } from "@/utils/constants"; import { OverviewHeader } from "@/components/overview"; import { DestinationSection } from "@/containers/setup/destination/destination.section"; -import { NewDestinationContainer } from "./destination.styled"; +import { NewDestinationContainer } from "./destinations.styled"; import { useRouter } from "next/navigation"; export function NewDestinationList() { diff --git a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx b/frontend/webapp/containers/overview/destinations/update.destination.flow.tsx similarity index 97% rename from frontend/webapp/containers/overview/destination/update.destination.flow.tsx rename to frontend/webapp/containers/overview/destinations/update.destination.flow.tsx index 4addddb1d..1bb1a5221 100644 --- a/frontend/webapp/containers/overview/destination/update.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destinations/update.destination.flow.tsx @@ -6,7 +6,7 @@ import { useMutation, useQuery } from "react-query"; import { getDestination, updateDestination } from "@/services"; import { ManageDestination } from "@/components/overview"; import { deleteDestination, getDestinations } from "@/services/destinations"; -import { ManageDestinationWrapper } from "./destination.styled"; +import { ManageDestinationWrapper } from "./destinations.styled"; import { useRouter, useSearchParams } from "next/navigation"; import { useNotification } from "@/hooks"; const DEST = "dest"; diff --git a/frontend/webapp/containers/overview/index.tsx b/frontend/webapp/containers/overview/index.tsx index 60d3d1c17..27cff2fb1 100644 --- a/frontend/webapp/containers/overview/index.tsx +++ b/frontend/webapp/containers/overview/index.tsx @@ -1,8 +1,8 @@ export { OverviewContainer } from "./overview/overview"; -export { DestinationContainer } from "./destination/destination"; +export { DestinationContainer } from "./destinations/destinations"; export { InstrumentedSourcesContainer } from "./sources/instrumented.sources"; -export { NewDestinationList } from "./destination/new.destination.list"; -export { NewDestinationForm } from "./destination/new.destination.form"; -export { UpdateDestinationFlow } from "./destination/update.destination.flow"; +export { NewDestinationList } from "./destinations/new.destination.list"; +export { NewDestinationForm } from "./destinations/new.destination.form"; +export { UpdateDestinationFlow } from "./destinations/update.destination.flow"; export { UpdateSourceForm } from "./sources/update.source.form"; export { SourcesListContainer } from "./sources/sources.list.container"; diff --git a/frontend/webapp/utils/constants/routes.tsx b/frontend/webapp/utils/constants/routes.tsx index 6a074d899..13cbccc12 100644 --- a/frontend/webapp/utils/constants/routes.tsx +++ b/frontend/webapp/utils/constants/routes.tsx @@ -4,7 +4,7 @@ export const ROUTES = { SOURCES: "/overview/sources", DESTINATIONS: "/overview/destinations", NEW_DESTINATION: "/setup?state=destinations", - MANAGE_DESTINATION: "/overview/destinations/create/manage?dest=", + MANAGE_DESTINATION: "/overview/destinations/create/form?dest=", UPDATE_DESTINATION: "destinations/manage?dest=", CREATE_DESTINATION: "destinations/create", CREATE_SOURCE: "/overview/sources/create", From 8769e675ae3c65d1779fed9b46ce0903fec5740c Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 7 Aug 2023 15:11:39 +0300 Subject: [PATCH 072/374] WIP --- .../overview/sources/instrumented.sources.tsx | 19 ++++++++++++++++--- .../sources/sources.list.container.tsx | 16 ++++------------ .../overview/sources/update.source.form.tsx | 6 +----- frontend/webapp/utils/constants/string.tsx | 2 ++ 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/frontend/webapp/containers/overview/sources/instrumented.sources.tsx b/frontend/webapp/containers/overview/sources/instrumented.sources.tsx index 03ec2695f..495f370cb 100644 --- a/frontend/webapp/containers/overview/sources/instrumented.sources.tsx +++ b/frontend/webapp/containers/overview/sources/instrumented.sources.tsx @@ -25,15 +25,28 @@ export function InstrumentedSourcesContainer() { ); useEffect(onPageLoad, [searchParams]); + function getMessage(status: string) { + switch (status) { + case PARAMS.DELETED: + return OVERVIEW.SOURCE_DELETED_SUCCESS; + case PARAMS.CREATED: + return OVERVIEW.SOURCE_CREATED_SUCCESS; + case PARAMS.UPDATED: + return OVERVIEW.SOURCE_UPDATE_SUCCESS; + default: + return ""; + } + } + function onPageLoad() { const status = searchParams.get(PARAMS.STATUS); - if (status === PARAMS.DELETED) { + if (status) { refetchSources(); show({ type: NOTIFICATION.SUCCESS, - message: OVERVIEW.SOURCE_DELETED_SUCCESS, + message: getMessage(status), }); - router.push(ROUTES.SOURCES); + router.replace(ROUTES.SOURCES); } } return ( diff --git a/frontend/webapp/containers/overview/sources/sources.list.container.tsx b/frontend/webapp/containers/overview/sources/sources.list.container.tsx index 6d87ff086..7729cf345 100644 --- a/frontend/webapp/containers/overview/sources/sources.list.container.tsx +++ b/frontend/webapp/containers/overview/sources/sources.list.container.tsx @@ -1,6 +1,6 @@ "use client"; import React from "react"; -import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { NOTIFICATION, OVERVIEW, QUERIES, ROUTES } from "@/utils/constants"; import { OverviewHeader } from "@/components/overview"; import { useNotification } from "@/hooks"; import { useQuery } from "react-query"; @@ -9,22 +9,14 @@ import { NewSourcesList } from "@/containers/overview/sources/new.source.flow"; import { useRouter } from "next/navigation"; export function SourcesListContainer() { - const { show, Notification } = useNotification(); + const { Notification } = useNotification(); const router = useRouter(); - const { data: sources, refetch } = useQuery( - [QUERIES.API_SOURCES], - getSources - ); + const { data: sources } = useQuery([QUERIES.API_SOURCES], getSources); function onNewSourceSuccess() { setTimeout(() => { - router.back(); - refetch(); + router.push(`${ROUTES.SOURCES}?status=created`); }, 1000); - show({ - type: NOTIFICATION.SUCCESS, - message: OVERVIEW.SOURCE_CREATED_SUCCESS, - }); } return ( diff --git a/frontend/webapp/containers/overview/sources/update.source.form.tsx b/frontend/webapp/containers/overview/sources/update.source.form.tsx index 19d67bed5..a7d94cc2f 100644 --- a/frontend/webapp/containers/overview/sources/update.source.form.tsx +++ b/frontend/webapp/containers/overview/sources/update.source.form.tsx @@ -85,11 +85,7 @@ export function UpdateSourceForm() { function onSaveClick(newName) { editSource(newName, { onError, - onSuccess: () => - show({ - type: NOTIFICATION.SUCCESS, - message: OVERVIEW.SOURCE_UPDATE_SUCCESS, - }), + onSuccess: () => router.push(`${ROUTES.SOURCES}?status=updated`), }); } diff --git a/frontend/webapp/utils/constants/string.tsx b/frontend/webapp/utils/constants/string.tsx index 5d6fa690a..ec8a22441 100644 --- a/frontend/webapp/utils/constants/string.tsx +++ b/frontend/webapp/utils/constants/string.tsx @@ -98,4 +98,6 @@ export const NOTIFICATION = { export const PARAMS = { STATUS: "status", DELETED: "deleted", + CREATED: "created", + UPDATED: "updated", }; From f5220c5c688ec622583cdd4e407089774f198063 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 7 Aug 2023 15:38:31 +0300 Subject: [PATCH 073/374] WIP --- .../overview/destinations/destinations.tsx | 19 ++++++++++++++++--- .../destinations/new.destination.form.tsx | 11 ++--------- .../destinations/update.destination.flow.tsx | 12 ++---------- .../overview/sources/instrumented.sources.tsx | 1 + 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/frontend/webapp/containers/overview/destinations/destinations.tsx b/frontend/webapp/containers/overview/destinations/destinations.tsx index f8020223d..ca8a967eb 100644 --- a/frontend/webapp/containers/overview/destinations/destinations.tsx +++ b/frontend/webapp/containers/overview/destinations/destinations.tsx @@ -28,15 +28,28 @@ export function DestinationContainer() { useEffect(onPageLoad, [searchParams, destinationList]); + function getMessage(status: string) { + switch (status) { + case PARAMS.DELETED: + return OVERVIEW.DESTINATION_DELETED_SUCCESS; + case PARAMS.CREATED: + return OVERVIEW.DESTINATION_CREATED_SUCCESS; + case PARAMS.UPDATED: + return OVERVIEW.DESTINATION_UPDATE_SUCCESS; + default: + return ""; + } + } + function onPageLoad() { const status = searchParams.get(PARAMS.STATUS); - if (status === PARAMS.DELETED) { + if (status) { refetchDestinations(); show({ type: NOTIFICATION.SUCCESS, - message: OVERVIEW.DESTINATION_DELETED_SUCCESS, + message: getMessage(status), }); - router.push(ROUTES.DESTINATIONS); + router.replace(ROUTES.DESTINATIONS); } } diff --git a/frontend/webapp/containers/overview/destinations/new.destination.form.tsx b/frontend/webapp/containers/overview/destinations/new.destination.form.tsx index c88928126..2a0ad1b82 100644 --- a/frontend/webapp/containers/overview/destinations/new.destination.form.tsx +++ b/frontend/webapp/containers/overview/destinations/new.destination.form.tsx @@ -1,6 +1,6 @@ "use client"; import React, { useEffect } from "react"; -import { NOTIFICATION, OVERVIEW, QUERIES } from "@/utils/constants"; +import { NOTIFICATION, OVERVIEW, QUERIES, ROUTES } from "@/utils/constants"; import { useMutation, useQuery } from "react-query"; import { getDestination, @@ -59,13 +59,6 @@ export function NewDestinationForm() { setSectionData(currentData); } - function onSuccess(message = OVERVIEW.DESTINATION_UPDATE_SUCCESS) { - show({ - type: NOTIFICATION.SUCCESS, - message, - }); - } - function onError({ response }) { const message = response?.data?.message; show({ @@ -81,7 +74,7 @@ export function NewDestinationForm() { }; mutate(destination, { - onSuccess: () => onSuccess(OVERVIEW.DESTINATION_CREATED_SUCCESS), + onSuccess: () => router.push(`${ROUTES.DESTINATIONS}?status=created`), onError, }); } diff --git a/frontend/webapp/containers/overview/destinations/update.destination.flow.tsx b/frontend/webapp/containers/overview/destinations/update.destination.flow.tsx index 1bb1a5221..d4b9ac1c8 100644 --- a/frontend/webapp/containers/overview/destinations/update.destination.flow.tsx +++ b/frontend/webapp/containers/overview/destinations/update.destination.flow.tsx @@ -1,7 +1,7 @@ "use client"; import React, { useEffect, useMemo, useState } from "react"; import { KeyvalLoader } from "@/design.system"; -import { NOTIFICATION, OVERVIEW, QUERIES, ROUTES } from "@/utils/constants"; +import { NOTIFICATION, QUERIES, ROUTES } from "@/utils/constants"; import { useMutation, useQuery } from "react-query"; import { getDestination, updateDestination } from "@/services"; import { ManageDestination } from "@/components/overview"; @@ -63,7 +63,7 @@ export function UpdateDestinationFlow() { }; handleUpdateDestination(newDestinations, { - onSuccess: () => onSuccess(OVERVIEW.DESTINATION_UPDATE_SUCCESS), + onSuccess: () => router.push(`${ROUTES.DESTINATIONS}?status=updated`), onError, }); } @@ -78,14 +78,6 @@ export function UpdateDestinationFlow() { } } - function onSuccess(message: string) { - refetch(); - show({ - type: NOTIFICATION.SUCCESS, - message, - }); - } - function onError({ response }) { const message = response?.data?.message; show({ diff --git a/frontend/webapp/containers/overview/sources/instrumented.sources.tsx b/frontend/webapp/containers/overview/sources/instrumented.sources.tsx index 495f370cb..4ff1e9384 100644 --- a/frontend/webapp/containers/overview/sources/instrumented.sources.tsx +++ b/frontend/webapp/containers/overview/sources/instrumented.sources.tsx @@ -49,6 +49,7 @@ export function InstrumentedSourcesContainer() { router.replace(ROUTES.SOURCES); } } + return ( From 7626088416a3880e83d440c0c274171461dd431f Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 8 Aug 2023 11:01:43 +0300 Subject: [PATCH 074/374] add contact button --- frontend/webapp/assets/icons/social/index.tsx | 4 ++ .../webapp/assets/icons/social/slack-grey.svg | 7 +++ frontend/webapp/assets/icons/social/slack.svg | 10 ++++ .../side.menu/contact.us/contact.us.tsx | 48 +++++++++++++++++++ .../components/side.menu/menu/menu.styled.tsx | 5 ++ .../webapp/components/side.menu/menu/menu.tsx | 11 ++++- frontend/webapp/utils/constants/string.tsx | 1 + frontend/webapp/utils/constants/urls.tsx | 5 +- 8 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 frontend/webapp/assets/icons/social/index.tsx create mode 100644 frontend/webapp/assets/icons/social/slack-grey.svg create mode 100644 frontend/webapp/assets/icons/social/slack.svg create mode 100644 frontend/webapp/components/side.menu/contact.us/contact.us.tsx diff --git a/frontend/webapp/assets/icons/social/index.tsx b/frontend/webapp/assets/icons/social/index.tsx new file mode 100644 index 000000000..d868090ae --- /dev/null +++ b/frontend/webapp/assets/icons/social/index.tsx @@ -0,0 +1,4 @@ +import Slack from "./slack.svg"; +import SlackGrey from "./slack-grey.svg"; + +export { SlackGrey, Slack }; diff --git a/frontend/webapp/assets/icons/social/slack-grey.svg b/frontend/webapp/assets/icons/social/slack-grey.svg new file mode 100644 index 000000000..dfb76ae07 --- /dev/null +++ b/frontend/webapp/assets/icons/social/slack-grey.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/frontend/webapp/assets/icons/social/slack.svg b/frontend/webapp/assets/icons/social/slack.svg new file mode 100644 index 000000000..ff256fd4d --- /dev/null +++ b/frontend/webapp/assets/icons/social/slack.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/frontend/webapp/components/side.menu/contact.us/contact.us.tsx b/frontend/webapp/components/side.menu/contact.us/contact.us.tsx new file mode 100644 index 000000000..d33165ecd --- /dev/null +++ b/frontend/webapp/components/side.menu/contact.us/contact.us.tsx @@ -0,0 +1,48 @@ +import React from "react"; +import { Slack, SlackGrey } from "@/assets/icons/social"; +import { KeyvalText } from "@/design.system"; +import { SLACK_INVITE_LINK } from "@/utils/constants/urls"; +import { styled } from "styled-components"; +import { ACTION } from "@/utils/constants"; + +const ContactUsContainer = styled.div` + display: flex; + padding: 0px 16px; + height: 48px; + align-items: center; + gap: 10px; + cursor: pointer; + border-radius: 10px; + p { + color: #8b92a6; + } + .icon-lock { + display: none; + } + &:hover { + p { + color: ${({ theme }) => theme.colors.white}; + } + .icon-unlock { + display: none; + } + + .icon-lock { + display: block; + } + } +`; + +export default function ContactUsButton() { + function handleContactUsClick() { + window.open(SLACK_INVITE_LINK, "_blank"); + } + + return ( + + + + {ACTION.CONTACT_US} + + ); +} diff --git a/frontend/webapp/components/side.menu/menu/menu.styled.tsx b/frontend/webapp/components/side.menu/menu/menu.styled.tsx index 06e515012..e3c1700c6 100644 --- a/frontend/webapp/components/side.menu/menu/menu.styled.tsx +++ b/frontend/webapp/components/side.menu/menu/menu.styled.tsx @@ -14,3 +14,8 @@ export const LogoWrapper = styled.div` export const MenuItemsWrapper = styled.div` padding: 16px 9px; `; + +export const ContactUsWrapper = styled(MenuItemsWrapper)` + position: absolute; + bottom: 5%; +`; diff --git a/frontend/webapp/components/side.menu/menu/menu.tsx b/frontend/webapp/components/side.menu/menu/menu.tsx index 814885343..9cc7cd324 100644 --- a/frontend/webapp/components/side.menu/menu/menu.tsx +++ b/frontend/webapp/components/side.menu/menu/menu.tsx @@ -1,11 +1,17 @@ "use client"; import React, { useEffect, useState } from "react"; -import { MenuContainer, LogoWrapper, MenuItemsWrapper } from "./menu.styled"; +import { + MenuContainer, + LogoWrapper, + MenuItemsWrapper, + ContactUsWrapper, +} from "./menu.styled"; import { KeyvalText } from "@/design.system"; import MenuItem from "../menu.item/menu.item"; import { useRouter } from "next/navigation"; import { OVERVIEW, ROUTES } from "@/utils/constants"; import { MENU_ITEMS } from "./items"; +import ContactUsButton from "../contact.us/contact.us"; export interface MenuItem { id: number; @@ -59,6 +65,9 @@ export function Menu() { {renderMenuItemsList()} + + + ); } diff --git a/frontend/webapp/utils/constants/string.tsx b/frontend/webapp/utils/constants/string.tsx index ec8a22441..653500b2a 100644 --- a/frontend/webapp/utils/constants/string.tsx +++ b/frontend/webapp/utils/constants/string.tsx @@ -88,6 +88,7 @@ export const OVERVIEW = { export const ACTION = { SAVE: "Save", + CONTACT_US: "Contact Us", }; export const NOTIFICATION = { diff --git a/frontend/webapp/utils/constants/urls.tsx b/frontend/webapp/utils/constants/urls.tsx index a22b00441..584f320f7 100644 --- a/frontend/webapp/utils/constants/urls.tsx +++ b/frontend/webapp/utils/constants/urls.tsx @@ -22,4 +22,7 @@ const QUERIES = { API_DESTINATION_TYPES: "apiDestinationTypes", }; -export { API, QUERIES }; +const SLACK_INVITE_LINK = + "https://odigos.slack.com/join/shared_invite/zt-1d7egaz29-Rwv2T8kyzc3mWP8qKobz~A#/shared-invite/email"; + +export { API, QUERIES, SLACK_INVITE_LINK }; From 52f92f08b580eca075d36fa9cb903a8790fb2fa8 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 9 Aug 2023 17:11:06 +0300 Subject: [PATCH 075/374] fixed setup source and destinations list wrapping --- .../destination.list/destination.list.styled.tsx | 11 +++++++++-- .../sources/sources.list/sources.list.styled.tsx | 16 ++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx index 1515a8416..fcc749e55 100644 --- a/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx @@ -10,14 +10,21 @@ export const DestinationTypeTitleWrapper = styled.div` export const DestinationListWrapper = styled.div` width: 100%; - display: flex; - flex-wrap: wrap; + display: grid; + grid-template-columns: repeat(4, 1fr); gap: 24px; ::-webkit-scrollbar { display: none; } -ms-overflow-style: none; scrollbar-width: none; + + @media screen and (max-width: 1500px) { + grid-template-columns: repeat(3, 1fr); + } + @media screen and (max-width: 1150px) { + grid-template-columns: repeat(2, 1fr); + } `; export const EmptyListWrapper = styled.div` diff --git a/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx b/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx index 4e9eab0e3..8dae05be3 100644 --- a/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx +++ b/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx @@ -21,11 +21,23 @@ export const SourcesListWrapper = styled.div` width: 100%; height: 400px; padding-bottom: 300px; - display: flex; - flex-wrap: wrap; gap: 24px; overflow-y: scroll; scrollbar-width: none; + -ms-overflow-style: none; + + display: grid; + grid-template-columns: repeat(4, 1fr); + ::-webkit-scrollbar { + display: none; + } + + @media screen and (max-width: 1500px) { + grid-template-columns: repeat(3, 1fr); + } + @media screen and (max-width: 1150px) { + grid-template-columns: repeat(2, 1fr); + } `; export const EmptyListWrapper = styled.div` From 6095f4db72e665f0b340bfa00655d7e715d3bdee Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 9 Aug 2023 17:21:39 +0300 Subject: [PATCH 076/374] manage destination list set up --- .../destination.list/destination.list.styled.tsx | 16 ++++++++++++++-- .../destination.list/destination.list.styled.tsx | 5 ++++- .../sources/sources.list/sources.list.styled.tsx | 6 +++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx index f172a32f9..ceb5afeb1 100644 --- a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx @@ -1,11 +1,23 @@ import { styled } from "styled-components"; export const ManagedListWrapper = styled.div` - display: flex; - flex-wrap: wrap; + display: grid; gap: 24px; padding: 0px 36px; padding-bottom: 50px; + grid-template-columns: repeat(4, 1fr); + ::-webkit-scrollbar { + display: none; + } + -ms-overflow-style: none; + scrollbar-width: none; + + @media screen and (max-width: 1850px) { + grid-template-columns: repeat(3, 1fr); + } + @media screen and (max-width: 1450px) { + grid-template-columns: repeat(2, 1fr); + } `; export const MenuWrapper = styled.div` diff --git a/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx index fcc749e55..3521015e3 100644 --- a/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx @@ -11,13 +11,16 @@ export const DestinationTypeTitleWrapper = styled.div` export const DestinationListWrapper = styled.div` width: 100%; display: grid; - grid-template-columns: repeat(4, 1fr); + grid-template-columns: repeat(5, 1fr); gap: 24px; ::-webkit-scrollbar { display: none; } -ms-overflow-style: none; scrollbar-width: none; + @media screen and (max-width: 1750px) { + grid-template-columns: repeat(4, 1fr); + } @media screen and (max-width: 1500px) { grid-template-columns: repeat(3, 1fr); diff --git a/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx b/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx index 8dae05be3..6cd703561 100644 --- a/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx +++ b/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx @@ -27,11 +27,15 @@ export const SourcesListWrapper = styled.div` -ms-overflow-style: none; display: grid; - grid-template-columns: repeat(4, 1fr); + grid-template-columns: repeat(5, 1fr); ::-webkit-scrollbar { display: none; } + @media screen and (max-width: 1750px) { + grid-template-columns: repeat(4, 1fr); + } + @media screen and (max-width: 1500px) { grid-template-columns: repeat(3, 1fr); } From 960f16df2d1e926cb9af2c2ecbe7542b9d960cec Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 10 Aug 2023 09:37:45 +0300 Subject: [PATCH 077/374] remove unused code --- .../destination.card/destination.card.styled.tsx | 5 +++++ .../destination/destination.card/destination.card.tsx | 4 +--- .../destination/destination.list/destination.list.tsx | 1 - .../setup/destination/destination.section.tsx | 9 ++++++++- .../containers/setup/setup.header/setup.header.tsx | 2 +- .../containers/setup/setup.section/setup.section.tsx | 10 +++++++--- 6 files changed, 22 insertions(+), 9 deletions(-) diff --git a/frontend/webapp/components/setup/destination/destination.card/destination.card.styled.tsx b/frontend/webapp/components/setup/destination/destination.card/destination.card.styled.tsx index 17e6a2a89..b0ab56a32 100644 --- a/frontend/webapp/components/setup/destination/destination.card/destination.card.styled.tsx +++ b/frontend/webapp/components/setup/destination/destination.card/destination.card.styled.tsx @@ -7,6 +7,11 @@ export const DestinationCardWrapper = styled.div` flex-direction: column; gap: 14px; cursor: pointer; + border: 1px solid transparent; + &:hover { + border-radius: 24px; + border: ${({ theme }) => `1px solid ${theme.colors.secondary}`}; + } `; export const ApplicationNameWrapper = styled.div` diff --git a/frontend/webapp/components/setup/destination/destination.card/destination.card.tsx b/frontend/webapp/components/setup/destination/destination.card/destination.card.tsx index 316f81939..851127e45 100644 --- a/frontend/webapp/components/setup/destination/destination.card/destination.card.tsx +++ b/frontend/webapp/components/setup/destination/destination.card/destination.card.tsx @@ -27,13 +27,11 @@ type Destination = { type DestinationCardProps = { item: Destination; onClick: () => void; - focus: boolean; }; export function DestinationCard({ item: { supported_signals, image_url, display_name }, onClick, - focus, }: DestinationCardProps) { const monitors = useMemo(() => { return Object.entries(supported_signals).reduce((acc, [key, value]) => { @@ -50,7 +48,7 @@ export function DestinationCard({ }, [JSON.stringify(supported_signals)]); return ( - + onItemClick(item)} - focus={sectionData?.type === item?.type} /> )); } diff --git a/frontend/webapp/containers/setup/destination/destination.section.tsx b/frontend/webapp/containers/setup/destination/destination.section.tsx index 854edd779..41e3c8a72 100644 --- a/frontend/webapp/containers/setup/destination/destination.section.tsx +++ b/frontend/webapp/containers/setup/destination/destination.section.tsx @@ -22,11 +22,13 @@ import { getDestinationsTypes } from "@/services"; type DestinationSectionProps = { sectionData?: any; setSectionData: (data: any) => void; + onNext?: () => void; }; export function DestinationSection({ sectionData, setSectionData, + onNext, }: DestinationSectionProps) { const [searchFilter, setSearchFilter] = useState(""); const [dropdownData, setDropdownData] = useState(null); @@ -47,6 +49,11 @@ export function DestinationSection({ }); }, [isError]); + function onItemSelect(item) { + setSectionData(item); + onNext && onNext(); + } + function renderDestinationLists() { sortDestinationList(data); const list = filterDataByMonitorsOption( @@ -73,7 +80,7 @@ export function DestinationSection({ sectionData={sectionData} key={category.name} data={category} - onItemClick={(item: any) => setSectionData(item)} + onItemClick={(item: any) => onItemSelect(item)} /> ) ); diff --git a/frontend/webapp/containers/setup/setup.header/setup.header.tsx b/frontend/webapp/containers/setup/setup.header/setup.header.tsx index 6155e889a..f7ca31104 100644 --- a/frontend/webapp/containers/setup/setup.header/setup.header.tsx +++ b/frontend/webapp/containers/setup/setup.header/setup.header.tsx @@ -80,7 +80,7 @@ export function SetupHeader({ {SETUP.SELECTED} )} - {currentStep?.id !== SETUP.STEPS.ID.CREATE_CONNECTION && ( + {currentStep?.id === SETUP.STEPS.ID.CHOOSE_SOURCE && ( + ) : null; } @@ -110,7 +114,7 @@ export function SetupSection() { {currentStep.index !== 1 && ( - + {SETUP.BACK} From d62193bfa07f6c75803c057c800b52d85543cba3 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 10 Aug 2023 10:22:30 +0300 Subject: [PATCH 078/374] fixed repeat numbers --- .../destination.list/destination.list.styled.tsx | 5 +---- .../destination/destination.list/destination.list.tsx | 3 +++ .../setup/sources/sources.list/sources.list.styled.tsx | 5 +++-- .../components/setup/sources/sources.list/sources.list.tsx | 7 +++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx index 3521015e3..fcc749e55 100644 --- a/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx @@ -11,16 +11,13 @@ export const DestinationTypeTitleWrapper = styled.div` export const DestinationListWrapper = styled.div` width: 100%; display: grid; - grid-template-columns: repeat(5, 1fr); + grid-template-columns: repeat(4, 1fr); gap: 24px; ::-webkit-scrollbar { display: none; } -ms-overflow-style: none; scrollbar-width: none; - @media screen and (max-width: 1750px) { - grid-template-columns: repeat(4, 1fr); - } @media screen and (max-width: 1500px) { grid-template-columns: repeat(3, 1fr); diff --git a/frontend/webapp/components/setup/destination/destination.list/destination.list.tsx b/frontend/webapp/components/setup/destination/destination.list/destination.list.tsx index 4c1a981fd..fa6eb6d14 100644 --- a/frontend/webapp/components/setup/destination/destination.list/destination.list.tsx +++ b/frontend/webapp/components/setup/destination/destination.list/destination.list.tsx @@ -6,6 +6,7 @@ import { DestinationTypeTitleWrapper, } from "./destination.list.styled"; import { capitalizeFirstLetter } from "@/utils/functions"; +import { ROUTES } from "@/utils/constants"; export function DestinationList({ data: { items, name }, @@ -22,6 +23,8 @@ export function DestinationList({ /> )); } + // const getNumberOfItemsRepeated = () => + // window.location.pathname.includes(ROUTES.CREATE_DESTINATION) ? 5 : 4; return items?.length ? ( <> diff --git a/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx b/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx index 6cd703561..39d6b8fe9 100644 --- a/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx +++ b/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx @@ -17,7 +17,7 @@ export const SourcesTitleWrapper = styled.div` margin: 24px 0; `; -export const SourcesListWrapper = styled.div` +export const SourcesListWrapper = styled.div<{ repeat: number }>` width: 100%; height: 400px; padding-bottom: 300px; @@ -27,7 +27,8 @@ export const SourcesListWrapper = styled.div` -ms-overflow-style: none; display: grid; - grid-template-columns: repeat(5, 1fr); + grid-template-columns: ${({ repeat }) => `repeat(${repeat},1fr)`}; + ::-webkit-scrollbar { display: none; } diff --git a/frontend/webapp/components/setup/sources/sources.list/sources.list.tsx b/frontend/webapp/components/setup/sources/sources.list/sources.list.tsx index 1bd2192e1..f50df7ed0 100644 --- a/frontend/webapp/components/setup/sources/sources.list/sources.list.tsx +++ b/frontend/webapp/components/setup/sources/sources.list/sources.list.tsx @@ -7,7 +7,7 @@ import { } from "./sources.list.styled"; import { SourceCard } from "../source.card/source.card"; import { KeyvalLink, KeyvalText } from "@/design.system"; -import { SETUP } from "@/utils/constants"; +import { ROUTES, SETUP } from "@/utils/constants"; import Empty from "@/assets/images/empty-list.svg"; export function SourcesList({ @@ -37,13 +37,16 @@ export function SourcesList({ const isListEmpty = () => data?.length === 0; + const getNumberOfItemsRepeated = () => + window.location.pathname.includes(ROUTES.CREATE_SOURCE) ? 5 : 4; + return !data ? null : ( {`${data?.length} ${SETUP.APPLICATIONS}`} - + {isListEmpty() ? ( From ac1b8f98600780787a0c2d50c59f88c1856d88cb Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 10 Aug 2023 10:24:00 +0300 Subject: [PATCH 079/374] remove comments --- .../setup/destination/destination.list/destination.list.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/frontend/webapp/components/setup/destination/destination.list/destination.list.tsx b/frontend/webapp/components/setup/destination/destination.list/destination.list.tsx index fa6eb6d14..7f84d463b 100644 --- a/frontend/webapp/components/setup/destination/destination.list/destination.list.tsx +++ b/frontend/webapp/components/setup/destination/destination.list/destination.list.tsx @@ -23,8 +23,6 @@ export function DestinationList({ /> )); } - // const getNumberOfItemsRepeated = () => - // window.location.pathname.includes(ROUTES.CREATE_DESTINATION) ? 5 : 4; return items?.length ? ( <> From 883d21b02db6b7c0a953ead336f43c75866ae9f8 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 10 Aug 2023 10:34:22 +0300 Subject: [PATCH 080/374] WIP --- go.work.sum | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/go.work.sum b/go.work.sum index d1575bbee..f4405e992 100644 --- a/go.work.sum +++ b/go.work.sum @@ -244,6 +244,7 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/antlr/antlr4/runtime/Go/antlr v1.4.10/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= @@ -293,8 +294,6 @@ github.com/edenfed/opentelemetry-go-instrumentation-1 v0.0.0-20230730053900-d53d github.com/edenfed/opentelemetry-go-instrumentation-1 v0.0.0-20230730062110-e61bd9fd998e/go.mod h1:SYl3vHPGHMCOfF2bbeRBvtVafzEm5HHHsZc4mS02oyo= github.com/edenfed/opentelemetry-go-instrumentation-1 v0.0.0-20230730063239-1359423cb703/go.mod h1:SYl3vHPGHMCOfF2bbeRBvtVafzEm5HHHsZc4mS02oyo= github.com/edenfed/opentelemetry-go-instrumentation-1 v0.0.0-20230730071335-e3ae9a524206/go.mod h1:SYl3vHPGHMCOfF2bbeRBvtVafzEm5HHHsZc4mS02oyo= -github.com/edenfed/opentelemetry-go-instrumentation-1 v0.0.0-20230730104422-ed0d5aa81b08 h1:pbl9g6FIHZrGQzcRU/Yt6g3WIqAbqbsXK728ztyJRYk= -github.com/edenfed/opentelemetry-go-instrumentation-1 v0.0.0-20230730104422-ed0d5aa81b08/go.mod h1:SYl3vHPGHMCOfF2bbeRBvtVafzEm5HHHsZc4mS02oyo= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw= github.com/emicklei/go-restful/v3 v3.8.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/emicklei/go-restful/v3 v3.10.2 h1:hIovbnmBTLjHXkqEBUz3HGpXZdM7ZrE9fJIZIqlJLqE= @@ -425,7 +424,9 @@ go.opentelemetry.io/otel/trace v1.10.0/go.mod h1:Sij3YYczqAdz+EhmGhE6TpTxUO5/F/A go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= +go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= golang.org/x/arch v0.4.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= From d6f4127aa2df23f80c84f7ff8cef5b3f75dead75 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 10 Aug 2023 10:40:27 +0300 Subject: [PATCH 081/374] focus on hover --- .../destination.list/destination.list.styled.tsx | 2 +- .../sources.manage.list/sources.manage.styled.tsx | 3 ++- .../destination.list/destination.list.styled.tsx | 7 +++++-- .../destination.list/destination.list.tsx | 12 ++++++------ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx index ceb5afeb1..7df255f83 100644 --- a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx @@ -42,7 +42,7 @@ export const CardWrapper = styled.div` flex-direction: column; cursor: pointer; &:hover { - background: var(--dark-mode-dark-1, #07111a81); + border: ${({ theme }) => `1px solid ${theme.colors.secondary}`}; } `; diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx index 9a36b4efa..5666538c4 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx @@ -13,8 +13,9 @@ export const CardWrapper = styled.div` flex-direction: column; gap: 10px; cursor: pointer; + &:hover { - background: var(--dark-mode-dark-1, #07111a81); + border: ${({ theme }) => `1px solid ${theme.colors.secondary}`}; } `; diff --git a/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx index fcc749e55..8802d0155 100644 --- a/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/setup/destination/destination.list/destination.list.styled.tsx @@ -8,16 +8,19 @@ export const DestinationTypeTitleWrapper = styled.div` margin: 24px 0; `; -export const DestinationListWrapper = styled.div` +export const DestinationListWrapper = styled.div<{ repeat: number }>` width: 100%; display: grid; - grid-template-columns: repeat(4, 1fr); + grid-template-columns: ${({ repeat }) => `repeat(${repeat},1fr)`}; gap: 24px; ::-webkit-scrollbar { display: none; } -ms-overflow-style: none; scrollbar-width: none; + @media screen and (max-width: 1700px) { + grid-template-columns: repeat(4, 1fr); + } @media screen and (max-width: 1500px) { grid-template-columns: repeat(3, 1fr); diff --git a/frontend/webapp/components/setup/destination/destination.list/destination.list.tsx b/frontend/webapp/components/setup/destination/destination.list/destination.list.tsx index f92d799e5..8f838552c 100644 --- a/frontend/webapp/components/setup/destination/destination.list/destination.list.tsx +++ b/frontend/webapp/components/setup/destination/destination.list/destination.list.tsx @@ -8,11 +8,7 @@ import { import { capitalizeFirstLetter } from "@/utils/functions"; import { ROUTES } from "@/utils/constants"; -export function DestinationList({ - data: { items, name }, - onItemClick, - sectionData, -}: any) { +export function DestinationList({ data: { items, name }, onItemClick }: any) { function renderList() { return items?.map((item: any, index: number) => ( )); } + const getNumberOfItemsRepeated = () => + window.location.pathname.includes(ROUTES.CREATE_DESTINATION) ? 5 : 4; return items?.length ? ( <> @@ -30,7 +28,9 @@ export function DestinationList({ name )}`} - {renderList()} + + {renderList()} + ) : null; } From 7c0e27a2556c71e317efaa24e038518a1667a837 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 10 Aug 2023 10:46:31 +0300 Subject: [PATCH 082/374] types --- .../setup/destination/destination.section.tsx | 21 ++++++++++++++----- .../setup/setup.section/setup.section.tsx | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/frontend/webapp/containers/setup/destination/destination.section.tsx b/frontend/webapp/containers/setup/destination/destination.section.tsx index 41e3c8a72..18952e541 100644 --- a/frontend/webapp/containers/setup/destination/destination.section.tsx +++ b/frontend/webapp/containers/setup/destination/destination.section.tsx @@ -19,16 +19,27 @@ import { KeyvalLoader } from "@/design.system"; import { useNotification } from "@/hooks"; import { getDestinationsTypes } from "@/services"; +interface DestinationTypes { + image_url: string; + display_name: string; + supported_signals: { + [key: string]: { + supported: boolean; + }; + }; + type: string; +} + type DestinationSectionProps = { sectionData?: any; setSectionData: (data: any) => void; - onNext?: () => void; + onSelectItem?: () => void; }; export function DestinationSection({ sectionData, setSectionData, - onNext, + onSelectItem, }: DestinationSectionProps) { const [searchFilter, setSearchFilter] = useState(""); const [dropdownData, setDropdownData] = useState(null); @@ -49,9 +60,9 @@ export function DestinationSection({ }); }, [isError]); - function onItemSelect(item) { + function handleSelectItem(item: DestinationTypes) { setSectionData(item); - onNext && onNext(); + onSelectItem && onSelectItem(); } function renderDestinationLists() { @@ -80,7 +91,7 @@ export function DestinationSection({ sectionData={sectionData} key={category.name} data={category} - onItemClick={(item: any) => onItemSelect(item)} + onItemClick={(item: DestinationTypes) => handleSelectItem(item)} /> ) ); diff --git a/frontend/webapp/containers/setup/setup.section/setup.section.tsx b/frontend/webapp/containers/setup/setup.section/setup.section.tsx index 5b45368ba..c0578d1e3 100644 --- a/frontend/webapp/containers/setup/setup.section/setup.section.tsx +++ b/frontend/webapp/containers/setup/setup.section/setup.section.tsx @@ -55,7 +55,7 @@ export function SetupSection() { ) : null; } From d2ae59648a7b3dcae0fa54c2bb8289c68bb14e25 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 10 Aug 2023 11:10:10 +0300 Subject: [PATCH 083/374] fixed focus issue --- frontend/webapp/design.system/card/card.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/webapp/design.system/card/card.tsx b/frontend/webapp/design.system/card/card.tsx index 9867a5ae3..9d8110c75 100644 --- a/frontend/webapp/design.system/card/card.tsx +++ b/frontend/webapp/design.system/card/card.tsx @@ -5,5 +5,5 @@ interface CardProps { focus?: any; } export function KeyvalCard(props: CardProps) { - return {props.children}; + return {props.children}; } From 0d38d2a1c51bd630a81a3d3ba58483e5bdde0ea1 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 10 Aug 2023 11:27:23 +0300 Subject: [PATCH 084/374] remove scroll bar on firefox --- .../destination.list/destination.list.styled.tsx | 6 +++++- .../setup/destination/destination.section.styled.tsx | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx index 7df255f83..23b90c4b2 100644 --- a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx @@ -2,10 +2,12 @@ import { styled } from "styled-components"; export const ManagedListWrapper = styled.div` display: grid; - gap: 24px; + grid-gap: 24px; + padding: 0px 36px; padding-bottom: 50px; grid-template-columns: repeat(4, 1fr); + overflow-y: scroll; ::-webkit-scrollbar { display: none; } @@ -17,6 +19,7 @@ export const ManagedListWrapper = styled.div` } @media screen and (max-width: 1450px) { grid-template-columns: repeat(2, 1fr); + height: 75%; } `; @@ -30,6 +33,7 @@ export const MenuWrapper = styled.div` export const CardWrapper = styled.div` display: flex; width: 366px; + height: 190px; padding-top: 32px; padding-bottom: 24px; flex-direction: column; diff --git a/frontend/webapp/containers/setup/destination/destination.section.styled.tsx b/frontend/webapp/containers/setup/destination/destination.section.styled.tsx index 000d3870c..8e6409f0f 100644 --- a/frontend/webapp/containers/setup/destination/destination.section.styled.tsx +++ b/frontend/webapp/containers/setup/destination/destination.section.styled.tsx @@ -6,6 +6,11 @@ export const DestinationListContainer = styled.div` padding-bottom: 300px; margin-top: 24px; overflow: scroll; + ::-webkit-scrollbar { + display: none; + } + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ `; export const EmptyListWrapper = styled.div` From 0a35b8c750fde1ae1f99bf663dabc6ed67fd766d Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 10 Aug 2023 11:46:28 +0300 Subject: [PATCH 085/374] fixed focus issue --- .../setup/sources/sources.list/sources.list.styled.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx b/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx index 39d6b8fe9..100317447 100644 --- a/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx +++ b/frontend/webapp/components/setup/sources/sources.list/sources.list.styled.tsx @@ -25,7 +25,6 @@ export const SourcesListWrapper = styled.div<{ repeat: number }>` overflow-y: scroll; scrollbar-width: none; -ms-overflow-style: none; - display: grid; grid-template-columns: ${({ repeat }) => `repeat(${repeat},1fr)`}; @@ -46,7 +45,7 @@ export const SourcesListWrapper = styled.div<{ repeat: number }>` `; export const EmptyListWrapper = styled.div` - width: 100%; + width: 1168px; display: flex; justify-content: center; align-items: center; From fec0da92ee103a93b63188ccac9071a84be35a3a Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 10 Aug 2023 13:26:52 +0300 Subject: [PATCH 086/374] WIP --- .../destination.list.styled.tsx | 1 - .../sources.manage.styled.tsx | 25 +++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx index 23b90c4b2..a161d7f17 100644 --- a/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx +++ b/frontend/webapp/components/overview/destination/destination.list/destination.list.styled.tsx @@ -3,7 +3,6 @@ import { styled } from "styled-components"; export const ManagedListWrapper = styled.div` display: grid; grid-gap: 24px; - padding: 0px 36px; padding-bottom: 50px; grid-template-columns: repeat(4, 1fr); diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx index 5666538c4..8ac4100ab 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx @@ -28,12 +28,27 @@ export const EmptyListWrapper = styled.div` `; export const ManagedListWrapper = styled.div` - max-height: 72%; - display: flex; - flex-wrap: wrap; + display: grid; + height: 680px; gap: 24px; - padding: 0 36px 0 0; - overflow-y: scroll; + overflow: scroll; + grid-template-columns: repeat(5, 1fr); + ::-webkit-scrollbar { + display: none; + } + -ms-overflow-style: none; + scrollbar-width: none; + + @media screen and (max-width: 1800px) { + grid-template-columns: repeat(4, 1fr); + } + @media screen and (max-width: 1500px) { + grid-template-columns: repeat(3, 1fr); + } + @media screen and (max-width: 1200px) { + grid-template-columns: repeat(2, 1fr); + height: 650px; + } `; export const ManagedContainer = styled.div` From 41f1d1d49843753300f07b1f770a38afc215ebbc Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 10 Aug 2023 13:34:32 +0300 Subject: [PATCH 087/374] WIP --- .../containers/overview/destinations/destinations.styled.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/webapp/containers/overview/destinations/destinations.styled.tsx b/frontend/webapp/containers/overview/destinations/destinations.styled.tsx index 008ad16f7..993600da7 100644 --- a/frontend/webapp/containers/overview/destinations/destinations.styled.tsx +++ b/frontend/webapp/containers/overview/destinations/destinations.styled.tsx @@ -2,6 +2,11 @@ import styled from "styled-components"; export const NewDestinationContainer = styled.div` padding: 20px 36px; + ::-webkit-scrollbar { + display: none; + } + -ms-overflow-style: none; + scrollbar-width: none; `; export const ManageDestinationWrapper = styled.div` From 41d9ec0a606c3e795bce18a6824dcfb3813a441a Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 10 Aug 2023 13:55:30 +0300 Subject: [PATCH 088/374] WIP --- .../sources/sources.manage.list/sources.manage.styled.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx index 8ac4100ab..eef639f38 100644 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx @@ -29,7 +29,6 @@ export const EmptyListWrapper = styled.div` export const ManagedListWrapper = styled.div` display: grid; - height: 680px; gap: 24px; overflow: scroll; grid-template-columns: repeat(5, 1fr); @@ -44,6 +43,7 @@ export const ManagedListWrapper = styled.div` } @media screen and (max-width: 1500px) { grid-template-columns: repeat(3, 1fr); + height: 680px; } @media screen and (max-width: 1200px) { grid-template-columns: repeat(2, 1fr); From eccae083b7d35861624b8eaec5993cd346321ae9 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 24 Aug 2023 17:01:38 +0300 Subject: [PATCH 089/374] WIP --- go.work.sum | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/go.work.sum b/go.work.sum index 44d7b8b51..0cbb2f727 100644 --- a/go.work.sum +++ b/go.work.sum @@ -243,6 +243,7 @@ github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HR github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/antlr/antlr4/runtime/Go/antlr v1.4.10/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= +github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= @@ -257,8 +258,11 @@ github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= github.com/coreos/go-systemd/v22 v22.4.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/edenfed/opentelemetry-go-instrumentation-1 v0.0.0-20230725113008-4107208bd0e5/go.mod h1:SYl3vHPGHMCOfF2bbeRBvtVafzEm5HHHsZc4mS02oyo= github.com/edenfed/opentelemetry-go-instrumentation-1 v0.0.0-20230725115644-40990f7e3c2a/go.mod h1:SYl3vHPGHMCOfF2bbeRBvtVafzEm5HHHsZc4mS02oyo= github.com/edenfed/opentelemetry-go-instrumentation-1 v0.0.0-20230725120751-70c2c88605dd/go.mod h1:SYl3vHPGHMCOfF2bbeRBvtVafzEm5HHHsZc4mS02oyo= @@ -317,12 +321,14 @@ github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+ github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v1.1.1 h1:jxpi2eWoU84wbX9iIEyAeeoac3FLuifZpY9tcNUD9kw= github.com/golang/glog v1.1.1/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= github.com/google/cel-go v0.12.6/go.mod h1:Jk7ljRzLBhkmiAwBoUxB1sZSCVBAzkqPF25olK/iRDw= +github.com/google/cel-go v0.16.0/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -368,18 +374,13 @@ github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFSt github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/prometheus/procfs v0.11.0 h1:5EAgkfkMl659uZPbe9AS2N68a7Cc1TJbPEuGzFuRbyk= github.com/prometheus/procfs v0.11.0/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= @@ -400,13 +401,21 @@ github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtX github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd/api/v3 v3.5.7/go.mod h1:9qew1gCdDDLu+VwmeG+iFpL+QlpHTo7iubavdVDgCAA= +go.etcd.io/etcd/api/v3 v3.5.9/go.mod h1:uyAal843mC8uUVSLWz6eHa/d971iDGnCRpmKd2Z+X8k= go.etcd.io/etcd/client/pkg/v3 v3.5.7/go.mod h1:o0Abi1MK86iad3YrWhgUsbGx1pmTS+hrORWc2CamuhY= +go.etcd.io/etcd/client/pkg/v3 v3.5.9/go.mod h1:y+CzeSmkMpWN2Jyu1npecjB9BBnABxGM4pN8cGuJeL4= go.etcd.io/etcd/client/v2 v2.305.7/go.mod h1:GQGT5Z3TBuAQGvgPfhR7VPySu/SudxmEkRq9BgzFU6s= +go.etcd.io/etcd/client/v2 v2.305.9/go.mod h1:0NBdNx9wbxtEQLwAQtrDHwx58m02vXpDcgSYI2seohQ= go.etcd.io/etcd/client/v3 v3.5.7/go.mod h1:sOWmj9DZUMyAngS7QQwCyAXXAL6WhgTOPLNS/NabQgw= +go.etcd.io/etcd/client/v3 v3.5.9/go.mod h1:i/Eo5LrZ5IKqpbtpPDuaUnDOUv471oDg8cjQaUr2MbA= go.etcd.io/etcd/pkg/v3 v3.5.7/go.mod h1:kcOfWt3Ov9zgYdOiJ/o1Y9zFfLhQjylTgL4Lru8opRo= +go.etcd.io/etcd/pkg/v3 v3.5.9/go.mod h1:BZl0SAShQFk0IpLWR78T/+pyt8AruMHhTNNX73hkNVY= go.etcd.io/etcd/raft/v3 v3.5.7/go.mod h1:TflkAb/8Uy6JFBxcRaH2Fr6Slm9mCPVdI2efzxY96yU= +go.etcd.io/etcd/raft/v3 v3.5.9/go.mod h1:WnFkqzFdZua4LVlVXQEGhmooLeyS7mqzS4Pf4BCVqXg= go.etcd.io/etcd/server/v3 v3.5.7/go.mod h1:gxBgT84issUVBRpZ3XkW1T55NjOb4vZZRI4wVvNhf4A= +go.etcd.io/etcd/server/v3 v3.5.9/go.mod h1:GgI1fQClQCFIzuVjlvdbMxNbnISt90gdfYyqiAIt65g= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.35.0/go.mod h1:h8TWwRAhQpOd0aM5nYsRD8+flnkj+526GEIVlarH7eY= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.1/go.mod h1:9NiG9I2aHTKkcxqCILhjtyNA1QEiCjdBACv4IvrFQ+c= @@ -419,6 +428,7 @@ go.opentelemetry.io/otel/sdk v1.10.0/go.mod h1:vO06iKzD5baltJz1zarxMCNHFpUlUiOy4 go.opentelemetry.io/otel/trace v1.10.0/go.mod h1:Sij3YYczqAdz+EhmGhE6TpTxUO5/F/AzrK+kxfGqySM= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= @@ -431,6 +441,7 @@ golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw= golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -448,8 +459,12 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= +golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -471,9 +486,11 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= @@ -517,15 +534,18 @@ google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGO google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= k8s.io/api v0.27.2/go.mod h1:ENmbocXfBT2ADujUXcBhHV55RIT31IIEvkntP6vZKS4= k8s.io/apimachinery v0.27.2/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= k8s.io/apiserver v0.27.3/go.mod h1:Y61+EaBMVWUBJtxD5//cZ48cHZbQD+yIyV/4iEBhhNA= k8s.io/apiserver v0.27.4/go.mod h1:GDEFRfFZ4/l+pAvwYRnoSfz0K4j3TWiN4WsG2KnRteE= +k8s.io/apiserver v0.28.0/go.mod h1:MvLmtxhQ0Tb1SZk4hfJBjs8iqr5nhYeaFSaoEcz7Lk4= k8s.io/client-go v0.27.2/go.mod h1:tY0gVmUsHrAmjzHX9zs7eCjxcBsf8IiNe7KQ52biTcQ= k8s.io/component-base v0.27.3/go.mod h1:JNiKYcGImpQ44iwSYs6dysxzR9SxIIgQalk4HaCNVUY= k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kms v0.27.3/go.mod h1:VDfnSIK0dk5J+jasbe+kKpb3CQVwlcDeBLyq59P2KyY= k8s.io/kms v0.27.4/go.mod h1:0BY6tkfa+zOP85u8yE7iNNf1Yx7rEZnRQSWLEbsSk+w= +k8s.io/kms v0.28.0/go.mod h1:CNU792ls92v2Ye7Vn1jn+xLqYtUSezDZNVu6PLbJyrU= k8s.io/kube-openapi v0.0.0-20230718181711-3c0fae5ee9fd h1:0tN7VkdcfPGfii8Zl0edopOV08M6XxGlhO29AsPkBHw= k8s.io/kube-openapi v0.0.0-20230718181711-3c0fae5ee9fd/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM= k8s.io/utils v0.0.0-20230711102312-30195339c3c7 h1:ZgnF1KZsYxWIifwSNZFZgNtWE89WI5yiP5WwlfDoIyc= From caa3fa70c3fc85864db74d0e04b6f41572287676 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 10 Mar 2024 13:26:05 +0200 Subject: [PATCH 090/374] chore: wip --- .../sources.manage.card.tsx | 49 +++++++++++++++++++ .../sources.manage.list.tsx | 24 +++++++++ .../sources.manage.styled.tsx | 38 ++++++++++++++ .../containers/overview/sources/sources.tsx | 28 +++++++++++ frontend/webapp/types/sources.tsx | 11 +++++ 5 files changed, 150 insertions(+) create mode 100644 frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx create mode 100644 frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx create mode 100644 frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx create mode 100644 frontend/webapp/containers/overview/sources/sources.tsx create mode 100644 frontend/webapp/types/sources.tsx diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx new file mode 100644 index 000000000..dbd8fe628 --- /dev/null +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx @@ -0,0 +1,49 @@ +import React from "react"; +import { KeyvalImage, KeyvalTag, KeyvalText } from "@/design.system"; +import { CardWrapper } from "./sources.manage.styled"; +import theme from "@/styles/palette"; +import { KIND_COLORS } from "@/styles/global"; +import { SOURCES_LOGOS } from "@/assets/images"; +import { ManagedSource } from "@/types/sources"; + +const TEXT_STYLE: React.CSSProperties = { + textOverflow: "ellipsis", + whiteSpace: "nowrap", + overflow: "hidden", + width: 224, + textAlign: "center", +}; +const LOGO_STYLE: React.CSSProperties = { + padding: 4, + backgroundColor: theme.colors.white, +}; + +interface SourceManagedCardProps { + item: ManagedSource | null; +} +const DEPLOYMENT = "Deployment"; +export default function SourceManagedCard({ + item = null, +}: SourceManagedCardProps) { + return ( + + + + {item?.name} + + + + {item?.namespace} + + + ); +} diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx new file mode 100644 index 000000000..9d7b4bded --- /dev/null +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx @@ -0,0 +1,24 @@ +import React from "react"; +import { ManagedListWrapper, EmptyListWrapper } from "./sources.manage.styled"; +import Empty from "@/assets/images/empty-list.svg"; +import SourceManagedCard from "./sources.manage.card"; + +export function SourcesManagedList({ data = [1, 1, 1, 1] }) { + function renderDestinations() { + return data.map((source: any) => ); + } + + return ( + <> + + {data?.length === 0 ? ( + + + + ) : ( + renderDestinations() + )} + + + ); +} diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx new file mode 100644 index 000000000..cb4f81c3a --- /dev/null +++ b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx @@ -0,0 +1,38 @@ +import { styled } from "styled-components"; + +export const CardWrapper = styled.div` + display: flex; + width: 272px; + height: 152px; + padding-top: 32px; + padding-bottom: 24px; + border-radius: 24px; + border: 1px solid var(--dark-mode-dark-3, #203548); + background: var(--dark-mode-dark-1, #07111a); + align-items: center; + flex-direction: column; + gap: 10px; + cursor: pointer; + &:hover { + background: var(--dark-mode-dark-1, #07111a81); + } +`; + +export const EmptyListWrapper = styled.div` + width: 100%; + margin-top: 130px; + display: flex; + justify-content: center; + align-items: center; +`; + +export const ManagedListWrapper = styled.div` + width: 100%; + display: flex; + flex-wrap: wrap; + gap: 24px; + overflow-y: scroll; + padding: 0px 36px; + padding-bottom: 50px; + margin-top: 88px; +`; diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx new file mode 100644 index 000000000..9164e2704 --- /dev/null +++ b/frontend/webapp/containers/overview/sources/sources.tsx @@ -0,0 +1,28 @@ +"use client"; +import React from "react"; +import { KeyvalLoader } from "@/design.system"; +import { OVERVIEW, QUERIES } from "@/utils/constants"; +import { useQuery } from "react-query"; +import { getSources } from "@/services"; +import { OverviewHeader, SourcesManagedList } from "@/components/overview"; +import { SourcesContainerWrapper } from "./sources.styled"; + +export function SourcesContainer() { + const { + data: sources, + refetch, + isLoading, + } = useQuery([QUERIES.API_SOURCES], getSources); + + if (isLoading) { + return ; + } + console.log({ sources }); + + return ( + + + + + ); +} diff --git a/frontend/webapp/types/sources.tsx b/frontend/webapp/types/sources.tsx new file mode 100644 index 000000000..53f44fe6e --- /dev/null +++ b/frontend/webapp/types/sources.tsx @@ -0,0 +1,11 @@ +export interface ManagedSource { + kind: string; + name: string; + namespace: string; + languages: [ + { + container_name: string; + language: string; + } + ]; +} From 21096f49262a5862b82c43f2dc1342fb7872f940 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 13 Mar 2024 17:04:42 +0200 Subject: [PATCH 091/374] chore: wip --- .../sources.manage.card.tsx | 49 ------------------- .../sources.manage.list.tsx | 24 --------- .../sources.manage.styled.tsx | 38 -------------- .../containers/overview/sources/sources.tsx | 28 ----------- 4 files changed, 139 deletions(-) delete mode 100644 frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx delete mode 100644 frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx delete mode 100644 frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx delete mode 100644 frontend/webapp/containers/overview/sources/sources.tsx diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx deleted file mode 100644 index dbd8fe628..000000000 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.card.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import React from "react"; -import { KeyvalImage, KeyvalTag, KeyvalText } from "@/design.system"; -import { CardWrapper } from "./sources.manage.styled"; -import theme from "@/styles/palette"; -import { KIND_COLORS } from "@/styles/global"; -import { SOURCES_LOGOS } from "@/assets/images"; -import { ManagedSource } from "@/types/sources"; - -const TEXT_STYLE: React.CSSProperties = { - textOverflow: "ellipsis", - whiteSpace: "nowrap", - overflow: "hidden", - width: 224, - textAlign: "center", -}; -const LOGO_STYLE: React.CSSProperties = { - padding: 4, - backgroundColor: theme.colors.white, -}; - -interface SourceManagedCardProps { - item: ManagedSource | null; -} -const DEPLOYMENT = "Deployment"; -export default function SourceManagedCard({ - item = null, -}: SourceManagedCardProps) { - return ( - - - - {item?.name} - - - - {item?.namespace} - - - ); -} diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx deleted file mode 100644 index 9d7b4bded..000000000 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.list.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import React from "react"; -import { ManagedListWrapper, EmptyListWrapper } from "./sources.manage.styled"; -import Empty from "@/assets/images/empty-list.svg"; -import SourceManagedCard from "./sources.manage.card"; - -export function SourcesManagedList({ data = [1, 1, 1, 1] }) { - function renderDestinations() { - return data.map((source: any) => ); - } - - return ( - <> - - {data?.length === 0 ? ( - - - - ) : ( - renderDestinations() - )} - - - ); -} diff --git a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx b/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx deleted file mode 100644 index cb4f81c3a..000000000 --- a/frontend/webapp/components/overview/sources/sources.manage.list/sources.manage.styled.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { styled } from "styled-components"; - -export const CardWrapper = styled.div` - display: flex; - width: 272px; - height: 152px; - padding-top: 32px; - padding-bottom: 24px; - border-radius: 24px; - border: 1px solid var(--dark-mode-dark-3, #203548); - background: var(--dark-mode-dark-1, #07111a); - align-items: center; - flex-direction: column; - gap: 10px; - cursor: pointer; - &:hover { - background: var(--dark-mode-dark-1, #07111a81); - } -`; - -export const EmptyListWrapper = styled.div` - width: 100%; - margin-top: 130px; - display: flex; - justify-content: center; - align-items: center; -`; - -export const ManagedListWrapper = styled.div` - width: 100%; - display: flex; - flex-wrap: wrap; - gap: 24px; - overflow-y: scroll; - padding: 0px 36px; - padding-bottom: 50px; - margin-top: 88px; -`; diff --git a/frontend/webapp/containers/overview/sources/sources.tsx b/frontend/webapp/containers/overview/sources/sources.tsx deleted file mode 100644 index 9164e2704..000000000 --- a/frontend/webapp/containers/overview/sources/sources.tsx +++ /dev/null @@ -1,28 +0,0 @@ -"use client"; -import React from "react"; -import { KeyvalLoader } from "@/design.system"; -import { OVERVIEW, QUERIES } from "@/utils/constants"; -import { useQuery } from "react-query"; -import { getSources } from "@/services"; -import { OverviewHeader, SourcesManagedList } from "@/components/overview"; -import { SourcesContainerWrapper } from "./sources.styled"; - -export function SourcesContainer() { - const { - data: sources, - refetch, - isLoading, - } = useQuery([QUERIES.API_SOURCES], getSources); - - if (isLoading) { - return ; - } - console.log({ sources }); - - return ( - - - - - ); -} From b65cc6410731934bab4206f35bd38f8db606f82a Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 22 Jul 2024 13:18:40 +0300 Subject: [PATCH 092/374] chore: init gql --- frontend/go.mod | 12 +- frontend/go.sum | 39 +- frontend/gqlgen.yml | 25 + frontend/graph/generated.go | 9665 ++++++++++++++++++++++++++++ frontend/graph/model/models_gen.go | 377 ++ frontend/graph/resolver.go | 7 + frontend/graph/schema.graphqls | 235 + frontend/graph/schema.resolvers.go | 105 + frontend/main.go | 11 + 9 files changed, 10469 insertions(+), 7 deletions(-) create mode 100644 frontend/gqlgen.yml create mode 100644 frontend/graph/generated.go create mode 100644 frontend/graph/model/models_gen.go create mode 100644 frontend/graph/resolver.go create mode 100644 frontend/graph/schema.graphqls create mode 100644 frontend/graph/schema.resolvers.go diff --git a/frontend/go.mod b/frontend/go.mod index 1be157957..889e575e9 100644 --- a/frontend/go.mod +++ b/frontend/go.mod @@ -3,6 +3,7 @@ module github.com/odigos-io/odigos/frontend go 1.22.0 require ( + github.com/99designs/gqlgen v0.17.49 github.com/gin-contrib/cors v1.4.0 github.com/gin-gonic/gin v1.9.1 github.com/go-logr/logr v1.4.1 @@ -11,6 +12,7 @@ require ( github.com/odigos-io/odigos/destinations v0.0.0-20240223090638-df3328a088bc github.com/odigos-io/odigos/k8sutils v0.0.0 github.com/stretchr/testify v1.9.0 + github.com/vektah/gqlparser/v2 v2.5.16 go.opentelemetry.io/collector/component v0.104.0 go.opentelemetry.io/collector/confmap v0.104.0 go.opentelemetry.io/collector/exporter v0.104.0 @@ -76,6 +78,7 @@ require ( ) require ( + github.com/agnivade/levenshtein v1.1.1 // indirect github.com/bytedance/sonic v1.9.2 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -97,19 +100,23 @@ require ( github.com/google/gnostic-models v0.6.8 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/uuid v1.6.0 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/imdario/mergo v0.3.12 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/leodido/go-urn v1.2.4 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mattn/go-colorable v0.1.8 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/sosodev/duration v1.3.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect @@ -142,4 +149,5 @@ replace ( github.com/odigos-io/odigos/common => ../common github.com/odigos-io/odigos/destinations => ../destinations github.com/odigos-io/odigos/k8sutils => ../k8sutils + ) diff --git a/frontend/go.sum b/frontend/go.sum index 804963192..a548e5325 100644 --- a/frontend/go.sum +++ b/frontend/go.sum @@ -1,3 +1,15 @@ +github.com/99designs/gqlgen v0.17.49 h1:b3hNGexHd33fBSAd4NDT/c3NCcQzcAVkknhN9ym36YQ= +github.com/99designs/gqlgen v0.17.49/go.mod h1:tC8YFVZMed81x7UJ7ORUwXF4Kn6SXuucFqQBhN8+BU0= +github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4yPeE= +github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk= +github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= +github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss= +github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= @@ -14,6 +26,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= @@ -89,10 +103,14 @@ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJY github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -126,14 +144,18 @@ github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -171,6 +193,10 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4= +github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -192,6 +218,8 @@ github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6 github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/vektah/gqlparser/v2 v2.5.16 h1:1gcmLTvs3JLKXckwCwlUagVn/IlV2bwqle0vJ0vy5p8= +github.com/vektah/gqlparser/v2 v2.5.16/go.mod h1:1lz1OeCqgQbQepsGxPVywrjdBHW2T08PUS3pJqepRww= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opentelemetry.io/collector v0.104.0 h1:R3zjM4O3K3+ttzsjPV75P80xalxRbwYTURlK0ys7uyo= @@ -318,6 +346,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= @@ -336,8 +365,8 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/frontend/gqlgen.yml b/frontend/gqlgen.yml new file mode 100644 index 000000000..f54df5faf --- /dev/null +++ b/frontend/gqlgen.yml @@ -0,0 +1,25 @@ +# Where are all the schema files located? globs are supported eg src/**/*.graphqls +schema: + - graph/*.graphqls + +# Where should the generated server code go? +exec: + filename: graph/generated.go + package: graph + +# Uncomment to enable federation +# federation: +# filename: graph/federation.go +# package: graph + +# Where should any generated models go? +model: + filename: graph/model/models_gen.go + package: model + +# Where should the resolver implementations go? +resolver: + layout: follow-schema + dir: graph + package: graph + filename_template: '{name}.resolvers.go' diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go new file mode 100644 index 000000000..06d30cc55 --- /dev/null +++ b/frontend/graph/generated.go @@ -0,0 +1,9665 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package graph + +import ( + "bytes" + "context" + "embed" + "errors" + "fmt" + "strconv" + "sync" + "sync/atomic" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/introspection" + "github.com/odigos-io/odigos/frontend/graph/model" + gqlparser "github.com/vektah/gqlparser/v2" + "github.com/vektah/gqlparser/v2/ast" +) + +// region ************************** generated!.gotpl ************************** + +// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. +func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { + return &executableSchema{ + schema: cfg.Schema, + resolvers: cfg.Resolvers, + directives: cfg.Directives, + complexity: cfg.Complexity, + } +} + +type Config struct { + Schema *ast.Schema + Resolvers ResolverRoot + Directives DirectiveRoot + Complexity ComplexityRoot +} + +type ResolverRoot interface { + Mutation() MutationResolver + Query() QueryResolver +} + +type DirectiveRoot struct { +} + +type ComplexityRoot struct { + ActualAction struct { + Details func(childComplexity int) int + Disable func(childComplexity int) int + ID func(childComplexity int) int + Kind func(childComplexity int) int + Name func(childComplexity int) int + Notes func(childComplexity int) int + Signals func(childComplexity int) int + } + + ActualDestination struct { + ExportedSignals func(childComplexity int) int + Fields func(childComplexity int) int + ID func(childComplexity int) int + Name func(childComplexity int) int + Type func(childComplexity int) int + } + + ComputePlatform struct { + ActualActions func(childComplexity int) int + ActualDestinations func(childComplexity int) int + ComputePlatformType func(childComplexity int) int + ID func(childComplexity int) int + K8sActualNamespace func(childComplexity int, name string) int + K8sActualNamespaces func(childComplexity int) int + K8sActualSources func(childComplexity int) int + Name func(childComplexity int) int + } + + DesiredDestination struct { + ComputePlatforms func(childComplexity int) int + ExportSignals func(childComplexity int) int + Fields func(childComplexity int) int + ID func(childComplexity int) int + Name func(childComplexity int) int + Type func(childComplexity int) int + } + + DestinationSpecField struct { + Name func(childComplexity int) int + Value func(childComplexity int) int + } + + DestinationType struct { + Category func(childComplexity int) int + DisplayName func(childComplexity int) int + Fields func(childComplexity int) int + Image func(childComplexity int) int + Name func(childComplexity int) int + SupportedSignals func(childComplexity int) int + } + + DestinationTypeCategory struct { + DestinationTypes func(childComplexity int) int + Name func(childComplexity int) int + } + + DestinationTypeField struct { + ComponentProps func(childComplexity int) int + ComponentType func(childComplexity int) int + DisplayName func(childComplexity int) int + InitialValue func(childComplexity int) int + Name func(childComplexity int) int + Secret func(childComplexity int) int + ThumbnailURL func(childComplexity int) int + VideoURL func(childComplexity int) int + } + + K8sActualNamespace struct { + AutoInstrumented func(childComplexity int) int + K8sActualSources func(childComplexity int) int + Name func(childComplexity int) int + } + + K8sActualSource struct { + AutoInstrumented func(childComplexity int) int + CreationTimestamp func(childComplexity int) int + HasInstrumentedApplication func(childComplexity int) int + Kind func(childComplexity int) int + Name func(childComplexity int) int + Namespace func(childComplexity int) int + NumberOfInstances func(childComplexity int) int + ServiceName func(childComplexity int) int + } + + K8sActualSourceRuntimeInfo struct { + MainContainer func(childComplexity int) int + } + + K8sActualSourceRuntimeInfoContainer struct { + ContainerName func(childComplexity int) int + Language func(childComplexity int) int + } + + Mutation struct { + ApplyDesiredDestinationToComputePlatform func(childComplexity int, cpID string, destinationID string) int + ApplyDesiredNamespace func(childComplexity int, cpID string, nsID model.K8sNamespaceID, ns model.K8sDesiredNamespaceInput) int + ApplyDesiredSource func(childComplexity int, cpID string, sourceID model.K8sSourceID, source model.K8sDesiredSourceInput) int + CreateDesiredAction func(childComplexity int, cpID string, action model.DesiredActionInput) int + CreateDesiredDestination func(childComplexity int, destinationType string, destination model.DesiredDestinationInput) int + DeleteActualAction func(childComplexity int, cpID string, actionID string, kind string) int + DeleteDesiredDestination func(childComplexity int, destinationID string) int + DeleteDesiredNamespace func(childComplexity int, cpID string, nsID model.K8sNamespaceID) int + DeleteDesiredSource func(childComplexity int, cpID string, sourceID model.K8sSourceID) int + RemoveDesiredDestinationFromComputePlatform func(childComplexity int, cpID string, destinationID string) int + UpdateDesiredAction func(childComplexity int, cpID string, actionID string, action model.DesiredActionInput) int + UpdateDesiredDestination func(childComplexity int, destinationID string, destination model.DesiredDestinationInput) int + } + + Query struct { + ComputePlatform func(childComplexity int, cpID string) int + ComputePlatforms func(childComplexity int) int + DesiredDestinations func(childComplexity int) int + DestinationTypeCategories func(childComplexity int) int + } +} + +type MutationResolver interface { + ApplyDesiredNamespace(ctx context.Context, cpID string, nsID model.K8sNamespaceID, ns model.K8sDesiredNamespaceInput) (bool, error) + DeleteDesiredNamespace(ctx context.Context, cpID string, nsID model.K8sNamespaceID) (bool, error) + ApplyDesiredSource(ctx context.Context, cpID string, sourceID model.K8sSourceID, source model.K8sDesiredSourceInput) (bool, error) + DeleteDesiredSource(ctx context.Context, cpID string, sourceID model.K8sSourceID) (bool, error) + CreateDesiredDestination(ctx context.Context, destinationType string, destination model.DesiredDestinationInput) (*model.DesiredDestination, error) + UpdateDesiredDestination(ctx context.Context, destinationID string, destination model.DesiredDestinationInput) (*model.DesiredDestination, error) + DeleteDesiredDestination(ctx context.Context, destinationID string) (bool, error) + ApplyDesiredDestinationToComputePlatform(ctx context.Context, cpID string, destinationID string) (bool, error) + RemoveDesiredDestinationFromComputePlatform(ctx context.Context, cpID string, destinationID string) (bool, error) + CreateDesiredAction(ctx context.Context, cpID string, action model.DesiredActionInput) (bool, error) + UpdateDesiredAction(ctx context.Context, cpID string, actionID string, action model.DesiredActionInput) (bool, error) + DeleteActualAction(ctx context.Context, cpID string, actionID string, kind string) (bool, error) +} +type QueryResolver interface { + ComputePlatform(ctx context.Context, cpID string) (*model.ComputePlatform, error) + ComputePlatforms(ctx context.Context) ([]*model.ComputePlatform, error) + DestinationTypeCategories(ctx context.Context) ([]*model.DestinationTypeCategory, error) + DesiredDestinations(ctx context.Context) ([]*model.DesiredDestination, error) +} + +type executableSchema struct { + schema *ast.Schema + resolvers ResolverRoot + directives DirectiveRoot + complexity ComplexityRoot +} + +func (e *executableSchema) Schema() *ast.Schema { + if e.schema != nil { + return e.schema + } + return parsedSchema +} + +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + ec := executionContext{nil, e, 0, 0, nil} + _ = ec + switch typeName + "." + field { + + case "ActualAction.details": + if e.complexity.ActualAction.Details == nil { + break + } + + return e.complexity.ActualAction.Details(childComplexity), true + + case "ActualAction.disable": + if e.complexity.ActualAction.Disable == nil { + break + } + + return e.complexity.ActualAction.Disable(childComplexity), true + + case "ActualAction.id": + if e.complexity.ActualAction.ID == nil { + break + } + + return e.complexity.ActualAction.ID(childComplexity), true + + case "ActualAction.kind": + if e.complexity.ActualAction.Kind == nil { + break + } + + return e.complexity.ActualAction.Kind(childComplexity), true + + case "ActualAction.name": + if e.complexity.ActualAction.Name == nil { + break + } + + return e.complexity.ActualAction.Name(childComplexity), true + + case "ActualAction.notes": + if e.complexity.ActualAction.Notes == nil { + break + } + + return e.complexity.ActualAction.Notes(childComplexity), true + + case "ActualAction.signals": + if e.complexity.ActualAction.Signals == nil { + break + } + + return e.complexity.ActualAction.Signals(childComplexity), true + + case "ActualDestination.exportedSignals": + if e.complexity.ActualDestination.ExportedSignals == nil { + break + } + + return e.complexity.ActualDestination.ExportedSignals(childComplexity), true + + case "ActualDestination.fields": + if e.complexity.ActualDestination.Fields == nil { + break + } + + return e.complexity.ActualDestination.Fields(childComplexity), true + + case "ActualDestination.id": + if e.complexity.ActualDestination.ID == nil { + break + } + + return e.complexity.ActualDestination.ID(childComplexity), true + + case "ActualDestination.name": + if e.complexity.ActualDestination.Name == nil { + break + } + + return e.complexity.ActualDestination.Name(childComplexity), true + + case "ActualDestination.type": + if e.complexity.ActualDestination.Type == nil { + break + } + + return e.complexity.ActualDestination.Type(childComplexity), true + + case "ComputePlatform.actualActions": + if e.complexity.ComputePlatform.ActualActions == nil { + break + } + + return e.complexity.ComputePlatform.ActualActions(childComplexity), true + + case "ComputePlatform.actualDestinations": + if e.complexity.ComputePlatform.ActualDestinations == nil { + break + } + + return e.complexity.ComputePlatform.ActualDestinations(childComplexity), true + + case "ComputePlatform.computePlatformType": + if e.complexity.ComputePlatform.ComputePlatformType == nil { + break + } + + return e.complexity.ComputePlatform.ComputePlatformType(childComplexity), true + + case "ComputePlatform.id": + if e.complexity.ComputePlatform.ID == nil { + break + } + + return e.complexity.ComputePlatform.ID(childComplexity), true + + case "ComputePlatform.k8sActualNamespace": + if e.complexity.ComputePlatform.K8sActualNamespace == nil { + break + } + + args, err := ec.field_ComputePlatform_k8sActualNamespace_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.ComputePlatform.K8sActualNamespace(childComplexity, args["name"].(string)), true + + case "ComputePlatform.k8sActualNamespaces": + if e.complexity.ComputePlatform.K8sActualNamespaces == nil { + break + } + + return e.complexity.ComputePlatform.K8sActualNamespaces(childComplexity), true + + case "ComputePlatform.k8sActualSources": + if e.complexity.ComputePlatform.K8sActualSources == nil { + break + } + + return e.complexity.ComputePlatform.K8sActualSources(childComplexity), true + + case "ComputePlatform.name": + if e.complexity.ComputePlatform.Name == nil { + break + } + + return e.complexity.ComputePlatform.Name(childComplexity), true + + case "DesiredDestination.computePlatforms": + if e.complexity.DesiredDestination.ComputePlatforms == nil { + break + } + + return e.complexity.DesiredDestination.ComputePlatforms(childComplexity), true + + case "DesiredDestination.exportSignals": + if e.complexity.DesiredDestination.ExportSignals == nil { + break + } + + return e.complexity.DesiredDestination.ExportSignals(childComplexity), true + + case "DesiredDestination.fields": + if e.complexity.DesiredDestination.Fields == nil { + break + } + + return e.complexity.DesiredDestination.Fields(childComplexity), true + + case "DesiredDestination.id": + if e.complexity.DesiredDestination.ID == nil { + break + } + + return e.complexity.DesiredDestination.ID(childComplexity), true + + case "DesiredDestination.name": + if e.complexity.DesiredDestination.Name == nil { + break + } + + return e.complexity.DesiredDestination.Name(childComplexity), true + + case "DesiredDestination.type": + if e.complexity.DesiredDestination.Type == nil { + break + } + + return e.complexity.DesiredDestination.Type(childComplexity), true + + case "DestinationSpecField.name": + if e.complexity.DestinationSpecField.Name == nil { + break + } + + return e.complexity.DestinationSpecField.Name(childComplexity), true + + case "DestinationSpecField.value": + if e.complexity.DestinationSpecField.Value == nil { + break + } + + return e.complexity.DestinationSpecField.Value(childComplexity), true + + case "DestinationType.category": + if e.complexity.DestinationType.Category == nil { + break + } + + return e.complexity.DestinationType.Category(childComplexity), true + + case "DestinationType.displayName": + if e.complexity.DestinationType.DisplayName == nil { + break + } + + return e.complexity.DestinationType.DisplayName(childComplexity), true + + case "DestinationType.fields": + if e.complexity.DestinationType.Fields == nil { + break + } + + return e.complexity.DestinationType.Fields(childComplexity), true + + case "DestinationType.image": + if e.complexity.DestinationType.Image == nil { + break + } + + return e.complexity.DestinationType.Image(childComplexity), true + + case "DestinationType.name": + if e.complexity.DestinationType.Name == nil { + break + } + + return e.complexity.DestinationType.Name(childComplexity), true + + case "DestinationType.supportedSignals": + if e.complexity.DestinationType.SupportedSignals == nil { + break + } + + return e.complexity.DestinationType.SupportedSignals(childComplexity), true + + case "DestinationTypeCategory.destinationTypes": + if e.complexity.DestinationTypeCategory.DestinationTypes == nil { + break + } + + return e.complexity.DestinationTypeCategory.DestinationTypes(childComplexity), true + + case "DestinationTypeCategory.name": + if e.complexity.DestinationTypeCategory.Name == nil { + break + } + + return e.complexity.DestinationTypeCategory.Name(childComplexity), true + + case "DestinationTypeField.componentProps": + if e.complexity.DestinationTypeField.ComponentProps == nil { + break + } + + return e.complexity.DestinationTypeField.ComponentProps(childComplexity), true + + case "DestinationTypeField.componentType": + if e.complexity.DestinationTypeField.ComponentType == nil { + break + } + + return e.complexity.DestinationTypeField.ComponentType(childComplexity), true + + case "DestinationTypeField.displayName": + if e.complexity.DestinationTypeField.DisplayName == nil { + break + } + + return e.complexity.DestinationTypeField.DisplayName(childComplexity), true + + case "DestinationTypeField.initialValue": + if e.complexity.DestinationTypeField.InitialValue == nil { + break + } + + return e.complexity.DestinationTypeField.InitialValue(childComplexity), true + + case "DestinationTypeField.name": + if e.complexity.DestinationTypeField.Name == nil { + break + } + + return e.complexity.DestinationTypeField.Name(childComplexity), true + + case "DestinationTypeField.secret": + if e.complexity.DestinationTypeField.Secret == nil { + break + } + + return e.complexity.DestinationTypeField.Secret(childComplexity), true + + case "DestinationTypeField.thumbnailURL": + if e.complexity.DestinationTypeField.ThumbnailURL == nil { + break + } + + return e.complexity.DestinationTypeField.ThumbnailURL(childComplexity), true + + case "DestinationTypeField.videoURL": + if e.complexity.DestinationTypeField.VideoURL == nil { + break + } + + return e.complexity.DestinationTypeField.VideoURL(childComplexity), true + + case "K8sActualNamespace.autoInstrumented": + if e.complexity.K8sActualNamespace.AutoInstrumented == nil { + break + } + + return e.complexity.K8sActualNamespace.AutoInstrumented(childComplexity), true + + case "K8sActualNamespace.k8sActualSources": + if e.complexity.K8sActualNamespace.K8sActualSources == nil { + break + } + + return e.complexity.K8sActualNamespace.K8sActualSources(childComplexity), true + + case "K8sActualNamespace.name": + if e.complexity.K8sActualNamespace.Name == nil { + break + } + + return e.complexity.K8sActualNamespace.Name(childComplexity), true + + case "K8sActualSource.autoInstrumented": + if e.complexity.K8sActualSource.AutoInstrumented == nil { + break + } + + return e.complexity.K8sActualSource.AutoInstrumented(childComplexity), true + + case "K8sActualSource.creationTimestamp": + if e.complexity.K8sActualSource.CreationTimestamp == nil { + break + } + + return e.complexity.K8sActualSource.CreationTimestamp(childComplexity), true + + case "K8sActualSource.hasInstrumentedApplication": + if e.complexity.K8sActualSource.HasInstrumentedApplication == nil { + break + } + + return e.complexity.K8sActualSource.HasInstrumentedApplication(childComplexity), true + + case "K8sActualSource.kind": + if e.complexity.K8sActualSource.Kind == nil { + break + } + + return e.complexity.K8sActualSource.Kind(childComplexity), true + + case "K8sActualSource.name": + if e.complexity.K8sActualSource.Name == nil { + break + } + + return e.complexity.K8sActualSource.Name(childComplexity), true + + case "K8sActualSource.namespace": + if e.complexity.K8sActualSource.Namespace == nil { + break + } + + return e.complexity.K8sActualSource.Namespace(childComplexity), true + + case "K8sActualSource.numberOfInstances": + if e.complexity.K8sActualSource.NumberOfInstances == nil { + break + } + + return e.complexity.K8sActualSource.NumberOfInstances(childComplexity), true + + case "K8sActualSource.serviceName": + if e.complexity.K8sActualSource.ServiceName == nil { + break + } + + return e.complexity.K8sActualSource.ServiceName(childComplexity), true + + case "K8sActualSourceRuntimeInfo.mainContainer": + if e.complexity.K8sActualSourceRuntimeInfo.MainContainer == nil { + break + } + + return e.complexity.K8sActualSourceRuntimeInfo.MainContainer(childComplexity), true + + case "K8sActualSourceRuntimeInfoContainer.containerName": + if e.complexity.K8sActualSourceRuntimeInfoContainer.ContainerName == nil { + break + } + + return e.complexity.K8sActualSourceRuntimeInfoContainer.ContainerName(childComplexity), true + + case "K8sActualSourceRuntimeInfoContainer.language": + if e.complexity.K8sActualSourceRuntimeInfoContainer.Language == nil { + break + } + + return e.complexity.K8sActualSourceRuntimeInfoContainer.Language(childComplexity), true + + case "Mutation.applyDesiredDestinationToComputePlatform": + if e.complexity.Mutation.ApplyDesiredDestinationToComputePlatform == nil { + break + } + + args, err := ec.field_Mutation_applyDesiredDestinationToComputePlatform_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.ApplyDesiredDestinationToComputePlatform(childComplexity, args["cpId"].(string), args["destinationId"].(string)), true + + case "Mutation.applyDesiredNamespace": + if e.complexity.Mutation.ApplyDesiredNamespace == nil { + break + } + + args, err := ec.field_Mutation_applyDesiredNamespace_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.ApplyDesiredNamespace(childComplexity, args["cpId"].(string), args["nsId"].(model.K8sNamespaceID), args["ns"].(model.K8sDesiredNamespaceInput)), true + + case "Mutation.applyDesiredSource": + if e.complexity.Mutation.ApplyDesiredSource == nil { + break + } + + args, err := ec.field_Mutation_applyDesiredSource_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.ApplyDesiredSource(childComplexity, args["cpId"].(string), args["sourceId"].(model.K8sSourceID), args["source"].(model.K8sDesiredSourceInput)), true + + case "Mutation.createDesiredAction": + if e.complexity.Mutation.CreateDesiredAction == nil { + break + } + + args, err := ec.field_Mutation_createDesiredAction_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateDesiredAction(childComplexity, args["cpId"].(string), args["action"].(model.DesiredActionInput)), true + + case "Mutation.createDesiredDestination": + if e.complexity.Mutation.CreateDesiredDestination == nil { + break + } + + args, err := ec.field_Mutation_createDesiredDestination_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateDesiredDestination(childComplexity, args["destinationType"].(string), args["destination"].(model.DesiredDestinationInput)), true + + case "Mutation.deleteActualAction": + if e.complexity.Mutation.DeleteActualAction == nil { + break + } + + args, err := ec.field_Mutation_deleteActualAction_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteActualAction(childComplexity, args["cpId"].(string), args["actionId"].(string), args["kind"].(string)), true + + case "Mutation.deleteDesiredDestination": + if e.complexity.Mutation.DeleteDesiredDestination == nil { + break + } + + args, err := ec.field_Mutation_deleteDesiredDestination_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteDesiredDestination(childComplexity, args["destinationId"].(string)), true + + case "Mutation.deleteDesiredNamespace": + if e.complexity.Mutation.DeleteDesiredNamespace == nil { + break + } + + args, err := ec.field_Mutation_deleteDesiredNamespace_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteDesiredNamespace(childComplexity, args["cpId"].(string), args["nsId"].(model.K8sNamespaceID)), true + + case "Mutation.deleteDesiredSource": + if e.complexity.Mutation.DeleteDesiredSource == nil { + break + } + + args, err := ec.field_Mutation_deleteDesiredSource_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteDesiredSource(childComplexity, args["cpId"].(string), args["sourceId"].(model.K8sSourceID)), true + + case "Mutation.removeDesiredDestinationFromComputePlatform": + if e.complexity.Mutation.RemoveDesiredDestinationFromComputePlatform == nil { + break + } + + args, err := ec.field_Mutation_removeDesiredDestinationFromComputePlatform_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RemoveDesiredDestinationFromComputePlatform(childComplexity, args["cpId"].(string), args["destinationId"].(string)), true + + case "Mutation.updateDesiredAction": + if e.complexity.Mutation.UpdateDesiredAction == nil { + break + } + + args, err := ec.field_Mutation_updateDesiredAction_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateDesiredAction(childComplexity, args["cpId"].(string), args["actionId"].(string), args["action"].(model.DesiredActionInput)), true + + case "Mutation.updateDesiredDestination": + if e.complexity.Mutation.UpdateDesiredDestination == nil { + break + } + + args, err := ec.field_Mutation_updateDesiredDestination_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateDesiredDestination(childComplexity, args["destinationId"].(string), args["destination"].(model.DesiredDestinationInput)), true + + case "Query.computePlatform": + if e.complexity.Query.ComputePlatform == nil { + break + } + + args, err := ec.field_Query_computePlatform_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.ComputePlatform(childComplexity, args["cpId"].(string)), true + + case "Query.computePlatforms": + if e.complexity.Query.ComputePlatforms == nil { + break + } + + return e.complexity.Query.ComputePlatforms(childComplexity), true + + case "Query.desiredDestinations": + if e.complexity.Query.DesiredDestinations == nil { + break + } + + return e.complexity.Query.DesiredDestinations(childComplexity), true + + case "Query.destinationTypeCategories": + if e.complexity.Query.DestinationTypeCategories == nil { + break + } + + return e.complexity.Query.DestinationTypeCategories(childComplexity), true + + } + return 0, false +} + +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetOperationContext(ctx) + ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + inputUnmarshalMap := graphql.BuildUnmarshalerMap( + ec.unmarshalInputDesiredActionInput, + ec.unmarshalInputDesiredDestinationFieldInput, + ec.unmarshalInputDesiredDestinationInput, + ec.unmarshalInputK8sDesiredNamespaceInput, + ec.unmarshalInputK8sDesiredSourceInput, + ec.unmarshalInputK8sNamespaceId, + ec.unmarshalInputK8sSourceId, + ec.unmarshalInputWorkloadInput, + ) + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + var response graphql.Response + var data graphql.Marshaler + if first { + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data = ec._Query(ctx, rc.Operation.SelectionSet) + } else { + if atomic.LoadInt32(&ec.pendingDeferred) > 0 { + result := <-ec.deferredResults + atomic.AddInt32(&ec.pendingDeferred, -1) + data = result.Result + response.Path = result.Path + response.Label = result.Label + response.Errors = result.Errors + } else { + return nil + } + } + var buf bytes.Buffer + data.MarshalGQL(&buf) + response.Data = buf.Bytes() + if atomic.LoadInt32(&ec.deferred) > 0 { + hasNext := atomic.LoadInt32(&ec.pendingDeferred) > 0 + response.HasNext = &hasNext + } + + return &response + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data := ec._Mutation(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) + + return &graphql.Response{ + Data: buf.Bytes(), + } + } + + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +type executionContext struct { + *graphql.OperationContext + *executableSchema + deferred int32 + pendingDeferred int32 + deferredResults chan graphql.DeferredResult +} + +func (ec *executionContext) processDeferredGroup(dg graphql.DeferredGroup) { + atomic.AddInt32(&ec.pendingDeferred, 1) + go func() { + ctx := graphql.WithFreshResponseContext(dg.Context) + dg.FieldSet.Dispatch(ctx) + ds := graphql.DeferredResult{ + Path: dg.Path, + Label: dg.Label, + Result: dg.FieldSet, + Errors: graphql.GetErrors(ctx), + } + // null fields should bubble up + if dg.FieldSet.Invalids > 0 { + ds.Result = graphql.Null + } + ec.deferredResults <- ds + }() +} + +func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapSchema(ec.Schema()), nil +} + +func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil +} + +//go:embed "schema.graphqls" +var sourcesFS embed.FS + +func sourceData(filename string) string { + data, err := sourcesFS.ReadFile(filename) + if err != nil { + panic(fmt.Sprintf("codegen problem: %s not available", filename)) + } + return string(data) +} + +var sources = []*ast.Source{ + {Name: "schema.graphqls", Input: sourceData("schema.graphqls"), BuiltIn: false}, +} +var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// endregion ************************** generated!.gotpl ************************** + +// region ***************************** args.gotpl ***************************** + +func (ec *executionContext) field_ComputePlatform_k8sActualNamespace_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_applyDesiredDestinationToComputePlatform_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["cpId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cpId"] = arg0 + var arg1 string + if tmp, ok := rawArgs["destinationId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationId")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["destinationId"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_applyDesiredNamespace_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["cpId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cpId"] = arg0 + var arg1 model.K8sNamespaceID + if tmp, ok := rawArgs["nsId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nsId")) + arg1, err = ec.unmarshalNK8sNamespaceId2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sNamespaceID(ctx, tmp) + if err != nil { + return nil, err + } + } + args["nsId"] = arg1 + var arg2 model.K8sDesiredNamespaceInput + if tmp, ok := rawArgs["ns"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ns")) + arg2, err = ec.unmarshalNK8sDesiredNamespaceInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sDesiredNamespaceInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["ns"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_applyDesiredSource_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["cpId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cpId"] = arg0 + var arg1 model.K8sSourceID + if tmp, ok := rawArgs["sourceId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sourceId")) + arg1, err = ec.unmarshalNK8sSourceId2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sSourceID(ctx, tmp) + if err != nil { + return nil, err + } + } + args["sourceId"] = arg1 + var arg2 model.K8sDesiredSourceInput + if tmp, ok := rawArgs["source"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("source")) + arg2, err = ec.unmarshalNK8sDesiredSourceInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sDesiredSourceInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["source"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_createDesiredAction_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["cpId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cpId"] = arg0 + var arg1 model.DesiredActionInput + if tmp, ok := rawArgs["action"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("action")) + arg1, err = ec.unmarshalNDesiredActionInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredActionInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["action"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_createDesiredDestination_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["destinationType"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationType")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["destinationType"] = arg0 + var arg1 model.DesiredDestinationInput + if tmp, ok := rawArgs["destination"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destination")) + arg1, err = ec.unmarshalNDesiredDestinationInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["destination"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteActualAction_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["cpId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cpId"] = arg0 + var arg1 string + if tmp, ok := rawArgs["actionId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionId")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["actionId"] = arg1 + var arg2 string + if tmp, ok := rawArgs["kind"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["kind"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteDesiredDestination_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["destinationId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationId")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["destinationId"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteDesiredNamespace_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["cpId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cpId"] = arg0 + var arg1 model.K8sNamespaceID + if tmp, ok := rawArgs["nsId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nsId")) + arg1, err = ec.unmarshalNK8sNamespaceId2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sNamespaceID(ctx, tmp) + if err != nil { + return nil, err + } + } + args["nsId"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteDesiredSource_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["cpId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cpId"] = arg0 + var arg1 model.K8sSourceID + if tmp, ok := rawArgs["sourceId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sourceId")) + arg1, err = ec.unmarshalNK8sSourceId2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sSourceID(ctx, tmp) + if err != nil { + return nil, err + } + } + args["sourceId"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_removeDesiredDestinationFromComputePlatform_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["cpId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cpId"] = arg0 + var arg1 string + if tmp, ok := rawArgs["destinationId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationId")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["destinationId"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateDesiredAction_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["cpId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cpId"] = arg0 + var arg1 string + if tmp, ok := rawArgs["actionId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionId")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["actionId"] = arg1 + var arg2 model.DesiredActionInput + if tmp, ok := rawArgs["action"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("action")) + arg2, err = ec.unmarshalNDesiredActionInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredActionInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["action"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateDesiredDestination_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["destinationId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationId")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["destinationId"] = arg0 + var arg1 model.DesiredDestinationInput + if tmp, ok := rawArgs["destination"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destination")) + arg1, err = ec.unmarshalNDesiredDestinationInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["destination"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_computePlatform_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["cpId"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cpId"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } + } + args["includeDeprecated"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } + } + args["includeDeprecated"] = arg0 + return args, nil +} + +// endregion ***************************** args.gotpl ***************************** + +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + +// region **************************** field.gotpl ***************************** + +func (ec *executionContext) _ActualAction_id(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ActualAction_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ActualAction_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ActualAction", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ActualAction_kind(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ActualAction_kind(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Kind, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ActualAction_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ActualAction", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ActualAction_name(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ActualAction_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ActualAction_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ActualAction", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ActualAction_notes(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ActualAction_notes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Notes, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ActualAction_notes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ActualAction", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ActualAction_disable(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ActualAction_disable(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Disable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ActualAction_disable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ActualAction", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ActualAction_signals(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ActualAction_signals(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Signals, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]model.SignalType) + fc.Result = res + return ec.marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ActualAction_signals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ActualAction", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type SignalType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ActualAction_details(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ActualAction_details(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Details, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ActualAction_details(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ActualAction", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ActualDestination_id(ctx context.Context, field graphql.CollectedField, obj *model.ActualDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ActualDestination_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ActualDestination_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ActualDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ActualDestination_name(ctx context.Context, field graphql.CollectedField, obj *model.ActualDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ActualDestination_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ActualDestination_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ActualDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ActualDestination_type(ctx context.Context, field graphql.CollectedField, obj *model.ActualDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ActualDestination_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.DestinationType) + fc.Result = res + return ec.marshalNDestinationType2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ActualDestination_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ActualDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "category": + return ec.fieldContext_DestinationType_category(ctx, field) + case "name": + return ec.fieldContext_DestinationType_name(ctx, field) + case "displayName": + return ec.fieldContext_DestinationType_displayName(ctx, field) + case "image": + return ec.fieldContext_DestinationType_image(ctx, field) + case "supportedSignals": + return ec.fieldContext_DestinationType_supportedSignals(ctx, field) + case "fields": + return ec.fieldContext_DestinationType_fields(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DestinationType", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ActualDestination_exportedSignals(ctx context.Context, field graphql.CollectedField, obj *model.ActualDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ActualDestination_exportedSignals(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExportedSignals, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]model.SignalType) + fc.Result = res + return ec.marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ActualDestination_exportedSignals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ActualDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type SignalType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ActualDestination_fields(ctx context.Context, field graphql.CollectedField, obj *model.ActualDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ActualDestination_fields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.DestinationSpecField) + fc.Result = res + return ec.marshalNDestinationSpecField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationSpecFieldᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ActualDestination_fields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ActualDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_DestinationSpecField_name(ctx, field) + case "value": + return ec.fieldContext_DestinationSpecField_value(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DestinationSpecField", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ComputePlatform_id(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ComputePlatform_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ComputePlatform", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ComputePlatform_name(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ComputePlatform_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ComputePlatform", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ComputePlatform_computePlatformType(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_computePlatformType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ComputePlatformType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.ComputePlatformType) + fc.Result = res + return ec.marshalNComputePlatformType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ComputePlatform_computePlatformType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ComputePlatform", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ComputePlatformType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ComputePlatform_k8sActualNamespace(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_k8sActualNamespace(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.K8sActualNamespace, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.K8sActualNamespace) + fc.Result = res + return ec.marshalOK8sActualNamespace2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ComputePlatform_k8sActualNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ComputePlatform", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_K8sActualNamespace_name(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) + case "k8sActualSources": + return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sActualNamespace", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_ComputePlatform_k8sActualNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _ComputePlatform_k8sActualNamespaces(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_k8sActualNamespaces(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.K8sActualNamespaces, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.K8sActualNamespace) + fc.Result = res + return ec.marshalNK8sActualNamespace2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ComputePlatform_k8sActualNamespaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ComputePlatform", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_K8sActualNamespace_name(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) + case "k8sActualSources": + return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sActualNamespace", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ComputePlatform_k8sActualSources(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.K8sActualSources, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.K8sActualSource) + fc.Result = res + return ec.marshalNK8sActualSource2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSources(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ComputePlatform", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "namespace": + return ec.fieldContext_K8sActualSource_namespace(ctx, field) + case "kind": + return ec.fieldContext_K8sActualSource_kind(ctx, field) + case "name": + return ec.fieldContext_K8sActualSource_name(ctx, field) + case "serviceName": + return ec.fieldContext_K8sActualSource_serviceName(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) + case "creationTimestamp": + return ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) + case "numberOfInstances": + return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) + case "hasInstrumentedApplication": + return ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sActualSource", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ComputePlatform_actualDestinations(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_actualDestinations(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ActualDestinations, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.ActualDestination) + fc.Result = res + return ec.marshalNActualDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualDestination(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ComputePlatform_actualDestinations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ComputePlatform", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ActualDestination_id(ctx, field) + case "name": + return ec.fieldContext_ActualDestination_name(ctx, field) + case "type": + return ec.fieldContext_ActualDestination_type(ctx, field) + case "exportedSignals": + return ec.fieldContext_ActualDestination_exportedSignals(ctx, field) + case "fields": + return ec.fieldContext_ActualDestination_fields(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ActualDestination", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ComputePlatform_actualActions(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_actualActions(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ActualActions, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.ActualAction) + fc.Result = res + return ec.marshalNActualAction2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualAction(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ComputePlatform_actualActions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ComputePlatform", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ActualAction_id(ctx, field) + case "kind": + return ec.fieldContext_ActualAction_kind(ctx, field) + case "name": + return ec.fieldContext_ActualAction_name(ctx, field) + case "notes": + return ec.fieldContext_ActualAction_notes(ctx, field) + case "disable": + return ec.fieldContext_ActualAction_disable(ctx, field) + case "signals": + return ec.fieldContext_ActualAction_signals(ctx, field) + case "details": + return ec.fieldContext_ActualAction_details(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ActualAction", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DesiredDestination_id(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DesiredDestination_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DesiredDestination_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DesiredDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DesiredDestination_name(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DesiredDestination_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DesiredDestination_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DesiredDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DesiredDestination_type(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DesiredDestination_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.DestinationType) + fc.Result = res + return ec.marshalNDestinationType2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DesiredDestination_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DesiredDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "category": + return ec.fieldContext_DestinationType_category(ctx, field) + case "name": + return ec.fieldContext_DestinationType_name(ctx, field) + case "displayName": + return ec.fieldContext_DestinationType_displayName(ctx, field) + case "image": + return ec.fieldContext_DestinationType_image(ctx, field) + case "supportedSignals": + return ec.fieldContext_DestinationType_supportedSignals(ctx, field) + case "fields": + return ec.fieldContext_DestinationType_fields(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DestinationType", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DesiredDestination_exportSignals(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DesiredDestination_exportSignals(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExportSignals, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]model.SignalType) + fc.Result = res + return ec.marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DesiredDestination_exportSignals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DesiredDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type SignalType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DesiredDestination_fields(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DesiredDestination_fields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.DestinationSpecField) + fc.Result = res + return ec.marshalNDestinationSpecField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationSpecFieldᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DesiredDestination_fields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DesiredDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_DestinationSpecField_name(ctx, field) + case "value": + return ec.fieldContext_DestinationSpecField_value(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DestinationSpecField", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DesiredDestination_computePlatforms(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DesiredDestination_computePlatforms(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ComputePlatforms, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.ComputePlatform) + fc.Result = res + return ec.marshalNComputePlatform2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DesiredDestination_computePlatforms(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DesiredDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ComputePlatform_id(ctx, field) + case "name": + return ec.fieldContext_ComputePlatform_name(ctx, field) + case "computePlatformType": + return ec.fieldContext_ComputePlatform_computePlatformType(ctx, field) + case "k8sActualNamespace": + return ec.fieldContext_ComputePlatform_k8sActualNamespace(ctx, field) + case "k8sActualNamespaces": + return ec.fieldContext_ComputePlatform_k8sActualNamespaces(ctx, field) + case "k8sActualSources": + return ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) + case "actualDestinations": + return ec.fieldContext_ComputePlatform_actualDestinations(ctx, field) + case "actualActions": + return ec.fieldContext_ComputePlatform_actualActions(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ComputePlatform", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationSpecField_name(ctx context.Context, field graphql.CollectedField, obj *model.DestinationSpecField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationSpecField_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationSpecField_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationSpecField", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationSpecField_value(ctx context.Context, field graphql.CollectedField, obj *model.DestinationSpecField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationSpecField_value(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Value, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationSpecField_value(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationSpecField", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationType_category(ctx context.Context, field graphql.CollectedField, obj *model.DestinationType) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationType_category(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Category, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationType_category(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationType", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationType_name(ctx context.Context, field graphql.CollectedField, obj *model.DestinationType) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationType_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationType_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationType", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationType_displayName(ctx context.Context, field graphql.CollectedField, obj *model.DestinationType) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationType_displayName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DisplayName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationType_displayName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationType", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationType_image(ctx context.Context, field graphql.CollectedField, obj *model.DestinationType) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationType_image(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Image, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationType_image(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationType", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationType_supportedSignals(ctx context.Context, field graphql.CollectedField, obj *model.DestinationType) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationType_supportedSignals(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SupportedSignals, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]model.SignalType) + fc.Result = res + return ec.marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationType_supportedSignals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationType", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type SignalType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationType_fields(ctx context.Context, field graphql.CollectedField, obj *model.DestinationType) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationType_fields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.DestinationTypeField) + fc.Result = res + return ec.marshalNDestinationTypeField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeFieldᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationType_fields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationType", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_DestinationTypeField_name(ctx, field) + case "displayName": + return ec.fieldContext_DestinationTypeField_displayName(ctx, field) + case "videoURL": + return ec.fieldContext_DestinationTypeField_videoURL(ctx, field) + case "thumbnailURL": + return ec.fieldContext_DestinationTypeField_thumbnailURL(ctx, field) + case "componentType": + return ec.fieldContext_DestinationTypeField_componentType(ctx, field) + case "componentProps": + return ec.fieldContext_DestinationTypeField_componentProps(ctx, field) + case "secret": + return ec.fieldContext_DestinationTypeField_secret(ctx, field) + case "initialValue": + return ec.fieldContext_DestinationTypeField_initialValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DestinationTypeField", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationTypeCategory_name(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeCategory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypeCategory_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationTypeCategory_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationTypeCategory", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationTypeCategory_destinationTypes(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeCategory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypeCategory_destinationTypes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DestinationTypes, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.DestinationType) + fc.Result = res + return ec.marshalNDestinationType2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationTypeCategory_destinationTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationTypeCategory", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "category": + return ec.fieldContext_DestinationType_category(ctx, field) + case "name": + return ec.fieldContext_DestinationType_name(ctx, field) + case "displayName": + return ec.fieldContext_DestinationType_displayName(ctx, field) + case "image": + return ec.fieldContext_DestinationType_image(ctx, field) + case "supportedSignals": + return ec.fieldContext_DestinationType_supportedSignals(ctx, field) + case "fields": + return ec.fieldContext_DestinationType_fields(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DestinationType", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationTypeField_name(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypeField_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationTypeField_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationTypeField", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationTypeField_displayName(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypeField_displayName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DisplayName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationTypeField_displayName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationTypeField", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationTypeField_videoURL(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypeField_videoURL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.VideoURL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationTypeField_videoURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationTypeField", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationTypeField_thumbnailURL(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypeField_thumbnailURL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ThumbnailURL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationTypeField_thumbnailURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationTypeField", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationTypeField_componentType(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypeField_componentType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ComponentType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationTypeField_componentType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationTypeField", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationTypeField_componentProps(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypeField_componentProps(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ComponentProps, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationTypeField_componentProps(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationTypeField", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationTypeField_secret(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypeField_secret(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Secret, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationTypeField_secret(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationTypeField", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DestinationTypeField_initialValue(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypeField_initialValue(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InitialValue, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DestinationTypeField_initialValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DestinationTypeField", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualNamespace_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualNamespace_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualNamespace_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualNamespace", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualNamespace_autoInstrumented(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AutoInstrumented, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualNamespace_autoInstrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualNamespace", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualNamespace_k8sActualSources(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.K8sActualSources, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.K8sActualSource) + fc.Result = res + return ec.marshalNK8sActualSource2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualNamespace_k8sActualSources(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualNamespace", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "namespace": + return ec.fieldContext_K8sActualSource_namespace(ctx, field) + case "kind": + return ec.fieldContext_K8sActualSource_kind(ctx, field) + case "name": + return ec.fieldContext_K8sActualSource_name(ctx, field) + case "serviceName": + return ec.fieldContext_K8sActualSource_serviceName(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) + case "creationTimestamp": + return ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) + case "numberOfInstances": + return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) + case "hasInstrumentedApplication": + return ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sActualSource", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualSource_namespace(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_namespace(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Namespace, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSource_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualSource_kind(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_kind(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Kind, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.K8sResourceKind) + fc.Result = res + return ec.marshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSource_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type K8sResourceKind does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualSource_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSource_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualSource_serviceName(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_serviceName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ServiceName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSource_serviceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualSource_autoInstrumented(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AutoInstrumented, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualSource_creationTimestamp(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreationTimestamp, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSource_creationTimestamp(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualSource_numberOfInstances(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.NumberOfInstances, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*int) + fc.Result = res + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSource_numberOfInstances(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualSource_hasInstrumentedApplication(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.HasInstrumentedApplication, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSource_hasInstrumentedApplication(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualSourceRuntimeInfo_mainContainer(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSourceRuntimeInfo_mainContainer(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MainContainer, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.K8sActualSourceRuntimeInfoContainer) + fc.Result = res + return ec.marshalOK8sActualSourceRuntimeInfoContainer2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSourceRuntimeInfoContainer(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSourceRuntimeInfo_mainContainer(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSourceRuntimeInfo", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "containerName": + return ec.fieldContext_K8sActualSourceRuntimeInfoContainer_containerName(ctx, field) + case "language": + return ec.fieldContext_K8sActualSourceRuntimeInfoContainer_language(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sActualSourceRuntimeInfoContainer", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer_containerName(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfoContainer) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSourceRuntimeInfoContainer_containerName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ContainerName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSourceRuntimeInfoContainer_containerName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSourceRuntimeInfoContainer", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer_language(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfoContainer) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSourceRuntimeInfoContainer_language(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Language, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.ProgrammingLanguage) + fc.Result = res + return ec.marshalNProgrammingLanguage2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐProgrammingLanguage(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSourceRuntimeInfoContainer_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSourceRuntimeInfoContainer", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ProgrammingLanguage does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Mutation_applyDesiredNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_applyDesiredNamespace(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().ApplyDesiredNamespace(rctx, fc.Args["cpId"].(string), fc.Args["nsId"].(model.K8sNamespaceID), fc.Args["ns"].(model.K8sDesiredNamespaceInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_applyDesiredNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_applyDesiredNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteDesiredNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteDesiredNamespace(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteDesiredNamespace(rctx, fc.Args["cpId"].(string), fc.Args["nsId"].(model.K8sNamespaceID)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteDesiredNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteDesiredNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_applyDesiredSource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_applyDesiredSource(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().ApplyDesiredSource(rctx, fc.Args["cpId"].(string), fc.Args["sourceId"].(model.K8sSourceID), fc.Args["source"].(model.K8sDesiredSourceInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_applyDesiredSource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_applyDesiredSource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteDesiredSource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteDesiredSource(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteDesiredSource(rctx, fc.Args["cpId"].(string), fc.Args["sourceId"].(model.K8sSourceID)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteDesiredSource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteDesiredSource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createDesiredDestination(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createDesiredDestination(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateDesiredDestination(rctx, fc.Args["destinationType"].(string), fc.Args["destination"].(model.DesiredDestinationInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.DesiredDestination) + fc.Result = res + return ec.marshalNDesiredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createDesiredDestination(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_DesiredDestination_id(ctx, field) + case "name": + return ec.fieldContext_DesiredDestination_name(ctx, field) + case "type": + return ec.fieldContext_DesiredDestination_type(ctx, field) + case "exportSignals": + return ec.fieldContext_DesiredDestination_exportSignals(ctx, field) + case "fields": + return ec.fieldContext_DesiredDestination_fields(ctx, field) + case "computePlatforms": + return ec.fieldContext_DesiredDestination_computePlatforms(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DesiredDestination", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createDesiredDestination_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateDesiredDestination(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateDesiredDestination(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateDesiredDestination(rctx, fc.Args["destinationId"].(string), fc.Args["destination"].(model.DesiredDestinationInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.DesiredDestination) + fc.Result = res + return ec.marshalNDesiredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateDesiredDestination(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_DesiredDestination_id(ctx, field) + case "name": + return ec.fieldContext_DesiredDestination_name(ctx, field) + case "type": + return ec.fieldContext_DesiredDestination_type(ctx, field) + case "exportSignals": + return ec.fieldContext_DesiredDestination_exportSignals(ctx, field) + case "fields": + return ec.fieldContext_DesiredDestination_fields(ctx, field) + case "computePlatforms": + return ec.fieldContext_DesiredDestination_computePlatforms(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DesiredDestination", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateDesiredDestination_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteDesiredDestination(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteDesiredDestination(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteDesiredDestination(rctx, fc.Args["destinationId"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteDesiredDestination(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteDesiredDestination_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_applyDesiredDestinationToComputePlatform(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_applyDesiredDestinationToComputePlatform(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().ApplyDesiredDestinationToComputePlatform(rctx, fc.Args["cpId"].(string), fc.Args["destinationId"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_applyDesiredDestinationToComputePlatform(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_applyDesiredDestinationToComputePlatform_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_removeDesiredDestinationFromComputePlatform(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_removeDesiredDestinationFromComputePlatform(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RemoveDesiredDestinationFromComputePlatform(rctx, fc.Args["cpId"].(string), fc.Args["destinationId"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_removeDesiredDestinationFromComputePlatform(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_removeDesiredDestinationFromComputePlatform_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createDesiredAction(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createDesiredAction(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateDesiredAction(rctx, fc.Args["cpId"].(string), fc.Args["action"].(model.DesiredActionInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createDesiredAction(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createDesiredAction_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateDesiredAction(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateDesiredAction(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateDesiredAction(rctx, fc.Args["cpId"].(string), fc.Args["actionId"].(string), fc.Args["action"].(model.DesiredActionInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateDesiredAction(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateDesiredAction_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteActualAction(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteActualAction(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteActualAction(rctx, fc.Args["cpId"].(string), fc.Args["actionId"].(string), fc.Args["kind"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteActualAction(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteActualAction_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_computePlatform(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_computePlatform(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ComputePlatform(rctx, fc.Args["cpId"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.ComputePlatform) + fc.Result = res + return ec.marshalOComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_computePlatform(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ComputePlatform_id(ctx, field) + case "name": + return ec.fieldContext_ComputePlatform_name(ctx, field) + case "computePlatformType": + return ec.fieldContext_ComputePlatform_computePlatformType(ctx, field) + case "k8sActualNamespace": + return ec.fieldContext_ComputePlatform_k8sActualNamespace(ctx, field) + case "k8sActualNamespaces": + return ec.fieldContext_ComputePlatform_k8sActualNamespaces(ctx, field) + case "k8sActualSources": + return ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) + case "actualDestinations": + return ec.fieldContext_ComputePlatform_actualDestinations(ctx, field) + case "actualActions": + return ec.fieldContext_ComputePlatform_actualActions(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ComputePlatform", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_computePlatform_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_computePlatforms(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_computePlatforms(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ComputePlatforms(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.ComputePlatform) + fc.Result = res + return ec.marshalOComputePlatform2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_computePlatforms(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ComputePlatform_id(ctx, field) + case "name": + return ec.fieldContext_ComputePlatform_name(ctx, field) + case "computePlatformType": + return ec.fieldContext_ComputePlatform_computePlatformType(ctx, field) + case "k8sActualNamespace": + return ec.fieldContext_ComputePlatform_k8sActualNamespace(ctx, field) + case "k8sActualNamespaces": + return ec.fieldContext_ComputePlatform_k8sActualNamespaces(ctx, field) + case "k8sActualSources": + return ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) + case "actualDestinations": + return ec.fieldContext_ComputePlatform_actualDestinations(ctx, field) + case "actualActions": + return ec.fieldContext_ComputePlatform_actualActions(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ComputePlatform", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_destinationTypeCategories(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_destinationTypeCategories(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().DestinationTypeCategories(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.DestinationTypeCategory) + fc.Result = res + return ec.marshalODestinationTypeCategory2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeCategory(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_destinationTypeCategories(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_DestinationTypeCategory_name(ctx, field) + case "destinationTypes": + return ec.fieldContext_DestinationTypeCategory_destinationTypes(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DestinationTypeCategory", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_desiredDestinations(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_desiredDestinations(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().DesiredDestinations(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.DesiredDestination) + fc.Result = res + return ec.marshalODesiredDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_desiredDestinations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_DesiredDestination_id(ctx, field) + case "name": + return ec.fieldContext_DesiredDestination_name(ctx, field) + case "type": + return ec.fieldContext_DesiredDestination_type(ctx, field) + case "exportSignals": + return ec.fieldContext_DesiredDestination_exportSignals(ctx, field) + case "fields": + return ec.fieldContext_DesiredDestination_fields(ctx, field) + case "computePlatforms": + return ec.fieldContext_DesiredDestination_computePlatforms(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DesiredDestination", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectType(fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___schema(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectSchema() + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Schema) + fc.Result = res + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "description": + return ec.fieldContext___Schema_description(ctx, field) + case "types": + return ec.fieldContext___Schema_types(ctx, field) + case "queryType": + return ec.fieldContext___Schema_queryType(ctx, field) + case "mutationType": + return ec.fieldContext___Schema_mutationType(ctx, field) + case "subscriptionType": + return ec.fieldContext___Schema_subscriptionType(ctx, field) + case "directives": + return ec.fieldContext___Schema_directives(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_locations(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Locations, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]string) + fc.Result = res + return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __DirectiveLocation does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_args(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_args(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DefaultValue, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_types(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Types(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_queryType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.QueryType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_mutationType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MutationType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SubscriptionType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_directives(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Directives(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Directive) + fc.Result = res + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Directive_name(ctx, field) + case "description": + return ec.fieldContext___Directive_description(ctx, field) + case "locations": + return ec.fieldContext___Directive_locations(ctx, field) + case "args": + return ec.fieldContext___Directive_args(ctx, field) + case "isRepeatable": + return ec.fieldContext___Directive_isRepeatable(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_kind(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Kind(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalN__TypeKind2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __TypeKind does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_fields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Field) + fc.Result = res + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Field_name(ctx, field) + case "description": + return ec.fieldContext___Field_description(ctx, field) + case "args": + return ec.fieldContext___Field_args(ctx, field) + case "type": + return ec.fieldContext___Field_type(ctx, field) + case "isDeprecated": + return ec.fieldContext___Field_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___Field_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_interfaces(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Interfaces(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PossibleTypes(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_enumValues(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.EnumValue) + fc.Result = res + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___EnumValue_name(ctx, field) + case "description": + return ec.fieldContext___EnumValue_description(ctx, field) + case "isDeprecated": + return ec.fieldContext___EnumValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___EnumValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_inputFields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InputFields(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_ofType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.OfType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SpecifiedByURL(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputDesiredActionInput(ctx context.Context, obj interface{}) (model.DesiredActionInput, error) { + var it model.DesiredActionInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"kind", "name", "notes", "disable", "signals", "details"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "kind": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Kind = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "notes": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("notes")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Notes = data + case "disable": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("disable")) + data, err := ec.unmarshalNBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.Disable = data + case "signals": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signals")) + data, err := ec.unmarshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, v) + if err != nil { + return it, err + } + it.Signals = data + case "details": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("details")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Details = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputDesiredDestinationFieldInput(ctx context.Context, obj interface{}) (model.DesiredDestinationFieldInput, error) { + var it model.DesiredDestinationFieldInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "value"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "value": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Value = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputDesiredDestinationInput(ctx context.Context, obj interface{}) (model.DesiredDestinationInput, error) { + var it model.DesiredDestinationInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "exportSignals", "fields"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "exportSignals": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exportSignals")) + data, err := ec.unmarshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, v) + if err != nil { + return it, err + } + it.ExportSignals = data + case "fields": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fields")) + data, err := ec.unmarshalNDesiredDestinationFieldInput2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationFieldInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Fields = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputK8sDesiredNamespaceInput(ctx context.Context, obj interface{}) (model.K8sDesiredNamespaceInput, error) { + var it model.K8sDesiredNamespaceInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"autoInstrument"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "autoInstrument": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("autoInstrument")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.AutoInstrument = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputK8sDesiredSourceInput(ctx context.Context, obj interface{}) (model.K8sDesiredSourceInput, error) { + var it model.K8sDesiredSourceInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"serviceName", "autoInstrument"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "serviceName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("serviceName")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ServiceName = data + case "autoInstrument": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("autoInstrument")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.AutoInstrument = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputK8sNamespaceId(ctx context.Context, obj interface{}) (model.K8sNamespaceID, error) { + var it model.K8sNamespaceID + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputK8sSourceId(ctx context.Context, obj interface{}) (model.K8sSourceID, error) { + var it model.K8sSourceID + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"namespace", "kind", "name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + case "kind": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) + data, err := ec.unmarshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx, v) + if err != nil { + return it, err + } + it.Kind = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputWorkloadInput(ctx context.Context, obj interface{}) (model.WorkloadInput, error) { + var it model.WorkloadInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"kind", "name", "namespace"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "kind": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) + data, err := ec.unmarshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx, v) + if err != nil { + return it, err + } + it.Kind = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + } + } + + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var actualActionImplementors = []string{"ActualAction"} + +func (ec *executionContext) _ActualAction(ctx context.Context, sel ast.SelectionSet, obj *model.ActualAction) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, actualActionImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ActualAction") + case "id": + out.Values[i] = ec._ActualAction_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "kind": + out.Values[i] = ec._ActualAction_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._ActualAction_name(ctx, field, obj) + case "notes": + out.Values[i] = ec._ActualAction_notes(ctx, field, obj) + case "disable": + out.Values[i] = ec._ActualAction_disable(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "signals": + out.Values[i] = ec._ActualAction_signals(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "details": + out.Values[i] = ec._ActualAction_details(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var actualDestinationImplementors = []string{"ActualDestination"} + +func (ec *executionContext) _ActualDestination(ctx context.Context, sel ast.SelectionSet, obj *model.ActualDestination) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, actualDestinationImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ActualDestination") + case "id": + out.Values[i] = ec._ActualDestination_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._ActualDestination_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ec._ActualDestination_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "exportedSignals": + out.Values[i] = ec._ActualDestination_exportedSignals(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "fields": + out.Values[i] = ec._ActualDestination_fields(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var computePlatformImplementors = []string{"ComputePlatform"} + +func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.SelectionSet, obj *model.ComputePlatform) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, computePlatformImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ComputePlatform") + case "id": + out.Values[i] = ec._ComputePlatform_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._ComputePlatform_name(ctx, field, obj) + case "computePlatformType": + out.Values[i] = ec._ComputePlatform_computePlatformType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "k8sActualNamespace": + out.Values[i] = ec._ComputePlatform_k8sActualNamespace(ctx, field, obj) + case "k8sActualNamespaces": + out.Values[i] = ec._ComputePlatform_k8sActualNamespaces(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "k8sActualSources": + out.Values[i] = ec._ComputePlatform_k8sActualSources(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "actualDestinations": + out.Values[i] = ec._ComputePlatform_actualDestinations(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "actualActions": + out.Values[i] = ec._ComputePlatform_actualActions(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var desiredDestinationImplementors = []string{"DesiredDestination"} + +func (ec *executionContext) _DesiredDestination(ctx context.Context, sel ast.SelectionSet, obj *model.DesiredDestination) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, desiredDestinationImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DesiredDestination") + case "id": + out.Values[i] = ec._DesiredDestination_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._DesiredDestination_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ec._DesiredDestination_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "exportSignals": + out.Values[i] = ec._DesiredDestination_exportSignals(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "fields": + out.Values[i] = ec._DesiredDestination_fields(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "computePlatforms": + out.Values[i] = ec._DesiredDestination_computePlatforms(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var destinationSpecFieldImplementors = []string{"DestinationSpecField"} + +func (ec *executionContext) _DestinationSpecField(ctx context.Context, sel ast.SelectionSet, obj *model.DestinationSpecField) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, destinationSpecFieldImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DestinationSpecField") + case "name": + out.Values[i] = ec._DestinationSpecField_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "value": + out.Values[i] = ec._DestinationSpecField_value(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var destinationTypeImplementors = []string{"DestinationType"} + +func (ec *executionContext) _DestinationType(ctx context.Context, sel ast.SelectionSet, obj *model.DestinationType) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, destinationTypeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DestinationType") + case "category": + out.Values[i] = ec._DestinationType_category(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._DestinationType_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "displayName": + out.Values[i] = ec._DestinationType_displayName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "image": + out.Values[i] = ec._DestinationType_image(ctx, field, obj) + case "supportedSignals": + out.Values[i] = ec._DestinationType_supportedSignals(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "fields": + out.Values[i] = ec._DestinationType_fields(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var destinationTypeCategoryImplementors = []string{"DestinationTypeCategory"} + +func (ec *executionContext) _DestinationTypeCategory(ctx context.Context, sel ast.SelectionSet, obj *model.DestinationTypeCategory) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, destinationTypeCategoryImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DestinationTypeCategory") + case "name": + out.Values[i] = ec._DestinationTypeCategory_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "destinationTypes": + out.Values[i] = ec._DestinationTypeCategory_destinationTypes(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var destinationTypeFieldImplementors = []string{"DestinationTypeField"} + +func (ec *executionContext) _DestinationTypeField(ctx context.Context, sel ast.SelectionSet, obj *model.DestinationTypeField) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, destinationTypeFieldImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DestinationTypeField") + case "name": + out.Values[i] = ec._DestinationTypeField_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "displayName": + out.Values[i] = ec._DestinationTypeField_displayName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "videoURL": + out.Values[i] = ec._DestinationTypeField_videoURL(ctx, field, obj) + case "thumbnailURL": + out.Values[i] = ec._DestinationTypeField_thumbnailURL(ctx, field, obj) + case "componentType": + out.Values[i] = ec._DestinationTypeField_componentType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "componentProps": + out.Values[i] = ec._DestinationTypeField_componentProps(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "secret": + out.Values[i] = ec._DestinationTypeField_secret(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "initialValue": + out.Values[i] = ec._DestinationTypeField_initialValue(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var k8sActualNamespaceImplementors = []string{"K8sActualNamespace"} + +func (ec *executionContext) _K8sActualNamespace(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualNamespace) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualNamespaceImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("K8sActualNamespace") + case "name": + out.Values[i] = ec._K8sActualNamespace_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "autoInstrumented": + out.Values[i] = ec._K8sActualNamespace_autoInstrumented(ctx, field, obj) + case "k8sActualSources": + out.Values[i] = ec._K8sActualNamespace_k8sActualSources(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var k8sActualSourceImplementors = []string{"K8sActualSource"} + +func (ec *executionContext) _K8sActualSource(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSource) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("K8sActualSource") + case "namespace": + out.Values[i] = ec._K8sActualSource_namespace(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "kind": + out.Values[i] = ec._K8sActualSource_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._K8sActualSource_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "serviceName": + out.Values[i] = ec._K8sActualSource_serviceName(ctx, field, obj) + case "autoInstrumented": + out.Values[i] = ec._K8sActualSource_autoInstrumented(ctx, field, obj) + case "creationTimestamp": + out.Values[i] = ec._K8sActualSource_creationTimestamp(ctx, field, obj) + case "numberOfInstances": + out.Values[i] = ec._K8sActualSource_numberOfInstances(ctx, field, obj) + case "hasInstrumentedApplication": + out.Values[i] = ec._K8sActualSource_hasInstrumentedApplication(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var k8sActualSourceRuntimeInfoImplementors = []string{"K8sActualSourceRuntimeInfo"} + +func (ec *executionContext) _K8sActualSourceRuntimeInfo(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSourceRuntimeInfo) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceRuntimeInfoImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("K8sActualSourceRuntimeInfo") + case "mainContainer": + out.Values[i] = ec._K8sActualSourceRuntimeInfo_mainContainer(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var k8sActualSourceRuntimeInfoContainerImplementors = []string{"K8sActualSourceRuntimeInfoContainer"} + +func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSourceRuntimeInfoContainer) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceRuntimeInfoContainerImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("K8sActualSourceRuntimeInfoContainer") + case "containerName": + out.Values[i] = ec._K8sActualSourceRuntimeInfoContainer_containerName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "language": + out.Values[i] = ec._K8sActualSourceRuntimeInfoContainer_language(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var mutationImplementors = []string{"Mutation"} + +func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Mutation", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Mutation") + case "applyDesiredNamespace": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_applyDesiredNamespace(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteDesiredNamespace": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteDesiredNamespace(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "applyDesiredSource": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_applyDesiredSource(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteDesiredSource": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteDesiredSource(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createDesiredDestination": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createDesiredDestination(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateDesiredDestination": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateDesiredDestination(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteDesiredDestination": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteDesiredDestination(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "applyDesiredDestinationToComputePlatform": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_applyDesiredDestinationToComputePlatform(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "removeDesiredDestinationFromComputePlatform": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_removeDesiredDestinationFromComputePlatform(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createDesiredAction": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createDesiredAction(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateDesiredAction": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateDesiredAction(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteActualAction": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteActualAction(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var queryImplementors = []string{"Query"} + +func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Query", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Query") + case "computePlatform": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_computePlatform(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "computePlatforms": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_computePlatforms(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "destinationTypeCategories": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_destinationTypeCategories(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "desiredDestinations": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_desiredDestinations(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "__type": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___type(ctx, field) + }) + case "__schema": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___schema(ctx, field) + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __DirectiveImplementors = []string{"__Directive"} + +func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Directive") + case "name": + out.Values[i] = ec.___Directive_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Directive_description(ctx, field, obj) + case "locations": + out.Values[i] = ec.___Directive_locations(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "args": + out.Values[i] = ec.___Directive_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __EnumValueImplementors = []string{"__EnumValue"} + +func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__EnumValue") + case "name": + out.Values[i] = ec.___EnumValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___EnumValue_description(ctx, field, obj) + case "isDeprecated": + out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __FieldImplementors = []string{"__Field"} + +func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Field") + case "name": + out.Values[i] = ec.___Field_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Field_description(ctx, field, obj) + case "args": + out.Values[i] = ec.___Field_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ec.___Field_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isDeprecated": + out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __InputValueImplementors = []string{"__InputValue"} + +func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__InputValue") + case "name": + out.Values[i] = ec.___InputValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___InputValue_description(ctx, field, obj) + case "type": + out.Values[i] = ec.___InputValue_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "defaultValue": + out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __SchemaImplementors = []string{"__Schema"} + +func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Schema") + case "description": + out.Values[i] = ec.___Schema_description(ctx, field, obj) + case "types": + out.Values[i] = ec.___Schema_types(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "queryType": + out.Values[i] = ec.___Schema_queryType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "mutationType": + out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) + case "subscriptionType": + out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) + case "directives": + out.Values[i] = ec.___Schema_directives(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __TypeImplementors = []string{"__Type"} + +func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Type") + case "kind": + out.Values[i] = ec.___Type_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec.___Type_name(ctx, field, obj) + case "description": + out.Values[i] = ec.___Type_description(ctx, field, obj) + case "fields": + out.Values[i] = ec.___Type_fields(ctx, field, obj) + case "interfaces": + out.Values[i] = ec.___Type_interfaces(ctx, field, obj) + case "possibleTypes": + out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) + case "enumValues": + out.Values[i] = ec.___Type_enumValues(ctx, field, obj) + case "inputFields": + out.Values[i] = ec.___Type_inputFields(ctx, field, obj) + case "ofType": + out.Values[i] = ec.___Type_ofType(ctx, field, obj) + case "specifiedByURL": + out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +// endregion **************************** object.gotpl **************************** + +// region ***************************** type.gotpl ***************************** + +func (ec *executionContext) marshalNActualAction2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualAction(ctx context.Context, sel ast.SelectionSet, v []*model.ActualAction) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOActualAction2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualAction(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalNActualDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualDestination(ctx context.Context, sel ast.SelectionSet, v []*model.ActualDestination) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOActualDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualDestination(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNComputePlatform2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ComputePlatform) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx context.Context, sel ast.SelectionSet, v *model.ComputePlatform) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._ComputePlatform(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNComputePlatformType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformType(ctx context.Context, v interface{}) (model.ComputePlatformType, error) { + var res model.ComputePlatformType + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNComputePlatformType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformType(ctx context.Context, sel ast.SelectionSet, v model.ComputePlatformType) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNDesiredActionInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredActionInput(ctx context.Context, v interface{}) (model.DesiredActionInput, error) { + res, err := ec.unmarshalInputDesiredActionInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNDesiredDestination2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx context.Context, sel ast.SelectionSet, v model.DesiredDestination) graphql.Marshaler { + return ec._DesiredDestination(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDesiredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx context.Context, sel ast.SelectionSet, v *model.DesiredDestination) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._DesiredDestination(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNDesiredDestinationFieldInput2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationFieldInputᚄ(ctx context.Context, v interface{}) ([]*model.DesiredDestinationFieldInput, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*model.DesiredDestinationFieldInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNDesiredDestinationFieldInput2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationFieldInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalNDesiredDestinationFieldInput2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationFieldInput(ctx context.Context, v interface{}) (*model.DesiredDestinationFieldInput, error) { + res, err := ec.unmarshalInputDesiredDestinationFieldInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNDesiredDestinationInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationInput(ctx context.Context, v interface{}) (model.DesiredDestinationInput, error) { + res, err := ec.unmarshalInputDesiredDestinationInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNDestinationSpecField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationSpecFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.DestinationSpecField) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNDestinationSpecField2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationSpecField(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNDestinationSpecField2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationSpecField(ctx context.Context, sel ast.SelectionSet, v *model.DestinationSpecField) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._DestinationSpecField(ctx, sel, v) +} + +func (ec *executionContext) marshalNDestinationType2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx context.Context, sel ast.SelectionSet, v []*model.DestinationType) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalODestinationType2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalNDestinationType2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx context.Context, sel ast.SelectionSet, v *model.DestinationType) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._DestinationType(ctx, sel, v) +} + +func (ec *executionContext) marshalNDestinationTypeField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.DestinationTypeField) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNDestinationTypeField2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeField(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNDestinationTypeField2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeField(ctx context.Context, sel ast.SelectionSet, v *model.DestinationTypeField) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._DestinationTypeField(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalID(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalID(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNK8sActualNamespace2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx context.Context, sel ast.SelectionSet, v []*model.K8sActualNamespace) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOK8sActualNamespace2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalNK8sActualSource2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx context.Context, sel ast.SelectionSet, v []*model.K8sActualSource) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOK8sActualSource2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) unmarshalNK8sDesiredNamespaceInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sDesiredNamespaceInput(ctx context.Context, v interface{}) (model.K8sDesiredNamespaceInput, error) { + res, err := ec.unmarshalInputK8sDesiredNamespaceInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNK8sDesiredSourceInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sDesiredSourceInput(ctx context.Context, v interface{}) (model.K8sDesiredSourceInput, error) { + res, err := ec.unmarshalInputK8sDesiredSourceInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNK8sNamespaceId2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sNamespaceID(ctx context.Context, v interface{}) (model.K8sNamespaceID, error) { + res, err := ec.unmarshalInputK8sNamespaceId(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx context.Context, v interface{}) (model.K8sResourceKind, error) { + var res model.K8sResourceKind + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx context.Context, sel ast.SelectionSet, v model.K8sResourceKind) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNK8sSourceId2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sSourceID(ctx context.Context, v interface{}) (model.K8sSourceID, error) { + res, err := ec.unmarshalInputK8sSourceId(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNProgrammingLanguage2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐProgrammingLanguage(ctx context.Context, v interface{}) (model.ProgrammingLanguage, error) { + var res model.ProgrammingLanguage + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNProgrammingLanguage2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐProgrammingLanguage(ctx context.Context, sel ast.SelectionSet, v model.ProgrammingLanguage) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNSignalType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalType(ctx context.Context, v interface{}) (model.SignalType, error) { + var res model.SignalType + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNSignalType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalType(ctx context.Context, sel ast.SelectionSet, v model.SignalType) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx context.Context, v interface{}) ([]model.SignalType, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]model.SignalType, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNSignalType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalType(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []model.SignalType) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNSignalType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { + return ec.___Directive(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__DirectiveLocation2string(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { + return ec.___EnumValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { + return ec.___Field(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { + return ec.___InputValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { + return ec.___Type(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec.___Type(ctx, sel, v) +} + +func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalOActualAction2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualAction(ctx context.Context, sel ast.SelectionSet, v *model.ActualAction) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ActualAction(ctx, sel, v) +} + +func (ec *executionContext) marshalOActualDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualDestination(ctx context.Context, sel ast.SelectionSet, v *model.ActualDestination) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ActualDestination(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + return res +} + +func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalBoolean(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalBoolean(*v) + return res +} + +func (ec *executionContext) marshalOComputePlatform2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx context.Context, sel ast.SelectionSet, v []*model.ComputePlatform) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalOComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx context.Context, sel ast.SelectionSet, v *model.ComputePlatform) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ComputePlatform(ctx, sel, v) +} + +func (ec *executionContext) marshalODesiredDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx context.Context, sel ast.SelectionSet, v []*model.DesiredDestination) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalODesiredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalODesiredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx context.Context, sel ast.SelectionSet, v *model.DesiredDestination) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._DesiredDestination(ctx, sel, v) +} + +func (ec *executionContext) marshalODestinationType2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx context.Context, sel ast.SelectionSet, v *model.DestinationType) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._DestinationType(ctx, sel, v) +} + +func (ec *executionContext) marshalODestinationTypeCategory2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeCategory(ctx context.Context, sel ast.SelectionSet, v []*model.DestinationTypeCategory) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalODestinationTypeCategory2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeCategory(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalODestinationTypeCategory2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeCategory(ctx context.Context, sel ast.SelectionSet, v *model.DestinationTypeCategory) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._DestinationTypeCategory(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interface{}) (*int, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalInt(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalInt(*v) + return res +} + +func (ec *executionContext) marshalOK8sActualNamespace2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx context.Context, sel ast.SelectionSet, v *model.K8sActualNamespace) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._K8sActualNamespace(ctx, sel, v) +} + +func (ec *executionContext) marshalOK8sActualSource2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx context.Context, sel ast.SelectionSet, v *model.K8sActualSource) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._K8sActualSource(ctx, sel, v) +} + +func (ec *executionContext) marshalOK8sActualSourceRuntimeInfoContainer2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSourceRuntimeInfoContainer(ctx context.Context, sel ast.SelectionSet, v *model.K8sActualSourceRuntimeInfoContainer) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._K8sActualSourceRuntimeInfoContainer(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalString(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalString(*v) + return res +} + +func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Schema(ctx, sel, v) +} + +func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Type(ctx, sel, v) +} + +// endregion ***************************** type.gotpl ***************************** diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go new file mode 100644 index 000000000..f6da0e88c --- /dev/null +++ b/frontend/graph/model/models_gen.go @@ -0,0 +1,377 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package model + +import ( + "fmt" + "io" + "strconv" +) + +type ActualAction struct { + ID string `json:"id"` + Kind string `json:"kind"` + Name *string `json:"name,omitempty"` + Notes *string `json:"notes,omitempty"` + Disable bool `json:"disable"` + Signals []SignalType `json:"signals"` + Details string `json:"details"` +} + +type ActualDestination struct { + ID string `json:"id"` + Name string `json:"name"` + Type *DestinationType `json:"type"` + ExportedSignals []SignalType `json:"exportedSignals"` + Fields []*DestinationSpecField `json:"fields"` +} + +type ComputePlatform struct { + ID string `json:"id"` + Name *string `json:"name,omitempty"` + ComputePlatformType ComputePlatformType `json:"computePlatformType"` + K8sActualNamespace *K8sActualNamespace `json:"k8sActualNamespace,omitempty"` + K8sActualNamespaces []*K8sActualNamespace `json:"k8sActualNamespaces"` + K8sActualSources []*K8sActualSource `json:"k8sActualSources"` + ActualDestinations []*ActualDestination `json:"actualDestinations"` + ActualActions []*ActualAction `json:"actualActions"` +} + +type DesiredActionInput struct { + Kind string `json:"kind"` + Name *string `json:"name,omitempty"` + Notes *string `json:"notes,omitempty"` + Disable bool `json:"disable"` + Signals []SignalType `json:"signals"` + Details string `json:"details"` +} + +type DesiredDestination struct { + ID string `json:"id"` + Name string `json:"name"` + Type *DestinationType `json:"type"` + ExportSignals []SignalType `json:"exportSignals"` + Fields []*DestinationSpecField `json:"fields"` + ComputePlatforms []*ComputePlatform `json:"computePlatforms"` +} + +type DesiredDestinationFieldInput struct { + Name string `json:"name"` + Value string `json:"value"` +} + +type DesiredDestinationInput struct { + Name string `json:"name"` + ExportSignals []SignalType `json:"exportSignals"` + Fields []*DesiredDestinationFieldInput `json:"fields"` +} + +type DestinationSpecField struct { + Name string `json:"name"` + Value string `json:"value"` +} + +type DestinationType struct { + Category string `json:"category"` + Name string `json:"name"` + DisplayName string `json:"displayName"` + Image *string `json:"image,omitempty"` + SupportedSignals []SignalType `json:"supportedSignals"` + Fields []*DestinationTypeField `json:"fields"` +} + +type DestinationTypeCategory struct { + Name string `json:"name"` + DestinationTypes []*DestinationType `json:"destinationTypes"` +} + +type DestinationTypeField struct { + Name string `json:"name"` + DisplayName string `json:"displayName"` + VideoURL *string `json:"videoURL,omitempty"` + ThumbnailURL *string `json:"thumbnailURL,omitempty"` + ComponentType string `json:"componentType"` + ComponentProps string `json:"componentProps"` + Secret bool `json:"secret"` + InitialValue *string `json:"initialValue,omitempty"` +} + +type K8sActualNamespace struct { + Name string `json:"name"` + AutoInstrumented *bool `json:"autoInstrumented,omitempty"` + K8sActualSources []*K8sActualSource `json:"k8sActualSources"` +} + +type K8sActualSource struct { + Namespace string `json:"namespace"` + Kind K8sResourceKind `json:"kind"` + Name string `json:"name"` + ServiceName *string `json:"serviceName,omitempty"` + AutoInstrumented *bool `json:"autoInstrumented,omitempty"` + CreationTimestamp *string `json:"creationTimestamp,omitempty"` + NumberOfInstances *int `json:"numberOfInstances,omitempty"` + HasInstrumentedApplication bool `json:"hasInstrumentedApplication"` +} + +type K8sActualSourceRuntimeInfo struct { + MainContainer *K8sActualSourceRuntimeInfoContainer `json:"mainContainer,omitempty"` +} + +type K8sActualSourceRuntimeInfoContainer struct { + ContainerName string `json:"containerName"` + Language ProgrammingLanguage `json:"language"` +} + +type K8sDesiredNamespaceInput struct { + AutoInstrument *bool `json:"autoInstrument,omitempty"` +} + +type K8sDesiredSourceInput struct { + ServiceName *string `json:"serviceName,omitempty"` + AutoInstrument *bool `json:"autoInstrument,omitempty"` +} + +type K8sNamespaceID struct { + Name string `json:"name"` +} + +type K8sSourceID struct { + Namespace string `json:"namespace"` + Kind K8sResourceKind `json:"kind"` + Name string `json:"name"` +} + +type Mutation struct { +} + +type Query struct { +} + +type WorkloadInput struct { + Kind K8sResourceKind `json:"kind"` + Name string `json:"name"` + Namespace string `json:"namespace"` +} + +type ComputePlatformType string + +const ( + ComputePlatformTypeK8s ComputePlatformType = "K8S" + ComputePlatformTypeVM ComputePlatformType = "VM" +) + +var AllComputePlatformType = []ComputePlatformType{ + ComputePlatformTypeK8s, + ComputePlatformTypeVM, +} + +func (e ComputePlatformType) IsValid() bool { + switch e { + case ComputePlatformTypeK8s, ComputePlatformTypeVM: + return true + } + return false +} + +func (e ComputePlatformType) String() string { + return string(e) +} + +func (e *ComputePlatformType) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = ComputePlatformType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid ComputePlatformType", str) + } + return nil +} + +func (e ComputePlatformType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type K8sResourceKind string + +const ( + K8sResourceKindDeployment K8sResourceKind = "Deployment" + K8sResourceKindDaemonSet K8sResourceKind = "DaemonSet" + K8sResourceKindStatefulSet K8sResourceKind = "StatefulSet" +) + +var AllK8sResourceKind = []K8sResourceKind{ + K8sResourceKindDeployment, + K8sResourceKindDaemonSet, + K8sResourceKindStatefulSet, +} + +func (e K8sResourceKind) IsValid() bool { + switch e { + case K8sResourceKindDeployment, K8sResourceKindDaemonSet, K8sResourceKindStatefulSet: + return true + } + return false +} + +func (e K8sResourceKind) String() string { + return string(e) +} + +func (e *K8sResourceKind) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = K8sResourceKind(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid K8sResourceKind", str) + } + return nil +} + +func (e K8sResourceKind) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type ProgrammingLanguage string + +const ( + ProgrammingLanguageUnspecified ProgrammingLanguage = "Unspecified" + ProgrammingLanguageJava ProgrammingLanguage = "Java" + ProgrammingLanguageGo ProgrammingLanguage = "Go" + ProgrammingLanguageJavaScript ProgrammingLanguage = "JavaScript" + ProgrammingLanguagePython ProgrammingLanguage = "Python" + ProgrammingLanguageDotNet ProgrammingLanguage = "DotNet" +) + +var AllProgrammingLanguage = []ProgrammingLanguage{ + ProgrammingLanguageUnspecified, + ProgrammingLanguageJava, + ProgrammingLanguageGo, + ProgrammingLanguageJavaScript, + ProgrammingLanguagePython, + ProgrammingLanguageDotNet, +} + +func (e ProgrammingLanguage) IsValid() bool { + switch e { + case ProgrammingLanguageUnspecified, ProgrammingLanguageJava, ProgrammingLanguageGo, ProgrammingLanguageJavaScript, ProgrammingLanguagePython, ProgrammingLanguageDotNet: + return true + } + return false +} + +func (e ProgrammingLanguage) String() string { + return string(e) +} + +func (e *ProgrammingLanguage) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = ProgrammingLanguage(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid ProgrammingLanguage", str) + } + return nil +} + +func (e ProgrammingLanguage) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type SignalType string + +const ( + SignalTypeTraces SignalType = "TRACES" + SignalTypeMetrics SignalType = "METRICS" + SignalTypeLogs SignalType = "LOGS" +) + +var AllSignalType = []SignalType{ + SignalTypeTraces, + SignalTypeMetrics, + SignalTypeLogs, +} + +func (e SignalType) IsValid() bool { + switch e { + case SignalTypeTraces, SignalTypeMetrics, SignalTypeLogs: + return true + } + return false +} + +func (e SignalType) String() string { + return string(e) +} + +func (e *SignalType) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = SignalType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid SignalType", str) + } + return nil +} + +func (e SignalType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type SpanKind string + +const ( + SpanKindInternal SpanKind = "Internal" + SpanKindServer SpanKind = "Server" + SpanKindClient SpanKind = "Client" + SpanKindProducer SpanKind = "Producer" + SpanKindConsumer SpanKind = "Consumer" +) + +var AllSpanKind = []SpanKind{ + SpanKindInternal, + SpanKindServer, + SpanKindClient, + SpanKindProducer, + SpanKindConsumer, +} + +func (e SpanKind) IsValid() bool { + switch e { + case SpanKindInternal, SpanKindServer, SpanKindClient, SpanKindProducer, SpanKindConsumer: + return true + } + return false +} + +func (e SpanKind) String() string { + return string(e) +} + +func (e *SpanKind) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = SpanKind(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid SpanKind", str) + } + return nil +} + +func (e SpanKind) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} diff --git a/frontend/graph/resolver.go b/frontend/graph/resolver.go new file mode 100644 index 000000000..a25c09c61 --- /dev/null +++ b/frontend/graph/resolver.go @@ -0,0 +1,7 @@ +package graph + +// This file will not be regenerated automatically. +// +// It serves as dependency injection for your app, add any dependencies you require here. + +type Resolver struct{} diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls new file mode 100644 index 000000000..d03d61729 --- /dev/null +++ b/frontend/graph/schema.graphqls @@ -0,0 +1,235 @@ +enum ComputePlatformType { + K8S + VM +} + +enum K8sResourceKind { + Deployment + DaemonSet + StatefulSet +} + +enum ProgrammingLanguage { + Unspecified + Java + Go + JavaScript + Python + DotNet +} + +enum SignalType { + TRACES + METRICS + LOGS +} + +enum SpanKind { + Internal + Server + Client + Producer + Consumer +} + +type K8sActualNamespace { + name: String! + autoInstrumented: Boolean + + k8sActualSources: [K8sActualSource]! +} + +input K8sDesiredNamespaceInput { + autoInstrument: Boolean +} +input K8sNamespaceId { + name: String! +} + +type K8sActualSource { + namespace: String! + kind: K8sResourceKind! + name: String! + serviceName: String + autoInstrumented: Boolean + creationTimestamp: String + numberOfInstances: Int + # Odigos records an array of runtime infos. + # currently we only keep the first one assuming it is the user's app. + hasInstrumentedApplication: Boolean! +} +type K8sActualSourceRuntimeInfo { + mainContainer: K8sActualSourceRuntimeInfoContainer +} +type K8sActualSourceRuntimeInfoContainer { + containerName: String! + language: ProgrammingLanguage! +} + +input K8sDesiredSourceInput { + serviceName: String + autoInstrument: Boolean +} +input K8sSourceId { + namespace: String! + kind: K8sResourceKind! + name: String! +} + +type DestinationSpecField { + name: String! + value: String! +} +type ActualDestination { + id: ID! + name: String! + type: DestinationType! + exportedSignals: [SignalType!]! + fields: [DestinationSpecField!]! +} +type DesiredDestination { + id: ID! + name: String! + type: DestinationType! + exportSignals: [SignalType!]! + fields: [DestinationSpecField!]! + + # compute platforms that include this destination + computePlatforms: [ComputePlatform!]! +} +input DesiredDestinationFieldInput { + name: String! + value: String! +} +input DesiredDestinationInput { + name: String! + exportSignals: [SignalType!]! + fields: [DesiredDestinationFieldInput!]! +} + +type DestinationTypeField { + name: String! + displayName: String! + videoURL: String + thumbnailURL: String + componentType: String! + # componentProps is JSON stringified data as text + componentProps: String! + secret: Boolean! + initialValue: String +} +type DestinationType { + # category is currently "managed" or "self hosted" + category: String! + # the name of the destination type (prometheus, jaeger, etc) + name: String! + # same destination type "name", but used for display (for example can contain spaces) + displayName: String! + + # name of an image file to be used for this destination type + # the image themselves are stored [here](https://s3.console.aws.amazon.com/s3/buckets/odigos-destinations) + image: String + + # the signals that this destination type supports + supportedSignals: [SignalType!]! + + fields: [DestinationTypeField!]! +} +type DestinationTypeCategory { + # the name of the category + name: String! + destinationTypes: [DestinationType]! +} + +type ComputePlatform { + id: ID! + name: String + computePlatformType: ComputePlatformType! + + k8sActualNamespace(name: String!): K8sActualNamespace + k8sActualNamespaces: [K8sActualNamespace]! + k8sActualSources: [K8sActualSource]! + + # destinations that are applied to this compute platform + actualDestinations: [ActualDestination]! + actualActions: [ActualAction]! +} + +# Define the input type for Workload +input WorkloadInput { + kind: K8sResourceKind! + name: String! + namespace: String! +} + +input DesiredActionInput { + kind: String! + name: String + notes: String + disable: Boolean! + signals: [SignalType!]! + details: String! +} + +type ActualAction { + id: ID! + kind: String! + name: String + notes: String + disable: Boolean! + signals: [SignalType!]! + details: String! +} + +type Query { + computePlatform(cpId: ID!): ComputePlatform + computePlatforms: [ComputePlatform] + destinationTypeCategories: [DestinationTypeCategory] + desiredDestinations: [DesiredDestination] +} + +type Mutation { + # desired namespace mutations + applyDesiredNamespace( + cpId: ID! + nsId: K8sNamespaceId! + ns: K8sDesiredNamespaceInput! + ): Boolean! + deleteDesiredNamespace(cpId: ID!, nsId: K8sNamespaceId!): Boolean! + + #k8s desired source mutations + applyDesiredSource( + cpId: ID! + sourceId: K8sSourceId! + source: K8sDesiredSourceInput! + ): Boolean! + deleteDesiredSource(cpId: ID!, sourceId: K8sSourceId!): Boolean! + + # desired destination mutations + createDesiredDestination( + destinationType: String! + destination: DesiredDestinationInput! + ): DesiredDestination! + updateDesiredDestination( + destinationId: ID! + destination: DesiredDestinationInput! + ): DesiredDestination! + deleteDesiredDestination(destinationId: ID!): Boolean! + applyDesiredDestinationToComputePlatform( + cpId: ID! + destinationId: ID! + ): Boolean! + removeDesiredDestinationFromComputePlatform( + cpId: ID! + destinationId: ID! + ): Boolean! + + # actions mutations + createDesiredAction(cpId: ID!, action: DesiredActionInput!): Boolean! + updateDesiredAction( + cpId: ID! + actionId: String! + action: DesiredActionInput! + ): Boolean! + deleteActualAction(cpId: ID!, actionId: String!, kind: String!): Boolean! +} diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go new file mode 100644 index 000000000..473e81de6 --- /dev/null +++ b/frontend/graph/schema.resolvers.go @@ -0,0 +1,105 @@ +package graph + +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.49 + +import ( + "context" + "fmt" + + "github.com/odigos-io/odigos/frontend/graph/model" +) + +// ApplyDesiredNamespace is the resolver for the applyDesiredNamespace field. +func (r *mutationResolver) ApplyDesiredNamespace(ctx context.Context, cpID string, nsID model.K8sNamespaceID, ns model.K8sDesiredNamespaceInput) (bool, error) { + panic(fmt.Errorf("not implemented: ApplyDesiredNamespace - applyDesiredNamespace")) +} + +// DeleteDesiredNamespace is the resolver for the deleteDesiredNamespace field. +func (r *mutationResolver) DeleteDesiredNamespace(ctx context.Context, cpID string, nsID model.K8sNamespaceID) (bool, error) { + panic(fmt.Errorf("not implemented: DeleteDesiredNamespace - deleteDesiredNamespace")) +} + +// ApplyDesiredSource is the resolver for the applyDesiredSource field. +func (r *mutationResolver) ApplyDesiredSource(ctx context.Context, cpID string, sourceID model.K8sSourceID, source model.K8sDesiredSourceInput) (bool, error) { + panic(fmt.Errorf("not implemented: ApplyDesiredSource - applyDesiredSource")) +} + +// DeleteDesiredSource is the resolver for the deleteDesiredSource field. +func (r *mutationResolver) DeleteDesiredSource(ctx context.Context, cpID string, sourceID model.K8sSourceID) (bool, error) { + panic(fmt.Errorf("not implemented: DeleteDesiredSource - deleteDesiredSource")) +} + +// CreateDesiredDestination is the resolver for the createDesiredDestination field. +func (r *mutationResolver) CreateDesiredDestination(ctx context.Context, destinationType string, destination model.DesiredDestinationInput) (*model.DesiredDestination, error) { + panic(fmt.Errorf("not implemented: CreateDesiredDestination - createDesiredDestination")) +} + +// UpdateDesiredDestination is the resolver for the updateDesiredDestination field. +func (r *mutationResolver) UpdateDesiredDestination(ctx context.Context, destinationID string, destination model.DesiredDestinationInput) (*model.DesiredDestination, error) { + panic(fmt.Errorf("not implemented: UpdateDesiredDestination - updateDesiredDestination")) +} + +// DeleteDesiredDestination is the resolver for the deleteDesiredDestination field. +func (r *mutationResolver) DeleteDesiredDestination(ctx context.Context, destinationID string) (bool, error) { + panic(fmt.Errorf("not implemented: DeleteDesiredDestination - deleteDesiredDestination")) +} + +// ApplyDesiredDestinationToComputePlatform is the resolver for the applyDesiredDestinationToComputePlatform field. +func (r *mutationResolver) ApplyDesiredDestinationToComputePlatform(ctx context.Context, cpID string, destinationID string) (bool, error) { + panic(fmt.Errorf("not implemented: ApplyDesiredDestinationToComputePlatform - applyDesiredDestinationToComputePlatform")) +} + +// RemoveDesiredDestinationFromComputePlatform is the resolver for the removeDesiredDestinationFromComputePlatform field. +func (r *mutationResolver) RemoveDesiredDestinationFromComputePlatform(ctx context.Context, cpID string, destinationID string) (bool, error) { + panic(fmt.Errorf("not implemented: RemoveDesiredDestinationFromComputePlatform - removeDesiredDestinationFromComputePlatform")) +} + +// CreateDesiredAction is the resolver for the createDesiredAction field. +func (r *mutationResolver) CreateDesiredAction(ctx context.Context, cpID string, action model.DesiredActionInput) (bool, error) { + panic(fmt.Errorf("not implemented: CreateDesiredAction - createDesiredAction")) +} + +// UpdateDesiredAction is the resolver for the updateDesiredAction field. +func (r *mutationResolver) UpdateDesiredAction(ctx context.Context, cpID string, actionID string, action model.DesiredActionInput) (bool, error) { + panic(fmt.Errorf("not implemented: UpdateDesiredAction - updateDesiredAction")) +} + +// DeleteActualAction is the resolver for the deleteActualAction field. +func (r *mutationResolver) DeleteActualAction(ctx context.Context, cpID string, actionID string, kind string) (bool, error) { + panic(fmt.Errorf("not implemented: DeleteActualAction - deleteActualAction")) +} + +// ComputePlatform is the resolver for the computePlatform field. +func (r *queryResolver) ComputePlatform(ctx context.Context, cpID string) (*model.ComputePlatform, error) { + panic(fmt.Errorf("not implemented: ComputePlatform - computePlatform")) +} + +// ComputePlatforms is the resolver for the computePlatforms field. +func (r *queryResolver) ComputePlatforms(ctx context.Context) ([]*model.ComputePlatform, error) { + + return []*model.ComputePlatform{ + { + ID: "1", + }}, nil +} + +// DestinationTypeCategories is the resolver for the destinationTypeCategories field. +func (r *queryResolver) DestinationTypeCategories(ctx context.Context) ([]*model.DestinationTypeCategory, error) { + panic(fmt.Errorf("not implemented: DestinationTypeCategories - destinationTypeCategories")) +} + +// DesiredDestinations is the resolver for the desiredDestinations field. +func (r *queryResolver) DesiredDestinations(ctx context.Context) ([]*model.DesiredDestination, error) { + panic(fmt.Errorf("not implemented: DesiredDestinations - desiredDestinations")) +} + +// Mutation returns MutationResolver implementation. +func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} } + +// Query returns QueryResolver implementation. +func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } + +type mutationResolver struct{ *Resolver } +type queryResolver struct{ *Resolver } diff --git a/frontend/main.go b/frontend/main.go index 5ef09f9f7..3395f06ee 100644 --- a/frontend/main.go +++ b/frontend/main.go @@ -32,6 +32,10 @@ import ( "github.com/odigos-io/odigos/frontend/endpoints" _ "net/http/pprof" + + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/odigos-io/odigos/frontend/graph" ) const ( @@ -162,6 +166,13 @@ func startHTTPServer(flags *Flags) (*gin.Engine, error) { apis.DELETE("/actions/types/PiiMasking/:id", func(c *gin.Context) { actions.DeletePiiMasking(c, flags.Namespace, c.Param("id")) }) } + // GraphQL handlers + gqlHandler := handler.NewDefaultServer(graph.NewExecutableSchema(graph.Config{Resolvers: &graph.Resolver{}})) + r.POST("/graphql", func(c *gin.Context) { + gqlHandler.ServeHTTP(c.Writer, c.Request) + }) + r.GET("/playground", gin.WrapH(playground.Handler("GraphQL Playground", "/graphql"))) + return r, nil } From fb07059821c58d71c7d4b22c952d290ee809328b Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 22 Jul 2024 16:22:33 +0300 Subject: [PATCH 093/374] chore: get cp with actual sources --- .vscode/launch.json | 128 +++-- frontend/endpoints/sources.go | 67 +++ frontend/graph/conversions.go | 83 +++ frontend/graph/generated.go | 866 +++++++++++++++++++++++++++-- frontend/graph/model/models_gen.go | 78 ++- frontend/graph/schema.graphqls | 25 + frontend/graph/schema.resolvers.go | 12 +- 7 files changed, 1158 insertions(+), 101 deletions(-) create mode 100644 frontend/graph/conversions.go diff --git a/.vscode/launch.json b/.vscode/launch.json index eb87a8e79..7f00a842e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,61 +1,69 @@ { - "version": "0.2.0", - "configurations": [ - { - "name": "Remote Odiglet", - "type": "go", - "request": "attach", - "mode": "remote", - "debugAdapter": "legacy", - "port": 2345, - "host": "127.0.0.1", - "remotePath": "" - }, - { - "name": "instrumentor local", - "type": "go", - "request": "launch", - "mode": "debug", - "program": "${workspaceFolder}/instrumentor", - "cwd": "${workspaceFolder}/instrumentor" - }, - { - "name": "frontend", - "type": "go", - "request": "launch", - "mode": "debug", - "program": "${workspaceFolder}/frontend", - "cwd": "${workspaceFolder}/frontend", - "args": ["--port", "8085", "--address", "0.0.0.0"] - }, - { - "name": "autoscaler local", - "type": "go", - "request": "launch", - "mode": "debug", - "program": "${workspaceFolder}/autoscaler", - "cwd": "${workspaceFolder}/autoscaler", - "env": { - "ODIGOS_VERSION": "v1.0.71" - } - }, - { - "name": "scheduler local", - "type": "go", - "request": "launch", - "mode": "debug", - "program": "${workspaceFolder}/scheduler", - "cwd": "${workspaceFolder}/scheduler" - }, - { - "name": "cli uninstall", - "type": "go", - "request": "launch", - "mode": "debug", - "program": "${workspaceFolder}/cli", - "cwd": "${workspaceFolder}/cli", - "args": ["uninstall", "--yes"], - "buildFlags": "-tags=embed_manifests" - } - ] -} \ No newline at end of file + "version": "0.2.0", + "configurations": [ + { + "name": "Remote Odiglet", + "type": "go", + "request": "attach", + "mode": "remote", + "debugAdapter": "legacy", + "port": 2345, + "host": "127.0.0.1", + "remotePath": "" + }, + { + "name": "instrumentor local", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${workspaceFolder}/instrumentor", + "cwd": "${workspaceFolder}/instrumentor" + }, + { + "name": "frontend", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${workspaceFolder}/frontend", + "cwd": "${workspaceFolder}/frontend", + "args": ["--port", "8085", "--address", "0.0.0.0"] + }, + { + "name": "gql-playground", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${workspaceFolder}/frontend/main.go", + "cwd": "${workspaceFolder}/frontend" + }, + { + "name": "autoscaler local", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${workspaceFolder}/autoscaler", + "cwd": "${workspaceFolder}/autoscaler", + "env": { + "ODIGOS_VERSION": "v1.0.71" + } + }, + { + "name": "scheduler local", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${workspaceFolder}/scheduler", + "cwd": "${workspaceFolder}/scheduler" + }, + { + "name": "cli uninstall", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${workspaceFolder}/cli", + "cwd": "${workspaceFolder}/cli", + "args": ["uninstall", "--yes"], + "buildFlags": "-tags=embed_manifests" + } + ] +} diff --git a/frontend/endpoints/sources.go b/frontend/endpoints/sources.go index 84cf0a367..79192c4d3 100644 --- a/frontend/endpoints/sources.go +++ b/frontend/endpoints/sources.go @@ -48,6 +48,73 @@ type PatchSourceRequest struct { ReportedName *string `json:"reported_name"` } +func GetActualSources(ctx context.Context, odigosns string) []ThinSource { + + effectiveInstrumentedSources := map[SourceID]ThinSource{} + + var ( + items []GetApplicationItem + instrumentedApplications *v1alpha1.InstrumentedApplicationList + ) + + g, ctx := errgroup.WithContext(ctx) + g.Go(func() error { + relevantNamespaces, err := getRelevantNameSpaces(ctx, odigosns) + if err != nil { + return err + } + nsInstrumentedMap := map[string]*bool{} + for _, ns := range relevantNamespaces { + nsInstrumentedMap[ns.Name] = isObjectLabeledForInstrumentation(ns.ObjectMeta) + } + // get all the applications in all the namespaces, + // passing an empty string here is more efficient compared to iterating over the namespaces + // since it will make a single request per workload type to the k8s api server + items, err = getApplicationsInNamespace(ctx, "", nsInstrumentedMap) + return err + }) + + g.Go(func() error { + var err error + instrumentedApplications, err = kube.DefaultClient.OdigosClient.InstrumentedApplications("").List(ctx, metav1.ListOptions{}) + return err + }) + + if err := g.Wait(); err != nil { + return nil + } + + for _, item := range items { + if item.nsItem.InstrumentationEffective { + id := SourceID{Namespace: item.namespace, Kind: string(item.nsItem.Kind), Name: item.nsItem.Name} + effectiveInstrumentedSources[id] = ThinSource{ + NumberOfRunningInstances: item.nsItem.Instances, + SourceID: id, + } + } + } + + sourcesResult := []ThinSource{} + // go over the instrumented applications and update the languages of the effective sources. + // Not all effective sources necessarily have a corresponding instrumented application, + // it may take some time for the instrumented application to be created. In that case the languages + // slice will be empty. + for _, app := range instrumentedApplications.Items { + thinSource := k8sInstrumentedAppToThinSource(&app) + if source, ok := effectiveInstrumentedSources[thinSource.SourceID]; ok { + source.IaDetails = thinSource.IaDetails + effectiveInstrumentedSources[thinSource.SourceID] = source + } + } + + for _, source := range effectiveInstrumentedSources { + sourcesResult = append(sourcesResult, source) + } + + return sourcesResult + +} + func GetSources(c *gin.Context, odigosns string) { ctx := c.Request.Context() effectiveInstrumentedSources := map[SourceID]ThinSource{} diff --git a/frontend/graph/conversions.go b/frontend/graph/conversions.go new file mode 100644 index 000000000..6dc38cb16 --- /dev/null +++ b/frontend/graph/conversions.go @@ -0,0 +1,83 @@ +package graph + +import ( + "time" + + "github.com/odigos-io/odigos/frontend/endpoints" + gqlmodel "github.com/odigos-io/odigos/frontend/graph/model" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func k8sKindToGql(k8sResourceKind string) gqlmodel.K8sResourceKind { + switch k8sResourceKind { + case "Deployment": + return gqlmodel.K8sResourceKindDeployment + case "StatefulSet": + return gqlmodel.K8sResourceKindStatefulSet + case "DaemonSet": + return gqlmodel.K8sResourceKindDaemonSet + } + return "" +} + +func k8sConditionStatusToGql(status v1.ConditionStatus) gqlmodel.ConditionStatus { + switch status { + case v1.ConditionTrue: + return gqlmodel.ConditionStatusTrue + case v1.ConditionFalse: + return gqlmodel.ConditionStatusFalse + case v1.ConditionUnknown: + return gqlmodel.ConditionStatusUnknown + } + return gqlmodel.ConditionStatusUnknown + +} + +func k8sLastTransitionTimeToGql(t v1.Time) *string { + if t.IsZero() { + return nil + } + str := t.UTC().Format(time.RFC3339) + return &str +} + +func k8sActualSourceToGql(k8sSource *endpoints.ThinSource) *gqlmodel.K8sActualSource { + + hasInstrumentedApplication := k8sSource.IaDetails != nil + + var gqlIaDetails *gqlmodel.InstrumentedApplicationDetails + if hasInstrumentedApplication { + gqlIaDetails = &gqlmodel.InstrumentedApplicationDetails{ + Languages: make([]*gqlmodel.SourceLanguage, len(k8sSource.IaDetails.Languages)), + Conditions: make([]*gqlmodel.Condition, len(k8sSource.IaDetails.Conditions)), + } + + for i, lang := range k8sSource.IaDetails.Languages { + gqlIaDetails.Languages[i] = &gqlmodel.SourceLanguage{ + ContainerName: lang.ContainerName, + Language: lang.Language, + } + } + + for i, cond := range k8sSource.IaDetails.Conditions { + gqlIaDetails.Conditions[i] = &gqlmodel.Condition{ + Type: cond.Type, + Status: k8sConditionStatusToGql(cond.Status), + Reason: &cond.Reason, + LastTransitionTime: k8sLastTransitionTimeToGql(cond.LastTransitionTime), + Message: &cond.Message, + } + } + } + + serviceName := "test-service-name" + + return &gqlmodel.K8sActualSource{ + Namespace: k8sSource.Namespace, + Kind: k8sKindToGql(k8sSource.Kind), + Name: k8sSource.Name, + ServiceName: &serviceName, + NumberOfInstances: &k8sSource.NumberOfRunningInstances, + InstrumentedApplicationDetails: gqlIaDetails, + } +} diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index 06d30cc55..8bbd7df4d 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -76,6 +76,14 @@ type ComplexityRoot struct { Name func(childComplexity int) int } + Condition struct { + LastTransitionTime func(childComplexity int) int + Message func(childComplexity int) int + Reason func(childComplexity int) int + Status func(childComplexity int) int + Type func(childComplexity int) int + } + DesiredDestination struct { ComputePlatforms func(childComplexity int) int ExportSignals func(childComplexity int) int @@ -115,6 +123,11 @@ type ComplexityRoot struct { VideoURL func(childComplexity int) int } + InstrumentedApplicationDetails struct { + Conditions func(childComplexity int) int + Languages func(childComplexity int) int + } + K8sActualNamespace struct { AutoInstrumented func(childComplexity int) int K8sActualSources func(childComplexity int) int @@ -122,14 +135,15 @@ type ComplexityRoot struct { } K8sActualSource struct { - AutoInstrumented func(childComplexity int) int - CreationTimestamp func(childComplexity int) int - HasInstrumentedApplication func(childComplexity int) int - Kind func(childComplexity int) int - Name func(childComplexity int) int - Namespace func(childComplexity int) int - NumberOfInstances func(childComplexity int) int - ServiceName func(childComplexity int) int + AutoInstrumented func(childComplexity int) int + CreationTimestamp func(childComplexity int) int + HasInstrumentedApplication func(childComplexity int) int + InstrumentedApplicationDetails func(childComplexity int) int + Kind func(childComplexity int) int + Name func(childComplexity int) int + Namespace func(childComplexity int) int + NumberOfInstances func(childComplexity int) int + ServiceName func(childComplexity int) int } K8sActualSourceRuntimeInfo struct { @@ -162,6 +176,11 @@ type ComplexityRoot struct { DesiredDestinations func(childComplexity int) int DestinationTypeCategories func(childComplexity int) int } + + SourceLanguage struct { + ContainerName func(childComplexity int) int + Language func(childComplexity int) int + } } type MutationResolver interface { @@ -349,6 +368,41 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ComputePlatform.Name(childComplexity), true + case "Condition.lastTransitionTime": + if e.complexity.Condition.LastTransitionTime == nil { + break + } + + return e.complexity.Condition.LastTransitionTime(childComplexity), true + + case "Condition.message": + if e.complexity.Condition.Message == nil { + break + } + + return e.complexity.Condition.Message(childComplexity), true + + case "Condition.reason": + if e.complexity.Condition.Reason == nil { + break + } + + return e.complexity.Condition.Reason(childComplexity), true + + case "Condition.status": + if e.complexity.Condition.Status == nil { + break + } + + return e.complexity.Condition.Status(childComplexity), true + + case "Condition.type": + if e.complexity.Condition.Type == nil { + break + } + + return e.complexity.Condition.Type(childComplexity), true + case "DesiredDestination.computePlatforms": if e.complexity.DesiredDestination.ComputePlatforms == nil { break @@ -517,6 +571,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.DestinationTypeField.VideoURL(childComplexity), true + case "InstrumentedApplicationDetails.conditions": + if e.complexity.InstrumentedApplicationDetails.Conditions == nil { + break + } + + return e.complexity.InstrumentedApplicationDetails.Conditions(childComplexity), true + + case "InstrumentedApplicationDetails.languages": + if e.complexity.InstrumentedApplicationDetails.Languages == nil { + break + } + + return e.complexity.InstrumentedApplicationDetails.Languages(childComplexity), true + case "K8sActualNamespace.autoInstrumented": if e.complexity.K8sActualNamespace.AutoInstrumented == nil { break @@ -559,6 +627,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.K8sActualSource.HasInstrumentedApplication(childComplexity), true + case "K8sActualSource.instrumentedApplicationDetails": + if e.complexity.K8sActualSource.InstrumentedApplicationDetails == nil { + break + } + + return e.complexity.K8sActualSource.InstrumentedApplicationDetails(childComplexity), true + case "K8sActualSource.kind": if e.complexity.K8sActualSource.Kind == nil { break @@ -792,6 +867,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.DestinationTypeCategories(childComplexity), true + case "SourceLanguage.containerName": + if e.complexity.SourceLanguage.ContainerName == nil { + break + } + + return e.complexity.SourceLanguage.ContainerName(childComplexity), true + + case "SourceLanguage.language": + if e.complexity.SourceLanguage.Language == nil { + break + } + + return e.complexity.SourceLanguage.Language(childComplexity), true + } return 0, false } @@ -2160,6 +2249,8 @@ func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSources(_ cont return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) case "hasInstrumentedApplication": return ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) + case "instrumentedApplicationDetails": + return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type K8sActualSource", field.Name) }, @@ -2283,6 +2374,217 @@ func (ec *executionContext) fieldContext_ComputePlatform_actualActions(_ context return fc, nil } +func (ec *executionContext) _Condition_type(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Condition_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Condition", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Condition_status(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_status(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Status, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.ConditionStatus) + fc.Result = res + return ec.marshalNConditionStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionStatus(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Condition_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Condition", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ConditionStatus does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Condition_lastTransitionTime(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_lastTransitionTime(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.LastTransitionTime, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Condition_lastTransitionTime(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Condition", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Condition_reason(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_reason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Reason, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Condition_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Condition", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Condition_message(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_message(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Condition_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Condition", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _DesiredDestination_id(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { fc, err := ec.fieldContext_DesiredDestination_id(ctx, field) if err != nil { @@ -3397,6 +3699,106 @@ func (ec *executionContext) fieldContext_DestinationTypeField_initialValue(_ con return fc, nil } +func (ec *executionContext) _InstrumentedApplicationDetails_languages(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentedApplicationDetails_languages(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Languages, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.SourceLanguage) + fc.Result = res + return ec.marshalOSourceLanguage2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguageᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_languages(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "InstrumentedApplicationDetails", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "containerName": + return ec.fieldContext_SourceLanguage_containerName(ctx, field) + case "language": + return ec.fieldContext_SourceLanguage_language(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type SourceLanguage", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _InstrumentedApplicationDetails_conditions(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Conditions, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Condition) + fc.Result = res + return ec.marshalOCondition2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_conditions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "InstrumentedApplicationDetails", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "type": + return ec.fieldContext_Condition_type(ctx, field) + case "status": + return ec.fieldContext_Condition_status(ctx, field) + case "lastTransitionTime": + return ec.fieldContext_Condition_lastTransitionTime(ctx, field) + case "reason": + return ec.fieldContext_Condition_reason(ctx, field) + case "message": + return ec.fieldContext_Condition_message(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Condition", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _K8sActualNamespace_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { fc, err := ec.fieldContext_K8sActualNamespace_name(ctx, field) if err != nil { @@ -3537,6 +3939,8 @@ func (ec *executionContext) fieldContext_K8sActualNamespace_k8sActualSources(_ c return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) case "hasInstrumentedApplication": return ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) + case "instrumentedApplicationDetails": + return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type K8sActualSource", field.Name) }, @@ -3884,6 +4288,53 @@ func (ec *executionContext) fieldContext_K8sActualSource_hasInstrumentedApplicat return fc, nil } +func (ec *executionContext) _K8sActualSource_instrumentedApplicationDetails(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InstrumentedApplicationDetails, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.InstrumentedApplicationDetails) + fc.Result = res + return ec.marshalOInstrumentedApplicationDetails2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentedApplicationDetails(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSource_instrumentedApplicationDetails(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "languages": + return ec.fieldContext_InstrumentedApplicationDetails_languages(ctx, field) + case "conditions": + return ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type InstrumentedApplicationDetails", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _K8sActualSourceRuntimeInfo_mainContainer(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfo) (ret graphql.Marshaler) { fc, err := ec.fieldContext_K8sActualSourceRuntimeInfo_mainContainer(ctx, field) if err != nil { @@ -5012,8 +5463,107 @@ func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field return fc, nil } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query___schema(ctx, field) +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___schema(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectSchema() + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Schema) + fc.Result = res + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "description": + return ec.fieldContext___Schema_description(ctx, field) + case "types": + return ec.fieldContext___Schema_types(ctx, field) + case "queryType": + return ec.fieldContext___Schema_queryType(ctx, field) + case "mutationType": + return ec.fieldContext___Schema_mutationType(ctx, field) + case "subscriptionType": + return ec.fieldContext___Schema_subscriptionType(ctx, field) + case "directives": + return ec.fieldContext___Schema_directives(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _SourceLanguage_containerName(ctx context.Context, field graphql.CollectedField, obj *model.SourceLanguage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SourceLanguage_containerName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ContainerName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SourceLanguage_containerName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SourceLanguage", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SourceLanguage_language(ctx context.Context, field graphql.CollectedField, obj *model.SourceLanguage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SourceLanguage_language(ctx, field) if err != nil { return graphql.Null } @@ -5026,42 +5576,31 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.introspectSchema() + return obj.Language, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*introspection.Schema) + res := resTmp.(string) fc.Result = res - return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SourceLanguage_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "SourceLanguage", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "description": - return ec.fieldContext___Schema_description(ctx, field) - case "types": - return ec.fieldContext___Schema_types(ctx, field) - case "queryType": - return ec.fieldContext___Schema_queryType(ctx, field) - case "mutationType": - return ec.fieldContext___Schema_mutationType(ctx, field) - case "subscriptionType": - return ec.fieldContext___Schema_subscriptionType(ctx, field) - case "directives": - return ec.fieldContext___Schema_directives(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil @@ -7345,6 +7884,56 @@ func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.Select return out } +var conditionImplementors = []string{"Condition"} + +func (ec *executionContext) _Condition(ctx context.Context, sel ast.SelectionSet, obj *model.Condition) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, conditionImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Condition") + case "type": + out.Values[i] = ec._Condition_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "status": + out.Values[i] = ec._Condition_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "lastTransitionTime": + out.Values[i] = ec._Condition_lastTransitionTime(ctx, field, obj) + case "reason": + out.Values[i] = ec._Condition_reason(ctx, field, obj) + case "message": + out.Values[i] = ec._Condition_message(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var desiredDestinationImplementors = []string{"DesiredDestination"} func (ec *executionContext) _DesiredDestination(ctx context.Context, sel ast.SelectionSet, obj *model.DesiredDestination) graphql.Marshaler { @@ -7623,6 +8212,44 @@ func (ec *executionContext) _DestinationTypeField(ctx context.Context, sel ast.S return out } +var instrumentedApplicationDetailsImplementors = []string{"InstrumentedApplicationDetails"} + +func (ec *executionContext) _InstrumentedApplicationDetails(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentedApplicationDetails) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, instrumentedApplicationDetailsImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("InstrumentedApplicationDetails") + case "languages": + out.Values[i] = ec._InstrumentedApplicationDetails_languages(ctx, field, obj) + case "conditions": + out.Values[i] = ec._InstrumentedApplicationDetails_conditions(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var k8sActualNamespaceImplementors = []string{"K8sActualNamespace"} func (ec *executionContext) _K8sActualNamespace(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualNamespace) graphql.Marshaler { @@ -7708,6 +8335,8 @@ func (ec *executionContext) _K8sActualSource(ctx context.Context, sel ast.Select if out.Values[i] == graphql.Null { out.Invalids++ } + case "instrumentedApplicationDetails": + out.Values[i] = ec._K8sActualSource_instrumentedApplicationDetails(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -8063,6 +8692,50 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr return out } +var sourceLanguageImplementors = []string{"SourceLanguage"} + +func (ec *executionContext) _SourceLanguage(ctx context.Context, sel ast.SelectionSet, obj *model.SourceLanguage) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, sourceLanguageImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SourceLanguage") + case "containerName": + out.Values[i] = ec._SourceLanguage_containerName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "language": + out.Values[i] = ec._SourceLanguage_language(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { @@ -8544,6 +9217,26 @@ func (ec *executionContext) marshalNComputePlatformType2githubᚗcomᚋodigosᚑ return v } +func (ec *executionContext) marshalNCondition2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐCondition(ctx context.Context, sel ast.SelectionSet, v *model.Condition) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Condition(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNConditionStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionStatus(ctx context.Context, v interface{}) (model.ConditionStatus, error) { + var res model.ConditionStatus + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNConditionStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionStatus(ctx context.Context, sel ast.SelectionSet, v model.ConditionStatus) graphql.Marshaler { + return v +} + func (ec *executionContext) unmarshalNDesiredActionInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredActionInput(ctx context.Context, v interface{}) (model.DesiredActionInput, error) { res, err := ec.unmarshalInputDesiredActionInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -8948,6 +9641,16 @@ func (ec *executionContext) marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋo return ret } +func (ec *executionContext) marshalNSourceLanguage2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguage(ctx context.Context, sel ast.SelectionSet, v *model.SourceLanguage) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._SourceLanguage(ctx, sel, v) +} + func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) @@ -9304,6 +10007,53 @@ func (ec *executionContext) marshalOComputePlatform2ᚖgithubᚗcomᚋodigosᚑi return ec._ComputePlatform(ctx, sel, v) } +func (ec *executionContext) marshalOCondition2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Condition) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNCondition2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐCondition(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + func (ec *executionContext) marshalODesiredDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx context.Context, sel ast.SelectionSet, v []*model.DesiredDestination) graphql.Marshaler { if v == nil { return graphql.Null @@ -9407,6 +10157,13 @@ func (ec *executionContext) marshalODestinationTypeCategory2ᚖgithubᚗcomᚋod return ec._DestinationTypeCategory(ctx, sel, v) } +func (ec *executionContext) marshalOInstrumentedApplicationDetails2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentedApplicationDetails(ctx context.Context, sel ast.SelectionSet, v *model.InstrumentedApplicationDetails) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._InstrumentedApplicationDetails(ctx, sel, v) +} + func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interface{}) (*int, error) { if v == nil { return nil, nil @@ -9444,6 +10201,53 @@ func (ec *executionContext) marshalOK8sActualSourceRuntimeInfoContainer2ᚖgithu return ec._K8sActualSourceRuntimeInfoContainer(ctx, sel, v) } +func (ec *executionContext) marshalOSourceLanguage2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguageᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.SourceLanguage) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNSourceLanguage2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguage(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { if v == nil { return nil, nil diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index f6da0e88c..8a8f8bf0c 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -37,6 +37,14 @@ type ComputePlatform struct { ActualActions []*ActualAction `json:"actualActions"` } +type Condition struct { + Type string `json:"type"` + Status ConditionStatus `json:"status"` + LastTransitionTime *string `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + type DesiredActionInput struct { Kind string `json:"kind"` Name *string `json:"name,omitempty"` @@ -96,6 +104,11 @@ type DestinationTypeField struct { InitialValue *string `json:"initialValue,omitempty"` } +type InstrumentedApplicationDetails struct { + Languages []*SourceLanguage `json:"languages,omitempty"` + Conditions []*Condition `json:"conditions,omitempty"` +} + type K8sActualNamespace struct { Name string `json:"name"` AutoInstrumented *bool `json:"autoInstrumented,omitempty"` @@ -103,14 +116,15 @@ type K8sActualNamespace struct { } type K8sActualSource struct { - Namespace string `json:"namespace"` - Kind K8sResourceKind `json:"kind"` - Name string `json:"name"` - ServiceName *string `json:"serviceName,omitempty"` - AutoInstrumented *bool `json:"autoInstrumented,omitempty"` - CreationTimestamp *string `json:"creationTimestamp,omitempty"` - NumberOfInstances *int `json:"numberOfInstances,omitempty"` - HasInstrumentedApplication bool `json:"hasInstrumentedApplication"` + Namespace string `json:"namespace"` + Kind K8sResourceKind `json:"kind"` + Name string `json:"name"` + ServiceName *string `json:"serviceName,omitempty"` + AutoInstrumented *bool `json:"autoInstrumented,omitempty"` + CreationTimestamp *string `json:"creationTimestamp,omitempty"` + NumberOfInstances *int `json:"numberOfInstances,omitempty"` + HasInstrumentedApplication bool `json:"hasInstrumentedApplication"` + InstrumentedApplicationDetails *InstrumentedApplicationDetails `json:"instrumentedApplicationDetails,omitempty"` } type K8sActualSourceRuntimeInfo struct { @@ -147,6 +161,11 @@ type Mutation struct { type Query struct { } +type SourceLanguage struct { + ContainerName string `json:"containerName"` + Language string `json:"language"` +} + type WorkloadInput struct { Kind K8sResourceKind `json:"kind"` Name string `json:"name"` @@ -194,6 +213,49 @@ func (e ComputePlatformType) MarshalGQL(w io.Writer) { fmt.Fprint(w, strconv.Quote(e.String())) } +type ConditionStatus string + +const ( + ConditionStatusTrue ConditionStatus = "True" + ConditionStatusFalse ConditionStatus = "False" + ConditionStatusUnknown ConditionStatus = "Unknown" +) + +var AllConditionStatus = []ConditionStatus{ + ConditionStatusTrue, + ConditionStatusFalse, + ConditionStatusUnknown, +} + +func (e ConditionStatus) IsValid() bool { + switch e { + case ConditionStatusTrue, ConditionStatusFalse, ConditionStatusUnknown: + return true + } + return false +} + +func (e ConditionStatus) String() string { + return string(e) +} + +func (e *ConditionStatus) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = ConditionStatus(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid ConditionStatus", str) + } + return nil +} + +func (e ConditionStatus) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + type K8sResourceKind string const ( diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index d03d61729..9eee8f6a4 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -9,6 +9,12 @@ enum K8sResourceKind { StatefulSet } +enum ConditionStatus { + True + False + Unknown +} + enum ProgrammingLanguage { Unspecified Java @@ -32,6 +38,24 @@ enum SpanKind { Consumer } +type SourceLanguage { + containerName: String! + language: String! +} + +type InstrumentedApplicationDetails { + languages: [SourceLanguage!] + conditions: [Condition!] +} + +type Condition { + type: String! + status: ConditionStatus! + lastTransitionTime: String + reason: String + message: String +} + type K8sActualNamespace { name: String! autoInstrumented: Boolean @@ -57,6 +81,7 @@ type K8sActualSource { # Odigos records an array of runtime infos. # currently we only keep the first one assuming it is the user's app. hasInstrumentedApplication: Boolean! + instrumentedApplicationDetails: InstrumentedApplicationDetails } type K8sActualSourceRuntimeInfo { mainContainer: K8sActualSourceRuntimeInfoContainer diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 473e81de6..432b7cd36 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -8,6 +8,7 @@ import ( "context" "fmt" + "github.com/odigos-io/odigos/frontend/endpoints" "github.com/odigos-io/odigos/frontend/graph/model" ) @@ -73,12 +74,19 @@ func (r *mutationResolver) DeleteActualAction(ctx context.Context, cpID string, // ComputePlatform is the resolver for the computePlatform field. func (r *queryResolver) ComputePlatform(ctx context.Context, cpID string) (*model.ComputePlatform, error) { - panic(fmt.Errorf("not implemented: ComputePlatform - computePlatform")) + k8sActualSources := endpoints.GetActualSources(ctx, "odigos-system") + res := make([]*model.K8sActualSource, len(k8sActualSources)) + for i, source := range k8sActualSources { + res[i] = k8sActualSourceToGql(&source) + } + + return &model.ComputePlatform{ + K8sActualSources: res, + }, nil } // ComputePlatforms is the resolver for the computePlatforms field. func (r *queryResolver) ComputePlatforms(ctx context.Context) ([]*model.ComputePlatform, error) { - return []*model.ComputePlatform{ { ID: "1", From 7ad840676f68cd48675177291c21fb2a58365e5c Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 22 Jul 2024 16:24:58 +0300 Subject: [PATCH 094/374] chore: remove service name --- frontend/graph/conversions.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/frontend/graph/conversions.go b/frontend/graph/conversions.go index 6dc38cb16..a6ce2fdc6 100644 --- a/frontend/graph/conversions.go +++ b/frontend/graph/conversions.go @@ -70,13 +70,10 @@ func k8sActualSourceToGql(k8sSource *endpoints.ThinSource) *gqlmodel.K8sActualSo } } - serviceName := "test-service-name" - return &gqlmodel.K8sActualSource{ Namespace: k8sSource.Namespace, Kind: k8sKindToGql(k8sSource.Kind), Name: k8sSource.Name, - ServiceName: &serviceName, NumberOfInstances: &k8sSource.NumberOfRunningInstances, InstrumentedApplicationDetails: gqlIaDetails, } From 0ae9afd5ec2426bea93db6eff29761d52541696a Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 24 Jul 2024 10:23:43 +0300 Subject: [PATCH 095/374] chore: wip --- frontend/Makefile | 2 + frontend/endpoints/actual-sources.go | 146 +++++++++++++ frontend/endpoints/sources.go | 67 ------ frontend/gqlgen.yml | 18 ++ frontend/graph/conversions.go | 14 +- frontend/graph/generated.go | 299 +++++++++++++++------------ frontend/graph/model/models_gen.go | 1 + frontend/graph/schema.graphqls | 6 +- frontend/graph/schema.resolvers.go | 45 +++- 9 files changed, 386 insertions(+), 212 deletions(-) create mode 100644 frontend/Makefile create mode 100644 frontend/endpoints/actual-sources.go diff --git a/frontend/Makefile b/frontend/Makefile new file mode 100644 index 000000000..a3dc15e31 --- /dev/null +++ b/frontend/Makefile @@ -0,0 +1,2 @@ +gqlgen: + go run github.com/99designs/gqlgen generate \ No newline at end of file diff --git a/frontend/endpoints/actual-sources.go b/frontend/endpoints/actual-sources.go new file mode 100644 index 000000000..e11d0c32a --- /dev/null +++ b/frontend/endpoints/actual-sources.go @@ -0,0 +1,146 @@ +package endpoints + +import ( + "context" + "fmt" + + "github.com/odigos-io/odigos/api/odigos/v1alpha1" + "github.com/odigos-io/odigos/common/consts" + "github.com/odigos-io/odigos/frontend/kube" + + "github.com/odigos-io/odigos/k8sutils/pkg/workload" + "golang.org/x/sync/errgroup" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func GetActualSources(ctx context.Context, odigosns string) []ThinSource { + + effectiveInstrumentedSources := map[SourceID]ThinSource{} + + var ( + items []GetApplicationItem + instrumentedApplications *v1alpha1.InstrumentedApplicationList + ) + + g, ctx := errgroup.WithContext(ctx) + g.Go(func() error { + relevantNamespaces, err := getRelevantNameSpaces(ctx, odigosns) + if err != nil { + return err + } + nsInstrumentedMap := map[string]*bool{} + for _, ns := range relevantNamespaces { + nsInstrumentedMap[ns.Name] = isObjectLabeledForInstrumentation(ns.ObjectMeta) + } + // get all the applications in all the namespaces, + // passing an empty string here is more efficient compared to iterating over the namespaces + // since it will make a single request per workload type to the k8s api server + items, err = getApplicationsInNamespace(ctx, "", nsInstrumentedMap) + return err + }) + + g.Go(func() error { + var err error + instrumentedApplications, err = kube.DefaultClient.OdigosClient.InstrumentedApplications("").List(ctx, metav1.ListOptions{}) + return err + }) + + if err := g.Wait(); err != nil { + return nil + } + + for _, item := range items { + if item.nsItem.InstrumentationEffective { + id := SourceID{Namespace: item.namespace, Kind: string(item.nsItem.Kind), Name: item.nsItem.Name} + effectiveInstrumentedSources[id] = ThinSource{ + NumberOfRunningInstances: item.nsItem.Instances, + SourceID: id, + } + } + } + + sourcesResult := []ThinSource{} + // go over the instrumented applications and update the languages of the effective sources. + // Not all effective sources necessarily have a corresponding instrumented application, + // it may take some time for the instrumented application to be created. In that case the languages + // slice will be empty. + for _, app := range instrumentedApplications.Items { + thinSource := k8sInstrumentedAppToThinSource(&app) + if source, ok := effectiveInstrumentedSources[thinSource.SourceID]; ok { + source.IaDetails = thinSource.IaDetails + effectiveInstrumentedSources[thinSource.SourceID] = source + } + } + + for _, source := range effectiveInstrumentedSources { + sourcesResult = append(sourcesResult, source) + } + + return sourcesResult + +} + +func GetActualSource(ctx context.Context, ns string, kind string, name string) (*Source, error) { + + k8sObjectName := workload.GetRuntimeObjectName(name, kind) + + owner, numberOfRunningInstances := getWorkload(ctx, ns, kind, name) + if owner == nil { + return nil, fmt.Errorf("owner not found") + } + ownerAnnotations := owner.GetAnnotations() + var reportedName string + if ownerAnnotations != nil { + reportedName = ownerAnnotations[consts.OdigosReportedNameAnnotation] + } + + ts := ThinSource{ + SourceID: SourceID{ + Namespace: ns, + Kind: kind, + Name: name, + }, + NumberOfRunningInstances: numberOfRunningInstances, + } + + instrumentedApplication, err := kube.DefaultClient.OdigosClient.InstrumentedApplications(ns).Get(ctx, k8sObjectName, metav1.GetOptions{}) + if err == nil { + // valid instrumented application, grab the runtime details + ts.IaDetails = k8sInstrumentedAppToThinSource(instrumentedApplication).IaDetails + // potentially add a condition for healthy instrumentation instances + err = addHealthyInstrumentationInstancesCondition(ctx, instrumentedApplication, &ts) + if err != nil { + return nil, err + } + } + + return &Source{ + ThinSource: ts, + ReportedName: reportedName, + }, nil +} + +func getWorkload(c context.Context, ns string, kind string, name string) (metav1.Object, int) { + switch kind { + case "Deployment": + deployment, err := kube.DefaultClient.AppsV1().Deployments(ns).Get(c, name, metav1.GetOptions{}) + if err != nil { + return nil, 0 + } + return deployment, int(deployment.Status.AvailableReplicas) + case "StatefulSet": + statefulSet, err := kube.DefaultClient.AppsV1().StatefulSets(ns).Get(c, name, metav1.GetOptions{}) + if err != nil { + return nil, 0 + } + return statefulSet, int(statefulSet.Status.ReadyReplicas) + case "DaemonSet": + daemonSet, err := kube.DefaultClient.AppsV1().DaemonSets(ns).Get(c, name, metav1.GetOptions{}) + if err != nil { + return nil, 0 + } + return daemonSet, int(daemonSet.Status.NumberReady) + default: + return nil, 0 + } +} diff --git a/frontend/endpoints/sources.go b/frontend/endpoints/sources.go index 79192c4d3..84cf0a367 100644 --- a/frontend/endpoints/sources.go +++ b/frontend/endpoints/sources.go @@ -48,73 +48,6 @@ type PatchSourceRequest struct { ReportedName *string `json:"reported_name"` } -func GetActualSources(ctx context.Context, odigosns string) []ThinSource { - - effectiveInstrumentedSources := map[SourceID]ThinSource{} - - var ( - items []GetApplicationItem - instrumentedApplications *v1alpha1.InstrumentedApplicationList - ) - - g, ctx := errgroup.WithContext(ctx) - g.Go(func() error { - relevantNamespaces, err := getRelevantNameSpaces(ctx, odigosns) - if err != nil { - return err - } - nsInstrumentedMap := map[string]*bool{} - for _, ns := range relevantNamespaces { - nsInstrumentedMap[ns.Name] = isObjectLabeledForInstrumentation(ns.ObjectMeta) - } - // get all the applications in all the namespaces, - // passing an empty string here is more efficient compared to iterating over the namespaces - // since it will make a single request per workload type to the k8s api server - items, err = getApplicationsInNamespace(ctx, "", nsInstrumentedMap) - return err - }) - - g.Go(func() error { - var err error - instrumentedApplications, err = kube.DefaultClient.OdigosClient.InstrumentedApplications("").List(ctx, metav1.ListOptions{}) - return err - }) - - if err := g.Wait(); err != nil { - return nil - } - - for _, item := range items { - if item.nsItem.InstrumentationEffective { - id := SourceID{Namespace: item.namespace, Kind: string(item.nsItem.Kind), Name: item.nsItem.Name} - effectiveInstrumentedSources[id] = ThinSource{ - NumberOfRunningInstances: item.nsItem.Instances, - SourceID: id, - } - } - } - - sourcesResult := []ThinSource{} - // go over the instrumented applications and update the languages of the effective sources. - // Not all effective sources necessarily have a corresponding instrumented application, - // it may take some time for the instrumented application to be created. In that case the languages - // slice will be empty. - for _, app := range instrumentedApplications.Items { - thinSource := k8sInstrumentedAppToThinSource(&app) - if source, ok := effectiveInstrumentedSources[thinSource.SourceID]; ok { - source.IaDetails = thinSource.IaDetails - effectiveInstrumentedSources[thinSource.SourceID] = source - } - } - - for _, source := range effectiveInstrumentedSources { - sourcesResult = append(sourcesResult, source) - } - - return sourcesResult - -} - func GetSources(c *gin.Context, odigosns string) { ctx := c.Request.Context() effectiveInstrumentedSources := map[SourceID]ThinSource{} diff --git a/frontend/gqlgen.yml b/frontend/gqlgen.yml index f54df5faf..16744a23f 100644 --- a/frontend/gqlgen.yml +++ b/frontend/gqlgen.yml @@ -23,3 +23,21 @@ resolver: dir: graph package: graph filename_template: '{name}.resolvers.go' + +models: + ID: + model: + - github.com/99designs/gqlgen/graphql.ID + - github.com/99designs/gqlgen/graphql.Int + - github.com/99designs/gqlgen/graphql.Int64 + - github.com/99designs/gqlgen/graphql.Int32 + Int: + model: + - github.com/99designs/gqlgen/graphql.Int + - github.com/99designs/gqlgen/graphql.Int64 + - github.com/99designs/gqlgen/graphql.Int32 + + ComputePlatform: + fields: + k8sActualSource: + resolver: true diff --git a/frontend/graph/conversions.go b/frontend/graph/conversions.go index a6ce2fdc6..49b433f2d 100644 --- a/frontend/graph/conversions.go +++ b/frontend/graph/conversions.go @@ -41,7 +41,7 @@ func k8sLastTransitionTimeToGql(t v1.Time) *string { return &str } -func k8sActualSourceToGql(k8sSource *endpoints.ThinSource) *gqlmodel.K8sActualSource { +func k8sThinSourceToGql(k8sSource *endpoints.ThinSource) *gqlmodel.K8sActualSource { hasInstrumentedApplication := k8sSource.IaDetails != nil @@ -78,3 +78,15 @@ func k8sActualSourceToGql(k8sSource *endpoints.ThinSource) *gqlmodel.K8sActualSo InstrumentedApplicationDetails: gqlIaDetails, } } + +func k8sSourceToGql(k8sSource *endpoints.Source) *gqlmodel.K8sActualSource { + baseSource := k8sThinSourceToGql(&k8sSource.ThinSource) + return &gqlmodel.K8sActualSource{ + Namespace: baseSource.Namespace, + Kind: baseSource.Kind, + Name: baseSource.Name, + NumberOfInstances: baseSource.NumberOfInstances, + InstrumentedApplicationDetails: baseSource.InstrumentedApplicationDetails, + ServiceName: &k8sSource.ReportedName, + } +} diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index 8bbd7df4d..ba6988c46 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -39,6 +39,7 @@ type Config struct { } type ResolverRoot interface { + ComputePlatform() ComputePlatformResolver Mutation() MutationResolver Query() QueryResolver } @@ -72,6 +73,7 @@ type ComplexityRoot struct { ID func(childComplexity int) int K8sActualNamespace func(childComplexity int, name string) int K8sActualNamespaces func(childComplexity int) int + K8sActualSource func(childComplexity int, name *string, namespace *string, kind *string) int K8sActualSources func(childComplexity int) int Name func(childComplexity int) int } @@ -172,7 +174,6 @@ type ComplexityRoot struct { Query struct { ComputePlatform func(childComplexity int, cpID string) int - ComputePlatforms func(childComplexity int) int DesiredDestinations func(childComplexity int) int DestinationTypeCategories func(childComplexity int) int } @@ -183,6 +184,9 @@ type ComplexityRoot struct { } } +type ComputePlatformResolver interface { + K8sActualSource(ctx context.Context, obj *model.ComputePlatform, name *string, namespace *string, kind *string) (*model.K8sActualSource, error) +} type MutationResolver interface { ApplyDesiredNamespace(ctx context.Context, cpID string, nsID model.K8sNamespaceID, ns model.K8sDesiredNamespaceInput) (bool, error) DeleteDesiredNamespace(ctx context.Context, cpID string, nsID model.K8sNamespaceID) (bool, error) @@ -199,7 +203,6 @@ type MutationResolver interface { } type QueryResolver interface { ComputePlatform(ctx context.Context, cpID string) (*model.ComputePlatform, error) - ComputePlatforms(ctx context.Context) ([]*model.ComputePlatform, error) DestinationTypeCategories(ctx context.Context) ([]*model.DestinationTypeCategory, error) DesiredDestinations(ctx context.Context) ([]*model.DesiredDestination, error) } @@ -354,6 +357,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ComputePlatform.K8sActualNamespaces(childComplexity), true + case "ComputePlatform.k8sActualSource": + if e.complexity.ComputePlatform.K8sActualSource == nil { + break + } + + args, err := ec.field_ComputePlatform_k8sActualSource_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.ComputePlatform.K8sActualSource(childComplexity, args["name"].(*string), args["namespace"].(*string), args["kind"].(*string)), true + case "ComputePlatform.k8sActualSources": if e.complexity.ComputePlatform.K8sActualSources == nil { break @@ -846,13 +861,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.ComputePlatform(childComplexity, args["cpId"].(string)), true - case "Query.computePlatforms": - if e.complexity.Query.ComputePlatforms == nil { - break - } - - return e.complexity.Query.ComputePlatforms(childComplexity), true - case "Query.desiredDestinations": if e.complexity.Query.DesiredDestinations == nil { break @@ -1028,6 +1036,39 @@ func (ec *executionContext) field_ComputePlatform_k8sActualNamespace_args(ctx co return args, nil } +func (ec *executionContext) field_ComputePlatform_k8sActualSource_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["namespace"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["namespace"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["kind"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["kind"] = arg2 + return args, nil +} + func (ec *executionContext) field_Mutation_applyDesiredDestinationToComputePlatform_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -2194,6 +2235,78 @@ func (ec *executionContext) fieldContext_ComputePlatform_k8sActualNamespaces(_ c return fc, nil } +func (ec *executionContext) _ComputePlatform_k8sActualSource(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_k8sActualSource(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.ComputePlatform().K8sActualSource(rctx, obj, fc.Args["name"].(*string), fc.Args["namespace"].(*string), fc.Args["kind"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.K8sActualSource) + fc.Result = res + return ec.marshalOK8sActualSource2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ComputePlatform", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "namespace": + return ec.fieldContext_K8sActualSource_namespace(ctx, field) + case "kind": + return ec.fieldContext_K8sActualSource_kind(ctx, field) + case "name": + return ec.fieldContext_K8sActualSource_name(ctx, field) + case "serviceName": + return ec.fieldContext_K8sActualSource_serviceName(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) + case "creationTimestamp": + return ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) + case "numberOfInstances": + return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) + case "hasInstrumentedApplication": + return ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) + case "instrumentedApplicationDetails": + return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sActualSource", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_ComputePlatform_k8sActualSource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _ComputePlatform_k8sActualSources(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { fc, err := ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) if err != nil { @@ -2874,6 +2987,8 @@ func (ec *executionContext) fieldContext_DesiredDestination_computePlatforms(_ c return ec.fieldContext_ComputePlatform_k8sActualNamespace(ctx, field) case "k8sActualNamespaces": return ec.fieldContext_ComputePlatform_k8sActualNamespaces(ctx, field) + case "k8sActualSource": + return ec.fieldContext_ComputePlatform_k8sActualSource(ctx, field) case "k8sActualSources": return ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) case "actualDestinations": @@ -5204,6 +5319,8 @@ func (ec *executionContext) fieldContext_Query_computePlatform(ctx context.Conte return ec.fieldContext_ComputePlatform_k8sActualNamespace(ctx, field) case "k8sActualNamespaces": return ec.fieldContext_ComputePlatform_k8sActualNamespaces(ctx, field) + case "k8sActualSource": + return ec.fieldContext_ComputePlatform_k8sActualSource(ctx, field) case "k8sActualSources": return ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) case "actualDestinations": @@ -5228,65 +5345,6 @@ func (ec *executionContext) fieldContext_Query_computePlatform(ctx context.Conte return fc, nil } -func (ec *executionContext) _Query_computePlatforms(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_computePlatforms(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().ComputePlatforms(rctx) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]*model.ComputePlatform) - fc.Result = res - return ec.marshalOComputePlatform2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_computePlatforms(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ComputePlatform_id(ctx, field) - case "name": - return ec.fieldContext_ComputePlatform_name(ctx, field) - case "computePlatformType": - return ec.fieldContext_ComputePlatform_computePlatformType(ctx, field) - case "k8sActualNamespace": - return ec.fieldContext_ComputePlatform_k8sActualNamespace(ctx, field) - case "k8sActualNamespaces": - return ec.fieldContext_ComputePlatform_k8sActualNamespaces(ctx, field) - case "k8sActualSources": - return ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) - case "actualDestinations": - return ec.fieldContext_ComputePlatform_actualDestinations(ctx, field) - case "actualActions": - return ec.fieldContext_ComputePlatform_actualActions(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ComputePlatform", field.Name) - }, - } - return fc, nil -} - func (ec *executionContext) _Query_destinationTypeCategories(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_destinationTypeCategories(ctx, field) if err != nil { @@ -7830,36 +7888,69 @@ func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.Select case "id": out.Values[i] = ec._ComputePlatform_id(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "name": out.Values[i] = ec._ComputePlatform_name(ctx, field, obj) case "computePlatformType": out.Values[i] = ec._ComputePlatform_computePlatformType(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "k8sActualNamespace": out.Values[i] = ec._ComputePlatform_k8sActualNamespace(ctx, field, obj) case "k8sActualNamespaces": out.Values[i] = ec._ComputePlatform_k8sActualNamespaces(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } + case "k8sActualSource": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ComputePlatform_k8sActualSource(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "k8sActualSources": out.Values[i] = ec._ComputePlatform_k8sActualSources(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "actualDestinations": out.Values[i] = ec._ComputePlatform_actualDestinations(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "actualActions": out.Values[i] = ec._ComputePlatform_actualActions(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } default: panic("unknown field " + strconv.Quote(field.Name)) @@ -8603,25 +8694,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "computePlatforms": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_computePlatforms(ctx, field) - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "destinationTypeCategories": field := field @@ -9959,47 +10031,6 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast return res } -func (ec *executionContext) marshalOComputePlatform2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx context.Context, sel ast.SelectionSet, v []*model.ComputePlatform) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalOComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - return ret -} - func (ec *executionContext) marshalOComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx context.Context, sel ast.SelectionSet, v *model.ComputePlatform) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index 8a8f8bf0c..3bf3f4a72 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -32,6 +32,7 @@ type ComputePlatform struct { ComputePlatformType ComputePlatformType `json:"computePlatformType"` K8sActualNamespace *K8sActualNamespace `json:"k8sActualNamespace,omitempty"` K8sActualNamespaces []*K8sActualNamespace `json:"k8sActualNamespaces"` + K8sActualSource *K8sActualSource `json:"k8sActualSource,omitempty"` K8sActualSources []*K8sActualSource `json:"k8sActualSources"` ActualDestinations []*ActualDestination `json:"actualDestinations"` ActualActions []*ActualAction `json:"actualActions"` diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index 9eee8f6a4..1ec837b6c 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -173,6 +173,11 @@ type ComputePlatform { k8sActualNamespace(name: String!): K8sActualNamespace k8sActualNamespaces: [K8sActualNamespace]! + k8sActualSource( + name: String + namespace: String + kind: String + ): K8sActualSource k8sActualSources: [K8sActualSource]! # destinations that are applied to this compute platform @@ -208,7 +213,6 @@ type ActualAction { type Query { computePlatform(cpId: ID!): ComputePlatform - computePlatforms: [ComputePlatform] destinationTypeCategories: [DestinationTypeCategory] desiredDestinations: [DesiredDestination] } diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 432b7cd36..a744f7054 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -12,6 +12,20 @@ import ( "github.com/odigos-io/odigos/frontend/graph/model" ) +// K8sActualSource is the resolver for the k8sActualSource field. +func (r *computePlatformResolver) K8sActualSource(ctx context.Context, obj *model.ComputePlatform, name *string, namespace *string, kind *string) (*model.K8sActualSource, error) { + source, err := endpoints.GetActualSource(ctx, *namespace, *kind, *name) + if err != nil { + return nil, err + } + if source == nil { + return nil, nil + } + k8sActualSource := k8sSourceToGql(source) + + return k8sActualSource, nil +} + // ApplyDesiredNamespace is the resolver for the applyDesiredNamespace field. func (r *mutationResolver) ApplyDesiredNamespace(ctx context.Context, cpID string, nsID model.K8sNamespaceID, ns model.K8sDesiredNamespaceInput) (bool, error) { panic(fmt.Errorf("not implemented: ApplyDesiredNamespace - applyDesiredNamespace")) @@ -77,7 +91,7 @@ func (r *queryResolver) ComputePlatform(ctx context.Context, cpID string) (*mode k8sActualSources := endpoints.GetActualSources(ctx, "odigos-system") res := make([]*model.K8sActualSource, len(k8sActualSources)) for i, source := range k8sActualSources { - res[i] = k8sActualSourceToGql(&source) + res[i] = k8sThinSourceToGql(&source) } return &model.ComputePlatform{ @@ -85,14 +99,6 @@ func (r *queryResolver) ComputePlatform(ctx context.Context, cpID string) (*mode }, nil } -// ComputePlatforms is the resolver for the computePlatforms field. -func (r *queryResolver) ComputePlatforms(ctx context.Context) ([]*model.ComputePlatform, error) { - return []*model.ComputePlatform{ - { - ID: "1", - }}, nil -} - // DestinationTypeCategories is the resolver for the destinationTypeCategories field. func (r *queryResolver) DestinationTypeCategories(ctx context.Context) ([]*model.DestinationTypeCategory, error) { panic(fmt.Errorf("not implemented: DestinationTypeCategories - destinationTypeCategories")) @@ -103,11 +109,32 @@ func (r *queryResolver) DesiredDestinations(ctx context.Context) ([]*model.Desir panic(fmt.Errorf("not implemented: DesiredDestinations - desiredDestinations")) } +// ComputePlatform returns ComputePlatformResolver implementation. +func (r *Resolver) ComputePlatform() ComputePlatformResolver { return &computePlatformResolver{r} } + // Mutation returns MutationResolver implementation. func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} } // Query returns QueryResolver implementation. func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } +type computePlatformResolver struct{ *Resolver } type mutationResolver struct{ *Resolver } type queryResolver struct{ *Resolver } + +// !!! WARNING !!! +// The code below was going to be deleted when updating resolvers. It has been copied here so you have +// one last chance to move it out of harms way if you want. There are two reasons this happens: +// - When renaming or deleting a resolver the old code will be put in here. You can safely delete +// it when you're done. +// - You have helper methods in this file. Move them out to keep these resolver files clean. +func (r *computePlatformResolver) K8sActualSources(ctx context.Context, obj *model.ComputePlatform) ([]*model.K8sActualSource, error) { + // thinSource, err := endpoints.GetActualSource(ctx, *namespace, *kind, *name) + // if err != nil { + // return nil, err + // } + // k8sActualSource := k8sSourceToGql(thinSource) + + // return k8sActualSources, nil + return obj.K8sActualSources, nil +} From 97628777fda9f35b4b12634c9126a716fd6944d8 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 24 Jul 2024 11:49:09 +0300 Subject: [PATCH 096/374] chore: init gql apollo client --- .../app/(setup)/choose-sources/page.tsx | 47 +++++- frontend/webapp/app/layout.tsx | 23 +-- frontend/webapp/app/page.tsx | 2 + frontend/webapp/lib/gql/apollo-wrapper.tsx | 49 ++++++ frontend/webapp/lib/gql/client.ts | 12 ++ frontend/webapp/lib/gql/index.ts | 1 + frontend/webapp/lib/index.ts | 1 + frontend/webapp/package.json | 3 + frontend/webapp/utils/constants/urls.tsx | 2 +- frontend/webapp/yarn.lock | 146 +++++++++++++++++- 10 files changed, 272 insertions(+), 14 deletions(-) create mode 100644 frontend/webapp/lib/gql/apollo-wrapper.tsx create mode 100644 frontend/webapp/lib/gql/client.ts create mode 100644 frontend/webapp/lib/gql/index.ts create mode 100644 frontend/webapp/lib/index.ts diff --git a/frontend/webapp/app/(setup)/choose-sources/page.tsx b/frontend/webapp/app/(setup)/choose-sources/page.tsx index 495ec2f21..14a203ce5 100644 --- a/frontend/webapp/app/(setup)/choose-sources/page.tsx +++ b/frontend/webapp/app/(setup)/choose-sources/page.tsx @@ -1,10 +1,55 @@ 'use client'; -import React from 'react'; +import React, { useEffect } from 'react'; import { StepsList } from '@/components'; import { ChooseSourcesContainer } from '@/containers'; import { CardWrapper, PageContainer, StepListWrapper } from '../styled'; +import { useSuspenseQuery, gql } from '@apollo/client'; + +const GET_COMPUTE_PLATFORM = gql` + query GetComputePlatform($cpId: ID!) { + computePlatform(cpId: $cpId) { + id + name + computePlatformType + k8sActualSources { + namespace + kind + name + serviceName + autoInstrumented + creationTimestamp + numberOfInstances + hasInstrumentedApplication + instrumentedApplicationDetails { + languages { + containerName + language + } + conditions { + type + status + lastTransitionTime + reason + message + } + } + } + } + } +`; + export default function ChooseSourcesPage() { + const { error, data } = useSuspenseQuery(GET_COMPUTE_PLATFORM, { + variables: { cpId: '1' }, + }); + + useEffect(() => { + if (error) { + console.error(error); + } + console.log({ data }); + }, [error, data]); return ( diff --git a/frontend/webapp/app/layout.tsx b/frontend/webapp/app/layout.tsx index 2387fee82..e36316b12 100644 --- a/frontend/webapp/app/layout.tsx +++ b/frontend/webapp/app/layout.tsx @@ -7,6 +7,7 @@ import { NotificationManager } from '@/components'; import ReduxProvider from '@/store/redux-provider'; import { QueryClient, QueryClientProvider } from 'react-query'; import { ThemeProviderWrapper } from '@keyval-dev/design-system'; +import { ApolloWrapper } from '@/lib'; const LAYOUT_STYLE: React.CSSProperties = { margin: 0, @@ -36,16 +37,18 @@ export default function RootLayout({ return ( - - - - - {children} - - - - - + + + + + + {children} + + + + + + ); diff --git a/frontend/webapp/app/page.tsx b/frontend/webapp/app/page.tsx index bb5248607..8adeeae09 100644 --- a/frontend/webapp/app/page.tsx +++ b/frontend/webapp/app/page.tsx @@ -6,8 +6,10 @@ import { ROUTES, CONFIG, QUERIES } from '@/utils'; import { Loader } from '@keyval-dev/design-system'; import { getDestinations, getConfig } from '@/services'; import { addNotification, store } from '@/store'; + export default function App() { const router = useRouter(); + const { data, isLoading: isConfigLoading } = useQuery( [QUERIES.API_CONFIG], getConfig diff --git a/frontend/webapp/lib/gql/apollo-wrapper.tsx b/frontend/webapp/lib/gql/apollo-wrapper.tsx new file mode 100644 index 000000000..6ccd91e74 --- /dev/null +++ b/frontend/webapp/lib/gql/apollo-wrapper.tsx @@ -0,0 +1,49 @@ +'use client'; + +import { ApolloLink, HttpLink } from '@apollo/client'; +import { + ApolloNextAppProvider, + InMemoryCache, + ApolloClient, + SSRMultipartLink, +} from '@apollo/experimental-nextjs-app-support'; +import { onError } from '@apollo/client/link/error'; + +function makeClient() { + const httpLink = new HttpLink({ + uri: 'http://localhost:8085/graphql', + }); + + const errorLink = onError(({ graphQLErrors, networkError }) => { + if (graphQLErrors) { + graphQLErrors.forEach(({ message, locations, path }) => + console.log( + `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}` + ) + ); + } + if (networkError) console.log(`[Network error]: ${networkError}`); + }); + + return new ApolloClient({ + cache: new InMemoryCache(), + link: + typeof window === 'undefined' + ? ApolloLink.from([ + new SSRMultipartLink({ + stripDefer: true, + }), + errorLink, + httpLink, + ]) + : ApolloLink.from([errorLink, httpLink]), + }); +} + +export function ApolloWrapper({ children }: React.PropsWithChildren<{}>) { + return ( + + {children} + + ); +} diff --git a/frontend/webapp/lib/gql/client.ts b/frontend/webapp/lib/gql/client.ts new file mode 100644 index 000000000..f6260d0a5 --- /dev/null +++ b/frontend/webapp/lib/gql/client.ts @@ -0,0 +1,12 @@ +// lib/client.js +import { HttpLink, InMemoryCache, ApolloClient } from '@apollo/client'; +import { registerApolloClient } from '@apollo/experimental-nextjs-app-support'; + +export const { getClient } = registerApolloClient(() => { + return new ApolloClient({ + cache: new InMemoryCache(), + link: new HttpLink({ + uri: 'https://main--time-pav6zq.apollographos.net/graphql', + }), + }); +}); diff --git a/frontend/webapp/lib/gql/index.ts b/frontend/webapp/lib/gql/index.ts new file mode 100644 index 000000000..32e0cb77d --- /dev/null +++ b/frontend/webapp/lib/gql/index.ts @@ -0,0 +1 @@ +export * from './apollo-wrapper'; diff --git a/frontend/webapp/lib/index.ts b/frontend/webapp/lib/index.ts new file mode 100644 index 000000000..8a12aabda --- /dev/null +++ b/frontend/webapp/lib/index.ts @@ -0,0 +1 @@ +export * from './gql'; diff --git a/frontend/webapp/package.json b/frontend/webapp/package.json index 3d3733390..da7a1c730 100644 --- a/frontend/webapp/package.json +++ b/frontend/webapp/package.json @@ -10,6 +10,8 @@ "lint:fix": "next lint --fix" }, "dependencies": { + "@apollo/client": "^3.11.0-rc.2", + "@apollo/experimental-nextjs-app-support": "^0.11.2", "@focus-reactive/react-yaml": "^1.1.2", "@keyval-dev/design-system": "^2.0.2", "@next/font": "^13.4.7", @@ -22,6 +24,7 @@ "axios": "^1.4.0", "eslint": "8.42.0", "eslint-config-next": "13.4.5", + "graphql": "^16.9.0", "next": "13.5.4", "postcss": "^8.4.26", "prop-types": "^15.8.1", diff --git a/frontend/webapp/utils/constants/urls.tsx b/frontend/webapp/utils/constants/urls.tsx index c340e33b3..8eeadac81 100644 --- a/frontend/webapp/utils/constants/urls.tsx +++ b/frontend/webapp/utils/constants/urls.tsx @@ -38,4 +38,4 @@ export const ACTION_DOCS_LINK = 'https://docs.odigos.io/pipeline/actions/introduction'; export const ACTION_ITEM_DOCS_LINK = 'https://docs.odigos.io/pipeline/actions'; -export { API, QUERIES, SLACK_INVITE_LINK }; +export { API, QUERIES, SLACK_INVITE_LINK, BASE_URL }; diff --git a/frontend/webapp/yarn.lock b/frontend/webapp/yarn.lock index fa1c7f596..a29e061c7 100644 --- a/frontend/webapp/yarn.lock +++ b/frontend/webapp/yarn.lock @@ -10,6 +10,40 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" +"@apollo/client-react-streaming@0.11.2": + version "0.11.2" + resolved "https://registry.yarnpkg.com/@apollo/client-react-streaming/-/client-react-streaming-0.11.2.tgz#788a5b0254469b679f8abf5391e40c420fe61965" + integrity sha512-rRA/dIA09/Y6+jtGGBnXHQfPOv6BYYVZwQP8OzQtWrWbSgDEI6uAhqULssU5f0ZhQJVzKDuslqGE9QAX0gdfRQ== + dependencies: + ts-invariant "^0.10.3" + +"@apollo/client@^3.11.0-rc.2": + version "3.11.0-rc.2" + resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.11.0-rc.2.tgz#69cbdf263330edf313f02f782ab30a3b8420c5d1" + integrity sha512-k5mj92/WKwMpnrViL3+EYGQwQ7grlo3xho9ZLIU/Y7+7KLGHpXVtb4lrqoZHA1+SqXFciZOu4sUx5ysAuv325g== + dependencies: + "@graphql-typed-document-node/core" "^3.1.1" + "@wry/caches" "^1.0.0" + "@wry/equality" "^0.5.6" + "@wry/trie" "^0.5.0" + graphql-tag "^2.12.6" + hoist-non-react-statics "^3.3.2" + optimism "^0.18.0" + prop-types "^15.7.2" + rehackt "^0.1.0" + response-iterator "^0.2.6" + symbol-observable "^4.0.0" + ts-invariant "^0.10.3" + tslib "^2.3.0" + zen-observable-ts "^1.2.5" + +"@apollo/experimental-nextjs-app-support@^0.11.2": + version "0.11.2" + resolved "https://registry.yarnpkg.com/@apollo/experimental-nextjs-app-support/-/experimental-nextjs-app-support-0.11.2.tgz#3df9253229afd6ec94bc5873f649f23c487c9dfb" + integrity sha512-HRQ8/Ux/tM2pezrhZeoHsJs55+nJvJZRV1B21QwEVtWhslQXjT5gqs5nKw86KURF0xR7gX18Nyy659NzJ09Pmw== + dependencies: + "@apollo/client-react-streaming" "0.11.2" + "@babel/cli@^7.21.0": version "7.22.6" resolved "https://registry.npmjs.org/@babel/cli/-/cli-7.22.6.tgz" @@ -1394,6 +1428,11 @@ "@codemirror/view" "^0.19.4" js-yaml "^4.1.0" +"@graphql-typed-document-node/core@^3.1.1": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" + integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== + "@humanwhocodes/config-array@^0.11.10": version "0.11.10" resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz" @@ -2284,6 +2323,41 @@ "@typescript-eslint/types" "5.59.9" eslint-visitor-keys "^3.3.0" +"@wry/caches@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@wry/caches/-/caches-1.0.1.tgz#8641fd3b6e09230b86ce8b93558d44cf1ece7e52" + integrity sha512-bXuaUNLVVkD20wcGBWRyo7j9N3TxePEWFZj2Y+r9OoUzfqmavM84+mFykRicNsBqatba5JLay1t48wxaXaWnlA== + dependencies: + tslib "^2.3.0" + +"@wry/context@^0.7.0": + version "0.7.4" + resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.7.4.tgz#e32d750fa075955c4ab2cfb8c48095e1d42d5990" + integrity sha512-jmT7Sb4ZQWI5iyu3lobQxICu2nC/vbUhP0vIdd6tHC9PTfenmRmuIFqktc6GH9cgi+ZHnsLWPvfSvc4DrYmKiQ== + dependencies: + tslib "^2.3.0" + +"@wry/equality@^0.5.6": + version "0.5.7" + resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.5.7.tgz#72ec1a73760943d439d56b7b1e9985aec5d497bb" + integrity sha512-BRFORjsTuQv5gxcXsuDXx6oGRhuVsEGwZy6LOzRRfgu+eSfxbhUQ9L9YtSEIuIjY/o7g3iWFjrc5eSY1GXP2Dw== + dependencies: + tslib "^2.3.0" + +"@wry/trie@^0.4.3": + version "0.4.3" + resolved "https://registry.yarnpkg.com/@wry/trie/-/trie-0.4.3.tgz#077d52c22365871bf3ffcbab8e95cb8bc5689af4" + integrity sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w== + dependencies: + tslib "^2.3.0" + +"@wry/trie@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@wry/trie/-/trie-0.5.0.tgz#11e783f3a53f6e4cd1d42d2d1323f5bc3fa99c94" + integrity sha512-FNoYzHawTMk/6KMQoEG5O4PuioX19UbwdQKF44yw0nLfOypfQdjtfZzo/UIJWAJ23sNIFbD1Ug9lbaDGMwbqQA== + dependencies: + tslib "^2.3.0" + acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" @@ -3704,6 +3778,18 @@ graphemer@^1.4.0: resolved "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== +graphql-tag@^2.12.6: + version "2.12.6" + resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1" + integrity sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg== + dependencies: + tslib "^2.1.0" + +graphql@^16.9.0: + version "16.9.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.9.0.tgz#1c310e63f16a49ce1fbb230bd0a000e99f6f115f" + integrity sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw== + has-bigints@^1.0.1, has-bigints@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz" @@ -3750,6 +3836,13 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" +hoist-non-react-statics@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" + integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== + dependencies: + react-is "^16.7.0" + human-signals@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz" @@ -4463,6 +4556,16 @@ open@^9.1.0: is-inside-container "^1.0.0" is-wsl "^2.2.0" +optimism@^0.18.0: + version "0.18.0" + resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.18.0.tgz#e7bb38b24715f3fdad8a9a7fc18e999144bbfa63" + integrity sha512-tGn8+REwLRNFnb9WmcY5IfpOqeX2kpaYJ1s6Ae3mn12AeydLkR3j+jSCmVQFoXqU8D41PAJ1RG1rCRNWmNZVmQ== + dependencies: + "@wry/caches" "^1.0.0" + "@wry/context" "^0.7.0" + "@wry/trie" "^0.4.3" + tslib "^2.3.0" + optionator@^0.9.1: version "0.9.1" resolved "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz" @@ -4588,7 +4691,7 @@ prelude-ls@^1.2.1: resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prop-types@^15.8.1: +prop-types@^15.7.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz" integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== @@ -4620,7 +4723,7 @@ react-dom@18.2.0: loose-envify "^1.1.0" scheduler "^0.23.0" -react-is@^16.13.1: +react-is@^16.13.1, react-is@^16.7.0: version "16.13.1" resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== @@ -4730,6 +4833,11 @@ regjsparser@^0.9.1: dependencies: jsesc "~0.5.0" +rehackt@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/rehackt/-/rehackt-0.1.0.tgz#a7c5e289c87345f70da8728a7eb878e5d03c696b" + integrity sha512-7kRDOuLHB87D/JESKxQoRwv4DzbIdwkAGQ7p6QKGdVlY1IZheUnVhlk/4UZlNUVxdAXpyxikE3URsG067ybVzw== + remove-accents@0.5.0: version "0.5.0" resolved "https://registry.npmjs.org/remove-accents/-/remove-accents-0.5.0.tgz" @@ -4768,6 +4876,11 @@ resolve@^2.0.0-next.4: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +response-iterator@^0.2.6: + version "0.2.6" + resolved "https://registry.yarnpkg.com/response-iterator/-/response-iterator-0.2.6.tgz#249005fb14d2e4eeb478a3f735a28fd8b4c9f3da" + integrity sha512-pVzEEzrsg23Sh053rmDUvLSkGXluZio0qu8VT6ukrYuvtjVfCbDZH9d6PGXb8HZfzdNZt8feXv/jvUzlhRgLnw== + reusify@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz" @@ -5084,6 +5197,11 @@ swr@^2.1.5: dependencies: use-sync-external-store "^1.2.0" +symbol-observable@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-4.0.0.tgz#5b425f192279e87f2f9b937ac8540d1984b39205" + integrity sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ== + synckit@^0.8.5: version "0.8.5" resolved "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz" @@ -5119,6 +5237,13 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +ts-invariant@^0.10.3: + version "0.10.3" + resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.10.3.tgz#3e048ff96e91459ffca01304dbc7f61c1f642f6c" + integrity sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ== + dependencies: + tslib "^2.1.0" + tsconfig-paths@^3.14.1: version "3.14.2" resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz" @@ -5139,6 +5264,11 @@ tslib@^2.0.3, tslib@^2.4.0, tslib@^2.5.0: resolved "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz" integrity sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w== +tslib@^2.1.0, tslib@^2.3.0: + version "2.6.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" + integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== + tsutils@^3.21.0: version "3.21.0" resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz" @@ -5326,6 +5456,18 @@ yocto-queue@^0.1.0: resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== +zen-observable-ts@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-1.2.5.tgz#6c6d9ea3d3a842812c6e9519209365a122ba8b58" + integrity sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg== + dependencies: + zen-observable "0.8.15" + +zen-observable@0.8.15: + version "0.8.15" + resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15" + integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ== + zod@3.21.4: version "3.21.4" resolved "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz" From c437800f7ef25d07d7eab523c803ed2a53af8233 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 24 Jul 2024 13:45:26 +0300 Subject: [PATCH 097/374] chore: wip --- frontend/webapp/app/page.tsx | 28 ++++--------------- frontend/webapp/graphql/index.ts | 1 + frontend/webapp/graphql/queries/config.ts | 10 +++++++ frontend/webapp/graphql/queries/index.ts | 1 + frontend/webapp/hooks/index.tsx | 1 + frontend/webapp/hooks/new-config/index.ts | 1 + frontend/webapp/hooks/new-config/useConfig.ts | 16 +++++++++++ frontend/webapp/types/common.ts | 6 ++++ 8 files changed, 42 insertions(+), 22 deletions(-) create mode 100644 frontend/webapp/graphql/index.ts create mode 100644 frontend/webapp/graphql/queries/config.ts create mode 100644 frontend/webapp/graphql/queries/index.ts create mode 100644 frontend/webapp/hooks/new-config/index.ts create mode 100644 frontend/webapp/hooks/new-config/useConfig.ts diff --git a/frontend/webapp/app/page.tsx b/frontend/webapp/app/page.tsx index 8adeeae09..ec28d1ded 100644 --- a/frontend/webapp/app/page.tsx +++ b/frontend/webapp/app/page.tsx @@ -1,29 +1,18 @@ 'use client'; import { useEffect } from 'react'; -import { useQuery } from 'react-query'; +import { useConfig } from '@/hooks'; +import { ROUTES, CONFIG } from '@/utils'; import { useRouter } from 'next/navigation'; -import { ROUTES, CONFIG, QUERIES } from '@/utils'; -import { Loader } from '@keyval-dev/design-system'; -import { getDestinations, getConfig } from '@/services'; import { addNotification, store } from '@/store'; +import { Loader } from '@keyval-dev/design-system'; export default function App() { const router = useRouter(); + const { data, error } = useConfig(); - const { data, isLoading: isConfigLoading } = useQuery( - [QUERIES.API_CONFIG], - getConfig - ); - const { - isLoading: isDestinationLoading, - data: destinationList, - error, - } = useQuery([QUERIES.API_DESTINATIONS], getDestinations); useEffect(() => { - if (isConfigLoading || isDestinationLoading) return; - - renderCurrentPage(); - }, [data, destinationList]); + data && renderCurrentPage(); + }, [data, error]); useEffect(() => { if (!error) return; @@ -43,11 +32,6 @@ export default function App() { function renderCurrentPage() { const { installation } = data; - if (destinationList.length > 0) { - router.push(ROUTES.OVERVIEW); - return; - } - switch (installation) { case CONFIG.NEW: case CONFIG.APPS_SELECTED: diff --git a/frontend/webapp/graphql/index.ts b/frontend/webapp/graphql/index.ts new file mode 100644 index 000000000..3cf1ef310 --- /dev/null +++ b/frontend/webapp/graphql/index.ts @@ -0,0 +1 @@ +export * from './queries'; diff --git a/frontend/webapp/graphql/queries/config.ts b/frontend/webapp/graphql/queries/config.ts new file mode 100644 index 000000000..aea46dda4 --- /dev/null +++ b/frontend/webapp/graphql/queries/config.ts @@ -0,0 +1,10 @@ +import { gql } from '@apollo/client'; + +// Define the GraphQL query +export const GET_CONFIG = gql` + query GetConfig { + config { + installation + } + } +`; diff --git a/frontend/webapp/graphql/queries/index.ts b/frontend/webapp/graphql/queries/index.ts new file mode 100644 index 000000000..f03c2281a --- /dev/null +++ b/frontend/webapp/graphql/queries/index.ts @@ -0,0 +1 @@ +export * from './config'; diff --git a/frontend/webapp/hooks/index.tsx b/frontend/webapp/hooks/index.tsx index 25b8aaeb8..7bae585c0 100644 --- a/frontend/webapp/hooks/index.tsx +++ b/frontend/webapp/hooks/index.tsx @@ -7,3 +7,4 @@ export * from './destinations'; export * from './actions'; export * from './useNotify'; export * from './useSSE'; +export * from './new-config'; diff --git a/frontend/webapp/hooks/new-config/index.ts b/frontend/webapp/hooks/new-config/index.ts new file mode 100644 index 000000000..4852f577a --- /dev/null +++ b/frontend/webapp/hooks/new-config/index.ts @@ -0,0 +1 @@ +export * from './useConfig'; diff --git a/frontend/webapp/hooks/new-config/useConfig.ts b/frontend/webapp/hooks/new-config/useConfig.ts new file mode 100644 index 000000000..4f262c758 --- /dev/null +++ b/frontend/webapp/hooks/new-config/useConfig.ts @@ -0,0 +1,16 @@ +import { useEffect } from 'react'; +import { Config } from '@/types'; +import { GET_CONFIG } from '@/graphql'; +import { useSuspenseQuery } from '@apollo/client'; + +export const useConfig = () => { + const { data, error } = useSuspenseQuery(GET_CONFIG); + + useEffect(() => { + if (error) { + console.error('Error fetching config:', error); + } + }, [error]); + + return { data: data?.config, error }; +}; diff --git a/frontend/webapp/types/common.ts b/frontend/webapp/types/common.ts index b739aa8fa..2640ccccf 100644 --- a/frontend/webapp/types/common.ts +++ b/frontend/webapp/types/common.ts @@ -17,3 +17,9 @@ export interface Notification { crdType?: string; type: 'success' | 'error' | 'info'; } + +export type Config = { + config: { + installation: string; + }; +}; From 6ee566ffa4e451dc89fca06e1cd64de431263a27 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 24 Jul 2024 13:54:40 +0300 Subject: [PATCH 098/374] chore: init base gql schema --- frontend/endpoints/config.go | 10 +- frontend/graph/generated.go | 7735 ++++++---------------------- frontend/graph/model/models_gen.go | 128 +- frontend/graph/schema.graphqls | 148 +- frontend/graph/schema.resolvers.go | 93 +- frontend/main.go | 1 - 6 files changed, 1761 insertions(+), 6354 deletions(-) diff --git a/frontend/endpoints/config.go b/frontend/endpoints/config.go index f58e77131..f98dcc73b 100644 --- a/frontend/endpoints/config.go +++ b/frontend/endpoints/config.go @@ -4,9 +4,7 @@ import ( "context" "fmt" "log" - "net/http" - "github.com/gin-gonic/gin" "github.com/odigos-io/odigos/common/consts" "github.com/odigos-io/odigos/frontend/kube" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -24,17 +22,17 @@ type GetConfigResponse struct { Installation InstallationStatus `json:"installation"` } -func GetConfig(c *gin.Context) { +func GetConfig(c context.Context) GetConfigResponse { var response GetConfigResponse - if !isSomethingLabeled(c.Request.Context()) { + if !isSomethingLabeled(c) { response.Installation = NewInstallation - } else if !isDestinationChosen(c.Request.Context()) { + } else if !isDestinationChosen(c) { response.Installation = AppsSelected } else { response.Installation = Finished } - c.JSON(http.StatusOK, response) + return response } func isDestinationChosen(ctx context.Context) bool { diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index ba6988c46..f85cf9f8c 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -48,27 +48,7 @@ type DirectiveRoot struct { } type ComplexityRoot struct { - ActualAction struct { - Details func(childComplexity int) int - Disable func(childComplexity int) int - ID func(childComplexity int) int - Kind func(childComplexity int) int - Name func(childComplexity int) int - Notes func(childComplexity int) int - Signals func(childComplexity int) int - } - - ActualDestination struct { - ExportedSignals func(childComplexity int) int - Fields func(childComplexity int) int - ID func(childComplexity int) int - Name func(childComplexity int) int - Type func(childComplexity int) int - } - ComputePlatform struct { - ActualActions func(childComplexity int) int - ActualDestinations func(childComplexity int) int ComputePlatformType func(childComplexity int) int ID func(childComplexity int) int K8sActualNamespace func(childComplexity int, name string) int @@ -86,43 +66,8 @@ type ComplexityRoot struct { Type func(childComplexity int) int } - DesiredDestination struct { - ComputePlatforms func(childComplexity int) int - ExportSignals func(childComplexity int) int - Fields func(childComplexity int) int - ID func(childComplexity int) int - Name func(childComplexity int) int - Type func(childComplexity int) int - } - - DestinationSpecField struct { - Name func(childComplexity int) int - Value func(childComplexity int) int - } - - DestinationType struct { - Category func(childComplexity int) int - DisplayName func(childComplexity int) int - Fields func(childComplexity int) int - Image func(childComplexity int) int - Name func(childComplexity int) int - SupportedSignals func(childComplexity int) int - } - - DestinationTypeCategory struct { - DestinationTypes func(childComplexity int) int - Name func(childComplexity int) int - } - - DestinationTypeField struct { - ComponentProps func(childComplexity int) int - ComponentType func(childComplexity int) int - DisplayName func(childComplexity int) int - InitialValue func(childComplexity int) int - Name func(childComplexity int) int - Secret func(childComplexity int) int - ThumbnailURL func(childComplexity int) int - VideoURL func(childComplexity int) int + GetConfigResponse struct { + Installation func(childComplexity int) int } InstrumentedApplicationDetails struct { @@ -158,24 +103,12 @@ type ComplexityRoot struct { } Mutation struct { - ApplyDesiredDestinationToComputePlatform func(childComplexity int, cpID string, destinationID string) int - ApplyDesiredNamespace func(childComplexity int, cpID string, nsID model.K8sNamespaceID, ns model.K8sDesiredNamespaceInput) int - ApplyDesiredSource func(childComplexity int, cpID string, sourceID model.K8sSourceID, source model.K8sDesiredSourceInput) int - CreateDesiredAction func(childComplexity int, cpID string, action model.DesiredActionInput) int - CreateDesiredDestination func(childComplexity int, destinationType string, destination model.DesiredDestinationInput) int - DeleteActualAction func(childComplexity int, cpID string, actionID string, kind string) int - DeleteDesiredDestination func(childComplexity int, destinationID string) int - DeleteDesiredNamespace func(childComplexity int, cpID string, nsID model.K8sNamespaceID) int - DeleteDesiredSource func(childComplexity int, cpID string, sourceID model.K8sSourceID) int - RemoveDesiredDestinationFromComputePlatform func(childComplexity int, cpID string, destinationID string) int - UpdateDesiredAction func(childComplexity int, cpID string, actionID string, action model.DesiredActionInput) int - UpdateDesiredDestination func(childComplexity int, destinationID string, destination model.DesiredDestinationInput) int + CreateK8sDesiredNamespace func(childComplexity int, cpID string, namespace model.K8sDesiredNamespaceInput) int } Query struct { - ComputePlatform func(childComplexity int, cpID string) int - DesiredDestinations func(childComplexity int) int - DestinationTypeCategories func(childComplexity int) int + ComputePlatform func(childComplexity int, cpID string) int + Config func(childComplexity int) int } SourceLanguage struct { @@ -188,23 +121,11 @@ type ComputePlatformResolver interface { K8sActualSource(ctx context.Context, obj *model.ComputePlatform, name *string, namespace *string, kind *string) (*model.K8sActualSource, error) } type MutationResolver interface { - ApplyDesiredNamespace(ctx context.Context, cpID string, nsID model.K8sNamespaceID, ns model.K8sDesiredNamespaceInput) (bool, error) - DeleteDesiredNamespace(ctx context.Context, cpID string, nsID model.K8sNamespaceID) (bool, error) - ApplyDesiredSource(ctx context.Context, cpID string, sourceID model.K8sSourceID, source model.K8sDesiredSourceInput) (bool, error) - DeleteDesiredSource(ctx context.Context, cpID string, sourceID model.K8sSourceID) (bool, error) - CreateDesiredDestination(ctx context.Context, destinationType string, destination model.DesiredDestinationInput) (*model.DesiredDestination, error) - UpdateDesiredDestination(ctx context.Context, destinationID string, destination model.DesiredDestinationInput) (*model.DesiredDestination, error) - DeleteDesiredDestination(ctx context.Context, destinationID string) (bool, error) - ApplyDesiredDestinationToComputePlatform(ctx context.Context, cpID string, destinationID string) (bool, error) - RemoveDesiredDestinationFromComputePlatform(ctx context.Context, cpID string, destinationID string) (bool, error) - CreateDesiredAction(ctx context.Context, cpID string, action model.DesiredActionInput) (bool, error) - UpdateDesiredAction(ctx context.Context, cpID string, actionID string, action model.DesiredActionInput) (bool, error) - DeleteActualAction(ctx context.Context, cpID string, actionID string, kind string) (bool, error) + CreateK8sDesiredNamespace(ctx context.Context, cpID string, namespace model.K8sDesiredNamespaceInput) (*model.K8sActualNamespace, error) } type QueryResolver interface { ComputePlatform(ctx context.Context, cpID string) (*model.ComputePlatform, error) - DestinationTypeCategories(ctx context.Context) ([]*model.DestinationTypeCategory, error) - DesiredDestinations(ctx context.Context) ([]*model.DesiredDestination, error) + Config(ctx context.Context) (*model.GetConfigResponse, error) } type executableSchema struct { @@ -226,104 +147,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in _ = ec switch typeName + "." + field { - case "ActualAction.details": - if e.complexity.ActualAction.Details == nil { - break - } - - return e.complexity.ActualAction.Details(childComplexity), true - - case "ActualAction.disable": - if e.complexity.ActualAction.Disable == nil { - break - } - - return e.complexity.ActualAction.Disable(childComplexity), true - - case "ActualAction.id": - if e.complexity.ActualAction.ID == nil { - break - } - - return e.complexity.ActualAction.ID(childComplexity), true - - case "ActualAction.kind": - if e.complexity.ActualAction.Kind == nil { - break - } - - return e.complexity.ActualAction.Kind(childComplexity), true - - case "ActualAction.name": - if e.complexity.ActualAction.Name == nil { - break - } - - return e.complexity.ActualAction.Name(childComplexity), true - - case "ActualAction.notes": - if e.complexity.ActualAction.Notes == nil { - break - } - - return e.complexity.ActualAction.Notes(childComplexity), true - - case "ActualAction.signals": - if e.complexity.ActualAction.Signals == nil { - break - } - - return e.complexity.ActualAction.Signals(childComplexity), true - - case "ActualDestination.exportedSignals": - if e.complexity.ActualDestination.ExportedSignals == nil { - break - } - - return e.complexity.ActualDestination.ExportedSignals(childComplexity), true - - case "ActualDestination.fields": - if e.complexity.ActualDestination.Fields == nil { - break - } - - return e.complexity.ActualDestination.Fields(childComplexity), true - - case "ActualDestination.id": - if e.complexity.ActualDestination.ID == nil { - break - } - - return e.complexity.ActualDestination.ID(childComplexity), true - - case "ActualDestination.name": - if e.complexity.ActualDestination.Name == nil { - break - } - - return e.complexity.ActualDestination.Name(childComplexity), true - - case "ActualDestination.type": - if e.complexity.ActualDestination.Type == nil { - break - } - - return e.complexity.ActualDestination.Type(childComplexity), true - - case "ComputePlatform.actualActions": - if e.complexity.ComputePlatform.ActualActions == nil { - break - } - - return e.complexity.ComputePlatform.ActualActions(childComplexity), true - - case "ComputePlatform.actualDestinations": - if e.complexity.ComputePlatform.ActualDestinations == nil { - break - } - - return e.complexity.ComputePlatform.ActualDestinations(childComplexity), true - case "ComputePlatform.computePlatformType": if e.complexity.ComputePlatform.ComputePlatformType == nil { break @@ -418,173 +241,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Condition.Type(childComplexity), true - case "DesiredDestination.computePlatforms": - if e.complexity.DesiredDestination.ComputePlatforms == nil { - break - } - - return e.complexity.DesiredDestination.ComputePlatforms(childComplexity), true - - case "DesiredDestination.exportSignals": - if e.complexity.DesiredDestination.ExportSignals == nil { - break - } - - return e.complexity.DesiredDestination.ExportSignals(childComplexity), true - - case "DesiredDestination.fields": - if e.complexity.DesiredDestination.Fields == nil { - break - } - - return e.complexity.DesiredDestination.Fields(childComplexity), true - - case "DesiredDestination.id": - if e.complexity.DesiredDestination.ID == nil { - break - } - - return e.complexity.DesiredDestination.ID(childComplexity), true - - case "DesiredDestination.name": - if e.complexity.DesiredDestination.Name == nil { - break - } - - return e.complexity.DesiredDestination.Name(childComplexity), true - - case "DesiredDestination.type": - if e.complexity.DesiredDestination.Type == nil { - break - } - - return e.complexity.DesiredDestination.Type(childComplexity), true - - case "DestinationSpecField.name": - if e.complexity.DestinationSpecField.Name == nil { - break - } - - return e.complexity.DestinationSpecField.Name(childComplexity), true - - case "DestinationSpecField.value": - if e.complexity.DestinationSpecField.Value == nil { - break - } - - return e.complexity.DestinationSpecField.Value(childComplexity), true - - case "DestinationType.category": - if e.complexity.DestinationType.Category == nil { - break - } - - return e.complexity.DestinationType.Category(childComplexity), true - - case "DestinationType.displayName": - if e.complexity.DestinationType.DisplayName == nil { - break - } - - return e.complexity.DestinationType.DisplayName(childComplexity), true - - case "DestinationType.fields": - if e.complexity.DestinationType.Fields == nil { - break - } - - return e.complexity.DestinationType.Fields(childComplexity), true - - case "DestinationType.image": - if e.complexity.DestinationType.Image == nil { - break - } - - return e.complexity.DestinationType.Image(childComplexity), true - - case "DestinationType.name": - if e.complexity.DestinationType.Name == nil { - break - } - - return e.complexity.DestinationType.Name(childComplexity), true - - case "DestinationType.supportedSignals": - if e.complexity.DestinationType.SupportedSignals == nil { - break - } - - return e.complexity.DestinationType.SupportedSignals(childComplexity), true - - case "DestinationTypeCategory.destinationTypes": - if e.complexity.DestinationTypeCategory.DestinationTypes == nil { - break - } - - return e.complexity.DestinationTypeCategory.DestinationTypes(childComplexity), true - - case "DestinationTypeCategory.name": - if e.complexity.DestinationTypeCategory.Name == nil { - break - } - - return e.complexity.DestinationTypeCategory.Name(childComplexity), true - - case "DestinationTypeField.componentProps": - if e.complexity.DestinationTypeField.ComponentProps == nil { - break - } - - return e.complexity.DestinationTypeField.ComponentProps(childComplexity), true - - case "DestinationTypeField.componentType": - if e.complexity.DestinationTypeField.ComponentType == nil { - break - } - - return e.complexity.DestinationTypeField.ComponentType(childComplexity), true - - case "DestinationTypeField.displayName": - if e.complexity.DestinationTypeField.DisplayName == nil { - break - } - - return e.complexity.DestinationTypeField.DisplayName(childComplexity), true - - case "DestinationTypeField.initialValue": - if e.complexity.DestinationTypeField.InitialValue == nil { - break - } - - return e.complexity.DestinationTypeField.InitialValue(childComplexity), true - - case "DestinationTypeField.name": - if e.complexity.DestinationTypeField.Name == nil { - break - } - - return e.complexity.DestinationTypeField.Name(childComplexity), true - - case "DestinationTypeField.secret": - if e.complexity.DestinationTypeField.Secret == nil { - break - } - - return e.complexity.DestinationTypeField.Secret(childComplexity), true - - case "DestinationTypeField.thumbnailURL": - if e.complexity.DestinationTypeField.ThumbnailURL == nil { - break - } - - return e.complexity.DestinationTypeField.ThumbnailURL(childComplexity), true - - case "DestinationTypeField.videoURL": - if e.complexity.DestinationTypeField.VideoURL == nil { + case "GetConfigResponse.installation": + if e.complexity.GetConfigResponse.Installation == nil { break } - return e.complexity.DestinationTypeField.VideoURL(childComplexity), true + return e.complexity.GetConfigResponse.Installation(childComplexity), true case "InstrumentedApplicationDetails.conditions": if e.complexity.InstrumentedApplicationDetails.Conditions == nil { @@ -705,149 +367,17 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.K8sActualSourceRuntimeInfoContainer.Language(childComplexity), true - case "Mutation.applyDesiredDestinationToComputePlatform": - if e.complexity.Mutation.ApplyDesiredDestinationToComputePlatform == nil { - break - } - - args, err := ec.field_Mutation_applyDesiredDestinationToComputePlatform_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.ApplyDesiredDestinationToComputePlatform(childComplexity, args["cpId"].(string), args["destinationId"].(string)), true - - case "Mutation.applyDesiredNamespace": - if e.complexity.Mutation.ApplyDesiredNamespace == nil { - break - } - - args, err := ec.field_Mutation_applyDesiredNamespace_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.ApplyDesiredNamespace(childComplexity, args["cpId"].(string), args["nsId"].(model.K8sNamespaceID), args["ns"].(model.K8sDesiredNamespaceInput)), true - - case "Mutation.applyDesiredSource": - if e.complexity.Mutation.ApplyDesiredSource == nil { - break - } - - args, err := ec.field_Mutation_applyDesiredSource_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.ApplyDesiredSource(childComplexity, args["cpId"].(string), args["sourceId"].(model.K8sSourceID), args["source"].(model.K8sDesiredSourceInput)), true - - case "Mutation.createDesiredAction": - if e.complexity.Mutation.CreateDesiredAction == nil { - break - } - - args, err := ec.field_Mutation_createDesiredAction_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.CreateDesiredAction(childComplexity, args["cpId"].(string), args["action"].(model.DesiredActionInput)), true - - case "Mutation.createDesiredDestination": - if e.complexity.Mutation.CreateDesiredDestination == nil { - break - } - - args, err := ec.field_Mutation_createDesiredDestination_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.CreateDesiredDestination(childComplexity, args["destinationType"].(string), args["destination"].(model.DesiredDestinationInput)), true - - case "Mutation.deleteActualAction": - if e.complexity.Mutation.DeleteActualAction == nil { - break - } - - args, err := ec.field_Mutation_deleteActualAction_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.DeleteActualAction(childComplexity, args["cpId"].(string), args["actionId"].(string), args["kind"].(string)), true - - case "Mutation.deleteDesiredDestination": - if e.complexity.Mutation.DeleteDesiredDestination == nil { - break - } - - args, err := ec.field_Mutation_deleteDesiredDestination_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.DeleteDesiredDestination(childComplexity, args["destinationId"].(string)), true - - case "Mutation.deleteDesiredNamespace": - if e.complexity.Mutation.DeleteDesiredNamespace == nil { - break - } - - args, err := ec.field_Mutation_deleteDesiredNamespace_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.DeleteDesiredNamespace(childComplexity, args["cpId"].(string), args["nsId"].(model.K8sNamespaceID)), true - - case "Mutation.deleteDesiredSource": - if e.complexity.Mutation.DeleteDesiredSource == nil { - break - } - - args, err := ec.field_Mutation_deleteDesiredSource_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.DeleteDesiredSource(childComplexity, args["cpId"].(string), args["sourceId"].(model.K8sSourceID)), true - - case "Mutation.removeDesiredDestinationFromComputePlatform": - if e.complexity.Mutation.RemoveDesiredDestinationFromComputePlatform == nil { - break - } - - args, err := ec.field_Mutation_removeDesiredDestinationFromComputePlatform_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.RemoveDesiredDestinationFromComputePlatform(childComplexity, args["cpId"].(string), args["destinationId"].(string)), true - - case "Mutation.updateDesiredAction": - if e.complexity.Mutation.UpdateDesiredAction == nil { - break - } - - args, err := ec.field_Mutation_updateDesiredAction_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Mutation.UpdateDesiredAction(childComplexity, args["cpId"].(string), args["actionId"].(string), args["action"].(model.DesiredActionInput)), true - - case "Mutation.updateDesiredDestination": - if e.complexity.Mutation.UpdateDesiredDestination == nil { + case "Mutation.createK8sDesiredNamespace": + if e.complexity.Mutation.CreateK8sDesiredNamespace == nil { break } - args, err := ec.field_Mutation_updateDesiredDestination_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_createK8sDesiredNamespace_args(context.TODO(), rawArgs) if err != nil { return 0, false } - return e.complexity.Mutation.UpdateDesiredDestination(childComplexity, args["destinationId"].(string), args["destination"].(model.DesiredDestinationInput)), true + return e.complexity.Mutation.CreateK8sDesiredNamespace(childComplexity, args["cpId"].(string), args["namespace"].(model.K8sDesiredNamespaceInput)), true case "Query.computePlatform": if e.complexity.Query.ComputePlatform == nil { @@ -861,19 +391,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.ComputePlatform(childComplexity, args["cpId"].(string)), true - case "Query.desiredDestinations": - if e.complexity.Query.DesiredDestinations == nil { - break - } - - return e.complexity.Query.DesiredDestinations(childComplexity), true - - case "Query.destinationTypeCategories": - if e.complexity.Query.DestinationTypeCategories == nil { + case "Query.config": + if e.complexity.Query.Config == nil { break } - return e.complexity.Query.DestinationTypeCategories(childComplexity), true + return e.complexity.Query.Config(childComplexity), true case "SourceLanguage.containerName": if e.complexity.SourceLanguage.ContainerName == nil { @@ -897,14 +420,10 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( - ec.unmarshalInputDesiredActionInput, - ec.unmarshalInputDesiredDestinationFieldInput, - ec.unmarshalInputDesiredDestinationInput, ec.unmarshalInputK8sDesiredNamespaceInput, ec.unmarshalInputK8sDesiredSourceInput, ec.unmarshalInputK8sNamespaceId, ec.unmarshalInputK8sSourceId, - ec.unmarshalInputWorkloadInput, ) first := true @@ -1069,7 +588,7 @@ func (ec *executionContext) field_ComputePlatform_k8sActualSource_args(ctx conte return args, nil } -func (ec *executionContext) field_Mutation_applyDesiredDestinationToComputePlatform_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_createK8sDesiredNamespace_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string @@ -1081,306 +600,15 @@ func (ec *executionContext) field_Mutation_applyDesiredDestinationToComputePlatf } } args["cpId"] = arg0 - var arg1 string - if tmp, ok := rawArgs["destinationId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationId")) - arg1, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["destinationId"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_applyDesiredNamespace_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["cpId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) - arg0, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cpId"] = arg0 - var arg1 model.K8sNamespaceID - if tmp, ok := rawArgs["nsId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nsId")) - arg1, err = ec.unmarshalNK8sNamespaceId2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sNamespaceID(ctx, tmp) - if err != nil { - return nil, err - } - } - args["nsId"] = arg1 - var arg2 model.K8sDesiredNamespaceInput - if tmp, ok := rawArgs["ns"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ns")) - arg2, err = ec.unmarshalNK8sDesiredNamespaceInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sDesiredNamespaceInput(ctx, tmp) - if err != nil { - return nil, err - } - } - args["ns"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_applyDesiredSource_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["cpId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) - arg0, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cpId"] = arg0 - var arg1 model.K8sSourceID - if tmp, ok := rawArgs["sourceId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sourceId")) - arg1, err = ec.unmarshalNK8sSourceId2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sSourceID(ctx, tmp) - if err != nil { - return nil, err - } - } - args["sourceId"] = arg1 - var arg2 model.K8sDesiredSourceInput - if tmp, ok := rawArgs["source"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("source")) - arg2, err = ec.unmarshalNK8sDesiredSourceInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sDesiredSourceInput(ctx, tmp) - if err != nil { - return nil, err - } - } - args["source"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_createDesiredAction_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["cpId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) - arg0, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cpId"] = arg0 - var arg1 model.DesiredActionInput - if tmp, ok := rawArgs["action"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("action")) - arg1, err = ec.unmarshalNDesiredActionInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredActionInput(ctx, tmp) - if err != nil { - return nil, err - } - } - args["action"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_createDesiredDestination_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["destinationType"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationType")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["destinationType"] = arg0 - var arg1 model.DesiredDestinationInput - if tmp, ok := rawArgs["destination"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destination")) - arg1, err = ec.unmarshalNDesiredDestinationInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationInput(ctx, tmp) - if err != nil { - return nil, err - } - } - args["destination"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_deleteActualAction_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["cpId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) - arg0, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cpId"] = arg0 - var arg1 string - if tmp, ok := rawArgs["actionId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionId")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["actionId"] = arg1 - var arg2 string - if tmp, ok := rawArgs["kind"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) - arg2, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["kind"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_deleteDesiredDestination_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["destinationId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationId")) - arg0, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["destinationId"] = arg0 - return args, nil -} - -func (ec *executionContext) field_Mutation_deleteDesiredNamespace_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["cpId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) - arg0, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cpId"] = arg0 - var arg1 model.K8sNamespaceID - if tmp, ok := rawArgs["nsId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nsId")) - arg1, err = ec.unmarshalNK8sNamespaceId2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sNamespaceID(ctx, tmp) - if err != nil { - return nil, err - } - } - args["nsId"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_deleteDesiredSource_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["cpId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) - arg0, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cpId"] = arg0 - var arg1 model.K8sSourceID - if tmp, ok := rawArgs["sourceId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sourceId")) - arg1, err = ec.unmarshalNK8sSourceId2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sSourceID(ctx, tmp) - if err != nil { - return nil, err - } - } - args["sourceId"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_removeDesiredDestinationFromComputePlatform_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["cpId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) - arg0, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cpId"] = arg0 - var arg1 string - if tmp, ok := rawArgs["destinationId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationId")) - arg1, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["destinationId"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateDesiredAction_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["cpId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) - arg0, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cpId"] = arg0 - var arg1 string - if tmp, ok := rawArgs["actionId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("actionId")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["actionId"] = arg1 - var arg2 model.DesiredActionInput - if tmp, ok := rawArgs["action"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("action")) - arg2, err = ec.unmarshalNDesiredActionInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredActionInput(ctx, tmp) - if err != nil { - return nil, err - } - } - args["action"] = arg2 - return args, nil -} - -func (ec *executionContext) field_Mutation_updateDesiredDestination_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["destinationId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationId")) - arg0, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["destinationId"] = arg0 - var arg1 model.DesiredDestinationInput - if tmp, ok := rawArgs["destination"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destination")) - arg1, err = ec.unmarshalNDesiredDestinationInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationInput(ctx, tmp) + var arg1 model.K8sDesiredNamespaceInput + if tmp, ok := rawArgs["namespace"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + arg1, err = ec.unmarshalNK8sDesiredNamespaceInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sDesiredNamespaceInput(ctx, tmp) if err != nil { return nil, err } } - args["destination"] = arg1 + args["namespace"] = arg1 return args, nil } @@ -1452,8 +680,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** -func (ec *executionContext) _ActualAction_id(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ActualAction_id(ctx, field) +func (ec *executionContext) _ComputePlatform_id(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_id(ctx, field) if err != nil { return graphql.Null } @@ -1483,9 +711,9 @@ func (ec *executionContext) _ActualAction_id(ctx context.Context, field graphql. return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ActualAction_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ComputePlatform_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ActualAction", + Object: "ComputePlatform", Field: field, IsMethod: false, IsResolver: false, @@ -1496,8 +724,8 @@ func (ec *executionContext) fieldContext_ActualAction_id(_ context.Context, fiel return fc, nil } -func (ec *executionContext) _ActualAction_kind(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ActualAction_kind(ctx, field) +func (ec *executionContext) _ComputePlatform_name(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_name(ctx, field) if err != nil { return graphql.Null } @@ -1510,26 +738,23 @@ func (ec *executionContext) _ActualAction_kind(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Kind, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ActualAction_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ComputePlatform_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ActualAction", + Object: "ComputePlatform", Field: field, IsMethod: false, IsResolver: false, @@ -1540,8 +765,8 @@ func (ec *executionContext) fieldContext_ActualAction_kind(_ context.Context, fi return fc, nil } -func (ec *executionContext) _ActualAction_name(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ActualAction_name(ctx, field) +func (ec *executionContext) _ComputePlatform_computePlatformType(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_computePlatformType(ctx, field) if err != nil { return graphql.Null } @@ -1554,35 +779,38 @@ func (ec *executionContext) _ActualAction_name(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.ComputePlatformType, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(model.ComputePlatformType) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNComputePlatformType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ActualAction_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ComputePlatform_computePlatformType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ActualAction", + Object: "ComputePlatform", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type ComputePlatformType does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ActualAction_notes(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ActualAction_notes(ctx, field) +func (ec *executionContext) _ComputePlatform_k8sActualNamespace(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_k8sActualNamespace(ctx, field) if err != nil { return graphql.Null } @@ -1595,7 +823,7 @@ func (ec *executionContext) _ActualAction_notes(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Notes, nil + return obj.K8sActualNamespace, nil }) if err != nil { ec.Error(ctx, err) @@ -1604,29 +832,48 @@ func (ec *executionContext) _ActualAction_notes(ctx context.Context, field graph if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*model.K8sActualNamespace) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOK8sActualNamespace2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ActualAction_notes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ComputePlatform_k8sActualNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ActualAction", + Object: "ComputePlatform", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _ActualAction_disable(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ActualAction_disable(ctx, field) - if err != nil { - return graphql.Null - } + switch field.Name { + case "name": + return ec.fieldContext_K8sActualNamespace_name(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) + case "k8sActualSources": + return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sActualNamespace", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_ComputePlatform_k8sActualNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _ComputePlatform_k8sActualNamespaces(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_k8sActualNamespaces(ctx, field) + if err != nil { + return graphql.Null + } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { @@ -1636,7 +883,7 @@ func (ec *executionContext) _ActualAction_disable(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Disable, nil + return obj.K8sActualNamespaces, nil }) if err != nil { ec.Error(ctx, err) @@ -1648,26 +895,34 @@ func (ec *executionContext) _ActualAction_disable(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(bool) + res := resTmp.([]*model.K8sActualNamespace) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNK8sActualNamespace2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ActualAction_disable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ComputePlatform_k8sActualNamespaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ActualAction", + Object: "ComputePlatform", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext_K8sActualNamespace_name(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) + case "k8sActualSources": + return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sActualNamespace", field.Name) }, } return fc, nil } -func (ec *executionContext) _ActualAction_signals(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ActualAction_signals(ctx, field) +func (ec *executionContext) _ComputePlatform_k8sActualSource(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_k8sActualSource(ctx, field) if err != nil { return graphql.Null } @@ -1680,38 +935,66 @@ func (ec *executionContext) _ActualAction_signals(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Signals, nil + return ec.resolvers.ComputePlatform().K8sActualSource(rctx, obj, fc.Args["name"].(*string), fc.Args["namespace"].(*string), fc.Args["kind"].(*string)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.([]model.SignalType) + res := resTmp.(*model.K8sActualSource) fc.Result = res - return ec.marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, field.Selections, res) + return ec.marshalOK8sActualSource2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ActualAction_signals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ActualAction", + Object: "ComputePlatform", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type SignalType does not have child fields") + switch field.Name { + case "namespace": + return ec.fieldContext_K8sActualSource_namespace(ctx, field) + case "kind": + return ec.fieldContext_K8sActualSource_kind(ctx, field) + case "name": + return ec.fieldContext_K8sActualSource_name(ctx, field) + case "serviceName": + return ec.fieldContext_K8sActualSource_serviceName(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) + case "creationTimestamp": + return ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) + case "numberOfInstances": + return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) + case "hasInstrumentedApplication": + return ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) + case "instrumentedApplicationDetails": + return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sActualSource", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_ComputePlatform_k8sActualSource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _ActualAction_details(ctx context.Context, field graphql.CollectedField, obj *model.ActualAction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ActualAction_details(ctx, field) +func (ec *executionContext) _ComputePlatform_k8sActualSources(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) if err != nil { return graphql.Null } @@ -1724,7 +1007,7 @@ func (ec *executionContext) _ActualAction_details(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Details, nil + return obj.K8sActualSources, nil }) if err != nil { ec.Error(ctx, err) @@ -1736,26 +1019,46 @@ func (ec *executionContext) _ActualAction_details(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(string) + res := resTmp.([]*model.K8sActualSource) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNK8sActualSource2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ActualAction_details(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSources(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ActualAction", + Object: "ComputePlatform", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "namespace": + return ec.fieldContext_K8sActualSource_namespace(ctx, field) + case "kind": + return ec.fieldContext_K8sActualSource_kind(ctx, field) + case "name": + return ec.fieldContext_K8sActualSource_name(ctx, field) + case "serviceName": + return ec.fieldContext_K8sActualSource_serviceName(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) + case "creationTimestamp": + return ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) + case "numberOfInstances": + return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) + case "hasInstrumentedApplication": + return ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) + case "instrumentedApplicationDetails": + return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sActualSource", field.Name) }, } return fc, nil } -func (ec *executionContext) _ActualDestination_id(ctx context.Context, field graphql.CollectedField, obj *model.ActualDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ActualDestination_id(ctx, field) +func (ec *executionContext) _Condition_type(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_type(ctx, field) if err != nil { return graphql.Null } @@ -1768,7 +1071,7 @@ func (ec *executionContext) _ActualDestination_id(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ID, nil + return obj.Type, nil }) if err != nil { ec.Error(ctx, err) @@ -1782,24 +1085,24 @@ func (ec *executionContext) _ActualDestination_id(ctx context.Context, field gra } res := resTmp.(string) fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ActualDestination_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Condition_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ActualDestination", + Object: "Condition", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ActualDestination_name(ctx context.Context, field graphql.CollectedField, obj *model.ActualDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ActualDestination_name(ctx, field) +func (ec *executionContext) _Condition_status(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_status(ctx, field) if err != nil { return graphql.Null } @@ -1812,7 +1115,7 @@ func (ec *executionContext) _ActualDestination_name(ctx context.Context, field g }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.Status, nil }) if err != nil { ec.Error(ctx, err) @@ -1824,26 +1127,26 @@ func (ec *executionContext) _ActualDestination_name(ctx context.Context, field g } return graphql.Null } - res := resTmp.(string) + res := resTmp.(model.ConditionStatus) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNConditionStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionStatus(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ActualDestination_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Condition_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ActualDestination", + Object: "Condition", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type ConditionStatus does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ActualDestination_type(ctx context.Context, field graphql.CollectedField, obj *model.ActualDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ActualDestination_type(ctx, field) +func (ec *executionContext) _Condition_lastTransitionTime(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_lastTransitionTime(ctx, field) if err != nil { return graphql.Null } @@ -1856,52 +1159,35 @@ func (ec *executionContext) _ActualDestination_type(ctx context.Context, field g }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Type, nil + return obj.LastTransitionTime, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(*model.DestinationType) + res := resTmp.(*string) fc.Result = res - return ec.marshalNDestinationType2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ActualDestination_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Condition_lastTransitionTime(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ActualDestination", + Object: "Condition", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "category": - return ec.fieldContext_DestinationType_category(ctx, field) - case "name": - return ec.fieldContext_DestinationType_name(ctx, field) - case "displayName": - return ec.fieldContext_DestinationType_displayName(ctx, field) - case "image": - return ec.fieldContext_DestinationType_image(ctx, field) - case "supportedSignals": - return ec.fieldContext_DestinationType_supportedSignals(ctx, field) - case "fields": - return ec.fieldContext_DestinationType_fields(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DestinationType", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ActualDestination_exportedSignals(ctx context.Context, field graphql.CollectedField, obj *model.ActualDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ActualDestination_exportedSignals(ctx, field) +func (ec *executionContext) _Condition_reason(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_reason(ctx, field) if err != nil { return graphql.Null } @@ -1914,38 +1200,35 @@ func (ec *executionContext) _ActualDestination_exportedSignals(ctx context.Conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ExportedSignals, nil + return obj.Reason, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.([]model.SignalType) + res := resTmp.(*string) fc.Result = res - return ec.marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ActualDestination_exportedSignals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Condition_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ActualDestination", + Object: "Condition", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type SignalType does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ActualDestination_fields(ctx context.Context, field graphql.CollectedField, obj *model.ActualDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ActualDestination_fields(ctx, field) +func (ec *executionContext) _Condition_message(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_message(ctx, field) if err != nil { return graphql.Null } @@ -1958,44 +1241,35 @@ func (ec *executionContext) _ActualDestination_fields(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Fields, nil + return obj.Message, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.([]*model.DestinationSpecField) + res := resTmp.(*string) fc.Result = res - return ec.marshalNDestinationSpecField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationSpecFieldᚄ(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ActualDestination_fields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Condition_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ActualDestination", + Object: "Condition", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_DestinationSpecField_name(ctx, field) - case "value": - return ec.fieldContext_DestinationSpecField_value(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DestinationSpecField", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ComputePlatform_id(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ComputePlatform_id(ctx, field) +func (ec *executionContext) _GetConfigResponse_installation(ctx context.Context, field graphql.CollectedField, obj *model.GetConfigResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_GetConfigResponse_installation(ctx, field) if err != nil { return graphql.Null } @@ -2008,7 +1282,7 @@ func (ec *executionContext) _ComputePlatform_id(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ID, nil + return obj.Installation, nil }) if err != nil { ec.Error(ctx, err) @@ -2020,26 +1294,26 @@ func (ec *executionContext) _ComputePlatform_id(ctx context.Context, field graph } return graphql.Null } - res := resTmp.(string) + res := resTmp.(model.InstallationStatus) fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) + return ec.marshalNInstallationStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstallationStatus(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ComputePlatform_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_GetConfigResponse_installation(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ComputePlatform", + Object: "GetConfigResponse", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type InstallationStatus does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ComputePlatform_name(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ComputePlatform_name(ctx, field) +func (ec *executionContext) _InstrumentedApplicationDetails_languages(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentedApplicationDetails_languages(ctx, field) if err != nil { return graphql.Null } @@ -2052,7 +1326,7 @@ func (ec *executionContext) _ComputePlatform_name(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.Languages, nil }) if err != nil { ec.Error(ctx, err) @@ -2061,26 +1335,32 @@ func (ec *executionContext) _ComputePlatform_name(ctx context.Context, field gra if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.([]*model.SourceLanguage) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOSourceLanguage2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguageᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ComputePlatform_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_languages(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ComputePlatform", + Object: "InstrumentedApplicationDetails", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "containerName": + return ec.fieldContext_SourceLanguage_containerName(ctx, field) + case "language": + return ec.fieldContext_SourceLanguage_language(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type SourceLanguage", field.Name) }, } return fc, nil } -func (ec *executionContext) _ComputePlatform_computePlatformType(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ComputePlatform_computePlatformType(ctx, field) +func (ec *executionContext) _InstrumentedApplicationDetails_conditions(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) if err != nil { return graphql.Null } @@ -2093,38 +1373,47 @@ func (ec *executionContext) _ComputePlatform_computePlatformType(ctx context.Con }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ComputePlatformType, nil + return obj.Conditions, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(model.ComputePlatformType) + res := resTmp.([]*model.Condition) fc.Result = res - return ec.marshalNComputePlatformType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformType(ctx, field.Selections, res) + return ec.marshalOCondition2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ComputePlatform_computePlatformType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_conditions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ComputePlatform", + Object: "InstrumentedApplicationDetails", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ComputePlatformType does not have child fields") + switch field.Name { + case "type": + return ec.fieldContext_Condition_type(ctx, field) + case "status": + return ec.fieldContext_Condition_status(ctx, field) + case "lastTransitionTime": + return ec.fieldContext_Condition_lastTransitionTime(ctx, field) + case "reason": + return ec.fieldContext_Condition_reason(ctx, field) + case "message": + return ec.fieldContext_Condition_message(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Condition", field.Name) }, } return fc, nil } -func (ec *executionContext) _ComputePlatform_k8sActualNamespace(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ComputePlatform_k8sActualNamespace(ctx, field) +func (ec *executionContext) _K8sActualNamespace_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualNamespace_name(ctx, field) if err != nil { return graphql.Null } @@ -2137,67 +1426,7 @@ func (ec *executionContext) _ComputePlatform_k8sActualNamespace(ctx context.Cont }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.K8sActualNamespace, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.K8sActualNamespace) - fc.Result = res - return ec.marshalOK8sActualNamespace2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_ComputePlatform_k8sActualNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ComputePlatform", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_K8sActualNamespace_name(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) - case "k8sActualSources": - return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type K8sActualNamespace", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_ComputePlatform_k8sActualNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _ComputePlatform_k8sActualNamespaces(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ComputePlatform_k8sActualNamespaces(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.K8sActualNamespaces, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -2209,34 +1438,26 @@ func (ec *executionContext) _ComputePlatform_k8sActualNamespaces(ctx context.Con } return graphql.Null } - res := resTmp.([]*model.K8sActualNamespace) + res := resTmp.(string) fc.Result = res - return ec.marshalNK8sActualNamespace2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ComputePlatform_k8sActualNamespaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualNamespace_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ComputePlatform", + Object: "K8sActualNamespace", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_K8sActualNamespace_name(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) - case "k8sActualSources": - return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type K8sActualNamespace", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ComputePlatform_k8sActualSource(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ComputePlatform_k8sActualSource(ctx, field) +func (ec *executionContext) _K8sActualNamespace_autoInstrumented(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) if err != nil { return graphql.Null } @@ -2249,7 +1470,7 @@ func (ec *executionContext) _ComputePlatform_k8sActualSource(ctx context.Context }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.ComputePlatform().K8sActualSource(rctx, obj, fc.Args["name"].(*string), fc.Args["namespace"].(*string), fc.Args["kind"].(*string)) + return obj.AutoInstrumented, nil }) if err != nil { ec.Error(ctx, err) @@ -2258,57 +1479,26 @@ func (ec *executionContext) _ComputePlatform_k8sActualSource(ctx context.Context if resTmp == nil { return graphql.Null } - res := resTmp.(*model.K8sActualSource) + res := resTmp.(*bool) fc.Result = res - return ec.marshalOK8sActualSource2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx, field.Selections, res) + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualNamespace_autoInstrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ComputePlatform", + Object: "K8sActualNamespace", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "namespace": - return ec.fieldContext_K8sActualSource_namespace(ctx, field) - case "kind": - return ec.fieldContext_K8sActualSource_kind(ctx, field) - case "name": - return ec.fieldContext_K8sActualSource_name(ctx, field) - case "serviceName": - return ec.fieldContext_K8sActualSource_serviceName(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) - case "creationTimestamp": - return ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) - case "numberOfInstances": - return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) - case "hasInstrumentedApplication": - return ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) - case "instrumentedApplicationDetails": - return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type K8sActualSource", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_ComputePlatform_k8sActualSource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _ComputePlatform_k8sActualSources(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) +func (ec *executionContext) _K8sActualNamespace_k8sActualSources(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) if err != nil { return graphql.Null } @@ -2338,9 +1528,9 @@ func (ec *executionContext) _ComputePlatform_k8sActualSources(ctx context.Contex return ec.marshalNK8sActualSource2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSources(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualNamespace_k8sActualSources(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ComputePlatform", + Object: "K8sActualNamespace", Field: field, IsMethod: false, IsResolver: false, @@ -2371,8 +1561,8 @@ func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSources(_ cont return fc, nil } -func (ec *executionContext) _ComputePlatform_actualDestinations(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ComputePlatform_actualDestinations(ctx, field) +func (ec *executionContext) _K8sActualSource_namespace(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_namespace(ctx, field) if err != nil { return graphql.Null } @@ -2385,7 +1575,7 @@ func (ec *executionContext) _ComputePlatform_actualDestinations(ctx context.Cont }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ActualDestinations, nil + return obj.Namespace, nil }) if err != nil { ec.Error(ctx, err) @@ -2397,38 +1587,26 @@ func (ec *executionContext) _ComputePlatform_actualDestinations(ctx context.Cont } return graphql.Null } - res := resTmp.([]*model.ActualDestination) + res := resTmp.(string) fc.Result = res - return ec.marshalNActualDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualDestination(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ComputePlatform_actualDestinations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ComputePlatform", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ActualDestination_id(ctx, field) - case "name": - return ec.fieldContext_ActualDestination_name(ctx, field) - case "type": - return ec.fieldContext_ActualDestination_type(ctx, field) - case "exportedSignals": - return ec.fieldContext_ActualDestination_exportedSignals(ctx, field) - case "fields": - return ec.fieldContext_ActualDestination_fields(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ActualDestination", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ComputePlatform_actualActions(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ComputePlatform_actualActions(ctx, field) +func (ec *executionContext) _K8sActualSource_kind(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_kind(ctx, field) if err != nil { return graphql.Null } @@ -2441,7 +1619,7 @@ func (ec *executionContext) _ComputePlatform_actualActions(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ActualActions, nil + return obj.Kind, nil }) if err != nil { ec.Error(ctx, err) @@ -2453,42 +1631,26 @@ func (ec *executionContext) _ComputePlatform_actualActions(ctx context.Context, } return graphql.Null } - res := resTmp.([]*model.ActualAction) + res := resTmp.(model.K8sResourceKind) fc.Result = res - return ec.marshalNActualAction2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualAction(ctx, field.Selections, res) + return ec.marshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ComputePlatform_actualActions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ComputePlatform", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ActualAction_id(ctx, field) - case "kind": - return ec.fieldContext_ActualAction_kind(ctx, field) - case "name": - return ec.fieldContext_ActualAction_name(ctx, field) - case "notes": - return ec.fieldContext_ActualAction_notes(ctx, field) - case "disable": - return ec.fieldContext_ActualAction_disable(ctx, field) - case "signals": - return ec.fieldContext_ActualAction_signals(ctx, field) - case "details": - return ec.fieldContext_ActualAction_details(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ActualAction", field.Name) + return nil, errors.New("field of type K8sResourceKind does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Condition_type(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Condition_type(ctx, field) +func (ec *executionContext) _K8sActualSource_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_name(ctx, field) if err != nil { return graphql.Null } @@ -2501,7 +1663,7 @@ func (ec *executionContext) _Condition_type(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Type, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -2518,9 +1680,9 @@ func (ec *executionContext) _Condition_type(ctx context.Context, field graphql.C return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Condition_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Condition", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, @@ -2531,8 +1693,8 @@ func (ec *executionContext) fieldContext_Condition_type(_ context.Context, field return fc, nil } -func (ec *executionContext) _Condition_status(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Condition_status(ctx, field) +func (ec *executionContext) _K8sActualSource_serviceName(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_serviceName(ctx, field) if err != nil { return graphql.Null } @@ -2545,38 +1707,35 @@ func (ec *executionContext) _Condition_status(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Status, nil + return obj.ServiceName, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(model.ConditionStatus) + res := resTmp.(*string) fc.Result = res - return ec.marshalNConditionStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionStatus(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Condition_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_serviceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Condition", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ConditionStatus does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Condition_lastTransitionTime(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Condition_lastTransitionTime(ctx, field) +func (ec *executionContext) _K8sActualSource_autoInstrumented(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) if err != nil { return graphql.Null } @@ -2589,7 +1748,7 @@ func (ec *executionContext) _Condition_lastTransitionTime(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.LastTransitionTime, nil + return obj.AutoInstrumented, nil }) if err != nil { ec.Error(ctx, err) @@ -2598,26 +1757,26 @@ func (ec *executionContext) _Condition_lastTransitionTime(ctx context.Context, f if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*bool) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Condition_lastTransitionTime(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Condition", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Condition_reason(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Condition_reason(ctx, field) +func (ec *executionContext) _K8sActualSource_creationTimestamp(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) if err != nil { return graphql.Null } @@ -2630,7 +1789,7 @@ func (ec *executionContext) _Condition_reason(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Reason, nil + return obj.CreationTimestamp, nil }) if err != nil { ec.Error(ctx, err) @@ -2644,9 +1803,9 @@ func (ec *executionContext) _Condition_reason(ctx context.Context, field graphql return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Condition_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_creationTimestamp(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Condition", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, @@ -2657,8 +1816,8 @@ func (ec *executionContext) fieldContext_Condition_reason(_ context.Context, fie return fc, nil } -func (ec *executionContext) _Condition_message(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Condition_message(ctx, field) +func (ec *executionContext) _K8sActualSource_numberOfInstances(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) if err != nil { return graphql.Null } @@ -2671,7 +1830,7 @@ func (ec *executionContext) _Condition_message(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Message, nil + return obj.NumberOfInstances, nil }) if err != nil { ec.Error(ctx, err) @@ -2680,26 +1839,26 @@ func (ec *executionContext) _Condition_message(ctx context.Context, field graphq if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*int) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Condition_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_numberOfInstances(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Condition", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _DesiredDestination_id(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DesiredDestination_id(ctx, field) +func (ec *executionContext) _K8sActualSource_hasInstrumentedApplication(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) if err != nil { return graphql.Null } @@ -2712,7 +1871,7 @@ func (ec *executionContext) _DesiredDestination_id(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ID, nil + return obj.HasInstrumentedApplication, nil }) if err != nil { ec.Error(ctx, err) @@ -2724,26 +1883,26 @@ func (ec *executionContext) _DesiredDestination_id(ctx context.Context, field gr } return graphql.Null } - res := resTmp.(string) + res := resTmp.(bool) fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DesiredDestination_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_hasInstrumentedApplication(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DesiredDestination", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _DesiredDestination_name(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DesiredDestination_name(ctx, field) +func (ec *executionContext) _K8sActualSource_instrumentedApplicationDetails(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) if err != nil { return graphql.Null } @@ -2756,38 +1915,41 @@ func (ec *executionContext) _DesiredDestination_name(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.InstrumentedApplicationDetails, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.InstrumentedApplicationDetails) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOInstrumentedApplicationDetails2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentedApplicationDetails(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DesiredDestination_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_instrumentedApplicationDetails(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DesiredDestination", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "languages": + return ec.fieldContext_InstrumentedApplicationDetails_languages(ctx, field) + case "conditions": + return ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type InstrumentedApplicationDetails", field.Name) }, } return fc, nil } -func (ec *executionContext) _DesiredDestination_type(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DesiredDestination_type(ctx, field) +func (ec *executionContext) _K8sActualSourceRuntimeInfo_mainContainer(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfo) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSourceRuntimeInfo_mainContainer(ctx, field) if err != nil { return graphql.Null } @@ -2800,52 +1962,41 @@ func (ec *executionContext) _DesiredDestination_type(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Type, nil + return obj.MainContainer, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(*model.DestinationType) + res := resTmp.(*model.K8sActualSourceRuntimeInfoContainer) fc.Result = res - return ec.marshalNDestinationType2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx, field.Selections, res) + return ec.marshalOK8sActualSourceRuntimeInfoContainer2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSourceRuntimeInfoContainer(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DesiredDestination_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSourceRuntimeInfo_mainContainer(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DesiredDestination", + Object: "K8sActualSourceRuntimeInfo", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "category": - return ec.fieldContext_DestinationType_category(ctx, field) - case "name": - return ec.fieldContext_DestinationType_name(ctx, field) - case "displayName": - return ec.fieldContext_DestinationType_displayName(ctx, field) - case "image": - return ec.fieldContext_DestinationType_image(ctx, field) - case "supportedSignals": - return ec.fieldContext_DestinationType_supportedSignals(ctx, field) - case "fields": - return ec.fieldContext_DestinationType_fields(ctx, field) + case "containerName": + return ec.fieldContext_K8sActualSourceRuntimeInfoContainer_containerName(ctx, field) + case "language": + return ec.fieldContext_K8sActualSourceRuntimeInfoContainer_language(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type DestinationType", field.Name) + return nil, fmt.Errorf("no field named %q was found under type K8sActualSourceRuntimeInfoContainer", field.Name) }, } return fc, nil } -func (ec *executionContext) _DesiredDestination_exportSignals(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DesiredDestination_exportSignals(ctx, field) +func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer_containerName(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfoContainer) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSourceRuntimeInfoContainer_containerName(ctx, field) if err != nil { return graphql.Null } @@ -2858,7 +2009,7 @@ func (ec *executionContext) _DesiredDestination_exportSignals(ctx context.Contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ExportSignals, nil + return obj.ContainerName, nil }) if err != nil { ec.Error(ctx, err) @@ -2870,26 +2021,26 @@ func (ec *executionContext) _DesiredDestination_exportSignals(ctx context.Contex } return graphql.Null } - res := resTmp.([]model.SignalType) + res := resTmp.(string) fc.Result = res - return ec.marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DesiredDestination_exportSignals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSourceRuntimeInfoContainer_containerName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DesiredDestination", + Object: "K8sActualSourceRuntimeInfoContainer", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type SignalType does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _DesiredDestination_fields(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DesiredDestination_fields(ctx, field) +func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer_language(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfoContainer) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSourceRuntimeInfoContainer_language(ctx, field) if err != nil { return graphql.Null } @@ -2902,7 +2053,7 @@ func (ec *executionContext) _DesiredDestination_fields(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Fields, nil + return obj.Language, nil }) if err != nil { ec.Error(ctx, err) @@ -2914,32 +2065,86 @@ func (ec *executionContext) _DesiredDestination_fields(ctx context.Context, fiel } return graphql.Null } - res := resTmp.([]*model.DestinationSpecField) + res := resTmp.(model.ProgrammingLanguage) fc.Result = res - return ec.marshalNDestinationSpecField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationSpecFieldᚄ(ctx, field.Selections, res) + return ec.marshalNProgrammingLanguage2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐProgrammingLanguage(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DesiredDestination_fields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSourceRuntimeInfoContainer_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DesiredDestination", + Object: "K8sActualSourceRuntimeInfoContainer", Field: field, IsMethod: false, IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ProgrammingLanguage does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createK8sDesiredNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createK8sDesiredNamespace(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateK8sDesiredNamespace(rctx, fc.Args["cpId"].(string), fc.Args["namespace"].(model.K8sDesiredNamespaceInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.K8sActualNamespace) + fc.Result = res + return ec.marshalOK8sActualNamespace2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createK8sDesiredNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "name": - return ec.fieldContext_DestinationSpecField_name(ctx, field) - case "value": - return ec.fieldContext_DestinationSpecField_value(ctx, field) + return ec.fieldContext_K8sActualNamespace_name(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) + case "k8sActualSources": + return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type DestinationSpecField", field.Name) + return nil, fmt.Errorf("no field named %q was found under type K8sActualNamespace", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createK8sDesiredNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _DesiredDestination_computePlatforms(ctx context.Context, field graphql.CollectedField, obj *model.DesiredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DesiredDestination_computePlatforms(ctx, field) +func (ec *executionContext) _Query_computePlatform(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_computePlatform(ctx, field) if err != nil { return graphql.Null } @@ -2952,29 +2157,26 @@ func (ec *executionContext) _DesiredDestination_computePlatforms(ctx context.Con }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ComputePlatforms, nil + return ec.resolvers.Query().ComputePlatform(rctx, fc.Args["cpId"].(string)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.([]*model.ComputePlatform) + res := resTmp.(*model.ComputePlatform) fc.Result = res - return ec.marshalNComputePlatform2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformᚄ(ctx, field.Selections, res) + return ec.marshalOComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DesiredDestination_computePlatforms(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_computePlatform(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DesiredDestination", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": @@ -2991,19 +2193,26 @@ func (ec *executionContext) fieldContext_DesiredDestination_computePlatforms(_ c return ec.fieldContext_ComputePlatform_k8sActualSource(ctx, field) case "k8sActualSources": return ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) - case "actualDestinations": - return ec.fieldContext_ComputePlatform_actualDestinations(ctx, field) - case "actualActions": - return ec.fieldContext_ComputePlatform_actualActions(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type ComputePlatform", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_computePlatform_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _DestinationSpecField_name(ctx context.Context, field graphql.CollectedField, obj *model.DestinationSpecField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationSpecField_name(ctx, field) +func (ec *executionContext) _Query_config(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_config(ctx, field) if err != nil { return graphql.Null } @@ -3016,38 +2225,39 @@ func (ec *executionContext) _DestinationSpecField_name(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return ec.resolvers.Query().Config(rctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.GetConfigResponse) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOGetConfigResponse2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐGetConfigResponse(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationSpecField_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_config(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationSpecField", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "installation": + return ec.fieldContext_GetConfigResponse_installation(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type GetConfigResponse", field.Name) }, } return fc, nil } -func (ec *executionContext) _DestinationSpecField_value(ctx context.Context, field graphql.CollectedField, obj *model.DestinationSpecField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationSpecField_value(ctx, field) +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___type(ctx, field) if err != nil { return graphql.Null } @@ -3060,38 +2270,68 @@ func (ec *executionContext) _DestinationSpecField_value(ctx context.Context, fie }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Value, nil + return ec.introspectType(fc.Args["name"].(string)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationSpecField_value(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationSpecField", + Object: "Query", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _DestinationType_category(ctx context.Context, field graphql.CollectedField, obj *model.DestinationType) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationType_category(ctx, field) +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___schema(ctx, field) if err != nil { return graphql.Null } @@ -3104,38 +2344,49 @@ func (ec *executionContext) _DestinationType_category(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Category, nil + return ec.introspectSchema() }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*introspection.Schema) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationType_category(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationType", + Object: "Query", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "description": + return ec.fieldContext___Schema_description(ctx, field) + case "types": + return ec.fieldContext___Schema_types(ctx, field) + case "queryType": + return ec.fieldContext___Schema_queryType(ctx, field) + case "mutationType": + return ec.fieldContext___Schema_mutationType(ctx, field) + case "subscriptionType": + return ec.fieldContext___Schema_subscriptionType(ctx, field) + case "directives": + return ec.fieldContext___Schema_directives(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) }, } return fc, nil } -func (ec *executionContext) _DestinationType_name(ctx context.Context, field graphql.CollectedField, obj *model.DestinationType) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationType_name(ctx, field) +func (ec *executionContext) _SourceLanguage_containerName(ctx context.Context, field graphql.CollectedField, obj *model.SourceLanguage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SourceLanguage_containerName(ctx, field) if err != nil { return graphql.Null } @@ -3148,7 +2399,7 @@ func (ec *executionContext) _DestinationType_name(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.ContainerName, nil }) if err != nil { ec.Error(ctx, err) @@ -3165,9 +2416,9 @@ func (ec *executionContext) _DestinationType_name(ctx context.Context, field gra return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationType_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SourceLanguage_containerName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationType", + Object: "SourceLanguage", Field: field, IsMethod: false, IsResolver: false, @@ -3178,8 +2429,8 @@ func (ec *executionContext) fieldContext_DestinationType_name(_ context.Context, return fc, nil } -func (ec *executionContext) _DestinationType_displayName(ctx context.Context, field graphql.CollectedField, obj *model.DestinationType) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationType_displayName(ctx, field) +func (ec *executionContext) _SourceLanguage_language(ctx context.Context, field graphql.CollectedField, obj *model.SourceLanguage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SourceLanguage_language(ctx, field) if err != nil { return graphql.Null } @@ -3192,7 +2443,7 @@ func (ec *executionContext) _DestinationType_displayName(ctx context.Context, fi }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.DisplayName, nil + return obj.Language, nil }) if err != nil { ec.Error(ctx, err) @@ -3209,9 +2460,9 @@ func (ec *executionContext) _DestinationType_displayName(ctx context.Context, fi return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationType_displayName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SourceLanguage_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationType", + Object: "SourceLanguage", Field: field, IsMethod: false, IsResolver: false, @@ -3222,8 +2473,8 @@ func (ec *executionContext) fieldContext_DestinationType_displayName(_ context.C return fc, nil } -func (ec *executionContext) _DestinationType_image(ctx context.Context, field graphql.CollectedField, obj *model.DestinationType) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationType_image(ctx, field) +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_name(ctx, field) if err != nil { return graphql.Null } @@ -3236,23 +2487,26 @@ func (ec *executionContext) _DestinationType_image(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Image, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationType_image(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationType", + Object: "__Directive", Field: field, IsMethod: false, IsResolver: false, @@ -3263,8 +2517,8 @@ func (ec *executionContext) fieldContext_DestinationType_image(_ context.Context return fc, nil } -func (ec *executionContext) _DestinationType_supportedSignals(ctx context.Context, field graphql.CollectedField, obj *model.DestinationType) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationType_supportedSignals(ctx, field) +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_description(ctx, field) if err != nil { return graphql.Null } @@ -3277,38 +2531,35 @@ func (ec *executionContext) _DestinationType_supportedSignals(ctx context.Contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.SupportedSignals, nil + return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.([]model.SignalType) + res := resTmp.(*string) fc.Result = res - return ec.marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationType_supportedSignals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationType", + Object: "__Directive", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type SignalType does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _DestinationType_fields(ctx context.Context, field graphql.CollectedField, obj *model.DestinationType) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationType_fields(ctx, field) +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_locations(ctx, field) if err != nil { return graphql.Null } @@ -3321,7 +2572,7 @@ func (ec *executionContext) _DestinationType_fields(ctx context.Context, field g }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Fields, nil + return obj.Locations, nil }) if err != nil { ec.Error(ctx, err) @@ -3333,44 +2584,26 @@ func (ec *executionContext) _DestinationType_fields(ctx context.Context, field g } return graphql.Null } - res := resTmp.([]*model.DestinationTypeField) + res := resTmp.([]string) fc.Result = res - return ec.marshalNDestinationTypeField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeFieldᚄ(ctx, field.Selections, res) + return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationType_fields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationType", + Object: "__Directive", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_DestinationTypeField_name(ctx, field) - case "displayName": - return ec.fieldContext_DestinationTypeField_displayName(ctx, field) - case "videoURL": - return ec.fieldContext_DestinationTypeField_videoURL(ctx, field) - case "thumbnailURL": - return ec.fieldContext_DestinationTypeField_thumbnailURL(ctx, field) - case "componentType": - return ec.fieldContext_DestinationTypeField_componentType(ctx, field) - case "componentProps": - return ec.fieldContext_DestinationTypeField_componentProps(ctx, field) - case "secret": - return ec.fieldContext_DestinationTypeField_secret(ctx, field) - case "initialValue": - return ec.fieldContext_DestinationTypeField_initialValue(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DestinationTypeField", field.Name) + return nil, errors.New("field of type __DirectiveLocation does not have child fields") }, } return fc, nil } -func (ec *executionContext) _DestinationTypeCategory_name(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeCategory) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationTypeCategory_name(ctx, field) +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_args(ctx, field) if err != nil { return graphql.Null } @@ -3383,7 +2616,7 @@ func (ec *executionContext) _DestinationTypeCategory_name(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.Args, nil }) if err != nil { ec.Error(ctx, err) @@ -3395,26 +2628,36 @@ func (ec *executionContext) _DestinationTypeCategory_name(ctx context.Context, f } return graphql.Null } - res := resTmp.(string) + res := resTmp.([]introspection.InputValue) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationTypeCategory_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationTypeCategory", + Object: "__Directive", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, } return fc, nil } -func (ec *executionContext) _DestinationTypeCategory_destinationTypes(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeCategory) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationTypeCategory_destinationTypes(ctx, field) +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) if err != nil { return graphql.Null } @@ -3427,7 +2670,7 @@ func (ec *executionContext) _DestinationTypeCategory_destinationTypes(ctx contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.DestinationTypes, nil + return obj.IsRepeatable, nil }) if err != nil { ec.Error(ctx, err) @@ -3439,40 +2682,26 @@ func (ec *executionContext) _DestinationTypeCategory_destinationTypes(ctx contex } return graphql.Null } - res := resTmp.([]*model.DestinationType) + res := resTmp.(bool) fc.Result = res - return ec.marshalNDestinationType2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationTypeCategory_destinationTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationTypeCategory", + Object: "__Directive", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "category": - return ec.fieldContext_DestinationType_category(ctx, field) - case "name": - return ec.fieldContext_DestinationType_name(ctx, field) - case "displayName": - return ec.fieldContext_DestinationType_displayName(ctx, field) - case "image": - return ec.fieldContext_DestinationType_image(ctx, field) - case "supportedSignals": - return ec.fieldContext_DestinationType_supportedSignals(ctx, field) - case "fields": - return ec.fieldContext_DestinationType_fields(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DestinationType", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _DestinationTypeField_name(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationTypeField_name(ctx, field) +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_name(ctx, field) if err != nil { return graphql.Null } @@ -3502,9 +2731,9 @@ func (ec *executionContext) _DestinationTypeField_name(ctx context.Context, fiel return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationTypeField_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationTypeField", + Object: "__EnumValue", Field: field, IsMethod: false, IsResolver: false, @@ -3515,8 +2744,8 @@ func (ec *executionContext) fieldContext_DestinationTypeField_name(_ context.Con return fc, nil } -func (ec *executionContext) _DestinationTypeField_displayName(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationTypeField_displayName(ctx, field) +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_description(ctx, field) if err != nil { return graphql.Null } @@ -3529,28 +2758,25 @@ func (ec *executionContext) _DestinationTypeField_displayName(ctx context.Contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.DisplayName, nil + return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationTypeField_displayName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationTypeField", + Object: "__EnumValue", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") @@ -3559,8 +2785,8 @@ func (ec *executionContext) fieldContext_DestinationTypeField_displayName(_ cont return fc, nil } -func (ec *executionContext) _DestinationTypeField_videoURL(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationTypeField_videoURL(ctx, field) +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) if err != nil { return graphql.Null } @@ -3573,35 +2799,38 @@ func (ec *executionContext) _DestinationTypeField_videoURL(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.VideoURL, nil + return obj.IsDeprecated(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(bool) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationTypeField_videoURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationTypeField", + Object: "__EnumValue", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _DestinationTypeField_thumbnailURL(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationTypeField_thumbnailURL(ctx, field) +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) if err != nil { return graphql.Null } @@ -3614,7 +2843,7 @@ func (ec *executionContext) _DestinationTypeField_thumbnailURL(ctx context.Conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ThumbnailURL, nil + return obj.DeprecationReason(), nil }) if err != nil { ec.Error(ctx, err) @@ -3628,11 +2857,11 @@ func (ec *executionContext) _DestinationTypeField_thumbnailURL(ctx context.Conte return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationTypeField_thumbnailURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationTypeField", + Object: "__EnumValue", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") @@ -3641,8 +2870,8 @@ func (ec *executionContext) fieldContext_DestinationTypeField_thumbnailURL(_ con return fc, nil } -func (ec *executionContext) _DestinationTypeField_componentType(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationTypeField_componentType(ctx, field) +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_name(ctx, field) if err != nil { return graphql.Null } @@ -3655,7 +2884,7 @@ func (ec *executionContext) _DestinationTypeField_componentType(ctx context.Cont }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ComponentType, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -3672,9 +2901,9 @@ func (ec *executionContext) _DestinationTypeField_componentType(ctx context.Cont return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationTypeField_componentType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationTypeField", + Object: "__Field", Field: field, IsMethod: false, IsResolver: false, @@ -3685,8 +2914,8 @@ func (ec *executionContext) fieldContext_DestinationTypeField_componentType(_ co return fc, nil } -func (ec *executionContext) _DestinationTypeField_componentProps(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationTypeField_componentProps(ctx, field) +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_description(ctx, field) if err != nil { return graphql.Null } @@ -3699,28 +2928,25 @@ func (ec *executionContext) _DestinationTypeField_componentProps(ctx context.Con }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ComponentProps, nil + return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationTypeField_componentProps(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationTypeField", + Object: "__Field", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") @@ -3729,8 +2955,8 @@ func (ec *executionContext) fieldContext_DestinationTypeField_componentProps(_ c return fc, nil } -func (ec *executionContext) _DestinationTypeField_secret(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationTypeField_secret(ctx, field) +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_args(ctx, field) if err != nil { return graphql.Null } @@ -3743,7 +2969,7 @@ func (ec *executionContext) _DestinationTypeField_secret(ctx context.Context, fi }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Secret, nil + return obj.Args, nil }) if err != nil { ec.Error(ctx, err) @@ -3755,26 +2981,36 @@ func (ec *executionContext) _DestinationTypeField_secret(ctx context.Context, fi } return graphql.Null } - res := resTmp.(bool) + res := resTmp.([]introspection.InputValue) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationTypeField_secret(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationTypeField", + Object: "__Field", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, } return fc, nil } -func (ec *executionContext) _DestinationTypeField_initialValue(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypeField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_DestinationTypeField_initialValue(ctx, field) +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_type(ctx, field) if err != nil { return graphql.Null } @@ -3787,35 +3023,60 @@ func (ec *executionContext) _DestinationTypeField_initialValue(ctx context.Conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InitialValue, nil + return obj.Type, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_DestinationTypeField_initialValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "DestinationTypeField", + Object: "__Field", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) _InstrumentedApplicationDetails_languages(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentedApplicationDetails_languages(ctx, field) +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) if err != nil { return graphql.Null } @@ -3828,41 +3089,38 @@ func (ec *executionContext) _InstrumentedApplicationDetails_languages(ctx contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Languages, nil + return obj.IsDeprecated(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*model.SourceLanguage) + res := resTmp.(bool) fc.Result = res - return ec.marshalOSourceLanguage2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguageᚄ(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_languages(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentedApplicationDetails", + Object: "__Field", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "containerName": - return ec.fieldContext_SourceLanguage_containerName(ctx, field) - case "language": - return ec.fieldContext_SourceLanguage_language(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type SourceLanguage", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _InstrumentedApplicationDetails_conditions(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) if err != nil { return graphql.Null } @@ -3875,7 +3133,7 @@ func (ec *executionContext) _InstrumentedApplicationDetails_conditions(ctx conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Conditions, nil + return obj.DeprecationReason(), nil }) if err != nil { ec.Error(ctx, err) @@ -3884,38 +3142,26 @@ func (ec *executionContext) _InstrumentedApplicationDetails_conditions(ctx conte if resTmp == nil { return graphql.Null } - res := resTmp.([]*model.Condition) + res := resTmp.(*string) fc.Result = res - return ec.marshalOCondition2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionᚄ(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_conditions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentedApplicationDetails", + Object: "__Field", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "type": - return ec.fieldContext_Condition_type(ctx, field) - case "status": - return ec.fieldContext_Condition_status(ctx, field) - case "lastTransitionTime": - return ec.fieldContext_Condition_lastTransitionTime(ctx, field) - case "reason": - return ec.fieldContext_Condition_reason(ctx, field) - case "message": - return ec.fieldContext_Condition_message(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Condition", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _K8sActualNamespace_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualNamespace_name(ctx, field) +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_name(ctx, field) if err != nil { return graphql.Null } @@ -3945,9 +3191,9 @@ func (ec *executionContext) _K8sActualNamespace_name(ctx context.Context, field return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualNamespace_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualNamespace", + Object: "__InputValue", Field: field, IsMethod: false, IsResolver: false, @@ -3958,8 +3204,8 @@ func (ec *executionContext) fieldContext_K8sActualNamespace_name(_ context.Conte return fc, nil } -func (ec *executionContext) _K8sActualNamespace_autoInstrumented(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_description(ctx, field) if err != nil { return graphql.Null } @@ -3972,7 +3218,7 @@ func (ec *executionContext) _K8sActualNamespace_autoInstrumented(ctx context.Con }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.AutoInstrumented, nil + return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) @@ -3981,26 +3227,26 @@ func (ec *executionContext) _K8sActualNamespace_autoInstrumented(ctx context.Con if resTmp == nil { return graphql.Null } - res := resTmp.(*bool) + res := resTmp.(*string) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualNamespace_autoInstrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualNamespace", + Object: "__InputValue", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _K8sActualNamespace_k8sActualSources(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_type(ctx, field) if err != nil { return graphql.Null } @@ -4013,7 +3259,7 @@ func (ec *executionContext) _K8sActualNamespace_k8sActualSources(ctx context.Con }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.K8sActualSources, nil + return obj.Type, nil }) if err != nil { ec.Error(ctx, err) @@ -4025,46 +3271,48 @@ func (ec *executionContext) _K8sActualNamespace_k8sActualSources(ctx context.Con } return graphql.Null } - res := resTmp.([]*model.K8sActualSource) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalNK8sActualSource2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx, field.Selections, res) + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualNamespace_k8sActualSources(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualNamespace", + Object: "__InputValue", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "namespace": - return ec.fieldContext_K8sActualSource_namespace(ctx, field) case "kind": - return ec.fieldContext_K8sActualSource_kind(ctx, field) + return ec.fieldContext___Type_kind(ctx, field) case "name": - return ec.fieldContext_K8sActualSource_name(ctx, field) - case "serviceName": - return ec.fieldContext_K8sActualSource_serviceName(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) - case "creationTimestamp": - return ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) - case "numberOfInstances": - return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) - case "hasInstrumentedApplication": - return ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) - case "instrumentedApplicationDetails": - return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type K8sActualSource", field.Name) + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) _K8sActualSource_namespace(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_namespace(ctx, field) +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) if err != nil { return graphql.Null } @@ -4077,26 +3325,23 @@ func (ec *executionContext) _K8sActualSource_namespace(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Namespace, nil + return obj.DefaultValue, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "__InputValue", Field: field, IsMethod: false, IsResolver: false, @@ -4107,8 +3352,8 @@ func (ec *executionContext) fieldContext_K8sActualSource_namespace(_ context.Con return fc, nil } -func (ec *executionContext) _K8sActualSource_kind(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_kind(ctx, field) +func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_description(ctx, field) if err != nil { return graphql.Null } @@ -4121,38 +3366,35 @@ func (ec *executionContext) _K8sActualSource_kind(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Kind, nil + return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(model.K8sResourceKind) + res := resTmp.(*string) fc.Result = res - return ec.marshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "__Schema", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type K8sResourceKind does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _K8sActualSource_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_name(ctx, field) +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_types(ctx, field) if err != nil { return graphql.Null } @@ -4165,7 +3407,7 @@ func (ec *executionContext) _K8sActualSource_name(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.Types(), nil }) if err != nil { ec.Error(ctx, err) @@ -4177,26 +3419,48 @@ func (ec *executionContext) _K8sActualSource_name(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(string) + res := resTmp.([]introspection.Type) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "__Schema", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) _K8sActualSource_serviceName(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_serviceName(ctx, field) +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_queryType(ctx, field) if err != nil { return graphql.Null } @@ -4209,35 +3473,60 @@ func (ec *executionContext) _K8sActualSource_serviceName(ctx context.Context, fi }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ServiceName, nil + return obj.QueryType(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_serviceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "__Schema", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) _K8sActualSource_autoInstrumented(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_mutationType(ctx, field) if err != nil { return graphql.Null } @@ -4250,7 +3539,7 @@ func (ec *executionContext) _K8sActualSource_autoInstrumented(ctx context.Contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.AutoInstrumented, nil + return obj.MutationType(), nil }) if err != nil { ec.Error(ctx, err) @@ -4259,26 +3548,48 @@ func (ec *executionContext) _K8sActualSource_autoInstrumented(ctx context.Contex if resTmp == nil { return graphql.Null } - res := resTmp.(*bool) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "__Schema", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) _K8sActualSource_creationTimestamp(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) if err != nil { return graphql.Null } @@ -4291,7 +3602,7 @@ func (ec *executionContext) _K8sActualSource_creationTimestamp(ctx context.Conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.CreationTimestamp, nil + return obj.SubscriptionType(), nil }) if err != nil { ec.Error(ctx, err) @@ -4300,26 +3611,48 @@ func (ec *executionContext) _K8sActualSource_creationTimestamp(ctx context.Conte if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_creationTimestamp(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "__Schema", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) _K8sActualSource_numberOfInstances(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_directives(ctx, field) if err != nil { return graphql.Null } @@ -4332,35 +3665,50 @@ func (ec *executionContext) _K8sActualSource_numberOfInstances(ctx context.Conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.NumberOfInstances, nil + return obj.Directives(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*int) + res := resTmp.([]introspection.Directive) fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_numberOfInstances(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "__Schema", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext___Directive_name(ctx, field) + case "description": + return ec.fieldContext___Directive_description(ctx, field) + case "locations": + return ec.fieldContext___Directive_locations(ctx, field) + case "args": + return ec.fieldContext___Directive_args(ctx, field) + case "isRepeatable": + return ec.fieldContext___Directive_isRepeatable(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) }, } return fc, nil } -func (ec *executionContext) _K8sActualSource_hasInstrumentedApplication(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_kind(ctx, field) if err != nil { return graphql.Null } @@ -4373,7 +3721,7 @@ func (ec *executionContext) _K8sActualSource_hasInstrumentedApplication(ctx cont }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.HasInstrumentedApplication, nil + return obj.Kind(), nil }) if err != nil { ec.Error(ctx, err) @@ -4385,26 +3733,26 @@ func (ec *executionContext) _K8sActualSource_hasInstrumentedApplication(ctx cont } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_hasInstrumentedApplication(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "__Type", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type __TypeKind does not have child fields") }, } return fc, nil } -func (ec *executionContext) _K8sActualSource_instrumentedApplicationDetails(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_name(ctx, field) if err != nil { return graphql.Null } @@ -4417,7 +3765,7 @@ func (ec *executionContext) _K8sActualSource_instrumentedApplicationDetails(ctx }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InstrumentedApplicationDetails, nil + return obj.Name(), nil }) if err != nil { ec.Error(ctx, err) @@ -4426,32 +3774,26 @@ func (ec *executionContext) _K8sActualSource_instrumentedApplicationDetails(ctx if resTmp == nil { return graphql.Null } - res := resTmp.(*model.InstrumentedApplicationDetails) + res := resTmp.(*string) fc.Result = res - return ec.marshalOInstrumentedApplicationDetails2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentedApplicationDetails(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_instrumentedApplicationDetails(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "__Type", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "languages": - return ec.fieldContext_InstrumentedApplicationDetails_languages(ctx, field) - case "conditions": - return ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type InstrumentedApplicationDetails", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _K8sActualSourceRuntimeInfo_mainContainer(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfo) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSourceRuntimeInfo_mainContainer(ctx, field) +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_description(ctx, field) if err != nil { return graphql.Null } @@ -4464,7 +3806,7 @@ func (ec *executionContext) _K8sActualSourceRuntimeInfo_mainContainer(ctx contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.MainContainer, nil + return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) @@ -4473,32 +3815,26 @@ func (ec *executionContext) _K8sActualSourceRuntimeInfo_mainContainer(ctx contex if resTmp == nil { return graphql.Null } - res := resTmp.(*model.K8sActualSourceRuntimeInfoContainer) + res := resTmp.(*string) fc.Result = res - return ec.marshalOK8sActualSourceRuntimeInfoContainer2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSourceRuntimeInfoContainer(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSourceRuntimeInfo_mainContainer(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSourceRuntimeInfo", + Object: "__Type", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "containerName": - return ec.fieldContext_K8sActualSourceRuntimeInfoContainer_containerName(ctx, field) - case "language": - return ec.fieldContext_K8sActualSourceRuntimeInfoContainer_language(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type K8sActualSourceRuntimeInfoContainer", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer_containerName(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfoContainer) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSourceRuntimeInfoContainer_containerName(ctx, field) +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_fields(ctx, field) if err != nil { return graphql.Null } @@ -4511,38 +3847,60 @@ func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer_containerName(c }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ContainerName, nil + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.([]introspection.Field) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSourceRuntimeInfoContainer_containerName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSourceRuntimeInfoContainer", + Object: "__Type", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext___Field_name(ctx, field) + case "description": + return ec.fieldContext___Field_description(ctx, field) + case "args": + return ec.fieldContext___Field_args(ctx, field) + case "type": + return ec.fieldContext___Field_type(ctx, field) + case "isDeprecated": + return ec.fieldContext___Field_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___Field_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer_language(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfoContainer) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSourceRuntimeInfoContainer_language(ctx, field) +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_interfaces(ctx, field) if err != nil { return graphql.Null } @@ -4555,38 +3913,57 @@ func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer_language(ctx co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Language, nil + return obj.Interfaces(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(model.ProgrammingLanguage) + res := resTmp.([]introspection.Type) fc.Result = res - return ec.marshalNProgrammingLanguage2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐProgrammingLanguage(ctx, field.Selections, res) + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSourceRuntimeInfoContainer_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSourceRuntimeInfoContainer", + Object: "__Type", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ProgrammingLanguage does not have child fields") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } -func (ec *executionContext) _Mutation_applyDesiredNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_applyDesiredNamespace(ctx, field) +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) if err != nil { return graphql.Null } @@ -4599,49 +3976,57 @@ func (ec *executionContext) _Mutation_applyDesiredNamespace(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().ApplyDesiredNamespace(rctx, fc.Args["cpId"].(string), fc.Args["nsId"].(model.K8sNamespaceID), fc.Args["ns"].(model.K8sDesiredNamespaceInput)) + return obj.PossibleTypes(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bool) + res := resTmp.([]introspection.Type) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_applyDesiredNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "__Type", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_applyDesiredNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Mutation_deleteDesiredNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_deleteDesiredNamespace(ctx, field) +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_enumValues(ctx, field) if err != nil { return graphql.Null } @@ -4654,31 +4039,38 @@ func (ec *executionContext) _Mutation_deleteDesiredNamespace(ctx context.Context }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().DeleteDesiredNamespace(rctx, fc.Args["cpId"].(string), fc.Args["nsId"].(model.K8sNamespaceID)) + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bool) + res := resTmp.([]introspection.EnumValue) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_deleteDesiredNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "__Type", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext___EnumValue_name(ctx, field) + case "description": + return ec.fieldContext___EnumValue_description(ctx, field) + case "isDeprecated": + return ec.fieldContext___EnumValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___EnumValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) }, } defer func() { @@ -4688,15 +4080,15 @@ func (ec *executionContext) fieldContext_Mutation_deleteDesiredNamespace(ctx con } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_deleteDesiredNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Mutation_applyDesiredSource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_applyDesiredSource(ctx, field) +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_inputFields(ctx, field) if err != nil { return graphql.Null } @@ -4709,49 +4101,45 @@ func (ec *executionContext) _Mutation_applyDesiredSource(ctx context.Context, fi }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().ApplyDesiredSource(rctx, fc.Args["cpId"].(string), fc.Args["sourceId"].(model.K8sSourceID), fc.Args["source"].(model.K8sDesiredSourceInput)) + return obj.InputFields(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bool) + res := resTmp.([]introspection.InputValue) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_applyDesiredSource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "__Type", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_applyDesiredSource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Mutation_deleteDesiredSource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_deleteDesiredSource(ctx, field) +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_ofType(ctx, field) if err != nil { return graphql.Null } @@ -4764,49 +4152,57 @@ func (ec *executionContext) _Mutation_deleteDesiredSource(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().DeleteDesiredSource(rctx, fc.Args["cpId"].(string), fc.Args["sourceId"].(model.K8sSourceID)) + return obj.OfType(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_deleteDesiredSource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "__Type", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_deleteDesiredSource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Mutation_createDesiredDestination(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_createDesiredDestination(ctx, field) +func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) if err != nil { return graphql.Null } @@ -4819,3550 +4215,241 @@ func (ec *executionContext) _Mutation_createDesiredDestination(ctx context.Conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CreateDesiredDestination(rctx, fc.Args["destinationType"].(string), fc.Args["destination"].(model.DesiredDestinationInput)) + return obj.SpecifiedByURL(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(*model.DesiredDestination) + res := resTmp.(*string) fc.Result = res - return ec.marshalNDesiredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_createDesiredDestination(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "__Type", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_DesiredDestination_id(ctx, field) - case "name": - return ec.fieldContext_DesiredDestination_name(ctx, field) - case "type": - return ec.fieldContext_DesiredDestination_type(ctx, field) - case "exportSignals": - return ec.fieldContext_DesiredDestination_exportSignals(ctx, field) - case "fields": - return ec.fieldContext_DesiredDestination_fields(ctx, field) - case "computePlatforms": - return ec.fieldContext_DesiredDestination_computePlatforms(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DesiredDestination", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_createDesiredDestination_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Mutation_updateDesiredDestination(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_updateDesiredDestination(ctx, field) - if err != nil { - return graphql.Null +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputK8sDesiredNamespaceInput(ctx context.Context, obj interface{}) (model.K8sDesiredNamespaceInput, error) { + var it model.K8sDesiredNamespaceInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + + fieldsInOrder := [...]string{"autoInstrument"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().UpdateDesiredDestination(rctx, fc.Args["destinationId"].(string), fc.Args["destination"].(model.DesiredDestinationInput)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") + switch k { + case "autoInstrument": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("autoInstrument")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.AutoInstrument = data } - return graphql.Null } - res := resTmp.(*model.DesiredDestination) - fc.Result = res - return ec.marshalNDesiredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx, field.Selections, res) + + return it, nil } -func (ec *executionContext) fieldContext_Mutation_updateDesiredDestination(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Mutation", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_DesiredDestination_id(ctx, field) - case "name": - return ec.fieldContext_DesiredDestination_name(ctx, field) - case "type": - return ec.fieldContext_DesiredDestination_type(ctx, field) - case "exportSignals": - return ec.fieldContext_DesiredDestination_exportSignals(ctx, field) - case "fields": - return ec.fieldContext_DesiredDestination_fields(ctx, field) - case "computePlatforms": - return ec.fieldContext_DesiredDestination_computePlatforms(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DesiredDestination", field.Name) - }, +func (ec *executionContext) unmarshalInputK8sDesiredSourceInput(ctx context.Context, obj interface{}) (model.K8sDesiredSourceInput, error) { + var it model.K8sDesiredSourceInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) + + fieldsInOrder := [...]string{"serviceName", "autoInstrument"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "serviceName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("serviceName")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ServiceName = data + case "autoInstrument": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("autoInstrument")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.AutoInstrument = data } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_updateDesiredDestination_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err } - return fc, nil + + return it, nil } -func (ec *executionContext) _Mutation_deleteDesiredDestination(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_deleteDesiredDestination(ctx, field) - if err != nil { - return graphql.Null +func (ec *executionContext) unmarshalInputK8sNamespaceId(ctx context.Context, obj interface{}) (model.K8sNamespaceID, error) { + var it model.K8sNamespaceID + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + + fieldsInOrder := [...]string{"name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().DeleteDesiredDestination(rctx, fc.Args["destinationId"].(string)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data } - return graphql.Null } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + + return it, nil } -func (ec *executionContext) fieldContext_Mutation_deleteDesiredDestination(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Mutation", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_deleteDesiredDestination_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Mutation_applyDesiredDestinationToComputePlatform(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_applyDesiredDestinationToComputePlatform(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().ApplyDesiredDestinationToComputePlatform(rctx, fc.Args["cpId"].(string), fc.Args["destinationId"].(string)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Mutation_applyDesiredDestinationToComputePlatform(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Mutation", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_applyDesiredDestinationToComputePlatform_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Mutation_removeDesiredDestinationFromComputePlatform(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_removeDesiredDestinationFromComputePlatform(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().RemoveDesiredDestinationFromComputePlatform(rctx, fc.Args["cpId"].(string), fc.Args["destinationId"].(string)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Mutation_removeDesiredDestinationFromComputePlatform(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Mutation", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_removeDesiredDestinationFromComputePlatform_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Mutation_createDesiredAction(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_createDesiredAction(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CreateDesiredAction(rctx, fc.Args["cpId"].(string), fc.Args["action"].(model.DesiredActionInput)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Mutation_createDesiredAction(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Mutation", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_createDesiredAction_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Mutation_updateDesiredAction(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_updateDesiredAction(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().UpdateDesiredAction(rctx, fc.Args["cpId"].(string), fc.Args["actionId"].(string), fc.Args["action"].(model.DesiredActionInput)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Mutation_updateDesiredAction(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Mutation", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_updateDesiredAction_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Mutation_deleteActualAction(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_deleteActualAction(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().DeleteActualAction(rctx, fc.Args["cpId"].(string), fc.Args["actionId"].(string), fc.Args["kind"].(string)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Mutation_deleteActualAction(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Mutation", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_deleteActualAction_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Query_computePlatform(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_computePlatform(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().ComputePlatform(rctx, fc.Args["cpId"].(string)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.ComputePlatform) - fc.Result = res - return ec.marshalOComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_computePlatform(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ComputePlatform_id(ctx, field) - case "name": - return ec.fieldContext_ComputePlatform_name(ctx, field) - case "computePlatformType": - return ec.fieldContext_ComputePlatform_computePlatformType(ctx, field) - case "k8sActualNamespace": - return ec.fieldContext_ComputePlatform_k8sActualNamespace(ctx, field) - case "k8sActualNamespaces": - return ec.fieldContext_ComputePlatform_k8sActualNamespaces(ctx, field) - case "k8sActualSource": - return ec.fieldContext_ComputePlatform_k8sActualSource(ctx, field) - case "k8sActualSources": - return ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) - case "actualDestinations": - return ec.fieldContext_ComputePlatform_actualDestinations(ctx, field) - case "actualActions": - return ec.fieldContext_ComputePlatform_actualActions(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ComputePlatform", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_computePlatform_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Query_destinationTypeCategories(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_destinationTypeCategories(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().DestinationTypeCategories(rctx) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]*model.DestinationTypeCategory) - fc.Result = res - return ec.marshalODestinationTypeCategory2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeCategory(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_destinationTypeCategories(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_DestinationTypeCategory_name(ctx, field) - case "destinationTypes": - return ec.fieldContext_DestinationTypeCategory_destinationTypes(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DestinationTypeCategory", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _Query_desiredDestinations(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_desiredDestinations(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().DesiredDestinations(rctx) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]*model.DesiredDestination) - fc.Result = res - return ec.marshalODesiredDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_desiredDestinations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_DesiredDestination_id(ctx, field) - case "name": - return ec.fieldContext_DesiredDestination_name(ctx, field) - case "type": - return ec.fieldContext_DesiredDestination_type(ctx, field) - case "exportSignals": - return ec.fieldContext_DesiredDestination_exportSignals(ctx, field) - case "fields": - return ec.fieldContext_DesiredDestination_fields(ctx, field) - case "computePlatforms": - return ec.fieldContext_DesiredDestination_computePlatforms(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DesiredDestination", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query___type(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.introspectType(fc.Args["name"].(string)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query___schema(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.introspectSchema() - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Schema) - fc.Result = res - return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "description": - return ec.fieldContext___Schema_description(ctx, field) - case "types": - return ec.fieldContext___Schema_types(ctx, field) - case "queryType": - return ec.fieldContext___Schema_queryType(ctx, field) - case "mutationType": - return ec.fieldContext___Schema_mutationType(ctx, field) - case "subscriptionType": - return ec.fieldContext___Schema_subscriptionType(ctx, field) - case "directives": - return ec.fieldContext___Schema_directives(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _SourceLanguage_containerName(ctx context.Context, field graphql.CollectedField, obj *model.SourceLanguage) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_SourceLanguage_containerName(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ContainerName, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_SourceLanguage_containerName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "SourceLanguage", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _SourceLanguage_language(ctx context.Context, field graphql.CollectedField, obj *model.SourceLanguage) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_SourceLanguage_language(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Language, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_SourceLanguage_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "SourceLanguage", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_description(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_locations(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Locations, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]string) - fc.Result = res - return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __DirectiveLocation does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_args(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Args, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.InputValue) - fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Directive_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsRepeatable, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_description(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_description(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_args(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Args, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.InputValue) - fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Field_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_type(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_description(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_type(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DefaultValue, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_description(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_types(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Types(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_queryType(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.QueryType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_mutationType(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.MutationType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.SubscriptionType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_directives(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Directives(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.Directive) - fc.Result = res - return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___Directive_name(ctx, field) - case "description": - return ec.fieldContext___Directive_description(ctx, field) - case "locations": - return ec.fieldContext___Directive_locations(ctx, field) - case "args": - return ec.fieldContext___Directive_args(ctx, field) - case "isRepeatable": - return ec.fieldContext___Directive_isRepeatable(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_kind(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Kind(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalN__TypeKind2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __TypeKind does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_description(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_fields(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.Field) - fc.Result = res - return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___Field_name(ctx, field) - case "description": - return ec.fieldContext___Field_description(ctx, field) - case "args": - return ec.fieldContext___Field_args(ctx, field) - case "type": - return ec.fieldContext___Field_type(ctx, field) - case "isDeprecated": - return ec.fieldContext___Field_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___Field_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_interfaces(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Interfaces(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.PossibleTypes(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_enumValues(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.EnumValue) - fc.Result = res - return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___EnumValue_name(ctx, field) - case "description": - return ec.fieldContext___EnumValue_description(ctx, field) - case "isDeprecated": - return ec.fieldContext___EnumValue_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___EnumValue_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_inputFields(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.InputFields(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.InputValue) - fc.Result = res - return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_ofType(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.OfType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.SpecifiedByURL(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -// endregion **************************** field.gotpl ***************************** - -// region **************************** input.gotpl ***************************** - -func (ec *executionContext) unmarshalInputDesiredActionInput(ctx context.Context, obj interface{}) (model.DesiredActionInput, error) { - var it model.DesiredActionInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"kind", "name", "notes", "disable", "signals", "details"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "kind": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Kind = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "notes": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("notes")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.Notes = data - case "disable": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("disable")) - data, err := ec.unmarshalNBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.Disable = data - case "signals": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signals")) - data, err := ec.unmarshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, v) - if err != nil { - return it, err - } - it.Signals = data - case "details": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("details")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Details = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputDesiredDestinationFieldInput(ctx context.Context, obj interface{}) (model.DesiredDestinationFieldInput, error) { - var it model.DesiredDestinationFieldInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"name", "value"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "value": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Value = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputDesiredDestinationInput(ctx context.Context, obj interface{}) (model.DesiredDestinationInput, error) { - var it model.DesiredDestinationInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"name", "exportSignals", "fields"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "exportSignals": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exportSignals")) - data, err := ec.unmarshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx, v) - if err != nil { - return it, err - } - it.ExportSignals = data - case "fields": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fields")) - data, err := ec.unmarshalNDesiredDestinationFieldInput2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationFieldInputᚄ(ctx, v) - if err != nil { - return it, err - } - it.Fields = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputK8sDesiredNamespaceInput(ctx context.Context, obj interface{}) (model.K8sDesiredNamespaceInput, error) { - var it model.K8sDesiredNamespaceInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"autoInstrument"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "autoInstrument": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("autoInstrument")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) - if err != nil { - return it, err - } - it.AutoInstrument = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputK8sDesiredSourceInput(ctx context.Context, obj interface{}) (model.K8sDesiredSourceInput, error) { - var it model.K8sDesiredSourceInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"serviceName", "autoInstrument"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "serviceName": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("serviceName")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.ServiceName = data - case "autoInstrument": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("autoInstrument")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) - if err != nil { - return it, err - } - it.AutoInstrument = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputK8sNamespaceId(ctx context.Context, obj interface{}) (model.K8sNamespaceID, error) { - var it model.K8sNamespaceID - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"name"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Name = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputK8sSourceId(ctx context.Context, obj interface{}) (model.K8sSourceID, error) { - var it model.K8sSourceID - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"namespace", "kind", "name"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "namespace": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Namespace = data - case "kind": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) - data, err := ec.unmarshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx, v) - if err != nil { - return it, err - } - it.Kind = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Name = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputWorkloadInput(ctx context.Context, obj interface{}) (model.WorkloadInput, error) { - var it model.WorkloadInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"kind", "name", "namespace"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "kind": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) - data, err := ec.unmarshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx, v) - if err != nil { - return it, err - } - it.Kind = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "namespace": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - it.Namespace = data - } - } - - return it, nil -} - -// endregion **************************** input.gotpl ***************************** - -// region ************************** interface.gotpl *************************** - -// endregion ************************** interface.gotpl *************************** - -// region **************************** object.gotpl **************************** - -var actualActionImplementors = []string{"ActualAction"} - -func (ec *executionContext) _ActualAction(ctx context.Context, sel ast.SelectionSet, obj *model.ActualAction) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, actualActionImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("ActualAction") - case "id": - out.Values[i] = ec._ActualAction_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "kind": - out.Values[i] = ec._ActualAction_kind(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "name": - out.Values[i] = ec._ActualAction_name(ctx, field, obj) - case "notes": - out.Values[i] = ec._ActualAction_notes(ctx, field, obj) - case "disable": - out.Values[i] = ec._ActualAction_disable(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "signals": - out.Values[i] = ec._ActualAction_signals(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "details": - out.Values[i] = ec._ActualAction_details(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var actualDestinationImplementors = []string{"ActualDestination"} - -func (ec *executionContext) _ActualDestination(ctx context.Context, sel ast.SelectionSet, obj *model.ActualDestination) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, actualDestinationImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("ActualDestination") - case "id": - out.Values[i] = ec._ActualDestination_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "name": - out.Values[i] = ec._ActualDestination_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "type": - out.Values[i] = ec._ActualDestination_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "exportedSignals": - out.Values[i] = ec._ActualDestination_exportedSignals(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "fields": - out.Values[i] = ec._ActualDestination_fields(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var computePlatformImplementors = []string{"ComputePlatform"} - -func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.SelectionSet, obj *model.ComputePlatform) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, computePlatformImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("ComputePlatform") - case "id": - out.Values[i] = ec._ComputePlatform_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "name": - out.Values[i] = ec._ComputePlatform_name(ctx, field, obj) - case "computePlatformType": - out.Values[i] = ec._ComputePlatform_computePlatformType(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "k8sActualNamespace": - out.Values[i] = ec._ComputePlatform_k8sActualNamespace(ctx, field, obj) - case "k8sActualNamespaces": - out.Values[i] = ec._ComputePlatform_k8sActualNamespaces(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "k8sActualSource": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._ComputePlatform_k8sActualSource(ctx, field, obj) - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "k8sActualSources": - out.Values[i] = ec._ComputePlatform_k8sActualSources(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "actualDestinations": - out.Values[i] = ec._ComputePlatform_actualDestinations(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "actualActions": - out.Values[i] = ec._ComputePlatform_actualActions(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var conditionImplementors = []string{"Condition"} - -func (ec *executionContext) _Condition(ctx context.Context, sel ast.SelectionSet, obj *model.Condition) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, conditionImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Condition") - case "type": - out.Values[i] = ec._Condition_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "status": - out.Values[i] = ec._Condition_status(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "lastTransitionTime": - out.Values[i] = ec._Condition_lastTransitionTime(ctx, field, obj) - case "reason": - out.Values[i] = ec._Condition_reason(ctx, field, obj) - case "message": - out.Values[i] = ec._Condition_message(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var desiredDestinationImplementors = []string{"DesiredDestination"} - -func (ec *executionContext) _DesiredDestination(ctx context.Context, sel ast.SelectionSet, obj *model.DesiredDestination) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, desiredDestinationImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("DesiredDestination") - case "id": - out.Values[i] = ec._DesiredDestination_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "name": - out.Values[i] = ec._DesiredDestination_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "type": - out.Values[i] = ec._DesiredDestination_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "exportSignals": - out.Values[i] = ec._DesiredDestination_exportSignals(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "fields": - out.Values[i] = ec._DesiredDestination_fields(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "computePlatforms": - out.Values[i] = ec._DesiredDestination_computePlatforms(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var destinationSpecFieldImplementors = []string{"DestinationSpecField"} - -func (ec *executionContext) _DestinationSpecField(ctx context.Context, sel ast.SelectionSet, obj *model.DestinationSpecField) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, destinationSpecFieldImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("DestinationSpecField") - case "name": - out.Values[i] = ec._DestinationSpecField_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "value": - out.Values[i] = ec._DestinationSpecField_value(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var destinationTypeImplementors = []string{"DestinationType"} - -func (ec *executionContext) _DestinationType(ctx context.Context, sel ast.SelectionSet, obj *model.DestinationType) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, destinationTypeImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("DestinationType") - case "category": - out.Values[i] = ec._DestinationType_category(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "name": - out.Values[i] = ec._DestinationType_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "displayName": - out.Values[i] = ec._DestinationType_displayName(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "image": - out.Values[i] = ec._DestinationType_image(ctx, field, obj) - case "supportedSignals": - out.Values[i] = ec._DestinationType_supportedSignals(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "fields": - out.Values[i] = ec._DestinationType_fields(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) +func (ec *executionContext) unmarshalInputK8sSourceId(ctx context.Context, obj interface{}) (model.K8sSourceID, error) { + var it model.K8sSourceID + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v } - return out -} - -var destinationTypeCategoryImplementors = []string{"DestinationTypeCategory"} - -func (ec *executionContext) _DestinationTypeCategory(ctx context.Context, sel ast.SelectionSet, obj *model.DestinationTypeCategory) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, destinationTypeCategoryImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("DestinationTypeCategory") - case "name": - out.Values[i] = ec._DestinationTypeCategory_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "destinationTypes": - out.Values[i] = ec._DestinationTypeCategory_destinationTypes(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) + fieldsInOrder := [...]string{"namespace", "kind", "name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var destinationTypeFieldImplementors = []string{"DestinationTypeField"} - -func (ec *executionContext) _DestinationTypeField(ctx context.Context, sel ast.SelectionSet, obj *model.DestinationTypeField) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, destinationTypeFieldImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("DestinationTypeField") - case "name": - out.Values[i] = ec._DestinationTypeField_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "displayName": - out.Values[i] = ec._DestinationTypeField_displayName(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "videoURL": - out.Values[i] = ec._DestinationTypeField_videoURL(ctx, field, obj) - case "thumbnailURL": - out.Values[i] = ec._DestinationTypeField_thumbnailURL(ctx, field, obj) - case "componentType": - out.Values[i] = ec._DestinationTypeField_componentType(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "componentProps": - out.Values[i] = ec._DestinationTypeField_componentProps(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + switch k { + case "namespace": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err } - case "secret": - out.Values[i] = ec._DestinationTypeField_secret(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + it.Namespace = data + case "kind": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) + data, err := ec.unmarshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx, v) + if err != nil { + return it, err } - case "initialValue": - out.Values[i] = ec._DestinationTypeField_initialValue(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) + it.Kind = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + } } - return out + return it, nil } -var instrumentedApplicationDetailsImplementors = []string{"InstrumentedApplicationDetails"} - -func (ec *executionContext) _InstrumentedApplicationDetails(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentedApplicationDetails) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, instrumentedApplicationDetailsImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("InstrumentedApplicationDetails") - case "languages": - out.Values[i] = ec._InstrumentedApplicationDetails_languages(ctx, field, obj) - case "conditions": - out.Values[i] = ec._InstrumentedApplicationDetails_conditions(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } +// endregion **************************** input.gotpl ***************************** - atomic.AddInt32(&ec.deferred, int32(len(deferred))) +// region ************************** interface.gotpl *************************** - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } +// endregion ************************** interface.gotpl *************************** - return out -} +// region **************************** object.gotpl **************************** -var k8sActualNamespaceImplementors = []string{"K8sActualNamespace"} +var computePlatformImplementors = []string{"ComputePlatform"} -func (ec *executionContext) _K8sActualNamespace(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualNamespace) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualNamespaceImplementors) +func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.SelectionSet, obj *model.ComputePlatform) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, computePlatformImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("K8sActualNamespace") + out.Values[i] = graphql.MarshalString("ComputePlatform") + case "id": + out.Values[i] = ec._ComputePlatform_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } case "name": - out.Values[i] = ec._K8sActualNamespace_name(ctx, field, obj) + out.Values[i] = ec._ComputePlatform_name(ctx, field, obj) + case "computePlatformType": + out.Values[i] = ec._ComputePlatform_computePlatformType(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } - case "autoInstrumented": - out.Values[i] = ec._K8sActualNamespace_autoInstrumented(ctx, field, obj) + case "k8sActualNamespace": + out.Values[i] = ec._ComputePlatform_k8sActualNamespace(ctx, field, obj) + case "k8sActualNamespaces": + out.Values[i] = ec._ComputePlatform_k8sActualNamespaces(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "k8sActualSource": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ComputePlatform_k8sActualSource(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "k8sActualSources": - out.Values[i] = ec._K8sActualNamespace_k8sActualSources(ctx, field, obj) + out.Values[i] = ec._ComputePlatform_k8sActualSources(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } default: panic("unknown field " + strconv.Quote(field.Name)) @@ -8387,47 +4474,33 @@ func (ec *executionContext) _K8sActualNamespace(ctx context.Context, sel ast.Sel return out } -var k8sActualSourceImplementors = []string{"K8sActualSource"} +var conditionImplementors = []string{"Condition"} -func (ec *executionContext) _K8sActualSource(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSource) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceImplementors) +func (ec *executionContext) _Condition(ctx context.Context, sel ast.SelectionSet, obj *model.Condition) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, conditionImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("K8sActualSource") - case "namespace": - out.Values[i] = ec._K8sActualSource_namespace(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "kind": - out.Values[i] = ec._K8sActualSource_kind(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "name": - out.Values[i] = ec._K8sActualSource_name(ctx, field, obj) + out.Values[i] = graphql.MarshalString("Condition") + case "type": + out.Values[i] = ec._Condition_type(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "serviceName": - out.Values[i] = ec._K8sActualSource_serviceName(ctx, field, obj) - case "autoInstrumented": - out.Values[i] = ec._K8sActualSource_autoInstrumented(ctx, field, obj) - case "creationTimestamp": - out.Values[i] = ec._K8sActualSource_creationTimestamp(ctx, field, obj) - case "numberOfInstances": - out.Values[i] = ec._K8sActualSource_numberOfInstances(ctx, field, obj) - case "hasInstrumentedApplication": - out.Values[i] = ec._K8sActualSource_hasInstrumentedApplication(ctx, field, obj) + case "status": + out.Values[i] = ec._Condition_status(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "instrumentedApplicationDetails": - out.Values[i] = ec._K8sActualSource_instrumentedApplicationDetails(ctx, field, obj) + case "lastTransitionTime": + out.Values[i] = ec._Condition_lastTransitionTime(ctx, field, obj) + case "reason": + out.Values[i] = ec._Condition_reason(ctx, field, obj) + case "message": + out.Values[i] = ec._Condition_message(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -8451,19 +4524,22 @@ func (ec *executionContext) _K8sActualSource(ctx context.Context, sel ast.Select return out } -var k8sActualSourceRuntimeInfoImplementors = []string{"K8sActualSourceRuntimeInfo"} +var getConfigResponseImplementors = []string{"GetConfigResponse"} -func (ec *executionContext) _K8sActualSourceRuntimeInfo(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSourceRuntimeInfo) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceRuntimeInfoImplementors) +func (ec *executionContext) _GetConfigResponse(ctx context.Context, sel ast.SelectionSet, obj *model.GetConfigResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, getConfigResponseImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("K8sActualSourceRuntimeInfo") - case "mainContainer": - out.Values[i] = ec._K8sActualSourceRuntimeInfo_mainContainer(ctx, field, obj) + out.Values[i] = graphql.MarshalString("GetConfigResponse") + case "installation": + out.Values[i] = ec._GetConfigResponse_installation(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -8487,27 +4563,21 @@ func (ec *executionContext) _K8sActualSourceRuntimeInfo(ctx context.Context, sel return out } -var k8sActualSourceRuntimeInfoContainerImplementors = []string{"K8sActualSourceRuntimeInfoContainer"} +var instrumentedApplicationDetailsImplementors = []string{"InstrumentedApplicationDetails"} -func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSourceRuntimeInfoContainer) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceRuntimeInfoContainerImplementors) +func (ec *executionContext) _InstrumentedApplicationDetails(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentedApplicationDetails) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, instrumentedApplicationDetailsImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("K8sActualSourceRuntimeInfoContainer") - case "containerName": - out.Values[i] = ec._K8sActualSourceRuntimeInfoContainer_containerName(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "language": - out.Values[i] = ec._K8sActualSourceRuntimeInfoContainer_language(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } + out.Values[i] = graphql.MarshalString("InstrumentedApplicationDetails") + case "languages": + out.Values[i] = ec._InstrumentedApplicationDetails_languages(ctx, field, obj) + case "conditions": + out.Values[i] = ec._InstrumentedApplicationDetails_conditions(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -8531,106 +4601,26 @@ func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer(ctx context.Con return out } -var mutationImplementors = []string{"Mutation"} +var k8sActualNamespaceImplementors = []string{"K8sActualNamespace"} -func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) - ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ - Object: "Mutation", - }) +func (ec *executionContext) _K8sActualNamespace(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualNamespace) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualNamespaceImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { - innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ - Object: field.Name, - Field: field, - }) - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("Mutation") - case "applyDesiredNamespace": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_applyDesiredNamespace(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "deleteDesiredNamespace": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_deleteDesiredNamespace(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "applyDesiredSource": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_applyDesiredSource(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "deleteDesiredSource": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_deleteDesiredSource(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "createDesiredDestination": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_createDesiredDestination(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "updateDesiredDestination": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_updateDesiredDestination(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "deleteDesiredDestination": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_deleteDesiredDestination(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "applyDesiredDestinationToComputePlatform": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_applyDesiredDestinationToComputePlatform(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "removeDesiredDestinationFromComputePlatform": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_removeDesiredDestinationFromComputePlatform(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "createDesiredAction": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_createDesiredAction(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "updateDesiredAction": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_updateDesiredAction(ctx, field) - }) + out.Values[i] = graphql.MarshalString("K8sActualNamespace") + case "name": + out.Values[i] = ec._K8sActualNamespace_name(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "deleteActualAction": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_deleteActualAction(ctx, field) - }) + case "autoInstrumented": + out.Values[i] = ec._K8sActualNamespace_autoInstrumented(ctx, field, obj) + case "k8sActualSources": + out.Values[i] = ec._K8sActualNamespace_k8sActualSources(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -8657,90 +4647,47 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return out } -var queryImplementors = []string{"Query"} +var k8sActualSourceImplementors = []string{"K8sActualSource"} -func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ - Object: "Query", - }) +func (ec *executionContext) _K8sActualSource(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSource) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { - innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ - Object: field.Name, - Field: field, - }) - switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("Query") - case "computePlatform": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_computePlatform(ctx, field) - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "destinationTypeCategories": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_destinationTypeCategories(ctx, field) - return res + out.Values[i] = graphql.MarshalString("K8sActualSource") + case "namespace": + out.Values[i] = ec._K8sActualSource_namespace(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "kind": + out.Values[i] = ec._K8sActualSource_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "desiredDestinations": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_desiredDestinations(ctx, field) - return res + case "name": + out.Values[i] = ec._K8sActualSource_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "serviceName": + out.Values[i] = ec._K8sActualSource_serviceName(ctx, field, obj) + case "autoInstrumented": + out.Values[i] = ec._K8sActualSource_autoInstrumented(ctx, field, obj) + case "creationTimestamp": + out.Values[i] = ec._K8sActualSource_creationTimestamp(ctx, field, obj) + case "numberOfInstances": + out.Values[i] = ec._K8sActualSource_numberOfInstances(ctx, field, obj) + case "hasInstrumentedApplication": + out.Values[i] = ec._K8sActualSource_hasInstrumentedApplication(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "__type": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Query___type(ctx, field) - }) - case "__schema": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Query___schema(ctx, field) - }) + case "instrumentedApplicationDetails": + out.Values[i] = ec._K8sActualSource_instrumentedApplicationDetails(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -8764,27 +4711,19 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr return out } -var sourceLanguageImplementors = []string{"SourceLanguage"} +var k8sActualSourceRuntimeInfoImplementors = []string{"K8sActualSourceRuntimeInfo"} -func (ec *executionContext) _SourceLanguage(ctx context.Context, sel ast.SelectionSet, obj *model.SourceLanguage) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, sourceLanguageImplementors) +func (ec *executionContext) _K8sActualSourceRuntimeInfo(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSourceRuntimeInfo) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceRuntimeInfoImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("SourceLanguage") - case "containerName": - out.Values[i] = ec._SourceLanguage_containerName(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "language": - out.Values[i] = ec._SourceLanguage_language(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } + out.Values[i] = graphql.MarshalString("K8sActualSourceRuntimeInfo") + case "mainContainer": + out.Values[i] = ec._K8sActualSourceRuntimeInfo_mainContainer(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -8808,36 +4747,24 @@ func (ec *executionContext) _SourceLanguage(ctx context.Context, sel ast.Selecti return out } -var __DirectiveImplementors = []string{"__Directive"} +var k8sActualSourceRuntimeInfoContainerImplementors = []string{"K8sActualSourceRuntimeInfoContainer"} -func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) +func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSourceRuntimeInfoContainer) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceRuntimeInfoContainerImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("__Directive") - case "name": - out.Values[i] = ec.___Directive_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "description": - out.Values[i] = ec.___Directive_description(ctx, field, obj) - case "locations": - out.Values[i] = ec.___Directive_locations(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "args": - out.Values[i] = ec.___Directive_args(ctx, field, obj) + out.Values[i] = graphql.MarshalString("K8sActualSourceRuntimeInfoContainer") + case "containerName": + out.Values[i] = ec._K8sActualSourceRuntimeInfoContainer_containerName(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "isRepeatable": - out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + case "language": + out.Values[i] = ec._K8sActualSourceRuntimeInfoContainer_language(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -8864,31 +4791,29 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS return out } -var __EnumValueImplementors = []string{"__EnumValue"} +var mutationImplementors = []string{"Mutation"} -func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) +func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Mutation", + }) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("__EnumValue") - case "name": - out.Values[i] = ec.___EnumValue_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "description": - out.Values[i] = ec.___EnumValue_description(ctx, field, obj) - case "isDeprecated": - out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "deprecationReason": - out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) + out.Values[i] = graphql.MarshalString("Mutation") + case "createK8sDesiredNamespace": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createK8sDesiredNamespace(ctx, field) + }) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -8912,41 +4837,71 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS return out } -var __FieldImplementors = []string{"__Field"} +var queryImplementors = []string{"Query"} -func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) +func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Query", + }) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("__Field") - case "name": - out.Values[i] = ec.___Field_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + out.Values[i] = graphql.MarshalString("Query") + case "computePlatform": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_computePlatform(ctx, field) + return res } - case "description": - out.Values[i] = ec.___Field_description(ctx, field, obj) - case "args": - out.Values[i] = ec.___Field_args(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } - case "type": - out.Values[i] = ec.___Field_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "config": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_config(ctx, field) + return res } - case "isDeprecated": - out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } - case "deprecationReason": - out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "__type": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___type(ctx, field) + }) + case "__schema": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___schema(ctx, field) + }) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -8970,31 +4925,27 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, return out } -var __InputValueImplementors = []string{"__InputValue"} +var sourceLanguageImplementors = []string{"SourceLanguage"} -func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) +func (ec *executionContext) _SourceLanguage(ctx context.Context, sel ast.SelectionSet, obj *model.SourceLanguage) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, sourceLanguageImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("__InputValue") - case "name": - out.Values[i] = ec.___InputValue_name(ctx, field, obj) + out.Values[i] = graphql.MarshalString("SourceLanguage") + case "containerName": + out.Values[i] = ec._SourceLanguage_containerName(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "description": - out.Values[i] = ec.___InputValue_description(ctx, field, obj) - case "type": - out.Values[i] = ec.___InputValue_type(ctx, field, obj) + case "language": + out.Values[i] = ec._SourceLanguage_language(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "defaultValue": - out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -9018,35 +4969,36 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection return out } -var __SchemaImplementors = []string{"__Schema"} +var __DirectiveImplementors = []string{"__Directive"} -func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) +func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("__Schema") + out.Values[i] = graphql.MarshalString("__Directive") + case "name": + out.Values[i] = ec.___Directive_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "description": - out.Values[i] = ec.___Schema_description(ctx, field, obj) - case "types": - out.Values[i] = ec.___Schema_types(ctx, field, obj) + out.Values[i] = ec.___Directive_description(ctx, field, obj) + case "locations": + out.Values[i] = ec.___Directive_locations(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "queryType": - out.Values[i] = ec.___Schema_queryType(ctx, field, obj) + case "args": + out.Values[i] = ec.___Directive_args(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "mutationType": - out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) - case "subscriptionType": - out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) - case "directives": - out.Values[i] = ec.___Schema_directives(ctx, field, obj) + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -9073,40 +5025,31 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, return out } -var __TypeImplementors = []string{"__Type"} +var __EnumValueImplementors = []string{"__EnumValue"} -func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) +func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("__Type") - case "kind": - out.Values[i] = ec.___Type_kind(ctx, field, obj) + out.Values[i] = graphql.MarshalString("__EnumValue") + case "name": + out.Values[i] = ec.___EnumValue_name(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "name": - out.Values[i] = ec.___Type_name(ctx, field, obj) case "description": - out.Values[i] = ec.___Type_description(ctx, field, obj) - case "fields": - out.Values[i] = ec.___Type_fields(ctx, field, obj) - case "interfaces": - out.Values[i] = ec.___Type_interfaces(ctx, field, obj) - case "possibleTypes": - out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) - case "enumValues": - out.Values[i] = ec.___Type_enumValues(ctx, field, obj) - case "inputFields": - out.Values[i] = ec.___Type_inputFields(ctx, field, obj) - case "ofType": - out.Values[i] = ec.___Type_ofType(ctx, field, obj) - case "specifiedByURL": - out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) + out.Values[i] = ec.___EnumValue_description(ctx, field, obj) + case "isDeprecated": + out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -9130,385 +5073,271 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o return out } -// endregion **************************** object.gotpl **************************** +var __FieldImplementors = []string{"__Field"} -// region ***************************** type.gotpl ***************************** +func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) -func (ec *executionContext) marshalNActualAction2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualAction(ctx context.Context, sel ast.SelectionSet, v []*model.ActualAction) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Field") + case "name": + out.Values[i] = ec.___Field_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - ret[i] = ec.marshalOActualAction2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualAction(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - return ret -} - -func (ec *executionContext) marshalNActualDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualDestination(ctx context.Context, sel ast.SelectionSet, v []*model.ActualDestination) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() + case "description": + out.Values[i] = ec.___Field_description(ctx, field, obj) + case "args": + out.Values[i] = ec.___Field_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - ret[i] = ec.marshalOActualDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualDestination(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - return ret -} - -func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - res, err := graphql.UnmarshalBoolean(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { - res := graphql.MarshalBoolean(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - } - return res -} - -func (ec *executionContext) marshalNComputePlatform2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ComputePlatform) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() + case "type": + out.Values[i] = ec.___Field_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - ret[i] = ec.marshalNComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx context.Context, sel ast.SelectionSet, v *model.ComputePlatform) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") + case "isDeprecated": + out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } + } + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - return ec._ComputePlatform(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNComputePlatformType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformType(ctx context.Context, v interface{}) (model.ComputePlatformType, error) { - var res model.ComputePlatformType - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} -func (ec *executionContext) marshalNComputePlatformType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformType(ctx context.Context, sel ast.SelectionSet, v model.ComputePlatformType) graphql.Marshaler { - return v -} + atomic.AddInt32(&ec.deferred, int32(len(deferred))) -func (ec *executionContext) marshalNCondition2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐCondition(ctx context.Context, sel ast.SelectionSet, v *model.Condition) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) } - return ec._Condition(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNConditionStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionStatus(ctx context.Context, v interface{}) (model.ConditionStatus, error) { - var res model.ConditionStatus - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} -func (ec *executionContext) marshalNConditionStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionStatus(ctx context.Context, sel ast.SelectionSet, v model.ConditionStatus) graphql.Marshaler { - return v + return out } -func (ec *executionContext) unmarshalNDesiredActionInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredActionInput(ctx context.Context, v interface{}) (model.DesiredActionInput, error) { - res, err := ec.unmarshalInputDesiredActionInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} +var __InputValueImplementors = []string{"__InputValue"} -func (ec *executionContext) marshalNDesiredDestination2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx context.Context, sel ast.SelectionSet, v model.DesiredDestination) graphql.Marshaler { - return ec._DesiredDestination(ctx, sel, &v) -} +func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) -func (ec *executionContext) marshalNDesiredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx context.Context, sel ast.SelectionSet, v *model.DesiredDestination) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__InputValue") + case "name": + out.Values[i] = ec.___InputValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___InputValue_description(ctx, field, obj) + case "type": + out.Values[i] = ec.___InputValue_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "defaultValue": + out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } + } + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - return ec._DesiredDestination(ctx, sel, v) -} -func (ec *executionContext) unmarshalNDesiredDestinationFieldInput2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationFieldInputᚄ(ctx context.Context, v interface{}) ([]*model.DesiredDestinationFieldInput, error) { - var vSlice []interface{} - if v != nil { - vSlice = graphql.CoerceList(v) - } - var err error - res := make([]*model.DesiredDestinationFieldInput, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNDesiredDestinationFieldInput2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationFieldInput(ctx, vSlice[i]) - if err != nil { - return nil, err - } + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) } - return res, nil -} -func (ec *executionContext) unmarshalNDesiredDestinationFieldInput2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationFieldInput(ctx context.Context, v interface{}) (*model.DesiredDestinationFieldInput, error) { - res, err := ec.unmarshalInputDesiredDestinationFieldInput(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) + return out } -func (ec *executionContext) unmarshalNDesiredDestinationInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestinationInput(ctx context.Context, v interface{}) (model.DesiredDestinationInput, error) { - res, err := ec.unmarshalInputDesiredDestinationInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} +var __SchemaImplementors = []string{"__Schema"} -func (ec *executionContext) marshalNDestinationSpecField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationSpecFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.DestinationSpecField) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() +func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Schema") + case "description": + out.Values[i] = ec.___Schema_description(ctx, field, obj) + case "types": + out.Values[i] = ec.___Schema_types(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - ret[i] = ec.marshalNDestinationSpecField2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationSpecField(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) + case "queryType": + out.Values[i] = ec.___Schema_queryType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "mutationType": + out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) + case "subscriptionType": + out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) + case "directives": + out.Values[i] = ec.___Schema_directives(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) } - } - wg.Wait() + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) } - return ret + return out } -func (ec *executionContext) marshalNDestinationSpecField2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationSpecField(ctx context.Context, sel ast.SelectionSet, v *model.DestinationSpecField) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") +var __TypeImplementors = []string{"__Type"} + +func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Type") + case "kind": + out.Values[i] = ec.___Type_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec.___Type_name(ctx, field, obj) + case "description": + out.Values[i] = ec.___Type_description(ctx, field, obj) + case "fields": + out.Values[i] = ec.___Type_fields(ctx, field, obj) + case "interfaces": + out.Values[i] = ec.___Type_interfaces(ctx, field, obj) + case "possibleTypes": + out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) + case "enumValues": + out.Values[i] = ec.___Type_enumValues(ctx, field, obj) + case "inputFields": + out.Values[i] = ec.___Type_inputFields(ctx, field, obj) + case "ofType": + out.Values[i] = ec.___Type_ofType(ctx, field, obj) + case "specifiedByURL": + out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } + } + out.Dispatch(ctx) + if out.Invalids > 0 { return graphql.Null } - return ec._DestinationSpecField(ctx, sel, v) -} -func (ec *executionContext) marshalNDestinationType2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx context.Context, sel ast.SelectionSet, v []*model.DestinationType) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalODestinationType2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) } - wg.Wait() - return ret + return out } -func (ec *executionContext) marshalNDestinationType2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx context.Context, sel ast.SelectionSet, v *model.DestinationType) graphql.Marshaler { - if v == nil { +// endregion **************************** object.gotpl **************************** + +// region ***************************** type.gotpl ***************************** + +func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } - return graphql.Null } - return ec._DestinationType(ctx, sel, v) + return res } -func (ec *executionContext) marshalNDestinationTypeField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.DestinationTypeField) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNDestinationTypeField2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeField(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } +func (ec *executionContext) unmarshalNComputePlatformType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformType(ctx context.Context, v interface{}) (model.ComputePlatformType, error) { + var res model.ComputePlatformType + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} - return ret +func (ec *executionContext) marshalNComputePlatformType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatformType(ctx context.Context, sel ast.SelectionSet, v model.ComputePlatformType) graphql.Marshaler { + return v } -func (ec *executionContext) marshalNDestinationTypeField2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeField(ctx context.Context, sel ast.SelectionSet, v *model.DestinationTypeField) graphql.Marshaler { +func (ec *executionContext) marshalNCondition2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐCondition(ctx context.Context, sel ast.SelectionSet, v *model.Condition) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec._DestinationTypeField(ctx, sel, v) + return ec._Condition(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNConditionStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionStatus(ctx context.Context, v interface{}) (model.ConditionStatus, error) { + var res model.ConditionStatus + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNConditionStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionStatus(ctx context.Context, sel ast.SelectionSet, v model.ConditionStatus) graphql.Marshaler { + return v } func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { @@ -9526,6 +5355,16 @@ func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.Selec return res } +func (ec *executionContext) unmarshalNInstallationStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstallationStatus(ctx context.Context, v interface{}) (model.InstallationStatus, error) { + var res model.InstallationStatus + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNInstallationStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstallationStatus(ctx context.Context, sel ast.SelectionSet, v model.InstallationStatus) graphql.Marshaler { + return v +} + func (ec *executionContext) marshalNK8sActualNamespace2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx context.Context, sel ast.SelectionSet, v []*model.K8sActualNamespace) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup @@ -9607,16 +5446,6 @@ func (ec *executionContext) unmarshalNK8sDesiredNamespaceInput2githubᚗcomᚋod return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalNK8sDesiredSourceInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sDesiredSourceInput(ctx context.Context, v interface{}) (model.K8sDesiredSourceInput, error) { - res, err := ec.unmarshalInputK8sDesiredSourceInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNK8sNamespaceId2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sNamespaceID(ctx context.Context, v interface{}) (model.K8sNamespaceID, error) { - res, err := ec.unmarshalInputK8sNamespaceId(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - func (ec *executionContext) unmarshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx context.Context, v interface{}) (model.K8sResourceKind, error) { var res model.K8sResourceKind err := res.UnmarshalGQL(v) @@ -9627,11 +5456,6 @@ func (ec *executionContext) marshalNK8sResourceKind2githubᚗcomᚋodigosᚑio return v } -func (ec *executionContext) unmarshalNK8sSourceId2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sSourceID(ctx context.Context, v interface{}) (model.K8sSourceID, error) { - res, err := ec.unmarshalInputK8sSourceId(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - func (ec *executionContext) unmarshalNProgrammingLanguage2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐProgrammingLanguage(ctx context.Context, v interface{}) (model.ProgrammingLanguage, error) { var res model.ProgrammingLanguage err := res.UnmarshalGQL(v) @@ -9642,77 +5466,6 @@ func (ec *executionContext) marshalNProgrammingLanguage2githubᚗcomᚋodigosᚑ return v } -func (ec *executionContext) unmarshalNSignalType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalType(ctx context.Context, v interface{}) (model.SignalType, error) { - var res model.SignalType - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNSignalType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalType(ctx context.Context, sel ast.SelectionSet, v model.SignalType) graphql.Marshaler { - return v -} - -func (ec *executionContext) unmarshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx context.Context, v interface{}) ([]model.SignalType, error) { - var vSlice []interface{} - if v != nil { - vSlice = graphql.CoerceList(v) - } - var err error - res := make([]model.SignalType, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalNSignalType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalType(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil -} - -func (ec *executionContext) marshalNSignalType2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []model.SignalType) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNSignalType2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSignalType(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - func (ec *executionContext) marshalNSourceLanguage2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguage(ctx context.Context, sel ast.SelectionSet, v *model.SourceLanguage) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -9991,20 +5744,6 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a return res } -func (ec *executionContext) marshalOActualAction2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualAction(ctx context.Context, sel ast.SelectionSet, v *model.ActualAction) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._ActualAction(ctx, sel, v) -} - -func (ec *executionContext) marshalOActualDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐActualDestination(ctx context.Context, sel ast.SelectionSet, v *model.ActualDestination) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._ActualDestination(ctx, sel, v) -} - func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { res, err := graphql.UnmarshalBoolean(v) return res, graphql.ErrorOnPath(ctx, err) @@ -10085,107 +5824,11 @@ func (ec *executionContext) marshalOCondition2ᚕᚖgithubᚗcomᚋodigosᚑio return ret } -func (ec *executionContext) marshalODesiredDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx context.Context, sel ast.SelectionSet, v []*model.DesiredDestination) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalODesiredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - return ret -} - -func (ec *executionContext) marshalODesiredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDesiredDestination(ctx context.Context, sel ast.SelectionSet, v *model.DesiredDestination) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._DesiredDestination(ctx, sel, v) -} - -func (ec *executionContext) marshalODestinationType2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationType(ctx context.Context, sel ast.SelectionSet, v *model.DestinationType) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._DestinationType(ctx, sel, v) -} - -func (ec *executionContext) marshalODestinationTypeCategory2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeCategory(ctx context.Context, sel ast.SelectionSet, v []*model.DestinationTypeCategory) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalODestinationTypeCategory2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeCategory(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - return ret -} - -func (ec *executionContext) marshalODestinationTypeCategory2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypeCategory(ctx context.Context, sel ast.SelectionSet, v *model.DestinationTypeCategory) graphql.Marshaler { +func (ec *executionContext) marshalOGetConfigResponse2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐGetConfigResponse(ctx context.Context, sel ast.SelectionSet, v *model.GetConfigResponse) graphql.Marshaler { if v == nil { return graphql.Null } - return ec._DestinationTypeCategory(ctx, sel, v) + return ec._GetConfigResponse(ctx, sel, v) } func (ec *executionContext) marshalOInstrumentedApplicationDetails2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentedApplicationDetails(ctx context.Context, sel ast.SelectionSet, v *model.InstrumentedApplicationDetails) graphql.Marshaler { diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index 3bf3f4a72..53ab6b877 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -8,24 +8,6 @@ import ( "strconv" ) -type ActualAction struct { - ID string `json:"id"` - Kind string `json:"kind"` - Name *string `json:"name,omitempty"` - Notes *string `json:"notes,omitempty"` - Disable bool `json:"disable"` - Signals []SignalType `json:"signals"` - Details string `json:"details"` -} - -type ActualDestination struct { - ID string `json:"id"` - Name string `json:"name"` - Type *DestinationType `json:"type"` - ExportedSignals []SignalType `json:"exportedSignals"` - Fields []*DestinationSpecField `json:"fields"` -} - type ComputePlatform struct { ID string `json:"id"` Name *string `json:"name,omitempty"` @@ -34,8 +16,6 @@ type ComputePlatform struct { K8sActualNamespaces []*K8sActualNamespace `json:"k8sActualNamespaces"` K8sActualSource *K8sActualSource `json:"k8sActualSource,omitempty"` K8sActualSources []*K8sActualSource `json:"k8sActualSources"` - ActualDestinations []*ActualDestination `json:"actualDestinations"` - ActualActions []*ActualAction `json:"actualActions"` } type Condition struct { @@ -46,63 +26,8 @@ type Condition struct { Message *string `json:"message,omitempty"` } -type DesiredActionInput struct { - Kind string `json:"kind"` - Name *string `json:"name,omitempty"` - Notes *string `json:"notes,omitempty"` - Disable bool `json:"disable"` - Signals []SignalType `json:"signals"` - Details string `json:"details"` -} - -type DesiredDestination struct { - ID string `json:"id"` - Name string `json:"name"` - Type *DestinationType `json:"type"` - ExportSignals []SignalType `json:"exportSignals"` - Fields []*DestinationSpecField `json:"fields"` - ComputePlatforms []*ComputePlatform `json:"computePlatforms"` -} - -type DesiredDestinationFieldInput struct { - Name string `json:"name"` - Value string `json:"value"` -} - -type DesiredDestinationInput struct { - Name string `json:"name"` - ExportSignals []SignalType `json:"exportSignals"` - Fields []*DesiredDestinationFieldInput `json:"fields"` -} - -type DestinationSpecField struct { - Name string `json:"name"` - Value string `json:"value"` -} - -type DestinationType struct { - Category string `json:"category"` - Name string `json:"name"` - DisplayName string `json:"displayName"` - Image *string `json:"image,omitempty"` - SupportedSignals []SignalType `json:"supportedSignals"` - Fields []*DestinationTypeField `json:"fields"` -} - -type DestinationTypeCategory struct { - Name string `json:"name"` - DestinationTypes []*DestinationType `json:"destinationTypes"` -} - -type DestinationTypeField struct { - Name string `json:"name"` - DisplayName string `json:"displayName"` - VideoURL *string `json:"videoURL,omitempty"` - ThumbnailURL *string `json:"thumbnailURL,omitempty"` - ComponentType string `json:"componentType"` - ComponentProps string `json:"componentProps"` - Secret bool `json:"secret"` - InitialValue *string `json:"initialValue,omitempty"` +type GetConfigResponse struct { + Installation InstallationStatus `json:"installation"` } type InstrumentedApplicationDetails struct { @@ -167,12 +92,6 @@ type SourceLanguage struct { Language string `json:"language"` } -type WorkloadInput struct { - Kind K8sResourceKind `json:"kind"` - Name string `json:"name"` - Namespace string `json:"namespace"` -} - type ComputePlatformType string const ( @@ -257,6 +176,49 @@ func (e ConditionStatus) MarshalGQL(w io.Writer) { fmt.Fprint(w, strconv.Quote(e.String())) } +type InstallationStatus string + +const ( + InstallationStatusNew InstallationStatus = "NEW" + InstallationStatusAppsSelected InstallationStatus = "APPS_SELECTED" + InstallationStatusFinished InstallationStatus = "FINISHED" +) + +var AllInstallationStatus = []InstallationStatus{ + InstallationStatusNew, + InstallationStatusAppsSelected, + InstallationStatusFinished, +} + +func (e InstallationStatus) IsValid() bool { + switch e { + case InstallationStatusNew, InstallationStatusAppsSelected, InstallationStatusFinished: + return true + } + return false +} + +func (e InstallationStatus) String() string { + return string(e) +} + +func (e *InstallationStatus) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = InstallationStatus(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid InstallationStatus", str) + } + return nil +} + +func (e InstallationStatus) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + type K8sResourceKind string const ( diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index 1ec837b6c..06d2ebb47 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -38,6 +38,12 @@ enum SpanKind { Consumer } +enum InstallationStatus { + NEW + APPS_SELECTED + FINISHED +} + type SourceLanguage { containerName: String! language: String! @@ -59,7 +65,6 @@ type Condition { type K8sActualNamespace { name: String! autoInstrumented: Boolean - k8sActualSources: [K8sActualSource]! } @@ -101,71 +106,6 @@ input K8sSourceId { name: String! } -type DestinationSpecField { - name: String! - value: String! -} -type ActualDestination { - id: ID! - name: String! - type: DestinationType! - exportedSignals: [SignalType!]! - fields: [DestinationSpecField!]! -} -type DesiredDestination { - id: ID! - name: String! - type: DestinationType! - exportSignals: [SignalType!]! - fields: [DestinationSpecField!]! - - # compute platforms that include this destination - computePlatforms: [ComputePlatform!]! -} -input DesiredDestinationFieldInput { - name: String! - value: String! -} -input DesiredDestinationInput { - name: String! - exportSignals: [SignalType!]! - fields: [DesiredDestinationFieldInput!]! -} - -type DestinationTypeField { - name: String! - displayName: String! - videoURL: String - thumbnailURL: String - componentType: String! - # componentProps is JSON stringified data as text - componentProps: String! - secret: Boolean! - initialValue: String -} -type DestinationType { - # category is currently "managed" or "self hosted" - category: String! - # the name of the destination type (prometheus, jaeger, etc) - name: String! - # same destination type "name", but used for display (for example can contain spaces) - displayName: String! - - # name of an image file to be used for this destination type - # the image themselves are stored [here](https://s3.console.aws.amazon.com/s3/buckets/odigos-destinations) - image: String - - # the signals that this destination type supports - supportedSignals: [SignalType!]! - - fields: [DestinationTypeField!]! -} -type DestinationTypeCategory { - # the name of the category - name: String! - destinationTypes: [DestinationType]! -} - type ComputePlatform { id: ID! name: String @@ -181,84 +121,20 @@ type ComputePlatform { k8sActualSources: [K8sActualSource]! # destinations that are applied to this compute platform - actualDestinations: [ActualDestination]! - actualActions: [ActualAction]! -} - -# Define the input type for Workload -input WorkloadInput { - kind: K8sResourceKind! - name: String! - namespace: String! -} - -input DesiredActionInput { - kind: String! - name: String - notes: String - disable: Boolean! - signals: [SignalType!]! - details: String! } -type ActualAction { - id: ID! - kind: String! - name: String - notes: String - disable: Boolean! - signals: [SignalType!]! - details: String! +type GetConfigResponse { + installation: InstallationStatus! } type Query { computePlatform(cpId: ID!): ComputePlatform - destinationTypeCategories: [DestinationTypeCategory] - desiredDestinations: [DesiredDestination] + config: GetConfigResponse } type Mutation { - # desired namespace mutations - applyDesiredNamespace( - cpId: ID! - nsId: K8sNamespaceId! - ns: K8sDesiredNamespaceInput! - ): Boolean! - deleteDesiredNamespace(cpId: ID!, nsId: K8sNamespaceId!): Boolean! - - #k8s desired source mutations - applyDesiredSource( - cpId: ID! - sourceId: K8sSourceId! - source: K8sDesiredSourceInput! - ): Boolean! - deleteDesiredSource(cpId: ID!, sourceId: K8sSourceId!): Boolean! - - # desired destination mutations - createDesiredDestination( - destinationType: String! - destination: DesiredDestinationInput! - ): DesiredDestination! - updateDesiredDestination( - destinationId: ID! - destination: DesiredDestinationInput! - ): DesiredDestination! - deleteDesiredDestination(destinationId: ID!): Boolean! - applyDesiredDestinationToComputePlatform( - cpId: ID! - destinationId: ID! - ): Boolean! - removeDesiredDestinationFromComputePlatform( - cpId: ID! - destinationId: ID! - ): Boolean! - - # actions mutations - createDesiredAction(cpId: ID!, action: DesiredActionInput!): Boolean! - updateDesiredAction( + createK8sDesiredNamespace( cpId: ID! - actionId: String! - action: DesiredActionInput! - ): Boolean! - deleteActualAction(cpId: ID!, actionId: String!, kind: String!): Boolean! + namespace: K8sDesiredNamespaceInput! + ): K8sActualNamespace } diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index a744f7054..9a8ea6532 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -26,64 +26,9 @@ func (r *computePlatformResolver) K8sActualSource(ctx context.Context, obj *mode return k8sActualSource, nil } -// ApplyDesiredNamespace is the resolver for the applyDesiredNamespace field. -func (r *mutationResolver) ApplyDesiredNamespace(ctx context.Context, cpID string, nsID model.K8sNamespaceID, ns model.K8sDesiredNamespaceInput) (bool, error) { - panic(fmt.Errorf("not implemented: ApplyDesiredNamespace - applyDesiredNamespace")) -} - -// DeleteDesiredNamespace is the resolver for the deleteDesiredNamespace field. -func (r *mutationResolver) DeleteDesiredNamespace(ctx context.Context, cpID string, nsID model.K8sNamespaceID) (bool, error) { - panic(fmt.Errorf("not implemented: DeleteDesiredNamespace - deleteDesiredNamespace")) -} - -// ApplyDesiredSource is the resolver for the applyDesiredSource field. -func (r *mutationResolver) ApplyDesiredSource(ctx context.Context, cpID string, sourceID model.K8sSourceID, source model.K8sDesiredSourceInput) (bool, error) { - panic(fmt.Errorf("not implemented: ApplyDesiredSource - applyDesiredSource")) -} - -// DeleteDesiredSource is the resolver for the deleteDesiredSource field. -func (r *mutationResolver) DeleteDesiredSource(ctx context.Context, cpID string, sourceID model.K8sSourceID) (bool, error) { - panic(fmt.Errorf("not implemented: DeleteDesiredSource - deleteDesiredSource")) -} - -// CreateDesiredDestination is the resolver for the createDesiredDestination field. -func (r *mutationResolver) CreateDesiredDestination(ctx context.Context, destinationType string, destination model.DesiredDestinationInput) (*model.DesiredDestination, error) { - panic(fmt.Errorf("not implemented: CreateDesiredDestination - createDesiredDestination")) -} - -// UpdateDesiredDestination is the resolver for the updateDesiredDestination field. -func (r *mutationResolver) UpdateDesiredDestination(ctx context.Context, destinationID string, destination model.DesiredDestinationInput) (*model.DesiredDestination, error) { - panic(fmt.Errorf("not implemented: UpdateDesiredDestination - updateDesiredDestination")) -} - -// DeleteDesiredDestination is the resolver for the deleteDesiredDestination field. -func (r *mutationResolver) DeleteDesiredDestination(ctx context.Context, destinationID string) (bool, error) { - panic(fmt.Errorf("not implemented: DeleteDesiredDestination - deleteDesiredDestination")) -} - -// ApplyDesiredDestinationToComputePlatform is the resolver for the applyDesiredDestinationToComputePlatform field. -func (r *mutationResolver) ApplyDesiredDestinationToComputePlatform(ctx context.Context, cpID string, destinationID string) (bool, error) { - panic(fmt.Errorf("not implemented: ApplyDesiredDestinationToComputePlatform - applyDesiredDestinationToComputePlatform")) -} - -// RemoveDesiredDestinationFromComputePlatform is the resolver for the removeDesiredDestinationFromComputePlatform field. -func (r *mutationResolver) RemoveDesiredDestinationFromComputePlatform(ctx context.Context, cpID string, destinationID string) (bool, error) { - panic(fmt.Errorf("not implemented: RemoveDesiredDestinationFromComputePlatform - removeDesiredDestinationFromComputePlatform")) -} - -// CreateDesiredAction is the resolver for the createDesiredAction field. -func (r *mutationResolver) CreateDesiredAction(ctx context.Context, cpID string, action model.DesiredActionInput) (bool, error) { - panic(fmt.Errorf("not implemented: CreateDesiredAction - createDesiredAction")) -} - -// UpdateDesiredAction is the resolver for the updateDesiredAction field. -func (r *mutationResolver) UpdateDesiredAction(ctx context.Context, cpID string, actionID string, action model.DesiredActionInput) (bool, error) { - panic(fmt.Errorf("not implemented: UpdateDesiredAction - updateDesiredAction")) -} - -// DeleteActualAction is the resolver for the deleteActualAction field. -func (r *mutationResolver) DeleteActualAction(ctx context.Context, cpID string, actionID string, kind string) (bool, error) { - panic(fmt.Errorf("not implemented: DeleteActualAction - deleteActualAction")) +// CreateK8sDesiredNamespace is the resolver for the createK8sDesiredNamespace field. +func (r *mutationResolver) CreateK8sDesiredNamespace(ctx context.Context, cpID string, namespace model.K8sDesiredNamespaceInput) (*model.K8sActualNamespace, error) { + panic(fmt.Errorf("not implemented: CreateK8sDesiredNamespace - createK8sDesiredNamespace")) } // ComputePlatform is the resolver for the computePlatform field. @@ -99,14 +44,15 @@ func (r *queryResolver) ComputePlatform(ctx context.Context, cpID string) (*mode }, nil } -// DestinationTypeCategories is the resolver for the destinationTypeCategories field. -func (r *queryResolver) DestinationTypeCategories(ctx context.Context) ([]*model.DestinationTypeCategory, error) { - panic(fmt.Errorf("not implemented: DestinationTypeCategories - destinationTypeCategories")) -} +// Config is the resolver for the config field. +func (r *queryResolver) Config(ctx context.Context) (*model.GetConfigResponse, error) { + response := endpoints.GetConfig(ctx) + + gqlResponse := &model.GetConfigResponse{ + Installation: model.InstallationStatus(response.Installation), + } -// DesiredDestinations is the resolver for the desiredDestinations field. -func (r *queryResolver) DesiredDestinations(ctx context.Context) ([]*model.DesiredDestination, error) { - panic(fmt.Errorf("not implemented: DesiredDestinations - desiredDestinations")) + return gqlResponse, nil } // ComputePlatform returns ComputePlatformResolver implementation. @@ -121,20 +67,3 @@ func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } type computePlatformResolver struct{ *Resolver } type mutationResolver struct{ *Resolver } type queryResolver struct{ *Resolver } - -// !!! WARNING !!! -// The code below was going to be deleted when updating resolvers. It has been copied here so you have -// one last chance to move it out of harms way if you want. There are two reasons this happens: -// - When renaming or deleting a resolver the old code will be put in here. You can safely delete -// it when you're done. -// - You have helper methods in this file. Move them out to keep these resolver files clean. -func (r *computePlatformResolver) K8sActualSources(ctx context.Context, obj *model.ComputePlatform) ([]*model.K8sActualSource, error) { - // thinSource, err := endpoints.GetActualSource(ctx, *namespace, *kind, *name) - // if err != nil { - // return nil, err - // } - // k8sActualSource := k8sSourceToGql(thinSource) - - // return k8sActualSources, nil - return obj.K8sActualSources, nil -} diff --git a/frontend/main.go b/frontend/main.go index 3395f06ee..1a5adb3a1 100644 --- a/frontend/main.go +++ b/frontend/main.go @@ -112,7 +112,6 @@ func startHTTPServer(flags *Flags) (*gin.Engine, error) { apis.PATCH("/sources/namespace/:namespace/kind/:kind/name/:name", endpoints.PatchSource) apis.GET("/applications/:namespace", endpoints.GetApplicationsInNamespace) - apis.GET("/config", endpoints.GetConfig) apis.GET("/destination-types", endpoints.GetDestinationTypes) apis.GET("/destination-types/:type", endpoints.GetDestinationTypeDetails) apis.GET("/destinations", func(c *gin.Context) { endpoints.GetDestinations(c, flags.Namespace) }) From d72cd01764fbc22a7c060fddd9f132ebe33fba57 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 24 Jul 2024 15:46:33 +0300 Subject: [PATCH 099/374] chore: init new setup --- frontend/webapp/app/globals.css | 4 ++ frontend/webapp/app/layout.tsx | 18 ++--- .../webapp/app/setup/choose-sources/page.tsx | 45 ++++++++++++ frontend/webapp/app/setup/layout.tsx | 16 +++++ .../components/setup/headers/header/index.tsx | 68 +++++++++++++++++++ .../webapp/components/setup/headers/index.tsx | 1 + frontend/webapp/public/brand/odigos-icon.svg | 6 ++ .../public/brand/transparent-logo-black.svg | 19 ++++++ .../public/brand/transparent-logo-white.svg | 19 ++++++ frontend/webapp/reuseable-components/index.ts | 1 + .../reuseable-components/text/index.tsx | 40 +++++++++++ .../webapp/styles/{palette.tsx => palette.ts} | 9 ++- frontend/webapp/styles/theme.ts | 39 +++++++++++ 13 files changed, 273 insertions(+), 12 deletions(-) create mode 100644 frontend/webapp/app/globals.css create mode 100644 frontend/webapp/app/setup/choose-sources/page.tsx create mode 100644 frontend/webapp/app/setup/layout.tsx create mode 100644 frontend/webapp/components/setup/headers/header/index.tsx create mode 100644 frontend/webapp/public/brand/odigos-icon.svg create mode 100644 frontend/webapp/public/brand/transparent-logo-black.svg create mode 100644 frontend/webapp/public/brand/transparent-logo-white.svg create mode 100644 frontend/webapp/reuseable-components/index.ts create mode 100644 frontend/webapp/reuseable-components/text/index.tsx rename frontend/webapp/styles/{palette.tsx => palette.ts} (86%) create mode 100644 frontend/webapp/styles/theme.ts diff --git a/frontend/webapp/app/globals.css b/frontend/webapp/app/globals.css new file mode 100644 index 000000000..27185356f --- /dev/null +++ b/frontend/webapp/app/globals.css @@ -0,0 +1,4 @@ +/* Preload key fonts in your global CSS */ +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=Kode+Mono:wght@400;700&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;700&display=swap'); diff --git a/frontend/webapp/app/layout.tsx b/frontend/webapp/app/layout.tsx index e36316b12..9a7036926 100644 --- a/frontend/webapp/app/layout.tsx +++ b/frontend/webapp/app/layout.tsx @@ -1,13 +1,14 @@ 'use client'; +import './globals.css'; import React from 'react'; import { useSSE } from '@/hooks'; -import theme from '@/styles/palette'; +import theme from '@/styles/theme'; +import { ApolloWrapper } from '@/lib'; import { ThemeProvider } from 'styled-components'; import { NotificationManager } from '@/components'; import ReduxProvider from '@/store/redux-provider'; import { QueryClient, QueryClientProvider } from 'react-query'; import { ThemeProviderWrapper } from '@keyval-dev/design-system'; -import { ApolloWrapper } from '@/lib'; const LAYOUT_STYLE: React.CSSProperties = { margin: 0, @@ -15,7 +16,6 @@ const LAYOUT_STYLE: React.CSSProperties = { scrollbarWidth: 'none', width: '100vw', height: '100vh', - backgroundColor: theme.colors.dark, }; export default function RootLayout({ @@ -40,12 +40,12 @@ export default function RootLayout({ - - - {children} - - - + {/* */} + + {children} + + + {/* */} diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx new file mode 100644 index 000000000..933dfb802 --- /dev/null +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -0,0 +1,45 @@ +'use client'; +import React from 'react'; + +import { useSuspenseQuery, gql } from '@apollo/client'; + +const GET_COMPUTE_PLATFORM = gql` + query GetComputePlatform($cpId: ID!) { + computePlatform(cpId: $cpId) { + id + name + computePlatformType + k8sActualSources { + namespace + kind + name + serviceName + autoInstrumented + creationTimestamp + numberOfInstances + hasInstrumentedApplication + instrumentedApplicationDetails { + languages { + containerName + language + } + conditions { + type + status + lastTransitionTime + reason + message + } + } + } + } + } +`; + +export default function ChooseSourcesPage() { + const { error, data } = useSuspenseQuery(GET_COMPUTE_PLATFORM, { + variables: { cpId: '1' }, + }); + + return <>; +} diff --git a/frontend/webapp/app/setup/layout.tsx b/frontend/webapp/app/setup/layout.tsx new file mode 100644 index 000000000..2aaf15e78 --- /dev/null +++ b/frontend/webapp/app/setup/layout.tsx @@ -0,0 +1,16 @@ +'use client'; +import React from 'react'; +import { SetupHeader } from '@/components'; + +export default function SetupLayout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + + {children} + + ); +} diff --git a/frontend/webapp/components/setup/headers/header/index.tsx b/frontend/webapp/components/setup/headers/header/index.tsx new file mode 100644 index 000000000..3e5be0249 --- /dev/null +++ b/frontend/webapp/components/setup/headers/header/index.tsx @@ -0,0 +1,68 @@ +import { Text } from '@/reuseable-components'; +import Image from 'next/image'; +import React from 'react'; +import styled from 'styled-components'; + +interface SetupHeaderProps { + onBack?: () => void; + onNext?: () => void; +} + +const HeaderContainer = styled.div` + display: flex; + justify-content: space-between; + padding: 0 24px 0 32px; + align-items: center; + background-color: ${({ theme }) => theme.colors.dark_grey}; + border-bottom: 1px solid rgba(249, 249, 249, 0.16); + height: 80px; +`; + +const Title = styled(Text)``; + +const Logo = styled.div` + display: flex; + align-items: center; + font-size: 1.2em; +`; + +const NavigationButtons = styled.div` + display: flex; + align-items: center; +`; + +const Button = styled.button` + background-color: #333; + border: none; + color: #fff; + padding: 5px 10px; + margin: 0 5px; + display: flex; + align-items: center; + cursor: pointer; + font-size: 1em; + + &:hover { + background-color: #444; + } +`; + +export const SetupHeader: React.FC = ({ onBack, onNext }) => { + return ( + + + logo + + START WITH ODIGOS + + + + + + ); +}; diff --git a/frontend/webapp/components/setup/headers/index.tsx b/frontend/webapp/components/setup/headers/index.tsx index fc5486a21..ce9c51325 100644 --- a/frontend/webapp/components/setup/headers/index.tsx +++ b/frontend/webapp/components/setup/headers/index.tsx @@ -2,3 +2,4 @@ export * from './choose-destination-header'; export * from './choose-sources-header'; export * from './connect-destination-header'; export * from './back-button'; +export * from './header'; diff --git a/frontend/webapp/public/brand/odigos-icon.svg b/frontend/webapp/public/brand/odigos-icon.svg new file mode 100644 index 000000000..9247584f3 --- /dev/null +++ b/frontend/webapp/public/brand/odigos-icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/frontend/webapp/public/brand/transparent-logo-black.svg b/frontend/webapp/public/brand/transparent-logo-black.svg new file mode 100644 index 000000000..5aeff3c50 --- /dev/null +++ b/frontend/webapp/public/brand/transparent-logo-black.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/frontend/webapp/public/brand/transparent-logo-white.svg b/frontend/webapp/public/brand/transparent-logo-white.svg new file mode 100644 index 000000000..9c91b04ac --- /dev/null +++ b/frontend/webapp/public/brand/transparent-logo-white.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts new file mode 100644 index 000000000..1a9ac1460 --- /dev/null +++ b/frontend/webapp/reuseable-components/index.ts @@ -0,0 +1 @@ +export * from './text'; diff --git a/frontend/webapp/reuseable-components/text/index.tsx b/frontend/webapp/reuseable-components/text/index.tsx new file mode 100644 index 000000000..0cc8c08c6 --- /dev/null +++ b/frontend/webapp/reuseable-components/text/index.tsx @@ -0,0 +1,40 @@ +import React from 'react'; +import styled from 'styled-components'; + +interface TextProps { + children: React.ReactNode; + color?: string; + size?: number; + weight?: number; + align?: 'left' | 'center' | 'right'; +} + +const TextWrapper = styled.span<{ + color?: string; + size: number; + weight: number; + align: 'left' | 'center' | 'right'; +}>` + color: ${({ color, theme }) => + color || console.log({ theme }) || theme.colors.text}; + font-size: ${({ size }) => size}px; + font-weight: ${({ weight }) => weight}; + text-align: ${({ align }) => align}; + font-family: ${({ theme }) => theme.font_family.primary}; +`; + +const Text: React.FC = ({ + children, + color, + size = 16, + weight = 400, + align = 'left', +}) => { + return ( + + {children} + + ); +}; + +export { Text }; diff --git a/frontend/webapp/styles/palette.tsx b/frontend/webapp/styles/palette.ts similarity index 86% rename from frontend/webapp/styles/palette.tsx rename to frontend/webapp/styles/palette.ts index 4df30fcb8..006a9a0cf 100644 --- a/frontend/webapp/styles/palette.tsx +++ b/frontend/webapp/styles/palette.ts @@ -2,8 +2,11 @@ import { DefaultTheme } from 'styled-components'; // Define your color palette const colors = { - primary: '#07111A', - secondary: '#0EE6F3', + primary: '#111', + secondary: '#F9F9F9', + dark_grey: '#151515', + text: '#F9F9F9', + torquiz_light: '#96F2FF', dark: '#07111A', light_dark: '#132330', @@ -26,7 +29,7 @@ const text = { }; const font_family = { - primary: 'Inter, sans-serif', + primary: 'Kode Mono, sans-serif', }; // Define the theme interface diff --git a/frontend/webapp/styles/theme.ts b/frontend/webapp/styles/theme.ts new file mode 100644 index 000000000..9b44c56c1 --- /dev/null +++ b/frontend/webapp/styles/theme.ts @@ -0,0 +1,39 @@ +import { DefaultTheme } from 'styled-components'; + +// Define your color palette +const colors = { + primary: '#111', + secondary: '#F9F9F9', + dark_grey: '#151515', + text: '#F9F9F9', +}; + +const text = { + primary: '#07111A', + secondary: '#0EE6F3', + white: '#fff', + light_grey: '#CCD0D2', + grey: '#8b92a5', + dark_button: '#0A1824', +}; + +const font_family = { + primary: 'Kode Mono, sans-serif', +}; + +// Define the theme interface +interface ThemeInterface extends DefaultTheme { + colors: typeof colors; + text: typeof text; + font_family: typeof font_family; +} + +// Create your theme object +const theme: ThemeInterface = { + colors, + text, + font_family, +}; + +// Export the theme +export default theme; From 36d31336d382f5307d3e30a43ca313d19a39a0b3 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 24 Jul 2024 16:44:43 +0300 Subject: [PATCH 100/374] chore: setup header --- .../components/setup/headers/header/index.tsx | 48 ++++++----- .../public/icons/common/arrow-black.svg | 8 ++ .../public/icons/common/arrow-white.svg | 8 ++ frontend/webapp/public/icons/common/index.ts | 3 + frontend/webapp/public/icons/index.ts | 1 + .../reuseable-components/button/index.tsx | 80 +++++++++++++++++++ frontend/webapp/reuseable-components/index.ts | 1 + 7 files changed, 131 insertions(+), 18 deletions(-) create mode 100644 frontend/webapp/public/icons/common/arrow-black.svg create mode 100644 frontend/webapp/public/icons/common/arrow-white.svg create mode 100644 frontend/webapp/public/icons/common/index.ts create mode 100644 frontend/webapp/public/icons/index.ts create mode 100644 frontend/webapp/reuseable-components/button/index.tsx diff --git a/frontend/webapp/components/setup/headers/header/index.tsx b/frontend/webapp/components/setup/headers/header/index.tsx index 3e5be0249..2d6943029 100644 --- a/frontend/webapp/components/setup/headers/header/index.tsx +++ b/frontend/webapp/components/setup/headers/header/index.tsx @@ -1,4 +1,5 @@ -import { Text } from '@/reuseable-components'; +import { Button, Text } from '@/reuseable-components'; +import theme from '@/styles/theme'; import Image from 'next/image'; import React from 'react'; import styled from 'styled-components'; @@ -20,31 +21,22 @@ const HeaderContainer = styled.div` const Title = styled(Text)``; -const Logo = styled.div` +const HeaderButton = styled(Button)` display: flex; align-items: center; - font-size: 1.2em; + gap: 8px; `; -const NavigationButtons = styled.div` +const Logo = styled.div` display: flex; align-items: center; + font-size: 1.2em; `; -const Button = styled.button` - background-color: #333; - border: none; - color: #fff; - padding: 5px 10px; - margin: 0 5px; +const NavigationButtons = styled.div` display: flex; + gap: 8px; align-items: center; - cursor: pointer; - font-size: 1em; - - &:hover { - background-color: #444; - } `; export const SetupHeader: React.FC = ({ onBack, onNext }) => { @@ -60,8 +52,28 @@ export const SetupHeader: React.FC = ({ onBack, onNext }) => { START WITH ODIGOS - - + + back + + BACK + + + + + NEXT + + next + ); diff --git a/frontend/webapp/public/icons/common/arrow-black.svg b/frontend/webapp/public/icons/common/arrow-black.svg new file mode 100644 index 000000000..edc77a1d2 --- /dev/null +++ b/frontend/webapp/public/icons/common/arrow-black.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/webapp/public/icons/common/arrow-white.svg b/frontend/webapp/public/icons/common/arrow-white.svg new file mode 100644 index 000000000..d230cf243 --- /dev/null +++ b/frontend/webapp/public/icons/common/arrow-white.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/frontend/webapp/public/icons/common/index.ts b/frontend/webapp/public/icons/common/index.ts new file mode 100644 index 000000000..b80e515df --- /dev/null +++ b/frontend/webapp/public/icons/common/index.ts @@ -0,0 +1,3 @@ +import ArrowBlack from './arrow.svg'; +import ArrowWhite from './arrow-white.svg'; +export { ArrowBlack, ArrowWhite }; diff --git a/frontend/webapp/public/icons/index.ts b/frontend/webapp/public/icons/index.ts new file mode 100644 index 000000000..d0b932366 --- /dev/null +++ b/frontend/webapp/public/icons/index.ts @@ -0,0 +1 @@ +export * from './common'; diff --git a/frontend/webapp/reuseable-components/button/index.tsx b/frontend/webapp/reuseable-components/button/index.tsx new file mode 100644 index 000000000..9ef4562a9 --- /dev/null +++ b/frontend/webapp/reuseable-components/button/index.tsx @@ -0,0 +1,80 @@ +import React, { ButtonHTMLAttributes } from 'react'; +import styled, { css } from 'styled-components'; + +interface ButtonProps extends ButtonHTMLAttributes { + variant?: 'primary' | 'secondary' | 'tertiary'; + isDisabled?: boolean; +} + +const variantStyles = { + primary: css` + border-radius: 32px; + border: 1px solid rgba(249, 249, 249, 0.24); + background: rgba(249, 249, 249, 0.8); + height: 36px; + padding: 8px 14px 8px 16px; + + &:hover { + background: rgba(249, 249, 249, 0.6); + } + &:active { + background: rgba(249, 249, 249, 0.5); + } + `, + secondary: css` + background: #151515; + border: 1px solid rgba(249, 249, 249, 0.24); + border-radius: 32px; + &:hover { + background: #151515bc; + } + &:active { + background: #1515158d; + } + `, + tertiary: css` + background-color: transparent; + border-radius: 32px; + border: 2px solid rgba(249, 249, 249, 0.8); + &:hover { + background-color: #eaeaea; + } + &:active { + background-color: #ccc; + } + `, +}; + +const StyledButton = styled.button` + padding: 10px 20px; + border: none; + border-radius: 5px; + cursor: pointer; + transition: background-color 0.3s ease; + + ${({ variant }) => variant && variantStyles[variant]} + ${({ isDisabled }) => + isDisabled && + css` + background-color: #eaeaea; + color: #888; + cursor: not-allowed; + &:hover, + &:active { + background-color: #eaeaea; + } + `} +`; + +export const Button: React.FC = ({ + children, + variant = 'primary', + isDisabled = false, + ...props +}) => { + return ( + + {children} + + ); +}; diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts index 1a9ac1460..c912adb8d 100644 --- a/frontend/webapp/reuseable-components/index.ts +++ b/frontend/webapp/reuseable-components/index.ts @@ -1 +1,2 @@ export * from './text'; +export * from './button'; From 071406d15dae38802adf39af5734ddc558f77dae Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 24 Jul 2024 17:35:48 +0300 Subject: [PATCH 101/374] chore: setup side menu --- frontend/webapp/app/setup/layout.tsx | 44 ++++++- frontend/webapp/components/setup/index.tsx | 1 + .../webapp/components/setup/menu/index.tsx | 124 ++++++++++++++++++ frontend/webapp/public/icons/common/check.svg | 3 + .../reuseable-components/text/index.tsx | 21 ++- frontend/webapp/styles/theme.ts | 1 + 6 files changed, 187 insertions(+), 7 deletions(-) create mode 100644 frontend/webapp/components/setup/menu/index.tsx create mode 100644 frontend/webapp/public/icons/common/check.svg diff --git a/frontend/webapp/app/setup/layout.tsx b/frontend/webapp/app/setup/layout.tsx index 2aaf15e78..4462ddad2 100644 --- a/frontend/webapp/app/setup/layout.tsx +++ b/frontend/webapp/app/setup/layout.tsx @@ -1,6 +1,31 @@ 'use client'; import React from 'react'; -import { SetupHeader } from '@/components'; +import styled from 'styled-components'; +import { SetupHeader, SideMenu } from '@/components'; + +const LayoutContainer = styled.div` + width: 100%; + height: 100vh; + background-color: ${({ theme }) => theme.colors.primary}; + display: flex; + align-items: center; + flex-direction: column; +`; + +const SideMenuWrapper = styled.div` + position: absolute; + left: 24px; + top: 144px; +`; + +const MainContent = styled.div` + display: flex; + max-width: 1440px; + width: 100%; + background-color: ${({ theme }) => theme.colors.secondary}; + flex-direction: column; + align-items: center; +`; export default function SetupLayout({ children, @@ -8,9 +33,18 @@ export default function SetupLayout({ children: React.ReactNode; }) { return ( - <> - - {children} - + +
+ +
+ + + + + + + {children} + +
); } diff --git a/frontend/webapp/components/setup/index.tsx b/frontend/webapp/components/setup/index.tsx index e2f355a8b..b45b6ee9c 100644 --- a/frontend/webapp/components/setup/index.tsx +++ b/frontend/webapp/components/setup/index.tsx @@ -6,3 +6,4 @@ export { ConnectionsIcons } from './connection/connections_icons/connections_ico export { CreateConnectionForm } from './connection/create.connection.form/create.connection.form'; export { QuickHelp } from './connection/quick.help/quick.help'; export * from './headers'; +export * from './menu'; diff --git a/frontend/webapp/components/setup/menu/index.tsx b/frontend/webapp/components/setup/menu/index.tsx new file mode 100644 index 000000000..aa217815e --- /dev/null +++ b/frontend/webapp/components/setup/menu/index.tsx @@ -0,0 +1,124 @@ +import { Text } from '@/reuseable-components'; +import Image from 'next/image'; +import React from 'react'; +import styled, { css } from 'styled-components'; + +interface StepProps { + title: string; + subtitle?: string; + state: 'finish' | 'active' | 'disabled'; + stepNumber: number; +} + +const Container = styled.div` + display: flex; + flex-direction: column; + gap: 32px; +`; + +const Step = styled.div<{ state: 'finish' | 'active' | 'disabled' }>` + display: flex; + gap: 16px; + padding: 10px 0; + cursor: ${({ state }) => (state === 'disabled' ? 'not-allowed' : 'pointer')}; + opacity: ${({ state }) => (state === 'disabled' ? 0.5 : 1)}; + + transition: opacity 0.3s; + + ${({ state }) => state === 'active' && css``} + + & + & { + margin-top: 10px; + } +`; + +const IconWrapper = styled.div<{ state: 'finish' | 'active' | 'disabled' }>` + margin-right: 10px; + border-radius: 32px; + width: 24px; + height: 24px; + border: 1px solid #f9f9f9; + display: flex; + justify-content: center; + align-items: center; + + ${({ state }) => + state === 'finish' + ? css` + opacity: 0.8; + ` + : state === 'disabled' && + css` + border: 1px dashed rgba(249, 249, 249, 0.4); + `} +`; + +const StepContent = styled.div` + display: flex; + justify-content: center; + flex-direction: column; + gap: 8px; +`; + +const StepTitle = styled(Text)` + font-size: 16px; + font-weight: bold; +`; + +const StepSubtitle = styled(Text)``; + +const SideMenu: React.FC = () => { + const steps: StepProps[] = [ + { + title: 'INSTALLATION', + subtitle: 'Success', + state: 'finish', + stepNumber: 1, + }, + { + title: 'SOURCES', + state: 'active', + stepNumber: 2, + }, + { + title: 'DESTINATIONS', + state: 'disabled', + stepNumber: 3, + }, + ]; + + return ( + + {steps.map((step, index) => ( + + + {step.state === 'finish' && ( + {''} + )} + {step.state === 'active' && ( + {step.stepNumber} + )} + {step.state === 'disabled' && ( + {step.stepNumber} + )} + + + {step.title} + {step.subtitle && ( + + {step.subtitle} + + )} + + + ))} + + ); +}; + +export { SideMenu }; diff --git a/frontend/webapp/public/icons/common/check.svg b/frontend/webapp/public/icons/common/check.svg new file mode 100644 index 000000000..6ee9b2be2 --- /dev/null +++ b/frontend/webapp/public/icons/common/check.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/webapp/reuseable-components/text/index.tsx b/frontend/webapp/reuseable-components/text/index.tsx index 0cc8c08c6..75fbc78b6 100644 --- a/frontend/webapp/reuseable-components/text/index.tsx +++ b/frontend/webapp/reuseable-components/text/index.tsx @@ -7,6 +7,7 @@ interface TextProps { size?: number; weight?: number; align?: 'left' | 'center' | 'right'; + family?: 'primary' | 'secondary'; } const TextWrapper = styled.span<{ @@ -14,13 +15,22 @@ const TextWrapper = styled.span<{ size: number; weight: number; align: 'left' | 'center' | 'right'; + family?: 'primary' | 'secondary'; }>` color: ${({ color, theme }) => color || console.log({ theme }) || theme.colors.text}; font-size: ${({ size }) => size}px; font-weight: ${({ weight }) => weight}; text-align: ${({ align }) => align}; - font-family: ${({ theme }) => theme.font_family.primary}; + font-family: ${({ theme, family }) => { + if (family === 'primary') { + return theme.font_family.primary; + } + if (family === 'secondary') { + return theme.font_family.secondary; + } + return theme.font_family.primary; + }}; `; const Text: React.FC = ({ @@ -29,9 +39,16 @@ const Text: React.FC = ({ size = 16, weight = 400, align = 'left', + family = 'primary', }) => { return ( - + {children} ); diff --git a/frontend/webapp/styles/theme.ts b/frontend/webapp/styles/theme.ts index 9b44c56c1..6789e96cf 100644 --- a/frontend/webapp/styles/theme.ts +++ b/frontend/webapp/styles/theme.ts @@ -19,6 +19,7 @@ const text = { const font_family = { primary: 'Kode Mono, sans-serif', + secondary: 'Inter, sans-serif', }; // Define the theme interface From 09c9c241059968ccd9d0dab1b04a460e47caa697 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 24 Jul 2024 17:40:32 +0300 Subject: [PATCH 102/374] chore: fixed pr comments" " --- frontend/webapp/app/setup/layout.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/webapp/app/setup/layout.tsx b/frontend/webapp/app/setup/layout.tsx index 4462ddad2..f3afba447 100644 --- a/frontend/webapp/app/setup/layout.tsx +++ b/frontend/webapp/app/setup/layout.tsx @@ -18,6 +18,10 @@ const SideMenuWrapper = styled.div` top: 144px; `; +const HeaderWrapper = styled.div` + width: 100vw; +`; + const MainContent = styled.div` display: flex; max-width: 1440px; @@ -34,9 +38,9 @@ export default function SetupLayout({ }) { return ( -
+ -
+ From c2db8648b5f20b0819135556bfed6628e60203b3 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 25 Jul 2024 11:29:10 +0300 Subject: [PATCH 103/374] chore: init setup sources components --- .../webapp/app/setup/choose-sources/page.tsx | 17 +- frontend/webapp/app/setup/layout.tsx | 7 +- .../webapp/components/setup/menu/index.tsx | 4 +- frontend/webapp/public/icons/common/info.svg | 3 + .../webapp/public/icons/common/search.svg | 3 + frontend/webapp/reuseable-components/index.ts | 2 + .../reuseable-components/input/index.tsx | 184 ++++++++++++++++++ .../section-title/index.tsx | 57 ++++++ .../reuseable-components/text/index.tsx | 8 +- .../reuseable-components/tooltip/index.tsx | 69 +++++++ frontend/webapp/styles/theme.ts | 4 +- 11 files changed, 345 insertions(+), 13 deletions(-) create mode 100644 frontend/webapp/public/icons/common/info.svg create mode 100644 frontend/webapp/public/icons/common/search.svg create mode 100644 frontend/webapp/reuseable-components/input/index.tsx create mode 100644 frontend/webapp/reuseable-components/section-title/index.tsx create mode 100644 frontend/webapp/reuseable-components/tooltip/index.tsx diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx index 933dfb802..cca8a2243 100644 --- a/frontend/webapp/app/setup/choose-sources/page.tsx +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { useSuspenseQuery, gql } from '@apollo/client'; +import { Input, SectionTitle } from '@/reuseable-components'; const GET_COMPUTE_PLATFORM = gql` query GetComputePlatform($cpId: ID!) { @@ -41,5 +42,19 @@ export default function ChooseSourcesPage() { variables: { cpId: '1' }, }); - return <>; + return ( +
+ + +
+ ); } diff --git a/frontend/webapp/app/setup/layout.tsx b/frontend/webapp/app/setup/layout.tsx index f3afba447..d03aa3117 100644 --- a/frontend/webapp/app/setup/layout.tsx +++ b/frontend/webapp/app/setup/layout.tsx @@ -26,7 +26,6 @@ const MainContent = styled.div` display: flex; max-width: 1440px; width: 100%; - background-color: ${({ theme }) => theme.colors.secondary}; flex-direction: column; align-items: center; `; @@ -44,11 +43,7 @@ export default function SetupLayout({ - - - - {children} - + {children}
); } diff --git a/frontend/webapp/components/setup/menu/index.tsx b/frontend/webapp/components/setup/menu/index.tsx index aa217815e..08e1716f5 100644 --- a/frontend/webapp/components/setup/menu/index.tsx +++ b/frontend/webapp/components/setup/menu/index.tsx @@ -108,9 +108,9 @@ const SideMenu: React.FC = () => { )} - {step.title} + {step.title} {step.subtitle && ( - + {step.subtitle} )} diff --git a/frontend/webapp/public/icons/common/info.svg b/frontend/webapp/public/icons/common/info.svg new file mode 100644 index 000000000..02127d33b --- /dev/null +++ b/frontend/webapp/public/icons/common/info.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/webapp/public/icons/common/search.svg b/frontend/webapp/public/icons/common/search.svg new file mode 100644 index 000000000..a278da695 --- /dev/null +++ b/frontend/webapp/public/icons/common/search.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts index c912adb8d..b95b1445a 100644 --- a/frontend/webapp/reuseable-components/index.ts +++ b/frontend/webapp/reuseable-components/index.ts @@ -1,2 +1,4 @@ export * from './text'; export * from './button'; +export * from './section-title'; +export * from './input'; diff --git a/frontend/webapp/reuseable-components/input/index.tsx b/frontend/webapp/reuseable-components/input/index.tsx new file mode 100644 index 000000000..a1b04c5bc --- /dev/null +++ b/frontend/webapp/reuseable-components/input/index.tsx @@ -0,0 +1,184 @@ +import Image from 'next/image'; +import React from 'react'; +import styled, { css } from 'styled-components'; +import { Text } from '../text'; +import { Tooltip } from '../tooltip'; + +interface InputProps extends React.InputHTMLAttributes { + icon?: string; + buttonLabel?: string; + onButtonClick?: () => void; + errorMessage?: string; + title?: string; + tooltip?: string; +} + +const Container = styled.div` + display: flex; + flex-direction: column; + position: relative; + width: 100%; +`; + +const InputWrapper = styled.div<{ + isDisabled?: boolean; + hasError?: boolean; + isActive?: boolean; +}>` + width: 100%; + display: flex; + align-items: center; + height: 36px; + gap: 12px; + padding: 0 12px; + transition: border-color 0.3s; + border-radius: 32px; + border: 1px solid rgba(249, 249, 249, 0.24); + ${({ isDisabled }) => + isDisabled && + css` + background-color: #555; + cursor: not-allowed; + opacity: 0.6; + `} + + ${({ hasError }) => + hasError && + css` + border-color: red; + `} + + ${({ isActive }) => + isActive && + css` + border-color: ${({ theme }) => theme.colors.secondary}; + `} + + &:hover { + border-color: ${({ theme }) => theme.colors.secondary}; + } + &:focus-within { + border-color: ${({ theme }) => theme.colors.secondary}; + } +`; + +const StyledInput = styled.input` + flex: 1; + border: none; + outline: none; + background: none; + color: ${({ theme }) => theme.colors.text}; + font-size: 14px; + + &::placeholder { + color: ${({ theme }) => theme.colors.text}; + font-family: ${({ theme }) => theme.font_family.primary}; + opacity: 0.4; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 22px; /* 157.143% */ + } + + &:disabled { + background-color: #555; + cursor: not-allowed; + } +`; + +const IconWrapper = styled.div` + display: flex; + align-items: center; +`; + +const Button = styled.button` + background-color: ${({ theme }) => theme.colors.primary}; + border: none; + color: #fff; + padding: 8px 16px; + border-radius: 20px; + cursor: pointer; + margin-left: 8px; + + &:hover { + background-color: ${({ theme }) => theme.colors.secondary}; + } + + &:disabled { + background-color: #555; + cursor: not-allowed; + } +`; + +const ErrorWrapper = styled.div` + position: relative; +`; + +const ErrorMessage = styled(Text)` + color: red; + font-size: 12px; + position: absolute; + top: 100%; + left: 0; + margin-top: 4px; +`; + +const Title = styled(Text)` + font-size: 16px; + font-weight: bold; + margin-bottom: 4px; +`; + +const HeaderWrapper = styled.div` + display: flex; + align-items: center; + gap: 6px; +`; + +const Input: React.FC = ({ + icon, + buttonLabel, + onButtonClick, + errorMessage, + title, + tooltip, + ...props +}) => { + return ( + + + + {title} + {tooltip && ( + + )} + + + + + {icon && ( + + + + )} + + {buttonLabel && onButtonClick && ( + + )} + + {errorMessage && ( + + {errorMessage} + + )} + + ); +}; + +export { Input }; diff --git a/frontend/webapp/reuseable-components/section-title/index.tsx b/frontend/webapp/reuseable-components/section-title/index.tsx new file mode 100644 index 000000000..01b9d2e08 --- /dev/null +++ b/frontend/webapp/reuseable-components/section-title/index.tsx @@ -0,0 +1,57 @@ +import React from 'react'; +import { Text } from '../text'; +import { Button } from '../button'; +import styled from 'styled-components'; + +interface SectionTitleProps { + title: string; + description: string; + buttonText?: string; + onButtonClick?: () => void; +} + +const Container = styled.div` + display: flex; + justify-content: space-between; + align-items: center; + gap: 16px; +`; + +const TitleContainer = styled.div` + display: flex; + flex-direction: column; + gap: 4px; +`; + +const Title = styled(Text)``; + +const Description = styled(Text)``; + +const ActionButton = styled(Button)``; + +const SectionTitle: React.FC = ({ + title, + description, + buttonText, + onButtonClick, +}) => { + return ( + + + + {title} + + + {description} + + + {buttonText && onButtonClick && ( + + {buttonText} + + )} + + ); +}; + +export { SectionTitle }; diff --git a/frontend/webapp/reuseable-components/text/index.tsx b/frontend/webapp/reuseable-components/text/index.tsx index 75fbc78b6..71e8afc9d 100644 --- a/frontend/webapp/reuseable-components/text/index.tsx +++ b/frontend/webapp/reuseable-components/text/index.tsx @@ -8,6 +8,7 @@ interface TextProps { weight?: number; align?: 'left' | 'center' | 'right'; family?: 'primary' | 'secondary'; + opacity?: number; } const TextWrapper = styled.span<{ @@ -16,12 +17,13 @@ const TextWrapper = styled.span<{ weight: number; align: 'left' | 'center' | 'right'; family?: 'primary' | 'secondary'; + opacity: number; }>` - color: ${({ color, theme }) => - color || console.log({ theme }) || theme.colors.text}; + color: ${({ color, theme }) => color || theme.colors.text}; font-size: ${({ size }) => size}px; font-weight: ${({ weight }) => weight}; text-align: ${({ align }) => align}; + opacity: ${({ opacity }) => opacity}; font-family: ${({ theme, family }) => { if (family === 'primary') { return theme.font_family.primary; @@ -40,6 +42,7 @@ const Text: React.FC = ({ weight = 400, align = 'left', family = 'primary', + opacity = 1, }) => { return ( = ({ size={size} weight={weight} align={align} + opacity={opacity} > {children} diff --git a/frontend/webapp/reuseable-components/tooltip/index.tsx b/frontend/webapp/reuseable-components/tooltip/index.tsx new file mode 100644 index 000000000..0a88f7358 --- /dev/null +++ b/frontend/webapp/reuseable-components/tooltip/index.tsx @@ -0,0 +1,69 @@ +import React from 'react'; +import styled from 'styled-components'; +import { Text } from '../text'; + +interface TooltipProps { + text: string; + children: React.ReactNode; +} + +const TooltipContainer = styled.div` + position: relative; + display: inline-block; + width: fit-content; + cursor: pointer; +`; + +const TooltipText = styled.div` + visibility: hidden; + background-color: ${({ theme }) => theme.colors.dark_grey}; + background: #1a1a1a; + color: #fff; + text-align: center; + border-radius: 4px; + padding: 8px; + position: absolute; + z-index: 1; + bottom: 125%; /* Position the tooltip above the text */ + left: 50%; + transform: translateX(-50%); + white-space: nowrap; + opacity: 0; + transition: opacity 0.3s; + + /* Tooltip arrow */ + &::after { + content: ''; + position: absolute; + z-index: 99999; + top: 100%; /* At the bottom of the tooltip */ + left: 50%; + margin-left: -5px; + border-width: 5px; + border-style: solid; + border-color: #1a1a1a transparent transparent transparent; + } +`; + +const TooltipWrapper = styled.div` + &:hover ${TooltipText} { + visibility: visible; + opacity: 1; + z-index: 999; + } +`; + +const Tooltip: React.FC = ({ text, children }) => { + return ( + + + {children} + + {text} + + + + ); +}; + +export { Tooltip }; diff --git a/frontend/webapp/styles/theme.ts b/frontend/webapp/styles/theme.ts index 6789e96cf..5da9b382d 100644 --- a/frontend/webapp/styles/theme.ts +++ b/frontend/webapp/styles/theme.ts @@ -18,8 +18,8 @@ const text = { }; const font_family = { - primary: 'Kode Mono, sans-serif', - secondary: 'Inter, sans-serif', + primary: 'Inter, sans-serif', + secondary: 'Kode Mono, sans-serif', }; // Define the theme interface From e4448247944205f63b1cf363f84462e7e62519cd Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 25 Jul 2024 14:06:55 +0300 Subject: [PATCH 104/374] chore: init tooltip component --- .../webapp/app/setup/choose-sources/page.tsx | 3 --- .../reuseable-components/input/index.tsx | 24 ++++++++++++------- .../reuseable-components/tooltip/index.tsx | 24 ++++++++++++------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx index cca8a2243..57ee736ad 100644 --- a/frontend/webapp/app/setup/choose-sources/page.tsx +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -51,9 +51,6 @@ export default function ChooseSourcesPage() {
); diff --git a/frontend/webapp/reuseable-components/input/index.tsx b/frontend/webapp/reuseable-components/input/index.tsx index a1b04c5bc..b52900018 100644 --- a/frontend/webapp/reuseable-components/input/index.tsx +++ b/frontend/webapp/reuseable-components/input/index.tsx @@ -133,6 +133,7 @@ const HeaderWrapper = styled.div` display: flex; align-items: center; gap: 6px; + margin-bottom: 4px; `; const Input: React.FC = ({ @@ -146,14 +147,21 @@ const Input: React.FC = ({ }) => { return ( - - - {title} - {tooltip && ( - - )} - - + {title && ( + + + {title} + {tooltip && ( + + )} + + + )} ` &:hover ${TooltipText} { - visibility: visible; - opacity: 1; - z-index: 999; + ${({ hasText }) => + hasText && + ` + visibility: visible; + opacity: 1; + z-index: 999; + `} } `; const Tooltip: React.FC = ({ text, children }) => { + const hasText = !!text; + return ( - + {children} - - {text} - + {hasText && ( + + {text} + + )} ); From 4632da30f91d03ccfd34df017cc2a4c0fe3d2c42 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 25 Jul 2024 14:59:30 +0300 Subject: [PATCH 105/374] chore: added dropdoen component --- .../webapp/app/setup/choose-sources/page.tsx | 32 ++- .../components/setup/headers/header/index.tsx | 2 +- .../public/icons/common/extend-arrow.svg | 5 + .../reuseable-components/divider/index.tsx | 36 ++++ .../reuseable-components/dropdown/index.tsx | 187 ++++++++++++++++++ frontend/webapp/reuseable-components/index.ts | 3 + .../reuseable-components/input/index.tsx | 3 +- frontend/webapp/styles/theme.ts | 1 + 8 files changed, 260 insertions(+), 9 deletions(-) create mode 100644 frontend/webapp/public/icons/common/extend-arrow.svg create mode 100644 frontend/webapp/reuseable-components/divider/index.tsx create mode 100644 frontend/webapp/reuseable-components/dropdown/index.tsx diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx index 57ee736ad..ca6425492 100644 --- a/frontend/webapp/app/setup/choose-sources/page.tsx +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -1,8 +1,8 @@ 'use client'; -import React from 'react'; +import React, { useState } from 'react'; import { useSuspenseQuery, gql } from '@apollo/client'; -import { Input, SectionTitle } from '@/reuseable-components'; +import { Dropdown, Input, SectionTitle } from '@/reuseable-components'; const GET_COMPUTE_PLATFORM = gql` query GetComputePlatform($cpId: ID!) { @@ -42,16 +42,34 @@ export default function ChooseSourcesPage() { variables: { cpId: '1' }, }); + const [selectedOption, setSelectedOption] = useState('All types'); + const options = [ + 'All types', + 'Existing destinations', + 'Self hosted', + 'Managed', + ]; + return ( -
+
- +
+ + + +
); } diff --git a/frontend/webapp/components/setup/headers/header/index.tsx b/frontend/webapp/components/setup/headers/header/index.tsx index 2d6943029..b1bfa77ec 100644 --- a/frontend/webapp/components/setup/headers/header/index.tsx +++ b/frontend/webapp/components/setup/headers/header/index.tsx @@ -50,7 +50,7 @@ export const SetupHeader: React.FC = ({ onBack, onNext }) => { height={20} /> - START WITH ODIGOS + START WITH ODIGOS + + + + \ No newline at end of file diff --git a/frontend/webapp/reuseable-components/divider/index.tsx b/frontend/webapp/reuseable-components/divider/index.tsx new file mode 100644 index 000000000..5ba268e48 --- /dev/null +++ b/frontend/webapp/reuseable-components/divider/index.tsx @@ -0,0 +1,36 @@ +import React from 'react'; +import styled from 'styled-components'; + +interface DividerProps { + thickness?: number; + color?: string; + margin?: string; + orientation?: 'horizontal' | 'vertical'; +} + +const StyledDivider = styled.div` + width: ${({ orientation, thickness }) => + orientation === 'vertical' ? `${thickness}px` : '100%'}; + height: ${({ orientation, thickness }) => + orientation === 'horizontal' ? `${thickness}px` : '100%'}; + background-color: ${({ color, theme }) => color || theme.colors.border}; + margin: ${({ margin }) => margin || '8px 0'}; +`; + +const Divider: React.FC = ({ + thickness = 1, + color, + margin, + orientation = 'horizontal', +}) => { + return ( + + ); +}; + +export { Divider }; diff --git a/frontend/webapp/reuseable-components/dropdown/index.tsx b/frontend/webapp/reuseable-components/dropdown/index.tsx new file mode 100644 index 000000000..a61e47386 --- /dev/null +++ b/frontend/webapp/reuseable-components/dropdown/index.tsx @@ -0,0 +1,187 @@ +import React, { useState, useRef } from 'react'; +import { Input } from '../input'; +import styled, { css } from 'styled-components'; +import { Tooltip } from '../tooltip'; +import Image from 'next/image'; +import { Text } from '../text'; +import { Divider } from '../divider'; + +interface DropdownProps { + options: string[]; + selectedOption: string; + onSelect: (option: string) => void; + title?: string; + tooltip?: string; +} + +const Container = styled.div` + display: flex; + flex-direction: column; + position: relative; + width: 100%; +`; + +const Title = styled(Text)``; + +const DropdownHeader = styled.div<{ isOpen: boolean }>` + display: flex; + align-items: center; + justify-content: space-between; + height: 36px; + padding: 0 16px; + border-radius: 32px; + border: 1px solid rgba(249, 249, 249, 0.24); + cursor: pointer; + background-color: transparent; + border-radius: 32px; + ${({ isOpen, theme }) => + isOpen && + css` + border: 1px solid rgba(249, 249, 249, 0.48); + background: rgba(249, 249, 249, 0.08); + `}; + + &:hover { + border-color: ${({ theme }) => theme.colors.secondary}; + } + &:focus-within { + border-color: ${({ theme }) => theme.colors.secondary}; + } +`; + +const DropdownListContainer = styled.div` + position: absolute; + top: 60px; + left: 0; + width: 100%; + max-height: 200px; + overflow-y: auto; + display: flex; + flex-direction: column; + gap: 8px; + padding: 8px; + background-color: rgba(249, 249, 249, 0.08); + border: 1px solid ${({ theme }) => theme.colors.border}; + border-radius: 32px; + margin-top: 4px; + z-index: 10; +`; + +const SearchInputContainer = styled.div` + display: flex; + flex-direction: column; + align-items: center; +`; + +const DropdownItem = styled.div<{ isSelected: boolean }>` + padding: 8px 12px; + cursor: pointer; + display: flex; + justify-content: space-between; + align-items: center; + border-radius: 32px; + &:hover { + background: rgba(68, 74, 217, 0.24); + } + ${({ isSelected, theme }) => + isSelected && + css` + background: rgba(68, 74, 217, 0.24); + `} +`; + +const HeaderWrapper = styled.div` + display: flex; + align-items: center; + gap: 6px; + margin-bottom: 4px; +`; + +const OpenDropdownIcon = styled(Image)<{ isOpen: boolean }>` + transform: ${({ isOpen }) => (isOpen ? 'rotate(180deg)' : 'rotate(0deg)')}; +`; + +const Dropdown: React.FC = ({ + options, + selectedOption, + onSelect, + title, + tooltip, +}) => { + const [isOpen, setIsOpen] = useState(false); + const [searchTerm, setSearchTerm] = useState(''); + const dropdownRef = useRef(null); + + const filteredOptions = options.filter((option) => + option.toLowerCase().includes(searchTerm.toLowerCase()) + ); + + const handleSelect = (option: string) => { + onSelect(option); + setIsOpen(false); + }; + + return ( + + {title && ( + + + {title} + {tooltip && ( + + )} + + + )} + setIsOpen(!isOpen)}> + {selectedOption} + + + + {isOpen && ( + + + setSearchTerm(e.target.value)} + /> + + + {filteredOptions.map((option) => ( + handleSelect(option)} + > + {option} + + {option === selectedOption && ( + + )} + + ))} + + )} + + ); +}; + +export { Dropdown }; diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts index b95b1445a..2740c05e6 100644 --- a/frontend/webapp/reuseable-components/index.ts +++ b/frontend/webapp/reuseable-components/index.ts @@ -2,3 +2,6 @@ export * from './text'; export * from './button'; export * from './section-title'; export * from './input'; +export * from './tooltip'; +export * from './dropdown'; +export * from './divider'; diff --git a/frontend/webapp/reuseable-components/input/index.tsx b/frontend/webapp/reuseable-components/input/index.tsx index b52900018..9b62c8bc1 100644 --- a/frontend/webapp/reuseable-components/input/index.tsx +++ b/frontend/webapp/reuseable-components/input/index.tsx @@ -30,7 +30,7 @@ const InputWrapper = styled.div<{ align-items: center; height: 36px; gap: 12px; - padding: 0 12px; + transition: border-color 0.3s; border-radius: 32px; border: 1px solid rgba(249, 249, 249, 0.24); @@ -89,6 +89,7 @@ const StyledInput = styled.input` const IconWrapper = styled.div` display: flex; align-items: center; + margin-left: 12px; `; const Button = styled.button` diff --git a/frontend/webapp/styles/theme.ts b/frontend/webapp/styles/theme.ts index 5da9b382d..ce5ce7c11 100644 --- a/frontend/webapp/styles/theme.ts +++ b/frontend/webapp/styles/theme.ts @@ -6,6 +6,7 @@ const colors = { secondary: '#F9F9F9', dark_grey: '#151515', text: '#F9F9F9', + border: 'rgba(249, 249, 249, 0.08)', }; const text = { From f12cde690ec028de655c368787624f6fde7135a5 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 25 Jul 2024 15:38:05 +0300 Subject: [PATCH 106/374] chore: counter component --- .../webapp/app/setup/choose-sources/page.tsx | 16 ++++++-- .../reuseable-components/counter/index.tsx | 39 +++++++++++++++++++ frontend/webapp/reuseable-components/index.ts | 1 + .../reuseable-components/text/index.tsx | 2 +- 4 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 frontend/webapp/reuseable-components/counter/index.tsx diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx index ca6425492..8f791b6a2 100644 --- a/frontend/webapp/app/setup/choose-sources/page.tsx +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -2,7 +2,13 @@ import React, { useState } from 'react'; import { useSuspenseQuery, gql } from '@apollo/client'; -import { Dropdown, Input, SectionTitle } from '@/reuseable-components'; +import { + Counter, + Divider, + Dropdown, + Input, + SectionTitle, +} from '@/reuseable-components'; const GET_COMPUTE_PLATFORM = gql` query GetComputePlatform($cpId: ID!) { @@ -56,7 +62,7 @@ export default function ChooseSourcesPage() { title="Choose sources" description="Apps will be automatically instrumented, and data will be sent to the relevant APM's destinations." /> -
+
+ +
+ +
); } diff --git a/frontend/webapp/reuseable-components/counter/index.tsx b/frontend/webapp/reuseable-components/counter/index.tsx new file mode 100644 index 000000000..b9b242e63 --- /dev/null +++ b/frontend/webapp/reuseable-components/counter/index.tsx @@ -0,0 +1,39 @@ +import React from 'react'; +import styled from 'styled-components'; +import { Text } from '../text'; + +interface CounterProps { + value: number; + title: string; +} + +const Container = styled.div` + display: flex; + align-items: center; + gap: 8px; +`; + +const ValueContainer = styled.div` + display: flex; + align-items: center; + justify-content: center; + width: 20px; + height: 20px; + border-radius: 32px; + border: 1px solid rgba(249, 249, 249, 0.24); +`; + +const Counter: React.FC = ({ value, title }) => { + return ( + + {title} + + + {value} + + + + ); +}; + +export { Counter }; diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts index 2740c05e6..48b6b8186 100644 --- a/frontend/webapp/reuseable-components/index.ts +++ b/frontend/webapp/reuseable-components/index.ts @@ -5,3 +5,4 @@ export * from './input'; export * from './tooltip'; export * from './dropdown'; export * from './divider'; +export * from './counter'; diff --git a/frontend/webapp/reuseable-components/text/index.tsx b/frontend/webapp/reuseable-components/text/index.tsx index 71e8afc9d..7044c019e 100644 --- a/frontend/webapp/reuseable-components/text/index.tsx +++ b/frontend/webapp/reuseable-components/text/index.tsx @@ -39,7 +39,7 @@ const Text: React.FC = ({ children, color, size = 16, - weight = 400, + weight = 300, align = 'left', family = 'primary', opacity = 1, From 154fc7d312bda4a1da447cb5fba50a57756853b7 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 25 Jul 2024 16:19:05 +0300 Subject: [PATCH 107/374] chore: wip --- .../webapp/app/setup/choose-sources/page.tsx | 27 +++++- .../reuseable-components/checkbox/index.tsx | 82 +++++++++++++++++++ frontend/webapp/reuseable-components/index.ts | 2 + .../reuseable-components/toggle/index.tsx | 80 ++++++++++++++++++ 4 files changed, 189 insertions(+), 2 deletions(-) create mode 100644 frontend/webapp/reuseable-components/checkbox/index.tsx create mode 100644 frontend/webapp/reuseable-components/toggle/index.tsx diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx index 8f791b6a2..902358931 100644 --- a/frontend/webapp/app/setup/choose-sources/page.tsx +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -3,11 +3,13 @@ import React, { useState } from 'react'; import { useSuspenseQuery, gql } from '@apollo/client'; import { + Checkbox, Counter, Divider, Dropdown, Input, SectionTitle, + Toggle, } from '@/reuseable-components'; const GET_COMPUTE_PLATFORM = gql` @@ -56,8 +58,12 @@ export default function ChooseSourcesPage() { 'Managed', ]; + const handleCheckboxChange = (value: boolean) => { + console.log('Checkbox is now', value); + }; + return ( -
+
-
+
+
+ + +
+
+
); } diff --git a/frontend/webapp/reuseable-components/checkbox/index.tsx b/frontend/webapp/reuseable-components/checkbox/index.tsx new file mode 100644 index 000000000..956fbb6ec --- /dev/null +++ b/frontend/webapp/reuseable-components/checkbox/index.tsx @@ -0,0 +1,82 @@ +import React, { useState } from 'react'; +import styled from 'styled-components'; +import { Tooltip } from '../tooltip'; +import Image from 'next/image'; +import { Text } from '../text'; + +interface CheckboxProps { + title: string; + tooltip?: string; + initialValue?: boolean; + onChange?: (value: boolean) => void; + disabled?: boolean; +} + +const Container = styled.div<{ disabled?: boolean }>` + display: flex; + align-items: center; + gap: 8px; + cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')}; + opacity: ${({ disabled }) => (disabled ? 0.6 : 1)}; +`; + +const CheckboxWrapper = styled.div<{ isChecked: boolean; disabled?: boolean }>` + width: 18px; + height: 18px; + border-radius: 6px; + border: 1px dashed rgba(249, 249, 249, 0.4); + display: flex; + align-items: center; + justify-content: center; + background-color: ${({ isChecked, theme }) => + isChecked ? theme.colors.primary : 'transparent'}; + pointer-events: ${({ disabled }) => (disabled ? 'none' : 'auto')}; +`; + +const Title = styled.span` + font-size: 16px; + color: #fff; +`; + +const Checkbox: React.FC = ({ + title, + tooltip, + initialValue = false, + onChange, + disabled, +}) => { + const [isChecked, setIsChecked] = useState(initialValue); + + const handleToggle = () => { + if (!disabled) { + const newValue = !isChecked; + setIsChecked(newValue); + if (onChange) { + onChange(newValue); + } + } + }; + + return ( + + + + {isChecked && ( + + )} + + {title} + {tooltip && ( + + )} + + + ); +}; + +export { Checkbox }; diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts index 48b6b8186..4090df8fb 100644 --- a/frontend/webapp/reuseable-components/index.ts +++ b/frontend/webapp/reuseable-components/index.ts @@ -6,3 +6,5 @@ export * from './tooltip'; export * from './dropdown'; export * from './divider'; export * from './counter'; +export * from './toggle'; +export * from './checkbox'; diff --git a/frontend/webapp/reuseable-components/toggle/index.tsx b/frontend/webapp/reuseable-components/toggle/index.tsx new file mode 100644 index 000000000..e3377c4a0 --- /dev/null +++ b/frontend/webapp/reuseable-components/toggle/index.tsx @@ -0,0 +1,80 @@ +import React, { useState } from 'react'; +import Image from 'next/image'; +import styled, { css } from 'styled-components'; +import { Tooltip } from '../tooltip'; +import { Text } from '../text'; + +interface ToggleProps { + title: string; + tooltip?: string; + initialValue?: boolean; + onChange?: (value: boolean) => void; + disabled?: boolean; +} + +const Container = styled.div<{ disabled?: boolean }>` + display: flex; + align-items: center; + gap: 12px; + cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')}; + opacity: ${({ disabled }) => (disabled ? 0.6 : 1)}; +`; + +const ToggleSwitch = styled.div<{ isActive: boolean; disabled?: boolean }>` + width: 24px; + height: 12px; + border: 1px dashed #aaa; + border-radius: 20px; + display: flex; + align-items: center; + padding: 2px; + background-color: ${({ isActive, theme }) => + isActive ? theme.colors.primary : 'transparent'}; + pointer-events: ${({ disabled }) => (disabled ? 'none' : 'auto')}; + cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')}; + opacity: ${({ isActive }) => (isActive ? 1 : 0.4)}; + &::before { + content: ''; + width: 12px; + height: 12px; + border-radius: 50%; + background-color: ${({ theme }) => theme.colors.secondary}; + transform: ${({ isActive }) => + isActive ? 'translateX(12px)' : 'translateX(0)'}; + transition: transform 0.3s; + } +`; + +const Toggle: React.FC = ({ + title, + tooltip, + initialValue = false, + onChange, + disabled, +}) => { + const [isActive, setIsActive] = useState(initialValue); + + const handleToggle = () => { + if (!disabled) { + const newValue = !isActive; + setIsActive(newValue); + if (onChange) { + onChange(newValue); + } + } + }; + + return ( + + + + {title} + {tooltip && ( + + )} + + + ); +}; + +export { Toggle }; From 91a79591659817af7aff4b67ebc2ff73b4ea6fb7 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 28 Jul 2024 09:43:54 +0300 Subject: [PATCH 108/374] chore: wip --- frontend/graph/schema.graphqls | 1 - frontend/graph/schema.resolvers.go | 6 +++++- frontend/webapp/app/setup/choose-sources/page.tsx | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index 06d2ebb47..09ed84053 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -110,7 +110,6 @@ type ComputePlatform { id: ID! name: String computePlatformType: ComputePlatformType! - k8sActualNamespace(name: String!): K8sActualNamespace k8sActualNamespaces: [K8sActualNamespace]! k8sActualSource( diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 9a8ea6532..753bf7fc3 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -39,8 +39,12 @@ func (r *queryResolver) ComputePlatform(ctx context.Context, cpID string) (*mode res[i] = k8sThinSourceToGql(&source) } + name := "odigos-system" + return &model.ComputePlatform{ - K8sActualSources: res, + K8sActualSources: res, + Name: &name, + ComputePlatformType: model.ComputePlatformTypeK8s, }, nil } diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx index 902358931..37c0862bb 100644 --- a/frontend/webapp/app/setup/choose-sources/page.tsx +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -1,5 +1,5 @@ 'use client'; -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { useSuspenseQuery, gql } from '@apollo/client'; import { @@ -50,6 +50,10 @@ export default function ChooseSourcesPage() { variables: { cpId: '1' }, }); + useEffect(() => { + console.log(data); + }, [data]); + const [selectedOption, setSelectedOption] = useState('All types'); const options = [ 'All types', From 412d448336f757f43cd4a2b1b6fd3f44b529addb Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 28 Jul 2024 15:03:45 +0300 Subject: [PATCH 109/374] chore: get compute platform namspace with actual sources --- frontend/endpoints/actual-sources.go | 21 ++++------ frontend/endpoints/applications.go | 22 ++++++++++ frontend/endpoints/namespaces.go | 40 +++++++++++++++++++ frontend/graph/conversions.go | 11 +++++ frontend/graph/schema.resolvers.go | 17 ++++++++ .../reuseable-components/dropdown/index.tsx | 4 +- 6 files changed, 100 insertions(+), 15 deletions(-) diff --git a/frontend/endpoints/actual-sources.go b/frontend/endpoints/actual-sources.go index e11d0c32a..237dbff86 100644 --- a/frontend/endpoints/actual-sources.go +++ b/frontend/endpoints/actual-sources.go @@ -14,7 +14,14 @@ import ( ) func GetActualSources(ctx context.Context, odigosns string) []ThinSource { + return getSourcesForNamespace(ctx, odigosns) +} + +func GetNamespaceActualSources(ctx context.Context, namespace string) []ThinSource { + return getSourcesForNamespace(ctx, namespace) +} +func getSourcesForNamespace(ctx context.Context, namespace string) []ThinSource { effectiveInstrumentedSources := map[SourceID]ThinSource{} var ( @@ -24,7 +31,7 @@ func GetActualSources(ctx context.Context, odigosns string) []ThinSource { g, ctx := errgroup.WithContext(ctx) g.Go(func() error { - relevantNamespaces, err := getRelevantNameSpaces(ctx, odigosns) + relevantNamespaces, err := getRelevantNameSpaces(ctx, namespace) if err != nil { return err } @@ -32,9 +39,6 @@ func GetActualSources(ctx context.Context, odigosns string) []ThinSource { for _, ns := range relevantNamespaces { nsInstrumentedMap[ns.Name] = isObjectLabeledForInstrumentation(ns.ObjectMeta) } - // get all the applications in all the namespaces, - // passing an empty string here is more efficient compared to iterating over the namespaces - // since it will make a single request per workload type to the k8s api server items, err = getApplicationsInNamespace(ctx, "", nsInstrumentedMap) return err }) @@ -60,10 +64,6 @@ func GetActualSources(ctx context.Context, odigosns string) []ThinSource { } sourcesResult := []ThinSource{} - // go over the instrumented applications and update the languages of the effective sources. - // Not all effective sources necessarily have a corresponding instrumented application, - // it may take some time for the instrumented application to be created. In that case the languages - // slice will be empty. for _, app := range instrumentedApplications.Items { thinSource := k8sInstrumentedAppToThinSource(&app) if source, ok := effectiveInstrumentedSources[thinSource.SourceID]; ok { @@ -77,13 +77,10 @@ func GetActualSources(ctx context.Context, odigosns string) []ThinSource { } return sourcesResult - } func GetActualSource(ctx context.Context, ns string, kind string, name string) (*Source, error) { - k8sObjectName := workload.GetRuntimeObjectName(name, kind) - owner, numberOfRunningInstances := getWorkload(ctx, ns, kind, name) if owner == nil { return nil, fmt.Errorf("owner not found") @@ -105,9 +102,7 @@ func GetActualSource(ctx context.Context, ns string, kind string, name string) ( instrumentedApplication, err := kube.DefaultClient.OdigosClient.InstrumentedApplications(ns).Get(ctx, k8sObjectName, metav1.GetOptions{}) if err == nil { - // valid instrumented application, grab the runtime details ts.IaDetails = k8sInstrumentedAppToThinSource(instrumentedApplication).IaDetails - // potentially add a condition for healthy instrumentation instances err = addHealthyInstrumentationInstancesCondition(ctx, instrumentedApplication, &ts) if err != nil { return nil, err diff --git a/frontend/endpoints/applications.go b/frontend/endpoints/applications.go index a29346cf0..a16df40e6 100644 --- a/frontend/endpoints/applications.go +++ b/frontend/endpoints/applications.go @@ -75,6 +75,28 @@ func GetApplicationsInNamespace(c *gin.Context) { }) } +func GetApplicationsInK8SNamespace(ctx context.Context, ns string) []GetApplicationItemInNamespace { + + namespace, err := kube.DefaultClient.CoreV1().Namespaces().Get(ctx, ns, metav1.GetOptions{}) + if err != nil { + + return nil + } + + items, err := getApplicationsInNamespace(ctx, namespace.Name, map[string]*bool{namespace.Name: isObjectLabeledForInstrumentation(namespace.ObjectMeta)}) + if err != nil { + + return nil + } + + apps := make([]GetApplicationItemInNamespace, len(items)) + for i, item := range items { + apps[i] = item.nsItem + } + + return apps +} + // getApplicationsInNamespace returns all applications in the namespace and their instrumentation status. // nsName can be an empty string to get applications in all namespaces. // nsInstrumentedMap is a map of namespace name to a boolean pointer indicating if the namespace is instrumented. diff --git a/frontend/endpoints/namespaces.go b/frontend/endpoints/namespaces.go index b6f660e28..f0f6ff23d 100644 --- a/frontend/endpoints/namespaces.go +++ b/frontend/endpoints/namespaces.go @@ -73,6 +73,46 @@ func GetNamespaces(c *gin.Context, odigosns string) { c.JSON(http.StatusOK, response) } +func GetK8SNamespaces(ctx context.Context, odigosns string) GetNamespacesResponse { + + var ( + relevantNameSpaces []v1.Namespace + appsPerNamespace map[string]int + ) + + g, ctx := errgroup.WithContext(ctx) + g.Go(func() error { + var err error + relevantNameSpaces, err = getRelevantNameSpaces(ctx, odigosns) + return err + }) + + g.Go(func() error { + var err error + appsPerNamespace, err = CountAppsPerNamespace(ctx) + return err + }) + + if err := g.Wait(); err != nil { + + return GetNamespacesResponse{} + } + + var response GetNamespacesResponse + for _, namespace := range relevantNameSpaces { + // check if entire namespace is instrumented + selected := namespace.Labels[consts.OdigosInstrumentationLabel] == consts.InstrumentationEnabled + + response.Namespaces = append(response.Namespaces, GetNamespaceItem{ + Name: namespace.Name, + Selected: selected, + TotalApps: appsPerNamespace[namespace.Name], + }) + } + + return response +} + // getRelevantNameSpaces returns a list of namespaces that are relevant for instrumentation. // Taking into account the ignored namespaces from the OdigosConfiguration. func getRelevantNameSpaces(ctx context.Context, odigosns string) ([]v1.Namespace, error) { diff --git a/frontend/graph/conversions.go b/frontend/graph/conversions.go index 49b433f2d..936727a48 100644 --- a/frontend/graph/conversions.go +++ b/frontend/graph/conversions.go @@ -90,3 +90,14 @@ func k8sSourceToGql(k8sSource *endpoints.Source) *gqlmodel.K8sActualSource { ServiceName: &k8sSource.ReportedName, } } + +func k8sApplicationItemToGql(appItem *endpoints.GetApplicationItemInNamespace) *gqlmodel.K8sActualSource { + + stringKind := string(appItem.Kind) + + return &gqlmodel.K8sActualSource{ + Kind: k8sKindToGql(stringKind), + Name: appItem.Name, + NumberOfInstances: &appItem.Instances, + } +} diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 753bf7fc3..d54ccbe98 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -40,11 +40,28 @@ func (r *queryResolver) ComputePlatform(ctx context.Context, cpID string) (*mode } name := "odigos-system" + namespacesResponse := endpoints.GetK8SNamespaces(ctx, name) + + K8sActualNamespaces := make([]*model.K8sActualNamespace, len(namespacesResponse.Namespaces)) + + for i, namespace := range namespacesResponse.Namespaces { + namespaceActualSources := endpoints.GetApplicationsInK8SNamespace(ctx, namespace.Name) + namespaceSources := make([]*model.K8sActualSource, len(namespaceActualSources)) + for j, source := range namespaceActualSources { + namespaceSources[j] = k8sApplicationItemToGql(&source) + } + + K8sActualNamespaces[i] = &model.K8sActualNamespace{ + Name: namespace.Name, + K8sActualSources: namespaceSources, + } + } return &model.ComputePlatform{ K8sActualSources: res, Name: &name, ComputePlatformType: model.ComputePlatformTypeK8s, + K8sActualNamespaces: K8sActualNamespaces, }, nil } diff --git a/frontend/webapp/reuseable-components/dropdown/index.tsx b/frontend/webapp/reuseable-components/dropdown/index.tsx index a61e47386..f6a2c2a6e 100644 --- a/frontend/webapp/reuseable-components/dropdown/index.tsx +++ b/frontend/webapp/reuseable-components/dropdown/index.tsx @@ -60,11 +60,11 @@ const DropdownListContainer = styled.div` flex-direction: column; gap: 8px; padding: 8px; - background-color: rgba(249, 249, 249, 0.08); + background-color: #242424; border: 1px solid ${({ theme }) => theme.colors.border}; border-radius: 32px; margin-top: 4px; - z-index: 10; + z-index: 999; `; const SearchInputContainer = styled.div` From 5242d162c0776f2a63de8551819fe560f6319076 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 28 Jul 2024 16:06:43 +0300 Subject: [PATCH 110/374] chore: sources list --- .../webapp/app/setup/choose-sources/page.tsx | 60 +++++---- .../containers/setup/sources/sources-list.tsx | 123 ++++++++++++++++++ .../webapp/public/icons/common/folder.svg | 3 + .../reuseable-components/text/index.tsx | 2 +- 4 files changed, 163 insertions(+), 25 deletions(-) create mode 100644 frontend/webapp/containers/setup/sources/sources-list.tsx create mode 100644 frontend/webapp/public/icons/common/folder.svg diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx index 37c0862bb..2812c568d 100644 --- a/frontend/webapp/app/setup/choose-sources/page.tsx +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -11,6 +11,7 @@ import { SectionTitle, Toggle, } from '@/reuseable-components'; +import { SourcesList } from '@/containers/setup/sources/sources-list'; const GET_COMPUTE_PLATFORM = gql` query GetComputePlatform($cpId: ID!) { @@ -18,37 +19,43 @@ const GET_COMPUTE_PLATFORM = gql` id name computePlatformType - k8sActualSources { - namespace - kind + k8sActualNamespaces { name - serviceName - autoInstrumented - creationTimestamp - numberOfInstances - hasInstrumentedApplication - instrumentedApplicationDetails { - languages { - containerName - language - } - conditions { - type - status - lastTransitionTime - reason - message - } + k8sActualSources { + name + kind + numberOfInstances } } } } `; +type ComputePlatformData = { + id: string; + name: string; + computePlatformType: string; + k8sActualNamespaces: { + name: string; + k8sActualSources: { + name: string; + kind: string; + numberOfInstances: number; + }[]; + }[]; +}; + +type ComputePlatform = { + computePlatform: ComputePlatformData; +}; + export default function ChooseSourcesPage() { - const { error, data } = useSuspenseQuery(GET_COMPUTE_PLATFORM, { - variables: { cpId: '1' }, - }); + const { error, data } = useSuspenseQuery( + GET_COMPUTE_PLATFORM, + { + variables: { cpId: '1' }, + } + ); useEffect(() => { console.log(data); @@ -104,7 +111,12 @@ export default function ChooseSourcesPage() { onChange={handleCheckboxChange} />
- + +
); } diff --git a/frontend/webapp/containers/setup/sources/sources-list.tsx b/frontend/webapp/containers/setup/sources/sources-list.tsx new file mode 100644 index 000000000..4e823e45d --- /dev/null +++ b/frontend/webapp/containers/setup/sources/sources-list.tsx @@ -0,0 +1,123 @@ +import { Text } from '@/reuseable-components'; +import Image from 'next/image'; +import React, { useState } from 'react'; +import styled from 'styled-components'; + +const Container = styled.div` + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 12px; + align-self: stretch; + border-radius: 16px; + background: ${({ theme }) => theme.colors.primary}; + height: 100%; + max-height: 548px; + overflow-y: auto; +`; + +const ListItem = styled.div<{ selected: boolean }>` + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + padding: 16px 0px; + transition: background 0.3s; + border-radius: 16px; + + cursor: pointer; + background: ${({ selected }) => + selected ? 'rgba(68, 74, 217, 0.24)' : 'rgba(249, 249, 249, 0.04)'}; + + &:hover { + background: rgba(68, 74, 217, 0.24); + } +`; + +const ListItemContent = styled.div` + margin-left: 16px; + display: flex; + gap: 12px; +`; + +const SourceIconWrapper = styled.div` + display: flex; + width: 36px; + height: 36px; + justify-content: center; + align-items: center; + gap: 8px; + border-radius: 8px; + background: linear-gradient( + 180deg, + rgba(249, 249, 249, 0.06) 0%, + rgba(249, 249, 249, 0.02) 100% + ); +`; + +const TextWrapper = styled.div` + display: flex; + flex-direction: column; + height: 36px; + justify-content: space-between; +`; + +const SelectedTextWrapper = styled.div` + margin-right: 24px; +`; + +interface K8sActualSource { + name: string; + kind: string; + numberOfInstances: number; +} + +const SourcesList: React.FC<{ items: K8sActualSource[] }> = ({ items }) => { + const [selectedItems, setSelectedItems] = useState([]); + + const handleItemClick = (name: string) => { + setSelectedItems((prevSelectedItems) => + prevSelectedItems.includes(name) + ? prevSelectedItems.filter((item) => item !== name) + : [...prevSelectedItems, name] + ); + }; + + return ( + + {items.map((item) => ( + handleItemClick(item.name)} + > + + + source + + + {item.name} + + {item.numberOfInstances} running instances · {item.kind} + + + + {selectedItems.includes(item.name) && ( + + + SELECTED + + + )} + + ))} + + ); +}; + +export { SourcesList }; diff --git a/frontend/webapp/public/icons/common/folder.svg b/frontend/webapp/public/icons/common/folder.svg new file mode 100644 index 000000000..59cce3af9 --- /dev/null +++ b/frontend/webapp/public/icons/common/folder.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/webapp/reuseable-components/text/index.tsx b/frontend/webapp/reuseable-components/text/index.tsx index 7044c019e..a375ed19a 100644 --- a/frontend/webapp/reuseable-components/text/index.tsx +++ b/frontend/webapp/reuseable-components/text/index.tsx @@ -11,7 +11,7 @@ interface TextProps { opacity?: number; } -const TextWrapper = styled.span<{ +const TextWrapper = styled.div<{ color?: string; size: number; weight: number; From fc9e1fccd0bdc8bccd1daec28f9c9149dc3f632d Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 29 Jul 2024 14:09:24 +0300 Subject: [PATCH 111/374] chore: wip --- .../app/(setup)/choose-sources/page.tsx | 47 +------ .../webapp/app/setup/choose-sources/page.tsx | 121 +--------------- frontend/webapp/app/setup/layout.tsx | 9 +- .../choose-sources-list/index.tsx | 131 ++++++++++++++++++ .../choose-sources-menu/index.ts | 2 + .../search-and-dropdown.tsx | 37 +++++ .../toggles-and-checkboxes.tsx | 60 ++++++++ .../choose-sources-menu/type.ts | 30 ++++ .../main/sources/choose-sources/index.tsx | 124 +++++++++++++++++ .../webapp/containers/main/sources/index.ts | 1 + .../graphql/queries/compute-platform.ts | 19 +++ frontend/webapp/graphql/queries/index.ts | 1 + .../webapp/hooks/compute-platform/index.ts | 1 + .../compute-platform/useComputePlatform.ts | 20 +++ frontend/webapp/hooks/index.tsx | 1 + .../reuseable-components/dropdown/index.tsx | 24 ++-- frontend/webapp/types/common.ts | 5 + frontend/webapp/types/compute-platform.ts | 16 +++ frontend/webapp/types/index.ts | 1 + frontend/webapp/types/sources.ts | 6 + 20 files changed, 483 insertions(+), 173 deletions(-) create mode 100644 frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx create mode 100644 frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/index.ts create mode 100644 frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/search-and-dropdown.tsx create mode 100644 frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/toggles-and-checkboxes.tsx create mode 100644 frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/type.ts create mode 100644 frontend/webapp/containers/main/sources/choose-sources/index.tsx create mode 100644 frontend/webapp/graphql/queries/compute-platform.ts create mode 100644 frontend/webapp/hooks/compute-platform/index.ts create mode 100644 frontend/webapp/hooks/compute-platform/useComputePlatform.ts create mode 100644 frontend/webapp/types/compute-platform.ts diff --git a/frontend/webapp/app/(setup)/choose-sources/page.tsx b/frontend/webapp/app/(setup)/choose-sources/page.tsx index 14a203ce5..495ec2f21 100644 --- a/frontend/webapp/app/(setup)/choose-sources/page.tsx +++ b/frontend/webapp/app/(setup)/choose-sources/page.tsx @@ -1,55 +1,10 @@ 'use client'; -import React, { useEffect } from 'react'; +import React from 'react'; import { StepsList } from '@/components'; import { ChooseSourcesContainer } from '@/containers'; import { CardWrapper, PageContainer, StepListWrapper } from '../styled'; -import { useSuspenseQuery, gql } from '@apollo/client'; - -const GET_COMPUTE_PLATFORM = gql` - query GetComputePlatform($cpId: ID!) { - computePlatform(cpId: $cpId) { - id - name - computePlatformType - k8sActualSources { - namespace - kind - name - serviceName - autoInstrumented - creationTimestamp - numberOfInstances - hasInstrumentedApplication - instrumentedApplicationDetails { - languages { - containerName - language - } - conditions { - type - status - lastTransitionTime - reason - message - } - } - } - } - } -`; - export default function ChooseSourcesPage() { - const { error, data } = useSuspenseQuery(GET_COMPUTE_PLATFORM, { - variables: { cpId: '1' }, - }); - - useEffect(() => { - if (error) { - console.error(error); - } - console.log({ data }); - }, [error, data]); return ( diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx index 2812c568d..3c0fbed5a 100644 --- a/frontend/webapp/app/setup/choose-sources/page.tsx +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -1,122 +1,11 @@ 'use client'; -import React, { useEffect, useState } from 'react'; - -import { useSuspenseQuery, gql } from '@apollo/client'; -import { - Checkbox, - Counter, - Divider, - Dropdown, - Input, - SectionTitle, - Toggle, -} from '@/reuseable-components'; -import { SourcesList } from '@/containers/setup/sources/sources-list'; - -const GET_COMPUTE_PLATFORM = gql` - query GetComputePlatform($cpId: ID!) { - computePlatform(cpId: $cpId) { - id - name - computePlatformType - k8sActualNamespaces { - name - k8sActualSources { - name - kind - numberOfInstances - } - } - } - } -`; - -type ComputePlatformData = { - id: string; - name: string; - computePlatformType: string; - k8sActualNamespaces: { - name: string; - k8sActualSources: { - name: string; - kind: string; - numberOfInstances: number; - }[]; - }[]; -}; - -type ComputePlatform = { - computePlatform: ComputePlatformData; -}; +import React from 'react'; +import { ChooseSourcesContainer } from '@/containers/main'; export default function ChooseSourcesPage() { - const { error, data } = useSuspenseQuery( - GET_COMPUTE_PLATFORM, - { - variables: { cpId: '1' }, - } - ); - - useEffect(() => { - console.log(data); - }, [data]); - - const [selectedOption, setSelectedOption] = useState('All types'); - const options = [ - 'All types', - 'Existing destinations', - 'Self hosted', - 'Managed', - ]; - - const handleCheckboxChange = (value: boolean) => { - console.log('Checkbox is now', value); - }; - return ( -
- -
- - - -
- -
- -
- - -
- -
- - -
+ <> + + ); } diff --git a/frontend/webapp/app/setup/layout.tsx b/frontend/webapp/app/setup/layout.tsx index d03aa3117..198d6164d 100644 --- a/frontend/webapp/app/setup/layout.tsx +++ b/frontend/webapp/app/setup/layout.tsx @@ -30,6 +30,11 @@ const MainContent = styled.div` align-items: center; `; +const ContentWrapper = styled.div` + width: 640px; + padding-top: 64px; +`; + export default function SetupLayout({ children, }: { @@ -43,7 +48,9 @@ export default function SetupLayout({ - {children} + + {children} + ); } diff --git a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx new file mode 100644 index 000000000..796bbe564 --- /dev/null +++ b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx @@ -0,0 +1,131 @@ +import { Text } from '@/reuseable-components'; +import Image from 'next/image'; +import React, { useState } from 'react'; +import styled from 'styled-components'; + +const Container = styled.div` + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 12px; + align-self: stretch; + border-radius: 16px; + background: ${({ theme }) => theme.colors.primary}; + height: 100%; + max-height: 548px; + overflow-y: auto; +`; + +const ListItem = styled.div<{ selected: boolean }>` + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + padding: 16px 0px; + transition: background 0.3s; + border-radius: 16px; + + cursor: pointer; + background: ${({ selected }) => + selected ? 'rgba(68, 74, 217, 0.24)' : 'rgba(249, 249, 249, 0.04)'}; + + &:hover { + background: rgba(68, 74, 217, 0.24); + } +`; + +const ListItemContent = styled.div` + margin-left: 16px; + display: flex; + gap: 12px; +`; + +const SourceIconWrapper = styled.div` + display: flex; + width: 36px; + height: 36px; + justify-content: center; + align-items: center; + gap: 8px; + border-radius: 8px; + background: linear-gradient( + 180deg, + rgba(249, 249, 249, 0.06) 0%, + rgba(249, 249, 249, 0.02) 100% + ); +`; + +const TextWrapper = styled.div` + display: flex; + flex-direction: column; + height: 36px; + justify-content: space-between; +`; + +const SelectedTextWrapper = styled.div` + margin-right: 24px; +`; + +interface K8sActualSource { + name: string; + kind: string; + numberOfInstances: number; +} + +interface SourcesListProps { + items: K8sActualSource[]; + selectedItems: K8sActualSource[]; + setSelectedItems: React.Dispatch>; +} + +const SourcesList: React.FC = ({ + items, + selectedItems, + setSelectedItems, +}) => { + const handleItemClick = (item: K8sActualSource) => { + setSelectedItems((prevSelectedItems) => + prevSelectedItems.includes(item) + ? prevSelectedItems.filter((selectedItem) => selectedItem !== item) + : [...prevSelectedItems, item] + ); + }; + + return ( + + {items.map((item) => ( + handleItemClick(item)} + > + + + source + + + {item.name} + + {item.numberOfInstances} running instances · {item.kind} + + + + {selectedItems.includes(item) && ( + + + SELECTED + + + )} + + ))} + + ); +}; + +export { SourcesList }; diff --git a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/index.ts b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/index.ts new file mode 100644 index 000000000..892c7ba07 --- /dev/null +++ b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/index.ts @@ -0,0 +1,2 @@ +export * from './search-and-dropdown'; +export * from './toggles-and-checkboxes'; diff --git a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/search-and-dropdown.tsx b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/search-and-dropdown.tsx new file mode 100644 index 000000000..abf53b1be --- /dev/null +++ b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/search-and-dropdown.tsx @@ -0,0 +1,37 @@ +import React from 'react'; +import styled from 'styled-components'; +import { SearchDropdownProps } from './type'; +import { Input, Dropdown } from '@/reuseable-components'; + +const Container = styled.div` + display: flex; + gap: 8px; + margin-top: 24px; +`; + +const SearchAndDropdown: React.FC = ({ + state, + handlers, + dropdownOptions, +}) => { + const { selectedOption, searchFilter } = state; + const { setSelectedOption, setSearchFilter } = handlers; + + return ( + + setSearchFilter(e.target.value)} + /> + + + ); +}; + +export { SearchAndDropdown }; diff --git a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/toggles-and-checkboxes.tsx b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/toggles-and-checkboxes.tsx new file mode 100644 index 000000000..5a7c604db --- /dev/null +++ b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/toggles-and-checkboxes.tsx @@ -0,0 +1,60 @@ +import React from 'react'; +import styled from 'styled-components'; +import { Counter, Toggle, Checkbox } from '@/reuseable-components'; +import { ToggleCheckboxHandlers, ToggleCheckboxState } from './type'; + +const Container = styled.div` + display: flex; + justify-content: space-between; + align-items: center; +`; + +const ToggleWrapper = styled.div` + display: flex; + gap: 32px; +`; + +type ToggleCheckboxProps = { + state: ToggleCheckboxState; + handlers: ToggleCheckboxHandlers; +}; + +const TogglesAndCheckboxes: React.FC = ({ + state, + handlers, +}) => { + const { + selectedAppsCount, + selectAllCheckbox, + showSelectedOnly, + futureAppsCheckbox, + } = state; + + const { setSelectAllCheckbox, setShowSelectedOnly, setFutureAppsCheckbox } = + handlers; + return ( + + + + + + + + + ); +}; + +export { TogglesAndCheckboxes }; diff --git a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/type.ts b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/type.ts new file mode 100644 index 000000000..530473dd8 --- /dev/null +++ b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/type.ts @@ -0,0 +1,30 @@ +import { DropdownOption } from '@/types'; + +export type ToggleCheckboxState = { + selectedAppsCount: number; + selectAllCheckbox: boolean; + showSelectedOnly: boolean; + futureAppsCheckbox: boolean; +}; + +export type ToggleCheckboxHandlers = { + setSelectAllCheckbox: (value: boolean) => void; + setShowSelectedOnly: (value: boolean) => void; + setFutureAppsCheckbox: (value: boolean) => void; +}; + +export type SearchDropdownState = { + selectedOption: DropdownOption | undefined; + searchFilter: string; +}; + +export type SearchDropdownHandlers = { + setSelectedOption: (option: DropdownOption) => void; + setSearchFilter: (search: string) => void; +}; + +export type SearchDropdownProps = { + state: SearchDropdownState; + handlers: SearchDropdownHandlers; + dropdownOptions: DropdownOption[]; +}; diff --git a/frontend/webapp/containers/main/sources/choose-sources/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/index.tsx new file mode 100644 index 000000000..dec62cc78 --- /dev/null +++ b/frontend/webapp/containers/main/sources/choose-sources/index.tsx @@ -0,0 +1,124 @@ +import React, { useEffect, useState } from 'react'; +import { useComputePlatform } from '@/hooks'; +import { SourcesList } from './choose-sources-list'; +import { SectionTitle, Divider } from '@/reuseable-components'; +import { DropdownOption, K8sActualNamespace, K8sActualSource } from '@/types'; +import { SearchAndDropdown, TogglesAndCheckboxes } from './choose-sources-menu'; +import { + SearchDropdownHandlers, + SearchDropdownState, + ToggleCheckboxHandlers, + ToggleCheckboxState, +} from './choose-sources-menu/type'; + +export function ChooseSourcesContainer() { + const [searchFilter, setSearchFilter] = useState(''); + const [showSelectedOnly, setShowSelectedOnly] = useState(false); + const [selectAllCheckbox, setSelectAllCheckbox] = useState(false); + const [futureAppsCheckbox, setFutureAppsCheckbox] = useState(false); + const [selectedOption, setSelectedOption] = useState(); + const [selectedItems, setSelectedItems] = useState([]); + const [namespacesList, setNamespacesList] = useState([]); + + const { error, data } = useComputePlatform(); + + useEffect(() => { + data && buildNamespacesList(); + }, [data, error]); + + useEffect(() => { + selectAllCheckbox ? selectAllSources() : unselectAllSources(); + }, [selectAllCheckbox]); + + function buildNamespacesList() { + const namespaces = data?.computePlatform?.k8sActualNamespaces || []; + const namespacesList = namespaces.map((namespace: K8sActualNamespace) => ({ + id: namespace.name, + value: namespace.name, + })); + + setSelectedOption(namespacesList[0]); + setNamespacesList(namespacesList); + } + + function filterSources(sources: K8sActualSource[]) { + return sources.filter((source: K8sActualSource) => { + return ( + searchFilter === '' || + source.name.toLowerCase().includes(searchFilter.toLowerCase()) + ); + }); + } + + function selectAllSources() { + const allSources = + data?.computePlatform?.k8sActualNamespaces.flatMap( + (namespace) => namespace.k8sActualSources + ) || []; + setSelectedItems(allSources); + } + + function unselectAllSources() { + setSelectedItems([]); + } + + function getVisibleSources() { + const allSources = + data?.computePlatform?.k8sActualNamespaces[0].k8sActualSources || []; + const filteredSources = searchFilter + ? filterSources(allSources) + : allSources; + + return showSelectedOnly + ? filteredSources.filter((source) => selectedItems.includes(source)) + : filteredSources; + } + + const toggleCheckboxState: ToggleCheckboxState = { + selectedAppsCount: selectedItems.length, + selectAllCheckbox, + showSelectedOnly, + futureAppsCheckbox, + }; + + const toggleCheckboxHandlers: ToggleCheckboxHandlers = { + setSelectAllCheckbox, + setShowSelectedOnly, + setFutureAppsCheckbox, + }; + + const searchDropdownState: SearchDropdownState = { + selectedOption, + searchFilter, + }; + + const searchDropdownHandlers: SearchDropdownHandlers = { + setSelectedOption, + setSearchFilter, + }; + + return ( + <> + + + + + + + + ); +} diff --git a/frontend/webapp/containers/main/sources/index.ts b/frontend/webapp/containers/main/sources/index.ts index 0a28eb6b8..c81126c2b 100644 --- a/frontend/webapp/containers/main/sources/index.ts +++ b/frontend/webapp/containers/main/sources/index.ts @@ -1,3 +1,4 @@ export * from './managed'; export * from './choose.sources'; +export * from './choose-sources'; export * from './edit.source'; diff --git a/frontend/webapp/graphql/queries/compute-platform.ts b/frontend/webapp/graphql/queries/compute-platform.ts new file mode 100644 index 000000000..6d1f3244a --- /dev/null +++ b/frontend/webapp/graphql/queries/compute-platform.ts @@ -0,0 +1,19 @@ +import { gql } from '@apollo/client'; + +export const GET_COMPUTE_PLATFORM = gql` + query GetComputePlatform($cpId: ID!) { + computePlatform(cpId: $cpId) { + id + name + computePlatformType + k8sActualNamespaces { + name + k8sActualSources { + name + kind + numberOfInstances + } + } + } + } +`; diff --git a/frontend/webapp/graphql/queries/index.ts b/frontend/webapp/graphql/queries/index.ts index f03c2281a..a4ba77920 100644 --- a/frontend/webapp/graphql/queries/index.ts +++ b/frontend/webapp/graphql/queries/index.ts @@ -1 +1,2 @@ export * from './config'; +export * from './compute-platform'; diff --git a/frontend/webapp/hooks/compute-platform/index.ts b/frontend/webapp/hooks/compute-platform/index.ts new file mode 100644 index 000000000..f535085ea --- /dev/null +++ b/frontend/webapp/hooks/compute-platform/index.ts @@ -0,0 +1 @@ +export * from './useComputePlatform'; diff --git a/frontend/webapp/hooks/compute-platform/useComputePlatform.ts b/frontend/webapp/hooks/compute-platform/useComputePlatform.ts new file mode 100644 index 000000000..76d9f00f6 --- /dev/null +++ b/frontend/webapp/hooks/compute-platform/useComputePlatform.ts @@ -0,0 +1,20 @@ +import { ComputePlatform } from '@/types'; +import { useQuery } from '@apollo/client'; +import { GET_COMPUTE_PLATFORM } from '@/graphql'; + +type UseComputePlatformHook = { + data?: ComputePlatform; + loading: boolean; + error?: Error; +}; + +export const useComputePlatform = (): UseComputePlatformHook => { + const { data, loading, error } = useQuery( + GET_COMPUTE_PLATFORM, + { + variables: { cpId: '1' }, + } + ); + + return { data, loading, error }; +}; diff --git a/frontend/webapp/hooks/index.tsx b/frontend/webapp/hooks/index.tsx index 7bae585c0..44c4a33e1 100644 --- a/frontend/webapp/hooks/index.tsx +++ b/frontend/webapp/hooks/index.tsx @@ -8,3 +8,4 @@ export * from './actions'; export * from './useNotify'; export * from './useSSE'; export * from './new-config'; +export * from './compute-platform'; diff --git a/frontend/webapp/reuseable-components/dropdown/index.tsx b/frontend/webapp/reuseable-components/dropdown/index.tsx index f6a2c2a6e..b43634117 100644 --- a/frontend/webapp/reuseable-components/dropdown/index.tsx +++ b/frontend/webapp/reuseable-components/dropdown/index.tsx @@ -5,11 +5,13 @@ import { Tooltip } from '../tooltip'; import Image from 'next/image'; import { Text } from '../text'; import { Divider } from '../divider'; +import { DropdownOption } from '@/types'; +import { useOnClickOutside } from '@/hooks'; interface DropdownProps { - options: string[]; - selectedOption: string; - onSelect: (option: string) => void; + options: DropdownOption[]; + selectedOption: DropdownOption | undefined; + onSelect: (option: DropdownOption) => void; title?: string; tooltip?: string; } @@ -112,11 +114,13 @@ const Dropdown: React.FC = ({ const [searchTerm, setSearchTerm] = useState(''); const dropdownRef = useRef(null); + useOnClickOutside(dropdownRef, () => setIsOpen(false)); + const filteredOptions = options.filter((option) => - option.toLowerCase().includes(searchTerm.toLowerCase()) + option.value.toLowerCase().includes(searchTerm.toLowerCase()) ); - const handleSelect = (option: string) => { + const handleSelect = (option: DropdownOption) => { onSelect(option); setIsOpen(false); }; @@ -139,7 +143,7 @@ const Dropdown: React.FC = ({ )} setIsOpen(!isOpen)}> - {selectedOption} + {selectedOption?.value} = ({ {filteredOptions.map((option) => ( handleSelect(option)} > - {option} + {option.value} - {option === selectedOption && ( + {option.id === selectedOption?.id && ( Date: Mon, 29 Jul 2024 14:17:10 +0300 Subject: [PATCH 112/374] chore: wip --- .../containers/setup/sources/sources-list.tsx | 123 ------------------ 1 file changed, 123 deletions(-) delete mode 100644 frontend/webapp/containers/setup/sources/sources-list.tsx diff --git a/frontend/webapp/containers/setup/sources/sources-list.tsx b/frontend/webapp/containers/setup/sources/sources-list.tsx deleted file mode 100644 index 4e823e45d..000000000 --- a/frontend/webapp/containers/setup/sources/sources-list.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import { Text } from '@/reuseable-components'; -import Image from 'next/image'; -import React, { useState } from 'react'; -import styled from 'styled-components'; - -const Container = styled.div` - display: flex; - flex-direction: column; - align-items: flex-start; - gap: 12px; - align-self: stretch; - border-radius: 16px; - background: ${({ theme }) => theme.colors.primary}; - height: 100%; - max-height: 548px; - overflow-y: auto; -`; - -const ListItem = styled.div<{ selected: boolean }>` - display: flex; - align-items: center; - justify-content: space-between; - width: 100%; - padding: 16px 0px; - transition: background 0.3s; - border-radius: 16px; - - cursor: pointer; - background: ${({ selected }) => - selected ? 'rgba(68, 74, 217, 0.24)' : 'rgba(249, 249, 249, 0.04)'}; - - &:hover { - background: rgba(68, 74, 217, 0.24); - } -`; - -const ListItemContent = styled.div` - margin-left: 16px; - display: flex; - gap: 12px; -`; - -const SourceIconWrapper = styled.div` - display: flex; - width: 36px; - height: 36px; - justify-content: center; - align-items: center; - gap: 8px; - border-radius: 8px; - background: linear-gradient( - 180deg, - rgba(249, 249, 249, 0.06) 0%, - rgba(249, 249, 249, 0.02) 100% - ); -`; - -const TextWrapper = styled.div` - display: flex; - flex-direction: column; - height: 36px; - justify-content: space-between; -`; - -const SelectedTextWrapper = styled.div` - margin-right: 24px; -`; - -interface K8sActualSource { - name: string; - kind: string; - numberOfInstances: number; -} - -const SourcesList: React.FC<{ items: K8sActualSource[] }> = ({ items }) => { - const [selectedItems, setSelectedItems] = useState([]); - - const handleItemClick = (name: string) => { - setSelectedItems((prevSelectedItems) => - prevSelectedItems.includes(name) - ? prevSelectedItems.filter((item) => item !== name) - : [...prevSelectedItems, name] - ); - }; - - return ( - - {items.map((item) => ( - handleItemClick(item.name)} - > - - - source - - - {item.name} - - {item.numberOfInstances} running instances · {item.kind} - - - - {selectedItems.includes(item.name) && ( - - - SELECTED - - - )} - - ))} - - ); -}; - -export { SourcesList }; From 0a6d4aff8573707e12efe6df415fa7401af7568b Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 29 Jul 2024 14:59:07 +0300 Subject: [PATCH 113/374] chore: change endpoints folder to service --- frontend/endpoints/applications.go | 22 -- frontend/graph/conversions.go | 8 +- frontend/graph/schema.resolvers.go | 9 +- frontend/services/applications.go | 195 ++++++++++++++++++ frontend/services/namespaces.go | 178 ++++++++++++++++ .../actual-sources.go => services/sources.go} | 104 +++++++++- frontend/services/utils.go | 52 +++++ 7 files changed, 537 insertions(+), 31 deletions(-) create mode 100644 frontend/services/applications.go create mode 100644 frontend/services/namespaces.go rename frontend/{endpoints/actual-sources.go => services/sources.go} (56%) create mode 100644 frontend/services/utils.go diff --git a/frontend/endpoints/applications.go b/frontend/endpoints/applications.go index a16df40e6..a29346cf0 100644 --- a/frontend/endpoints/applications.go +++ b/frontend/endpoints/applications.go @@ -75,28 +75,6 @@ func GetApplicationsInNamespace(c *gin.Context) { }) } -func GetApplicationsInK8SNamespace(ctx context.Context, ns string) []GetApplicationItemInNamespace { - - namespace, err := kube.DefaultClient.CoreV1().Namespaces().Get(ctx, ns, metav1.GetOptions{}) - if err != nil { - - return nil - } - - items, err := getApplicationsInNamespace(ctx, namespace.Name, map[string]*bool{namespace.Name: isObjectLabeledForInstrumentation(namespace.ObjectMeta)}) - if err != nil { - - return nil - } - - apps := make([]GetApplicationItemInNamespace, len(items)) - for i, item := range items { - apps[i] = item.nsItem - } - - return apps -} - // getApplicationsInNamespace returns all applications in the namespace and their instrumentation status. // nsName can be an empty string to get applications in all namespaces. // nsInstrumentedMap is a map of namespace name to a boolean pointer indicating if the namespace is instrumented. diff --git a/frontend/graph/conversions.go b/frontend/graph/conversions.go index 936727a48..6f8cc6010 100644 --- a/frontend/graph/conversions.go +++ b/frontend/graph/conversions.go @@ -3,8 +3,8 @@ package graph import ( "time" - "github.com/odigos-io/odigos/frontend/endpoints" gqlmodel "github.com/odigos-io/odigos/frontend/graph/model" + "github.com/odigos-io/odigos/frontend/services" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -41,7 +41,7 @@ func k8sLastTransitionTimeToGql(t v1.Time) *string { return &str } -func k8sThinSourceToGql(k8sSource *endpoints.ThinSource) *gqlmodel.K8sActualSource { +func k8sThinSourceToGql(k8sSource *services.ThinSource) *gqlmodel.K8sActualSource { hasInstrumentedApplication := k8sSource.IaDetails != nil @@ -79,7 +79,7 @@ func k8sThinSourceToGql(k8sSource *endpoints.ThinSource) *gqlmodel.K8sActualSour } } -func k8sSourceToGql(k8sSource *endpoints.Source) *gqlmodel.K8sActualSource { +func k8sSourceToGql(k8sSource *services.Source) *gqlmodel.K8sActualSource { baseSource := k8sThinSourceToGql(&k8sSource.ThinSource) return &gqlmodel.K8sActualSource{ Namespace: baseSource.Namespace, @@ -91,7 +91,7 @@ func k8sSourceToGql(k8sSource *endpoints.Source) *gqlmodel.K8sActualSource { } } -func k8sApplicationItemToGql(appItem *endpoints.GetApplicationItemInNamespace) *gqlmodel.K8sActualSource { +func k8sApplicationItemToGql(appItem *services.GetApplicationItemInNamespace) *gqlmodel.K8sActualSource { stringKind := string(appItem.Kind) diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index d54ccbe98..8e0f8a886 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -10,11 +10,12 @@ import ( "github.com/odigos-io/odigos/frontend/endpoints" "github.com/odigos-io/odigos/frontend/graph/model" + "github.com/odigos-io/odigos/frontend/services" ) // K8sActualSource is the resolver for the k8sActualSource field. func (r *computePlatformResolver) K8sActualSource(ctx context.Context, obj *model.ComputePlatform, name *string, namespace *string, kind *string) (*model.K8sActualSource, error) { - source, err := endpoints.GetActualSource(ctx, *namespace, *kind, *name) + source, err := services.GetActualSource(ctx, *namespace, *kind, *name) if err != nil { return nil, err } @@ -33,19 +34,19 @@ func (r *mutationResolver) CreateK8sDesiredNamespace(ctx context.Context, cpID s // ComputePlatform is the resolver for the computePlatform field. func (r *queryResolver) ComputePlatform(ctx context.Context, cpID string) (*model.ComputePlatform, error) { - k8sActualSources := endpoints.GetActualSources(ctx, "odigos-system") + k8sActualSources := services.GetActualSources(ctx, "odigos-system") res := make([]*model.K8sActualSource, len(k8sActualSources)) for i, source := range k8sActualSources { res[i] = k8sThinSourceToGql(&source) } name := "odigos-system" - namespacesResponse := endpoints.GetK8SNamespaces(ctx, name) + namespacesResponse := services.GetK8SNamespaces(ctx, name) K8sActualNamespaces := make([]*model.K8sActualNamespace, len(namespacesResponse.Namespaces)) for i, namespace := range namespacesResponse.Namespaces { - namespaceActualSources := endpoints.GetApplicationsInK8SNamespace(ctx, namespace.Name) + namespaceActualSources := services.GetApplicationsInK8SNamespace(ctx, namespace.Name) namespaceSources := make([]*model.K8sActualSource, len(namespaceActualSources)) for j, source := range namespaceActualSources { namespaceSources[j] = k8sApplicationItemToGql(&source) diff --git a/frontend/services/applications.go b/frontend/services/applications.go new file mode 100644 index 000000000..012310216 --- /dev/null +++ b/frontend/services/applications.go @@ -0,0 +1,195 @@ +package services + +import ( + "context" + + appsv1 "k8s.io/api/apps/v1" + + "github.com/odigos-io/odigos/k8sutils/pkg/client" + + "github.com/odigos-io/odigos/frontend/kube" + "golang.org/x/sync/errgroup" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type GetApplicationsInNamespaceRequest struct { + Namespace string `uri:"namespace" binding:"required"` +} + +type GetApplicationsInNamespaceResponse struct { + Applications []GetApplicationItemInNamespace `json:"applications"` +} + +type WorkloadKind string + +const ( + WorkloadKindDeployment WorkloadKind = "Deployment" + WorkloadKindStatefulSet WorkloadKind = "StatefulSet" + WorkloadKindDaemonSet WorkloadKind = "DaemonSet" +) + +type GetApplicationItemInNamespace struct { + Name string `json:"name"` + Kind WorkloadKind `json:"kind"` + Instances int `json:"instances"` + AppInstrumentationLabeled *bool `json:"app_instrumentation_labeled"` + NsInstrumentationLabeled *bool `json:"ns_instrumentation_labeled"` + InstrumentationEffective bool `json:"instrumentation_effective"` +} + +type GetApplicationItem struct { + // namespace is used when querying all the namespaces, the response can be grouped/filtered by namespace + namespace string + nsItem GetApplicationItemInNamespace +} + +func GetApplicationsInK8SNamespace(ctx context.Context, ns string) []GetApplicationItemInNamespace { + + namespace, err := kube.DefaultClient.CoreV1().Namespaces().Get(ctx, ns, metav1.GetOptions{}) + if err != nil { + + return nil + } + + items, err := getApplicationsInNamespace(ctx, namespace.Name, map[string]*bool{namespace.Name: isObjectLabeledForInstrumentation(namespace.ObjectMeta)}) + if err != nil { + + return nil + } + + apps := make([]GetApplicationItemInNamespace, len(items)) + for i, item := range items { + apps[i] = item.nsItem + } + + return apps +} + +// getApplicationsInNamespace returns all applications in the namespace and their instrumentation status. +// nsName can be an empty string to get applications in all namespaces. +// nsInstrumentedMap is a map of namespace name to a boolean pointer indicating if the namespace is instrumented. +func getApplicationsInNamespace(ctx context.Context, nsName string, nsInstrumentedMap map[string]*bool) ([]GetApplicationItem, error) { + g, ctx := errgroup.WithContext(ctx) + var ( + deps []GetApplicationItem + ss []GetApplicationItem + dss []GetApplicationItem + ) + + g.Go(func() error { + var err error + deps, err = getDeployments(nsName, ctx) + return err + }) + + g.Go(func() error { + var err error + ss, err = getStatefulSets(nsName, ctx) + return err + }) + + g.Go(func() error { + var err error + dss, err = getDaemonSets(nsName, ctx) + return err + }) + + if err := g.Wait(); err != nil { + return nil, err + } + + items := make([]GetApplicationItem, len(deps)+len(ss)+len(dss)) + copy(items, deps) + copy(items[len(deps):], ss) + copy(items[len(deps)+len(ss):], dss) + + for i := range items { + item := &items[i] + // check if the entire namespace is instrumented + // as it affects the applications in the namespace + // which use this label to determine if they should be instrumented + nsInstrumentationLabeled := nsInstrumentedMap[item.namespace] + item.nsItem.NsInstrumentationLabeled = nsInstrumentationLabeled + appInstrumented := (item.nsItem.AppInstrumentationLabeled != nil && *item.nsItem.AppInstrumentationLabeled) + appInstrumentationInherited := item.nsItem.AppInstrumentationLabeled == nil + nsInstrumented := (nsInstrumentationLabeled != nil && *nsInstrumentationLabeled) + item.nsItem.InstrumentationEffective = appInstrumented || (appInstrumentationInherited && nsInstrumented) + } + + return items, nil +} + +func getDeployments(namespace string, ctx context.Context) ([]GetApplicationItem, error) { + var response []GetApplicationItem + err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.AppsV1().Deployments(namespace).List, ctx, metav1.ListOptions{}, func(deps *appsv1.DeploymentList) error { + for _, dep := range deps.Items { + appInstrumentationLabeled := isObjectLabeledForInstrumentation(dep.ObjectMeta) + response = append(response, GetApplicationItem{ + namespace: dep.Namespace, + nsItem: GetApplicationItemInNamespace{ + Name: dep.Name, + Kind: WorkloadKindDeployment, + Instances: int(dep.Status.AvailableReplicas), + AppInstrumentationLabeled: appInstrumentationLabeled, + }, + }) + } + return nil + }) + + if err != nil { + return nil, err + } + + return response, nil +} + +func getStatefulSets(namespace string, ctx context.Context) ([]GetApplicationItem, error) { + var response []GetApplicationItem + err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.AppsV1().StatefulSets(namespace).List, ctx, metav1.ListOptions{}, func(sss *appsv1.StatefulSetList) error { + for _, ss := range sss.Items { + appInstrumentationLabeled := isObjectLabeledForInstrumentation(ss.ObjectMeta) + response = append(response, GetApplicationItem{ + namespace: ss.Namespace, + nsItem: GetApplicationItemInNamespace{ + Name: ss.Name, + Kind: WorkloadKindStatefulSet, + Instances: int(ss.Status.ReadyReplicas), + AppInstrumentationLabeled: appInstrumentationLabeled, + }, + }) + } + return nil + }) + + if err != nil { + return nil, err + } + + return response, nil +} + +func getDaemonSets(namespace string, ctx context.Context) ([]GetApplicationItem, error) { + var response []GetApplicationItem + err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.AppsV1().DaemonSets(namespace).List, ctx, metav1.ListOptions{}, func(dss *appsv1.DaemonSetList) error { + for _, ds := range dss.Items { + appInstrumentationLabeled := isObjectLabeledForInstrumentation(ds.ObjectMeta) + response = append(response, GetApplicationItem{ + namespace: ds.Namespace, + nsItem: GetApplicationItemInNamespace{ + Name: ds.Name, + Kind: WorkloadKindDaemonSet, + Instances: int(ds.Status.NumberReady), + AppInstrumentationLabeled: appInstrumentationLabeled, + }, + }) + } + return nil + }) + + if err != nil { + return nil, err + } + + return response, nil +} diff --git a/frontend/services/namespaces.go b/frontend/services/namespaces.go new file mode 100644 index 000000000..62282aa4c --- /dev/null +++ b/frontend/services/namespaces.go @@ -0,0 +1,178 @@ +package services + +import ( + "context" + "fmt" + + "github.com/odigos-io/odigos/k8sutils/pkg/client" + + "k8s.io/apimachinery/pkg/runtime/schema" + + "golang.org/x/sync/errgroup" + + "github.com/odigos-io/odigos/api/odigos/v1alpha1" + "github.com/odigos-io/odigos/common/consts" + "github.com/odigos-io/odigos/common/utils" + + "github.com/odigos-io/odigos/frontend/kube" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type GetNamespacesResponse struct { + Namespaces []GetNamespaceItem `json:"namespaces"` +} + +type GetNamespaceItem struct { + Name string `json:"name"` + Selected bool `json:"selected"` + TotalApps int `json:"totalApps"` +} + +func GetK8SNamespaces(ctx context.Context, odigosns string) GetNamespacesResponse { + + var ( + relevantNameSpaces []v1.Namespace + appsPerNamespace map[string]int + ) + + g, ctx := errgroup.WithContext(ctx) + g.Go(func() error { + var err error + relevantNameSpaces, err = getRelevantNameSpaces(ctx, odigosns) + return err + }) + + g.Go(func() error { + var err error + appsPerNamespace, err = CountAppsPerNamespace(ctx) + return err + }) + + if err := g.Wait(); err != nil { + + return GetNamespacesResponse{} + } + + var response GetNamespacesResponse + for _, namespace := range relevantNameSpaces { + // check if entire namespace is instrumented + selected := namespace.Labels[consts.OdigosInstrumentationLabel] == consts.InstrumentationEnabled + + response.Namespaces = append(response.Namespaces, GetNamespaceItem{ + Name: namespace.Name, + Selected: selected, + TotalApps: appsPerNamespace[namespace.Name], + }) + } + + return response +} + +// getRelevantNameSpaces returns a list of namespaces that are relevant for instrumentation. +// Taking into account the ignored namespaces from the OdigosConfiguration. +func getRelevantNameSpaces(ctx context.Context, odigosns string) ([]v1.Namespace, error) { + var ( + odigosConfig *v1alpha1.OdigosConfiguration + list *v1.NamespaceList + ) + + g, ctx := errgroup.WithContext(ctx) + g.Go(func() error { + var err error + odigosConfig, err = kube.DefaultClient.OdigosClient.OdigosConfigurations(odigosns).Get(ctx, consts.OdigosConfigurationName, metav1.GetOptions{}) + return err + }) + + g.Go(func() error { + var err error + list, err = kube.DefaultClient.CoreV1().Namespaces().List(ctx, metav1.ListOptions{}) + return err + }) + + if err := g.Wait(); err != nil { + return []v1.Namespace{}, err + } + + result := []v1.Namespace{} + for _, namespace := range list.Items { + if utils.IsItemIgnored(namespace.Name, odigosConfig.Spec.IgnoredNamespaces) { + continue + } + + result = append(result, namespace) + } + + return result, nil +} + +type PersistNamespaceItem struct { + Name string `json:"name"` + SelectedAll bool `json:"selected_all"` + FutureSelected *bool `json:"future_selected,omitempty"` + Objects []PersistNamespaceObject `json:"objects"` +} + +type PersistNamespaceObject struct { + Name string `json:"name"` + Kind WorkloadKind `json:"kind"` + Selected *bool `json:"selected,omitempty"` +} + +func getJsonMergePatchForInstrumentationLabel(enabled *bool) []byte { + labelJsonMergePatchValue := "null" + if enabled != nil { + if *enabled { + labelJsonMergePatchValue = fmt.Sprintf("\"%s\"", consts.InstrumentationEnabled) + } else { + labelJsonMergePatchValue = fmt.Sprintf("\"%s\"", consts.InstrumentationDisabled) + } + } + + jsonMergePatchContent := fmt.Sprintf(`{"metadata":{"labels":{"%s":%s}}}`, consts.OdigosInstrumentationLabel, labelJsonMergePatchValue) + return []byte(jsonMergePatchContent) +} + +func syncWorkloadsInNamespace(ctx context.Context, nsName string, workloads []PersistNamespaceObject) error { + g, ctx := errgroup.WithContext(ctx) + g.SetLimit(kube.K8sClientDefaultBurst) + + for _, workload := range workloads { + currWorkload := workload + g.Go(func() error { + // Only label selected sources, ignore the rest + if currWorkload.Selected != nil && *currWorkload.Selected { + return setWorkloadInstrumentationLabel(ctx, nsName, currWorkload.Name, currWorkload.Kind, currWorkload.Selected) + } + return nil + }) + } + return g.Wait() +} + +// returns a map, where the key is a namespace name and the value is the +// number of apps in this namespace (not necessarily instrumented) +func CountAppsPerNamespace(ctx context.Context) (map[string]int, error) { + namespaceToAppsCount := make(map[string]int) + + resourceTypes := []string{"deployments", "statefulsets", "daemonsets"} + + for _, resourceType := range resourceTypes { + err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.MetadataClient.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1", + Resource: resourceType, + }).List, ctx, metav1.ListOptions{}, func(list *metav1.PartialObjectMetadataList) error { + for _, item := range list.Items { + namespaceToAppsCount[item.Namespace]++ + } + return nil + }) + + if err != nil { + return nil, fmt.Errorf("failed to count %s: %w", resourceType, err) + } + } + + return namespaceToAppsCount, nil +} diff --git a/frontend/endpoints/actual-sources.go b/frontend/services/sources.go similarity index 56% rename from frontend/endpoints/actual-sources.go rename to frontend/services/sources.go index 237dbff86..65faf79d5 100644 --- a/frontend/endpoints/actual-sources.go +++ b/frontend/services/sources.go @@ -1,8 +1,9 @@ -package endpoints +package services import ( "context" "fmt" + "time" "github.com/odigos-io/odigos/api/odigos/v1alpha1" "github.com/odigos-io/odigos/common/consts" @@ -13,6 +14,38 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +type SourceLanguage struct { + ContainerName string `json:"container_name"` + Language string `json:"language"` +} + +type InstrumentedApplicationDetails struct { + Languages []SourceLanguage `json:"languages,omitempty"` + Conditions []metav1.Condition `json:"conditions,omitempty"` +} +type SourceID struct { + // combination of namespace, kind and name is unique + Name string `json:"name"` + Kind string `json:"kind"` + Namespace string `json:"namespace"` +} + +type Source struct { + ThinSource + ReportedName string `json:"reported_name,omitempty"` +} + +type PatchSourceRequest struct { + ReportedName *string `json:"reported_name"` +} + +// this object contains only part of the source fields. It is used to display the sources in the frontend +type ThinSource struct { + SourceID + NumberOfRunningInstances int `json:"number_of_running_instances"` + IaDetails *InstrumentedApplicationDetails `json:"instrumented_application_details"` +} + func GetActualSources(ctx context.Context, odigosns string) []ThinSource { return getSourcesForNamespace(ctx, odigosns) } @@ -139,3 +172,72 @@ func getWorkload(c context.Context, ns string, kind string, name string) (metav1 return nil, 0 } } + +func addHealthyInstrumentationInstancesCondition(ctx context.Context, app *v1alpha1.InstrumentedApplication, source *ThinSource) error { + labelSelector := fmt.Sprintf("%s=%s", consts.InstrumentedAppNameLabel, app.Name) + instancesList, err := kube.DefaultClient.OdigosClient.InstrumentationInstances(app.Namespace).List(ctx, metav1.ListOptions{ + LabelSelector: labelSelector, + }) + + if err != nil { + return err + } + + totalInstances := len(instancesList.Items) + if totalInstances == 0 { + // no instances so nothing to report + return nil + } + + healthyInstances := 0 + latestStatusTime := metav1.NewTime(time.Time{}) + for _, instance := range instancesList.Items { + if instance.Status.Healthy != nil && *instance.Status.Healthy { + healthyInstances++ + } + if instance.Status.LastStatusTime.After(latestStatusTime.Time) { + latestStatusTime = instance.Status.LastStatusTime + } + } + + status := metav1.ConditionTrue + if healthyInstances < totalInstances { + status = metav1.ConditionFalse + } + + source.IaDetails.Conditions = append(source.IaDetails.Conditions, metav1.Condition{ + Type: "HealthyInstrumentationInstances", + Status: status, + LastTransitionTime: latestStatusTime, + Message: fmt.Sprintf("%d/%d instances are healthy", healthyInstances, totalInstances), + }) + + return nil +} + +func k8sInstrumentedAppToThinSource(app *v1alpha1.InstrumentedApplication) ThinSource { + var source ThinSource + source.Name = app.OwnerReferences[0].Name + source.Kind = app.OwnerReferences[0].Kind + source.Namespace = app.Namespace + var conditions []metav1.Condition + for _, condition := range app.Status.Conditions { + conditions = append(conditions, metav1.Condition{ + Type: condition.Type, + Status: condition.Status, + Message: condition.Message, + LastTransitionTime: condition.LastTransitionTime, + }) + } + source.IaDetails = &InstrumentedApplicationDetails{ + Languages: []SourceLanguage{}, + Conditions: conditions, + } + for _, language := range app.Spec.RuntimeDetails { + source.IaDetails.Languages = append(source.IaDetails.Languages, SourceLanguage{ + ContainerName: language.ContainerName, + Language: string(language.Language), + }) + } + return source +} diff --git a/frontend/services/utils.go b/frontend/services/utils.go new file mode 100644 index 000000000..e41f28d6b --- /dev/null +++ b/frontend/services/utils.go @@ -0,0 +1,52 @@ +package services + +import ( + "context" + "errors" + "path" + + "github.com/odigos-io/odigos/common/consts" + "github.com/odigos-io/odigos/frontend/kube" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +const cdnUrl = "https://d15jtxgb40qetw.cloudfront.net" + +func GetImageURL(image string) string { + return path.Join(cdnUrl, image) +} + +func setWorkloadInstrumentationLabel(ctx context.Context, nsName string, workloadName string, workloadKind WorkloadKind, enabled *bool) error { + jsonMergePatchData := getJsonMergePatchForInstrumentationLabel(enabled) + + switch workloadKind { + case WorkloadKindDeployment: + _, err := kube.DefaultClient.AppsV1().Deployments(nsName).Patch(ctx, workloadName, types.MergePatchType, jsonMergePatchData, metav1.PatchOptions{}) + return err + case WorkloadKindStatefulSet: + _, err := kube.DefaultClient.AppsV1().StatefulSets(nsName).Patch(ctx, workloadName, types.MergePatchType, jsonMergePatchData, metav1.PatchOptions{}) + return err + case WorkloadKindDaemonSet: + _, err := kube.DefaultClient.AppsV1().DaemonSets(nsName).Patch(ctx, workloadName, types.MergePatchType, jsonMergePatchData, metav1.PatchOptions{}) + return err + default: + return errors.New("unsupported workload kind " + string(workloadKind)) + } +} + +// getNsInstrumentedLabel return the instrumentation label of the object. +// if the object is not labeled, it returns nil +func isObjectLabeledForInstrumentation(metav metav1.ObjectMeta) *bool { + labels := metav.GetLabels() + if labels == nil { + return nil + } + namespaceInstrumented, found := labels[consts.OdigosInstrumentationLabel] + var nsInstrumentationLabeled *bool + if found { + instrumentationLabel := namespaceInstrumented == consts.InstrumentationEnabled + nsInstrumentationLabeled = &instrumentationLabel + } + return nsInstrumentationLabeled +} From f7f1a177feeaf204dd354968f8fa661f0981075a Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 29 Jul 2024 15:19:14 +0300 Subject: [PATCH 114/374] chore: update endpoints --- frontend/gqlgen.yml | 2 + frontend/graph/generated.go | 141 +++++++++-------------------- frontend/graph/model/models_gen.go | 1 - frontend/graph/schema.graphqls | 3 +- frontend/graph/schema.resolvers.go | 16 +++- 5 files changed, 60 insertions(+), 103 deletions(-) diff --git a/frontend/gqlgen.yml b/frontend/gqlgen.yml index 16744a23f..ec2e32555 100644 --- a/frontend/gqlgen.yml +++ b/frontend/gqlgen.yml @@ -39,5 +39,7 @@ models: ComputePlatform: fields: + k8sActualNamespace: + resolver: true k8sActualSource: resolver: true diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index f85cf9f8c..82ba75e52 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -50,7 +50,6 @@ type DirectiveRoot struct { type ComplexityRoot struct { ComputePlatform struct { ComputePlatformType func(childComplexity int) int - ID func(childComplexity int) int K8sActualNamespace func(childComplexity int, name string) int K8sActualNamespaces func(childComplexity int) int K8sActualSource func(childComplexity int, name *string, namespace *string, kind *string) int @@ -107,7 +106,7 @@ type ComplexityRoot struct { } Query struct { - ComputePlatform func(childComplexity int, cpID string) int + ComputePlatform func(childComplexity int) int Config func(childComplexity int) int } @@ -118,13 +117,15 @@ type ComplexityRoot struct { } type ComputePlatformResolver interface { + K8sActualNamespace(ctx context.Context, obj *model.ComputePlatform, name string) (*model.K8sActualNamespace, error) + K8sActualSource(ctx context.Context, obj *model.ComputePlatform, name *string, namespace *string, kind *string) (*model.K8sActualSource, error) } type MutationResolver interface { CreateK8sDesiredNamespace(ctx context.Context, cpID string, namespace model.K8sDesiredNamespaceInput) (*model.K8sActualNamespace, error) } type QueryResolver interface { - ComputePlatform(ctx context.Context, cpID string) (*model.ComputePlatform, error) + ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) Config(ctx context.Context) (*model.GetConfigResponse, error) } @@ -154,13 +155,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ComputePlatform.ComputePlatformType(childComplexity), true - case "ComputePlatform.id": - if e.complexity.ComputePlatform.ID == nil { - break - } - - return e.complexity.ComputePlatform.ID(childComplexity), true - case "ComputePlatform.k8sActualNamespace": if e.complexity.ComputePlatform.K8sActualNamespace == nil { break @@ -384,12 +378,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - args, err := ec.field_Query_computePlatform_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.ComputePlatform(childComplexity, args["cpId"].(string)), true + return e.complexity.Query.ComputePlatform(childComplexity), true case "Query.config": if e.complexity.Query.Config == nil { @@ -627,21 +616,6 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_computePlatform_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["cpId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) - arg0, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cpId"] = arg0 - return args, nil -} - func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -680,50 +654,6 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** -func (ec *executionContext) _ComputePlatform_id(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ComputePlatform_id(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_ComputePlatform_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ComputePlatform", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _ComputePlatform_name(ctx context.Context, field graphql.CollectedField, obj *model.ComputePlatform) (ret graphql.Marshaler) { fc, err := ec.fieldContext_ComputePlatform_name(ctx, field) if err != nil { @@ -823,7 +753,7 @@ func (ec *executionContext) _ComputePlatform_k8sActualNamespace(ctx context.Cont }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.K8sActualNamespace, nil + return ec.resolvers.ComputePlatform().K8sActualNamespace(rctx, obj, fc.Args["name"].(string)) }) if err != nil { ec.Error(ctx, err) @@ -841,8 +771,8 @@ func (ec *executionContext) fieldContext_ComputePlatform_k8sActualNamespace(ctx fc = &graphql.FieldContext{ Object: "ComputePlatform", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "name": @@ -2157,7 +2087,7 @@ func (ec *executionContext) _Query_computePlatform(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().ComputePlatform(rctx, fc.Args["cpId"].(string)) + return ec.resolvers.Query().ComputePlatform(rctx) }) if err != nil { ec.Error(ctx, err) @@ -2171,7 +2101,7 @@ func (ec *executionContext) _Query_computePlatform(ctx context.Context, field gr return ec.marshalOComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_computePlatform(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_computePlatform(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -2179,8 +2109,6 @@ func (ec *executionContext) fieldContext_Query_computePlatform(ctx context.Conte IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_ComputePlatform_id(ctx, field) case "name": return ec.fieldContext_ComputePlatform_name(ctx, field) case "computePlatformType": @@ -2197,17 +2125,6 @@ func (ec *executionContext) fieldContext_Query_computePlatform(ctx context.Conte return nil, fmt.Errorf("no field named %q was found under type ComputePlatform", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_computePlatform_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } @@ -4394,11 +4311,6 @@ func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.Select switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("ComputePlatform") - case "id": - out.Values[i] = ec._ComputePlatform_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } case "name": out.Values[i] = ec._ComputePlatform_name(ctx, field, obj) case "computePlatformType": @@ -4407,7 +4319,38 @@ func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.Select atomic.AddUint32(&out.Invalids, 1) } case "k8sActualNamespace": - out.Values[i] = ec._ComputePlatform_k8sActualNamespace(ctx, field, obj) + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ComputePlatform_k8sActualNamespace(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "k8sActualNamespaces": out.Values[i] = ec._ComputePlatform_k8sActualNamespaces(ctx, field, obj) if out.Values[i] == graphql.Null { diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index 53ab6b877..f171a4d40 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -9,7 +9,6 @@ import ( ) type ComputePlatform struct { - ID string `json:"id"` Name *string `json:"name,omitempty"` ComputePlatformType ComputePlatformType `json:"computePlatformType"` K8sActualNamespace *K8sActualNamespace `json:"k8sActualNamespace,omitempty"` diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index 09ed84053..52f97fb1e 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -107,7 +107,6 @@ input K8sSourceId { } type ComputePlatform { - id: ID! name: String computePlatformType: ComputePlatformType! k8sActualNamespace(name: String!): K8sActualNamespace @@ -127,7 +126,7 @@ type GetConfigResponse { } type Query { - computePlatform(cpId: ID!): ComputePlatform + computePlatform: ComputePlatform config: GetConfigResponse } diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 8e0f8a886..802c0bcb5 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -13,6 +13,20 @@ import ( "github.com/odigos-io/odigos/frontend/services" ) +// K8sActualNamespace is the resolver for the k8sActualNamespace field. +func (r *computePlatformResolver) K8sActualNamespace(ctx context.Context, obj *model.ComputePlatform, name string) (*model.K8sActualNamespace, error) { + namespaceActualSources := services.GetApplicationsInK8SNamespace(ctx, name) + namespaceSources := make([]*model.K8sActualSource, len(namespaceActualSources)) + for i, source := range namespaceActualSources { + namespaceSources[i] = k8sApplicationItemToGql(&source) + } + + return &model.K8sActualNamespace{ + Name: name, + K8sActualSources: namespaceSources, + }, nil +} + // K8sActualSource is the resolver for the k8sActualSource field. func (r *computePlatformResolver) K8sActualSource(ctx context.Context, obj *model.ComputePlatform, name *string, namespace *string, kind *string) (*model.K8sActualSource, error) { source, err := services.GetActualSource(ctx, *namespace, *kind, *name) @@ -33,7 +47,7 @@ func (r *mutationResolver) CreateK8sDesiredNamespace(ctx context.Context, cpID s } // ComputePlatform is the resolver for the computePlatform field. -func (r *queryResolver) ComputePlatform(ctx context.Context, cpID string) (*model.ComputePlatform, error) { +func (r *queryResolver) ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) { k8sActualSources := services.GetActualSources(ctx, "odigos-system") res := make([]*model.K8sActualSource, len(k8sActualSources)) for i, source := range k8sActualSources { From a03598468020f592718622a4af66c36141359f0d Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 29 Jul 2024 15:25:38 +0300 Subject: [PATCH 115/374] chore: wip --- frontend/graph/generated.go | 376 ----------------------------- frontend/graph/model/models_gen.go | 11 - frontend/graph/schema.graphqls | 9 - 3 files changed, 396 deletions(-) diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index 82ba75e52..11883d247 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -81,8 +81,6 @@ type ComplexityRoot struct { } K8sActualSource struct { - AutoInstrumented func(childComplexity int) int - CreationTimestamp func(childComplexity int) int HasInstrumentedApplication func(childComplexity int) int InstrumentedApplicationDetails func(childComplexity int) int Kind func(childComplexity int) int @@ -92,15 +90,6 @@ type ComplexityRoot struct { ServiceName func(childComplexity int) int } - K8sActualSourceRuntimeInfo struct { - MainContainer func(childComplexity int) int - } - - K8sActualSourceRuntimeInfoContainer struct { - ContainerName func(childComplexity int) int - Language func(childComplexity int) int - } - Mutation struct { CreateK8sDesiredNamespace func(childComplexity int, cpID string, namespace model.K8sDesiredNamespaceInput) int } @@ -277,20 +266,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.K8sActualNamespace.Name(childComplexity), true - case "K8sActualSource.autoInstrumented": - if e.complexity.K8sActualSource.AutoInstrumented == nil { - break - } - - return e.complexity.K8sActualSource.AutoInstrumented(childComplexity), true - - case "K8sActualSource.creationTimestamp": - if e.complexity.K8sActualSource.CreationTimestamp == nil { - break - } - - return e.complexity.K8sActualSource.CreationTimestamp(childComplexity), true - case "K8sActualSource.hasInstrumentedApplication": if e.complexity.K8sActualSource.HasInstrumentedApplication == nil { break @@ -340,27 +315,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.K8sActualSource.ServiceName(childComplexity), true - case "K8sActualSourceRuntimeInfo.mainContainer": - if e.complexity.K8sActualSourceRuntimeInfo.MainContainer == nil { - break - } - - return e.complexity.K8sActualSourceRuntimeInfo.MainContainer(childComplexity), true - - case "K8sActualSourceRuntimeInfoContainer.containerName": - if e.complexity.K8sActualSourceRuntimeInfoContainer.ContainerName == nil { - break - } - - return e.complexity.K8sActualSourceRuntimeInfoContainer.ContainerName(childComplexity), true - - case "K8sActualSourceRuntimeInfoContainer.language": - if e.complexity.K8sActualSourceRuntimeInfoContainer.Language == nil { - break - } - - return e.complexity.K8sActualSourceRuntimeInfoContainer.Language(childComplexity), true - case "Mutation.createK8sDesiredNamespace": if e.complexity.Mutation.CreateK8sDesiredNamespace == nil { break @@ -895,10 +849,6 @@ func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSource(ctx con return ec.fieldContext_K8sActualSource_name(ctx, field) case "serviceName": return ec.fieldContext_K8sActualSource_serviceName(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) - case "creationTimestamp": - return ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) case "numberOfInstances": return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) case "hasInstrumentedApplication": @@ -970,10 +920,6 @@ func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSources(_ cont return ec.fieldContext_K8sActualSource_name(ctx, field) case "serviceName": return ec.fieldContext_K8sActualSource_serviceName(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) - case "creationTimestamp": - return ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) case "numberOfInstances": return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) case "hasInstrumentedApplication": @@ -1474,10 +1420,6 @@ func (ec *executionContext) fieldContext_K8sActualNamespace_k8sActualSources(_ c return ec.fieldContext_K8sActualSource_name(ctx, field) case "serviceName": return ec.fieldContext_K8sActualSource_serviceName(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) - case "creationTimestamp": - return ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) case "numberOfInstances": return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) case "hasInstrumentedApplication": @@ -1664,88 +1606,6 @@ func (ec *executionContext) fieldContext_K8sActualSource_serviceName(_ context.C return fc, nil } -func (ec *executionContext) _K8sActualSource_autoInstrumented(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.AutoInstrumented, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*bool) - fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "K8sActualSource", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _K8sActualSource_creationTimestamp(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_creationTimestamp(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.CreationTimestamp, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_K8sActualSource_creationTimestamp(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "K8sActualSource", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _K8sActualSource_numberOfInstances(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { fc, err := ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) if err != nil { @@ -1878,141 +1738,6 @@ func (ec *executionContext) fieldContext_K8sActualSource_instrumentedApplication return fc, nil } -func (ec *executionContext) _K8sActualSourceRuntimeInfo_mainContainer(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfo) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSourceRuntimeInfo_mainContainer(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.MainContainer, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*model.K8sActualSourceRuntimeInfoContainer) - fc.Result = res - return ec.marshalOK8sActualSourceRuntimeInfoContainer2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSourceRuntimeInfoContainer(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_K8sActualSourceRuntimeInfo_mainContainer(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "K8sActualSourceRuntimeInfo", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "containerName": - return ec.fieldContext_K8sActualSourceRuntimeInfoContainer_containerName(ctx, field) - case "language": - return ec.fieldContext_K8sActualSourceRuntimeInfoContainer_language(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type K8sActualSourceRuntimeInfoContainer", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer_containerName(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfoContainer) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSourceRuntimeInfoContainer_containerName(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ContainerName, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_K8sActualSourceRuntimeInfoContainer_containerName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "K8sActualSourceRuntimeInfoContainer", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer_language(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSourceRuntimeInfoContainer) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSourceRuntimeInfoContainer_language(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Language, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(model.ProgrammingLanguage) - fc.Result = res - return ec.marshalNProgrammingLanguage2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐProgrammingLanguage(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_K8sActualSourceRuntimeInfoContainer_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "K8sActualSourceRuntimeInfoContainer", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ProgrammingLanguage does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _Mutation_createK8sDesiredNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Mutation_createK8sDesiredNamespace(ctx, field) if err != nil { @@ -4618,10 +4343,6 @@ func (ec *executionContext) _K8sActualSource(ctx context.Context, sel ast.Select } case "serviceName": out.Values[i] = ec._K8sActualSource_serviceName(ctx, field, obj) - case "autoInstrumented": - out.Values[i] = ec._K8sActualSource_autoInstrumented(ctx, field, obj) - case "creationTimestamp": - out.Values[i] = ec._K8sActualSource_creationTimestamp(ctx, field, obj) case "numberOfInstances": out.Values[i] = ec._K8sActualSource_numberOfInstances(ctx, field, obj) case "hasInstrumentedApplication": @@ -4654,86 +4375,6 @@ func (ec *executionContext) _K8sActualSource(ctx context.Context, sel ast.Select return out } -var k8sActualSourceRuntimeInfoImplementors = []string{"K8sActualSourceRuntimeInfo"} - -func (ec *executionContext) _K8sActualSourceRuntimeInfo(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSourceRuntimeInfo) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceRuntimeInfoImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("K8sActualSourceRuntimeInfo") - case "mainContainer": - out.Values[i] = ec._K8sActualSourceRuntimeInfo_mainContainer(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var k8sActualSourceRuntimeInfoContainerImplementors = []string{"K8sActualSourceRuntimeInfoContainer"} - -func (ec *executionContext) _K8sActualSourceRuntimeInfoContainer(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualSourceRuntimeInfoContainer) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, k8sActualSourceRuntimeInfoContainerImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("K8sActualSourceRuntimeInfoContainer") - case "containerName": - out.Values[i] = ec._K8sActualSourceRuntimeInfoContainer_containerName(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "language": - out.Values[i] = ec._K8sActualSourceRuntimeInfoContainer_language(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - var mutationImplementors = []string{"Mutation"} func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { @@ -5399,16 +5040,6 @@ func (ec *executionContext) marshalNK8sResourceKind2githubᚗcomᚋodigosᚑio return v } -func (ec *executionContext) unmarshalNProgrammingLanguage2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐProgrammingLanguage(ctx context.Context, v interface{}) (model.ProgrammingLanguage, error) { - var res model.ProgrammingLanguage - err := res.UnmarshalGQL(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNProgrammingLanguage2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐProgrammingLanguage(ctx context.Context, sel ast.SelectionSet, v model.ProgrammingLanguage) graphql.Marshaler { - return v -} - func (ec *executionContext) marshalNSourceLanguage2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguage(ctx context.Context, sel ast.SelectionSet, v *model.SourceLanguage) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -5811,13 +5442,6 @@ func (ec *executionContext) marshalOK8sActualSource2ᚖgithubᚗcomᚋodigosᚑi return ec._K8sActualSource(ctx, sel, v) } -func (ec *executionContext) marshalOK8sActualSourceRuntimeInfoContainer2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSourceRuntimeInfoContainer(ctx context.Context, sel ast.SelectionSet, v *model.K8sActualSourceRuntimeInfoContainer) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._K8sActualSourceRuntimeInfoContainer(ctx, sel, v) -} - func (ec *executionContext) marshalOSourceLanguage2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguageᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.SourceLanguage) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index f171a4d40..691ef5938 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -45,22 +45,11 @@ type K8sActualSource struct { Kind K8sResourceKind `json:"kind"` Name string `json:"name"` ServiceName *string `json:"serviceName,omitempty"` - AutoInstrumented *bool `json:"autoInstrumented,omitempty"` - CreationTimestamp *string `json:"creationTimestamp,omitempty"` NumberOfInstances *int `json:"numberOfInstances,omitempty"` HasInstrumentedApplication bool `json:"hasInstrumentedApplication"` InstrumentedApplicationDetails *InstrumentedApplicationDetails `json:"instrumentedApplicationDetails,omitempty"` } -type K8sActualSourceRuntimeInfo struct { - MainContainer *K8sActualSourceRuntimeInfoContainer `json:"mainContainer,omitempty"` -} - -type K8sActualSourceRuntimeInfoContainer struct { - ContainerName string `json:"containerName"` - Language ProgrammingLanguage `json:"language"` -} - type K8sDesiredNamespaceInput struct { AutoInstrument *bool `json:"autoInstrument,omitempty"` } diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index 52f97fb1e..d4d67433c 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -80,21 +80,12 @@ type K8sActualSource { kind: K8sResourceKind! name: String! serviceName: String - autoInstrumented: Boolean - creationTimestamp: String numberOfInstances: Int # Odigos records an array of runtime infos. # currently we only keep the first one assuming it is the user's app. hasInstrumentedApplication: Boolean! instrumentedApplicationDetails: InstrumentedApplicationDetails } -type K8sActualSourceRuntimeInfo { - mainContainer: K8sActualSourceRuntimeInfoContainer -} -type K8sActualSourceRuntimeInfoContainer { - containerName: String! - language: ProgrammingLanguage! -} input K8sDesiredSourceInput { serviceName: String From a89b7294247fe016e6f0b9b698aea3e4719a7e40 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 30 Jul 2024 10:54:00 +0300 Subject: [PATCH 116/374] chore: get source with namespace resolver --- frontend/endpoints/applications.go | 47 ++--- frontend/endpoints/sources.go | 8 +- frontend/gqlgen.yml | 4 + frontend/graph/conversions.go | 15 +- frontend/graph/generated.go | 299 +++++++++++++++++++++-------- frontend/graph/model/models_gen.go | 15 +- frontend/graph/schema.graphqls | 19 +- frontend/graph/schema.resolvers.go | 63 +++--- frontend/services/applications.go | 195 ------------------- frontend/services/namespaces.go | 31 --- frontend/services/sources.go | 227 +++++++++++++++------- frontend/services/utils.go | 52 ----- k8sutils/pkg/workload/workload.go | 48 +++++ 13 files changed, 497 insertions(+), 526 deletions(-) delete mode 100644 frontend/services/applications.go delete mode 100644 frontend/services/utils.go diff --git a/frontend/endpoints/applications.go b/frontend/endpoints/applications.go index a29346cf0..0a71c5a39 100644 --- a/frontend/endpoints/applications.go +++ b/frontend/endpoints/applications.go @@ -31,12 +31,10 @@ const ( ) type GetApplicationItemInNamespace struct { - Name string `json:"name"` - Kind WorkloadKind `json:"kind"` - Instances int `json:"instances"` - AppInstrumentationLabeled *bool `json:"app_instrumentation_labeled"` - NsInstrumentationLabeled *bool `json:"ns_instrumentation_labeled"` - InstrumentationEffective bool `json:"instrumentation_effective"` + Name string `json:"name"` + Kind WorkloadKind `json:"kind"` + Instances int `json:"instances"` + WorkloadLabeled *bool `json:"workload_labels"` } type GetApplicationItem struct { @@ -113,19 +111,6 @@ func getApplicationsInNamespace(ctx context.Context, nsName string, nsInstrument copy(items[len(deps):], ss) copy(items[len(deps)+len(ss):], dss) - for i := range items { - item := &items[i] - // check if the entire namespace is instrumented - // as it affects the applications in the namespace - // which use this label to determine if they should be instrumented - nsInstrumentationLabeled := nsInstrumentedMap[item.namespace] - item.nsItem.NsInstrumentationLabeled = nsInstrumentationLabeled - appInstrumented := (item.nsItem.AppInstrumentationLabeled != nil && *item.nsItem.AppInstrumentationLabeled) - appInstrumentationInherited := item.nsItem.AppInstrumentationLabeled == nil - nsInstrumented := (nsInstrumentationLabeled != nil && *nsInstrumentationLabeled) - item.nsItem.InstrumentationEffective = appInstrumented || (appInstrumentationInherited && nsInstrumented) - } - return items, nil } @@ -137,10 +122,10 @@ func getDeployments(namespace string, ctx context.Context) ([]GetApplicationItem response = append(response, GetApplicationItem{ namespace: dep.Namespace, nsItem: GetApplicationItemInNamespace{ - Name: dep.Name, - Kind: WorkloadKindDeployment, - Instances: int(dep.Status.AvailableReplicas), - AppInstrumentationLabeled: appInstrumentationLabeled, + Name: dep.Name, + Kind: WorkloadKindDeployment, + Instances: int(dep.Status.AvailableReplicas), + WorkloadLabeled: appInstrumentationLabeled, }, }) } @@ -162,10 +147,10 @@ func getStatefulSets(namespace string, ctx context.Context) ([]GetApplicationIte response = append(response, GetApplicationItem{ namespace: ss.Namespace, nsItem: GetApplicationItemInNamespace{ - Name: ss.Name, - Kind: WorkloadKindStatefulSet, - Instances: int(ss.Status.ReadyReplicas), - AppInstrumentationLabeled: appInstrumentationLabeled, + Name: ss.Name, + Kind: WorkloadKindStatefulSet, + Instances: int(ss.Status.ReadyReplicas), + WorkloadLabeled: appInstrumentationLabeled, }, }) } @@ -187,10 +172,10 @@ func getDaemonSets(namespace string, ctx context.Context) ([]GetApplicationItem, response = append(response, GetApplicationItem{ namespace: ds.Namespace, nsItem: GetApplicationItemInNamespace{ - Name: ds.Name, - Kind: WorkloadKindDaemonSet, - Instances: int(ds.Status.NumberReady), - AppInstrumentationLabeled: appInstrumentationLabeled, + Name: ds.Name, + Kind: WorkloadKindDaemonSet, + Instances: int(ds.Status.NumberReady), + WorkloadLabeled: appInstrumentationLabeled, }, }) } diff --git a/frontend/endpoints/sources.go b/frontend/endpoints/sources.go index 84cf0a367..3994b8d58 100644 --- a/frontend/endpoints/sources.go +++ b/frontend/endpoints/sources.go @@ -86,13 +86,7 @@ func GetSources(c *gin.Context, odigosns string) { } for _, item := range items { - if item.nsItem.InstrumentationEffective { - id := SourceID{Namespace: item.namespace, Kind: string(item.nsItem.Kind), Name: item.nsItem.Name} - effectiveInstrumentedSources[id] = ThinSource{ - NumberOfRunningInstances: item.nsItem.Instances, - SourceID: id, - } - } + println(item.nsItem.Name) } sourcesResult := []ThinSource{} diff --git a/frontend/gqlgen.yml b/frontend/gqlgen.yml index ec2e32555..de1e87028 100644 --- a/frontend/gqlgen.yml +++ b/frontend/gqlgen.yml @@ -43,3 +43,7 @@ models: resolver: true k8sActualSource: resolver: true + K8sActualNamespace: + fields: + k8sActualSources: + resolver: true diff --git a/frontend/graph/conversions.go b/frontend/graph/conversions.go index 6f8cc6010..79e400002 100644 --- a/frontend/graph/conversions.go +++ b/frontend/graph/conversions.go @@ -48,12 +48,12 @@ func k8sThinSourceToGql(k8sSource *services.ThinSource) *gqlmodel.K8sActualSourc var gqlIaDetails *gqlmodel.InstrumentedApplicationDetails if hasInstrumentedApplication { gqlIaDetails = &gqlmodel.InstrumentedApplicationDetails{ - Languages: make([]*gqlmodel.SourceLanguage, len(k8sSource.IaDetails.Languages)), + Containers: make([]*gqlmodel.SourceContainerRuntimeDetails, len(k8sSource.IaDetails.Languages)), Conditions: make([]*gqlmodel.Condition, len(k8sSource.IaDetails.Conditions)), } for i, lang := range k8sSource.IaDetails.Languages { - gqlIaDetails.Languages[i] = &gqlmodel.SourceLanguage{ + gqlIaDetails.Containers[i] = &gqlmodel.SourceContainerRuntimeDetails{ ContainerName: lang.ContainerName, Language: lang.Language, } @@ -90,14 +90,3 @@ func k8sSourceToGql(k8sSource *services.Source) *gqlmodel.K8sActualSource { ServiceName: &k8sSource.ReportedName, } } - -func k8sApplicationItemToGql(appItem *services.GetApplicationItemInNamespace) *gqlmodel.K8sActualSource { - - stringKind := string(appItem.Kind) - - return &gqlmodel.K8sActualSource{ - Kind: k8sKindToGql(stringKind), - Name: appItem.Name, - NumberOfInstances: &appItem.Instances, - } -} diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index 11883d247..4fcf78c0a 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -40,6 +40,7 @@ type Config struct { type ResolverRoot interface { ComputePlatform() ComputePlatformResolver + K8sActualNamespace() K8sActualNamespaceResolver Mutation() MutationResolver Query() QueryResolver } @@ -71,17 +72,18 @@ type ComplexityRoot struct { InstrumentedApplicationDetails struct { Conditions func(childComplexity int) int - Languages func(childComplexity int) int + Containers func(childComplexity int) int } K8sActualNamespace struct { - AutoInstrumented func(childComplexity int) int - K8sActualSources func(childComplexity int) int - Name func(childComplexity int) int + InstrumentationLabelEnabled func(childComplexity int) int + K8sActualSources func(childComplexity int, instrumentationLabeled *bool) int + Name func(childComplexity int) int } K8sActualSource struct { - HasInstrumentedApplication func(childComplexity int) int + AutoInstrumented func(childComplexity int) int + AutoInstrumentedDecision func(childComplexity int) int InstrumentedApplicationDetails func(childComplexity int) int Kind func(childComplexity int) int Name func(childComplexity int) int @@ -99,7 +101,7 @@ type ComplexityRoot struct { Config func(childComplexity int) int } - SourceLanguage struct { + SourceContainerRuntimeDetails struct { ContainerName func(childComplexity int) int Language func(childComplexity int) int } @@ -110,6 +112,9 @@ type ComputePlatformResolver interface { K8sActualSource(ctx context.Context, obj *model.ComputePlatform, name *string, namespace *string, kind *string) (*model.K8sActualSource, error) } +type K8sActualNamespaceResolver interface { + K8sActualSources(ctx context.Context, obj *model.K8sActualNamespace, instrumentationLabeled *bool) ([]*model.K8sActualSource, error) +} type MutationResolver interface { CreateK8sDesiredNamespace(ctx context.Context, cpID string, namespace model.K8sDesiredNamespaceInput) (*model.K8sActualNamespace, error) } @@ -238,26 +243,31 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.InstrumentedApplicationDetails.Conditions(childComplexity), true - case "InstrumentedApplicationDetails.languages": - if e.complexity.InstrumentedApplicationDetails.Languages == nil { + case "InstrumentedApplicationDetails.containers": + if e.complexity.InstrumentedApplicationDetails.Containers == nil { break } - return e.complexity.InstrumentedApplicationDetails.Languages(childComplexity), true + return e.complexity.InstrumentedApplicationDetails.Containers(childComplexity), true - case "K8sActualNamespace.autoInstrumented": - if e.complexity.K8sActualNamespace.AutoInstrumented == nil { + case "K8sActualNamespace.instrumentationLabelEnabled": + if e.complexity.K8sActualNamespace.InstrumentationLabelEnabled == nil { break } - return e.complexity.K8sActualNamespace.AutoInstrumented(childComplexity), true + return e.complexity.K8sActualNamespace.InstrumentationLabelEnabled(childComplexity), true case "K8sActualNamespace.k8sActualSources": if e.complexity.K8sActualNamespace.K8sActualSources == nil { break } - return e.complexity.K8sActualNamespace.K8sActualSources(childComplexity), true + args, err := ec.field_K8sActualNamespace_k8sActualSources_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.K8sActualNamespace.K8sActualSources(childComplexity, args["instrumentationLabeled"].(*bool)), true case "K8sActualNamespace.name": if e.complexity.K8sActualNamespace.Name == nil { @@ -266,12 +276,19 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.K8sActualNamespace.Name(childComplexity), true - case "K8sActualSource.hasInstrumentedApplication": - if e.complexity.K8sActualSource.HasInstrumentedApplication == nil { + case "K8sActualSource.autoInstrumented": + if e.complexity.K8sActualSource.AutoInstrumented == nil { break } - return e.complexity.K8sActualSource.HasInstrumentedApplication(childComplexity), true + return e.complexity.K8sActualSource.AutoInstrumented(childComplexity), true + + case "K8sActualSource.autoInstrumentedDecision": + if e.complexity.K8sActualSource.AutoInstrumentedDecision == nil { + break + } + + return e.complexity.K8sActualSource.AutoInstrumentedDecision(childComplexity), true case "K8sActualSource.instrumentedApplicationDetails": if e.complexity.K8sActualSource.InstrumentedApplicationDetails == nil { @@ -341,19 +358,19 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Config(childComplexity), true - case "SourceLanguage.containerName": - if e.complexity.SourceLanguage.ContainerName == nil { + case "SourceContainerRuntimeDetails.containerName": + if e.complexity.SourceContainerRuntimeDetails.ContainerName == nil { break } - return e.complexity.SourceLanguage.ContainerName(childComplexity), true + return e.complexity.SourceContainerRuntimeDetails.ContainerName(childComplexity), true - case "SourceLanguage.language": - if e.complexity.SourceLanguage.Language == nil { + case "SourceContainerRuntimeDetails.language": + if e.complexity.SourceContainerRuntimeDetails.Language == nil { break } - return e.complexity.SourceLanguage.Language(childComplexity), true + return e.complexity.SourceContainerRuntimeDetails.Language(childComplexity), true } return 0, false @@ -531,6 +548,21 @@ func (ec *executionContext) field_ComputePlatform_k8sActualSource_args(ctx conte return args, nil } +func (ec *executionContext) field_K8sActualNamespace_k8sActualSources_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *bool + if tmp, ok := rawArgs["instrumentationLabeled"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("instrumentationLabeled")) + arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } + } + args["instrumentationLabeled"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_createK8sDesiredNamespace_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -731,8 +763,8 @@ func (ec *executionContext) fieldContext_ComputePlatform_k8sActualNamespace(ctx switch field.Name { case "name": return ec.fieldContext_K8sActualNamespace_name(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) + case "instrumentationLabelEnabled": + return ec.fieldContext_K8sActualNamespace_instrumentationLabelEnabled(ctx, field) case "k8sActualSources": return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) } @@ -794,8 +826,8 @@ func (ec *executionContext) fieldContext_ComputePlatform_k8sActualNamespaces(_ c switch field.Name { case "name": return ec.fieldContext_K8sActualNamespace_name(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) + case "instrumentationLabelEnabled": + return ec.fieldContext_K8sActualNamespace_instrumentationLabelEnabled(ctx, field) case "k8sActualSources": return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) } @@ -851,8 +883,10 @@ func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSource(ctx con return ec.fieldContext_K8sActualSource_serviceName(ctx, field) case "numberOfInstances": return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) - case "hasInstrumentedApplication": - return ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) + case "autoInstrumentedDecision": + return ec.fieldContext_K8sActualSource_autoInstrumentedDecision(ctx, field) case "instrumentedApplicationDetails": return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) } @@ -922,8 +956,10 @@ func (ec *executionContext) fieldContext_ComputePlatform_k8sActualSources(_ cont return ec.fieldContext_K8sActualSource_serviceName(ctx, field) case "numberOfInstances": return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) - case "hasInstrumentedApplication": - return ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) + case "autoInstrumentedDecision": + return ec.fieldContext_K8sActualSource_autoInstrumentedDecision(ctx, field) case "instrumentedApplicationDetails": return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) } @@ -1188,8 +1224,8 @@ func (ec *executionContext) fieldContext_GetConfigResponse_installation(_ contex return fc, nil } -func (ec *executionContext) _InstrumentedApplicationDetails_languages(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentedApplicationDetails_languages(ctx, field) +func (ec *executionContext) _InstrumentedApplicationDetails_containers(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentedApplicationDetails_containers(ctx, field) if err != nil { return graphql.Null } @@ -1202,7 +1238,7 @@ func (ec *executionContext) _InstrumentedApplicationDetails_languages(ctx contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Languages, nil + return obj.Containers, nil }) if err != nil { ec.Error(ctx, err) @@ -1211,12 +1247,12 @@ func (ec *executionContext) _InstrumentedApplicationDetails_languages(ctx contex if resTmp == nil { return graphql.Null } - res := resTmp.([]*model.SourceLanguage) + res := resTmp.([]*model.SourceContainerRuntimeDetails) fc.Result = res - return ec.marshalOSourceLanguage2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguageᚄ(ctx, field.Selections, res) + return ec.marshalOSourceContainerRuntimeDetails2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceContainerRuntimeDetailsᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_languages(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_containers(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "InstrumentedApplicationDetails", Field: field, @@ -1225,11 +1261,11 @@ func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_language Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "containerName": - return ec.fieldContext_SourceLanguage_containerName(ctx, field) + return ec.fieldContext_SourceContainerRuntimeDetails_containerName(ctx, field) case "language": - return ec.fieldContext_SourceLanguage_language(ctx, field) + return ec.fieldContext_SourceContainerRuntimeDetails_language(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type SourceLanguage", field.Name) + return nil, fmt.Errorf("no field named %q was found under type SourceContainerRuntimeDetails", field.Name) }, } return fc, nil @@ -1332,8 +1368,8 @@ func (ec *executionContext) fieldContext_K8sActualNamespace_name(_ context.Conte return fc, nil } -func (ec *executionContext) _K8sActualNamespace_autoInstrumented(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) +func (ec *executionContext) _K8sActualNamespace_instrumentationLabelEnabled(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualNamespace_instrumentationLabelEnabled(ctx, field) if err != nil { return graphql.Null } @@ -1346,7 +1382,7 @@ func (ec *executionContext) _K8sActualNamespace_autoInstrumented(ctx context.Con }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.AutoInstrumented, nil + return obj.InstrumentationLabelEnabled, nil }) if err != nil { ec.Error(ctx, err) @@ -1360,7 +1396,7 @@ func (ec *executionContext) _K8sActualNamespace_autoInstrumented(ctx context.Con return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualNamespace_autoInstrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualNamespace_instrumentationLabelEnabled(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "K8sActualNamespace", Field: field, @@ -1387,7 +1423,7 @@ func (ec *executionContext) _K8sActualNamespace_k8sActualSources(ctx context.Con }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.K8sActualSources, nil + return ec.resolvers.K8sActualNamespace().K8sActualSources(rctx, obj, fc.Args["instrumentationLabeled"].(*bool)) }) if err != nil { ec.Error(ctx, err) @@ -1404,12 +1440,12 @@ func (ec *executionContext) _K8sActualNamespace_k8sActualSources(ctx context.Con return ec.marshalNK8sActualSource2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualNamespace_k8sActualSources(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualNamespace_k8sActualSources(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "K8sActualNamespace", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "namespace": @@ -1422,14 +1458,27 @@ func (ec *executionContext) fieldContext_K8sActualNamespace_k8sActualSources(_ c return ec.fieldContext_K8sActualSource_serviceName(ctx, field) case "numberOfInstances": return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) - case "hasInstrumentedApplication": - return ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) + case "autoInstrumentedDecision": + return ec.fieldContext_K8sActualSource_autoInstrumentedDecision(ctx, field) case "instrumentedApplicationDetails": return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type K8sActualSource", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_K8sActualNamespace_k8sActualSources_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } @@ -1647,8 +1696,8 @@ func (ec *executionContext) fieldContext_K8sActualSource_numberOfInstances(_ con return fc, nil } -func (ec *executionContext) _K8sActualSource_hasInstrumentedApplication(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_hasInstrumentedApplication(ctx, field) +func (ec *executionContext) _K8sActualSource_autoInstrumented(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) if err != nil { return graphql.Null } @@ -1661,7 +1710,7 @@ func (ec *executionContext) _K8sActualSource_hasInstrumentedApplication(ctx cont }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.HasInstrumentedApplication, nil + return obj.AutoInstrumented, nil }) if err != nil { ec.Error(ctx, err) @@ -1678,7 +1727,7 @@ func (ec *executionContext) _K8sActualSource_hasInstrumentedApplication(ctx cont return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_hasInstrumentedApplication(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "K8sActualSource", Field: field, @@ -1691,6 +1740,50 @@ func (ec *executionContext) fieldContext_K8sActualSource_hasInstrumentedApplicat return fc, nil } +func (ec *executionContext) _K8sActualSource_autoInstrumentedDecision(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_autoInstrumentedDecision(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AutoInstrumentedDecision, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumentedDecision(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "K8sActualSource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _K8sActualSource_instrumentedApplicationDetails(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { fc, err := ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) if err != nil { @@ -1727,8 +1820,8 @@ func (ec *executionContext) fieldContext_K8sActualSource_instrumentedApplication IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "languages": - return ec.fieldContext_InstrumentedApplicationDetails_languages(ctx, field) + case "containers": + return ec.fieldContext_InstrumentedApplicationDetails_containers(ctx, field) case "conditions": return ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) } @@ -1776,8 +1869,8 @@ func (ec *executionContext) fieldContext_Mutation_createK8sDesiredNamespace(ctx switch field.Name { case "name": return ec.fieldContext_K8sActualNamespace_name(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualNamespace_autoInstrumented(ctx, field) + case "instrumentationLabelEnabled": + return ec.fieldContext_K8sActualNamespace_instrumentationLabelEnabled(ctx, field) case "k8sActualSources": return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) } @@ -2027,8 +2120,8 @@ func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field return fc, nil } -func (ec *executionContext) _SourceLanguage_containerName(ctx context.Context, field graphql.CollectedField, obj *model.SourceLanguage) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_SourceLanguage_containerName(ctx, field) +func (ec *executionContext) _SourceContainerRuntimeDetails_containerName(ctx context.Context, field graphql.CollectedField, obj *model.SourceContainerRuntimeDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SourceContainerRuntimeDetails_containerName(ctx, field) if err != nil { return graphql.Null } @@ -2058,9 +2151,9 @@ func (ec *executionContext) _SourceLanguage_containerName(ctx context.Context, f return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SourceLanguage_containerName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SourceContainerRuntimeDetails_containerName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "SourceLanguage", + Object: "SourceContainerRuntimeDetails", Field: field, IsMethod: false, IsResolver: false, @@ -2071,8 +2164,8 @@ func (ec *executionContext) fieldContext_SourceLanguage_containerName(_ context. return fc, nil } -func (ec *executionContext) _SourceLanguage_language(ctx context.Context, field graphql.CollectedField, obj *model.SourceLanguage) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_SourceLanguage_language(ctx, field) +func (ec *executionContext) _SourceContainerRuntimeDetails_language(ctx context.Context, field graphql.CollectedField, obj *model.SourceContainerRuntimeDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SourceContainerRuntimeDetails_language(ctx, field) if err != nil { return graphql.Null } @@ -2102,9 +2195,9 @@ func (ec *executionContext) _SourceLanguage_language(ctx context.Context, field return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SourceLanguage_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SourceContainerRuntimeDetails_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "SourceLanguage", + Object: "SourceContainerRuntimeDetails", Field: field, IsMethod: false, IsResolver: false, @@ -4242,8 +4335,8 @@ func (ec *executionContext) _InstrumentedApplicationDetails(ctx context.Context, switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("InstrumentedApplicationDetails") - case "languages": - out.Values[i] = ec._InstrumentedApplicationDetails_languages(ctx, field, obj) + case "containers": + out.Values[i] = ec._InstrumentedApplicationDetails_containers(ctx, field, obj) case "conditions": out.Values[i] = ec._InstrumentedApplicationDetails_conditions(ctx, field, obj) default: @@ -4283,15 +4376,46 @@ func (ec *executionContext) _K8sActualNamespace(ctx context.Context, sel ast.Sel case "name": out.Values[i] = ec._K8sActualNamespace_name(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } - case "autoInstrumented": - out.Values[i] = ec._K8sActualNamespace_autoInstrumented(ctx, field, obj) + case "instrumentationLabelEnabled": + out.Values[i] = ec._K8sActualNamespace_instrumentationLabelEnabled(ctx, field, obj) case "k8sActualSources": - out.Values[i] = ec._K8sActualNamespace_k8sActualSources(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._K8sActualNamespace_k8sActualSources(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -4345,8 +4469,13 @@ func (ec *executionContext) _K8sActualSource(ctx context.Context, sel ast.Select out.Values[i] = ec._K8sActualSource_serviceName(ctx, field, obj) case "numberOfInstances": out.Values[i] = ec._K8sActualSource_numberOfInstances(ctx, field, obj) - case "hasInstrumentedApplication": - out.Values[i] = ec._K8sActualSource_hasInstrumentedApplication(ctx, field, obj) + case "autoInstrumented": + out.Values[i] = ec._K8sActualSource_autoInstrumented(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "autoInstrumentedDecision": + out.Values[i] = ec._K8sActualSource_autoInstrumentedDecision(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -4509,24 +4638,24 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr return out } -var sourceLanguageImplementors = []string{"SourceLanguage"} +var sourceContainerRuntimeDetailsImplementors = []string{"SourceContainerRuntimeDetails"} -func (ec *executionContext) _SourceLanguage(ctx context.Context, sel ast.SelectionSet, obj *model.SourceLanguage) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, sourceLanguageImplementors) +func (ec *executionContext) _SourceContainerRuntimeDetails(ctx context.Context, sel ast.SelectionSet, obj *model.SourceContainerRuntimeDetails) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, sourceContainerRuntimeDetailsImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("SourceLanguage") + out.Values[i] = graphql.MarshalString("SourceContainerRuntimeDetails") case "containerName": - out.Values[i] = ec._SourceLanguage_containerName(ctx, field, obj) + out.Values[i] = ec._SourceContainerRuntimeDetails_containerName(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "language": - out.Values[i] = ec._SourceLanguage_language(ctx, field, obj) + out.Values[i] = ec._SourceContainerRuntimeDetails_language(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -5040,14 +5169,14 @@ func (ec *executionContext) marshalNK8sResourceKind2githubᚗcomᚋodigosᚑio return v } -func (ec *executionContext) marshalNSourceLanguage2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguage(ctx context.Context, sel ast.SelectionSet, v *model.SourceLanguage) graphql.Marshaler { +func (ec *executionContext) marshalNSourceContainerRuntimeDetails2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceContainerRuntimeDetails(ctx context.Context, sel ast.SelectionSet, v *model.SourceContainerRuntimeDetails) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec._SourceLanguage(ctx, sel, v) + return ec._SourceContainerRuntimeDetails(ctx, sel, v) } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { @@ -5442,7 +5571,7 @@ func (ec *executionContext) marshalOK8sActualSource2ᚖgithubᚗcomᚋodigosᚑi return ec._K8sActualSource(ctx, sel, v) } -func (ec *executionContext) marshalOSourceLanguage2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguageᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.SourceLanguage) graphql.Marshaler { +func (ec *executionContext) marshalOSourceContainerRuntimeDetails2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceContainerRuntimeDetailsᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.SourceContainerRuntimeDetails) graphql.Marshaler { if v == nil { return graphql.Null } @@ -5469,7 +5598,7 @@ func (ec *executionContext) marshalOSourceLanguage2ᚕᚖgithubᚗcomᚋodigos if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNSourceLanguage2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceLanguage(ctx, sel, v[i]) + ret[i] = ec.marshalNSourceContainerRuntimeDetails2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceContainerRuntimeDetails(ctx, sel, v[i]) } if isLen1 { f(i) diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index 691ef5938..8edb3f653 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -30,14 +30,14 @@ type GetConfigResponse struct { } type InstrumentedApplicationDetails struct { - Languages []*SourceLanguage `json:"languages,omitempty"` - Conditions []*Condition `json:"conditions,omitempty"` + Containers []*SourceContainerRuntimeDetails `json:"containers,omitempty"` + Conditions []*Condition `json:"conditions,omitempty"` } type K8sActualNamespace struct { - Name string `json:"name"` - AutoInstrumented *bool `json:"autoInstrumented,omitempty"` - K8sActualSources []*K8sActualSource `json:"k8sActualSources"` + Name string `json:"name"` + InstrumentationLabelEnabled *bool `json:"instrumentationLabelEnabled,omitempty"` + K8sActualSources []*K8sActualSource `json:"k8sActualSources"` } type K8sActualSource struct { @@ -46,7 +46,8 @@ type K8sActualSource struct { Name string `json:"name"` ServiceName *string `json:"serviceName,omitempty"` NumberOfInstances *int `json:"numberOfInstances,omitempty"` - HasInstrumentedApplication bool `json:"hasInstrumentedApplication"` + AutoInstrumented bool `json:"autoInstrumented"` + AutoInstrumentedDecision string `json:"autoInstrumentedDecision"` InstrumentedApplicationDetails *InstrumentedApplicationDetails `json:"instrumentedApplicationDetails,omitempty"` } @@ -75,7 +76,7 @@ type Mutation struct { type Query struct { } -type SourceLanguage struct { +type SourceContainerRuntimeDetails struct { ContainerName string `json:"containerName"` Language string `json:"language"` } diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index d4d67433c..a13b96ca4 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -44,13 +44,13 @@ enum InstallationStatus { FINISHED } -type SourceLanguage { +type SourceContainerRuntimeDetails { containerName: String! language: String! } type InstrumentedApplicationDetails { - languages: [SourceLanguage!] + containers: [SourceContainerRuntimeDetails!] conditions: [Condition!] } @@ -64,8 +64,14 @@ type Condition { type K8sActualNamespace { name: String! - autoInstrumented: Boolean - k8sActualSources: [K8sActualSource]! + instrumentationLabelEnabled: Boolean + + # 1. if instrumentationLabeled = true, then only return sources that are labeled for instrumentation + # which means workload label is set to enabled, or workload label missing and ns label is set to enabled + # 2. if instrumentationLabeled = false, then return all sources which are not labeled for instrumentation. + # which means workload label is set to disabled, or workload label missing and ns label is not set to enabled + # 3. if instrumentationLabeled is not provided, then return all sources + k8sActualSources(instrumentationLabeled: Boolean): [K8sActualSource]! } input K8sDesiredNamespaceInput { @@ -81,9 +87,8 @@ type K8sActualSource { name: String! serviceName: String numberOfInstances: Int - # Odigos records an array of runtime infos. - # currently we only keep the first one assuming it is the user's app. - hasInstrumentedApplication: Boolean! + autoInstrumented: Boolean! + autoInstrumentedDecision: String! instrumentedApplicationDetails: InstrumentedApplicationDetails } diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 802c0bcb5..dec5ce7dd 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -10,20 +10,36 @@ import ( "github.com/odigos-io/odigos/frontend/endpoints" "github.com/odigos-io/odigos/frontend/graph/model" + "github.com/odigos-io/odigos/frontend/kube" "github.com/odigos-io/odigos/frontend/services" + "github.com/odigos-io/odigos/k8sutils/pkg/workload" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // K8sActualNamespace is the resolver for the k8sActualNamespace field. func (r *computePlatformResolver) K8sActualNamespace(ctx context.Context, obj *model.ComputePlatform, name string) (*model.K8sActualNamespace, error) { - namespaceActualSources := services.GetApplicationsInK8SNamespace(ctx, name) - namespaceSources := make([]*model.K8sActualSource, len(namespaceActualSources)) + namespaceActualSources, err := services.GetWorkloadsInNamespace(ctx, name, nil) + if err != nil { + return nil, err + } + + // Convert namespaceActualSources to []*model.K8sActualSource + namespaceActualSourcesPointers := make([]*model.K8sActualSource, len(namespaceActualSources)) for i, source := range namespaceActualSources { - namespaceSources[i] = k8sApplicationItemToGql(&source) + namespaceActualSourcesPointers[i] = &source + } + + namespace, err := kube.DefaultClient.CoreV1().Namespaces().Get(ctx, name, metav1.GetOptions{}) + if err != nil { + return nil, err } + nsInstrumented := workload.GetInstrumentationLabelValue(namespace.GetLabels()) + return &model.K8sActualNamespace{ - Name: name, - K8sActualSources: namespaceSources, + Name: name, + InstrumentationLabelEnabled: nsInstrumented, + K8sActualSources: namespaceActualSourcesPointers, }, nil } @@ -41,6 +57,11 @@ func (r *computePlatformResolver) K8sActualSource(ctx context.Context, obj *mode return k8sActualSource, nil } +// K8sActualSources is the resolver for the k8sActualSources field. +func (r *k8sActualNamespaceResolver) K8sActualSources(ctx context.Context, ns *model.K8sActualNamespace, instrumentationLabeled *bool) ([]*model.K8sActualSource, error) { + return ns.K8sActualSources, nil +} + // CreateK8sDesiredNamespace is the resolver for the createK8sDesiredNamespace field. func (r *mutationResolver) CreateK8sDesiredNamespace(ctx context.Context, cpID string, namespace model.K8sDesiredNamespaceInput) (*model.K8sActualNamespace, error) { panic(fmt.Errorf("not implemented: CreateK8sDesiredNamespace - createK8sDesiredNamespace")) @@ -48,35 +69,9 @@ func (r *mutationResolver) CreateK8sDesiredNamespace(ctx context.Context, cpID s // ComputePlatform is the resolver for the computePlatform field. func (r *queryResolver) ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) { - k8sActualSources := services.GetActualSources(ctx, "odigos-system") - res := make([]*model.K8sActualSource, len(k8sActualSources)) - for i, source := range k8sActualSources { - res[i] = k8sThinSourceToGql(&source) - } - - name := "odigos-system" - namespacesResponse := services.GetK8SNamespaces(ctx, name) - - K8sActualNamespaces := make([]*model.K8sActualNamespace, len(namespacesResponse.Namespaces)) - - for i, namespace := range namespacesResponse.Namespaces { - namespaceActualSources := services.GetApplicationsInK8SNamespace(ctx, namespace.Name) - namespaceSources := make([]*model.K8sActualSource, len(namespaceActualSources)) - for j, source := range namespaceActualSources { - namespaceSources[j] = k8sApplicationItemToGql(&source) - } - - K8sActualNamespaces[i] = &model.K8sActualNamespace{ - Name: namespace.Name, - K8sActualSources: namespaceSources, - } - } return &model.ComputePlatform{ - K8sActualSources: res, - Name: &name, ComputePlatformType: model.ComputePlatformTypeK8s, - K8sActualNamespaces: K8sActualNamespaces, }, nil } @@ -94,6 +89,11 @@ func (r *queryResolver) Config(ctx context.Context) (*model.GetConfigResponse, e // ComputePlatform returns ComputePlatformResolver implementation. func (r *Resolver) ComputePlatform() ComputePlatformResolver { return &computePlatformResolver{r} } +// K8sActualNamespace returns K8sActualNamespaceResolver implementation. +func (r *Resolver) K8sActualNamespace() K8sActualNamespaceResolver { + return &k8sActualNamespaceResolver{r} +} + // Mutation returns MutationResolver implementation. func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} } @@ -101,5 +101,6 @@ func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} } func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } type computePlatformResolver struct{ *Resolver } +type k8sActualNamespaceResolver struct{ *Resolver } type mutationResolver struct{ *Resolver } type queryResolver struct{ *Resolver } diff --git a/frontend/services/applications.go b/frontend/services/applications.go deleted file mode 100644 index 012310216..000000000 --- a/frontend/services/applications.go +++ /dev/null @@ -1,195 +0,0 @@ -package services - -import ( - "context" - - appsv1 "k8s.io/api/apps/v1" - - "github.com/odigos-io/odigos/k8sutils/pkg/client" - - "github.com/odigos-io/odigos/frontend/kube" - "golang.org/x/sync/errgroup" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type GetApplicationsInNamespaceRequest struct { - Namespace string `uri:"namespace" binding:"required"` -} - -type GetApplicationsInNamespaceResponse struct { - Applications []GetApplicationItemInNamespace `json:"applications"` -} - -type WorkloadKind string - -const ( - WorkloadKindDeployment WorkloadKind = "Deployment" - WorkloadKindStatefulSet WorkloadKind = "StatefulSet" - WorkloadKindDaemonSet WorkloadKind = "DaemonSet" -) - -type GetApplicationItemInNamespace struct { - Name string `json:"name"` - Kind WorkloadKind `json:"kind"` - Instances int `json:"instances"` - AppInstrumentationLabeled *bool `json:"app_instrumentation_labeled"` - NsInstrumentationLabeled *bool `json:"ns_instrumentation_labeled"` - InstrumentationEffective bool `json:"instrumentation_effective"` -} - -type GetApplicationItem struct { - // namespace is used when querying all the namespaces, the response can be grouped/filtered by namespace - namespace string - nsItem GetApplicationItemInNamespace -} - -func GetApplicationsInK8SNamespace(ctx context.Context, ns string) []GetApplicationItemInNamespace { - - namespace, err := kube.DefaultClient.CoreV1().Namespaces().Get(ctx, ns, metav1.GetOptions{}) - if err != nil { - - return nil - } - - items, err := getApplicationsInNamespace(ctx, namespace.Name, map[string]*bool{namespace.Name: isObjectLabeledForInstrumentation(namespace.ObjectMeta)}) - if err != nil { - - return nil - } - - apps := make([]GetApplicationItemInNamespace, len(items)) - for i, item := range items { - apps[i] = item.nsItem - } - - return apps -} - -// getApplicationsInNamespace returns all applications in the namespace and their instrumentation status. -// nsName can be an empty string to get applications in all namespaces. -// nsInstrumentedMap is a map of namespace name to a boolean pointer indicating if the namespace is instrumented. -func getApplicationsInNamespace(ctx context.Context, nsName string, nsInstrumentedMap map[string]*bool) ([]GetApplicationItem, error) { - g, ctx := errgroup.WithContext(ctx) - var ( - deps []GetApplicationItem - ss []GetApplicationItem - dss []GetApplicationItem - ) - - g.Go(func() error { - var err error - deps, err = getDeployments(nsName, ctx) - return err - }) - - g.Go(func() error { - var err error - ss, err = getStatefulSets(nsName, ctx) - return err - }) - - g.Go(func() error { - var err error - dss, err = getDaemonSets(nsName, ctx) - return err - }) - - if err := g.Wait(); err != nil { - return nil, err - } - - items := make([]GetApplicationItem, len(deps)+len(ss)+len(dss)) - copy(items, deps) - copy(items[len(deps):], ss) - copy(items[len(deps)+len(ss):], dss) - - for i := range items { - item := &items[i] - // check if the entire namespace is instrumented - // as it affects the applications in the namespace - // which use this label to determine if they should be instrumented - nsInstrumentationLabeled := nsInstrumentedMap[item.namespace] - item.nsItem.NsInstrumentationLabeled = nsInstrumentationLabeled - appInstrumented := (item.nsItem.AppInstrumentationLabeled != nil && *item.nsItem.AppInstrumentationLabeled) - appInstrumentationInherited := item.nsItem.AppInstrumentationLabeled == nil - nsInstrumented := (nsInstrumentationLabeled != nil && *nsInstrumentationLabeled) - item.nsItem.InstrumentationEffective = appInstrumented || (appInstrumentationInherited && nsInstrumented) - } - - return items, nil -} - -func getDeployments(namespace string, ctx context.Context) ([]GetApplicationItem, error) { - var response []GetApplicationItem - err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.AppsV1().Deployments(namespace).List, ctx, metav1.ListOptions{}, func(deps *appsv1.DeploymentList) error { - for _, dep := range deps.Items { - appInstrumentationLabeled := isObjectLabeledForInstrumentation(dep.ObjectMeta) - response = append(response, GetApplicationItem{ - namespace: dep.Namespace, - nsItem: GetApplicationItemInNamespace{ - Name: dep.Name, - Kind: WorkloadKindDeployment, - Instances: int(dep.Status.AvailableReplicas), - AppInstrumentationLabeled: appInstrumentationLabeled, - }, - }) - } - return nil - }) - - if err != nil { - return nil, err - } - - return response, nil -} - -func getStatefulSets(namespace string, ctx context.Context) ([]GetApplicationItem, error) { - var response []GetApplicationItem - err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.AppsV1().StatefulSets(namespace).List, ctx, metav1.ListOptions{}, func(sss *appsv1.StatefulSetList) error { - for _, ss := range sss.Items { - appInstrumentationLabeled := isObjectLabeledForInstrumentation(ss.ObjectMeta) - response = append(response, GetApplicationItem{ - namespace: ss.Namespace, - nsItem: GetApplicationItemInNamespace{ - Name: ss.Name, - Kind: WorkloadKindStatefulSet, - Instances: int(ss.Status.ReadyReplicas), - AppInstrumentationLabeled: appInstrumentationLabeled, - }, - }) - } - return nil - }) - - if err != nil { - return nil, err - } - - return response, nil -} - -func getDaemonSets(namespace string, ctx context.Context) ([]GetApplicationItem, error) { - var response []GetApplicationItem - err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.AppsV1().DaemonSets(namespace).List, ctx, metav1.ListOptions{}, func(dss *appsv1.DaemonSetList) error { - for _, ds := range dss.Items { - appInstrumentationLabeled := isObjectLabeledForInstrumentation(ds.ObjectMeta) - response = append(response, GetApplicationItem{ - namespace: ds.Namespace, - nsItem: GetApplicationItemInNamespace{ - Name: ds.Name, - Kind: WorkloadKindDaemonSet, - Instances: int(ds.Status.NumberReady), - AppInstrumentationLabeled: appInstrumentationLabeled, - }, - }) - } - return nil - }) - - if err != nil { - return nil, err - } - - return response, nil -} diff --git a/frontend/services/namespaces.go b/frontend/services/namespaces.go index 62282aa4c..5eaca3efd 100644 --- a/frontend/services/namespaces.go +++ b/frontend/services/namespaces.go @@ -119,37 +119,6 @@ type PersistNamespaceObject struct { Selected *bool `json:"selected,omitempty"` } -func getJsonMergePatchForInstrumentationLabel(enabled *bool) []byte { - labelJsonMergePatchValue := "null" - if enabled != nil { - if *enabled { - labelJsonMergePatchValue = fmt.Sprintf("\"%s\"", consts.InstrumentationEnabled) - } else { - labelJsonMergePatchValue = fmt.Sprintf("\"%s\"", consts.InstrumentationDisabled) - } - } - - jsonMergePatchContent := fmt.Sprintf(`{"metadata":{"labels":{"%s":%s}}}`, consts.OdigosInstrumentationLabel, labelJsonMergePatchValue) - return []byte(jsonMergePatchContent) -} - -func syncWorkloadsInNamespace(ctx context.Context, nsName string, workloads []PersistNamespaceObject) error { - g, ctx := errgroup.WithContext(ctx) - g.SetLimit(kube.K8sClientDefaultBurst) - - for _, workload := range workloads { - currWorkload := workload - g.Go(func() error { - // Only label selected sources, ignore the rest - if currWorkload.Selected != nil && *currWorkload.Selected { - return setWorkloadInstrumentationLabel(ctx, nsName, currWorkload.Name, currWorkload.Kind, currWorkload.Selected) - } - return nil - }) - } - return g.Wait() -} - // returns a map, where the key is a namespace name and the value is the // number of apps in this namespace (not necessarily instrumented) func CountAppsPerNamespace(ctx context.Context) (map[string]int, error) { diff --git a/frontend/services/sources.go b/frontend/services/sources.go index 65faf79d5..abdd8dbb1 100644 --- a/frontend/services/sources.go +++ b/frontend/services/sources.go @@ -10,8 +10,24 @@ import ( "github.com/odigos-io/odigos/frontend/kube" "github.com/odigos-io/odigos/k8sutils/pkg/workload" - "golang.org/x/sync/errgroup" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + appsv1 "k8s.io/api/apps/v1" + + "github.com/odigos-io/odigos/frontend/graph/model" + + "github.com/odigos-io/odigos/k8sutils/pkg/client" + + "golang.org/x/sync/errgroup" + corev1 "k8s.io/api/core/v1" +) + +type WorkloadKind string + +const ( + WorkloadKindDeployment WorkloadKind = "Deployment" + WorkloadKindStatefulSet WorkloadKind = "StatefulSet" + WorkloadKindDaemonSet WorkloadKind = "DaemonSet" ) type SourceLanguage struct { @@ -46,72 +62,6 @@ type ThinSource struct { IaDetails *InstrumentedApplicationDetails `json:"instrumented_application_details"` } -func GetActualSources(ctx context.Context, odigosns string) []ThinSource { - return getSourcesForNamespace(ctx, odigosns) -} - -func GetNamespaceActualSources(ctx context.Context, namespace string) []ThinSource { - return getSourcesForNamespace(ctx, namespace) -} - -func getSourcesForNamespace(ctx context.Context, namespace string) []ThinSource { - effectiveInstrumentedSources := map[SourceID]ThinSource{} - - var ( - items []GetApplicationItem - instrumentedApplications *v1alpha1.InstrumentedApplicationList - ) - - g, ctx := errgroup.WithContext(ctx) - g.Go(func() error { - relevantNamespaces, err := getRelevantNameSpaces(ctx, namespace) - if err != nil { - return err - } - nsInstrumentedMap := map[string]*bool{} - for _, ns := range relevantNamespaces { - nsInstrumentedMap[ns.Name] = isObjectLabeledForInstrumentation(ns.ObjectMeta) - } - items, err = getApplicationsInNamespace(ctx, "", nsInstrumentedMap) - return err - }) - - g.Go(func() error { - var err error - instrumentedApplications, err = kube.DefaultClient.OdigosClient.InstrumentedApplications("").List(ctx, metav1.ListOptions{}) - return err - }) - - if err := g.Wait(); err != nil { - return nil - } - - for _, item := range items { - if item.nsItem.InstrumentationEffective { - id := SourceID{Namespace: item.namespace, Kind: string(item.nsItem.Kind), Name: item.nsItem.Name} - effectiveInstrumentedSources[id] = ThinSource{ - NumberOfRunningInstances: item.nsItem.Instances, - SourceID: id, - } - } - } - - sourcesResult := []ThinSource{} - for _, app := range instrumentedApplications.Items { - thinSource := k8sInstrumentedAppToThinSource(&app) - if source, ok := effectiveInstrumentedSources[thinSource.SourceID]; ok { - source.IaDetails = thinSource.IaDetails - effectiveInstrumentedSources[thinSource.SourceID] = source - } - } - - for _, source := range effectiveInstrumentedSources { - sourcesResult = append(sourcesResult, source) - } - - return sourcesResult -} - func GetActualSource(ctx context.Context, ns string, kind string, name string) (*Source, error) { k8sObjectName := workload.GetRuntimeObjectName(name, kind) owner, numberOfRunningInstances := getWorkload(ctx, ns, kind, name) @@ -241,3 +191,146 @@ func k8sInstrumentedAppToThinSource(app *v1alpha1.InstrumentedApplication) ThinS } return source } + +func GetWorkloadsInNamespace(ctx context.Context, nsName string, instrumentationLabeled *bool) ([]model.K8sActualSource, error) { + + namespace, err := kube.DefaultClient.CoreV1().Namespaces().Get(ctx, nsName, metav1.GetOptions{}) + if err != nil { + return nil, err + } + + g, ctx := errgroup.WithContext(ctx) + var ( + deps []model.K8sActualSource + ss []model.K8sActualSource + dss []model.K8sActualSource + ) + + g.Go(func() error { + var err error + deps, err = getDeployments(ctx, *namespace, instrumentationLabeled) + return err + }) + + g.Go(func() error { + var err error + ss, err = getStatefulSets(ctx, *namespace, instrumentationLabeled) + return err + }) + + g.Go(func() error { + var err error + dss, err = getDaemonSets(ctx, *namespace, instrumentationLabeled) + return err + }) + + if err := g.Wait(); err != nil { + return nil, err + } + + items := make([]model.K8sActualSource, len(deps)+len(ss)+len(dss)) + copy(items, deps) + copy(items[len(deps):], ss) + copy(items[len(deps)+len(ss):], dss) + + return items, nil +} + +func getDeployments(ctx context.Context, namespace corev1.Namespace, instrumentationLabeled *bool) ([]model.K8sActualSource, error) { + var response []model.K8sActualSource + err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.AppsV1().Deployments(namespace.Name).List, ctx, metav1.ListOptions{}, func(deps *appsv1.DeploymentList) error { + for _, dep := range deps.Items { + _, _, decisionText, autoInstrumented := workload.GetInstrumentationLabelTexts(dep.GetLabels(), string(WorkloadKindDeployment), namespace.GetLabels()) + if instrumentationLabeled != nil && *instrumentationLabeled != autoInstrumented { + continue + } + numberOfInstances := int(dep.Status.ReadyReplicas) + response = append(response, model.K8sActualSource{ + Namespace: dep.Namespace, + Name: dep.Name, + Kind: k8sKindToGql(string(WorkloadKindDeployment)), + NumberOfInstances: &numberOfInstances, + AutoInstrumented: autoInstrumented, + AutoInstrumentedDecision: decisionText, + InstrumentedApplicationDetails: nil, // TODO: fill this + }) + } + return nil + }) + + if err != nil { + return nil, err + } + + return response, nil +} + +func getDaemonSets(ctx context.Context, namespace corev1.Namespace, instrumentationLabeled *bool) ([]model.K8sActualSource, error) { + var response []model.K8sActualSource + err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.AppsV1().DaemonSets(namespace.Name).List, ctx, metav1.ListOptions{}, func(dss *appsv1.DaemonSetList) error { + for _, ds := range dss.Items { + _, _, decisionText, autoInstrumented := workload.GetInstrumentationLabelTexts(ds.GetLabels(), string(WorkloadKindDaemonSet), namespace.GetLabels()) + if instrumentationLabeled != nil && *instrumentationLabeled != autoInstrumented { + continue + } + numberOfInstances := int(ds.Status.NumberReady) + response = append(response, model.K8sActualSource{ + Namespace: ds.Namespace, + Name: ds.Name, + Kind: k8sKindToGql(string(WorkloadKindDaemonSet)), + NumberOfInstances: &numberOfInstances, + AutoInstrumented: autoInstrumented, + AutoInstrumentedDecision: decisionText, + InstrumentedApplicationDetails: nil, // TODO: fill this + }) + } + return nil + }) + + if err != nil { + return nil, err + } + + return response, nil +} + +func getStatefulSets(ctx context.Context, namespace corev1.Namespace, instrumentationLabeled *bool) ([]model.K8sActualSource, error) { + var response []model.K8sActualSource + err := client.ListWithPages(client.DefaultPageSize, kube.DefaultClient.AppsV1().StatefulSets(namespace.Name).List, ctx, metav1.ListOptions{}, func(sss *appsv1.StatefulSetList) error { + for _, ss := range sss.Items { + _, _, decisionText, autoInstrumented := workload.GetInstrumentationLabelTexts(ss.GetLabels(), string(WorkloadKindStatefulSet), namespace.GetLabels()) + if instrumentationLabeled != nil && *instrumentationLabeled != autoInstrumented { + continue + } + numberOfInstances := int(ss.Status.ReadyReplicas) + response = append(response, model.K8sActualSource{ + Namespace: ss.Namespace, + Name: ss.Name, + Kind: k8sKindToGql(string(WorkloadKindStatefulSet)), + NumberOfInstances: &numberOfInstances, + AutoInstrumented: autoInstrumented, + AutoInstrumentedDecision: decisionText, + InstrumentedApplicationDetails: nil, // TODO: fill this + }) + } + return nil + }) + + if err != nil { + return nil, err + } + + return response, nil +} + +func k8sKindToGql(k8sResourceKind string) model.K8sResourceKind { + switch k8sResourceKind { + case "Deployment": + return model.K8sResourceKindDeployment + case "StatefulSet": + return model.K8sResourceKindStatefulSet + case "DaemonSet": + return model.K8sResourceKindDaemonSet + } + return "" +} diff --git a/frontend/services/utils.go b/frontend/services/utils.go deleted file mode 100644 index e41f28d6b..000000000 --- a/frontend/services/utils.go +++ /dev/null @@ -1,52 +0,0 @@ -package services - -import ( - "context" - "errors" - "path" - - "github.com/odigos-io/odigos/common/consts" - "github.com/odigos-io/odigos/frontend/kube" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" -) - -const cdnUrl = "https://d15jtxgb40qetw.cloudfront.net" - -func GetImageURL(image string) string { - return path.Join(cdnUrl, image) -} - -func setWorkloadInstrumentationLabel(ctx context.Context, nsName string, workloadName string, workloadKind WorkloadKind, enabled *bool) error { - jsonMergePatchData := getJsonMergePatchForInstrumentationLabel(enabled) - - switch workloadKind { - case WorkloadKindDeployment: - _, err := kube.DefaultClient.AppsV1().Deployments(nsName).Patch(ctx, workloadName, types.MergePatchType, jsonMergePatchData, metav1.PatchOptions{}) - return err - case WorkloadKindStatefulSet: - _, err := kube.DefaultClient.AppsV1().StatefulSets(nsName).Patch(ctx, workloadName, types.MergePatchType, jsonMergePatchData, metav1.PatchOptions{}) - return err - case WorkloadKindDaemonSet: - _, err := kube.DefaultClient.AppsV1().DaemonSets(nsName).Patch(ctx, workloadName, types.MergePatchType, jsonMergePatchData, metav1.PatchOptions{}) - return err - default: - return errors.New("unsupported workload kind " + string(workloadKind)) - } -} - -// getNsInstrumentedLabel return the instrumentation label of the object. -// if the object is not labeled, it returns nil -func isObjectLabeledForInstrumentation(metav metav1.ObjectMeta) *bool { - labels := metav.GetLabels() - if labels == nil { - return nil - } - namespaceInstrumented, found := labels[consts.OdigosInstrumentationLabel] - var nsInstrumentationLabeled *bool - if found { - instrumentationLabel := namespaceInstrumented == consts.InstrumentationEnabled - nsInstrumentationLabeled = &instrumentationLabel - } - return nsInstrumentationLabeled -} diff --git a/k8sutils/pkg/workload/workload.go b/k8sutils/pkg/workload/workload.go index be41b9d43..143bf3ba7 100644 --- a/k8sutils/pkg/workload/workload.go +++ b/k8sutils/pkg/workload/workload.go @@ -157,3 +157,51 @@ func IsInstrumentationDisabledExplicitly(obj client.Object) bool { return false } + +func GetInstrumentationLabelValue(labels map[string]string) *bool { + if val, exists := labels[consts.OdigosInstrumentationLabel]; exists { + enabled := val == consts.InstrumentationEnabled + return &enabled + } + + return nil +} + +func GetInstrumentationLabelTexts(workloadLabels map[string]string, workloadKind string, nsLabels map[string]string) (workloadText, nsText, decisionText string, sourceInstrumented bool) { + workloadLabel, workloadFound := workloadLabels[consts.OdigosInstrumentationLabel] + nsLabel, nsFound := nsLabels[consts.OdigosInstrumentationLabel] + + if workloadFound { + workloadText = consts.OdigosInstrumentationLabel + "=" + workloadLabel + } else { + workloadText = consts.OdigosInstrumentationLabel + " label not set" + } + + if nsFound { + nsText = consts.OdigosInstrumentationLabel + "=" + nsLabel + } else { + nsText = consts.OdigosInstrumentationLabel + " label not set" + } + + if workloadFound { + sourceInstrumented = workloadLabel == consts.InstrumentationEnabled + if sourceInstrumented { + decisionText = "Workload is instrumented because the " + workloadKind + " contains the label '" + consts.OdigosInstrumentationLabel + "=" + workloadLabel + "'" + } else { + decisionText = "Workload is NOT instrumented because the " + workloadKind + " contains the label '" + consts.OdigosInstrumentationLabel + "=" + workloadLabel + "'" + } + } else { + sourceInstrumented = nsLabel == consts.InstrumentationEnabled + if sourceInstrumented { + decisionText = "Workload is instrumented because the " + workloadKind + " is not labeled, and the namespace is labeled with '" + consts.OdigosInstrumentationLabel + "=" + nsLabel + "'" + } else { + if nsFound { + decisionText = "Workload is NOT instrumented because the " + workloadKind + " is not labeled, and the namespace is labeled with '" + consts.OdigosInstrumentationLabel + "=" + nsLabel + "'" + } else { + decisionText = "Workload is NOT instrumented because neither the workload nor the namespace has the '" + consts.OdigosInstrumentationLabel + "' label set" + } + } + } + + return +} From 50f542d6fba94525d934a2a1060e32fcd539103b Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 30 Jul 2024 11:46:12 +0300 Subject: [PATCH 117/374] chore: wip --- frontend/graph/schema.resolvers.go | 9 ++++++ frontend/services/namespaces.go | 8 +++-- .../main/sources/choose-sources/index.tsx | 19 +++++++----- .../graphql/queries/compute-platform.ts | 18 +++++++---- .../webapp/hooks/compute-platform/index.ts | 1 + .../compute-platform/useComputePlatform.ts | 10 ++----- .../hooks/compute-platform/useNamespace.ts | 30 +++++++++++++++++++ frontend/webapp/types/compute-platform.ts | 3 +- 8 files changed, 75 insertions(+), 23 deletions(-) create mode 100644 frontend/webapp/hooks/compute-platform/useNamespace.ts diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index dec5ce7dd..31f54457b 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -69,9 +69,18 @@ func (r *mutationResolver) CreateK8sDesiredNamespace(ctx context.Context, cpID s // ComputePlatform is the resolver for the computePlatform field. func (r *queryResolver) ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) { + namespacesResponse := services.GetK8SNamespaces(ctx) + + K8sActualNamespaces := make([]*model.K8sActualNamespace, len(namespacesResponse.Namespaces)) + for i, namespace := range namespacesResponse.Namespaces { + K8sActualNamespaces[i] = &model.K8sActualNamespace{ + Name: namespace.Name, + } + } return &model.ComputePlatform{ ComputePlatformType: model.ComputePlatformTypeK8s, + K8sActualNamespaces: K8sActualNamespaces, }, nil } diff --git a/frontend/services/namespaces.go b/frontend/services/namespaces.go index 5eaca3efd..fc22b6baf 100644 --- a/frontend/services/namespaces.go +++ b/frontend/services/namespaces.go @@ -29,7 +29,11 @@ type GetNamespaceItem struct { TotalApps int `json:"totalApps"` } -func GetK8SNamespaces(ctx context.Context, odigosns string) GetNamespacesResponse { +const ( + OdigosSystemNamespace = "odigos-system" +) + +func GetK8SNamespaces(ctx context.Context) GetNamespacesResponse { var ( relevantNameSpaces []v1.Namespace @@ -39,7 +43,7 @@ func GetK8SNamespaces(ctx context.Context, odigosns string) GetNamespacesRespons g, ctx := errgroup.WithContext(ctx) g.Go(func() error { var err error - relevantNameSpaces, err = getRelevantNameSpaces(ctx, odigosns) + relevantNameSpaces, err = getRelevantNameSpaces(ctx, OdigosSystemNamespace) return err }) diff --git a/frontend/webapp/containers/main/sources/choose-sources/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/index.tsx index dec62cc78..4357acff1 100644 --- a/frontend/webapp/containers/main/sources/choose-sources/index.tsx +++ b/frontend/webapp/containers/main/sources/choose-sources/index.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { useComputePlatform } from '@/hooks'; +import { useComputePlatform, useNamespace } from '@/hooks'; import { SourcesList } from './choose-sources-list'; import { SectionTitle, Divider } from '@/reuseable-components'; import { DropdownOption, K8sActualNamespace, K8sActualSource } from '@/types'; @@ -20,12 +20,20 @@ export function ChooseSourcesContainer() { const [selectedItems, setSelectedItems] = useState([]); const [namespacesList, setNamespacesList] = useState([]); + const [sourcesList, setSourcesList] = useState([]); + const { error, data } = useComputePlatform(); + const { data: namespacesData } = useNamespace(selectedOption?.value); useEffect(() => { data && buildNamespacesList(); }, [data, error]); + useEffect(() => { + console.log({ namespacesData }); + namespacesData && setSourcesList(namespacesData.k8sActualSources || []); + }, [namespacesData]); + useEffect(() => { selectAllCheckbox ? selectAllSources() : unselectAllSources(); }, [selectAllCheckbox]); @@ -51,11 +59,7 @@ export function ChooseSourcesContainer() { } function selectAllSources() { - const allSources = - data?.computePlatform?.k8sActualNamespaces.flatMap( - (namespace) => namespace.k8sActualSources - ) || []; - setSelectedItems(allSources); + setSelectedItems(sourcesList); } function unselectAllSources() { @@ -63,8 +67,7 @@ export function ChooseSourcesContainer() { } function getVisibleSources() { - const allSources = - data?.computePlatform?.k8sActualNamespaces[0].k8sActualSources || []; + const allSources = sourcesList || []; const filteredSources = searchFilter ? filterSources(allSources) : allSources; diff --git a/frontend/webapp/graphql/queries/compute-platform.ts b/frontend/webapp/graphql/queries/compute-platform.ts index 6d1f3244a..548549f8d 100644 --- a/frontend/webapp/graphql/queries/compute-platform.ts +++ b/frontend/webapp/graphql/queries/compute-platform.ts @@ -1,16 +1,24 @@ import { gql } from '@apollo/client'; export const GET_COMPUTE_PLATFORM = gql` - query GetComputePlatform($cpId: ID!) { - computePlatform(cpId: $cpId) { - id + query GetComputePlatform { + computePlatform { name - computePlatformType k8sActualNamespaces { name + } + } + } +`; + +export const GET_NAMESPACES = gql` + query GetK8sActualNamespace($namespaceName: String!) { + computePlatform { + k8sActualNamespace(name: $namespaceName) { + name k8sActualSources { - name kind + name numberOfInstances } } diff --git a/frontend/webapp/hooks/compute-platform/index.ts b/frontend/webapp/hooks/compute-platform/index.ts index f535085ea..6023020f7 100644 --- a/frontend/webapp/hooks/compute-platform/index.ts +++ b/frontend/webapp/hooks/compute-platform/index.ts @@ -1 +1,2 @@ export * from './useComputePlatform'; +export * from './useNamespace'; diff --git a/frontend/webapp/hooks/compute-platform/useComputePlatform.ts b/frontend/webapp/hooks/compute-platform/useComputePlatform.ts index 76d9f00f6..805dc835f 100644 --- a/frontend/webapp/hooks/compute-platform/useComputePlatform.ts +++ b/frontend/webapp/hooks/compute-platform/useComputePlatform.ts @@ -1,6 +1,6 @@ import { ComputePlatform } from '@/types'; import { useQuery } from '@apollo/client'; -import { GET_COMPUTE_PLATFORM } from '@/graphql'; +import { GET_COMPUTE_PLATFORM, GET_NAMESPACES } from '@/graphql'; type UseComputePlatformHook = { data?: ComputePlatform; @@ -9,12 +9,8 @@ type UseComputePlatformHook = { }; export const useComputePlatform = (): UseComputePlatformHook => { - const { data, loading, error } = useQuery( - GET_COMPUTE_PLATFORM, - { - variables: { cpId: '1' }, - } - ); + const { data, loading, error } = + useQuery(GET_COMPUTE_PLATFORM); return { data, loading, error }; }; diff --git a/frontend/webapp/hooks/compute-platform/useNamespace.ts b/frontend/webapp/hooks/compute-platform/useNamespace.ts new file mode 100644 index 000000000..beb415ee7 --- /dev/null +++ b/frontend/webapp/hooks/compute-platform/useNamespace.ts @@ -0,0 +1,30 @@ +import { useQuery } from '@apollo/client'; +import { GET_NAMESPACES } from '@/graphql'; +import { ComputePlatform, K8sActualNamespace } from '@/types'; +import { useEffect } from 'react'; + +type UseNamespaceHook = { + data?: K8sActualNamespace; + loading: boolean; + error?: Error; +}; + +export const useNamespace = ( + namespaceName: string | undefined +): UseNamespaceHook => { + const { data, loading, error } = useQuery(GET_NAMESPACES, { + skip: !namespaceName, + variables: { namespaceName }, + }); + + useEffect(() => { + console.log({ data }); + console.log({ error }); + }, [data, error]); + + return { + data: data?.computePlatform.k8sActualNamespace, + loading, + error, + }; +}; diff --git a/frontend/webapp/types/compute-platform.ts b/frontend/webapp/types/compute-platform.ts index e2233dadc..5bc647d63 100644 --- a/frontend/webapp/types/compute-platform.ts +++ b/frontend/webapp/types/compute-platform.ts @@ -1,13 +1,14 @@ import { K8sActualSource } from './sources'; export type K8sActualNamespace = { name: string; - k8sActualSources: K8sActualSource[]; + k8sActualSources?: K8sActualSource[]; }; type ComputePlatformData = { id: string; name: string; computePlatformType: string; + k8sActualNamespace?: K8sActualNamespace; k8sActualNamespaces: K8sActualNamespace[]; }; From 675eb6e1c92fb102fb49c9cf27c1c7af8cfc1132 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 30 Jul 2024 12:50:24 +0300 Subject: [PATCH 118/374] chore: select source step --- .../choose-sources-list/index.tsx | 12 ++----- .../main/sources/choose-sources/index.tsx | 32 ++++++++++++++----- .../hooks/compute-platform/useNamespace.ts | 7 +--- frontend/webapp/lib/gql/apollo-wrapper.tsx | 3 ++ .../reuseable-components/toggle/index.tsx | 6 +++- 5 files changed, 35 insertions(+), 25 deletions(-) diff --git a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx index 796bbe564..81c62b849 100644 --- a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx +++ b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx @@ -75,7 +75,7 @@ interface K8sActualSource { interface SourcesListProps { items: K8sActualSource[]; selectedItems: K8sActualSource[]; - setSelectedItems: React.Dispatch>; + setSelectedItems: (item: K8sActualSource) => void; } const SourcesList: React.FC = ({ @@ -83,21 +83,13 @@ const SourcesList: React.FC = ({ selectedItems, setSelectedItems, }) => { - const handleItemClick = (item: K8sActualSource) => { - setSelectedItems((prevSelectedItems) => - prevSelectedItems.includes(item) - ? prevSelectedItems.filter((selectedItem) => selectedItem !== item) - : [...prevSelectedItems, item] - ); - }; - return ( {items.map((item) => ( handleItemClick(item)} + onClick={() => setSelectedItems(item)} > diff --git a/frontend/webapp/containers/main/sources/choose-sources/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/index.tsx index 4357acff1..5b11bc670 100644 --- a/frontend/webapp/containers/main/sources/choose-sources/index.tsx +++ b/frontend/webapp/containers/main/sources/choose-sources/index.tsx @@ -1,14 +1,14 @@ import React, { useEffect, useState } from 'react'; -import { useComputePlatform, useNamespace } from '@/hooks'; import { SourcesList } from './choose-sources-list'; +import { useComputePlatform, useNamespace } from '@/hooks'; import { SectionTitle, Divider } from '@/reuseable-components'; import { DropdownOption, K8sActualNamespace, K8sActualSource } from '@/types'; import { SearchAndDropdown, TogglesAndCheckboxes } from './choose-sources-menu'; import { - SearchDropdownHandlers, SearchDropdownState, - ToggleCheckboxHandlers, ToggleCheckboxState, + SearchDropdownHandlers, + ToggleCheckboxHandlers, } from './choose-sources-menu/type'; export function ChooseSourcesContainer() { @@ -30,12 +30,11 @@ export function ChooseSourcesContainer() { }, [data, error]); useEffect(() => { - console.log({ namespacesData }); namespacesData && setSourcesList(namespacesData.k8sActualSources || []); }, [namespacesData]); useEffect(() => { - selectAllCheckbox ? selectAllSources() : unselectAllSources(); + selectAllCheckbox && selectAllSources(); }, [selectAllCheckbox]); function buildNamespacesList() { @@ -62,8 +61,25 @@ export function ChooseSourcesContainer() { setSelectedItems(sourcesList); } - function unselectAllSources() { - setSelectedItems([]); + function handleSelectItem(item: K8sActualSource) { + if (selectedItems.includes(item)) { + const updatedSelectedItems = selectedItems.filter( + (selectedItem) => selectedItem !== item + ); + setSelectedItems(updatedSelectedItems); + if ( + selectAllCheckbox && + updatedSelectedItems.length !== sourcesList.length + ) { + setSelectAllCheckbox(false); + } + } else { + const updatedSelectedItems = [...selectedItems, item]; + setSelectedItems(updatedSelectedItems); + if (updatedSelectedItems.length === sourcesList.length) { + setSelectAllCheckbox(true); + } + } } function getVisibleSources() { @@ -119,7 +135,7 @@ export function ChooseSourcesContainer() { diff --git a/frontend/webapp/hooks/compute-platform/useNamespace.ts b/frontend/webapp/hooks/compute-platform/useNamespace.ts index beb415ee7..f8a3cf818 100644 --- a/frontend/webapp/hooks/compute-platform/useNamespace.ts +++ b/frontend/webapp/hooks/compute-platform/useNamespace.ts @@ -1,7 +1,6 @@ import { useQuery } from '@apollo/client'; import { GET_NAMESPACES } from '@/graphql'; import { ComputePlatform, K8sActualNamespace } from '@/types'; -import { useEffect } from 'react'; type UseNamespaceHook = { data?: K8sActualNamespace; @@ -15,13 +14,9 @@ export const useNamespace = ( const { data, loading, error } = useQuery(GET_NAMESPACES, { skip: !namespaceName, variables: { namespaceName }, + fetchPolicy: 'cache-first', }); - useEffect(() => { - console.log({ data }); - console.log({ error }); - }, [data, error]); - return { data: data?.computePlatform.k8sActualNamespace, loading, diff --git a/frontend/webapp/lib/gql/apollo-wrapper.tsx b/frontend/webapp/lib/gql/apollo-wrapper.tsx index 6ccd91e74..0bef52a51 100644 --- a/frontend/webapp/lib/gql/apollo-wrapper.tsx +++ b/frontend/webapp/lib/gql/apollo-wrapper.tsx @@ -27,6 +27,9 @@ function makeClient() { return new ApolloClient({ cache: new InMemoryCache(), + devtools: { + enabled: true, + }, link: typeof window === 'undefined' ? ApolloLink.from([ diff --git a/frontend/webapp/reuseable-components/toggle/index.tsx b/frontend/webapp/reuseable-components/toggle/index.tsx index e3377c4a0..d0435143c 100644 --- a/frontend/webapp/reuseable-components/toggle/index.tsx +++ b/frontend/webapp/reuseable-components/toggle/index.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import Image from 'next/image'; import styled, { css } from 'styled-components'; import { Tooltip } from '../tooltip'; @@ -54,6 +54,10 @@ const Toggle: React.FC = ({ }) => { const [isActive, setIsActive] = useState(initialValue); + useEffect(() => { + setIsActive(initialValue); + }, [initialValue]); + const handleToggle = () => { if (!disabled) { const newValue = !isActive; From ab6daf0b59bc33f1d01779c131d533e4c584fdbd Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 30 Jul 2024 14:14:10 +0300 Subject: [PATCH 119/374] chore: init add destination --- .../app/setup/choose-destination/page.tsx | 11 +++++ .../components/setup/headers/header/index.tsx | 14 +++++- .../choose-destination-menu/index.tsx | 0 .../destinations-list/index.tsx | 0 .../destinations/choose-destination/index.tsx | 47 +++++++++++++++++++ .../containers/main/destinations/index.tsx | 1 + frontend/webapp/public/icons/common/plus.svg | 3 ++ .../reuseable-components/button/index.tsx | 3 +- .../reuseable-components/text/index.tsx | 5 ++ 9 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 frontend/webapp/app/setup/choose-destination/page.tsx create mode 100644 frontend/webapp/containers/main/destinations/choose-destination/choose-destination-menu/index.tsx create mode 100644 frontend/webapp/containers/main/destinations/choose-destination/destinations-list/index.tsx create mode 100644 frontend/webapp/containers/main/destinations/choose-destination/index.tsx create mode 100644 frontend/webapp/public/icons/common/plus.svg diff --git a/frontend/webapp/app/setup/choose-destination/page.tsx b/frontend/webapp/app/setup/choose-destination/page.tsx new file mode 100644 index 000000000..9d2189d08 --- /dev/null +++ b/frontend/webapp/app/setup/choose-destination/page.tsx @@ -0,0 +1,11 @@ +'use client'; +import { ChooseDestinationContainer } from '@/containers/main'; +import React from 'react'; + +export default function ChooseDestinationPage() { + return ( + <> + + + ); +} diff --git a/frontend/webapp/components/setup/headers/header/index.tsx b/frontend/webapp/components/setup/headers/header/index.tsx index b1bfa77ec..29bd04789 100644 --- a/frontend/webapp/components/setup/headers/header/index.tsx +++ b/frontend/webapp/components/setup/headers/header/index.tsx @@ -59,12 +59,22 @@ export const SetupHeader: React.FC = ({ onBack, onNext }) => { width={8} height={12} /> - + BACK - + NEXT + + + + back + + ADD DESTINATION + + + + + ); +} diff --git a/frontend/webapp/containers/main/destinations/index.tsx b/frontend/webapp/containers/main/destinations/index.tsx index 8dd9a55e6..eef1f549b 100644 --- a/frontend/webapp/containers/main/destinations/index.tsx +++ b/frontend/webapp/containers/main/destinations/index.tsx @@ -1 +1,2 @@ export * from './managed'; +export * from './choose-destination'; diff --git a/frontend/webapp/public/icons/common/plus.svg b/frontend/webapp/public/icons/common/plus.svg new file mode 100644 index 000000000..2f6fad8b7 --- /dev/null +++ b/frontend/webapp/public/icons/common/plus.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/webapp/reuseable-components/button/index.tsx b/frontend/webapp/reuseable-components/button/index.tsx index 9ef4562a9..e4c3d3f18 100644 --- a/frontend/webapp/reuseable-components/button/index.tsx +++ b/frontend/webapp/reuseable-components/button/index.tsx @@ -26,7 +26,8 @@ const variantStyles = { border: 1px solid rgba(249, 249, 249, 0.24); border-radius: 32px; &:hover { - background: #151515bc; + border: 1px solid rgba(249, 249, 249, 0.32); + background: rgba(249, 249, 249, 0.04); } &:active { background: #1515158d; diff --git a/frontend/webapp/reuseable-components/text/index.tsx b/frontend/webapp/reuseable-components/text/index.tsx index a375ed19a..61c582f40 100644 --- a/frontend/webapp/reuseable-components/text/index.tsx +++ b/frontend/webapp/reuseable-components/text/index.tsx @@ -9,6 +9,7 @@ interface TextProps { align?: 'left' | 'center' | 'right'; family?: 'primary' | 'secondary'; opacity?: number; + decoration?: string; } const TextWrapper = styled.div<{ @@ -18,12 +19,14 @@ const TextWrapper = styled.div<{ align: 'left' | 'center' | 'right'; family?: 'primary' | 'secondary'; opacity: number; + decoration?: string; }>` color: ${({ color, theme }) => color || theme.colors.text}; font-size: ${({ size }) => size}px; font-weight: ${({ weight }) => weight}; text-align: ${({ align }) => align}; opacity: ${({ opacity }) => opacity}; + text-decoration: ${({ decoration }) => decoration}; font-family: ${({ theme, family }) => { if (family === 'primary') { return theme.font_family.primary; @@ -43,6 +46,7 @@ const Text: React.FC = ({ align = 'left', family = 'primary', opacity = 1, + decoration, }) => { return ( = ({ weight={weight} align={align} opacity={opacity} + decoration={decoration} > {children} From 3359112ad181674b2a78686e7c94c944f484b282 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 30 Jul 2024 16:54:59 +0300 Subject: [PATCH 120/374] chore: get destination type --- frontend/gqlgen.yml | 5 + frontend/graph/generated.go | 3879 ++++++++++++++++++++------- frontend/graph/model/destination.go | 48 + frontend/graph/schema.graphqls | 52 +- frontend/graph/schema.resolvers.go | 43 +- frontend/services/destinations.go | 49 + frontend/services/utils.go | 9 + 7 files changed, 3103 insertions(+), 982 deletions(-) create mode 100644 frontend/graph/model/destination.go create mode 100644 frontend/services/destinations.go create mode 100644 frontend/services/utils.go diff --git a/frontend/gqlgen.yml b/frontend/gqlgen.yml index de1e87028..c4161c003 100644 --- a/frontend/gqlgen.yml +++ b/frontend/gqlgen.yml @@ -24,6 +24,11 @@ resolver: package: graph filename_template: '{name}.resolvers.go' +# gqlgen will search for any type names in the schema in these go packages +# if they match it will use them, otherwise it will generate them. +autobind: + - 'github.com/odigos-io/odigos/frontend/graph/model' + models: ID: model: diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index 4fcf78c0a..ab9a757eb 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -40,6 +40,8 @@ type Config struct { type ResolverRoot interface { ComputePlatform() ComputePlatformResolver + Destination() DestinationResolver + DestinationTypesCategoryItem() DestinationTypesCategoryItemResolver K8sActualNamespace() K8sActualNamespaceResolver Mutation() MutationResolver Query() QueryResolver @@ -66,10 +68,43 @@ type ComplexityRoot struct { Type func(childComplexity int) int } + Destination struct { + Conditions func(childComplexity int) int + DestinationType func(childComplexity int) int + ExportedSignals func(childComplexity int) int + Fields func(childComplexity int) int + Id func(childComplexity int) int + Name func(childComplexity int) int + Type func(childComplexity int) int + } + + DestinationTypesCategoryItem struct { + DisplayName func(childComplexity int) int + ImageUrl func(childComplexity int) int + SupportedSignals func(childComplexity int) int + TestConnectionSupported func(childComplexity int) int + Type func(childComplexity int) int + } + + DestinationsCategory struct { + Items func(childComplexity int) int + Name func(childComplexity int) int + } + + ExportedSignals struct { + Logs func(childComplexity int) int + Metrics func(childComplexity int) int + Traces func(childComplexity int) int + } + GetConfigResponse struct { Installation func(childComplexity int) int } + GetDestinationTypesResponse struct { + Categories func(childComplexity int) int + } + InstrumentedApplicationDetails struct { Conditions func(childComplexity int) int Containers func(childComplexity int) int @@ -96,15 +131,26 @@ type ComplexityRoot struct { CreateK8sDesiredNamespace func(childComplexity int, cpID string, namespace model.K8sDesiredNamespaceInput) int } + ObservabilitySignalSupport struct { + Supported func(childComplexity int) int + } + Query struct { - ComputePlatform func(childComplexity int) int - Config func(childComplexity int) int + ComputePlatform func(childComplexity int) int + Config func(childComplexity int) int + DestinationTypes func(childComplexity int) int } SourceContainerRuntimeDetails struct { ContainerName func(childComplexity int) int Language func(childComplexity int) int } + + SupportedSignals struct { + Logs func(childComplexity int) int + Metrics func(childComplexity int) int + Traces func(childComplexity int) int + } } type ComputePlatformResolver interface { @@ -112,6 +158,16 @@ type ComputePlatformResolver interface { K8sActualSource(ctx context.Context, obj *model.ComputePlatform, name *string, namespace *string, kind *string) (*model.K8sActualSource, error) } +type DestinationResolver interface { + Type(ctx context.Context, obj *model.Destination) (string, error) + + Fields(ctx context.Context, obj *model.Destination) ([]string, error) + + Conditions(ctx context.Context, obj *model.Destination) ([]*model.Condition, error) +} +type DestinationTypesCategoryItemResolver interface { + Type(ctx context.Context, obj *model.DestinationTypesCategoryItem) (string, error) +} type K8sActualNamespaceResolver interface { K8sActualSources(ctx context.Context, obj *model.K8sActualNamespace, instrumentationLabeled *bool) ([]*model.K8sActualSource, error) } @@ -121,6 +177,7 @@ type MutationResolver interface { type QueryResolver interface { ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) Config(ctx context.Context) (*model.GetConfigResponse, error) + DestinationTypes(ctx context.Context) (*model.GetDestinationTypesResponse, error) } type executableSchema struct { @@ -229,6 +286,125 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Condition.Type(childComplexity), true + case "Destination.conditions": + if e.complexity.Destination.Conditions == nil { + break + } + + return e.complexity.Destination.Conditions(childComplexity), true + + case "Destination.destinationType": + if e.complexity.Destination.DestinationType == nil { + break + } + + return e.complexity.Destination.DestinationType(childComplexity), true + + case "Destination.exportedSignals": + if e.complexity.Destination.ExportedSignals == nil { + break + } + + return e.complexity.Destination.ExportedSignals(childComplexity), true + + case "Destination.fields": + if e.complexity.Destination.Fields == nil { + break + } + + return e.complexity.Destination.Fields(childComplexity), true + + case "Destination.id": + if e.complexity.Destination.Id == nil { + break + } + + return e.complexity.Destination.Id(childComplexity), true + + case "Destination.name": + if e.complexity.Destination.Name == nil { + break + } + + return e.complexity.Destination.Name(childComplexity), true + + case "Destination.type": + if e.complexity.Destination.Type == nil { + break + } + + return e.complexity.Destination.Type(childComplexity), true + + case "DestinationTypesCategoryItem.displayName": + if e.complexity.DestinationTypesCategoryItem.DisplayName == nil { + break + } + + return e.complexity.DestinationTypesCategoryItem.DisplayName(childComplexity), true + + case "DestinationTypesCategoryItem.imageUrl": + if e.complexity.DestinationTypesCategoryItem.ImageUrl == nil { + break + } + + return e.complexity.DestinationTypesCategoryItem.ImageUrl(childComplexity), true + + case "DestinationTypesCategoryItem.supportedSignals": + if e.complexity.DestinationTypesCategoryItem.SupportedSignals == nil { + break + } + + return e.complexity.DestinationTypesCategoryItem.SupportedSignals(childComplexity), true + + case "DestinationTypesCategoryItem.testConnectionSupported": + if e.complexity.DestinationTypesCategoryItem.TestConnectionSupported == nil { + break + } + + return e.complexity.DestinationTypesCategoryItem.TestConnectionSupported(childComplexity), true + + case "DestinationTypesCategoryItem.type": + if e.complexity.DestinationTypesCategoryItem.Type == nil { + break + } + + return e.complexity.DestinationTypesCategoryItem.Type(childComplexity), true + + case "DestinationsCategory.items": + if e.complexity.DestinationsCategory.Items == nil { + break + } + + return e.complexity.DestinationsCategory.Items(childComplexity), true + + case "DestinationsCategory.name": + if e.complexity.DestinationsCategory.Name == nil { + break + } + + return e.complexity.DestinationsCategory.Name(childComplexity), true + + case "ExportedSignals.logs": + if e.complexity.ExportedSignals.Logs == nil { + break + } + + return e.complexity.ExportedSignals.Logs(childComplexity), true + + case "ExportedSignals.metrics": + if e.complexity.ExportedSignals.Metrics == nil { + break + } + + return e.complexity.ExportedSignals.Metrics(childComplexity), true + + case "ExportedSignals.traces": + if e.complexity.ExportedSignals.Traces == nil { + break + } + + return e.complexity.ExportedSignals.Traces(childComplexity), true + case "GetConfigResponse.installation": if e.complexity.GetConfigResponse.Installation == nil { break @@ -236,6 +412,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.GetConfigResponse.Installation(childComplexity), true + case "GetDestinationTypesResponse.categories": + if e.complexity.GetDestinationTypesResponse.Categories == nil { + break + } + + return e.complexity.GetDestinationTypesResponse.Categories(childComplexity), true + case "InstrumentedApplicationDetails.conditions": if e.complexity.InstrumentedApplicationDetails.Conditions == nil { break @@ -344,6 +527,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.CreateK8sDesiredNamespace(childComplexity, args["cpId"].(string), args["namespace"].(model.K8sDesiredNamespaceInput)), true + case "ObservabilitySignalSupport.supported": + if e.complexity.ObservabilitySignalSupport.Supported == nil { + break + } + + return e.complexity.ObservabilitySignalSupport.Supported(childComplexity), true + case "Query.computePlatform": if e.complexity.Query.ComputePlatform == nil { break @@ -358,6 +548,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Config(childComplexity), true + case "Query.destinationTypes": + if e.complexity.Query.DestinationTypes == nil { + break + } + + return e.complexity.Query.DestinationTypes(childComplexity), true + case "SourceContainerRuntimeDetails.containerName": if e.complexity.SourceContainerRuntimeDetails.ContainerName == nil { break @@ -372,6 +569,27 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.SourceContainerRuntimeDetails.Language(childComplexity), true + case "SupportedSignals.logs": + if e.complexity.SupportedSignals.Logs == nil { + break + } + + return e.complexity.SupportedSignals.Logs(childComplexity), true + + case "SupportedSignals.metrics": + if e.complexity.SupportedSignals.Metrics == nil { + break + } + + return e.complexity.SupportedSignals.Metrics(childComplexity), true + + case "SupportedSignals.traces": + if e.complexity.SupportedSignals.Traces == nil { + break + } + + return e.complexity.SupportedSignals.Traces(childComplexity), true + } return 0, false } @@ -1180,8 +1398,8 @@ func (ec *executionContext) fieldContext_Condition_message(_ context.Context, fi return fc, nil } -func (ec *executionContext) _GetConfigResponse_installation(ctx context.Context, field graphql.CollectedField, obj *model.GetConfigResponse) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_GetConfigResponse_installation(ctx, field) +func (ec *executionContext) _Destination_id(ctx context.Context, field graphql.CollectedField, obj *model.Destination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Destination_id(ctx, field) if err != nil { return graphql.Null } @@ -1194,7 +1412,7 @@ func (ec *executionContext) _GetConfigResponse_installation(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Installation, nil + return obj.Id, nil }) if err != nil { ec.Error(ctx, err) @@ -1206,26 +1424,26 @@ func (ec *executionContext) _GetConfigResponse_installation(ctx context.Context, } return graphql.Null } - res := resTmp.(model.InstallationStatus) + res := resTmp.(string) fc.Result = res - return ec.marshalNInstallationStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstallationStatus(ctx, field.Selections, res) + return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_GetConfigResponse_installation(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Destination_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "GetConfigResponse", + Object: "Destination", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type InstallationStatus does not have child fields") + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _InstrumentedApplicationDetails_containers(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentedApplicationDetails_containers(ctx, field) +func (ec *executionContext) _Destination_name(ctx context.Context, field graphql.CollectedField, obj *model.Destination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Destination_name(ctx, field) if err != nil { return graphql.Null } @@ -1238,41 +1456,38 @@ func (ec *executionContext) _InstrumentedApplicationDetails_containers(ctx conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Containers, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*model.SourceContainerRuntimeDetails) + res := resTmp.(string) fc.Result = res - return ec.marshalOSourceContainerRuntimeDetails2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceContainerRuntimeDetailsᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_containers(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Destination_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentedApplicationDetails", + Object: "Destination", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "containerName": - return ec.fieldContext_SourceContainerRuntimeDetails_containerName(ctx, field) - case "language": - return ec.fieldContext_SourceContainerRuntimeDetails_language(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type SourceContainerRuntimeDetails", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _InstrumentedApplicationDetails_conditions(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) +func (ec *executionContext) _Destination_type(ctx context.Context, field graphql.CollectedField, obj *model.Destination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Destination_type(ctx, field) if err != nil { return graphql.Null } @@ -1285,47 +1500,38 @@ func (ec *executionContext) _InstrumentedApplicationDetails_conditions(ctx conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Conditions, nil + return ec.resolvers.Destination().Type(rctx, obj) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*model.Condition) + res := resTmp.(string) fc.Result = res - return ec.marshalOCondition2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_conditions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Destination_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentedApplicationDetails", + Object: "Destination", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "type": - return ec.fieldContext_Condition_type(ctx, field) - case "status": - return ec.fieldContext_Condition_status(ctx, field) - case "lastTransitionTime": - return ec.fieldContext_Condition_lastTransitionTime(ctx, field) - case "reason": - return ec.fieldContext_Condition_reason(ctx, field) - case "message": - return ec.fieldContext_Condition_message(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Condition", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _K8sActualNamespace_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualNamespace_name(ctx, field) +func (ec *executionContext) _Destination_exportedSignals(ctx context.Context, field graphql.CollectedField, obj *model.Destination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Destination_exportedSignals(ctx, field) if err != nil { return graphql.Null } @@ -1338,7 +1544,7 @@ func (ec *executionContext) _K8sActualNamespace_name(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.ExportedSignals, nil }) if err != nil { ec.Error(ctx, err) @@ -1350,26 +1556,34 @@ func (ec *executionContext) _K8sActualNamespace_name(ctx context.Context, field } return graphql.Null } - res := resTmp.(string) + res := resTmp.(model.ExportedSignals) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNExportedSignals2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐExportedSignals(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualNamespace_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Destination_exportedSignals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualNamespace", + Object: "Destination", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "traces": + return ec.fieldContext_ExportedSignals_traces(ctx, field) + case "metrics": + return ec.fieldContext_ExportedSignals_metrics(ctx, field) + case "logs": + return ec.fieldContext_ExportedSignals_logs(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ExportedSignals", field.Name) }, } return fc, nil } -func (ec *executionContext) _K8sActualNamespace_instrumentationLabelEnabled(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualNamespace_instrumentationLabelEnabled(ctx, field) +func (ec *executionContext) _Destination_fields(ctx context.Context, field graphql.CollectedField, obj *model.Destination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Destination_fields(ctx, field) if err != nil { return graphql.Null } @@ -1382,35 +1596,38 @@ func (ec *executionContext) _K8sActualNamespace_instrumentationLabelEnabled(ctx }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InstrumentationLabelEnabled, nil + return ec.resolvers.Destination().Fields(rctx, obj) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*bool) + res := resTmp.([]string) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualNamespace_instrumentationLabelEnabled(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Destination_fields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualNamespace", + Object: "Destination", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _K8sActualNamespace_k8sActualSources(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) +func (ec *executionContext) _Destination_destinationType(ctx context.Context, field graphql.CollectedField, obj *model.Destination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Destination_destinationType(ctx, field) if err != nil { return graphql.Null } @@ -1423,7 +1640,7 @@ func (ec *executionContext) _K8sActualNamespace_k8sActualSources(ctx context.Con }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.K8sActualNamespace().K8sActualSources(rctx, obj, fc.Args["instrumentationLabeled"].(*bool)) + return obj.DestinationType, nil }) if err != nil { ec.Error(ctx, err) @@ -1435,55 +1652,38 @@ func (ec *executionContext) _K8sActualNamespace_k8sActualSources(ctx context.Con } return graphql.Null } - res := resTmp.([]*model.K8sActualSource) + res := resTmp.(model.DestinationTypesCategoryItem) fc.Result = res - return ec.marshalNK8sActualSource2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx, field.Selections, res) + return ec.marshalNDestinationTypesCategoryItem2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypesCategoryItem(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualNamespace_k8sActualSources(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Destination_destinationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualNamespace", + Object: "Destination", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "namespace": - return ec.fieldContext_K8sActualSource_namespace(ctx, field) - case "kind": - return ec.fieldContext_K8sActualSource_kind(ctx, field) - case "name": - return ec.fieldContext_K8sActualSource_name(ctx, field) - case "serviceName": - return ec.fieldContext_K8sActualSource_serviceName(ctx, field) - case "numberOfInstances": - return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) - case "autoInstrumented": - return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) - case "autoInstrumentedDecision": - return ec.fieldContext_K8sActualSource_autoInstrumentedDecision(ctx, field) - case "instrumentedApplicationDetails": - return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) + case "type": + return ec.fieldContext_DestinationTypesCategoryItem_type(ctx, field) + case "displayName": + return ec.fieldContext_DestinationTypesCategoryItem_displayName(ctx, field) + case "imageUrl": + return ec.fieldContext_DestinationTypesCategoryItem_imageUrl(ctx, field) + case "supportedSignals": + return ec.fieldContext_DestinationTypesCategoryItem_supportedSignals(ctx, field) + case "testConnectionSupported": + return ec.fieldContext_DestinationTypesCategoryItem_testConnectionSupported(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type K8sActualSource", field.Name) + return nil, fmt.Errorf("no field named %q was found under type DestinationTypesCategoryItem", field.Name) }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_K8sActualNamespace_k8sActualSources_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _K8sActualSource_namespace(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_namespace(ctx, field) +func (ec *executionContext) _Destination_conditions(ctx context.Context, field graphql.CollectedField, obj *model.Destination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Destination_conditions(ctx, field) if err != nil { return graphql.Null } @@ -1496,38 +1696,47 @@ func (ec *executionContext) _K8sActualSource_namespace(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Namespace, nil + return ec.resolvers.Destination().Conditions(rctx, obj) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.([]*model.Condition) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOCondition2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Destination_conditions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "Destination", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } + switch field.Name { + case "type": + return ec.fieldContext_Condition_type(ctx, field) + case "status": + return ec.fieldContext_Condition_status(ctx, field) + case "lastTransitionTime": + return ec.fieldContext_Condition_lastTransitionTime(ctx, field) + case "reason": + return ec.fieldContext_Condition_reason(ctx, field) + case "message": + return ec.fieldContext_Condition_message(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Condition", field.Name) + }, + } return fc, nil } -func (ec *executionContext) _K8sActualSource_kind(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_kind(ctx, field) +func (ec *executionContext) _DestinationTypesCategoryItem_type(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypesCategoryItem) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypesCategoryItem_type(ctx, field) if err != nil { return graphql.Null } @@ -1540,7 +1749,7 @@ func (ec *executionContext) _K8sActualSource_kind(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Kind, nil + return ec.resolvers.DestinationTypesCategoryItem().Type(rctx, obj) }) if err != nil { ec.Error(ctx, err) @@ -1552,26 +1761,26 @@ func (ec *executionContext) _K8sActualSource_kind(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(model.K8sResourceKind) + res := resTmp.(string) fc.Result = res - return ec.marshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_DestinationTypesCategoryItem_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "DestinationTypesCategoryItem", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type K8sResourceKind does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _K8sActualSource_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_name(ctx, field) +func (ec *executionContext) _DestinationTypesCategoryItem_displayName(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypesCategoryItem) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypesCategoryItem_displayName(ctx, field) if err != nil { return graphql.Null } @@ -1584,7 +1793,7 @@ func (ec *executionContext) _K8sActualSource_name(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.DisplayName, nil }) if err != nil { ec.Error(ctx, err) @@ -1601,9 +1810,9 @@ func (ec *executionContext) _K8sActualSource_name(ctx context.Context, field gra return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_DestinationTypesCategoryItem_displayName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "DestinationTypesCategoryItem", Field: field, IsMethod: false, IsResolver: false, @@ -1614,8 +1823,8 @@ func (ec *executionContext) fieldContext_K8sActualSource_name(_ context.Context, return fc, nil } -func (ec *executionContext) _K8sActualSource_serviceName(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_serviceName(ctx, field) +func (ec *executionContext) _DestinationTypesCategoryItem_imageUrl(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypesCategoryItem) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypesCategoryItem_imageUrl(ctx, field) if err != nil { return graphql.Null } @@ -1628,23 +1837,26 @@ func (ec *executionContext) _K8sActualSource_serviceName(ctx context.Context, fi }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ServiceName, nil + return obj.ImageUrl, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_serviceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_DestinationTypesCategoryItem_imageUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "DestinationTypesCategoryItem", Field: field, IsMethod: false, IsResolver: false, @@ -1655,8 +1867,8 @@ func (ec *executionContext) fieldContext_K8sActualSource_serviceName(_ context.C return fc, nil } -func (ec *executionContext) _K8sActualSource_numberOfInstances(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) +func (ec *executionContext) _DestinationTypesCategoryItem_supportedSignals(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypesCategoryItem) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypesCategoryItem_supportedSignals(ctx, field) if err != nil { return graphql.Null } @@ -1669,35 +1881,46 @@ func (ec *executionContext) _K8sActualSource_numberOfInstances(ctx context.Conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.NumberOfInstances, nil + return obj.SupportedSignals, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*int) + res := resTmp.(model.SupportedSignals) fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) + return ec.marshalNSupportedSignals2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSupportedSignals(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_numberOfInstances(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_DestinationTypesCategoryItem_supportedSignals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "DestinationTypesCategoryItem", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + switch field.Name { + case "traces": + return ec.fieldContext_SupportedSignals_traces(ctx, field) + case "metrics": + return ec.fieldContext_SupportedSignals_metrics(ctx, field) + case "logs": + return ec.fieldContext_SupportedSignals_logs(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type SupportedSignals", field.Name) }, } return fc, nil } -func (ec *executionContext) _K8sActualSource_autoInstrumented(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) +func (ec *executionContext) _DestinationTypesCategoryItem_testConnectionSupported(ctx context.Context, field graphql.CollectedField, obj *model.DestinationTypesCategoryItem) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationTypesCategoryItem_testConnectionSupported(ctx, field) if err != nil { return graphql.Null } @@ -1710,7 +1933,7 @@ func (ec *executionContext) _K8sActualSource_autoInstrumented(ctx context.Contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.AutoInstrumented, nil + return obj.TestConnectionSupported, nil }) if err != nil { ec.Error(ctx, err) @@ -1727,9 +1950,9 @@ func (ec *executionContext) _K8sActualSource_autoInstrumented(ctx context.Contex return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_DestinationTypesCategoryItem_testConnectionSupported(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "DestinationTypesCategoryItem", Field: field, IsMethod: false, IsResolver: false, @@ -1740,8 +1963,8 @@ func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumented(_ cont return fc, nil } -func (ec *executionContext) _K8sActualSource_autoInstrumentedDecision(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_autoInstrumentedDecision(ctx, field) +func (ec *executionContext) _DestinationsCategory_name(ctx context.Context, field graphql.CollectedField, obj *model.DestinationsCategory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationsCategory_name(ctx, field) if err != nil { return graphql.Null } @@ -1754,7 +1977,7 @@ func (ec *executionContext) _K8sActualSource_autoInstrumentedDecision(ctx contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.AutoInstrumentedDecision, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -1771,9 +1994,9 @@ func (ec *executionContext) _K8sActualSource_autoInstrumentedDecision(ctx contex return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumentedDecision(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_DestinationsCategory_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "DestinationsCategory", Field: field, IsMethod: false, IsResolver: false, @@ -1784,8 +2007,8 @@ func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumentedDecisio return fc, nil } -func (ec *executionContext) _K8sActualSource_instrumentedApplicationDetails(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) +func (ec *executionContext) _DestinationsCategory_items(ctx context.Context, field graphql.CollectedField, obj *model.DestinationsCategory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DestinationsCategory_items(ctx, field) if err != nil { return graphql.Null } @@ -1798,41 +2021,50 @@ func (ec *executionContext) _K8sActualSource_instrumentedApplicationDetails(ctx }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InstrumentedApplicationDetails, nil + return obj.Items, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*model.InstrumentedApplicationDetails) + res := resTmp.([]model.DestinationTypesCategoryItem) fc.Result = res - return ec.marshalOInstrumentedApplicationDetails2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentedApplicationDetails(ctx, field.Selections, res) + return ec.marshalNDestinationTypesCategoryItem2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypesCategoryItemᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_K8sActualSource_instrumentedApplicationDetails(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_DestinationsCategory_items(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "K8sActualSource", + Object: "DestinationsCategory", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "containers": - return ec.fieldContext_InstrumentedApplicationDetails_containers(ctx, field) - case "conditions": - return ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) + case "type": + return ec.fieldContext_DestinationTypesCategoryItem_type(ctx, field) + case "displayName": + return ec.fieldContext_DestinationTypesCategoryItem_displayName(ctx, field) + case "imageUrl": + return ec.fieldContext_DestinationTypesCategoryItem_imageUrl(ctx, field) + case "supportedSignals": + return ec.fieldContext_DestinationTypesCategoryItem_supportedSignals(ctx, field) + case "testConnectionSupported": + return ec.fieldContext_DestinationTypesCategoryItem_testConnectionSupported(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type InstrumentedApplicationDetails", field.Name) + return nil, fmt.Errorf("no field named %q was found under type DestinationTypesCategoryItem", field.Name) }, } return fc, nil } -func (ec *executionContext) _Mutation_createK8sDesiredNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_createK8sDesiredNamespace(ctx, field) +func (ec *executionContext) _ExportedSignals_traces(ctx context.Context, field graphql.CollectedField, obj *model.ExportedSignals) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ExportedSignals_traces(ctx, field) if err != nil { return graphql.Null } @@ -1845,54 +2077,38 @@ func (ec *executionContext) _Mutation_createK8sDesiredNamespace(ctx context.Cont }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CreateK8sDesiredNamespace(rctx, fc.Args["cpId"].(string), fc.Args["namespace"].(model.K8sDesiredNamespaceInput)) + return obj.Traces, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*model.K8sActualNamespace) + res := resTmp.(bool) fc.Result = res - return ec.marshalOK8sActualNamespace2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_createK8sDesiredNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ExportedSignals_traces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "ExportedSignals", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_K8sActualNamespace_name(ctx, field) - case "instrumentationLabelEnabled": - return ec.fieldContext_K8sActualNamespace_instrumentationLabelEnabled(ctx, field) - case "k8sActualSources": - return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type K8sActualNamespace", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_createK8sDesiredNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_computePlatform(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_computePlatform(ctx, field) +func (ec *executionContext) _ExportedSignals_metrics(ctx context.Context, field graphql.CollectedField, obj *model.ExportedSignals) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ExportedSignals_metrics(ctx, field) if err != nil { return graphql.Null } @@ -1905,49 +2121,38 @@ func (ec *executionContext) _Query_computePlatform(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().ComputePlatform(rctx) + return obj.Metrics, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*model.ComputePlatform) + res := resTmp.(bool) fc.Result = res - return ec.marshalOComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_computePlatform(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ExportedSignals_metrics(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "ExportedSignals", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_ComputePlatform_name(ctx, field) - case "computePlatformType": - return ec.fieldContext_ComputePlatform_computePlatformType(ctx, field) - case "k8sActualNamespace": - return ec.fieldContext_ComputePlatform_k8sActualNamespace(ctx, field) - case "k8sActualNamespaces": - return ec.fieldContext_ComputePlatform_k8sActualNamespaces(ctx, field) - case "k8sActualSource": - return ec.fieldContext_ComputePlatform_k8sActualSource(ctx, field) - case "k8sActualSources": - return ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ComputePlatform", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Query_config(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_config(ctx, field) +func (ec *executionContext) _ExportedSignals_logs(ctx context.Context, field graphql.CollectedField, obj *model.ExportedSignals) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ExportedSignals_logs(ctx, field) if err != nil { return graphql.Null } @@ -1960,39 +2165,38 @@ func (ec *executionContext) _Query_config(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Config(rctx) + return obj.Logs, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*model.GetConfigResponse) + res := resTmp.(bool) fc.Result = res - return ec.marshalOGetConfigResponse2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐGetConfigResponse(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_config(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ExportedSignals_logs(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "ExportedSignals", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "installation": - return ec.fieldContext_GetConfigResponse_installation(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type GetConfigResponse", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query___type(ctx, field) +func (ec *executionContext) _GetConfigResponse_installation(ctx context.Context, field graphql.CollectedField, obj *model.GetConfigResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_GetConfigResponse_installation(ctx, field) if err != nil { return graphql.Null } @@ -2005,68 +2209,38 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.introspectType(fc.Args["name"].(string)) + return obj.Installation, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*introspection.Type) + res := resTmp.(model.InstallationStatus) fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalNInstallationStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstallationStatus(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_GetConfigResponse_installation(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "GetConfigResponse", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type InstallationStatus does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query___schema(ctx, field) +func (ec *executionContext) _GetDestinationTypesResponse_categories(ctx context.Context, field graphql.CollectedField, obj *model.GetDestinationTypesResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_GetDestinationTypesResponse_categories(ctx, field) if err != nil { return graphql.Null } @@ -2079,49 +2253,44 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.introspectSchema() + return obj.Categories, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*introspection.Schema) + res := resTmp.([]model.DestinationsCategory) fc.Result = res - return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) + return ec.marshalNDestinationsCategory2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationsCategoryᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_GetDestinationTypesResponse_categories(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "GetDestinationTypesResponse", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "description": - return ec.fieldContext___Schema_description(ctx, field) - case "types": - return ec.fieldContext___Schema_types(ctx, field) - case "queryType": - return ec.fieldContext___Schema_queryType(ctx, field) - case "mutationType": - return ec.fieldContext___Schema_mutationType(ctx, field) - case "subscriptionType": - return ec.fieldContext___Schema_subscriptionType(ctx, field) - case "directives": - return ec.fieldContext___Schema_directives(ctx, field) + case "name": + return ec.fieldContext_DestinationsCategory_name(ctx, field) + case "items": + return ec.fieldContext_DestinationsCategory_items(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + return nil, fmt.Errorf("no field named %q was found under type DestinationsCategory", field.Name) }, } return fc, nil } -func (ec *executionContext) _SourceContainerRuntimeDetails_containerName(ctx context.Context, field graphql.CollectedField, obj *model.SourceContainerRuntimeDetails) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_SourceContainerRuntimeDetails_containerName(ctx, field) +func (ec *executionContext) _InstrumentedApplicationDetails_containers(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentedApplicationDetails_containers(ctx, field) if err != nil { return graphql.Null } @@ -2134,38 +2303,41 @@ func (ec *executionContext) _SourceContainerRuntimeDetails_containerName(ctx con }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ContainerName, nil + return obj.Containers, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.([]*model.SourceContainerRuntimeDetails) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOSourceContainerRuntimeDetails2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceContainerRuntimeDetailsᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SourceContainerRuntimeDetails_containerName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_containers(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "SourceContainerRuntimeDetails", + Object: "InstrumentedApplicationDetails", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "containerName": + return ec.fieldContext_SourceContainerRuntimeDetails_containerName(ctx, field) + case "language": + return ec.fieldContext_SourceContainerRuntimeDetails_language(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type SourceContainerRuntimeDetails", field.Name) }, } return fc, nil } -func (ec *executionContext) _SourceContainerRuntimeDetails_language(ctx context.Context, field graphql.CollectedField, obj *model.SourceContainerRuntimeDetails) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_SourceContainerRuntimeDetails_language(ctx, field) +func (ec *executionContext) _InstrumentedApplicationDetails_conditions(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentedApplicationDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) if err != nil { return graphql.Null } @@ -2178,38 +2350,47 @@ func (ec *executionContext) _SourceContainerRuntimeDetails_language(ctx context. }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Language, nil + return obj.Conditions, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.([]*model.Condition) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOCondition2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SourceContainerRuntimeDetails_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentedApplicationDetails_conditions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "SourceContainerRuntimeDetails", + Object: "InstrumentedApplicationDetails", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "type": + return ec.fieldContext_Condition_type(ctx, field) + case "status": + return ec.fieldContext_Condition_status(ctx, field) + case "lastTransitionTime": + return ec.fieldContext_Condition_lastTransitionTime(ctx, field) + case "reason": + return ec.fieldContext_Condition_reason(ctx, field) + case "message": + return ec.fieldContext_Condition_message(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Condition", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_name(ctx, field) +func (ec *executionContext) _K8sActualNamespace_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualNamespace_name(ctx, field) if err != nil { return graphql.Null } @@ -2239,9 +2420,9 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualNamespace_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "K8sActualNamespace", Field: field, IsMethod: false, IsResolver: false, @@ -2252,8 +2433,8 @@ func (ec *executionContext) fieldContext___Directive_name(_ context.Context, fie return fc, nil } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_description(ctx, field) +func (ec *executionContext) _K8sActualNamespace_instrumentationLabelEnabled(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualNamespace_instrumentationLabelEnabled(ctx, field) if err != nil { return graphql.Null } @@ -2266,7 +2447,7 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Description(), nil + return obj.InstrumentationLabelEnabled, nil }) if err != nil { ec.Error(ctx, err) @@ -2275,26 +2456,26 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*bool) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualNamespace_instrumentationLabelEnabled(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "K8sActualNamespace", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_locations(ctx, field) +func (ec *executionContext) _K8sActualNamespace_k8sActualSources(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualNamespace) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) if err != nil { return graphql.Null } @@ -2307,7 +2488,7 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Locations, nil + return ec.resolvers.K8sActualNamespace().K8sActualSources(rctx, obj, fc.Args["instrumentationLabeled"].(*bool)) }) if err != nil { ec.Error(ctx, err) @@ -2319,26 +2500,55 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } return graphql.Null } - res := resTmp.([]string) + res := resTmp.([]*model.K8sActualSource) fc.Result = res - return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) + return ec.marshalNK8sActualSource2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualSource(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualNamespace_k8sActualSources(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "K8sActualNamespace", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __DirectiveLocation does not have child fields") + switch field.Name { + case "namespace": + return ec.fieldContext_K8sActualSource_namespace(ctx, field) + case "kind": + return ec.fieldContext_K8sActualSource_kind(ctx, field) + case "name": + return ec.fieldContext_K8sActualSource_name(ctx, field) + case "serviceName": + return ec.fieldContext_K8sActualSource_serviceName(ctx, field) + case "numberOfInstances": + return ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) + case "autoInstrumented": + return ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) + case "autoInstrumentedDecision": + return ec.fieldContext_K8sActualSource_autoInstrumentedDecision(ctx, field) + case "instrumentedApplicationDetails": + return ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type K8sActualSource", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_K8sActualNamespace_k8sActualSources_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_args(ctx, field) +func (ec *executionContext) _K8sActualSource_namespace(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_namespace(ctx, field) if err != nil { return graphql.Null } @@ -2351,7 +2561,7 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Args, nil + return obj.Namespace, nil }) if err != nil { ec.Error(ctx, err) @@ -2363,36 +2573,26 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.([]introspection.InputValue) + res := resTmp.(string) fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) +func (ec *executionContext) _K8sActualSource_kind(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_kind(ctx, field) if err != nil { return graphql.Null } @@ -2405,7 +2605,7 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsRepeatable, nil + return obj.Kind, nil }) if err != nil { ec.Error(ctx, err) @@ -2417,26 +2617,26 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(model.K8sResourceKind) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type K8sResourceKind does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_name(ctx, field) +func (ec *executionContext) _K8sActualSource_name(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_name(ctx, field) if err != nil { return graphql.Null } @@ -2466,9 +2666,9 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, @@ -2479,8 +2679,8 @@ func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, fie return fc, nil } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_description(ctx, field) +func (ec *executionContext) _K8sActualSource_serviceName(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_serviceName(ctx, field) if err != nil { return graphql.Null } @@ -2493,7 +2693,7 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Description(), nil + return obj.ServiceName, nil }) if err != nil { ec.Error(ctx, err) @@ -2507,11 +2707,11 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_serviceName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "K8sActualSource", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") @@ -2520,8 +2720,8 @@ func (ec *executionContext) fieldContext___EnumValue_description(_ context.Conte return fc, nil } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) +func (ec *executionContext) _K8sActualSource_numberOfInstances(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_numberOfInstances(ctx, field) if err != nil { return graphql.Null } @@ -2534,38 +2734,35 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil + return obj.NumberOfInstances, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(*int) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_numberOfInstances(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "K8sActualSource", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) +func (ec *executionContext) _K8sActualSource_autoInstrumented(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_autoInstrumented(ctx, field) if err != nil { return graphql.Null } @@ -2578,35 +2775,38 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil + return obj.AutoInstrumented, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(bool) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "K8sActualSource", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_name(ctx, field) +func (ec *executionContext) _K8sActualSource_autoInstrumentedDecision(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_autoInstrumentedDecision(ctx, field) if err != nil { return graphql.Null } @@ -2619,7 +2819,7 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.AutoInstrumentedDecision, nil }) if err != nil { ec.Error(ctx, err) @@ -2636,9 +2836,9 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_autoInstrumentedDecision(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "K8sActualSource", Field: field, IsMethod: false, IsResolver: false, @@ -2649,8 +2849,8 @@ func (ec *executionContext) fieldContext___Field_name(_ context.Context, field g return fc, nil } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_description(ctx, field) +func (ec *executionContext) _K8sActualSource_instrumentedApplicationDetails(ctx context.Context, field graphql.CollectedField, obj *model.K8sActualSource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_K8sActualSource_instrumentedApplicationDetails(ctx, field) if err != nil { return graphql.Null } @@ -2663,7 +2863,7 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Description(), nil + return obj.InstrumentedApplicationDetails, nil }) if err != nil { ec.Error(ctx, err) @@ -2672,26 +2872,32 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*model.InstrumentedApplicationDetails) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOInstrumentedApplicationDetails2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentedApplicationDetails(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_K8sActualSource_instrumentedApplicationDetails(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "K8sActualSource", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "containers": + return ec.fieldContext_InstrumentedApplicationDetails_containers(ctx, field) + case "conditions": + return ec.fieldContext_InstrumentedApplicationDetails_conditions(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type InstrumentedApplicationDetails", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_args(ctx, field) +func (ec *executionContext) _Mutation_createK8sDesiredNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createK8sDesiredNamespace(ctx, field) if err != nil { return graphql.Null } @@ -2704,114 +2910,54 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Args, nil + return ec.resolvers.Mutation().CreateK8sDesiredNamespace(rctx, fc.Args["cpId"].(string), fc.Args["namespace"].(model.K8sDesiredNamespaceInput)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.([]introspection.InputValue) + res := resTmp.(*model.K8sActualNamespace) fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) + return ec.marshalOK8sActualNamespace2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_createK8sDesiredNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "Mutation", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) + return ec.fieldContext_K8sActualNamespace_name(ctx, field) + case "instrumentationLabelEnabled": + return ec.fieldContext_K8sActualNamespace_instrumentationLabelEnabled(ctx, field) + case "k8sActualSources": + return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + return nil, fmt.Errorf("no field named %q was found under type K8sActualNamespace", field.Name) }, } - return fc, nil -} - -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_type(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + err = ec.Recover(ctx, r) + ec.Error(ctx, err) } }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil - }) - if err != nil { + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createK8sDesiredNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, + return fc, err } return fc, nil } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) +func (ec *executionContext) _ObservabilitySignalSupport_supported(ctx context.Context, field graphql.CollectedField, obj *model.ObservabilitySignalSupport) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ObservabilitySignalSupport_supported(ctx, field) if err != nil { return graphql.Null } @@ -2824,7 +2970,7 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil + return obj.Supported, nil }) if err != nil { ec.Error(ctx, err) @@ -2841,11 +2987,11 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ObservabilitySignalSupport_supported(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "ObservabilitySignalSupport", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Boolean does not have child fields") @@ -2854,8 +3000,8 @@ func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, return fc, nil } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) +func (ec *executionContext) _Query_computePlatform(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_computePlatform(ctx, field) if err != nil { return graphql.Null } @@ -2868,7 +3014,7 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil + return ec.resolvers.Query().ComputePlatform(rctx) }) if err != nil { ec.Error(ctx, err) @@ -2877,26 +3023,40 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*model.ComputePlatform) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOComputePlatform2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐComputePlatform(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_computePlatform(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "Query", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext_ComputePlatform_name(ctx, field) + case "computePlatformType": + return ec.fieldContext_ComputePlatform_computePlatformType(ctx, field) + case "k8sActualNamespace": + return ec.fieldContext_ComputePlatform_k8sActualNamespace(ctx, field) + case "k8sActualNamespaces": + return ec.fieldContext_ComputePlatform_k8sActualNamespaces(ctx, field) + case "k8sActualSource": + return ec.fieldContext_ComputePlatform_k8sActualSource(ctx, field) + case "k8sActualSources": + return ec.fieldContext_ComputePlatform_k8sActualSources(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ComputePlatform", field.Name) }, } return fc, nil } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_name(ctx, field) +func (ec *executionContext) _Query_config(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_config(ctx, field) if err != nil { return graphql.Null } @@ -2909,38 +3069,39 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return ec.resolvers.Query().Config(rctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.GetConfigResponse) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOGetConfigResponse2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐGetConfigResponse(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_config(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "installation": + return ec.fieldContext_GetConfigResponse_installation(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type GetConfigResponse", field.Name) }, } return fc, nil } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_description(ctx, field) +func (ec *executionContext) _Query_destinationTypes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_destinationTypes(ctx, field) if err != nil { return graphql.Null } @@ -2953,7 +3114,7 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Description(), nil + return ec.resolvers.Query().DestinationTypes(rctx) }) if err != nil { ec.Error(ctx, err) @@ -2962,26 +3123,30 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*model.GetDestinationTypesResponse) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOGetDestinationTypesResponse2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐGetDestinationTypesResponse(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_destinationTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "Query", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "categories": + return ec.fieldContext_GetDestinationTypesResponse_categories(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type GetDestinationTypesResponse", field.Name) }, } return fc, nil } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_type(ctx, field) +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___type(ctx, field) if err != nil { return graphql.Null } @@ -2994,28 +3159,25 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Type, nil + return ec.introspectType(fc.Args["name"].(string)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "Query", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { @@ -3043,11 +3205,22 @@ func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, fi return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___schema(ctx, field) if err != nil { return graphql.Null } @@ -3060,7 +3233,7 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.DefaultValue, nil + return ec.introspectSchema() }) if err != nil { ec.Error(ctx, err) @@ -3069,26 +3242,40 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*introspection.Schema) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "Query", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "description": + return ec.fieldContext___Schema_description(ctx, field) + case "types": + return ec.fieldContext___Schema_types(ctx, field) + case "queryType": + return ec.fieldContext___Schema_queryType(ctx, field) + case "mutationType": + return ec.fieldContext___Schema_mutationType(ctx, field) + case "subscriptionType": + return ec.fieldContext___Schema_subscriptionType(ctx, field) + case "directives": + return ec.fieldContext___Schema_directives(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_description(ctx, field) +func (ec *executionContext) _SourceContainerRuntimeDetails_containerName(ctx context.Context, field graphql.CollectedField, obj *model.SourceContainerRuntimeDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SourceContainerRuntimeDetails_containerName(ctx, field) if err != nil { return graphql.Null } @@ -3101,25 +3288,28 @@ func (ec *executionContext) ___Schema_description(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Description(), nil + return obj.ContainerName, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SourceContainerRuntimeDetails_containerName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "SourceContainerRuntimeDetails", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") @@ -3128,8 +3318,8 @@ func (ec *executionContext) fieldContext___Schema_description(_ context.Context, return fc, nil } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_types(ctx, field) +func (ec *executionContext) _SourceContainerRuntimeDetails_language(ctx context.Context, field graphql.CollectedField, obj *model.SourceContainerRuntimeDetails) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SourceContainerRuntimeDetails_language(ctx, field) if err != nil { return graphql.Null } @@ -3142,7 +3332,7 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Types(), nil + return obj.Language, nil }) if err != nil { ec.Error(ctx, err) @@ -3154,48 +3344,26 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } return graphql.Null } - res := resTmp.([]introspection.Type) + res := resTmp.(string) fc.Result = res - return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SourceContainerRuntimeDetails_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "SourceContainerRuntimeDetails", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_queryType(ctx, field) +func (ec *executionContext) _SupportedSignals_traces(ctx context.Context, field graphql.CollectedField, obj *model.SupportedSignals) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SupportedSignals_traces(ctx, field) if err != nil { return graphql.Null } @@ -3208,7 +3376,7 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.QueryType(), nil + return obj.Traces, nil }) if err != nil { ec.Error(ctx, err) @@ -3220,48 +3388,30 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } return graphql.Null } - res := resTmp.(*introspection.Type) + res := resTmp.(model.ObservabilitySignalSupport) fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalNObservabilitySignalSupport2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐObservabilitySignalSupport(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SupportedSignals_traces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "SupportedSignals", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "supported": + return ec.fieldContext_ObservabilitySignalSupport_supported(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, fmt.Errorf("no field named %q was found under type ObservabilitySignalSupport", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_mutationType(ctx, field) +func (ec *executionContext) _SupportedSignals_metrics(ctx context.Context, field graphql.CollectedField, obj *model.SupportedSignals) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SupportedSignals_metrics(ctx, field) if err != nil { return graphql.Null } @@ -3274,57 +3424,42 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.MutationType(), nil + return obj.Metrics, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*introspection.Type) + res := resTmp.(model.ObservabilitySignalSupport) fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalNObservabilitySignalSupport2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐObservabilitySignalSupport(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SupportedSignals_metrics(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "SupportedSignals", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "supported": + return ec.fieldContext_ObservabilitySignalSupport_supported(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, fmt.Errorf("no field named %q was found under type ObservabilitySignalSupport", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) +func (ec *executionContext) _SupportedSignals_logs(ctx context.Context, field graphql.CollectedField, obj *model.SupportedSignals) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SupportedSignals_logs(ctx, field) if err != nil { return graphql.Null } @@ -3337,57 +3472,42 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.SubscriptionType(), nil + return obj.Logs, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*introspection.Type) + res := resTmp.(model.ObservabilitySignalSupport) fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalNObservabilitySignalSupport2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐObservabilitySignalSupport(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SupportedSignals_logs(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "SupportedSignals", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + case "supported": + return ec.fieldContext_ObservabilitySignalSupport_supported(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, fmt.Errorf("no field named %q was found under type ObservabilitySignalSupport", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_directives(ctx, field) +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_name(ctx, field) if err != nil { return graphql.Null } @@ -3400,7 +3520,7 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Directives(), nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -3412,38 +3532,26 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } return graphql.Null } - res := resTmp.([]introspection.Directive) + res := resTmp.(string) fc.Result = res - return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "__Directive", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___Directive_name(ctx, field) - case "description": - return ec.fieldContext___Directive_description(ctx, field) - case "locations": - return ec.fieldContext___Directive_locations(ctx, field) - case "args": - return ec.fieldContext___Directive_args(ctx, field) - case "isRepeatable": - return ec.fieldContext___Directive_isRepeatable(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_kind(ctx, field) +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_description(ctx, field) if err != nil { return graphql.Null } @@ -3456,38 +3564,35 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Kind(), nil + return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalN__TypeKind2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Directive", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __TypeKind does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_name(ctx, field) +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_locations(ctx, field) if err != nil { return graphql.Null } @@ -3500,35 +3605,38 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name(), nil + return obj.Locations, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.([]string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Directive", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type __DirectiveLocation does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_description(ctx, field) +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_args(ctx, field) if err != nil { return graphql.Null } @@ -3541,35 +3649,48 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Description(), nil + return obj.Args, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.([]introspection.InputValue) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Directive", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_fields(ctx, field) +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) if err != nil { return graphql.Null } @@ -3582,60 +3703,38 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + return obj.IsRepeatable, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]introspection.Field) + res := resTmp.(bool) fc.Result = res - return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Directive", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___Field_name(ctx, field) - case "description": - return ec.fieldContext___Field_description(ctx, field) - case "args": - return ec.fieldContext___Field_args(ctx, field) - case "type": - return ec.fieldContext___Field_type(ctx, field) - case "isDeprecated": - return ec.fieldContext___Field_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___Field_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_interfaces(ctx, field) +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_name(ctx, field) if err != nil { return graphql.Null } @@ -3648,57 +3747,38 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Interfaces(), nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]introspection.Type) + res := resTmp.(string) fc.Result = res - return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__EnumValue", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_description(ctx, field) if err != nil { return graphql.Null } @@ -3711,7 +3791,7 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.PossibleTypes(), nil + return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) @@ -3720,48 +3800,26 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra if resTmp == nil { return graphql.Null } - res := resTmp.([]introspection.Type) + res := resTmp.(*string) fc.Result = res - return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__EnumValue", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_enumValues(ctx, field) +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) if err != nil { return graphql.Null } @@ -3774,56 +3832,38 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + return obj.IsDeprecated(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]introspection.EnumValue) + res := resTmp.(bool) fc.Result = res - return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__EnumValue", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___EnumValue_name(ctx, field) - case "description": - return ec.fieldContext___EnumValue_description(ctx, field) - case "isDeprecated": - return ec.fieldContext___EnumValue_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___EnumValue_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_inputFields(ctx, field) +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) if err != nil { return graphql.Null } @@ -3836,7 +3876,7 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InputFields(), nil + return obj.DeprecationReason(), nil }) if err != nil { ec.Error(ctx, err) @@ -3845,36 +3885,26 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph if resTmp == nil { return graphql.Null } - res := resTmp.([]introspection.InputValue) + res := resTmp.(*string) fc.Result = res - return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__EnumValue", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_ofType(ctx, field) +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_name(ctx, field) if err != nil { return graphql.Null } @@ -3887,57 +3917,38 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.OfType(), nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*introspection.Type) + res := resTmp.(string) fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Field", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_description(ctx, field) if err != nil { return graphql.Null } @@ -3950,7 +3961,7 @@ func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.SpecifiedByURL(), nil + return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) @@ -3964,9 +3975,9 @@ func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field gr return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Field", Field: field, IsMethod: true, IsResolver: false, @@ -3977,18 +3988,1305 @@ func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context return fc, nil } -// endregion **************************** field.gotpl ***************************** - -// region **************************** input.gotpl ***************************** - -func (ec *executionContext) unmarshalInputK8sDesiredNamespaceInput(ctx context.Context, obj interface{}) (model.K8sDesiredNamespaceInput, error) { - var it model.K8sDesiredNamespaceInput - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"autoInstrument"} +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_args(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DefaultValue, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_types(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Types(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_queryType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.QueryType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_mutationType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MutationType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SubscriptionType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_directives(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Directives(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Directive) + fc.Result = res + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Directive_name(ctx, field) + case "description": + return ec.fieldContext___Directive_description(ctx, field) + case "locations": + return ec.fieldContext___Directive_locations(ctx, field) + case "args": + return ec.fieldContext___Directive_args(ctx, field) + case "isRepeatable": + return ec.fieldContext___Directive_isRepeatable(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_kind(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Kind(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalN__TypeKind2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __TypeKind does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_fields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Field) + fc.Result = res + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Field_name(ctx, field) + case "description": + return ec.fieldContext___Field_description(ctx, field) + case "args": + return ec.fieldContext___Field_args(ctx, field) + case "type": + return ec.fieldContext___Field_type(ctx, field) + case "isDeprecated": + return ec.fieldContext___Field_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___Field_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_interfaces(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Interfaces(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PossibleTypes(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_enumValues(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.EnumValue) + fc.Result = res + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___EnumValue_name(ctx, field) + case "description": + return ec.fieldContext___EnumValue_description(ctx, field) + case "isDeprecated": + return ec.fieldContext___EnumValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___EnumValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_inputFields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InputFields(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_ofType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.OfType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SpecifiedByURL(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputK8sDesiredNamespaceInput(ctx context.Context, obj interface{}) (model.K8sDesiredNamespaceInput, error) { + var it model.K8sDesiredNamespaceInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"autoInstrument"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -4096,56 +5394,229 @@ func (ec *executionContext) unmarshalInputK8sSourceId(ctx context.Context, obj i if err != nil { return it, err } - it.Kind = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err + it.Kind = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + } + } + + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var computePlatformImplementors = []string{"ComputePlatform"} + +func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.SelectionSet, obj *model.ComputePlatform) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, computePlatformImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ComputePlatform") + case "name": + out.Values[i] = ec._ComputePlatform_name(ctx, field, obj) + case "computePlatformType": + out.Values[i] = ec._ComputePlatform_computePlatformType(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "k8sActualNamespace": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ComputePlatform_k8sActualNamespace(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "k8sActualNamespaces": + out.Values[i] = ec._ComputePlatform_k8sActualNamespaces(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "k8sActualSource": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ComputePlatform_k8sActualSource(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "k8sActualSources": + out.Values[i] = ec._ComputePlatform_k8sActualSources(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var conditionImplementors = []string{"Condition"} + +func (ec *executionContext) _Condition(ctx context.Context, sel ast.SelectionSet, obj *model.Condition) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, conditionImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Condition") + case "type": + out.Values[i] = ec._Condition_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "status": + out.Values[i] = ec._Condition_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Name = data + case "lastTransitionTime": + out.Values[i] = ec._Condition_lastTransitionTime(ctx, field, obj) + case "reason": + out.Values[i] = ec._Condition_reason(ctx, field, obj) + case "message": + out.Values[i] = ec._Condition_message(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } - return it, nil -} - -// endregion **************************** input.gotpl ***************************** - -// region ************************** interface.gotpl *************************** + atomic.AddInt32(&ec.deferred, int32(len(deferred))) -// endregion ************************** interface.gotpl *************************** + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } -// region **************************** object.gotpl **************************** + return out +} -var computePlatformImplementors = []string{"ComputePlatform"} +var destinationImplementors = []string{"Destination"} -func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.SelectionSet, obj *model.ComputePlatform) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, computePlatformImplementors) +func (ec *executionContext) _Destination(ctx context.Context, sel ast.SelectionSet, obj *model.Destination) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, destinationImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("ComputePlatform") + out.Values[i] = graphql.MarshalString("Destination") + case "id": + out.Values[i] = ec._Destination_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } case "name": - out.Values[i] = ec._ComputePlatform_name(ctx, field, obj) - case "computePlatformType": - out.Values[i] = ec._ComputePlatform_computePlatformType(ctx, field, obj) + out.Values[i] = ec._Destination_name(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "k8sActualNamespace": + case "type": field := field - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ComputePlatform_k8sActualNamespace(ctx, field, obj) + res = ec._Destination_type(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } return res } @@ -4169,12 +5640,53 @@ func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.Select } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "k8sActualNamespaces": - out.Values[i] = ec._ComputePlatform_k8sActualNamespaces(ctx, field, obj) + case "exportedSignals": + out.Values[i] = ec._Destination_exportedSignals(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } - case "k8sActualSource": + case "fields": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Destination_fields(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "destinationType": + out.Values[i] = ec._Destination_destinationType(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "conditions": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -4183,7 +5695,77 @@ func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.Select ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ComputePlatform_k8sActualSource(ctx, field, obj) + res = ec._Destination_conditions(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var destinationTypesCategoryItemImplementors = []string{"DestinationTypesCategoryItem"} + +func (ec *executionContext) _DestinationTypesCategoryItem(ctx context.Context, sel ast.SelectionSet, obj *model.DestinationTypesCategoryItem) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, destinationTypesCategoryItemImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DestinationTypesCategoryItem") + case "type": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._DestinationTypesCategoryItem_type(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } return res } @@ -4205,12 +5787,120 @@ func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.Select out.Values[i] = graphql.Null continue } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "k8sActualSources": - out.Values[i] = ec._ComputePlatform_k8sActualSources(ctx, field, obj) + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "displayName": + out.Values[i] = ec._DestinationTypesCategoryItem_displayName(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "imageUrl": + out.Values[i] = ec._DestinationTypesCategoryItem_imageUrl(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "supportedSignals": + out.Values[i] = ec._DestinationTypesCategoryItem_supportedSignals(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "testConnectionSupported": + out.Values[i] = ec._DestinationTypesCategoryItem_testConnectionSupported(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var destinationsCategoryImplementors = []string{"DestinationsCategory"} + +func (ec *executionContext) _DestinationsCategory(ctx context.Context, sel ast.SelectionSet, obj *model.DestinationsCategory) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, destinationsCategoryImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("DestinationsCategory") + case "name": + out.Values[i] = ec._DestinationsCategory_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "items": + out.Values[i] = ec._DestinationsCategory_items(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var exportedSignalsImplementors = []string{"ExportedSignals"} + +func (ec *executionContext) _ExportedSignals(ctx context.Context, sel ast.SelectionSet, obj *model.ExportedSignals) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, exportedSignalsImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ExportedSignals") + case "traces": + out.Values[i] = ec._ExportedSignals_traces(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "metrics": + out.Values[i] = ec._ExportedSignals_metrics(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + out.Invalids++ + } + case "logs": + out.Values[i] = ec._ExportedSignals_logs(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } default: panic("unknown field " + strconv.Quote(field.Name)) @@ -4235,33 +5925,22 @@ func (ec *executionContext) _ComputePlatform(ctx context.Context, sel ast.Select return out } -var conditionImplementors = []string{"Condition"} +var getConfigResponseImplementors = []string{"GetConfigResponse"} -func (ec *executionContext) _Condition(ctx context.Context, sel ast.SelectionSet, obj *model.Condition) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, conditionImplementors) +func (ec *executionContext) _GetConfigResponse(ctx context.Context, sel ast.SelectionSet, obj *model.GetConfigResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, getConfigResponseImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("Condition") - case "type": - out.Values[i] = ec._Condition_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "status": - out.Values[i] = ec._Condition_status(ctx, field, obj) + out.Values[i] = graphql.MarshalString("GetConfigResponse") + case "installation": + out.Values[i] = ec._GetConfigResponse_installation(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "lastTransitionTime": - out.Values[i] = ec._Condition_lastTransitionTime(ctx, field, obj) - case "reason": - out.Values[i] = ec._Condition_reason(ctx, field, obj) - case "message": - out.Values[i] = ec._Condition_message(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -4285,19 +5964,19 @@ func (ec *executionContext) _Condition(ctx context.Context, sel ast.SelectionSet return out } -var getConfigResponseImplementors = []string{"GetConfigResponse"} +var getDestinationTypesResponseImplementors = []string{"GetDestinationTypesResponse"} -func (ec *executionContext) _GetConfigResponse(ctx context.Context, sel ast.SelectionSet, obj *model.GetConfigResponse) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, getConfigResponseImplementors) +func (ec *executionContext) _GetDestinationTypesResponse(ctx context.Context, sel ast.SelectionSet, obj *model.GetDestinationTypesResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, getDestinationTypesResponseImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("GetConfigResponse") - case "installation": - out.Values[i] = ec._GetConfigResponse_installation(ctx, field, obj) + out.Values[i] = graphql.MarshalString("GetDestinationTypesResponse") + case "categories": + out.Values[i] = ec._GetDestinationTypesResponse_categories(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -4550,6 +6229,45 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return out } +var observabilitySignalSupportImplementors = []string{"ObservabilitySignalSupport"} + +func (ec *executionContext) _ObservabilitySignalSupport(ctx context.Context, sel ast.SelectionSet, obj *model.ObservabilitySignalSupport) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, observabilitySignalSupportImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ObservabilitySignalSupport") + case "supported": + out.Values[i] = ec._ObservabilitySignalSupport_supported(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { @@ -4606,6 +6324,25 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "destinationTypes": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_destinationTypes(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "__type": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -4682,6 +6419,55 @@ func (ec *executionContext) _SourceContainerRuntimeDetails(ctx context.Context, return out } +var supportedSignalsImplementors = []string{"SupportedSignals"} + +func (ec *executionContext) _SupportedSignals(ctx context.Context, sel ast.SelectionSet, obj *model.SupportedSignals) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, supportedSignalsImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SupportedSignals") + case "traces": + out.Values[i] = ec._SupportedSignals_traces(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "metrics": + out.Values[i] = ec._SupportedSignals_metrics(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "logs": + out.Values[i] = ec._SupportedSignals_logs(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { @@ -5053,6 +6839,106 @@ func (ec *executionContext) marshalNConditionStatus2githubᚗcomᚋodigosᚑio return v } +func (ec *executionContext) marshalNDestinationTypesCategoryItem2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypesCategoryItem(ctx context.Context, sel ast.SelectionSet, v model.DestinationTypesCategoryItem) graphql.Marshaler { + return ec._DestinationTypesCategoryItem(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDestinationTypesCategoryItem2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypesCategoryItemᚄ(ctx context.Context, sel ast.SelectionSet, v []model.DestinationTypesCategoryItem) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNDestinationTypesCategoryItem2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypesCategoryItem(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNDestinationsCategory2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationsCategory(ctx context.Context, sel ast.SelectionSet, v model.DestinationsCategory) graphql.Marshaler { + return ec._DestinationsCategory(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDestinationsCategory2ᚕgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationsCategoryᚄ(ctx context.Context, sel ast.SelectionSet, v []model.DestinationsCategory) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNDestinationsCategory2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationsCategory(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNExportedSignals2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐExportedSignals(ctx context.Context, sel ast.SelectionSet, v model.ExportedSignals) graphql.Marshaler { + return ec._ExportedSignals(ctx, sel, &v) +} + func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { res, err := graphql.UnmarshalID(v) return res, graphql.ErrorOnPath(ctx, err) @@ -5169,6 +7055,10 @@ func (ec *executionContext) marshalNK8sResourceKind2githubᚗcomᚋodigosᚑio return v } +func (ec *executionContext) marshalNObservabilitySignalSupport2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐObservabilitySignalSupport(ctx context.Context, sel ast.SelectionSet, v model.ObservabilitySignalSupport) graphql.Marshaler { + return ec._ObservabilitySignalSupport(ctx, sel, &v) +} + func (ec *executionContext) marshalNSourceContainerRuntimeDetails2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceContainerRuntimeDetails(ctx context.Context, sel ast.SelectionSet, v *model.SourceContainerRuntimeDetails) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -5194,6 +7084,42 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S return res } +func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNString2string(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNSupportedSignals2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSupportedSignals(ctx context.Context, sel ast.SelectionSet, v model.SupportedSignals) graphql.Marshaler { + return ec._SupportedSignals(ctx, sel, &v) +} + func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { return ec.___Directive(ctx, sel, &v) } @@ -5534,6 +7460,13 @@ func (ec *executionContext) marshalOGetConfigResponse2ᚖgithubᚗcomᚋodigos return ec._GetConfigResponse(ctx, sel, v) } +func (ec *executionContext) marshalOGetDestinationTypesResponse2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐGetDestinationTypesResponse(ctx context.Context, sel ast.SelectionSet, v *model.GetDestinationTypesResponse) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._GetDestinationTypesResponse(ctx, sel, v) +} + func (ec *executionContext) marshalOInstrumentedApplicationDetails2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentedApplicationDetails(ctx context.Context, sel ast.SelectionSet, v *model.InstrumentedApplicationDetails) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/frontend/graph/model/destination.go b/frontend/graph/model/destination.go new file mode 100644 index 000000000..8f9af77a9 --- /dev/null +++ b/frontend/graph/model/destination.go @@ -0,0 +1,48 @@ +package model + +import ( + "github.com/odigos-io/odigos/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type GetDestinationTypesResponse struct { + Categories []DestinationsCategory `json:"categories"` +} + +type DestinationTypesCategoryItem struct { + Type common.DestinationType `json:"type"` + DisplayName string `json:"display_name"` + ImageUrl string `json:"image_url"` + SupportedSignals SupportedSignals `json:"supported_signals"` + TestConnectionSupported bool `json:"test_connection_supported"` +} + +type SupportedSignals struct { + Traces ObservabilitySignalSupport `json:"traces"` + Metrics ObservabilitySignalSupport `json:"metrics"` + Logs ObservabilitySignalSupport `json:"logs"` +} + +type ObservabilitySignalSupport struct { + Supported bool `json:"supported"` +} +type DestinationsCategory struct { + Name string `json:"name"` + Items []DestinationTypesCategoryItem `json:"items"` +} + +type ExportedSignals struct { + Traces bool `json:"traces"` + Metrics bool `json:"metrics"` + Logs bool `json:"logs"` +} + +type Destination struct { + Id string `json:"id"` + Name string `json:"name"` + Type common.DestinationType `json:"type"` + ExportedSignals ExportedSignals `json:"signals"` + Fields map[string]string `json:"fields"` + DestinationType DestinationTypesCategoryItem `json:"destination_type"` + Conditions []metav1.Condition `json:"conditions,omitempty"` +} diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index a13b96ca4..a1d5d0abc 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -65,18 +65,13 @@ type Condition { type K8sActualNamespace { name: String! instrumentationLabelEnabled: Boolean - - # 1. if instrumentationLabeled = true, then only return sources that are labeled for instrumentation - # which means workload label is set to enabled, or workload label missing and ns label is set to enabled - # 2. if instrumentationLabeled = false, then return all sources which are not labeled for instrumentation. - # which means workload label is set to disabled, or workload label missing and ns label is not set to enabled - # 3. if instrumentationLabeled is not provided, then return all sources k8sActualSources(instrumentationLabeled: Boolean): [K8sActualSource]! } input K8sDesiredNamespaceInput { autoInstrument: Boolean } + input K8sNamespaceId { name: String! } @@ -96,6 +91,7 @@ input K8sDesiredSourceInput { serviceName: String autoInstrument: Boolean } + input K8sSourceId { namespace: String! kind: K8sResourceKind! @@ -113,8 +109,49 @@ type ComputePlatform { kind: String ): K8sActualSource k8sActualSources: [K8sActualSource]! +} + +type SupportedSignals { + traces: ObservabilitySignalSupport! + metrics: ObservabilitySignalSupport! + logs: ObservabilitySignalSupport! +} + +type ObservabilitySignalSupport { + supported: Boolean! +} + +type DestinationTypesCategoryItem { + type: String! + displayName: String! + imageUrl: String! + supportedSignals: SupportedSignals! + testConnectionSupported: Boolean! +} - # destinations that are applied to this compute platform +type DestinationsCategory { + name: String! + items: [DestinationTypesCategoryItem!]! +} + +type GetDestinationTypesResponse { + categories: [DestinationsCategory!]! +} + +type ExportedSignals { + traces: Boolean! + metrics: Boolean! + logs: Boolean! +} + +type Destination { + id: ID! + name: String! + type: String! + exportedSignals: ExportedSignals! + fields: [String!]! + destinationType: DestinationTypesCategoryItem! + conditions: [Condition!] } type GetConfigResponse { @@ -124,6 +161,7 @@ type GetConfigResponse { type Query { computePlatform: ComputePlatform config: GetConfigResponse + destinationTypes: GetDestinationTypesResponse } type Mutation { diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 31f54457b..f32fbfbf4 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -57,9 +57,29 @@ func (r *computePlatformResolver) K8sActualSource(ctx context.Context, obj *mode return k8sActualSource, nil } +// Type is the resolver for the type field. +func (r *destinationResolver) Type(ctx context.Context, obj *model.Destination) (string, error) { + panic(fmt.Errorf("not implemented: Type - type")) +} + +// Fields is the resolver for the fields field. +func (r *destinationResolver) Fields(ctx context.Context, obj *model.Destination) ([]string, error) { + panic(fmt.Errorf("not implemented: Fields - fields")) +} + +// Conditions is the resolver for the conditions field. +func (r *destinationResolver) Conditions(ctx context.Context, obj *model.Destination) ([]*model.Condition, error) { + panic(fmt.Errorf("not implemented: Conditions - conditions")) +} + +// Type is the resolver for the type field. +func (r *destinationTypesCategoryItemResolver) Type(ctx context.Context, obj *model.DestinationTypesCategoryItem) (string, error) { + panic(fmt.Errorf("not implemented: Type - type")) +} + // K8sActualSources is the resolver for the k8sActualSources field. -func (r *k8sActualNamespaceResolver) K8sActualSources(ctx context.Context, ns *model.K8sActualNamespace, instrumentationLabeled *bool) ([]*model.K8sActualSource, error) { - return ns.K8sActualSources, nil +func (r *k8sActualNamespaceResolver) K8sActualSources(ctx context.Context, obj *model.K8sActualNamespace, instrumentationLabeled *bool) ([]*model.K8sActualSource, error) { + return obj.K8sActualSources, nil } // CreateK8sDesiredNamespace is the resolver for the createK8sDesiredNamespace field. @@ -95,9 +115,26 @@ func (r *queryResolver) Config(ctx context.Context) (*model.GetConfigResponse, e return gqlResponse, nil } +// DestinationTypes is the resolver for the destinationTypes field. +func (r *queryResolver) DestinationTypes(ctx context.Context) (*model.GetDestinationTypesResponse, error) { + + destTypes := services.GetDestinationTypes() + + return &destTypes, nil + +} + // ComputePlatform returns ComputePlatformResolver implementation. func (r *Resolver) ComputePlatform() ComputePlatformResolver { return &computePlatformResolver{r} } +// Destination returns DestinationResolver implementation. +func (r *Resolver) Destination() DestinationResolver { return &destinationResolver{r} } + +// DestinationTypesCategoryItem returns DestinationTypesCategoryItemResolver implementation. +func (r *Resolver) DestinationTypesCategoryItem() DestinationTypesCategoryItemResolver { + return &destinationTypesCategoryItemResolver{r} +} + // K8sActualNamespace returns K8sActualNamespaceResolver implementation. func (r *Resolver) K8sActualNamespace() K8sActualNamespaceResolver { return &k8sActualNamespaceResolver{r} @@ -110,6 +147,8 @@ func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} } func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } type computePlatformResolver struct{ *Resolver } +type destinationResolver struct{ *Resolver } +type destinationTypesCategoryItemResolver struct{ *Resolver } type k8sActualNamespaceResolver struct{ *Resolver } type mutationResolver struct{ *Resolver } type queryResolver struct{ *Resolver } diff --git a/frontend/services/destinations.go b/frontend/services/destinations.go new file mode 100644 index 000000000..a1d0b5b09 --- /dev/null +++ b/frontend/services/destinations.go @@ -0,0 +1,49 @@ +package services + +import ( + "github.com/odigos-io/odigos/common" + "github.com/odigos-io/odigos/destinations" + "github.com/odigos-io/odigos/frontend/graph/model" +) + +func GetDestinationTypes() model.GetDestinationTypesResponse { + var resp model.GetDestinationTypesResponse + itemsByCategory := make(map[string][]model.DestinationTypesCategoryItem) + for _, destConfig := range destinations.Get() { + item := DestinationTypeConfigToCategoryItem(destConfig) + itemsByCategory[destConfig.Metadata.Category] = append(itemsByCategory[destConfig.Metadata.Category], item) + } + + for category, items := range itemsByCategory { + resp.Categories = append(resp.Categories, model.DestinationsCategory{ + Name: category, + Items: items, + }) + + } + + return resp + +} + +func DestinationTypeConfigToCategoryItem(destConfig destinations.Destination) model.DestinationTypesCategoryItem { + + return model.DestinationTypesCategoryItem{ + Type: common.DestinationType(destConfig.Metadata.Type), + DisplayName: destConfig.Metadata.DisplayName, + ImageUrl: GetImageURL(destConfig.Spec.Image), + TestConnectionSupported: destConfig.Spec.TestConnectionSupported, + SupportedSignals: model.SupportedSignals{ + Traces: model.ObservabilitySignalSupport{ + Supported: destConfig.Spec.Signals.Traces.Supported, + }, + Metrics: model.ObservabilitySignalSupport{ + Supported: destConfig.Spec.Signals.Metrics.Supported, + }, + Logs: model.ObservabilitySignalSupport{ + Supported: destConfig.Spec.Signals.Logs.Supported, + }, + }, + } + +} diff --git a/frontend/services/utils.go b/frontend/services/utils.go new file mode 100644 index 000000000..90ff6591d --- /dev/null +++ b/frontend/services/utils.go @@ -0,0 +1,9 @@ +package services + +import "path" + +const cdnUrl = "https://d15jtxgb40qetw.cloudfront.net" + +func GetImageURL(image string) string { + return path.Join(cdnUrl, image) +} From 192e4f0a04027decd15bea82086bbe482f5f04a5 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 30 Jul 2024 16:59:33 +0300 Subject: [PATCH 121/374] chore: get destination type --- .../destinations/choose-destination/index.tsx | 11 ++++++++ .../webapp/graphql/queries/destination.ts | 26 +++++++++++++++++++ frontend/webapp/graphql/queries/index.ts | 1 + 3 files changed, 38 insertions(+) create mode 100644 frontend/webapp/graphql/queries/destination.ts diff --git a/frontend/webapp/containers/main/destinations/choose-destination/index.tsx b/frontend/webapp/containers/main/destinations/choose-destination/index.tsx index 95fe5ea0c..adcd566bf 100644 --- a/frontend/webapp/containers/main/destinations/choose-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/choose-destination/index.tsx @@ -3,6 +3,8 @@ import { Button, SectionTitle, Text } from '@/reuseable-components'; import styled from 'styled-components'; import Image from 'next/image'; import theme from '@/styles/theme'; +import { useQuery } from '@apollo/client'; +import { GET_DESTINATION_TYPE } from '@/graphql'; const AddDestinationButtonWrapper = styled.div` width: 100%; @@ -18,6 +20,15 @@ const AddDestinationButton = styled(Button)` `; export function ChooseDestinationContainer() { + const { data, loading, error } = useQuery(GET_DESTINATION_TYPE); + + useEffect(() => { + if (error) { + console.error('Error fetching destination types', error); + } + console.log({ data }); + }, [data, error]); + return ( <> Date: Sun, 4 Aug 2024 11:25:56 +0300 Subject: [PATCH 122/374] chore: wip --- frontend/webapp/app/globals.css | 2 +- .../components/setup/headers/header/index.tsx | 69 +++------- .../destinations/choose-destination/index.tsx | 54 +++++++- frontend/webapp/public/icons/common/x.svg | 14 ++ frontend/webapp/reuseable-components/index.ts | 2 + .../reuseable-components/modal/index.tsx | 124 ++++++++++++++++++ .../navigation-buttons/index.tsx | 93 +++++++++++++ .../reuseable-components/text/index.tsx | 46 ++----- frontend/webapp/styles/theme.ts | 1 + 9 files changed, 317 insertions(+), 88 deletions(-) create mode 100644 frontend/webapp/public/icons/common/x.svg create mode 100644 frontend/webapp/reuseable-components/modal/index.tsx create mode 100644 frontend/webapp/reuseable-components/navigation-buttons/index.tsx diff --git a/frontend/webapp/app/globals.css b/frontend/webapp/app/globals.css index 27185356f..6bbdf7e7c 100644 --- a/frontend/webapp/app/globals.css +++ b/frontend/webapp/app/globals.css @@ -1,4 +1,4 @@ /* Preload key fonts in your global CSS */ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap'); -@import url('https://fonts.googleapis.com/css2?family=Kode+Mono:wght@400;700&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=Kode+Mono:wght@100;200;300;400;500;600;700&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;700&display=swap'); diff --git a/frontend/webapp/components/setup/headers/header/index.tsx b/frontend/webapp/components/setup/headers/header/index.tsx index 29bd04789..2083c9c79 100644 --- a/frontend/webapp/components/setup/headers/header/index.tsx +++ b/frontend/webapp/components/setup/headers/header/index.tsx @@ -1,12 +1,11 @@ -import { Button, Text } from '@/reuseable-components'; -import theme from '@/styles/theme'; +import { NavigationButtons, Text } from '@/reuseable-components'; import Image from 'next/image'; import React from 'react'; import styled from 'styled-components'; interface SetupHeaderProps { - onBack?: () => void; - onNext?: () => void; + onBack: () => void; + onNext: () => void; } const HeaderContainer = styled.div` @@ -21,24 +20,12 @@ const HeaderContainer = styled.div` const Title = styled(Text)``; -const HeaderButton = styled(Button)` - display: flex; - align-items: center; - gap: 8px; -`; - const Logo = styled.div` display: flex; align-items: center; font-size: 1.2em; `; -const NavigationButtons = styled.div` - display: flex; - gap: 8px; - align-items: center; -`; - export const SetupHeader: React.FC = ({ onBack, onNext }) => { return ( @@ -51,40 +38,22 @@ export const SetupHeader: React.FC = ({ onBack, onNext }) => { /> START WITH ODIGOS - - - back - - BACK - - - - - NEXT - - next - - + ); }; diff --git a/frontend/webapp/containers/main/destinations/choose-destination/index.tsx b/frontend/webapp/containers/main/destinations/choose-destination/index.tsx index adcd566bf..e99babaca 100644 --- a/frontend/webapp/containers/main/destinations/choose-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/choose-destination/index.tsx @@ -1,5 +1,11 @@ import React, { useEffect, useState } from 'react'; -import { Button, SectionTitle, Text } from '@/reuseable-components'; +import { + Button, + Modal, + NavigationButtons, + SectionTitle, + Text, +} from '@/reuseable-components'; import styled from 'styled-components'; import Image from 'next/image'; import theme from '@/styles/theme'; @@ -21,6 +27,14 @@ const AddDestinationButton = styled(Button)` export function ChooseDestinationContainer() { const { data, loading, error } = useQuery(GET_DESTINATION_TYPE); + const [isModalOpen, setModalOpen] = useState(false); + + const handleOpenModal = () => setModalOpen(true); + const handleCloseModal = () => setModalOpen(false); + const handleSubmit = () => { + console.log('Action submitted'); + setModalOpen(false); + }; useEffect(() => { if (error) { @@ -36,7 +50,10 @@ export function ChooseDestinationContainer() { description="Add backend destinations where collected data will be sent and configure their settings." /> - + handleOpenModal()} + > back + {}, + variant: 'secondary', + }, + { + label: 'NEXT', + iconSrc: '/icons/common/arrow-black.svg', + onClick: () => {}, + variant: 'primary', + }, + { + label: 'NEXT', + iconSrc: '/icons/common/arrow-black.svg', + onClick: () => {}, + variant: 'primary', + }, + ]} + /> + } + header={{ + title: 'Modal Title', + }} + onClose={handleCloseModal} + > +

This is the modal content.

+
); diff --git a/frontend/webapp/public/icons/common/x.svg b/frontend/webapp/public/icons/common/x.svg new file mode 100644 index 000000000..26ea41f62 --- /dev/null +++ b/frontend/webapp/public/icons/common/x.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts index 4090df8fb..4cf8e0bd3 100644 --- a/frontend/webapp/reuseable-components/index.ts +++ b/frontend/webapp/reuseable-components/index.ts @@ -8,3 +8,5 @@ export * from './divider'; export * from './counter'; export * from './toggle'; export * from './checkbox'; +export * from './modal'; +export * from './navigation-buttons'; diff --git a/frontend/webapp/reuseable-components/modal/index.tsx b/frontend/webapp/reuseable-components/modal/index.tsx new file mode 100644 index 000000000..872b14503 --- /dev/null +++ b/frontend/webapp/reuseable-components/modal/index.tsx @@ -0,0 +1,124 @@ +import React from 'react'; +import Image from 'next/image'; +import { Text } from '../text'; +import ReactDOM from 'react-dom'; +import styled from 'styled-components'; +import { Button } from '../button'; + +interface ModalProps { + isOpen: boolean; + header: { + title: string; + }; + actionComponent?: React.ReactNode; + onClose: () => void; + children: React.ReactNode; +} + +const Overlay = styled.div` + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(17, 17, 17, 0.8); + backdrop-filter: blur(1px); + display: flex; + justify-content: center; + align-items: center; + z-index: 1000; +`; + +const ModalWrapper = styled.div` + background: ${({ theme }) => theme.colors.translucent_bg}; + border-radius: 40px; + border: ${({ theme }) => `1px solid ${theme.colors.border}`}; + width: 1080px; + box-shadow: 0px 1px 1px 0px rgba(17, 17, 17, 0.8), + 0px 2px 2px 0px rgba(17, 17, 17, 0.8), 0px 5px 5px 0px rgba(17, 17, 17, 0.8), + 0px 10px 10px 0px rgba(17, 17, 17, 0.8), + 0px 0px 8px 0px rgba(17, 17, 17, 0.8); +`; + +const ModalHeader = styled.div` + display: flex; + justify-content: space-between; + align-items: center; + height: 80px; + border-bottom: 1px solid ${({ theme }) => theme.colors.border}; + padding: 0 24px; +`; + +const ModalCloseButton = styled.div` + cursor: pointer; + display: flex; + align-items: center; + gap: 8px; +`; + +const HeaderActionsWrapper = styled.div` + display: flex; + align-items: center; + gap: 8px; +`; + +const ModalContent = styled.div` + padding: 1rem; +`; + +const ModalTitle = styled(Text)` + text-transform: uppercase; + font-weight: 500; +`; + +const CancelText = styled(Text)` + text-transform: uppercase; + font-weight: 600; + font-size: 14px; + font-family: ${({ theme }) => theme.font_family.secondary}; + text-decoration: underline; + cursor: pointer; +`; + +const ModalFooter = styled.div` + display: flex; + justify-content: flex-end; + padding: 1rem; + border-top: 1px solid #eaeaea; +`; + +const ModalButton = styled(Button)``; + +const Modal: React.FC = ({ + isOpen, + header, + onClose, + children, + actionComponent, +}) => { + if (!isOpen) return null; + + return ReactDOM.createPortal( + + + + + close + {'Cancel'} + + {header.title} + {actionComponent} + + {children} + + , + document.body + ); +}; + +export { Modal }; diff --git a/frontend/webapp/reuseable-components/navigation-buttons/index.tsx b/frontend/webapp/reuseable-components/navigation-buttons/index.tsx new file mode 100644 index 000000000..f1b366150 --- /dev/null +++ b/frontend/webapp/reuseable-components/navigation-buttons/index.tsx @@ -0,0 +1,93 @@ +import React from 'react'; +import Image from 'next/image'; +import { Text } from '../text'; +import { Button } from '../button'; +import theme from '@/styles/theme'; +import styled from 'styled-components'; + +interface NavigationButtonProps { + label: string; + iconSrc?: string; + onClick: () => void; + variant?: 'primary' | 'secondary'; + disabled?: boolean; +} + +interface NavigationButtonsProps { + buttons: NavigationButtonProps[]; +} + +const ButtonsContainer = styled.div` + display: flex; + gap: 8px; + align-items: center; +`; + +const StyledButton = styled(Button)` + display: flex; + align-items: center; + gap: 8px; +`; + +const ButtonText = styled(Text)` + text-decoration: underline; +`; + +export const NavigationButtons: React.FC = ({ + buttons, +}) => { + function renderBackButton({ + button, + index, + }: { + button: NavigationButtonProps; + index: number; + }) { + return ( + buttons.length > 0 && + buttons[0].label === 'BACK' && + button.iconSrc && + index === 0 + ); + } + return ( + + {buttons.map((button, index) => ( + + {renderBackButton({ button, index }) && ( + {button.label} + )} + + {button.label} + + {button.iconSrc && !renderBackButton({ button, index }) && ( + {button.label} + )} + + ))} + + ); +}; diff --git a/frontend/webapp/reuseable-components/text/index.tsx b/frontend/webapp/reuseable-components/text/index.tsx index 61c582f40..393e02dcc 100644 --- a/frontend/webapp/reuseable-components/text/index.tsx +++ b/frontend/webapp/reuseable-components/text/index.tsx @@ -14,23 +14,20 @@ interface TextProps { const TextWrapper = styled.div<{ color?: string; - size: number; - weight: number; - align: 'left' | 'center' | 'right'; + size?: number; + weight?: number; + align?: 'left' | 'center' | 'right'; family?: 'primary' | 'secondary'; - opacity: number; + opacity?: number; decoration?: string; }>` color: ${({ color, theme }) => color || theme.colors.text}; - font-size: ${({ size }) => size}px; - font-weight: ${({ weight }) => weight}; - text-align: ${({ align }) => align}; - opacity: ${({ opacity }) => opacity}; - text-decoration: ${({ decoration }) => decoration}; + font-size: ${({ size }) => (size !== undefined ? size : 16)}px; + font-weight: ${({ weight }) => (weight !== undefined ? weight : 300)}; + text-align: ${({ align }) => align || 'left'}; + opacity: ${({ opacity }) => (opacity !== undefined ? opacity : 1)}; + text-decoration: ${({ decoration }) => decoration || 'none'}; font-family: ${({ theme, family }) => { - if (family === 'primary') { - return theme.font_family.primary; - } if (family === 'secondary') { return theme.font_family.secondary; } @@ -38,29 +35,8 @@ const TextWrapper = styled.div<{ }}; `; -const Text: React.FC = ({ - children, - color, - size = 16, - weight = 300, - align = 'left', - family = 'primary', - opacity = 1, - decoration, -}) => { - return ( - - {children} - - ); +const Text: React.FC = ({ children, ...props }) => { + return {children}; }; export { Text }; diff --git a/frontend/webapp/styles/theme.ts b/frontend/webapp/styles/theme.ts index ce5ce7c11..fa1d86cb6 100644 --- a/frontend/webapp/styles/theme.ts +++ b/frontend/webapp/styles/theme.ts @@ -7,6 +7,7 @@ const colors = { dark_grey: '#151515', text: '#F9F9F9', border: 'rgba(249, 249, 249, 0.08)', + translucent_bg: '#1e1e1e', }; const text = { From 7ee83aea5eaa6e1dc57ab6157ea0fa585913afa1 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 4 Aug 2024 11:29:41 +0300 Subject: [PATCH 123/374] chore: modal header --- .../destinations/choose-destination/index.tsx | 18 +++++-------- .../reuseable-components/modal/index.tsx | 27 +++++++++++-------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/frontend/webapp/containers/main/destinations/choose-destination/index.tsx b/frontend/webapp/containers/main/destinations/choose-destination/index.tsx index e99babaca..c2fc0be52 100644 --- a/frontend/webapp/containers/main/destinations/choose-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/choose-destination/index.tsx @@ -74,18 +74,12 @@ export function ChooseDestinationContainer() { actionComponent={ {}, - variant: 'secondary', - }, - { - label: 'NEXT', - iconSrc: '/icons/common/arrow-black.svg', - onClick: () => {}, - variant: 'primary', - }, + // { + // label: 'BACK', + // iconSrc: '/icons/common/arrow-white.svg', + // onClick: () => {}, + // variant: 'secondary', + // }, { label: 'NEXT', iconSrc: '/icons/common/arrow-black.svg', diff --git a/frontend/webapp/reuseable-components/modal/index.tsx b/frontend/webapp/reuseable-components/modal/index.tsx index 872b14503..48b1aa577 100644 --- a/frontend/webapp/reuseable-components/modal/index.tsx +++ b/frontend/webapp/reuseable-components/modal/index.tsx @@ -66,9 +66,21 @@ const ModalContent = styled.div` padding: 1rem; `; +const ModalTitleContainer = styled.div` + position: absolute; + left: 50%; + transform: translateX(-50%); + display: flex; + align-items: center; + justify-content: center; + width: 100%; + pointer-events: none; +`; + const ModalTitle = styled(Text)` text-transform: uppercase; - font-weight: 500; + font-weight: 400; + pointer-events: auto; /* Allow interaction with the title */ `; const CancelText = styled(Text)` @@ -80,15 +92,6 @@ const CancelText = styled(Text)` cursor: pointer; `; -const ModalFooter = styled.div` - display: flex; - justify-content: flex-end; - padding: 1rem; - border-top: 1px solid #eaeaea; -`; - -const ModalButton = styled(Button)``; - const Modal: React.FC = ({ isOpen, header, @@ -111,7 +114,9 @@ const Modal: React.FC = ({ /> {'Cancel'} - {header.title} + + {header.title} + {actionComponent} {children} From b49336eef3b91f549e6c78af6e57300d4831e4e8 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 4 Aug 2024 11:33:38 +0300 Subject: [PATCH 124/374] chore: wip --- frontend/webapp/reuseable-components/modal/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/webapp/reuseable-components/modal/index.tsx b/frontend/webapp/reuseable-components/modal/index.tsx index 48b1aa577..68d08a1cd 100644 --- a/frontend/webapp/reuseable-components/modal/index.tsx +++ b/frontend/webapp/reuseable-components/modal/index.tsx @@ -79,8 +79,8 @@ const ModalTitleContainer = styled.div` const ModalTitle = styled(Text)` text-transform: uppercase; - font-weight: 400; - pointer-events: auto; /* Allow interaction with the title */ + font-family: ${({ theme }) => theme.font_family.secondary}; + pointer-events: auto; `; const CancelText = styled(Text)` @@ -115,7 +115,7 @@ const Modal: React.FC = ({ {'Cancel'} - {header.title} + {header.title} {actionComponent} From 6687777049be60b99ba37101971e52339f15ec53 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 4 Aug 2024 11:47:36 +0300 Subject: [PATCH 125/374] chore: wip --- frontend/webapp/components/setup/headers/header/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/webapp/components/setup/headers/header/index.tsx b/frontend/webapp/components/setup/headers/header/index.tsx index 2083c9c79..722a27586 100644 --- a/frontend/webapp/components/setup/headers/header/index.tsx +++ b/frontend/webapp/components/setup/headers/header/index.tsx @@ -1,7 +1,7 @@ -import { NavigationButtons, Text } from '@/reuseable-components'; import Image from 'next/image'; import React from 'react'; import styled from 'styled-components'; +import { NavigationButtons, Text } from '@/reuseable-components'; interface SetupHeaderProps { onBack: () => void; From df8e83fc7c260be9019cc87ac2c261b400d2b29e Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 4 Aug 2024 11:49:26 +0300 Subject: [PATCH 126/374] chore: ficed pr comments --- frontend/webapp/styles/theme.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/webapp/styles/theme.ts b/frontend/webapp/styles/theme.ts index fa1d86cb6..533cd3401 100644 --- a/frontend/webapp/styles/theme.ts +++ b/frontend/webapp/styles/theme.ts @@ -7,7 +7,7 @@ const colors = { dark_grey: '#151515', text: '#F9F9F9', border: 'rgba(249, 249, 249, 0.08)', - translucent_bg: '#1e1e1e', + translucent_bg: 'rgba(249, 249, 249, 0.04)', }; const text = { From a25a02415abd8e9b0c38ec8b7a96870f13e06a2a Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 4 Aug 2024 12:50:18 +0300 Subject: [PATCH 127/374] chore: init destination list --- .../destinations-list/index.tsx | 141 ++++++++++++++++++ .../destinations/choose-destination/index.tsx | 44 +++++- .../reuseable-components/modal/index.tsx | 4 +- frontend/webapp/types/destinations.ts | 17 +++ 4 files changed, 201 insertions(+), 5 deletions(-) diff --git a/frontend/webapp/containers/main/destinations/choose-destination/destinations-list/index.tsx b/frontend/webapp/containers/main/destinations/choose-destination/destinations-list/index.tsx index e69de29bb..b1c4859ab 100644 --- a/frontend/webapp/containers/main/destinations/choose-destination/destinations-list/index.tsx +++ b/frontend/webapp/containers/main/destinations/choose-destination/destinations-list/index.tsx @@ -0,0 +1,141 @@ +import React from 'react'; +import Image from 'next/image'; +import styled from 'styled-components'; +import { DestinationTypeItem } from '@/types'; +import { Text } from '@/reuseable-components'; + +const Container = styled.div` + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 12px; + align-self: stretch; + border-radius: 16px; + height: 100%; + max-height: 548px; + overflow-y: auto; +`; + +const ListItem = styled.div<{ selected: boolean }>` + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + padding: 16px 0px; + transition: background 0.3s; + border-radius: 16px; + + cursor: pointer; + background: ${({ selected }) => + selected ? 'rgba(68, 74, 217, 0.24)' : 'rgba(249, 249, 249, 0.04)'}; + + &:hover { + background: rgba(68, 74, 217, 0.24); + } +`; + +const ListItemContent = styled.div` + margin-left: 16px; + display: flex; + gap: 12px; +`; + +const DestinationIconWrapper = styled.div` + display: flex; + width: 36px; + height: 36px; + justify-content: center; + align-items: center; + gap: 8px; + border-radius: 8px; + background: linear-gradient( + 180deg, + rgba(249, 249, 249, 0.06) 0%, + rgba(249, 249, 249, 0.02) 100% + ); +`; + +const SignalsWrapper = styled.div` + display: flex; + gap: 4px; +`; + +const SignalText = styled(Text)` + color: rgba(249, 249, 249, 0.8); + font-size: 10px; + text-transform: capitalize; +`; + +const TextWrapper = styled.div` + display: flex; + flex-direction: column; + height: 36px; + justify-content: space-between; +`; + +const SelectedTextWrapper = styled.div` + margin-right: 24px; +`; + +interface DestinationsListProps { + items: DestinationTypeItem[]; + selectedItems: DestinationTypeItem[]; + setSelectedItems: (item: DestinationTypeItem) => void; +} + +const DestinationsList: React.FC = ({ + items, + selectedItems, + setSelectedItems, +}) => { + function renderSupportedSignals(item: DestinationTypeItem) { + const supportedSignals = item.supportedSignals; + const signals = Object.keys(supportedSignals); + const supportedSignalsList = signals.filter( + (signal) => supportedSignals[signal].supported + ); + + return supportedSignalsList.map((signal, index) => ( + <> + {signal} + {index < supportedSignalsList.length - 1 && ·} + + )); + } + renderSupportedSignals(items[0]); + return ( + + {items.map((item) => ( + setSelectedItems(item)} + > + + + destination + + + {item.displayName} + {renderSupportedSignals(item)} + + + {selectedItems.includes(item) && ( + + + SELECTED + + + )} + + ))} + + ); +}; + +export { DestinationsList }; diff --git a/frontend/webapp/containers/main/destinations/choose-destination/index.tsx b/frontend/webapp/containers/main/destinations/choose-destination/index.tsx index c2fc0be52..e634f8d66 100644 --- a/frontend/webapp/containers/main/destinations/choose-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/choose-destination/index.tsx @@ -11,6 +11,8 @@ import Image from 'next/image'; import theme from '@/styles/theme'; import { useQuery } from '@apollo/client'; import { GET_DESTINATION_TYPE } from '@/graphql'; +import { DestinationsList } from './destinations-list'; +import { DestinationTypeItem } from '@/types'; const AddDestinationButtonWrapper = styled.div` width: 100%; @@ -28,6 +30,10 @@ const AddDestinationButton = styled(Button)` export function ChooseDestinationContainer() { const { data, loading, error } = useQuery(GET_DESTINATION_TYPE); const [isModalOpen, setModalOpen] = useState(false); + const [destinationTypeList, setDestinationTypeList] = useState< + DestinationTypeItem[] + >([]); + const [selectedItems, setSelectedItems] = useState([]); const handleOpenModal = () => setModalOpen(true); const handleCloseModal = () => setModalOpen(false); @@ -40,9 +46,39 @@ export function ChooseDestinationContainer() { if (error) { console.error('Error fetching destination types', error); } + data && buildDestinationTypeList(); console.log({ data }); }, [data, error]); + function buildDestinationTypeList() { + const destinationTypes = data?.destinationTypes?.categories || []; + const destinationTypeList: DestinationTypeItem[] = destinationTypes.reduce( + (acc: DestinationTypeItem[], category: any) => { + const items = category.items.map((item: any) => ({ + category: category.name, + displayName: item.displayName, + imageUrl: item.imageUrl, + supportedSignals: item.supportedSignals, + })); + return [...acc, ...items]; + }, + [] + ); + setDestinationTypeList(destinationTypeList); + } + + function handleSelectItem(item: DestinationTypeItem) { + if (selectedItems.includes(item)) { + const updatedSelectedItems = selectedItems.filter( + (selectedItem) => selectedItem !== item + ); + setSelectedItems(updatedSelectedItems); + } else { + const updatedSelectedItems = [...selectedItems, item]; + setSelectedItems(updatedSelectedItems); + } + } + return ( <> } header={{ - title: 'Modal Title', + title: 'Add destination', }} onClose={handleCloseModal} > -

This is the modal content.

+ diff --git a/frontend/webapp/reuseable-components/modal/index.tsx b/frontend/webapp/reuseable-components/modal/index.tsx index 68d08a1cd..67f076ffa 100644 --- a/frontend/webapp/reuseable-components/modal/index.tsx +++ b/frontend/webapp/reuseable-components/modal/index.tsx @@ -62,9 +62,7 @@ const HeaderActionsWrapper = styled.div` gap: 8px; `; -const ModalContent = styled.div` - padding: 1rem; -`; +const ModalContent = styled.div``; const ModalTitleContainer = styled.div` position: absolute; diff --git a/frontend/webapp/types/destinations.ts b/frontend/webapp/types/destinations.ts index a00ad4051..56c734bbe 100644 --- a/frontend/webapp/types/destinations.ts +++ b/frontend/webapp/types/destinations.ts @@ -5,6 +5,23 @@ export enum DestinationsSortType { TYPE = 'type', } +export interface DestinationTypeItem { + displayName: string; + imageUrl: string; + category: 'managed' | 'self-hosted'; + supportedSignals: { + logs: { + supported: boolean; + }; + metrics: { + supported: boolean; + }; + traces: { + supported: boolean; + }; + }; +} + export interface DestinationType { fields: any; display_name: string; From f3e8c013af2e54bb2135ac650ca64b16e4f280bb Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 4 Aug 2024 14:33:49 +0300 Subject: [PATCH 128/374] chore: wip --- frontend/webapp/app/setup/layout.tsx | 9 ++- .../webapp/components/setup/menu/index.tsx | 7 +-- frontend/webapp/reuseable-components/index.ts | 1 + .../reuseable-components/input/index.tsx | 3 +- .../webapp/reuseable-components/tag/index.tsx | 60 +++++++++++++++++++ frontend/webapp/utils/constants/index.tsx | 1 + frontend/webapp/utils/constants/monitors.ts | 14 +++++ 7 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 frontend/webapp/reuseable-components/tag/index.tsx create mode 100644 frontend/webapp/utils/constants/monitors.ts diff --git a/frontend/webapp/app/setup/layout.tsx b/frontend/webapp/app/setup/layout.tsx index 198d6164d..a5ddf5598 100644 --- a/frontend/webapp/app/setup/layout.tsx +++ b/frontend/webapp/app/setup/layout.tsx @@ -43,7 +43,14 @@ export default function SetupLayout({ return ( - + diff --git a/frontend/webapp/components/setup/menu/index.tsx b/frontend/webapp/components/setup/menu/index.tsx index 08e1716f5..135c6ce8e 100644 --- a/frontend/webapp/components/setup/menu/index.tsx +++ b/frontend/webapp/components/setup/menu/index.tsx @@ -61,14 +61,13 @@ const StepContent = styled.div` `; const StepTitle = styled(Text)` - font-size: 16px; - font-weight: bold; + font-weight: 500; `; const StepSubtitle = styled(Text)``; -const SideMenu: React.FC = () => { - const steps: StepProps[] = [ +const SideMenu: React.FC<{ data?: StepProps[] }> = ({ data }) => { + const steps: StepProps[] = data || [ { title: 'INSTALLATION', subtitle: 'Success', diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts index 4cf8e0bd3..0391f7f11 100644 --- a/frontend/webapp/reuseable-components/index.ts +++ b/frontend/webapp/reuseable-components/index.ts @@ -10,3 +10,4 @@ export * from './toggle'; export * from './checkbox'; export * from './modal'; export * from './navigation-buttons'; +export * from './tag'; diff --git a/frontend/webapp/reuseable-components/input/index.tsx b/frontend/webapp/reuseable-components/input/index.tsx index 9b62c8bc1..2f5e3607c 100644 --- a/frontend/webapp/reuseable-components/input/index.tsx +++ b/frontend/webapp/reuseable-components/input/index.tsx @@ -75,8 +75,7 @@ const StyledInput = styled.input` font-family: ${({ theme }) => theme.font_family.primary}; opacity: 0.4; font-size: 14px; - font-style: normal; - font-weight: 400; + font-weight: 300; line-height: 22px; /* 157.143% */ } diff --git a/frontend/webapp/reuseable-components/tag/index.tsx b/frontend/webapp/reuseable-components/tag/index.tsx new file mode 100644 index 000000000..193553013 --- /dev/null +++ b/frontend/webapp/reuseable-components/tag/index.tsx @@ -0,0 +1,60 @@ +import React from 'react'; +import styled, { css } from 'styled-components'; + +interface TagProps { + id: string; + children: React.ReactNode; + isSelected: boolean; + isDisabled?: boolean; + onClick: (id: string) => void; +} + +const TagContainer = styled.div<{ isSelected: boolean; isDisabled: boolean }>` + display: flex; + align-items: center; + justify-content: center; + padding: 8px 16px; + border-radius: 16px; + background-color: ${({ theme, isSelected }) => + isSelected ? theme.colors.dark_grey : theme.colors.translucent_bg}; + cursor: ${({ isDisabled }) => (isDisabled ? 'not-allowed' : 'pointer')}; + opacity: ${({ isDisabled }) => (isDisabled ? 0.5 : 1)}; + transition: background-color 0.2s ease-in-out, 0.2s ease-in-out; + + ${({ isDisabled, theme }) => + !isDisabled && + css` + &:hover { + background-color: ${theme.colors.dark_grey}; + } + `} +`; + +const Tag: React.FC = ({ + id, + isSelected, + isDisabled = false, + onClick, + children, +}) => { + const handleClick = () => { + if (!isDisabled) { + onClick(id); + } + }; + + return ( + + {children} + + ); +}; + +export { Tag }; diff --git a/frontend/webapp/utils/constants/index.tsx b/frontend/webapp/utils/constants/index.tsx index b16a6a033..21b5ba246 100644 --- a/frontend/webapp/utils/constants/index.tsx +++ b/frontend/webapp/utils/constants/index.tsx @@ -3,3 +3,4 @@ export * from './config'; export * from './string'; export * from './urls'; export * from './programming.languages'; +export * from './monitors'; diff --git a/frontend/webapp/utils/constants/monitors.ts b/frontend/webapp/utils/constants/monitors.ts new file mode 100644 index 000000000..7bd5f3daf --- /dev/null +++ b/frontend/webapp/utils/constants/monitors.ts @@ -0,0 +1,14 @@ +export const MONITORS_OPTIONS = [ + { + id: 'logs', + value: 'Logs', + }, + { + id: 'metrics', + value: 'Metrics', + }, + { + id: 'traces', + value: 'Traces', + }, +]; From 239eac46b7511cd5f6fc0f5b016a515ea17509b8 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 4 Aug 2024 16:28:10 +0300 Subject: [PATCH 129/374] chore: code structure --- .../add-destination-button/index.tsx | 33 ++++ .../webapp/components/destinations/index.ts | 1 + frontend/webapp/components/index.ts | 1 + .../webapp/components/setup/menu/index.tsx | 3 +- .../destinations-list/index.tsx | 31 +--- .../destinations/add-destination/index.tsx | 64 ++++++++ .../choose-destination-menu/index.tsx | 0 .../destinations/choose-destination/index.tsx | 142 ------------------ .../containers/main/destinations/index.tsx | 2 +- .../reuseable-components/modal/index.tsx | 2 +- .../navigation-buttons/index.tsx | 7 +- .../webapp/reuseable-components/tag/index.tsx | 11 +- 12 files changed, 118 insertions(+), 179 deletions(-) create mode 100644 frontend/webapp/components/destinations/add-destination-button/index.tsx create mode 100644 frontend/webapp/components/destinations/index.ts rename frontend/webapp/containers/main/destinations/{choose-destination => add-destination}/destinations-list/index.tsx (77%) create mode 100644 frontend/webapp/containers/main/destinations/add-destination/index.tsx delete mode 100644 frontend/webapp/containers/main/destinations/choose-destination/choose-destination-menu/index.tsx delete mode 100644 frontend/webapp/containers/main/destinations/choose-destination/index.tsx diff --git a/frontend/webapp/components/destinations/add-destination-button/index.tsx b/frontend/webapp/components/destinations/add-destination-button/index.tsx new file mode 100644 index 000000000..281d403c7 --- /dev/null +++ b/frontend/webapp/components/destinations/add-destination-button/index.tsx @@ -0,0 +1,33 @@ +import React from 'react'; +import Image from 'next/image'; +import theme from '@/styles/theme'; +import styled from 'styled-components'; +import { Button, Text } from '@/reuseable-components'; + +const StyledAddDestinationButton = styled(Button)` + display: flex; + align-items: center; + justify-content: center; + gap: 8px; + width: 100%; +`; + +interface ModalActionComponentProps { + onClick: () => void; +} + +export function AddDestinationButton({ onClick }: ModalActionComponentProps) { + return ( + + back + + ADD DESTINATION + + + ); +} diff --git a/frontend/webapp/components/destinations/index.ts b/frontend/webapp/components/destinations/index.ts new file mode 100644 index 000000000..6a8d33bb7 --- /dev/null +++ b/frontend/webapp/components/destinations/index.ts @@ -0,0 +1 @@ +export * from './add-destination-button'; diff --git a/frontend/webapp/components/index.ts b/frontend/webapp/components/index.ts index c03b571ed..5a7406ea6 100644 --- a/frontend/webapp/components/index.ts +++ b/frontend/webapp/components/index.ts @@ -4,3 +4,4 @@ export * from './overview'; export * from './common'; export * from './notification/notification-manager'; export * from './notification/notification-list'; +export * from './destinations'; diff --git a/frontend/webapp/components/setup/menu/index.tsx b/frontend/webapp/components/setup/menu/index.tsx index 135c6ce8e..e78c035d2 100644 --- a/frontend/webapp/components/setup/menu/index.tsx +++ b/frontend/webapp/components/setup/menu/index.tsx @@ -33,11 +33,10 @@ const Step = styled.div<{ state: 'finish' | 'active' | 'disabled' }>` `; const IconWrapper = styled.div<{ state: 'finish' | 'active' | 'disabled' }>` - margin-right: 10px; border-radius: 32px; width: 24px; height: 24px; - border: 1px solid #f9f9f9; + border: 1px solid ${({ theme }) => theme.colors.secondary}; display: flex; justify-content: center; align-items: center; diff --git a/frontend/webapp/containers/main/destinations/choose-destination/destinations-list/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/destinations-list/index.tsx similarity index 77% rename from frontend/webapp/containers/main/destinations/choose-destination/destinations-list/index.tsx rename to frontend/webapp/containers/main/destinations/add-destination/destinations-list/index.tsx index b1c4859ab..7d54930ff 100644 --- a/frontend/webapp/containers/main/destinations/choose-destination/destinations-list/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/destinations-list/index.tsx @@ -16,7 +16,7 @@ const Container = styled.div` overflow-y: auto; `; -const ListItem = styled.div<{ selected: boolean }>` +const ListItem = styled.div<{}>` display: flex; align-items: center; justify-content: space-between; @@ -26,12 +26,14 @@ const ListItem = styled.div<{ selected: boolean }>` border-radius: 16px; cursor: pointer; - background: ${({ selected }) => - selected ? 'rgba(68, 74, 217, 0.24)' : 'rgba(249, 249, 249, 0.04)'}; + background: rgba(249, 249, 249, 0.04); &:hover { background: rgba(68, 74, 217, 0.24); } + &:last-child { + margin-bottom: 32px; + } `; const ListItemContent = styled.div` @@ -73,19 +75,13 @@ const TextWrapper = styled.div` justify-content: space-between; `; -const SelectedTextWrapper = styled.div` - margin-right: 24px; -`; - interface DestinationsListProps { items: DestinationTypeItem[]; - selectedItems: DestinationTypeItem[]; setSelectedItems: (item: DestinationTypeItem) => void; } const DestinationsList: React.FC = ({ items, - selectedItems, setSelectedItems, }) => { function renderSupportedSignals(item: DestinationTypeItem) { @@ -102,15 +98,11 @@ const DestinationsList: React.FC = ({ )); } - renderSupportedSignals(items[0]); + return ( {items.map((item) => ( - setSelectedItems(item)} - > + setSelectedItems(item)}> = ({ /> - {item.displayName} + {item.displayName} {renderSupportedSignals(item)} - {selectedItems.includes(item) && ( - - - SELECTED - - - )} ))} diff --git a/frontend/webapp/containers/main/destinations/add-destination/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/index.tsx new file mode 100644 index 000000000..97ed4d27f --- /dev/null +++ b/frontend/webapp/containers/main/destinations/add-destination/index.tsx @@ -0,0 +1,64 @@ +import React, { useEffect, useState } from 'react'; + +import styled from 'styled-components'; +import { useQuery } from '@apollo/client'; +import { DestinationTypeItem } from '@/types'; +import { GET_DESTINATION_TYPE } from '@/graphql'; +import { AddDestinationButton } from '@/components'; +import { SectionTitle } from '@/reuseable-components'; +import { AddDestinationModal } from './add-destination-modal'; + +const AddDestinationButtonWrapper = styled.div` + width: 100%; + margin-top: 24px; +`; + +export function ChooseDestinationContainer() { + const { data } = useQuery(GET_DESTINATION_TYPE); + + const [isModalOpen, setModalOpen] = useState(false); + const [destinationTypeList, setDestinationTypeList] = useState< + DestinationTypeItem[] + >([]); + + const handleOpenModal = () => setModalOpen(true); + const handleCloseModal = () => setModalOpen(false); + + useEffect(() => { + data && buildDestinationTypeList(); + }, [data]); + + function buildDestinationTypeList() { + const destinationTypes = data?.destinationTypes?.categories || []; + const destinationTypeList: DestinationTypeItem[] = destinationTypes.reduce( + (acc: DestinationTypeItem[], category: any) => { + const items = category.items.map((item: any) => ({ + category: category.name, + displayName: item.displayName, + imageUrl: item.imageUrl, + supportedSignals: item.supportedSignals, + })); + return [...acc, ...items]; + }, + [] + ); + setDestinationTypeList(destinationTypeList); + } + + return ( + <> + + + handleOpenModal()} /> + + + + ); +} diff --git a/frontend/webapp/containers/main/destinations/choose-destination/choose-destination-menu/index.tsx b/frontend/webapp/containers/main/destinations/choose-destination/choose-destination-menu/index.tsx deleted file mode 100644 index e69de29bb..000000000 diff --git a/frontend/webapp/containers/main/destinations/choose-destination/index.tsx b/frontend/webapp/containers/main/destinations/choose-destination/index.tsx deleted file mode 100644 index e634f8d66..000000000 --- a/frontend/webapp/containers/main/destinations/choose-destination/index.tsx +++ /dev/null @@ -1,142 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { - Button, - Modal, - NavigationButtons, - SectionTitle, - Text, -} from '@/reuseable-components'; -import styled from 'styled-components'; -import Image from 'next/image'; -import theme from '@/styles/theme'; -import { useQuery } from '@apollo/client'; -import { GET_DESTINATION_TYPE } from '@/graphql'; -import { DestinationsList } from './destinations-list'; -import { DestinationTypeItem } from '@/types'; - -const AddDestinationButtonWrapper = styled.div` - width: 100%; - margin-top: 24px; -`; - -const AddDestinationButton = styled(Button)` - display: flex; - align-items: center; - justify-content: center; - gap: 8px; - width: 100%; -`; - -export function ChooseDestinationContainer() { - const { data, loading, error } = useQuery(GET_DESTINATION_TYPE); - const [isModalOpen, setModalOpen] = useState(false); - const [destinationTypeList, setDestinationTypeList] = useState< - DestinationTypeItem[] - >([]); - const [selectedItems, setSelectedItems] = useState([]); - - const handleOpenModal = () => setModalOpen(true); - const handleCloseModal = () => setModalOpen(false); - const handleSubmit = () => { - console.log('Action submitted'); - setModalOpen(false); - }; - - useEffect(() => { - if (error) { - console.error('Error fetching destination types', error); - } - data && buildDestinationTypeList(); - console.log({ data }); - }, [data, error]); - - function buildDestinationTypeList() { - const destinationTypes = data?.destinationTypes?.categories || []; - const destinationTypeList: DestinationTypeItem[] = destinationTypes.reduce( - (acc: DestinationTypeItem[], category: any) => { - const items = category.items.map((item: any) => ({ - category: category.name, - displayName: item.displayName, - imageUrl: item.imageUrl, - supportedSignals: item.supportedSignals, - })); - return [...acc, ...items]; - }, - [] - ); - setDestinationTypeList(destinationTypeList); - } - - function handleSelectItem(item: DestinationTypeItem) { - if (selectedItems.includes(item)) { - const updatedSelectedItems = selectedItems.filter( - (selectedItem) => selectedItem !== item - ); - setSelectedItems(updatedSelectedItems); - } else { - const updatedSelectedItems = [...selectedItems, item]; - setSelectedItems(updatedSelectedItems); - } - } - - return ( - <> - - - handleOpenModal()} - > - back - - ADD DESTINATION - - - {}, - // variant: 'secondary', - // }, - { - label: 'NEXT', - iconSrc: '/icons/common/arrow-black.svg', - onClick: () => {}, - variant: 'primary', - }, - ]} - /> - } - header={{ - title: 'Add destination', - }} - onClose={handleCloseModal} - > - - - - - ); -} diff --git a/frontend/webapp/containers/main/destinations/index.tsx b/frontend/webapp/containers/main/destinations/index.tsx index eef1f549b..a50795fd7 100644 --- a/frontend/webapp/containers/main/destinations/index.tsx +++ b/frontend/webapp/containers/main/destinations/index.tsx @@ -1,2 +1,2 @@ export * from './managed'; -export * from './choose-destination'; +export * from './add-destination'; diff --git a/frontend/webapp/reuseable-components/modal/index.tsx b/frontend/webapp/reuseable-components/modal/index.tsx index 67f076ffa..7404ee698 100644 --- a/frontend/webapp/reuseable-components/modal/index.tsx +++ b/frontend/webapp/reuseable-components/modal/index.tsx @@ -83,7 +83,7 @@ const ModalTitle = styled(Text)` const CancelText = styled(Text)` text-transform: uppercase; - font-weight: 600; + font-weight: 500; font-size: 14px; font-family: ${({ theme }) => theme.font_family.secondary}; text-decoration: underline; diff --git a/frontend/webapp/reuseable-components/navigation-buttons/index.tsx b/frontend/webapp/reuseable-components/navigation-buttons/index.tsx index f1b366150..b0fc57919 100644 --- a/frontend/webapp/reuseable-components/navigation-buttons/index.tsx +++ b/frontend/webapp/reuseable-components/navigation-buttons/index.tsx @@ -43,12 +43,7 @@ export const NavigationButtons: React.FC = ({ button: NavigationButtonProps; index: number; }) { - return ( - buttons.length > 0 && - buttons[0].label === 'BACK' && - button.iconSrc && - index === 0 - ); + return buttons.length > 0 && button.iconSrc && index === 0; } return ( diff --git a/frontend/webapp/reuseable-components/tag/index.tsx b/frontend/webapp/reuseable-components/tag/index.tsx index 193553013..4e0e32dd2 100644 --- a/frontend/webapp/reuseable-components/tag/index.tsx +++ b/frontend/webapp/reuseable-components/tag/index.tsx @@ -13,19 +13,22 @@ const TagContainer = styled.div<{ isSelected: boolean; isDisabled: boolean }>` display: flex; align-items: center; justify-content: center; - padding: 8px 16px; + padding: 8px 12px; border-radius: 16px; background-color: ${({ theme, isSelected }) => - isSelected ? theme.colors.dark_grey : theme.colors.translucent_bg}; + isSelected ? theme.colors.primary : theme.colors.translucent_bg}; cursor: ${({ isDisabled }) => (isDisabled ? 'not-allowed' : 'pointer')}; opacity: ${({ isDisabled }) => (isDisabled ? 0.5 : 1)}; - transition: background-color 0.2s ease-in-out, 0.2s ease-in-out; + transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out; ${({ isDisabled, theme }) => !isDisabled && css` &:hover { - background-color: ${theme.colors.dark_grey}; + background-color: ${theme.colors.secondary}; + div { + color: ${theme.colors.primary}; + } } `} `; From 0f183f462d3ceb1741a7547a23bef63fa75aad1e Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 5 Aug 2024 11:52:10 +0300 Subject: [PATCH 130/374] chore: wip --- .../webapp/components/destinations/index.ts | 1 + .../destinations/monitors-tap-list/index.tsx | 47 ++++++++ .../webapp/components/setup/menu/index.tsx | 8 +- .../add-destination-modal/index.tsx | 107 ++++++++++++++++++ .../choose-destination-menu/index.tsx | 71 ++++++++++++ .../choose-destination-modal-body/index.tsx | 101 +++++++++++++++++ .../connect-destination-modal-body/index.tsx | 39 +++++++ .../destinations/add-destination/index.tsx | 32 +----- .../destinations/add-destination/styled.ts | 15 +++ frontend/webapp/types/common.ts | 7 ++ 10 files changed, 390 insertions(+), 38 deletions(-) create mode 100644 frontend/webapp/components/destinations/monitors-tap-list/index.tsx create mode 100644 frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx create mode 100644 frontend/webapp/containers/main/destinations/add-destination/choose-destination-menu/index.tsx create mode 100644 frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx create mode 100644 frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx create mode 100644 frontend/webapp/containers/main/destinations/add-destination/styled.ts diff --git a/frontend/webapp/components/destinations/index.ts b/frontend/webapp/components/destinations/index.ts index 6a8d33bb7..e7e4b7330 100644 --- a/frontend/webapp/components/destinations/index.ts +++ b/frontend/webapp/components/destinations/index.ts @@ -1 +1,2 @@ export * from './add-destination-button'; +export * from './monitors-tap-list'; diff --git a/frontend/webapp/components/destinations/monitors-tap-list/index.tsx b/frontend/webapp/components/destinations/monitors-tap-list/index.tsx new file mode 100644 index 000000000..c1f288894 --- /dev/null +++ b/frontend/webapp/components/destinations/monitors-tap-list/index.tsx @@ -0,0 +1,47 @@ +import React from 'react'; +import styled from 'styled-components'; +import { Text, Tag } from '@/reuseable-components'; +import { MONITORS_OPTIONS } from '@/utils'; + +interface MonitorButtonsProps { + selectedMonitors: string[]; + onMonitorSelect: (monitor: string) => void; +} + +const MonitorButtonsContainer = styled.div` + display: flex; + gap: 8px; + margin-left: 12px; +`; + +const MonitorsTitle = styled(Text)` + opacity: 0.8; + font-size: 14px; + margin-left: 32px; +`; + +const MonitorsTapList: React.FC = ({ + selectedMonitors, + onMonitorSelect, +}) => { + return ( + <> + Monitor by: + + {MONITORS_OPTIONS.map((monitor) => ( + onMonitorSelect(monitor.id)} + > + + {monitor.value} + + + ))} + + + ); +}; + +export { MonitorsTapList }; diff --git a/frontend/webapp/components/setup/menu/index.tsx b/frontend/webapp/components/setup/menu/index.tsx index e78c035d2..7bf3d5e33 100644 --- a/frontend/webapp/components/setup/menu/index.tsx +++ b/frontend/webapp/components/setup/menu/index.tsx @@ -1,15 +1,9 @@ import { Text } from '@/reuseable-components'; +import { StepProps } from '@/types'; import Image from 'next/image'; import React from 'react'; import styled, { css } from 'styled-components'; -interface StepProps { - title: string; - subtitle?: string; - state: 'finish' | 'active' | 'disabled'; - stepNumber: number; -} - const Container = styled.div` display: flex; flex-direction: column; diff --git a/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx new file mode 100644 index 000000000..a53260e37 --- /dev/null +++ b/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx @@ -0,0 +1,107 @@ +import React, { useEffect, useState } from 'react'; +import { Modal, NavigationButtons } from '@/reuseable-components'; +import { ChooseDestinationModalBody } from '../choose-destination-modal-body'; +import { DestinationTypeItem } from '@/types'; +import { ConnectDestinationModalBody } from '../connect-destination-modal-body'; +import { GET_DESTINATION_TYPE } from '@/graphql'; +import { useQuery } from '@apollo/client'; + +interface AddDestinationModalProps { + isModalOpen: boolean; + handleCloseModal: () => void; +} + +function ModalActionComponent({ + onNext, + onBack, + item, +}: { + onNext: () => void; + onBack: () => void; + item: DestinationTypeItem | undefined; +}) { + return ( + + ); +} + +export function AddDestinationModal({ + isModalOpen, + handleCloseModal, +}: AddDestinationModalProps) { + const { data } = useQuery(GET_DESTINATION_TYPE); + const [selectedItem, setSelectedItem] = useState(); + const [destinationTypeList, setDestinationTypeList] = useState< + DestinationTypeItem[] + >([]); + + useEffect(() => { + data && buildDestinationTypeList(); + }, [data]); + + function buildDestinationTypeList() { + const destinationTypes = data?.destinationTypes?.categories || []; + const destinationTypeList: DestinationTypeItem[] = destinationTypes.reduce( + (acc: DestinationTypeItem[], category: any) => { + const items = category.items.map((item: any) => ({ + category: category.name, + displayName: item.displayName, + imageUrl: item.imageUrl, + supportedSignals: item.supportedSignals, + })); + return [...acc, ...items]; + }, + [] + ); + setDestinationTypeList(destinationTypeList); + } + function handleNextStep(item: DestinationTypeItem) { + setSelectedItem(item); + } + + function renderModalBody() { + return selectedItem ? ( + + ) : ( + + ); + } + + return ( + {}} + onBack={() => setSelectedItem(undefined)} + item={selectedItem} + /> + } + header={{ title: 'Add destination' }} + onClose={handleCloseModal} + > + {renderModalBody()} + + ); +} diff --git a/frontend/webapp/containers/main/destinations/add-destination/choose-destination-menu/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-menu/index.tsx new file mode 100644 index 000000000..9a86b5ac5 --- /dev/null +++ b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-menu/index.tsx @@ -0,0 +1,71 @@ +import React, { useState } from 'react'; +import styled from 'styled-components'; +import { DropdownOption } from '@/types'; +import { MonitorsTapList } from '@/components'; +import { Dropdown, Input } from '@/reuseable-components'; + +interface FilterComponentProps { + selectedTag: DropdownOption | undefined; + onTagSelect: (option: DropdownOption) => void; + onSearch: (value: string) => void; + selectedMonitors: string[]; + onMonitorSelect: (monitor: string) => void; +} + +const InputAndDropdownContainer = styled.div` + display: flex; + gap: 12px; + width: 438px; +`; + +const FilterContainer = styled.div` + display: flex; + align-items: center; + padding: 24px 0; +`; + +const DROPDOWN_OPTIONS = [ + { value: 'All', id: 'all' }, + { value: 'Managed', id: 'managed' }, + { value: 'Self-hosted', id: 'self hosted' }, +]; + +const DestinationFilterComponent: React.FC = ({ + selectedTag, + onTagSelect, + onSearch, + selectedMonitors, + onMonitorSelect, +}) => { + const [searchTerm, setSearchTerm] = useState(''); + + const handleSearchChange = (e: React.ChangeEvent) => { + const value = e.target.value; + setSearchTerm(value); + onSearch(value); + }; + + return ( + + + + + + + + ); +}; + +export { DestinationFilterComponent }; diff --git a/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx new file mode 100644 index 000000000..79dab2b4e --- /dev/null +++ b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx @@ -0,0 +1,101 @@ +import React, { useState } from 'react'; + +import { SideMenu } from '@/components'; +import { DestinationsList } from '../destinations-list'; +import { Body, Container, SideMenuWrapper } from '../styled'; +import { Divider, SectionTitle } from '@/reuseable-components'; +import { DestinationFilterComponent } from '../choose-destination-menu'; +import { DestinationTypeItem, DropdownOption, StepProps } from '@/types'; + +interface ChooseDestinationModalBodyProps { + data: DestinationTypeItem[]; + onSelect: (item: DestinationTypeItem) => void; +} + +const SIDE_MENU_DATA: StepProps[] = [ + { + title: 'DESTINATIONS', + state: 'active', + stepNumber: 1, + }, + { + title: 'CONNECTION', + state: 'disabled', + stepNumber: 2, + }, +]; + +export function ChooseDestinationModalBody({ + data, + onSelect, +}: ChooseDestinationModalBodyProps) { + const [searchValue, setSearchValue] = useState(''); + const [selectedMonitors, setSelectedMonitors] = useState([]); + const [dropdownValue, setDropdownValue] = useState({ + id: 'all', + value: 'All', + }); + + function handleTagSelect(option: DropdownOption) { + setDropdownValue(option); + } + + function filterData() { + let filteredData = data; + + if (searchValue) { + filteredData = filteredData.filter((item) => + item.displayName.toLowerCase().includes(searchValue.toLowerCase()) + ); + } + + if (dropdownValue.id !== 'all') { + filteredData = filteredData.filter( + (item) => item.category === dropdownValue.id + ); + } + + if (selectedMonitors.length) { + filteredData = filteredData.filter((item) => + selectedMonitors.some( + (monitor) => + item.supportedSignals[monitor as keyof typeof item.supportedSignals] + .supported + ) + ); + } + + return filteredData; + } + + function onMonitorSelect(monitor: string) { + if (selectedMonitors.includes(monitor)) { + setSelectedMonitors(selectedMonitors.filter((item) => item !== monitor)); + } else { + setSelectedMonitors([...selectedMonitors, monitor]); + } + } + + return ( + + + + + + + + + + + + ); +} diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx new file mode 100644 index 000000000..6fda7bc35 --- /dev/null +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -0,0 +1,39 @@ +import React from 'react'; +import { StepProps } from '@/types'; +import { SideMenu } from '@/components'; +import { Divider, SectionTitle } from '@/reuseable-components'; +import { Body, Container, SideMenuWrapper } from '../styled'; +const SIDE_MENU_DATA: StepProps[] = [ + { + title: 'DESTINATIONS', + state: 'finish', + stepNumber: 1, + }, + { + title: 'CONNECTION', + state: 'active', + stepNumber: 2, + }, +]; + +interface ConnectDestinationModalBodyProps {} + +export function ConnectDestinationModalBody({}: ConnectDestinationModalBodyProps) { + return ( + + + + + + + {}} + /> + + + + ); +} diff --git a/frontend/webapp/containers/main/destinations/add-destination/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/index.tsx index 97ed4d27f..fcb7dff01 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/index.tsx @@ -1,9 +1,6 @@ -import React, { useEffect, useState } from 'react'; +import React, { useState } from 'react'; import styled from 'styled-components'; -import { useQuery } from '@apollo/client'; -import { DestinationTypeItem } from '@/types'; -import { GET_DESTINATION_TYPE } from '@/graphql'; import { AddDestinationButton } from '@/components'; import { SectionTitle } from '@/reuseable-components'; import { AddDestinationModal } from './add-destination-modal'; @@ -14,37 +11,11 @@ const AddDestinationButtonWrapper = styled.div` `; export function ChooseDestinationContainer() { - const { data } = useQuery(GET_DESTINATION_TYPE); - const [isModalOpen, setModalOpen] = useState(false); - const [destinationTypeList, setDestinationTypeList] = useState< - DestinationTypeItem[] - >([]); const handleOpenModal = () => setModalOpen(true); const handleCloseModal = () => setModalOpen(false); - useEffect(() => { - data && buildDestinationTypeList(); - }, [data]); - - function buildDestinationTypeList() { - const destinationTypes = data?.destinationTypes?.categories || []; - const destinationTypeList: DestinationTypeItem[] = destinationTypes.reduce( - (acc: DestinationTypeItem[], category: any) => { - const items = category.items.map((item: any) => ({ - category: category.name, - displayName: item.displayName, - imageUrl: item.imageUrl, - supportedSignals: item.supportedSignals, - })); - return [...acc, ...items]; - }, - [] - ); - setDestinationTypeList(destinationTypeList); - } - return ( <> ); diff --git a/frontend/webapp/containers/main/destinations/add-destination/styled.ts b/frontend/webapp/containers/main/destinations/add-destination/styled.ts new file mode 100644 index 000000000..9ad79d7d5 --- /dev/null +++ b/frontend/webapp/containers/main/destinations/add-destination/styled.ts @@ -0,0 +1,15 @@ +import styled from 'styled-components'; + +export const Body = styled.div` + padding: 32px 32px 0; + border-left: 1px solid rgba(249, 249, 249, 0.08); +`; + +export const SideMenuWrapper = styled.div` + padding: 32px; + width: 196px; +`; + +export const Container = styled.div` + display: flex; +`; diff --git a/frontend/webapp/types/common.ts b/frontend/webapp/types/common.ts index 3d57d580a..83e80afdc 100644 --- a/frontend/webapp/types/common.ts +++ b/frontend/webapp/types/common.ts @@ -28,3 +28,10 @@ export interface DropdownOption { id: string; value: string; } + +export interface StepProps { + title: string; + subtitle?: string; + state: 'finish' | 'active' | 'disabled'; + stepNumber: number; +} From d43d43926c108ec55c215da7efdaca2536361fcf Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 5 Aug 2024 11:54:51 +0300 Subject: [PATCH 131/374] chore: wip --- .../add-destination/add-destination-modal/index.tsx | 10 +++++----- .../connect-destination-modal-body/index.tsx | 11 ++++++++--- .../main/destinations/add-destination/index.tsx | 1 - 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx index a53260e37..eab8f59d3 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx @@ -1,10 +1,10 @@ import React, { useEffect, useState } from 'react'; -import { Modal, NavigationButtons } from '@/reuseable-components'; -import { ChooseDestinationModalBody } from '../choose-destination-modal-body'; +import { useQuery } from '@apollo/client'; import { DestinationTypeItem } from '@/types'; -import { ConnectDestinationModalBody } from '../connect-destination-modal-body'; import { GET_DESTINATION_TYPE } from '@/graphql'; -import { useQuery } from '@apollo/client'; +import { Modal, NavigationButtons } from '@/reuseable-components'; +import { ConnectDestinationModalBody } from '../connect-destination-modal-body'; +import { ChooseDestinationModalBody } from '../choose-destination-modal-body'; interface AddDestinationModalProps { isModalOpen: boolean; @@ -79,7 +79,7 @@ export function AddDestinationModal({ function renderModalBody() { return selectedItem ? ( - + ) : ( diff --git a/frontend/webapp/containers/main/destinations/add-destination/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/index.tsx index fcb7dff01..c8c92371d 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/index.tsx @@ -1,5 +1,4 @@ import React, { useState } from 'react'; - import styled from 'styled-components'; import { AddDestinationButton } from '@/components'; import { SectionTitle } from '@/reuseable-components'; From 0173aa2188b90dfb16502cbb78c707ab0ad07c3d Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 5 Aug 2024 15:40:57 +0300 Subject: [PATCH 132/374] chore: init get destination type query --- frontend/graph/generated.go | 775 +++++++++++++++++++++++++++-- frontend/graph/model/models_gen.go | 14 + frontend/graph/schema.graphqls | 15 + frontend/graph/schema.resolvers.go | 30 +- frontend/services/destinations.go | 12 + 5 files changed, 804 insertions(+), 42 deletions(-) diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index ab9a757eb..bd2077fec 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -97,10 +97,24 @@ type ComplexityRoot struct { Traces func(childComplexity int) int } + Field struct { + ComponentProperties func(childComplexity int) int + ComponentType func(childComplexity int) int + DisplayName func(childComplexity int) int + InitialValue func(childComplexity int) int + Name func(childComplexity int) int + ThumbnailURL func(childComplexity int) int + VideoURL func(childComplexity int) int + } + GetConfigResponse struct { Installation func(childComplexity int) int } + GetDestinationDetailsResponse struct { + Fields func(childComplexity int) int + } + GetDestinationTypesResponse struct { Categories func(childComplexity int) int } @@ -136,9 +150,10 @@ type ComplexityRoot struct { } Query struct { - ComputePlatform func(childComplexity int) int - Config func(childComplexity int) int - DestinationTypes func(childComplexity int) int + ComputePlatform func(childComplexity int) int + Config func(childComplexity int) int + DestinationTypeDetails func(childComplexity int, typeArg string) int + DestinationTypes func(childComplexity int) int } SourceContainerRuntimeDetails struct { @@ -178,6 +193,7 @@ type QueryResolver interface { ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) Config(ctx context.Context) (*model.GetConfigResponse, error) DestinationTypes(ctx context.Context) (*model.GetDestinationTypesResponse, error) + DestinationTypeDetails(ctx context.Context, typeArg string) (*model.GetDestinationDetailsResponse, error) } type executableSchema struct { @@ -405,6 +421,55 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ExportedSignals.Traces(childComplexity), true + case "Field.componentProperties": + if e.complexity.Field.ComponentProperties == nil { + break + } + + return e.complexity.Field.ComponentProperties(childComplexity), true + + case "Field.componentType": + if e.complexity.Field.ComponentType == nil { + break + } + + return e.complexity.Field.ComponentType(childComplexity), true + + case "Field.displayName": + if e.complexity.Field.DisplayName == nil { + break + } + + return e.complexity.Field.DisplayName(childComplexity), true + + case "Field.initialValue": + if e.complexity.Field.InitialValue == nil { + break + } + + return e.complexity.Field.InitialValue(childComplexity), true + + case "Field.name": + if e.complexity.Field.Name == nil { + break + } + + return e.complexity.Field.Name(childComplexity), true + + case "Field.thumbnailURL": + if e.complexity.Field.ThumbnailURL == nil { + break + } + + return e.complexity.Field.ThumbnailURL(childComplexity), true + + case "Field.videoUrl": + if e.complexity.Field.VideoURL == nil { + break + } + + return e.complexity.Field.VideoURL(childComplexity), true + case "GetConfigResponse.installation": if e.complexity.GetConfigResponse.Installation == nil { break @@ -412,6 +477,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.GetConfigResponse.Installation(childComplexity), true + case "GetDestinationDetailsResponse.fields": + if e.complexity.GetDestinationDetailsResponse.Fields == nil { + break + } + + return e.complexity.GetDestinationDetailsResponse.Fields(childComplexity), true + case "GetDestinationTypesResponse.categories": if e.complexity.GetDestinationTypesResponse.Categories == nil { break @@ -548,6 +620,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Config(childComplexity), true + case "Query.destinationTypeDetails": + if e.complexity.Query.DestinationTypeDetails == nil { + break + } + + args, err := ec.field_Query_destinationTypeDetails_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.DestinationTypeDetails(childComplexity, args["type"].(string)), true + case "Query.destinationTypes": if e.complexity.Query.DestinationTypes == nil { break @@ -820,6 +904,21 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } +func (ec *executionContext) field_Query_destinationTypeDetails_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["type"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["type"] = arg0 + return args, nil +} + func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -2063,8 +2162,357 @@ func (ec *executionContext) fieldContext_DestinationsCategory_items(_ context.Co return fc, nil } -func (ec *executionContext) _ExportedSignals_traces(ctx context.Context, field graphql.CollectedField, obj *model.ExportedSignals) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ExportedSignals_traces(ctx, field) +func (ec *executionContext) _ExportedSignals_traces(ctx context.Context, field graphql.CollectedField, obj *model.ExportedSignals) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ExportedSignals_traces(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Traces, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ExportedSignals_traces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ExportedSignals", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ExportedSignals_metrics(ctx context.Context, field graphql.CollectedField, obj *model.ExportedSignals) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ExportedSignals_metrics(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Metrics, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ExportedSignals_metrics(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ExportedSignals", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ExportedSignals_logs(ctx context.Context, field graphql.CollectedField, obj *model.ExportedSignals) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ExportedSignals_logs(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Logs, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ExportedSignals_logs(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ExportedSignals", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Field_name(ctx context.Context, field graphql.CollectedField, obj *model.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Field_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Field_displayName(ctx context.Context, field graphql.CollectedField, obj *model.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Field_displayName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DisplayName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Field_displayName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Field_componentType(ctx context.Context, field graphql.CollectedField, obj *model.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Field_componentType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ComponentType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Field_componentType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Field_componentProperties(ctx context.Context, field graphql.CollectedField, obj *model.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Field_componentProperties(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ComponentProperties, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Field_componentProperties(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Field_videoUrl(ctx context.Context, field graphql.CollectedField, obj *model.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Field_videoUrl(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.VideoURL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Field_videoUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Field_thumbnailURL(ctx context.Context, field graphql.CollectedField, obj *model.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Field_thumbnailURL(ctx, field) if err != nil { return graphql.Null } @@ -2077,38 +2525,35 @@ func (ec *executionContext) _ExportedSignals_traces(ctx context.Context, field g }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Traces, nil + return obj.ThumbnailURL, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(*string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ExportedSignals_traces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Field_thumbnailURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ExportedSignals", + Object: "Field", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ExportedSignals_metrics(ctx context.Context, field graphql.CollectedField, obj *model.ExportedSignals) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ExportedSignals_metrics(ctx, field) +func (ec *executionContext) _Field_initialValue(ctx context.Context, field graphql.CollectedField, obj *model.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Field_initialValue(ctx, field) if err != nil { return graphql.Null } @@ -2121,38 +2566,35 @@ func (ec *executionContext) _ExportedSignals_metrics(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Metrics, nil + return obj.InitialValue, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(*string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ExportedSignals_metrics(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Field_initialValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ExportedSignals", + Object: "Field", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ExportedSignals_logs(ctx context.Context, field graphql.CollectedField, obj *model.ExportedSignals) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ExportedSignals_logs(ctx, field) +func (ec *executionContext) _GetConfigResponse_installation(ctx context.Context, field graphql.CollectedField, obj *model.GetConfigResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_GetConfigResponse_installation(ctx, field) if err != nil { return graphql.Null } @@ -2165,7 +2607,7 @@ func (ec *executionContext) _ExportedSignals_logs(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Logs, nil + return obj.Installation, nil }) if err != nil { ec.Error(ctx, err) @@ -2177,26 +2619,26 @@ func (ec *executionContext) _ExportedSignals_logs(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(model.InstallationStatus) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNInstallationStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstallationStatus(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ExportedSignals_logs(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_GetConfigResponse_installation(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ExportedSignals", + Object: "GetConfigResponse", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type InstallationStatus does not have child fields") }, } return fc, nil } -func (ec *executionContext) _GetConfigResponse_installation(ctx context.Context, field graphql.CollectedField, obj *model.GetConfigResponse) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_GetConfigResponse_installation(ctx, field) +func (ec *executionContext) _GetDestinationDetailsResponse_fields(ctx context.Context, field graphql.CollectedField, obj *model.GetDestinationDetailsResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_GetDestinationDetailsResponse_fields(ctx, field) if err != nil { return graphql.Null } @@ -2209,7 +2651,7 @@ func (ec *executionContext) _GetConfigResponse_installation(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Installation, nil + return obj.Fields, nil }) if err != nil { ec.Error(ctx, err) @@ -2221,19 +2663,35 @@ func (ec *executionContext) _GetConfigResponse_installation(ctx context.Context, } return graphql.Null } - res := resTmp.(model.InstallationStatus) + res := resTmp.([]*model.Field) fc.Result = res - return ec.marshalNInstallationStatus2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstallationStatus(ctx, field.Selections, res) + return ec.marshalNField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐFieldᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_GetConfigResponse_installation(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_GetDestinationDetailsResponse_fields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "GetConfigResponse", + Object: "GetDestinationDetailsResponse", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type InstallationStatus does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext_Field_name(ctx, field) + case "displayName": + return ec.fieldContext_Field_displayName(ctx, field) + case "componentType": + return ec.fieldContext_Field_componentType(ctx, field) + case "componentProperties": + return ec.fieldContext_Field_componentProperties(ctx, field) + case "videoUrl": + return ec.fieldContext_Field_videoUrl(ctx, field) + case "thumbnailURL": + return ec.fieldContext_Field_thumbnailURL(ctx, field) + case "initialValue": + return ec.fieldContext_Field_initialValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Field", field.Name) }, } return fc, nil @@ -3145,6 +3603,62 @@ func (ec *executionContext) fieldContext_Query_destinationTypes(_ context.Contex return fc, nil } +func (ec *executionContext) _Query_destinationTypeDetails(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_destinationTypeDetails(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().DestinationTypeDetails(rctx, fc.Args["type"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.GetDestinationDetailsResponse) + fc.Result = res + return ec.marshalOGetDestinationDetailsResponse2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐGetDestinationDetailsResponse(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_destinationTypeDetails(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "fields": + return ec.fieldContext_GetDestinationDetailsResponse_fields(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type GetDestinationDetailsResponse", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_destinationTypeDetails_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query___type(ctx, field) if err != nil { @@ -5925,6 +6439,66 @@ func (ec *executionContext) _ExportedSignals(ctx context.Context, sel ast.Select return out } +var fieldImplementors = []string{"Field"} + +func (ec *executionContext) _Field(ctx context.Context, sel ast.SelectionSet, obj *model.Field) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, fieldImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Field") + case "name": + out.Values[i] = ec._Field_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "displayName": + out.Values[i] = ec._Field_displayName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "componentType": + out.Values[i] = ec._Field_componentType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "componentProperties": + out.Values[i] = ec._Field_componentProperties(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "videoUrl": + out.Values[i] = ec._Field_videoUrl(ctx, field, obj) + case "thumbnailURL": + out.Values[i] = ec._Field_thumbnailURL(ctx, field, obj) + case "initialValue": + out.Values[i] = ec._Field_initialValue(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var getConfigResponseImplementors = []string{"GetConfigResponse"} func (ec *executionContext) _GetConfigResponse(ctx context.Context, sel ast.SelectionSet, obj *model.GetConfigResponse) graphql.Marshaler { @@ -5964,6 +6538,45 @@ func (ec *executionContext) _GetConfigResponse(ctx context.Context, sel ast.Sele return out } +var getDestinationDetailsResponseImplementors = []string{"GetDestinationDetailsResponse"} + +func (ec *executionContext) _GetDestinationDetailsResponse(ctx context.Context, sel ast.SelectionSet, obj *model.GetDestinationDetailsResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, getDestinationDetailsResponseImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("GetDestinationDetailsResponse") + case "fields": + out.Values[i] = ec._GetDestinationDetailsResponse_fields(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var getDestinationTypesResponseImplementors = []string{"GetDestinationTypesResponse"} func (ec *executionContext) _GetDestinationTypesResponse(ctx context.Context, sel ast.SelectionSet, obj *model.GetDestinationTypesResponse) graphql.Marshaler { @@ -6343,6 +6956,25 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "destinationTypeDetails": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_destinationTypeDetails(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "__type": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -6939,6 +7571,60 @@ func (ec *executionContext) marshalNExportedSignals2githubᚗcomᚋodigosᚑio return ec._ExportedSignals(ctx, sel, &v) } +func (ec *executionContext) marshalNField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Field) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNField2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐField(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNField2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐField(ctx context.Context, sel ast.SelectionSet, v *model.Field) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Field(ctx, sel, v) +} + func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { res, err := graphql.UnmarshalID(v) return res, graphql.ErrorOnPath(ctx, err) @@ -7460,6 +8146,13 @@ func (ec *executionContext) marshalOGetConfigResponse2ᚖgithubᚗcomᚋodigos return ec._GetConfigResponse(ctx, sel, v) } +func (ec *executionContext) marshalOGetDestinationDetailsResponse2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐGetDestinationDetailsResponse(ctx context.Context, sel ast.SelectionSet, v *model.GetDestinationDetailsResponse) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._GetDestinationDetailsResponse(ctx, sel, v) +} + func (ec *executionContext) marshalOGetDestinationTypesResponse2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐGetDestinationTypesResponse(ctx context.Context, sel ast.SelectionSet, v *model.GetDestinationTypesResponse) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index 8edb3f653..e74ae4c57 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -25,10 +25,24 @@ type Condition struct { Message *string `json:"message,omitempty"` } +type Field struct { + Name string `json:"name"` + DisplayName string `json:"displayName"` + ComponentType string `json:"componentType"` + ComponentProperties string `json:"componentProperties"` + VideoURL *string `json:"videoUrl,omitempty"` + ThumbnailURL *string `json:"thumbnailURL,omitempty"` + InitialValue *string `json:"initialValue,omitempty"` +} + type GetConfigResponse struct { Installation InstallationStatus `json:"installation"` } +type GetDestinationDetailsResponse struct { + Fields []*Field `json:"fields"` +} + type InstrumentedApplicationDetails struct { Containers []*SourceContainerRuntimeDetails `json:"containers,omitempty"` Conditions []*Condition `json:"conditions,omitempty"` diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index a1d5d0abc..591e81151 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -158,10 +158,25 @@ type GetConfigResponse { installation: InstallationStatus! } +type Field { + name: String! + displayName: String! + componentType: String! + componentProperties: String! # Using String to store JSON data as a string + videoUrl: String + thumbnailURL: String + initialValue: String +} + +type GetDestinationDetailsResponse { + fields: [Field!]! +} + type Query { computePlatform: ComputePlatform config: GetConfigResponse destinationTypes: GetDestinationTypesResponse + destinationTypeDetails(type: String!): GetDestinationDetailsResponse } type Mutation { diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index f32fbfbf4..e8e75addb 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -6,8 +6,10 @@ package graph import ( "context" + "encoding/json" "fmt" + "github.com/odigos-io/odigos/common" "github.com/odigos-io/odigos/frontend/endpoints" "github.com/odigos-io/odigos/frontend/graph/model" "github.com/odigos-io/odigos/frontend/kube" @@ -117,11 +119,37 @@ func (r *queryResolver) Config(ctx context.Context) (*model.GetConfigResponse, e // DestinationTypes is the resolver for the destinationTypes field. func (r *queryResolver) DestinationTypes(ctx context.Context) (*model.GetDestinationTypesResponse, error) { - destTypes := services.GetDestinationTypes() return &destTypes, nil +} + +// DestinationTypeDetails is the resolver for the destinationTypeDetails field. +func (r *queryResolver) DestinationTypeDetails(ctx context.Context, typeArg string) (*model.GetDestinationDetailsResponse, error) { + destType := common.DestinationType(typeArg) + destTypeConfig, err := services.GetDestinationTypeConfig(destType) + if err != nil { + return nil, fmt.Errorf("destination type %s not found", destType) + } + + var resp model.GetDestinationDetailsResponse + for _, field := range destTypeConfig.Spec.Fields { + componentPropsJSON, err := json.Marshal(field.ComponentProps) + if err != nil { + return nil, fmt.Errorf("error marshalling component properties: %v", err) + } + + resp.Fields = append(resp.Fields, &model.Field{ + Name: field.Name, + DisplayName: field.DisplayName, + ComponentType: field.ComponentType, + ComponentProperties: string(componentPropsJSON), + InitialValue: &field.InitialValue, + }) + + } + return &resp, nil } // ComputePlatform returns ComputePlatformResolver implementation. diff --git a/frontend/services/destinations.go b/frontend/services/destinations.go index a1d0b5b09..39e7835e8 100644 --- a/frontend/services/destinations.go +++ b/frontend/services/destinations.go @@ -1,6 +1,8 @@ package services import ( + "fmt" + "github.com/odigos-io/odigos/common" "github.com/odigos-io/odigos/destinations" "github.com/odigos-io/odigos/frontend/graph/model" @@ -47,3 +49,13 @@ func DestinationTypeConfigToCategoryItem(destConfig destinations.Destination) mo } } + +func GetDestinationTypeConfig(destType common.DestinationType) (*destinations.Destination, error) { + for _, dest := range destinations.Get() { + if dest.Metadata.Type == destType { + return &dest, nil + } + } + + return nil, fmt.Errorf("destination type %s not found", destType) +} From e6dc4be74e2eae21c56115bab9c5ff2a87706c60 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 5 Aug 2024 17:11:57 +0300 Subject: [PATCH 133/374] chore: wip --- frontend/graph/generated.go | 55 ++++--------------- frontend/graph/model/destination.go | 10 ++-- frontend/graph/schema.resolvers.go | 11 ---- frontend/services/destinations.go | 2 +- .../app/setup/choose-destination/page.tsx | 2 +- .../add-destination-modal/index.tsx | 11 +++- .../connect-destination-modal-body/index.tsx | 14 ++++- .../webapp/graphql/queries/destination.ts | 18 ++++++ frontend/webapp/types/destinations.ts | 2 + 9 files changed, 58 insertions(+), 67 deletions(-) diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index bd2077fec..78302506b 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -41,7 +41,6 @@ type Config struct { type ResolverRoot interface { ComputePlatform() ComputePlatformResolver Destination() DestinationResolver - DestinationTypesCategoryItem() DestinationTypesCategoryItemResolver K8sActualNamespace() K8sActualNamespaceResolver Mutation() MutationResolver Query() QueryResolver @@ -180,9 +179,6 @@ type DestinationResolver interface { Conditions(ctx context.Context, obj *model.Destination) ([]*model.Condition, error) } -type DestinationTypesCategoryItemResolver interface { - Type(ctx context.Context, obj *model.DestinationTypesCategoryItem) (string, error) -} type K8sActualNamespaceResolver interface { K8sActualSources(ctx context.Context, obj *model.K8sActualNamespace, instrumentationLabeled *bool) ([]*model.K8sActualSource, error) } @@ -1848,7 +1844,7 @@ func (ec *executionContext) _DestinationTypesCategoryItem_type(ctx context.Conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.DestinationTypesCategoryItem().Type(rctx, obj) + return obj.Type, nil }) if err != nil { ec.Error(ctx, err) @@ -1869,8 +1865,8 @@ func (ec *executionContext) fieldContext_DestinationTypesCategoryItem_type(_ con fc = &graphql.FieldContext{ Object: "DestinationTypesCategoryItem", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, @@ -6268,60 +6264,29 @@ func (ec *executionContext) _DestinationTypesCategoryItem(ctx context.Context, s case "__typename": out.Values[i] = graphql.MarshalString("DestinationTypesCategoryItem") case "type": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._DestinationTypesCategoryItem_type(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue + out.Values[i] = ec._DestinationTypesCategoryItem_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "displayName": out.Values[i] = ec._DestinationTypesCategoryItem_displayName(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + out.Invalids++ } case "imageUrl": out.Values[i] = ec._DestinationTypesCategoryItem_imageUrl(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + out.Invalids++ } case "supportedSignals": out.Values[i] = ec._DestinationTypesCategoryItem_supportedSignals(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + out.Invalids++ } case "testConnectionSupported": out.Values[i] = ec._DestinationTypesCategoryItem_testConnectionSupported(ctx, field, obj) if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) + out.Invalids++ } default: panic("unknown field " + strconv.Quote(field.Name)) diff --git a/frontend/graph/model/destination.go b/frontend/graph/model/destination.go index 8f9af77a9..58a8bea11 100644 --- a/frontend/graph/model/destination.go +++ b/frontend/graph/model/destination.go @@ -10,11 +10,11 @@ type GetDestinationTypesResponse struct { } type DestinationTypesCategoryItem struct { - Type common.DestinationType `json:"type"` - DisplayName string `json:"display_name"` - ImageUrl string `json:"image_url"` - SupportedSignals SupportedSignals `json:"supported_signals"` - TestConnectionSupported bool `json:"test_connection_supported"` + Type string `json:"type"` + DisplayName string `json:"display_name"` + ImageUrl string `json:"image_url"` + SupportedSignals SupportedSignals `json:"supported_signals"` + TestConnectionSupported bool `json:"test_connection_supported"` } type SupportedSignals struct { diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index e8e75addb..de65f4e5f 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -74,11 +74,6 @@ func (r *destinationResolver) Conditions(ctx context.Context, obj *model.Destina panic(fmt.Errorf("not implemented: Conditions - conditions")) } -// Type is the resolver for the type field. -func (r *destinationTypesCategoryItemResolver) Type(ctx context.Context, obj *model.DestinationTypesCategoryItem) (string, error) { - panic(fmt.Errorf("not implemented: Type - type")) -} - // K8sActualSources is the resolver for the k8sActualSources field. func (r *k8sActualNamespaceResolver) K8sActualSources(ctx context.Context, obj *model.K8sActualNamespace, instrumentationLabeled *bool) ([]*model.K8sActualSource, error) { return obj.K8sActualSources, nil @@ -158,11 +153,6 @@ func (r *Resolver) ComputePlatform() ComputePlatformResolver { return &computePl // Destination returns DestinationResolver implementation. func (r *Resolver) Destination() DestinationResolver { return &destinationResolver{r} } -// DestinationTypesCategoryItem returns DestinationTypesCategoryItemResolver implementation. -func (r *Resolver) DestinationTypesCategoryItem() DestinationTypesCategoryItemResolver { - return &destinationTypesCategoryItemResolver{r} -} - // K8sActualNamespace returns K8sActualNamespaceResolver implementation. func (r *Resolver) K8sActualNamespace() K8sActualNamespaceResolver { return &k8sActualNamespaceResolver{r} @@ -176,7 +166,6 @@ func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } type computePlatformResolver struct{ *Resolver } type destinationResolver struct{ *Resolver } -type destinationTypesCategoryItemResolver struct{ *Resolver } type k8sActualNamespaceResolver struct{ *Resolver } type mutationResolver struct{ *Resolver } type queryResolver struct{ *Resolver } diff --git a/frontend/services/destinations.go b/frontend/services/destinations.go index 39e7835e8..4b0564e42 100644 --- a/frontend/services/destinations.go +++ b/frontend/services/destinations.go @@ -31,7 +31,7 @@ func GetDestinationTypes() model.GetDestinationTypesResponse { func DestinationTypeConfigToCategoryItem(destConfig destinations.Destination) model.DestinationTypesCategoryItem { return model.DestinationTypesCategoryItem{ - Type: common.DestinationType(destConfig.Metadata.Type), + Type: string(destConfig.Metadata.Type), DisplayName: destConfig.Metadata.DisplayName, ImageUrl: GetImageURL(destConfig.Spec.Image), TestConnectionSupported: destConfig.Spec.TestConnectionSupported, diff --git a/frontend/webapp/app/setup/choose-destination/page.tsx b/frontend/webapp/app/setup/choose-destination/page.tsx index 9d2189d08..92ffac25a 100644 --- a/frontend/webapp/app/setup/choose-destination/page.tsx +++ b/frontend/webapp/app/setup/choose-destination/page.tsx @@ -1,6 +1,6 @@ 'use client'; -import { ChooseDestinationContainer } from '@/containers/main'; import React from 'react'; +import { ChooseDestinationContainer } from '@/containers/main'; export default function ChooseDestinationPage() { return ( diff --git a/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx index eab8f59d3..7378c2020 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx @@ -11,6 +11,10 @@ interface AddDestinationModalProps { handleCloseModal: () => void; } +interface DestinationCategory { + name: string; + items: DestinationTypeItem[]; +} function ModalActionComponent({ onNext, onBack, @@ -60,12 +64,14 @@ export function AddDestinationModal({ function buildDestinationTypeList() { const destinationTypes = data?.destinationTypes?.categories || []; const destinationTypeList: DestinationTypeItem[] = destinationTypes.reduce( - (acc: DestinationTypeItem[], category: any) => { - const items = category.items.map((item: any) => ({ + (acc: DestinationTypeItem[], category: DestinationCategory) => { + const items = category.items.map((item: DestinationTypeItem) => ({ category: category.name, displayName: item.displayName, imageUrl: item.imageUrl, supportedSignals: item.supportedSignals, + testConnectionSupported: item.testConnectionSupported, + type: item.type, })); return [...acc, ...items]; }, @@ -73,6 +79,7 @@ export function AddDestinationModal({ ); setDestinationTypeList(destinationTypeList); } + function handleNextStep(item: DestinationTypeItem) { setSelectedItem(item); } diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index d86051d7d..92b6e4386 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -1,8 +1,10 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import { DestinationTypeItem, StepProps } from '@/types'; import { SideMenu } from '@/components'; import { Divider, SectionTitle } from '@/reuseable-components'; import { Body, Container, SideMenuWrapper } from '../styled'; +import { GET_DESTINATION_TYPE_DETAILS } from '@/graphql'; +import { useQuery } from '@apollo/client'; const SIDE_MENU_DATA: StepProps[] = [ { title: 'DESTINATIONS', @@ -23,7 +25,15 @@ interface ConnectDestinationModalBodyProps { export function ConnectDestinationModalBody({ destination, }: ConnectDestinationModalBodyProps) { - console.log({ destination }); + const { data } = useQuery(GET_DESTINATION_TYPE_DETAILS, { + variables: { type: destination?.type }, + skip: !destination, + }); + + useEffect(() => { + data && console.log({ data }); + }, [data]); + return ( diff --git a/frontend/webapp/graphql/queries/destination.ts b/frontend/webapp/graphql/queries/destination.ts index 34124683f..9fafe8e16 100644 --- a/frontend/webapp/graphql/queries/destination.ts +++ b/frontend/webapp/graphql/queries/destination.ts @@ -6,6 +6,8 @@ export const GET_DESTINATION_TYPE = gql` categories { name items { + type + testConnectionSupported displayName imageUrl supportedSignals { @@ -24,3 +26,19 @@ export const GET_DESTINATION_TYPE = gql` } } `; + +export const GET_DESTINATION_TYPE_DETAILS = gql` + query GetDestinationTypeDetails($type: String!) { + destinationTypeDetails(type: $type) { + fields { + name + displayName + componentType + componentProperties + videoUrl + thumbnailURL + initialValue + } + } + } +`; diff --git a/frontend/webapp/types/destinations.ts b/frontend/webapp/types/destinations.ts index 56c734bbe..e0b06b9e1 100644 --- a/frontend/webapp/types/destinations.ts +++ b/frontend/webapp/types/destinations.ts @@ -9,6 +9,8 @@ export interface DestinationTypeItem { displayName: string; imageUrl: string; category: 'managed' | 'self-hosted'; + type: string; + testConnectionSupported: boolean; supportedSignals: { logs: { supported: boolean; From d3415f18916c9bb9b5bc2718262163b88c98359b Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Tue, 6 Aug 2024 13:58:37 +0300 Subject: [PATCH 134/374] chore: wip --- .../connect-destination-modal-body/index.tsx | 67 +++++++++++++++-- .../checkbox-list/index.tsx | 73 +++++++++++++++++++ .../reuseable-components/checkbox/index.tsx | 12 ++- frontend/webapp/reuseable-components/index.ts | 1 + .../reuseable-components/input/index.tsx | 13 ++-- .../section-title/index.tsx | 11 ++- frontend/webapp/styles/theme.ts | 1 + frontend/webapp/types/destinations.ts | 17 +++++ 8 files changed, 174 insertions(+), 21 deletions(-) create mode 100644 frontend/webapp/reuseable-components/checkbox-list/index.tsx diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index 92b6e4386..61defc7b1 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -1,10 +1,20 @@ -import React, { useEffect } from 'react'; -import { DestinationTypeItem, StepProps } from '@/types'; +import React, { useEffect, useMemo, useState } from 'react'; +import { + DestinationDetailsResponse, + DestinationTypeItem, + StepProps, +} from '@/types'; import { SideMenu } from '@/components'; -import { Divider, SectionTitle } from '@/reuseable-components'; +import { + CheckboxList, + Divider, + Input, + SectionTitle, +} from '@/reuseable-components'; import { Body, Container, SideMenuWrapper } from '../styled'; import { GET_DESTINATION_TYPE_DETAILS } from '@/graphql'; import { useQuery } from '@apollo/client'; +import styled from 'styled-components'; const SIDE_MENU_DATA: StepProps[] = [ { title: 'DESTINATIONS', @@ -18,6 +28,12 @@ const SIDE_MENU_DATA: StepProps[] = [ }, ]; +const FormContainer = styled.div` + display: flex; + flex-direction: column; + gap: 24px; +`; + interface ConnectDestinationModalBodyProps { destination: DestinationTypeItem | undefined; } @@ -25,15 +41,40 @@ interface ConnectDestinationModalBodyProps { export function ConnectDestinationModalBody({ destination, }: ConnectDestinationModalBodyProps) { - const { data } = useQuery(GET_DESTINATION_TYPE_DETAILS, { - variables: { type: destination?.type }, - skip: !destination, - }); + const { data } = useQuery( + GET_DESTINATION_TYPE_DETAILS, + { + variables: { type: destination?.type }, + skip: !destination, + } + ); + + const monitors = useMemo(() => { + if (!destination) return []; + + const { logs, metrics, traces } = destination.supportedSignals; + return [ + logs.supported && { + id: 'logs', + title: 'Logs', + }, + metrics.supported && { + id: 'metrics', + title: 'Metrics', + }, + traces.supported && { + id: 'traces', + title: 'Traces', + }, + ].filter(Boolean); + }, [destination]); useEffect(() => { - data && console.log({ data }); + data && console.log({ destination, data }); }, [data]); + if (!destination) return null; + return ( @@ -48,6 +89,16 @@ export function ConnectDestinationModalBody({ onButtonClick={() => {}} /> + + + + ); diff --git a/frontend/webapp/reuseable-components/checkbox-list/index.tsx b/frontend/webapp/reuseable-components/checkbox-list/index.tsx new file mode 100644 index 000000000..6a4c92d12 --- /dev/null +++ b/frontend/webapp/reuseable-components/checkbox-list/index.tsx @@ -0,0 +1,73 @@ +import React, { useState, useEffect } from 'react'; +import styled from 'styled-components'; +import { Checkbox } from '../checkbox'; +import { Text } from '../text'; + +interface Monitor { + id: string; + title: string; + tooltip?: string; +} + +interface CheckboxListProps { + monitors: Monitor[]; + title?: string; +} + +const ListContainer = styled.div` + display: flex; + gap: 32px; +`; + +const TextWrapper = styled.div` + margin-bottom: 14px; +`; + +const CheckboxList: React.FC = ({ monitors, title }) => { + const [checkedState, setCheckedState] = useState([]); + + useEffect(() => { + // Initialize the checked state with all true if no initial values provided + setCheckedState(Array(monitors.length).fill(true)); + }, [monitors.length]); + + const handleCheckboxChange = (index: number, value: boolean) => { + const newCheckedState = [...checkedState]; + newCheckedState[index] = value; + + // Ensure at least one checkbox remains checked + if (newCheckedState.filter((checked) => checked).length === 0) { + return; + } + + setCheckedState(newCheckedState); + }; + + return ( +
+ {title && ( + + + {title} + + + )} + + {monitors.map((monitor, index) => ( + handleCheckboxChange(index, value)} + disabled={ + checkedState.filter((checked) => checked).length === 1 && + checkedState[index] + } + /> + ))} + +
+ ); +}; + +export { CheckboxList }; diff --git a/frontend/webapp/reuseable-components/checkbox/index.tsx b/frontend/webapp/reuseable-components/checkbox/index.tsx index 956fbb6ec..92a3c1470 100644 --- a/frontend/webapp/reuseable-components/checkbox/index.tsx +++ b/frontend/webapp/reuseable-components/checkbox/index.tsx @@ -24,20 +24,18 @@ const CheckboxWrapper = styled.div<{ isChecked: boolean; disabled?: boolean }>` width: 18px; height: 18px; border-radius: 6px; - border: 1px dashed rgba(249, 249, 249, 0.4); + border: ${({ isChecked }) => + isChecked + ? '1px dashed transparent' + : '1px dashed rgba(249, 249, 249, 0.4)'}; display: flex; align-items: center; justify-content: center; background-color: ${({ isChecked, theme }) => - isChecked ? theme.colors.primary : 'transparent'}; + isChecked ? theme.colors.majestic_blue : 'transparent'}; pointer-events: ${({ disabled }) => (disabled ? 'none' : 'auto')}; `; -const Title = styled.span` - font-size: 16px; - color: #fff; -`; - const Checkbox: React.FC = ({ title, tooltip, diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts index 0391f7f11..1839e88d6 100644 --- a/frontend/webapp/reuseable-components/index.ts +++ b/frontend/webapp/reuseable-components/index.ts @@ -11,3 +11,4 @@ export * from './checkbox'; export * from './modal'; export * from './navigation-buttons'; export * from './tag'; +export * from './checkbox-list'; diff --git a/frontend/webapp/reuseable-components/input/index.tsx b/frontend/webapp/reuseable-components/input/index.tsx index 2f5e3607c..7a908ea96 100644 --- a/frontend/webapp/reuseable-components/input/index.tsx +++ b/frontend/webapp/reuseable-components/input/index.tsx @@ -62,14 +62,16 @@ const InputWrapper = styled.div<{ } `; -const StyledInput = styled.input` +const StyledInput = styled.input<{ hasIcon?: string }>` flex: 1; border: none; outline: none; background: none; color: ${({ theme }) => theme.colors.text}; font-size: 14px; - + padding-left: ${({ hasIcon }) => (hasIcon ? '0' : '16px')}; + font-family: ${({ theme }) => theme.font_family.primary}; + font-weight: 300; &::placeholder { color: ${({ theme }) => theme.colors.text}; font-family: ${({ theme }) => theme.font_family.primary}; @@ -124,8 +126,9 @@ const ErrorMessage = styled(Text)` `; const Title = styled(Text)` - font-size: 16px; - font-weight: bold; + font-size: 14px; + opacity: 0.8; + line-height: 22px; margin-bottom: 4px; `; @@ -173,7 +176,7 @@ const Input: React.FC = ({ )} - + {buttonLabel && onButtonClick && (
diff --git a/frontend/webapp/containers/main/destinations/add-destination/dynamic-form-fields/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/dynamic-form-fields/index.tsx new file mode 100644 index 000000000..6b955f2de --- /dev/null +++ b/frontend/webapp/containers/main/destinations/add-destination/dynamic-form-fields/index.tsx @@ -0,0 +1,43 @@ +import React from 'react'; + +import { INPUT_TYPES } from '@/utils/constants/string'; +import { Dropdown, Input } from '@/reuseable-components'; + +export function DynamicConnectDestinationFormFields({ + fields, + onChange, +}: { + fields: any[]; + onChange: (name: string, value: any) => void; +}) { + return fields?.map((field: any) => { + switch (field.componentType) { + case INPUT_TYPES.INPUT: + return ( + onChange(field.name, value)} + /> + ); + + case INPUT_TYPES.DROPDOWN: + return ( + onChange(field.name, option.value)} + /> + ); + case INPUT_TYPES.MULTI_INPUT: + return
; + + case INPUT_TYPES.KEY_VALUE_PAIR: + return
; + case INPUT_TYPES.TEXTAREA: + return
; + default: + return null; + } + }); +} diff --git a/frontend/webapp/containers/main/destinations/add-destination/styled.ts b/frontend/webapp/containers/main/destinations/add-destination/styled.ts index 9ad79d7d5..6588c8936 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/styled.ts +++ b/frontend/webapp/containers/main/destinations/add-destination/styled.ts @@ -3,6 +3,8 @@ import styled from 'styled-components'; export const Body = styled.div` padding: 32px 32px 0; border-left: 1px solid rgba(249, 249, 249, 0.08); + min-height: 600px; + width: 692px; `; export const SideMenuWrapper = styled.div` diff --git a/frontend/webapp/graphql/queries/destination.ts b/frontend/webapp/graphql/queries/destination.ts index 9fafe8e16..993f302c4 100644 --- a/frontend/webapp/graphql/queries/destination.ts +++ b/frontend/webapp/graphql/queries/destination.ts @@ -35,8 +35,6 @@ export const GET_DESTINATION_TYPE_DETAILS = gql` displayName componentType componentProperties - videoUrl - thumbnailURL initialValue } } diff --git a/frontend/webapp/hooks/destinations/index.ts b/frontend/webapp/hooks/destinations/index.ts index fda969335..fdf8dc796 100644 --- a/frontend/webapp/hooks/destinations/index.ts +++ b/frontend/webapp/hooks/destinations/index.ts @@ -1,2 +1,3 @@ export * from './useDestinations'; export * from './useCheckConnection'; +export * from './useConnectDestinationForm'; diff --git a/frontend/webapp/hooks/destinations/useConnectDestinationForm.ts b/frontend/webapp/hooks/destinations/useConnectDestinationForm.ts new file mode 100644 index 000000000..aa1c71fca --- /dev/null +++ b/frontend/webapp/hooks/destinations/useConnectDestinationForm.ts @@ -0,0 +1,65 @@ +import { safeJsonParse } from '@/utils'; +import { DestinationDetailsField, DynamicField } from '@/types'; + +export function useConnectDestinationForm() { + function buildFormDynamicFields( + fields: DestinationDetailsField[] + ): DynamicField[] { + return fields + .map((field) => { + const { name, componentType, displayName, componentProperties } = field; + + let componentPropertiesJson; + switch (componentType) { + case 'dropdown': + componentPropertiesJson = safeJsonParse<{ [key: string]: string }>( + componentProperties, + {} + ); + + const options = Object.entries(componentPropertiesJson.values).map( + ([key, value]) => ({ + id: key, + value, + }) + ); + + return { + name, + componentType, + title: displayName, + onSelect: () => {}, + options, + selectedOption: options[0], + ...componentPropertiesJson, + }; + + case 'input': + componentPropertiesJson = safeJsonParse( + componentProperties, + [] + ); + return { + name, + componentType, + title: displayName, + ...componentPropertiesJson, + }; + + // case 'multi_input': + // case 'textarea': + // return { + // name, + // componentType, + // title: displayName, + // ...componentPropertiesJson, + // }; + default: + return undefined; + } + }) + .filter((field): field is DynamicField => field !== undefined); + } + + return { buildFormDynamicFields }; +} diff --git a/frontend/webapp/reuseable-components/checkbox-list/index.tsx b/frontend/webapp/reuseable-components/checkbox-list/index.tsx index 6a4c92d12..3888efa9b 100644 --- a/frontend/webapp/reuseable-components/checkbox-list/index.tsx +++ b/frontend/webapp/reuseable-components/checkbox-list/index.tsx @@ -12,6 +12,8 @@ interface Monitor { interface CheckboxListProps { monitors: Monitor[]; title?: string; + checkedState?: boolean[]; + setCheckedState: (checkedState: boolean[]) => void; } const ListContainer = styled.div` @@ -23,9 +25,12 @@ const TextWrapper = styled.div` margin-bottom: 14px; `; -const CheckboxList: React.FC = ({ monitors, title }) => { - const [checkedState, setCheckedState] = useState([]); - +const CheckboxList: React.FC = ({ + monitors, + title, + checkedState = [], + setCheckedState, +}) => { useEffect(() => { // Initialize the checked state with all true if no initial values provided setCheckedState(Array(monitors.length).fill(true)); diff --git a/frontend/webapp/types/destinations.ts b/frontend/webapp/types/destinations.ts index f67a866b0..91cc52649 100644 --- a/frontend/webapp/types/destinations.ts +++ b/frontend/webapp/types/destinations.ts @@ -35,6 +35,13 @@ export interface DestinationDetailsField { __typename: string; } +export type DynamicField = { + name: string; + componentType: 'input' | 'dropdown' | 'multi_input' | 'textarea'; + title: string; + [key: string]: any; +}; + export interface DestinationDetailsResponse { destinationTypeDetails: { fields: DestinationDetailsField[]; From 6b673558ea86d6ef5d59742537f668cc4975b468 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 7 Aug 2024 13:53:17 +0300 Subject: [PATCH 136/374] chore: create destination mutation --- frontend/graph/generated.go | 254 +++++++++++++++--- frontend/graph/model/models_gen.go | 18 ++ frontend/graph/schema.graphqls | 23 +- frontend/graph/schema.resolvers.go | 73 ++++- frontend/services/destinations.go | 208 ++++++++++++++ .../destinations-list/index.tsx | 4 +- 6 files changed, 530 insertions(+), 50 deletions(-) diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index 78302506b..c4e824cbc 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -141,7 +141,7 @@ type ComplexityRoot struct { } Mutation struct { - CreateK8sDesiredNamespace func(childComplexity int, cpID string, namespace model.K8sDesiredNamespaceInput) int + CreateNewDestination func(childComplexity int, destination model.DestinationInput) int } ObservabilitySignalSupport struct { @@ -183,7 +183,7 @@ type K8sActualNamespaceResolver interface { K8sActualSources(ctx context.Context, obj *model.K8sActualNamespace, instrumentationLabeled *bool) ([]*model.K8sActualSource, error) } type MutationResolver interface { - CreateK8sDesiredNamespace(ctx context.Context, cpID string, namespace model.K8sDesiredNamespaceInput) (*model.K8sActualNamespace, error) + CreateNewDestination(ctx context.Context, destination model.DestinationInput) (*model.Destination, error) } type QueryResolver interface { ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) @@ -583,17 +583,17 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.K8sActualSource.ServiceName(childComplexity), true - case "Mutation.createK8sDesiredNamespace": - if e.complexity.Mutation.CreateK8sDesiredNamespace == nil { + case "Mutation.createNewDestination": + if e.complexity.Mutation.CreateNewDestination == nil { break } - args, err := ec.field_Mutation_createK8sDesiredNamespace_args(context.TODO(), rawArgs) + args, err := ec.field_Mutation_createNewDestination_args(context.TODO(), rawArgs) if err != nil { return 0, false } - return e.complexity.Mutation.CreateK8sDesiredNamespace(childComplexity, args["cpId"].(string), args["namespace"].(model.K8sDesiredNamespaceInput)), true + return e.complexity.Mutation.CreateNewDestination(childComplexity, args["destination"].(model.DestinationInput)), true case "ObservabilitySignalSupport.supported": if e.complexity.ObservabilitySignalSupport.Supported == nil { @@ -678,6 +678,9 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( + ec.unmarshalInputDestinationInput, + ec.unmarshalInputExportedSignalsInput, + ec.unmarshalInputFieldInput, ec.unmarshalInputK8sDesiredNamespaceInput, ec.unmarshalInputK8sDesiredSourceInput, ec.unmarshalInputK8sNamespaceId, @@ -861,27 +864,18 @@ func (ec *executionContext) field_K8sActualNamespace_k8sActualSources_args(ctx c return args, nil } -func (ec *executionContext) field_Mutation_createK8sDesiredNamespace_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_createNewDestination_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["cpId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cpId")) - arg0, err = ec.unmarshalNID2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["cpId"] = arg0 - var arg1 model.K8sDesiredNamespaceInput - if tmp, ok := rawArgs["namespace"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) - arg1, err = ec.unmarshalNK8sDesiredNamespaceInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sDesiredNamespaceInput(ctx, tmp) + var arg0 model.DestinationInput + if tmp, ok := rawArgs["destination"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destination")) + arg0, err = ec.unmarshalNDestinationInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationInput(ctx, tmp) if err != nil { return nil, err } } - args["namespace"] = arg1 + args["destination"] = arg0 return args, nil } @@ -3350,8 +3344,8 @@ func (ec *executionContext) fieldContext_K8sActualSource_instrumentedApplication return fc, nil } -func (ec *executionContext) _Mutation_createK8sDesiredNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_createK8sDesiredNamespace(ctx, field) +func (ec *executionContext) _Mutation_createNewDestination(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createNewDestination(ctx, field) if err != nil { return graphql.Null } @@ -3364,21 +3358,24 @@ func (ec *executionContext) _Mutation_createK8sDesiredNamespace(ctx context.Cont }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CreateK8sDesiredNamespace(rctx, fc.Args["cpId"].(string), fc.Args["namespace"].(model.K8sDesiredNamespaceInput)) + return ec.resolvers.Mutation().CreateNewDestination(rctx, fc.Args["destination"].(model.DestinationInput)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*model.K8sActualNamespace) + res := resTmp.(*model.Destination) fc.Result = res - return ec.marshalOK8sActualNamespace2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx, field.Selections, res) + return ec.marshalNDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestination(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_createK8sDesiredNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_createNewDestination(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", Field: field, @@ -3386,14 +3383,22 @@ func (ec *executionContext) fieldContext_Mutation_createK8sDesiredNamespace(ctx IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { + case "id": + return ec.fieldContext_Destination_id(ctx, field) case "name": - return ec.fieldContext_K8sActualNamespace_name(ctx, field) - case "instrumentationLabelEnabled": - return ec.fieldContext_K8sActualNamespace_instrumentationLabelEnabled(ctx, field) - case "k8sActualSources": - return ec.fieldContext_K8sActualNamespace_k8sActualSources(ctx, field) + return ec.fieldContext_Destination_name(ctx, field) + case "type": + return ec.fieldContext_Destination_type(ctx, field) + case "exportedSignals": + return ec.fieldContext_Destination_exportedSignals(ctx, field) + case "fields": + return ec.fieldContext_Destination_fields(ctx, field) + case "destinationType": + return ec.fieldContext_Destination_destinationType(ctx, field) + case "conditions": + return ec.fieldContext_Destination_conditions(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type K8sActualNamespace", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Destination", field.Name) }, } defer func() { @@ -3403,7 +3408,7 @@ func (ec *executionContext) fieldContext_Mutation_createK8sDesiredNamespace(ctx } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_createK8sDesiredNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_createNewDestination_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } @@ -5789,6 +5794,129 @@ func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context // region **************************** input.gotpl ***************************** +func (ec *executionContext) unmarshalInputDestinationInput(ctx context.Context, obj interface{}) (model.DestinationInput, error) { + var it model.DestinationInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "type", "exportedSignals", "fields"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "type": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Type = data + case "exportedSignals": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exportedSignals")) + data, err := ec.unmarshalNExportedSignalsInput2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐExportedSignalsInput(ctx, v) + if err != nil { + return it, err + } + it.ExportedSignals = data + case "fields": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fields")) + data, err := ec.unmarshalNFieldInput2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐFieldInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.Fields = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputExportedSignalsInput(ctx context.Context, obj interface{}) (model.ExportedSignalsInput, error) { + var it model.ExportedSignalsInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"traces", "metrics", "logs"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "traces": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("traces")) + data, err := ec.unmarshalNBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.Traces = data + case "metrics": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("metrics")) + data, err := ec.unmarshalNBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.Metrics = data + case "logs": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("logs")) + data, err := ec.unmarshalNBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.Logs = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputFieldInput(ctx context.Context, obj interface{}) (model.FieldInput, error) { + var it model.FieldInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"key", "value"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "key": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("key")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Key = data + case "value": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Value = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputK8sDesiredNamespaceInput(ctx context.Context, obj interface{}) (model.K8sDesiredNamespaceInput, error) { var it model.K8sDesiredNamespaceInput asMap := map[string]interface{}{} @@ -6780,10 +6908,13 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("Mutation") - case "createK8sDesiredNamespace": + case "createNewDestination": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_createK8sDesiredNamespace(ctx, field) + return ec._Mutation_createNewDestination(ctx, field) }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -7436,6 +7567,25 @@ func (ec *executionContext) marshalNConditionStatus2githubᚗcomᚋodigosᚑio return v } +func (ec *executionContext) marshalNDestination2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestination(ctx context.Context, sel ast.SelectionSet, v model.Destination) graphql.Marshaler { + return ec._Destination(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestination(ctx context.Context, sel ast.SelectionSet, v *model.Destination) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Destination(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNDestinationInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationInput(ctx context.Context, v interface{}) (model.DestinationInput, error) { + res, err := ec.unmarshalInputDestinationInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalNDestinationTypesCategoryItem2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypesCategoryItem(ctx context.Context, sel ast.SelectionSet, v model.DestinationTypesCategoryItem) graphql.Marshaler { return ec._DestinationTypesCategoryItem(ctx, sel, &v) } @@ -7536,6 +7686,11 @@ func (ec *executionContext) marshalNExportedSignals2githubᚗcomᚋodigosᚑio return ec._ExportedSignals(ctx, sel, &v) } +func (ec *executionContext) unmarshalNExportedSignalsInput2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐExportedSignalsInput(ctx context.Context, v interface{}) (*model.ExportedSignalsInput, error) { + res, err := ec.unmarshalInputExportedSignalsInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalNField2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Field) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup @@ -7590,6 +7745,28 @@ func (ec *executionContext) marshalNField2ᚖgithubᚗcomᚋodigosᚑioᚋodigos return ec._Field(ctx, sel, v) } +func (ec *executionContext) unmarshalNFieldInput2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐFieldInputᚄ(ctx context.Context, v interface{}) ([]*model.FieldInput, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*model.FieldInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNFieldInput2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐFieldInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalNFieldInput2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐFieldInput(ctx context.Context, v interface{}) (*model.FieldInput, error) { + res, err := ec.unmarshalInputFieldInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { res, err := graphql.UnmarshalID(v) return res, graphql.ErrorOnPath(ctx, err) @@ -7691,11 +7868,6 @@ func (ec *executionContext) marshalNK8sActualSource2ᚕᚖgithubᚗcomᚋodigos return ret } -func (ec *executionContext) unmarshalNK8sDesiredNamespaceInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sDesiredNamespaceInput(ctx context.Context, v interface{}) (model.K8sDesiredNamespaceInput, error) { - res, err := ec.unmarshalInputK8sDesiredNamespaceInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - func (ec *executionContext) unmarshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx context.Context, v interface{}) (model.K8sResourceKind, error) { var res model.K8sResourceKind err := res.UnmarshalGQL(v) diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index e74ae4c57..58642ccda 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -25,6 +25,19 @@ type Condition struct { Message *string `json:"message,omitempty"` } +type DestinationInput struct { + Name string `json:"name"` + Type string `json:"type"` + ExportedSignals *ExportedSignalsInput `json:"exportedSignals"` + Fields []*FieldInput `json:"fields"` +} + +type ExportedSignalsInput struct { + Traces bool `json:"traces"` + Metrics bool `json:"metrics"` + Logs bool `json:"logs"` +} + type Field struct { Name string `json:"name"` DisplayName string `json:"displayName"` @@ -35,6 +48,11 @@ type Field struct { InitialValue *string `json:"initialValue,omitempty"` } +type FieldInput struct { + Key string `json:"key"` + Value string `json:"value"` +} + type GetConfigResponse struct { Installation InstallationStatus `json:"installation"` } diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index 591e81151..f7ef33816 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -172,6 +172,24 @@ type GetDestinationDetailsResponse { fields: [Field!]! } +input DestinationInput { + name: String! + type: String! + exportedSignals: ExportedSignalsInput! + fields: [FieldInput!]! +} + +input FieldInput { + key: String! + value: String! +} + +input ExportedSignalsInput { + traces: Boolean! + metrics: Boolean! + logs: Boolean! +} + type Query { computePlatform: ComputePlatform config: GetConfigResponse @@ -180,8 +198,5 @@ type Query { } type Mutation { - createK8sDesiredNamespace( - cpId: ID! - namespace: K8sDesiredNamespaceInput! - ): K8sActualNamespace + createNewDestination(destination: DestinationInput!): Destination! } diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index de65f4e5f..36f38a260 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -9,7 +9,9 @@ import ( "encoding/json" "fmt" + "github.com/odigos-io/odigos/api/odigos/v1alpha1" "github.com/odigos-io/odigos/common" + "github.com/odigos-io/odigos/common/consts" "github.com/odigos-io/odigos/frontend/endpoints" "github.com/odigos-io/odigos/frontend/graph/model" "github.com/odigos-io/odigos/frontend/kube" @@ -79,9 +81,74 @@ func (r *k8sActualNamespaceResolver) K8sActualSources(ctx context.Context, obj * return obj.K8sActualSources, nil } -// CreateK8sDesiredNamespace is the resolver for the createK8sDesiredNamespace field. -func (r *mutationResolver) CreateK8sDesiredNamespace(ctx context.Context, cpID string, namespace model.K8sDesiredNamespaceInput) (*model.K8sActualNamespace, error) { - panic(fmt.Errorf("not implemented: CreateK8sDesiredNamespace - createK8sDesiredNamespace")) +func (r *mutationResolver) CreateNewDestination(ctx context.Context, destination model.DestinationInput) (*model.Destination, error) { + odigosns := consts.DefaultOdigosNamespace + + destType := common.DestinationType(destination.Type) + destName := destination.Name + + destTypeConfig, err := services.GetDestinationTypeConfig(destType) + if err != nil { + return nil, fmt.Errorf("destination type %s not found", destType) + } + + // Convert fields to map[string]string + fieldsMap := make(map[string]string) + for _, field := range destination.Fields { + fieldsMap[field.Key] = field.Value + } + + errors := services.VerifyDestinationDataScheme(destType, destTypeConfig, fieldsMap) + if len(errors) > 0 { + return nil, fmt.Errorf("invalid destination data scheme: %v", errors) + } + + dataField, secretFields := services.TransformFieldsToDataAndSecrets(destTypeConfig, fieldsMap) + generateNamePrefix := "odigos.io.dest." + string(destType) + "-" + + k8sDestination := v1alpha1.Destination{ + ObjectMeta: metav1.ObjectMeta{ + GenerateName: generateNamePrefix, + }, + Spec: v1alpha1.DestinationSpec{ + Type: destType, + DestinationName: destName, + Data: dataField, + Signals: services.ExportedSignalsObjectToSlice(destination.ExportedSignals), + }, + } + + createSecret := len(secretFields) > 0 + if createSecret { + secretRef, err := services.CreateDestinationSecret(ctx, destType, secretFields, odigosns) + if err != nil { + return nil, err + } + k8sDestination.Spec.SecretRef = secretRef + } + + dest, err := kube.DefaultClient.OdigosClient.Destinations(odigosns).Create(ctx, &k8sDestination, metav1.CreateOptions{}) + if err != nil { + if createSecret { + kube.DefaultClient.CoreV1().Secrets(odigosns).Delete(ctx, destName, metav1.DeleteOptions{}) + } + return nil, err + } + + if dest.Spec.SecretRef != nil { + err = services.AddDestinationOwnerReferenceToSecret(ctx, odigosns, dest) + if err != nil { + return nil, err + } + } + + secretFieldsMap, err := services.GetDestinationSecretFields(ctx, odigosns, dest) + if err != nil { + return nil, err + } + + endpointDest := services.K8sDestinationToEndpointFormat(*dest, secretFieldsMap) + return &endpointDest, nil } // ComputePlatform is the resolver for the computePlatform field. diff --git a/frontend/services/destinations.go b/frontend/services/destinations.go index 4b0564e42..30c1bc77a 100644 --- a/frontend/services/destinations.go +++ b/frontend/services/destinations.go @@ -1,11 +1,18 @@ package services import ( + "context" + "encoding/json" "fmt" + "github.com/odigos-io/odigos/api/odigos/v1alpha1" "github.com/odigos-io/odigos/common" "github.com/odigos-io/odigos/destinations" "github.com/odigos-io/odigos/frontend/graph/model" + "github.com/odigos-io/odigos/frontend/kube" + k8s "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" ) func GetDestinationTypes() model.GetDestinationTypesResponse { @@ -59,3 +66,204 @@ func GetDestinationTypeConfig(destType common.DestinationType) (*destinations.De return nil, fmt.Errorf("destination type %s not found", destType) } + +func VerifyDestinationDataScheme(destType common.DestinationType, destTypeConfig *destinations.Destination, data map[string]string) []error { + + errors := []error{} + + // verify all fields in config are present in data (assuming here all fields are required) + for _, field := range destTypeConfig.Spec.Fields { + required, ok := field.ComponentProps["required"].(bool) + if !ok || !required { + continue + } + fieldValue, found := data[field.Name] + if !found || fieldValue == "" { + errors = append(errors, fmt.Errorf("field %s is required", field.Name)) + } + } + + // verify data fields are found in config + for dataField := range data { + found := false + // iterating all fields in config every time, assuming it's a small list + for _, field := range destTypeConfig.Spec.Fields { + if dataField == field.Name { + found = true + break + } + } + if !found { + errors = append(errors, fmt.Errorf("field %s is not found in config for destination type '%s'", dataField, destType)) + } + } + + return errors +} + +func TransformFieldsToDataAndSecrets(destTypeConfig *destinations.Destination, fields map[string]string) (map[string]string, map[string]string) { + + dataFields := map[string]string{} + secretFields := map[string]string{} + + for fieldName, fieldValue := range fields { + + // it is possible that some fields are not required and are empty. + // we should treat them as empty + if fieldValue == "" { + continue + } + + // for each field in the data, find it's config + // assuming the list is small so it's ok to iterate it + for _, fieldConfig := range destTypeConfig.Spec.Fields { + if fieldName == fieldConfig.Name { + if fieldConfig.Secret { + secretFields[fieldName] = fieldValue + } else { + dataFields[fieldName] = fieldValue + } + } + } + } + + return dataFields, secretFields +} + +func GetDestinationSecretFields(c context.Context, odigosns string, dest *v1alpha1.Destination) (map[string]string, error) { + + secretFields := map[string]string{} + secretRef := dest.Spec.SecretRef + + if secretRef == nil { + return secretFields, nil + } + + secret, err := kube.DefaultClient.CoreV1().Secrets(odigosns).Get(c, secretRef.Name, metav1.GetOptions{}) + if err != nil { + return nil, err + } + + for k, v := range secret.Data { + secretFields[k] = string(v) + } + + return secretFields, nil +} + +func K8sDestinationToEndpointFormat(k8sDest v1alpha1.Destination, secretFields map[string]string) model.Destination { + destType := k8sDest.Spec.Type + destName := k8sDest.Spec.DestinationName + mergedFields := mergeDataAndSecrets(k8sDest.Spec.Data, secretFields) + destTypeConfig := DestinationTypeConfigToCategoryItem(destinations.GetDestinationByType(string(destType))) + + var conditions []metav1.Condition + for _, condition := range k8sDest.Status.Conditions { + conditions = append(conditions, metav1.Condition{ + Type: condition.Type, + Status: condition.Status, + Message: condition.Message, + LastTransitionTime: condition.LastTransitionTime, + }) + } + + return model.Destination{ + Id: k8sDest.Name, + Name: destName, + Type: destType, + ExportedSignals: model.ExportedSignals{ + Traces: isSignalExported(k8sDest, common.TracesObservabilitySignal), + Metrics: isSignalExported(k8sDest, common.MetricsObservabilitySignal), + Logs: isSignalExported(k8sDest, common.LogsObservabilitySignal), + }, + Fields: mergedFields, + DestinationType: destTypeConfig, + Conditions: conditions, + } +} + +func isSignalExported(dest v1alpha1.Destination, signal common.ObservabilitySignal) bool { + for _, s := range dest.Spec.Signals { + if s == signal { + return true + } + } + + return false +} + +func mergeDataAndSecrets(data map[string]string, secrets map[string]string) map[string]string { + merged := map[string]string{} + + for k, v := range data { + merged[k] = v + } + + for k, v := range secrets { + merged[k] = v + } + + return merged +} +func ExportedSignalsObjectToSlice(signals *model.ExportedSignalsInput) []common.ObservabilitySignal { + var resp []common.ObservabilitySignal + if signals.Traces { + resp = append(resp, common.TracesObservabilitySignal) + } + if signals.Metrics { + resp = append(resp, common.MetricsObservabilitySignal) + } + if signals.Logs { + resp = append(resp, common.LogsObservabilitySignal) + } + + return resp +} + +func CreateDestinationSecret(ctx context.Context, destType common.DestinationType, secretFields map[string]string, odigosns string) (*k8s.LocalObjectReference, error) { + generateNamePrefix := "odigos.io.dest." + string(destType) + "-" + secret := k8s.Secret{ + ObjectMeta: metav1.ObjectMeta{ + GenerateName: generateNamePrefix, + }, + StringData: secretFields, + } + newSecret, err := kube.DefaultClient.CoreV1().Secrets(odigosns).Create(ctx, &secret, metav1.CreateOptions{}) + if err != nil { + return nil, err + } + return &k8s.LocalObjectReference{ + Name: newSecret.Name, + }, nil +} + +func AddDestinationOwnerReferenceToSecret(ctx context.Context, odigosns string, dest *v1alpha1.Destination) error { + destOwnerRef := metav1.OwnerReference{ + APIVersion: "odigos.io/v1alpha1", + Kind: "Destination", + Name: dest.Name, + UID: dest.UID, + } + + secretPatch := []struct { + Op string `json:"op"` + Path string `json:"path"` + Value []metav1.OwnerReference `json:"value"` + }{{ + Op: "add", + Path: "/metadata/ownerReferences", + Value: []metav1.OwnerReference{destOwnerRef}, + }, + } + + secretPatchBytes, err := json.Marshal(secretPatch) + if err != nil { + return err + } + + _, err = kube.DefaultClient.CoreV1().Secrets(odigosns).Patch(ctx, dest.Spec.SecretRef.Name, types.JSONPatchType, secretPatchBytes, metav1.PatchOptions{}) + if err != nil { + return err + } + return nil +} diff --git a/frontend/webapp/containers/main/destinations/add-destination/destinations-list/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/destinations-list/index.tsx index 7d54930ff..1d62f9bfd 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/destinations-list/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/destinations-list/index.tsx @@ -92,10 +92,10 @@ const DestinationsList: React.FC = ({ ); return supportedSignalsList.map((signal, index) => ( - <> + {signal} {index < supportedSignalsList.length - 1 && ·} - + )); } From fbad849b8ee7172da81abdf3657b7fae1be3a3b3 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 7 Aug 2024 15:15:32 +0300 Subject: [PATCH 137/374] chore: wip --- frontend/graph/generated.go | 295 +++++++++++++++++++++++++++++ frontend/graph/model/models_gen.go | 11 ++ frontend/graph/schema.graphqls | 16 ++ frontend/graph/schema.resolvers.go | 32 ++++ frontend/services/namespaces.go | 32 ++++ frontend/services/utils.go | 28 ++- 6 files changed, 413 insertions(+), 1 deletion(-) diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index c4e824cbc..c6b8cc0c4 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -142,6 +142,8 @@ type ComplexityRoot struct { Mutation struct { CreateNewDestination func(childComplexity int, destination model.DestinationInput) int + PersistK8sNamespace func(childComplexity int, namespace model.PersistNamespaceItemInput) int + PersistK8sSources func(childComplexity int, namespace string, sources []*model.PersistNamespaceSourceInput) int } ObservabilitySignalSupport struct { @@ -184,6 +186,8 @@ type K8sActualNamespaceResolver interface { } type MutationResolver interface { CreateNewDestination(ctx context.Context, destination model.DestinationInput) (*model.Destination, error) + PersistK8sNamespace(ctx context.Context, namespace model.PersistNamespaceItemInput) (bool, error) + PersistK8sSources(ctx context.Context, namespace string, sources []*model.PersistNamespaceSourceInput) (bool, error) } type QueryResolver interface { ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) @@ -595,6 +599,30 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.CreateNewDestination(childComplexity, args["destination"].(model.DestinationInput)), true + case "Mutation.persistK8sNamespace": + if e.complexity.Mutation.PersistK8sNamespace == nil { + break + } + + args, err := ec.field_Mutation_persistK8sNamespace_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.PersistK8sNamespace(childComplexity, args["namespace"].(model.PersistNamespaceItemInput)), true + + case "Mutation.persistK8sSources": + if e.complexity.Mutation.PersistK8sSources == nil { + break + } + + args, err := ec.field_Mutation_persistK8sSources_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.PersistK8sSources(childComplexity, args["namespace"].(string), args["sources"].([]*model.PersistNamespaceSourceInput)), true + case "ObservabilitySignalSupport.supported": if e.complexity.ObservabilitySignalSupport.Supported == nil { break @@ -685,6 +713,8 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputK8sDesiredSourceInput, ec.unmarshalInputK8sNamespaceId, ec.unmarshalInputK8sSourceId, + ec.unmarshalInputPersistNamespaceItemInput, + ec.unmarshalInputPersistNamespaceSourceInput, ) first := true @@ -879,6 +909,45 @@ func (ec *executionContext) field_Mutation_createNewDestination_args(ctx context return args, nil } +func (ec *executionContext) field_Mutation_persistK8sNamespace_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 model.PersistNamespaceItemInput + if tmp, ok := rawArgs["namespace"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + arg0, err = ec.unmarshalNPersistNamespaceItemInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐPersistNamespaceItemInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["namespace"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_persistK8sSources_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["namespace"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["namespace"] = arg0 + var arg1 []*model.PersistNamespaceSourceInput + if tmp, ok := rawArgs["sources"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sources")) + arg1, err = ec.unmarshalNPersistNamespaceSourceInput2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐPersistNamespaceSourceInputᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["sources"] = arg1 + return args, nil +} + func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -3415,6 +3484,116 @@ func (ec *executionContext) fieldContext_Mutation_createNewDestination(ctx conte return fc, nil } +func (ec *executionContext) _Mutation_persistK8sNamespace(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_persistK8sNamespace(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().PersistK8sNamespace(rctx, fc.Args["namespace"].(model.PersistNamespaceItemInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_persistK8sNamespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_persistK8sNamespace_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_persistK8sSources(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_persistK8sSources(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().PersistK8sSources(rctx, fc.Args["namespace"].(string), fc.Args["sources"].([]*model.PersistNamespaceSourceInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_persistK8sSources(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_persistK8sSources_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _ObservabilitySignalSupport_supported(ctx context.Context, field graphql.CollectedField, obj *model.ObservabilitySignalSupport) (ret graphql.Marshaler) { fc, err := ec.fieldContext_ObservabilitySignalSupport_supported(ctx, field) if err != nil { @@ -6046,6 +6225,81 @@ func (ec *executionContext) unmarshalInputK8sSourceId(ctx context.Context, obj i return it, nil } +func (ec *executionContext) unmarshalInputPersistNamespaceItemInput(ctx context.Context, obj interface{}) (model.PersistNamespaceItemInput, error) { + var it model.PersistNamespaceItemInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "futureSelected"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "futureSelected": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("futureSelected")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.FutureSelected = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputPersistNamespaceSourceInput(ctx context.Context, obj interface{}) (model.PersistNamespaceSourceInput, error) { + var it model.PersistNamespaceSourceInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "kind", "selected"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "kind": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) + data, err := ec.unmarshalNK8sResourceKind2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sResourceKind(ctx, v) + if err != nil { + return it, err + } + it.Kind = data + case "selected": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("selected")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Selected = data + } + } + + return it, nil +} + // endregion **************************** input.gotpl ***************************** // region ************************** interface.gotpl *************************** @@ -6915,6 +7169,20 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "persistK8sNamespace": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_persistK8sNamespace(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "persistK8sSources": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_persistK8sSources(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -7882,6 +8150,33 @@ func (ec *executionContext) marshalNObservabilitySignalSupport2githubᚗcomᚋod return ec._ObservabilitySignalSupport(ctx, sel, &v) } +func (ec *executionContext) unmarshalNPersistNamespaceItemInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐPersistNamespaceItemInput(ctx context.Context, v interface{}) (model.PersistNamespaceItemInput, error) { + res, err := ec.unmarshalInputPersistNamespaceItemInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNPersistNamespaceSourceInput2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐPersistNamespaceSourceInputᚄ(ctx context.Context, v interface{}) ([]*model.PersistNamespaceSourceInput, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*model.PersistNamespaceSourceInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNPersistNamespaceSourceInput2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐPersistNamespaceSourceInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalNPersistNamespaceSourceInput2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐPersistNamespaceSourceInput(ctx context.Context, v interface{}) (*model.PersistNamespaceSourceInput, error) { + res, err := ec.unmarshalInputPersistNamespaceSourceInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalNSourceContainerRuntimeDetails2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSourceContainerRuntimeDetails(ctx context.Context, sel ast.SelectionSet, v *model.SourceContainerRuntimeDetails) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index 58642ccda..e09092c8b 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -105,6 +105,17 @@ type K8sSourceID struct { type Mutation struct { } +type PersistNamespaceItemInput struct { + Name string `json:"name"` + FutureSelected *bool `json:"futureSelected,omitempty"` +} + +type PersistNamespaceSourceInput struct { + Name string `json:"name"` + Kind K8sResourceKind `json:"kind"` + Selected *bool `json:"selected,omitempty"` +} + type Query struct { } diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index f7ef33816..95de2251e 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -190,6 +190,17 @@ input ExportedSignalsInput { logs: Boolean! } +input PersistNamespaceItemInput { + name: String! + futureSelected: Boolean +} + +input PersistNamespaceSourceInput { + name: String! + kind: K8sResourceKind! + selected: Boolean +} + type Query { computePlatform: ComputePlatform config: GetConfigResponse @@ -199,4 +210,9 @@ type Query { type Mutation { createNewDestination(destination: DestinationInput!): Destination! + persistK8sNamespace(namespace: PersistNamespaceItemInput!): Boolean! + persistK8sSources( + namespace: String! + sources: [PersistNamespaceSourceInput!]! + ): Boolean! } diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 36f38a260..4c69ce864 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -18,6 +18,7 @@ import ( "github.com/odigos-io/odigos/frontend/services" "github.com/odigos-io/odigos/k8sutils/pkg/workload" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" ) // K8sActualNamespace is the resolver for the k8sActualNamespace field. @@ -81,6 +82,7 @@ func (r *k8sActualNamespaceResolver) K8sActualSources(ctx context.Context, obj * return obj.K8sActualSources, nil } +// CreateNewDestination is the resolver for the createNewDestination field. func (r *mutationResolver) CreateNewDestination(ctx context.Context, destination model.DestinationInput) (*model.Destination, error) { odigosns := consts.DefaultOdigosNamespace @@ -151,6 +153,36 @@ func (r *mutationResolver) CreateNewDestination(ctx context.Context, destination return &endpointDest, nil } +// PersistK8sNamespace is the resolver for the persistK8sNamespace field. +func (r *mutationResolver) PersistK8sNamespace(ctx context.Context, namespace model.PersistNamespaceItemInput) (bool, error) { + jsonMergePayload := services.GetJsonMergePatchForInstrumentationLabel(namespace.FutureSelected) + _, err := kube.DefaultClient.CoreV1().Namespaces().Patch(ctx, namespace.Name, types.MergePatchType, jsonMergePayload, metav1.PatchOptions{}) + if err != nil { + return false, fmt.Errorf("failed to patch namespace: %v", err) + } + + return true, nil +} + +// PersistK8sSources is the resolver for the persistK8sSources field. +func (r *mutationResolver) PersistK8sSources(ctx context.Context, namespace string, sources []*model.PersistNamespaceSourceInput) (bool, error) { + var persistObjects []model.PersistNamespaceSourceInput + for _, source := range sources { + persistObjects = append(persistObjects, model.PersistNamespaceSourceInput{ + Name: source.Name, + Kind: source.Kind, + Selected: source.Selected, + }) + } + + err := services.SyncWorkloadsInNamespace(ctx, namespace, persistObjects) + if err != nil { + return false, fmt.Errorf("failed to sync workloads: %v", err) + } + + return true, nil +} + // ComputePlatform is the resolver for the computePlatform field. func (r *queryResolver) ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) { namespacesResponse := services.GetK8SNamespaces(ctx) diff --git a/frontend/services/namespaces.go b/frontend/services/namespaces.go index fc22b6baf..c2fe67d48 100644 --- a/frontend/services/namespaces.go +++ b/frontend/services/namespaces.go @@ -14,6 +14,7 @@ import ( "github.com/odigos-io/odigos/common/consts" "github.com/odigos-io/odigos/common/utils" + "github.com/odigos-io/odigos/frontend/graph/model" "github.com/odigos-io/odigos/frontend/kube" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -149,3 +150,34 @@ func CountAppsPerNamespace(ctx context.Context) (map[string]int, error) { return namespaceToAppsCount, nil } + +func GetJsonMergePatchForInstrumentationLabel(enabled *bool) []byte { + labelJsonMergePatchValue := "null" + if enabled != nil { + if *enabled { + labelJsonMergePatchValue = fmt.Sprintf("\"%s\"", consts.InstrumentationEnabled) + } else { + labelJsonMergePatchValue = fmt.Sprintf("\"%s\"", consts.InstrumentationDisabled) + } + } + + jsonMergePatchContent := fmt.Sprintf(`{"metadata":{"labels":{"%s":%s}}}`, consts.OdigosInstrumentationLabel, labelJsonMergePatchValue) + return []byte(jsonMergePatchContent) +} + +func SyncWorkloadsInNamespace(ctx context.Context, nsName string, workloads []model.PersistNamespaceSourceInput) error { + g, ctx := errgroup.WithContext(ctx) + g.SetLimit(kube.K8sClientDefaultBurst) + + for _, workload := range workloads { + currWorkload := workload + g.Go(func() error { + // Only label selected sources, ignore the rest + if currWorkload.Selected != nil && *currWorkload.Selected { + return setWorkloadInstrumentationLabel(ctx, nsName, currWorkload.Name, WorkloadKind(currWorkload.Kind.String()), currWorkload.Selected) + } + return nil + }) + } + return g.Wait() +} diff --git a/frontend/services/utils.go b/frontend/services/utils.go index 90ff6591d..4464bb016 100644 --- a/frontend/services/utils.go +++ b/frontend/services/utils.go @@ -1,9 +1,35 @@ package services -import "path" +import ( + "context" + "errors" + "path" + + "github.com/odigos-io/odigos/frontend/kube" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) const cdnUrl = "https://d15jtxgb40qetw.cloudfront.net" func GetImageURL(image string) string { return path.Join(cdnUrl, image) } + +func setWorkloadInstrumentationLabel(ctx context.Context, nsName string, workloadName string, workloadKind WorkloadKind, enabled *bool) error { + jsonMergePatchData := GetJsonMergePatchForInstrumentationLabel(enabled) + + switch workloadKind { + case WorkloadKindDeployment: + _, err := kube.DefaultClient.AppsV1().Deployments(nsName).Patch(ctx, workloadName, types.MergePatchType, jsonMergePatchData, metav1.PatchOptions{}) + return err + case WorkloadKindStatefulSet: + _, err := kube.DefaultClient.AppsV1().StatefulSets(nsName).Patch(ctx, workloadName, types.MergePatchType, jsonMergePatchData, metav1.PatchOptions{}) + return err + case WorkloadKindDaemonSet: + _, err := kube.DefaultClient.AppsV1().DaemonSets(nsName).Patch(ctx, workloadName, types.MergePatchType, jsonMergePatchData, metav1.PatchOptions{}) + return err + default: + return errors.New("unsupported workload kind " + string(workloadKind)) + } +} From 65d5b12ee10c328ad93e63676f6dbd119666d4c2 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 7 Aug 2024 15:40:53 +0300 Subject: [PATCH 138/374] chore: init new mutations --- frontend/webapp/graphql/mutations/destination.ts | 9 +++++++++ frontend/webapp/graphql/mutations/index.ts | 1 + frontend/webapp/graphql/mutations/namespace.ts | 7 +++++++ frontend/webapp/graphql/mutations/source.ts | 10 ++++++++++ 4 files changed, 27 insertions(+) create mode 100644 frontend/webapp/graphql/mutations/destination.ts create mode 100644 frontend/webapp/graphql/mutations/index.ts create mode 100644 frontend/webapp/graphql/mutations/namespace.ts create mode 100644 frontend/webapp/graphql/mutations/source.ts diff --git a/frontend/webapp/graphql/mutations/destination.ts b/frontend/webapp/graphql/mutations/destination.ts new file mode 100644 index 000000000..0cbdcc12e --- /dev/null +++ b/frontend/webapp/graphql/mutations/destination.ts @@ -0,0 +1,9 @@ +import { gql } from '@apollo/client'; + +export const CREATE_DESTINATION = gql` + mutation CreateNewDestination($destination: DestinationInput!) { + createNewDestination(destination: $destination) { + id + } + } +`; diff --git a/frontend/webapp/graphql/mutations/index.ts b/frontend/webapp/graphql/mutations/index.ts new file mode 100644 index 000000000..cb9273dc8 --- /dev/null +++ b/frontend/webapp/graphql/mutations/index.ts @@ -0,0 +1 @@ +export * from './destination'; diff --git a/frontend/webapp/graphql/mutations/namespace.ts b/frontend/webapp/graphql/mutations/namespace.ts new file mode 100644 index 000000000..86b525867 --- /dev/null +++ b/frontend/webapp/graphql/mutations/namespace.ts @@ -0,0 +1,7 @@ +import { gql } from '@apollo/client'; + +export const PERSIST_NAMESPACE = gql` + mutation PersistNamespace($namespace: PersistNamespaceItemInput!) { + persistK8sNamespace(namespace: $namespace) + } +`; diff --git a/frontend/webapp/graphql/mutations/source.ts b/frontend/webapp/graphql/mutations/source.ts new file mode 100644 index 000000000..3c171a743 --- /dev/null +++ b/frontend/webapp/graphql/mutations/source.ts @@ -0,0 +1,10 @@ +import { gql } from '@apollo/client'; + +export const CREATE_SOURCE = gql` + mutation PersistSources( + $namespace: String! + $sources: [PersistNamespaceSourceInput!]! + ) { + persistK8sSources(namespace: $namespace, sources: $sources) + } +`; From cb7aa4e86f5735bdd5edbba27157e25cc3a0793f Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Wed, 7 Aug 2024 16:48:29 +0300 Subject: [PATCH 139/374] chore: wip --- frontend/webapp/app/setup/layout.tsx | 27 +------ .../components/setup/headers/header/index.tsx | 30 +++----- .../destinations/add-destination/index.tsx | 55 +++++++++++---- .../main/sources/choose-sources/index.tsx | 70 +++++++++++++------ .../reuseable-components/button/index.tsx | 5 +- .../navigation-buttons/index.tsx | 6 +- 6 files changed, 111 insertions(+), 82 deletions(-) diff --git a/frontend/webapp/app/setup/layout.tsx b/frontend/webapp/app/setup/layout.tsx index a5ddf5598..8de0ce226 100644 --- a/frontend/webapp/app/setup/layout.tsx +++ b/frontend/webapp/app/setup/layout.tsx @@ -1,7 +1,7 @@ 'use client'; import React from 'react'; import styled from 'styled-components'; -import { SetupHeader, SideMenu } from '@/components'; +import { SideMenu } from '@/components'; const LayoutContainer = styled.div` width: 100%; @@ -18,23 +18,14 @@ const SideMenuWrapper = styled.div` top: 144px; `; -const HeaderWrapper = styled.div` - width: 100vw; -`; - const MainContent = styled.div` display: flex; max-width: 1440px; - width: 100%; + width: 100vh; flex-direction: column; align-items: center; `; -const ContentWrapper = styled.div` - width: 640px; - padding-top: 64px; -`; - export default function SetupLayout({ children, }: { @@ -42,22 +33,10 @@ export default function SetupLayout({ }) { return ( - - - - - {children} - + {children} ); } diff --git a/frontend/webapp/components/setup/headers/header/index.tsx b/frontend/webapp/components/setup/headers/header/index.tsx index 722a27586..ceaa4c468 100644 --- a/frontend/webapp/components/setup/headers/header/index.tsx +++ b/frontend/webapp/components/setup/headers/header/index.tsx @@ -4,8 +4,13 @@ import styled from 'styled-components'; import { NavigationButtons, Text } from '@/reuseable-components'; interface SetupHeaderProps { - onBack: () => void; - onNext: () => void; + navigationButtons: { + label: string; + iconSrc?: string; + onClick: () => void; + variant?: 'primary' | 'secondary'; + disabled?: boolean; + }[]; } const HeaderContainer = styled.div` @@ -26,7 +31,9 @@ const Logo = styled.div` font-size: 1.2em; `; -export const SetupHeader: React.FC = ({ onBack, onNext }) => { +export const SetupHeader: React.FC = ({ + navigationButtons, +}) => { return ( @@ -38,22 +45,7 @@ export const SetupHeader: React.FC = ({ onBack, onNext }) => { /> START WITH ODIGOS - + ); }; diff --git a/frontend/webapp/containers/main/destinations/add-destination/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/index.tsx index c8c92371d..65a578524 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/index.tsx @@ -1,33 +1,64 @@ import React, { useState } from 'react'; import styled from 'styled-components'; -import { AddDestinationButton } from '@/components'; +import { AddDestinationButton, SetupHeader } from '@/components'; import { SectionTitle } from '@/reuseable-components'; import { AddDestinationModal } from './add-destination-modal'; +import { useRouter } from 'next/navigation'; const AddDestinationButtonWrapper = styled.div` width: 100%; margin-top: 24px; `; +const ContentWrapper = styled.div` + width: 640px; + padding-top: 64px; +`; + +const HeaderWrapper = styled.div` + width: 100vw; +`; + export function ChooseDestinationContainer() { const [isModalOpen, setModalOpen] = useState(false); + const router = useRouter(); const handleOpenModal = () => setModalOpen(true); const handleCloseModal = () => setModalOpen(false); return ( <> - - - handleOpenModal()} /> - - + + router.back(), + variant: 'secondary', + }, + { + label: 'DONE', + // iconSrc: '/icons/common/arrow-black.svg', + onClick: () => console.log('Next button clicked'), + variant: 'primary', + }, + ]} + /> + + + + + handleOpenModal()} /> + + + ); } diff --git a/frontend/webapp/containers/main/sources/choose-sources/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/index.tsx index 5b11bc670..4c5ea0f48 100644 --- a/frontend/webapp/containers/main/sources/choose-sources/index.tsx +++ b/frontend/webapp/containers/main/sources/choose-sources/index.tsx @@ -10,7 +10,18 @@ import { SearchDropdownHandlers, ToggleCheckboxHandlers, } from './choose-sources-menu/type'; - +import { SetupHeader } from '@/components'; +import styled from 'styled-components'; +import { useRouter } from 'next/navigation'; + +const ContentWrapper = styled.div` + width: 640px; + padding-top: 64px; +`; + +const HeaderWrapper = styled.div` + width: 100vw; +`; export function ChooseSourcesContainer() { const [searchFilter, setSearchFilter] = useState(''); const [showSelectedOnly, setShowSelectedOnly] = useState(false); @@ -19,9 +30,9 @@ export function ChooseSourcesContainer() { const [selectedOption, setSelectedOption] = useState(); const [selectedItems, setSelectedItems] = useState([]); const [namespacesList, setNamespacesList] = useState([]); - const [sourcesList, setSourcesList] = useState([]); + const router = useRouter(); const { error, data } = useComputePlatform(); const { data: namespacesData } = useNamespace(selectedOption?.value); @@ -118,26 +129,41 @@ export function ChooseSourcesContainer() { return ( <> - - - - - - + + router.push('/setup/choose-destination'), + variant: 'primary', + disabled: selectedItems.length === 0, + }, + ]} + /> + + + + + + + + + ); } diff --git a/frontend/webapp/reuseable-components/button/index.tsx b/frontend/webapp/reuseable-components/button/index.tsx index e4c3d3f18..a783b8320 100644 --- a/frontend/webapp/reuseable-components/button/index.tsx +++ b/frontend/webapp/reuseable-components/button/index.tsx @@ -57,8 +57,7 @@ const StyledButton = styled.button` ${({ isDisabled }) => isDisabled && css` - background-color: #eaeaea; - color: #888; + opacity: 0.5; cursor: not-allowed; &:hover, &:active { @@ -74,7 +73,7 @@ export const Button: React.FC = ({ ...props }) => { return ( - + {children} ); diff --git a/frontend/webapp/reuseable-components/navigation-buttons/index.tsx b/frontend/webapp/reuseable-components/navigation-buttons/index.tsx index b0fc57919..ebd7aad27 100644 --- a/frontend/webapp/reuseable-components/navigation-buttons/index.tsx +++ b/frontend/webapp/reuseable-components/navigation-buttons/index.tsx @@ -26,7 +26,9 @@ const ButtonsContainer = styled.div` const StyledButton = styled(Button)` display: flex; align-items: center; + justify-content: center; gap: 8px; + min-width: 91.6px; `; const ButtonText = styled(Text)` @@ -43,7 +45,7 @@ export const NavigationButtons: React.FC = ({ button: NavigationButtonProps; index: number; }) { - return buttons.length > 0 && button.iconSrc && index === 0; + return buttons.length > 1 && button.iconSrc && index === 0; } return ( @@ -52,7 +54,7 @@ export const NavigationButtons: React.FC = ({ key={index} variant={button.variant || 'secondary'} onClick={button.onClick} - disabled={button.disabled} + isDisabled={button.disabled} > {renderBackButton({ button, index }) && ( Date: Wed, 7 Aug 2024 17:44:37 +0300 Subject: [PATCH 140/374] chore: wip --- .../choose-sources-list/index.tsx | 16 +-- .../main/sources/choose-sources/index.tsx | 97 ++++++++++++++----- .../reuseable-components/checkbox/index.tsx | 6 +- frontend/webapp/types/sources.ts | 1 + 4 files changed, 86 insertions(+), 34 deletions(-) diff --git a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx index 81c62b849..87d8d76ab 100644 --- a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx +++ b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx @@ -1,4 +1,5 @@ import { Text } from '@/reuseable-components'; +import { K8sActualSource } from '@/types'; import Image from 'next/image'; import React, { useState } from 'react'; import styled from 'styled-components'; @@ -66,12 +67,6 @@ const SelectedTextWrapper = styled.div` margin-right: 24px; `; -interface K8sActualSource { - name: string; - kind: string; - numberOfInstances: number; -} - interface SourcesListProps { items: K8sActualSource[]; selectedItems: K8sActualSource[]; @@ -83,12 +78,19 @@ const SourcesList: React.FC = ({ selectedItems, setSelectedItems, }) => { + function isItemSelected(item: K8sActualSource) { + const selected = selectedItems.find( + (selectedItem) => selectedItem.name === item.name + ); + return !!selected; + } + return ( {items.map((item) => ( setSelectedItems(item)} > diff --git a/frontend/webapp/containers/main/sources/choose-sources/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/index.tsx index 4c5ea0f48..8d7a2fe72 100644 --- a/frontend/webapp/containers/main/sources/choose-sources/index.tsx +++ b/frontend/webapp/containers/main/sources/choose-sources/index.tsx @@ -13,6 +13,8 @@ import { import { SetupHeader } from '@/components'; import styled from 'styled-components'; import { useRouter } from 'next/navigation'; +import { setSources } from '@/store'; +import { useDispatch } from 'react-redux'; const ContentWrapper = styled.div` width: 640px; @@ -26,13 +28,19 @@ export function ChooseSourcesContainer() { const [searchFilter, setSearchFilter] = useState(''); const [showSelectedOnly, setShowSelectedOnly] = useState(false); const [selectAllCheckbox, setSelectAllCheckbox] = useState(false); - const [futureAppsCheckbox, setFutureAppsCheckbox] = useState(false); + const [futureAppsCheckbox, setFutureAppsCheckbox] = useState<{ + [key: string]: boolean; + }>({}); const [selectedOption, setSelectedOption] = useState(); - const [selectedItems, setSelectedItems] = useState([]); + const [selectedItems, setSelectedItems] = useState<{ + [key: string]: K8sActualSource[]; + }>({}); const [namespacesList, setNamespacesList] = useState([]); const [sourcesList, setSourcesList] = useState([]); const router = useRouter(); + const dispatch = useDispatch(); + const { error, data } = useComputePlatform(); const { data: namespacesData } = useNamespace(selectedOption?.value); @@ -69,26 +77,40 @@ export function ChooseSourcesContainer() { } function selectAllSources() { - setSelectedItems(sourcesList); + if (selectedOption) { + setSelectedItems({ + ...selectedItems, + [selectedOption.value]: sourcesList, + }); + } } function handleSelectItem(item: K8sActualSource) { - if (selectedItems.includes(item)) { - const updatedSelectedItems = selectedItems.filter( - (selectedItem) => selectedItem !== item - ); - setSelectedItems(updatedSelectedItems); - if ( - selectAllCheckbox && - updatedSelectedItems.length !== sourcesList.length - ) { - setSelectAllCheckbox(false); - } - } else { - const updatedSelectedItems = [...selectedItems, item]; - setSelectedItems(updatedSelectedItems); - if (updatedSelectedItems.length === sourcesList.length) { - setSelectAllCheckbox(true); + if (selectedOption) { + const currentSelectedItems = selectedItems[selectedOption.value] || []; + if (currentSelectedItems.includes(item)) { + const updatedSelectedItems = currentSelectedItems.filter( + (selectedItem) => selectedItem !== item + ); + setSelectedItems({ + ...selectedItems, + [selectedOption.value]: updatedSelectedItems, + }); + if ( + selectAllCheckbox && + updatedSelectedItems.length !== sourcesList.length + ) { + setSelectAllCheckbox(false); + } + } else { + const updatedSelectedItems = [...currentSelectedItems, item]; + setSelectedItems({ + ...selectedItems, + [selectedOption.value]: updatedSelectedItems, + }); + if (updatedSelectedItems.length === sourcesList.length) { + setSelectAllCheckbox(true); + } } } } @@ -100,21 +122,40 @@ export function ChooseSourcesContainer() { : allSources; return showSelectedOnly - ? filteredSources.filter((source) => selectedItems.includes(source)) + ? filteredSources.filter((source) => + selectedOption + ? (selectedItems[selectedOption.value] || []).includes(source) + : false + ) : filteredSources; } + function onNextClick() { + if (selectedOption) { + dispatch(setSources(selectedItems[selectedOption.value] || [])); + } + router.push('/setup/choose-destination'); + } + const toggleCheckboxState: ToggleCheckboxState = { - selectedAppsCount: selectedItems.length, + selectedAppsCount: selectedOption + ? (selectedItems[selectedOption.value] || []).length + : 0, selectAllCheckbox, showSelectedOnly, - futureAppsCheckbox, + futureAppsCheckbox: + futureAppsCheckbox[selectedOption?.value || ''] || false, }; const toggleCheckboxHandlers: ToggleCheckboxHandlers = { setSelectAllCheckbox, setShowSelectedOnly, - setFutureAppsCheckbox, + setFutureAppsCheckbox: (value: boolean) => { + setFutureAppsCheckbox({ + ...futureAppsCheckbox, + [selectedOption?.value || '']: value, + }); + }, }; const searchDropdownState: SearchDropdownState = { @@ -135,9 +176,11 @@ export function ChooseSourcesContainer() { { label: 'NEXT', iconSrc: '/icons/common/arrow-black.svg', - onClick: () => router.push('/setup/choose-destination'), + onClick: () => onNextClick(), variant: 'primary', - disabled: selectedItems.length === 0, + disabled: + !selectedOption || + (selectedItems[selectedOption.value] || []).length === 0, }, ]} /> @@ -159,7 +202,9 @@ export function ChooseSourcesContainer() { /> diff --git a/frontend/webapp/reuseable-components/checkbox/index.tsx b/frontend/webapp/reuseable-components/checkbox/index.tsx index 92a3c1470..57a1066d0 100644 --- a/frontend/webapp/reuseable-components/checkbox/index.tsx +++ b/frontend/webapp/reuseable-components/checkbox/index.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import styled from 'styled-components'; import { Tooltip } from '../tooltip'; import Image from 'next/image'; @@ -45,6 +45,10 @@ const Checkbox: React.FC = ({ }) => { const [isChecked, setIsChecked] = useState(initialValue); + useEffect(() => { + setIsChecked(initialValue); + }, [initialValue]); + const handleToggle = () => { if (!disabled) { const newValue = !isChecked; diff --git a/frontend/webapp/types/sources.ts b/frontend/webapp/types/sources.ts index f7d8e9709..d34825c62 100644 --- a/frontend/webapp/types/sources.ts +++ b/frontend/webapp/types/sources.ts @@ -75,4 +75,5 @@ export type K8sActualSource = { name: string; kind: string; numberOfInstances: number; + selected?: boolean; }; From 801c3ae2a9f597a6d8bac0f048b8ed82a6a36282 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 8 Aug 2024 11:43:54 +0300 Subject: [PATCH 141/374] chore: use custom hook to manage setup state --- .../choose-sources-list/index.tsx | 2 +- .../toggles-and-checkboxes.tsx | 13 +- .../main/sources/choose-sources/index.tsx | 169 ++++++------------ frontend/webapp/hooks/sources/index.ts | 2 + .../hooks/sources/useConnectSourcesList.ts | 43 +++++ .../sources/useConnectSourcesMenuState.ts | 88 +++++++++ frontend/webapp/store/slices/app-slice.ts | 21 ++- 7 files changed, 210 insertions(+), 128 deletions(-) create mode 100644 frontend/webapp/hooks/sources/useConnectSourcesList.ts create mode 100644 frontend/webapp/hooks/sources/useConnectSourcesMenuState.ts diff --git a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx index 87d8d76ab..c6c42e8fd 100644 --- a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx +++ b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-list/index.tsx @@ -109,7 +109,7 @@ const SourcesList: React.FC = ({
- {selectedItems.includes(item) && ( + {isItemSelected(item) && ( SELECTED diff --git a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/toggles-and-checkboxes.tsx b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/toggles-and-checkboxes.tsx index 5a7c604db..6e52797ef 100644 --- a/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/toggles-and-checkboxes.tsx +++ b/frontend/webapp/containers/main/sources/choose-sources/choose-sources-menu/toggles-and-checkboxes.tsx @@ -11,6 +11,7 @@ const Container = styled.div` const ToggleWrapper = styled.div` display: flex; + align-items: center; gap: 32px; `; @@ -46,13 +47,13 @@ const TogglesAndCheckboxes: React.FC = ({ initialValue={showSelectedOnly} onChange={setShowSelectedOnly} /> + -
); }; diff --git a/frontend/webapp/containers/main/sources/choose-sources/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/index.tsx index 8d7a2fe72..1a93ee898 100644 --- a/frontend/webapp/containers/main/sources/choose-sources/index.tsx +++ b/frontend/webapp/containers/main/sources/choose-sources/index.tsx @@ -1,8 +1,13 @@ -import React, { useEffect, useState } from 'react'; +import React, { useState } from 'react'; +import styled from 'styled-components'; +import { useDispatch } from 'react-redux'; +import { K8sActualSource } from '@/types'; +import { SetupHeader } from '@/components'; +import { useRouter } from 'next/navigation'; import { SourcesList } from './choose-sources-list'; -import { useComputePlatform, useNamespace } from '@/hooks'; import { SectionTitle, Divider } from '@/reuseable-components'; -import { DropdownOption, K8sActualNamespace, K8sActualSource } from '@/types'; +import { setNamespaceFutureSelectAppsList, setSources } from '@/store'; +import { useConnectSourcesList, useConnectSourcesMenuState } from '@/hooks'; import { SearchAndDropdown, TogglesAndCheckboxes } from './choose-sources-menu'; import { SearchDropdownState, @@ -10,14 +15,9 @@ import { SearchDropdownHandlers, ToggleCheckboxHandlers, } from './choose-sources-menu/type'; -import { SetupHeader } from '@/components'; -import styled from 'styled-components'; -import { useRouter } from 'next/navigation'; -import { setSources } from '@/store'; -import { useDispatch } from 'react-redux'; const ContentWrapper = styled.div` - width: 640px; + width: 660px; padding-top: 64px; `; @@ -25,147 +25,76 @@ const HeaderWrapper = styled.div` width: 100vw; `; export function ChooseSourcesContainer() { - const [searchFilter, setSearchFilter] = useState(''); - const [showSelectedOnly, setShowSelectedOnly] = useState(false); - const [selectAllCheckbox, setSelectAllCheckbox] = useState(false); - const [futureAppsCheckbox, setFutureAppsCheckbox] = useState<{ - [key: string]: boolean; - }>({}); - const [selectedOption, setSelectedOption] = useState(); - const [selectedItems, setSelectedItems] = useState<{ - [key: string]: K8sActualSource[]; - }>({}); - const [namespacesList, setNamespacesList] = useState([]); const [sourcesList, setSourcesList] = useState([]); + const { stateMenu, stateHandlers } = useConnectSourcesMenuState({ + sourcesList, + }); + const { namespacesList } = useConnectSourcesList({ + stateMenu, + sourcesList, + setSourcesList, + }); + const router = useRouter(); const dispatch = useDispatch(); - const { error, data } = useComputePlatform(); - const { data: namespacesData } = useNamespace(selectedOption?.value); - - useEffect(() => { - data && buildNamespacesList(); - }, [data, error]); - - useEffect(() => { - namespacesData && setSourcesList(namespacesData.k8sActualSources || []); - }, [namespacesData]); - - useEffect(() => { - selectAllCheckbox && selectAllSources(); - }, [selectAllCheckbox]); - - function buildNamespacesList() { - const namespaces = data?.computePlatform?.k8sActualNamespaces || []; - const namespacesList = namespaces.map((namespace: K8sActualNamespace) => ({ - id: namespace.name, - value: namespace.name, - })); - - setSelectedOption(namespacesList[0]); - setNamespacesList(namespacesList); - } - - function filterSources(sources: K8sActualSource[]) { - return sources.filter((source: K8sActualSource) => { - return ( - searchFilter === '' || - source.name.toLowerCase().includes(searchFilter.toLowerCase()) - ); - }); - } - - function selectAllSources() { - if (selectedOption) { - setSelectedItems({ - ...selectedItems, - [selectedOption.value]: sourcesList, - }); - } - } - - function handleSelectItem(item: K8sActualSource) { - if (selectedOption) { - const currentSelectedItems = selectedItems[selectedOption.value] || []; - if (currentSelectedItems.includes(item)) { - const updatedSelectedItems = currentSelectedItems.filter( - (selectedItem) => selectedItem !== item - ); - setSelectedItems({ - ...selectedItems, - [selectedOption.value]: updatedSelectedItems, - }); - if ( - selectAllCheckbox && - updatedSelectedItems.length !== sourcesList.length - ) { - setSelectAllCheckbox(false); - } - } else { - const updatedSelectedItems = [...currentSelectedItems, item]; - setSelectedItems({ - ...selectedItems, - [selectedOption.value]: updatedSelectedItems, - }); - if (updatedSelectedItems.length === sourcesList.length) { - setSelectAllCheckbox(true); - } - } - } - } - function getVisibleSources() { const allSources = sourcesList || []; - const filteredSources = searchFilter - ? filterSources(allSources) + const filteredSources = stateMenu.searchFilter + ? stateHandlers.filterSources(allSources) : allSources; - return showSelectedOnly + return stateMenu.showSelectedOnly ? filteredSources.filter((source) => - selectedOption - ? (selectedItems[selectedOption.value] || []).includes(source) + stateMenu.selectedOption + ? ( + stateMenu.selectedItems[stateMenu.selectedOption.value] || [] + ).find((selectedItem) => selectedItem.name === source.name) : false ) : filteredSources; } function onNextClick() { + const { selectedOption, selectedItems, futureAppsCheckbox } = stateMenu; if (selectedOption) { - dispatch(setSources(selectedItems[selectedOption.value] || [])); + dispatch(setSources(selectedItems)); + dispatch(setNamespaceFutureSelectAppsList(futureAppsCheckbox)); } router.push('/setup/choose-destination'); } const toggleCheckboxState: ToggleCheckboxState = { - selectedAppsCount: selectedOption - ? (selectedItems[selectedOption.value] || []).length + selectedAppsCount: stateMenu.selectedOption + ? (stateMenu.selectedItems[stateMenu.selectedOption.value] || []).length : 0, - selectAllCheckbox, - showSelectedOnly, + selectAllCheckbox: stateMenu.selectAllCheckbox, + showSelectedOnly: stateMenu.showSelectedOnly, futureAppsCheckbox: - futureAppsCheckbox[selectedOption?.value || ''] || false, + stateMenu.futureAppsCheckbox[stateMenu.selectedOption?.value || ''] || + false, }; const toggleCheckboxHandlers: ToggleCheckboxHandlers = { - setSelectAllCheckbox, - setShowSelectedOnly, + setSelectAllCheckbox: stateMenu.setSelectAllCheckbox, + setShowSelectedOnly: stateMenu.setShowSelectedOnly, setFutureAppsCheckbox: (value: boolean) => { - setFutureAppsCheckbox({ - ...futureAppsCheckbox, - [selectedOption?.value || '']: value, + stateMenu.setFutureAppsCheckbox({ + ...stateMenu.futureAppsCheckbox, + [stateMenu.selectedOption?.value || '']: value, }); }, }; const searchDropdownState: SearchDropdownState = { - selectedOption, - searchFilter, + selectedOption: stateMenu.selectedOption, + searchFilter: stateMenu.searchFilter, }; const searchDropdownHandlers: SearchDropdownHandlers = { - setSelectedOption, - setSearchFilter, + setSelectedOption: stateMenu.setSelectedOption, + setSearchFilter: stateMenu.setSearchFilter, }; return ( @@ -179,8 +108,10 @@ export function ChooseSourcesContainer() { onClick: () => onNextClick(), variant: 'primary', disabled: - !selectedOption || - (selectedItems[selectedOption.value] || []).length === 0, + !stateMenu.selectedOption || + Object.keys(stateMenu.selectedItems).every( + (value) => stateMenu.selectedItems[value].length === 0 + ), }, ]} /> @@ -203,9 +134,11 @@ export function ChooseSourcesContainer() { diff --git a/frontend/webapp/hooks/sources/index.ts b/frontend/webapp/hooks/sources/index.ts index da4dcad8c..fa6665c03 100644 --- a/frontend/webapp/hooks/sources/index.ts +++ b/frontend/webapp/hooks/sources/index.ts @@ -1 +1,3 @@ export * from './useSources'; +export * from './useConnectSourcesMenuState'; +export * from './useConnectSourcesList'; diff --git a/frontend/webapp/hooks/sources/useConnectSourcesList.ts b/frontend/webapp/hooks/sources/useConnectSourcesList.ts new file mode 100644 index 000000000..7eae478c6 --- /dev/null +++ b/frontend/webapp/hooks/sources/useConnectSourcesList.ts @@ -0,0 +1,43 @@ +import { DropdownOption, K8sActualNamespace, K8sActualSource } from '@/types'; +import { useEffect, useState } from 'react'; +import { useComputePlatform, useNamespace } from '../compute-platform'; + +export const useConnectSourcesList = ({ + stateMenu, + sourcesList, + setSourcesList, +}) => { + const [namespacesList, setNamespacesList] = useState([]); + + const { error, data } = useComputePlatform(); + const { data: namespacesData } = useNamespace( + stateMenu.selectedOption?.value + ); + + useEffect(() => { + data && buildNamespacesList(); + }, [data, error]); + + useEffect(() => { + if (namespacesData && namespacesData.k8sActualSources) { + setSourcesList(namespacesData.k8sActualSources || []); + stateMenu.setSelectAllCheckbox( + namespacesData.k8sActualSources?.length === + stateMenu.selectedItems[stateMenu.selectedOption?.value || ''] + ?.length && namespacesData.k8sActualSources?.length > 0 + ); + } + }, [namespacesData]); + + function buildNamespacesList() { + const namespaces = data?.computePlatform?.k8sActualNamespaces || []; + const namespacesList = namespaces.map((namespace: K8sActualNamespace) => ({ + id: namespace.name, + value: namespace.name, + })); + + stateMenu.setSelectedOption(namespacesList[0]); + setNamespacesList(namespacesList); + } + return { namespacesList }; +}; diff --git a/frontend/webapp/hooks/sources/useConnectSourcesMenuState.ts b/frontend/webapp/hooks/sources/useConnectSourcesMenuState.ts new file mode 100644 index 000000000..e52878362 --- /dev/null +++ b/frontend/webapp/hooks/sources/useConnectSourcesMenuState.ts @@ -0,0 +1,88 @@ +import { useEffect, useState } from 'react'; +import { DropdownOption, K8sActualSource } from '@/types'; + +export const useConnectSourcesMenuState = ({ sourcesList }) => { + const [searchFilter, setSearchFilter] = useState(''); + const [showSelectedOnly, setShowSelectedOnly] = useState(false); + const [selectAllCheckbox, setSelectAllCheckbox] = useState(false); + const [selectedOption, setSelectedOption] = useState(); + const [futureAppsCheckbox, setFutureAppsCheckbox] = useState<{ + [key: string]: boolean; + }>({}); + + const [selectedItems, setSelectedItems] = useState<{ + [key: string]: K8sActualSource[]; + }>({}); + + useEffect(() => { + selectAllCheckbox && selectAllSources(); + }, [selectAllCheckbox]); + + function selectAllSources() { + if (selectedOption) { + setSelectedItems({ + ...selectedItems, + [selectedOption.value]: sourcesList, + }); + } + } + + function filterSources(sources: K8sActualSource[]) { + return sources.filter((source: K8sActualSource) => { + return ( + searchFilter === '' || + source.name.toLowerCase().includes(searchFilter.toLowerCase()) + ); + }); + } + + function handleSelectItem(item: K8sActualSource) { + if (selectedOption) { + const currentSelectedItems = selectedItems[selectedOption.value] || []; + if (currentSelectedItems.includes(item)) { + const updatedSelectedItems = currentSelectedItems.filter( + (selectedItem) => selectedItem !== item + ); + setSelectedItems({ + ...selectedItems, + [selectedOption.value]: updatedSelectedItems, + }); + if ( + selectAllCheckbox && + updatedSelectedItems.length !== sourcesList.length + ) { + setSelectAllCheckbox(false); + } + } else { + const updatedSelectedItems = [...currentSelectedItems, item]; + setSelectedItems({ + ...selectedItems, + [selectedOption.value]: updatedSelectedItems, + }); + if (updatedSelectedItems.length === sourcesList.length) { + setSelectAllCheckbox(true); + } + } + } + } + + return { + stateMenu: { + searchFilter, + setSearchFilter, + showSelectedOnly, + setShowSelectedOnly, + selectAllCheckbox, + setSelectAllCheckbox, + selectedOption, + setSelectedOption, + futureAppsCheckbox, + setFutureAppsCheckbox, + selectedItems, + }, + stateHandlers: { + handleSelectItem, + filterSources, + }, + }; +}; diff --git a/frontend/webapp/store/slices/app-slice.ts b/frontend/webapp/store/slices/app-slice.ts index 66266f246..643894c65 100644 --- a/frontend/webapp/store/slices/app-slice.ts +++ b/frontend/webapp/store/slices/app-slice.ts @@ -1,25 +1,40 @@ +import { K8sActualSource } from '@/types'; import { createSlice } from '@reduxjs/toolkit'; import type { PayloadAction } from '@reduxjs/toolkit'; export interface IAppState { - sources: any; + sources: { + [key: string]: K8sActualSource[]; + }; + namespaceFutureSelectAppsList: { [key: string]: boolean }; } const initialState: IAppState = { sources: {}, + namespaceFutureSelectAppsList: {}, }; export const appSlice = createSlice({ name: 'app', initialState, reducers: { - setSources: (state, action: PayloadAction) => { + setSources: ( + state, + action: PayloadAction<{ [key: string]: K8sActualSource[] }> + ) => { state.sources = action.payload; }, + setNamespaceFutureSelectAppsList: ( + state, + action: PayloadAction<{ [key: string]: boolean }> + ) => { + state.namespaceFutureSelectAppsList = action.payload; + }, }, }); // Action creators are generated for each case reducer function -export const { setSources } = appSlice.actions; +export const { setSources, setNamespaceFutureSelectAppsList } = + appSlice.actions; export const appReducer = appSlice.reducer; From 9e0d46ad449c768b6af96b08d4c1ca0eef37da2d Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 8 Aug 2024 13:49:24 +0300 Subject: [PATCH 142/374] chore: wip --- .../containers/main/sources/choose-sources/index.tsx | 5 ++--- .../webapp/hooks/sources/useConnectSourcesList.ts | 6 +----- .../hooks/sources/useConnectSourcesMenuState.ts | 12 +++++++++++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/frontend/webapp/containers/main/sources/choose-sources/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/index.tsx index 1a93ee898..84d85d18d 100644 --- a/frontend/webapp/containers/main/sources/choose-sources/index.tsx +++ b/frontend/webapp/containers/main/sources/choose-sources/index.tsx @@ -32,7 +32,6 @@ export function ChooseSourcesContainer() { }); const { namespacesList } = useConnectSourcesList({ stateMenu, - sourcesList, setSourcesList, }); @@ -126,12 +125,12 @@ export function ChooseSourcesContainer() { handlers={searchDropdownHandlers} dropdownOptions={namespacesList} /> - + - + { +export const useConnectSourcesList = ({ stateMenu, setSourcesList }) => { const [namespacesList, setNamespacesList] = useState([]); const { error, data } = useComputePlatform(); diff --git a/frontend/webapp/hooks/sources/useConnectSourcesMenuState.ts b/frontend/webapp/hooks/sources/useConnectSourcesMenuState.ts index e52878362..4fd64e62a 100644 --- a/frontend/webapp/hooks/sources/useConnectSourcesMenuState.ts +++ b/frontend/webapp/hooks/sources/useConnectSourcesMenuState.ts @@ -1,5 +1,6 @@ import { useEffect, useState } from 'react'; import { DropdownOption, K8sActualSource } from '@/types'; +import { useSelector } from 'react-redux'; export const useConnectSourcesMenuState = ({ sourcesList }) => { const [searchFilter, setSearchFilter] = useState(''); @@ -9,11 +10,20 @@ export const useConnectSourcesMenuState = ({ sourcesList }) => { const [futureAppsCheckbox, setFutureAppsCheckbox] = useState<{ [key: string]: boolean; }>({}); - const [selectedItems, setSelectedItems] = useState<{ [key: string]: K8sActualSource[]; }>({}); + const { sources, namespaceFutureSelectAppsList } = useSelector( + ({ app }) => app + ); + + useEffect(() => { + sources && setSelectedItems(sources); + namespaceFutureSelectAppsList && + setFutureAppsCheckbox(namespaceFutureSelectAppsList); + }, [namespaceFutureSelectAppsList, sources]); + useEffect(() => { selectAllCheckbox && selectAllSources(); }, [selectAllCheckbox]); From 47dadd9a7a2a01fe925e84d2f6228389ac8c830d Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 8 Aug 2024 13:54:07 +0300 Subject: [PATCH 143/374] chore: wip --- .../add-destination/choose-destination-menu/index.tsx | 4 ++-- .../add-destination/choose-destination-modal-body/index.tsx | 2 +- .../containers/main/destinations/add-destination/index.tsx | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/frontend/webapp/containers/main/destinations/add-destination/choose-destination-menu/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-menu/index.tsx index 9a86b5ac5..76fecd5c9 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/choose-destination-menu/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-menu/index.tsx @@ -15,7 +15,7 @@ interface FilterComponentProps { const InputAndDropdownContainer = styled.div` display: flex; gap: 12px; - width: 438px; + width: 370px; `; const FilterContainer = styled.div` @@ -25,7 +25,7 @@ const FilterContainer = styled.div` `; const DROPDOWN_OPTIONS = [ - { value: 'All', id: 'all' }, + { value: 'All types', id: 'all' }, { value: 'Managed', id: 'managed' }, { value: 'Self-hosted', id: 'self hosted' }, ]; diff --git a/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx index 79dab2b4e..ae32bfb44 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx @@ -33,7 +33,7 @@ export function ChooseDestinationModalBody({ const [selectedMonitors, setSelectedMonitors] = useState([]); const [dropdownValue, setDropdownValue] = useState({ id: 'all', - value: 'All', + value: 'All types', }); function handleTagSelect(option: DropdownOption) { diff --git a/frontend/webapp/containers/main/destinations/add-destination/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/index.tsx index 65a578524..725049875 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/index.tsx @@ -1,9 +1,9 @@ import React, { useState } from 'react'; import styled from 'styled-components'; -import { AddDestinationButton, SetupHeader } from '@/components'; +import { useRouter } from 'next/navigation'; import { SectionTitle } from '@/reuseable-components'; import { AddDestinationModal } from './add-destination-modal'; -import { useRouter } from 'next/navigation'; +import { AddDestinationButton, SetupHeader } from '@/components'; const AddDestinationButtonWrapper = styled.div` width: 100%; @@ -39,7 +39,6 @@ export function ChooseDestinationContainer() { }, { label: 'DONE', - // iconSrc: '/icons/common/arrow-black.svg', onClick: () => console.log('Next button clicked'), variant: 'primary', }, From 45f5f6d961b41b1715f5416357bc60ab3fa09b8e Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 8 Aug 2024 14:27:25 +0300 Subject: [PATCH 144/374] chore: wip --- .../destinations/monitors-tap-list/index.tsx | 11 ++++++++--- .../choose-destination-menu/index.tsx | 14 ++++++++------ .../connect-destination-modal-body/index.tsx | 1 + .../main/destinations/add-destination/styled.ts | 3 ++- frontend/webapp/public/icons/monitors/logs.svg | 3 +++ frontend/webapp/public/icons/monitors/metrics.svg | 3 +++ frontend/webapp/public/icons/monitors/traces.svg | 3 +++ .../webapp/reuseable-components/input/index.tsx | 1 + .../webapp/reuseable-components/modal/index.tsx | 1 - frontend/webapp/reuseable-components/tag/index.tsx | 11 +++++------ .../webapp/reuseable-components/tooltip/index.tsx | 13 +++++-------- 11 files changed, 39 insertions(+), 25 deletions(-) create mode 100644 frontend/webapp/public/icons/monitors/logs.svg create mode 100644 frontend/webapp/public/icons/monitors/metrics.svg create mode 100644 frontend/webapp/public/icons/monitors/traces.svg diff --git a/frontend/webapp/components/destinations/monitors-tap-list/index.tsx b/frontend/webapp/components/destinations/monitors-tap-list/index.tsx index c1f288894..198ea3471 100644 --- a/frontend/webapp/components/destinations/monitors-tap-list/index.tsx +++ b/frontend/webapp/components/destinations/monitors-tap-list/index.tsx @@ -2,6 +2,7 @@ import React from 'react'; import styled from 'styled-components'; import { Text, Tag } from '@/reuseable-components'; import { MONITORS_OPTIONS } from '@/utils'; +import Image from 'next/image'; interface MonitorButtonsProps { selectedMonitors: string[]; @@ -34,9 +35,13 @@ const MonitorsTapList: React.FC = ({ isSelected={selectedMonitors.includes(monitor.id)} onClick={() => onMonitorSelect(monitor.id)} > - - {monitor.value} - + monitor + {monitor.value} ))} diff --git a/frontend/webapp/containers/main/destinations/add-destination/choose-destination-menu/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-menu/index.tsx index 76fecd5c9..ecf42141e 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/choose-destination-menu/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-menu/index.tsx @@ -48,12 +48,14 @@ const DestinationFilterComponent: React.FC = ({ return ( - +
+ +
+ + \ No newline at end of file diff --git a/frontend/webapp/public/icons/monitors/metrics.svg b/frontend/webapp/public/icons/monitors/metrics.svg new file mode 100644 index 000000000..8ca883925 --- /dev/null +++ b/frontend/webapp/public/icons/monitors/metrics.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/webapp/public/icons/monitors/traces.svg b/frontend/webapp/public/icons/monitors/traces.svg new file mode 100644 index 000000000..ff6d822d8 --- /dev/null +++ b/frontend/webapp/public/icons/monitors/traces.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/webapp/reuseable-components/input/index.tsx b/frontend/webapp/reuseable-components/input/index.tsx index 7a908ea96..05e674ede 100644 --- a/frontend/webapp/reuseable-components/input/index.tsx +++ b/frontend/webapp/reuseable-components/input/index.tsx @@ -160,6 +160,7 @@ const Input: React.FC = ({ alt="" width={16} height={16} + style={{ marginBottom: 4 }} /> )} diff --git a/frontend/webapp/reuseable-components/modal/index.tsx b/frontend/webapp/reuseable-components/modal/index.tsx index 7404ee698..ecb23a84f 100644 --- a/frontend/webapp/reuseable-components/modal/index.tsx +++ b/frontend/webapp/reuseable-components/modal/index.tsx @@ -33,7 +33,6 @@ const ModalWrapper = styled.div` background: ${({ theme }) => theme.colors.translucent_bg}; border-radius: 40px; border: ${({ theme }) => `1px solid ${theme.colors.border}`}; - width: 1080px; box-shadow: 0px 1px 1px 0px rgba(17, 17, 17, 0.8), 0px 2px 2px 0px rgba(17, 17, 17, 0.8), 0px 5px 5px 0px rgba(17, 17, 17, 0.8), 0px 10px 10px 0px rgba(17, 17, 17, 0.8), diff --git a/frontend/webapp/reuseable-components/tag/index.tsx b/frontend/webapp/reuseable-components/tag/index.tsx index 4e0e32dd2..235d14469 100644 --- a/frontend/webapp/reuseable-components/tag/index.tsx +++ b/frontend/webapp/reuseable-components/tag/index.tsx @@ -13,8 +13,10 @@ const TagContainer = styled.div<{ isSelected: boolean; isDisabled: boolean }>` display: flex; align-items: center; justify-content: center; - padding: 8px 12px; - border-radius: 16px; + height: 36px; + gap: 6px; + padding: 0 12px; + border-radius: 32px; background-color: ${({ theme, isSelected }) => isSelected ? theme.colors.primary : theme.colors.translucent_bg}; cursor: ${({ isDisabled }) => (isDisabled ? 'not-allowed' : 'pointer')}; @@ -25,10 +27,7 @@ const TagContainer = styled.div<{ isSelected: boolean; isDisabled: boolean }>` !isDisabled && css` &:hover { - background-color: ${theme.colors.secondary}; - div { - color: ${theme.colors.primary}; - } + background-color: ${theme.colors.primary}; } `} `; diff --git a/frontend/webapp/reuseable-components/tooltip/index.tsx b/frontend/webapp/reuseable-components/tooltip/index.tsx index 111e8bcb7..4c222c413 100644 --- a/frontend/webapp/reuseable-components/tooltip/index.tsx +++ b/frontend/webapp/reuseable-components/tooltip/index.tsx @@ -11,16 +11,17 @@ const TooltipContainer = styled.div` position: relative; display: inline-block; width: fit-content; + cursor: pointer; `; const TooltipText = styled.div` visibility: hidden; background-color: ${({ theme }) => theme.colors.dark_grey}; - background: #1a1a1a; - color: #fff; + border: 1px solid ${({ theme }) => theme.colors.border}; + color: ${({ theme }) => theme.text.primary}; text-align: center; - border-radius: 4px; + border-radius: 32px; padding: 8px; position: absolute; z-index: 1; @@ -38,10 +39,6 @@ const TooltipText = styled.div` z-index: 99999; top: 100%; /* At the bottom of the tooltip */ left: 50%; - margin-left: -5px; - border-width: 5px; - border-style: solid; - border-color: #1a1a1a transparent transparent transparent; } `; @@ -66,7 +63,7 @@ const Tooltip: React.FC = ({ text, children }) => { {children} {hasText && ( - {text} + {text} )} From d9a8420618985fc0e2bf48207c88b137fa8b7a5e Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 8 Aug 2024 15:48:11 +0300 Subject: [PATCH 145/374] chore: wip --- .../connect-destination-modal-body/index.tsx | 54 +++++++++++-------- .../dynamic-form-fields/index.tsx | 2 +- .../checkbox-list/index.tsx | 47 +++++++--------- 3 files changed, 51 insertions(+), 52 deletions(-) diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index 965fc9de2..304fb3fb8 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -19,6 +19,7 @@ import { useQuery } from '@apollo/client'; import styled from 'styled-components'; import { DynamicConnectDestinationFormFields } from '../dynamic-form-fields'; import { useConnectDestinationForm } from '@/hooks'; + const SIDE_MENU_DATA: StepProps[] = [ { title: 'DESTINATIONS', @@ -54,7 +55,7 @@ export function ConnectDestinationModalBody({ skip: !destination, } ); - const [checkedState, setCheckedState] = useState([]); + const [exportedSignals, setExportedSignals] = useState({}); const [destinationName, setDestinationName] = useState(''); const [dynamicFields, setDynamicFields] = useState([]); const [formData, setFormData] = useState>({}); @@ -64,32 +65,23 @@ export function ConnectDestinationModalBody({ if (!destination) return []; const { logs, metrics, traces } = destination.supportedSignals; + + setExportedSignals({ + logs: logs.supported, + metrics: metrics.supported, + traces: traces.supported, + }); + return [ - logs.supported && { - id: 'logs', - title: 'Logs', - }, - metrics.supported && { - id: 'metrics', - title: 'Metrics', - }, - traces.supported && { - id: 'traces', - title: 'Traces', - }, + logs.supported && { id: 'logs', title: 'Logs' }, + metrics.supported && { id: 'metrics', title: 'Metrics' }, + traces.supported && { id: 'traces', title: 'Traces' }, ].filter(Boolean); }, [destination]); useEffect(() => { - data && console.log({ destination, data }); - if (data) { const df = buildFormDynamicFields(data.destinationTypeDetails.fields); - console.log( - 'is missing fileds', - df.length !== data.destinationTypeDetails.fields.length - ); - console.log({ df }); setDynamicFields(df); } }, [data]); @@ -98,8 +90,24 @@ export function ConnectDestinationModalBody({ setFormData((prev) => ({ ...prev, [name]: value })); } + function handleSignalChange(signal: string, value: boolean) { + setExportedSignals((prev) => ({ ...prev, [signal]: value })); + } + function handleSubmit() { - console.log({ formData }); + const fields = Object.entries(formData).map(([name, value]) => ({ + key: name, + value, + })); + + const body = { + name: destinationName, + type: destination?.type, + exportedSignals, + fields, + }; + + console.log({ body }); } if (!destination) return null; @@ -120,10 +128,10 @@ export function ConnectDestinationModalBody({ onChange(field.name, value)} + onChange={(e) => onChange(field.name, e.target.value)} /> ); diff --git a/frontend/webapp/reuseable-components/checkbox-list/index.tsx b/frontend/webapp/reuseable-components/checkbox-list/index.tsx index 3888efa9b..c84594284 100644 --- a/frontend/webapp/reuseable-components/checkbox-list/index.tsx +++ b/frontend/webapp/reuseable-components/checkbox-list/index.tsx @@ -1,7 +1,7 @@ -import React, { useState, useEffect } from 'react'; +import React from 'react'; +import { Text } from '../text'; import styled from 'styled-components'; import { Checkbox } from '../checkbox'; -import { Text } from '../text'; interface Monitor { id: string; @@ -12,8 +12,8 @@ interface Monitor { interface CheckboxListProps { monitors: Monitor[]; title?: string; - checkedState?: boolean[]; - setCheckedState: (checkedState: boolean[]) => void; + exportedSignals: { [key: string]: boolean }; + handleSignalChange: (signal: string, value: boolean) => void; } const ListContainer = styled.div` @@ -28,25 +28,19 @@ const TextWrapper = styled.div` const CheckboxList: React.FC = ({ monitors, title, - checkedState = [], - setCheckedState, + exportedSignals, + handleSignalChange, }) => { - useEffect(() => { - // Initialize the checked state with all true if no initial values provided - setCheckedState(Array(monitors.length).fill(true)); - }, [monitors.length]); - - const handleCheckboxChange = (index: number, value: boolean) => { - const newCheckedState = [...checkedState]; - newCheckedState[index] = value; - - // Ensure at least one checkbox remains checked - if (newCheckedState.filter((checked) => checked).length === 0) { - return; - } + function isItemDisabled(item: Monitor) { + const selectedItems = Object.values(exportedSignals).filter( + (value) => value + ); - setCheckedState(newCheckedState); - }; + return ( + monitors.length === 1 || + (selectedItems.length === 1 && exportedSignals[item.id]) + ); + } return (
@@ -58,16 +52,13 @@ const CheckboxList: React.FC = ({ )} - {monitors.map((monitor, index) => ( + {monitors.map((monitor) => ( handleCheckboxChange(index, value)} - disabled={ - checkedState.filter((checked) => checked).length === 1 && - checkedState[index] - } + initialValue={exportedSignals[monitor.id]} + onChange={(value) => handleSignalChange(monitor.id, value)} + disabled={isItemDisabled(monitor)} /> ))} From 80fb9a6d35714dba08523bcd88aa235d9ceddb01 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 8 Aug 2024 16:20:00 +0300 Subject: [PATCH 146/374] chore: create destination mutation --- .../connect-destination-modal-body/index.tsx | 17 ++++++++++---- frontend/webapp/graphql/index.ts | 1 + .../destinations/useConnectDestinationForm.ts | 23 +++++++++++++++++-- .../checkbox-list/index.tsx | 3 ++- frontend/webapp/types/destinations.ts | 13 +++++++++++ 5 files changed, 50 insertions(+), 7 deletions(-) diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index 304fb3fb8..43d87c125 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -1,8 +1,10 @@ import React, { useEffect, useMemo, useState } from 'react'; import { DestinationDetailsResponse, + DestinationInput, DestinationTypeItem, DynamicField, + ExportedSignals, StepProps, } from '@/types'; import { SideMenu } from '@/components'; @@ -55,11 +57,16 @@ export function ConnectDestinationModalBody({ skip: !destination, } ); - const [exportedSignals, setExportedSignals] = useState({}); + const [exportedSignals, setExportedSignals] = useState({ + logs: false, + metrics: false, + traces: false, + }); const [destinationName, setDestinationName] = useState(''); const [dynamicFields, setDynamicFields] = useState([]); const [formData, setFormData] = useState>({}); - const { buildFormDynamicFields } = useConnectDestinationForm(); + const { buildFormDynamicFields, createNewDestination } = + useConnectDestinationForm(); const monitors = useMemo(() => { if (!destination) return []; @@ -100,13 +107,15 @@ export function ConnectDestinationModalBody({ value, })); - const body = { + const body: DestinationInput = { name: destinationName, - type: destination?.type, + type: destination?.type || '', exportedSignals, fields, }; + createNewDestination(body); + console.log({ body }); } diff --git a/frontend/webapp/graphql/index.ts b/frontend/webapp/graphql/index.ts index 3cf1ef310..d0720956a 100644 --- a/frontend/webapp/graphql/index.ts +++ b/frontend/webapp/graphql/index.ts @@ -1 +1,2 @@ export * from './queries'; +export * from './mutations'; diff --git a/frontend/webapp/hooks/destinations/useConnectDestinationForm.ts b/frontend/webapp/hooks/destinations/useConnectDestinationForm.ts index aa1c71fca..6e9b2a2f9 100644 --- a/frontend/webapp/hooks/destinations/useConnectDestinationForm.ts +++ b/frontend/webapp/hooks/destinations/useConnectDestinationForm.ts @@ -1,7 +1,14 @@ import { safeJsonParse } from '@/utils'; -import { DestinationDetailsField, DynamicField } from '@/types'; +import { + DestinationDetailsField, + DestinationInput, + DynamicField, +} from '@/types'; +import { CREATE_DESTINATION } from '@/graphql'; +import { useMutation } from '@apollo/client'; export function useConnectDestinationForm() { + const [createDestination] = useMutation(CREATE_DESTINATION); function buildFormDynamicFields( fields: DestinationDetailsField[] ): DynamicField[] { @@ -61,5 +68,17 @@ export function useConnectDestinationForm() { .filter((field): field is DynamicField => field !== undefined); } - return { buildFormDynamicFields }; + async function createNewDestination(destination: DestinationInput) { + try { + const { data } = await createDestination({ + variables: { destination }, + }); + return data?.createNewDestination?.id; + } catch (error) { + console.error('Error creating new destination:', error); + throw error; + } + } + + return { buildFormDynamicFields, createNewDestination }; } diff --git a/frontend/webapp/reuseable-components/checkbox-list/index.tsx b/frontend/webapp/reuseable-components/checkbox-list/index.tsx index c84594284..47e8f2e17 100644 --- a/frontend/webapp/reuseable-components/checkbox-list/index.tsx +++ b/frontend/webapp/reuseable-components/checkbox-list/index.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { Text } from '../text'; import styled from 'styled-components'; import { Checkbox } from '../checkbox'; +import { ExportedSignals } from '@/types'; interface Monitor { id: string; @@ -12,7 +13,7 @@ interface Monitor { interface CheckboxListProps { monitors: Monitor[]; title?: string; - exportedSignals: { [key: string]: boolean }; + exportedSignals: ExportedSignals; handleSignalChange: (signal: string, value: boolean) => void; } diff --git a/frontend/webapp/types/destinations.ts b/frontend/webapp/types/destinations.ts index 91cc52649..80bcfb7e0 100644 --- a/frontend/webapp/types/destinations.ts +++ b/frontend/webapp/types/destinations.ts @@ -48,6 +48,19 @@ export interface DestinationDetailsResponse { }; } +export interface ExportedSignals { + logs: boolean; + metrics: boolean; + traces: boolean; +} + +export interface DestinationInput { + name: string; + type: string; + exportedSignals: ExportedSignals; + fields: { key: string; value: any }[]; +} + export interface DestinationType { fields: any; display_name: string; From b86f51d10d7ad06a8c897612ed654f2707806683 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 12 Aug 2024 16:33:37 +0300 Subject: [PATCH 147/374] chore: wip --- frontend/webapp/graphql/mutations/index.ts | 2 + .../compute-platform/useConnectSources.ts | 53 +++++++++++++++++++ .../hooks/compute-platform/useNamespace.ts | 24 +++++++-- frontend/webapp/types/index.ts | 1 + frontend/webapp/types/namespace.ts | 4 ++ 5 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 frontend/webapp/hooks/compute-platform/useConnectSources.ts create mode 100644 frontend/webapp/types/namespace.ts diff --git a/frontend/webapp/graphql/mutations/index.ts b/frontend/webapp/graphql/mutations/index.ts index cb9273dc8..77b8f63f9 100644 --- a/frontend/webapp/graphql/mutations/index.ts +++ b/frontend/webapp/graphql/mutations/index.ts @@ -1 +1,3 @@ export * from './destination'; +export * from './source'; +export * from './namespace'; diff --git a/frontend/webapp/hooks/compute-platform/useConnectSources.ts b/frontend/webapp/hooks/compute-platform/useConnectSources.ts new file mode 100644 index 000000000..67a3cad2d --- /dev/null +++ b/frontend/webapp/hooks/compute-platform/useConnectSources.ts @@ -0,0 +1,53 @@ +// hooks/useConnectSources.ts +import { useMutation } from '@apollo/client'; +import { useSelector, useDispatch } from 'react-redux'; +import { CREATE_SOURCE } from '@/graphql'; +import { IAppState, setSources } from '@/store'; +import { K8sActualSource } from '@/types'; +import { useComputePlatform } from './useComputePlatform'; + +type UseConnectSourcesHook = { + createSources: ( + namespace: string, + sources: K8sActualSource[] + ) => Promise; + loading: boolean; + error?: Error; +}; + +export const useConnectSources = (): UseConnectSourcesHook => { + const [persistSourcesMutation, { loading, error }] = + useMutation(CREATE_SOURCE); + const dispatch = useDispatch(); + const sources = useSelector(({ app }: { app: IAppState }) => app.sources); + const { data } = useComputePlatform(); + + const createSources = async (namespace: string) => { + try { + let formattedSources = []; + Object.keys(sources).forEach((key) => { + const newSources = { + sources: sources[key].map((source) => ({ + name: source.name, + kind: source.kind, + selected: source.selected, + })), + }; + + formattedSources.push(newSources); + }); + await persistSourcesMutation({ + variables: { namespace, sources: formattedSources }, + }); + } catch (e) { + console.error('Error creating sources:', e); + throw e; + } + }; + + return { + createSources, + loading, + error, + }; +}; diff --git a/frontend/webapp/hooks/compute-platform/useNamespace.ts b/frontend/webapp/hooks/compute-platform/useNamespace.ts index f8a3cf818..5f9263b58 100644 --- a/frontend/webapp/hooks/compute-platform/useNamespace.ts +++ b/frontend/webapp/hooks/compute-platform/useNamespace.ts @@ -1,11 +1,16 @@ -import { useQuery } from '@apollo/client'; -import { GET_NAMESPACES } from '@/graphql'; -import { ComputePlatform, K8sActualNamespace } from '@/types'; +import { useMutation, useQuery } from '@apollo/client'; +import { GET_NAMESPACES, PERSIST_NAMESPACE } from '@/graphql'; +import { + ComputePlatform, + K8sActualNamespace, + PersistNamespaceItemInput, +} from '@/types'; type UseNamespaceHook = { data?: K8sActualNamespace; loading: boolean; error?: Error; + persistNamespace: (namespace: PersistNamespaceItemInput) => Promise; }; export const useNamespace = ( @@ -17,7 +22,20 @@ export const useNamespace = ( fetchPolicy: 'cache-first', }); + const [persistNamespaceMutation] = useMutation(PERSIST_NAMESPACE); + + const persistNamespace = async (namespace: PersistNamespaceItemInput) => { + try { + await persistNamespaceMutation({ + variables: { namespace }, + }); + } catch (e) { + console.error('Error persisting namespace:', e); + } + }; + return { + persistNamespace, data: data?.computePlatform.k8sActualNamespace, loading, error, diff --git a/frontend/webapp/types/index.ts b/frontend/webapp/types/index.ts index 1f91e3d5b..a19ce702c 100644 --- a/frontend/webapp/types/index.ts +++ b/frontend/webapp/types/index.ts @@ -4,3 +4,4 @@ export * from './actions'; export * from './sources'; export * from './common'; export * from './compute-platform'; +export * from './namespace'; diff --git a/frontend/webapp/types/namespace.ts b/frontend/webapp/types/namespace.ts new file mode 100644 index 000000000..765bdf783 --- /dev/null +++ b/frontend/webapp/types/namespace.ts @@ -0,0 +1,4 @@ +export interface PersistNamespaceItemInput { + name: string; + futureSelected: boolean; +} From 0469b22de1cbc2ced9ce4e8d19eb9714686801a5 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 15 Aug 2024 13:41:39 +0300 Subject: [PATCH 148/374] chore: testing setup apis --- .../connect-destination-modal-body/index.tsx | 13 +- .../main/sources/choose-sources/index.tsx | 1 + frontend/webapp/hooks/destinations/index.ts | 1 + .../destinations/useConnectDestinationForm.ts | 23 +--- .../destinations/useCreateDestination.ts | 21 ++++ frontend/webapp/hooks/setup/index.ts | 1 + frontend/webapp/hooks/setup/useConnectEnv.ts | 113 ++++++++++++++++++ frontend/webapp/hooks/sources/index.ts | 1 + .../webapp/hooks/sources/useCreateSources.ts | 46 +++++++ 9 files changed, 191 insertions(+), 29 deletions(-) create mode 100644 frontend/webapp/hooks/destinations/useCreateDestination.ts create mode 100644 frontend/webapp/hooks/setup/useConnectEnv.ts create mode 100644 frontend/webapp/hooks/sources/useCreateSources.ts diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index 43d87c125..7a4bfec2a 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -20,7 +20,7 @@ import { GET_DESTINATION_TYPE_DETAILS } from '@/graphql'; import { useQuery } from '@apollo/client'; import styled from 'styled-components'; import { DynamicConnectDestinationFormFields } from '../dynamic-form-fields'; -import { useConnectDestinationForm } from '@/hooks'; +import { useConnectDestinationForm, useConnectEnv } from '@/hooks'; const SIDE_MENU_DATA: StepProps[] = [ { @@ -65,8 +65,8 @@ export function ConnectDestinationModalBody({ const [destinationName, setDestinationName] = useState(''); const [dynamicFields, setDynamicFields] = useState([]); const [formData, setFormData] = useState>({}); - const { buildFormDynamicFields, createNewDestination } = - useConnectDestinationForm(); + const { buildFormDynamicFields } = useConnectDestinationForm(); + const { connectEnv, result, loading, error } = useConnectEnv(); const monitors = useMemo(() => { if (!destination) return []; @@ -101,7 +101,7 @@ export function ConnectDestinationModalBody({ setExportedSignals((prev) => ({ ...prev, [signal]: value })); } - function handleSubmit() { + async function handleSubmit() { const fields = Object.entries(formData).map(([name, value]) => ({ key: name, value, @@ -113,10 +113,7 @@ export function ConnectDestinationModalBody({ exportedSignals, fields, }; - - createNewDestination(body); - - console.log({ body }); + await connectEnv(body); } if (!destination) return null; diff --git a/frontend/webapp/containers/main/sources/choose-sources/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/index.tsx index 84d85d18d..d782ec1f8 100644 --- a/frontend/webapp/containers/main/sources/choose-sources/index.tsx +++ b/frontend/webapp/containers/main/sources/choose-sources/index.tsx @@ -61,6 +61,7 @@ export function ChooseSourcesContainer() { dispatch(setSources(selectedItems)); dispatch(setNamespaceFutureSelectAppsList(futureAppsCheckbox)); } + console.log({ selectedOption, selectedItems, futureAppsCheckbox }); router.push('/setup/choose-destination'); } diff --git a/frontend/webapp/hooks/destinations/index.ts b/frontend/webapp/hooks/destinations/index.ts index fdf8dc796..ec9bba927 100644 --- a/frontend/webapp/hooks/destinations/index.ts +++ b/frontend/webapp/hooks/destinations/index.ts @@ -1,3 +1,4 @@ export * from './useDestinations'; export * from './useCheckConnection'; export * from './useConnectDestinationForm'; +export * from './useCreateDestination'; diff --git a/frontend/webapp/hooks/destinations/useConnectDestinationForm.ts b/frontend/webapp/hooks/destinations/useConnectDestinationForm.ts index 6e9b2a2f9..aa1c71fca 100644 --- a/frontend/webapp/hooks/destinations/useConnectDestinationForm.ts +++ b/frontend/webapp/hooks/destinations/useConnectDestinationForm.ts @@ -1,14 +1,7 @@ import { safeJsonParse } from '@/utils'; -import { - DestinationDetailsField, - DestinationInput, - DynamicField, -} from '@/types'; -import { CREATE_DESTINATION } from '@/graphql'; -import { useMutation } from '@apollo/client'; +import { DestinationDetailsField, DynamicField } from '@/types'; export function useConnectDestinationForm() { - const [createDestination] = useMutation(CREATE_DESTINATION); function buildFormDynamicFields( fields: DestinationDetailsField[] ): DynamicField[] { @@ -68,17 +61,5 @@ export function useConnectDestinationForm() { .filter((field): field is DynamicField => field !== undefined); } - async function createNewDestination(destination: DestinationInput) { - try { - const { data } = await createDestination({ - variables: { destination }, - }); - return data?.createNewDestination?.id; - } catch (error) { - console.error('Error creating new destination:', error); - throw error; - } - } - - return { buildFormDynamicFields, createNewDestination }; + return { buildFormDynamicFields }; } diff --git a/frontend/webapp/hooks/destinations/useCreateDestination.ts b/frontend/webapp/hooks/destinations/useCreateDestination.ts new file mode 100644 index 000000000..95b9186fa --- /dev/null +++ b/frontend/webapp/hooks/destinations/useCreateDestination.ts @@ -0,0 +1,21 @@ +import { DestinationInput } from '@/types'; +import { CREATE_DESTINATION } from '@/graphql'; +import { useMutation } from '@apollo/client'; + +export function useCreateDestination() { + const [createDestination] = useMutation(CREATE_DESTINATION); + + async function createNewDestination(destination: DestinationInput) { + try { + const { data } = await createDestination({ + variables: { destination }, + }); + return data?.createNewDestination?.id; + } catch (error) { + console.error('Error creating new destination:', error); + throw error; + } + } + + return { createNewDestination }; +} diff --git a/frontend/webapp/hooks/setup/index.ts b/frontend/webapp/hooks/setup/index.ts index 8241525c2..31100a828 100644 --- a/frontend/webapp/hooks/setup/index.ts +++ b/frontend/webapp/hooks/setup/index.ts @@ -1 +1,2 @@ export * from './useConnect'; +export * from './useConnectEnv'; diff --git a/frontend/webapp/hooks/setup/useConnectEnv.ts b/frontend/webapp/hooks/setup/useConnectEnv.ts new file mode 100644 index 000000000..0973d0591 --- /dev/null +++ b/frontend/webapp/hooks/setup/useConnectEnv.ts @@ -0,0 +1,113 @@ +import { useState, useCallback, useEffect } from 'react'; +import { useCreateSource } from '../sources'; +import { useCreateDestination } from '../destinations'; + +import { + K8sActualSource, + DestinationInput, + PersistNamespaceItemInput, +} from '@/types'; +import { useSelector } from 'react-redux'; +import { useNamespace } from '../compute-platform'; +import { IAppState } from '@/store'; + +type ConnectEnvResult = { + success: boolean; + destinationId?: string; +}; + +export const useConnectEnv = () => { + const { + createSource, + success: sourceSuccess, + loading: sourceLoading, + error: sourceError, + } = useCreateSource(); + const { createNewDestination } = useCreateDestination(); + const { persistNamespace } = useNamespace(undefined); + + const [result, setResult] = useState(null); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(null); + + // Getting data from Redux + const sourcesList = useSelector(({ app }: { app: IAppState }) => app.sources); + const namespaceFutureSelectAppsList = useSelector( + ({ app }: { app: IAppState }) => app.namespaceFutureSelectAppsList + ); + + useEffect(() => { + console.log({ sourcesList, namespaceFutureSelectAppsList }); + }, [namespaceFutureSelectAppsList, sourcesList]); + + const connectEnv = useCallback( + async (destination: DestinationInput) => { + setLoading(true); + setError(null); + setResult(null); + + try { + // Persist namespaces based on namespaceFutureSelectAppsList + for (const namespaceName in namespaceFutureSelectAppsList) { + const futureSelected = namespaceFutureSelectAppsList[namespaceName]; + + const namespace: PersistNamespaceItemInput = { + name: namespaceName, + futureSelected, + }; + + await persistNamespace(namespace); + } + + // Create sources for each namespace in sourcesList + for (const namespaceName in sourcesList) { + const sources = sourcesList[namespaceName].map((source) => ({ + ...source, + selected: true, + })); + await createSource(namespaceName, sources); + + if (sourceError) { + throw new Error( + `Error creating sources for namespace: ${namespaceName}` + ); + } + } + + // Create destination + const destinationId = await createNewDestination(destination); + + if (!destinationId) { + throw new Error('Error creating destination.'); + } + + setResult({ + success: true, + destinationId, + }); + } catch (err) { + setError((err as Error).message); + setResult({ + success: false, + }); + } finally { + setLoading(false); + } + }, + [ + createSource, + createNewDestination, + persistNamespace, + sourceError, + sourcesList, + namespaceFutureSelectAppsList, + ] + ); + + return { + connectEnv, + result, + loading, + error, + }; +}; diff --git a/frontend/webapp/hooks/sources/index.ts b/frontend/webapp/hooks/sources/index.ts index fa6665c03..465944209 100644 --- a/frontend/webapp/hooks/sources/index.ts +++ b/frontend/webapp/hooks/sources/index.ts @@ -1,3 +1,4 @@ export * from './useSources'; export * from './useConnectSourcesMenuState'; export * from './useConnectSourcesList'; +export * from './useCreateSources'; diff --git a/frontend/webapp/hooks/sources/useCreateSources.ts b/frontend/webapp/hooks/sources/useCreateSources.ts new file mode 100644 index 000000000..10d91b79b --- /dev/null +++ b/frontend/webapp/hooks/sources/useCreateSources.ts @@ -0,0 +1,46 @@ +import { CREATE_SOURCE } from '@/graphql'; +import { K8sActualSource } from '@/types'; +import { useMutation } from '@apollo/client'; +import { useState } from 'react'; + +type CreateSourceResponse = { + persistK8sSources: boolean; +}; + +type CreateSourceVariables = { + namespace: string; + sources: K8sActualSource[]; +}; + +export const useCreateSource = () => { + const [createSourceMutation, { data, loading, error }] = useMutation< + CreateSourceResponse, + CreateSourceVariables + >(CREATE_SOURCE); + + const [success, setSuccess] = useState(null); + + const createSource = async ( + namespace: string, + sources: K8sActualSource[] + ) => { + try { + const result = await createSourceMutation({ + variables: { + namespace, + sources, + }, + }); + setSuccess(result.data?.persistK8sSources ?? false); + } catch (err) { + setSuccess(false); + } + }; + + return { + createSource, + success, + loading, + error, + }; +}; From 96a3df78416045789b8a5354104835b7ac9737f4 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 15 Aug 2024 13:52:23 +0300 Subject: [PATCH 149/374] chore: wip --- frontend/webapp/hooks/setup/useConnectEnv.ts | 3 ++- frontend/webapp/hooks/sources/useCreateSources.ts | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/webapp/hooks/setup/useConnectEnv.ts b/frontend/webapp/hooks/setup/useConnectEnv.ts index 0973d0591..0d037e67c 100644 --- a/frontend/webapp/hooks/setup/useConnectEnv.ts +++ b/frontend/webapp/hooks/setup/useConnectEnv.ts @@ -62,7 +62,8 @@ export const useConnectEnv = () => { // Create sources for each namespace in sourcesList for (const namespaceName in sourcesList) { const sources = sourcesList[namespaceName].map((source) => ({ - ...source, + kind: source.kind, + name: source.name, selected: true, })); await createSource(namespaceName, sources); diff --git a/frontend/webapp/hooks/sources/useCreateSources.ts b/frontend/webapp/hooks/sources/useCreateSources.ts index 10d91b79b..da75460ae 100644 --- a/frontend/webapp/hooks/sources/useCreateSources.ts +++ b/frontend/webapp/hooks/sources/useCreateSources.ts @@ -7,9 +7,15 @@ type CreateSourceResponse = { persistK8sSources: boolean; }; +type CreateSourcesArray = { + kind: string; + name: string; + selected: boolean; +}; + type CreateSourceVariables = { namespace: string; - sources: K8sActualSource[]; + sources: CreateSourcesArray[]; }; export const useCreateSource = () => { @@ -22,7 +28,7 @@ export const useCreateSource = () => { const createSource = async ( namespace: string, - sources: K8sActualSource[] + sources: CreateSourcesArray[] ) => { try { const result = await createSourceMutation({ From 35c2d73fb60149a331687722909cbc1bc954f677 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 15 Aug 2024 14:39:33 +0300 Subject: [PATCH 150/374] chore: wip --- frontend/webapp/app/(overview)/overview/page.tsx | 15 ++++++++++++++- .../webapp/graphql/queries/compute-platform.ts | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/frontend/webapp/app/(overview)/overview/page.tsx b/frontend/webapp/app/(overview)/overview/page.tsx index 06ba59a7a..633ecad9e 100644 --- a/frontend/webapp/app/(overview)/overview/page.tsx +++ b/frontend/webapp/app/(overview)/overview/page.tsx @@ -1,10 +1,23 @@ 'use client'; -import React from 'react'; +import React, { useEffect } from 'react'; import { OVERVIEW } from '@/utils'; import { OverviewHeader } from '@/components'; import { DataFlowContainer } from '@/containers'; +import { useQuery } from '@apollo/client'; +import { GET_COMPUTE_PLATFORM } from '@/graphql'; export default function OverviewPage() { + const { data, loading, error } = useQuery(GET_COMPUTE_PLATFORM); + + useEffect(() => { + if (error) { + console.error(error); + } + if (data) { + console.log(data); + } + }, [error, data]); + return ( <> diff --git a/frontend/webapp/graphql/queries/compute-platform.ts b/frontend/webapp/graphql/queries/compute-platform.ts index 548549f8d..6879bbbf3 100644 --- a/frontend/webapp/graphql/queries/compute-platform.ts +++ b/frontend/webapp/graphql/queries/compute-platform.ts @@ -6,6 +6,11 @@ export const GET_COMPUTE_PLATFORM = gql` name k8sActualNamespaces { name + k8sActualSources { + kind + name + numberOfInstances + } } } } From e65f6919e8e38d9f5208d2f767558d0467b17ac4 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 15 Aug 2024 16:30:47 +0300 Subject: [PATCH 151/374] chore: wip --- frontend/graph/schema.resolvers.go | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 4c69ce864..feac02ebb 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -23,7 +23,10 @@ import ( // K8sActualNamespace is the resolver for the k8sActualNamespace field. func (r *computePlatformResolver) K8sActualNamespace(ctx context.Context, obj *model.ComputePlatform, name string) (*model.K8sActualNamespace, error) { - namespaceActualSources, err := services.GetWorkloadsInNamespace(ctx, name, nil) + + instrumentationLabelEnabled := true + + namespaceActualSources, err := services.GetWorkloadsInNamespace(ctx, name, &instrumentationLabelEnabled) if err != nil { return nil, err } @@ -189,8 +192,31 @@ func (r *queryResolver) ComputePlatform(ctx context.Context) (*model.ComputePlat K8sActualNamespaces := make([]*model.K8sActualNamespace, len(namespacesResponse.Namespaces)) for i, namespace := range namespacesResponse.Namespaces { + + instrumentationLabelEnabled := true + + namespaceActualSources, err := services.GetWorkloadsInNamespace(ctx, namespace.Name, &instrumentationLabelEnabled) + if err != nil { + return nil, err + } + + // Convert namespaceActualSources to []*model.K8sActualSource + namespaceActualSourcesPointers := make([]*model.K8sActualSource, len(namespaceActualSources)) + for i, source := range namespaceActualSources { + namespaceActualSourcesPointers[i] = &source + } + + namespace, err := kube.DefaultClient.CoreV1().Namespaces().Get(ctx, namespace.Name, metav1.GetOptions{}) + if err != nil { + return nil, err + } + + nsInstrumented := workload.GetInstrumentationLabelValue(namespace.GetLabels()) + K8sActualNamespaces[i] = &model.K8sActualNamespace{ - Name: namespace.Name, + Name: namespace.Name, + InstrumentationLabelEnabled: nsInstrumented, + K8sActualSources: namespaceActualSourcesPointers, } } From acf7bda9ee8f6d19ccf6080a3d730809fdcbbe53 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 15 Aug 2024 17:00:11 +0300 Subject: [PATCH 152/374] chore: wip --- frontend/graph/schema.resolvers.go | 31 ++++++++----------- .../graphql/queries/compute-platform.ts | 11 +++++-- .../hooks/compute-platform/useNamespace.ts | 5 +-- frontend/webapp/hooks/setup/useConnectEnv.ts | 11 +++---- .../hooks/sources/useConnectSourcesList.ts | 3 +- frontend/webapp/store/slices/app-slice.ts | 8 ++++- 6 files changed, 38 insertions(+), 31 deletions(-) diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index feac02ebb..2106e1c71 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -24,9 +24,7 @@ import ( // K8sActualNamespace is the resolver for the k8sActualNamespace field. func (r *computePlatformResolver) K8sActualNamespace(ctx context.Context, obj *model.ComputePlatform, name string) (*model.K8sActualNamespace, error) { - instrumentationLabelEnabled := true - - namespaceActualSources, err := services.GetWorkloadsInNamespace(ctx, name, &instrumentationLabelEnabled) + namespaceActualSources, err := services.GetWorkloadsInNamespace(ctx, name, nil) if err != nil { return nil, err } @@ -82,7 +80,18 @@ func (r *destinationResolver) Conditions(ctx context.Context, obj *model.Destina // K8sActualSources is the resolver for the k8sActualSources field. func (r *k8sActualNamespaceResolver) K8sActualSources(ctx context.Context, obj *model.K8sActualNamespace, instrumentationLabeled *bool) ([]*model.K8sActualSource, error) { - return obj.K8sActualSources, nil + namespaceActualSources, err := services.GetWorkloadsInNamespace(ctx, obj.Name, instrumentationLabeled) + if err != nil { + return nil, err + } + + // Convert namespaceActualSources to []*model.K8sActualSource + namespaceActualSourcesPointers := make([]*model.K8sActualSource, len(namespaceActualSources)) + for i, source := range namespaceActualSources { + namespaceActualSourcesPointers[i] = &source + } + + return namespaceActualSourcesPointers, nil } // CreateNewDestination is the resolver for the createNewDestination field. @@ -193,19 +202,6 @@ func (r *queryResolver) ComputePlatform(ctx context.Context) (*model.ComputePlat K8sActualNamespaces := make([]*model.K8sActualNamespace, len(namespacesResponse.Namespaces)) for i, namespace := range namespacesResponse.Namespaces { - instrumentationLabelEnabled := true - - namespaceActualSources, err := services.GetWorkloadsInNamespace(ctx, namespace.Name, &instrumentationLabelEnabled) - if err != nil { - return nil, err - } - - // Convert namespaceActualSources to []*model.K8sActualSource - namespaceActualSourcesPointers := make([]*model.K8sActualSource, len(namespaceActualSources)) - for i, source := range namespaceActualSources { - namespaceActualSourcesPointers[i] = &source - } - namespace, err := kube.DefaultClient.CoreV1().Namespaces().Get(ctx, namespace.Name, metav1.GetOptions{}) if err != nil { return nil, err @@ -216,7 +212,6 @@ func (r *queryResolver) ComputePlatform(ctx context.Context) (*model.ComputePlat K8sActualNamespaces[i] = &model.K8sActualNamespace{ Name: namespace.Name, InstrumentationLabelEnabled: nsInstrumented, - K8sActualSources: namespaceActualSourcesPointers, } } diff --git a/frontend/webapp/graphql/queries/compute-platform.ts b/frontend/webapp/graphql/queries/compute-platform.ts index 6879bbbf3..5866e2ff1 100644 --- a/frontend/webapp/graphql/queries/compute-platform.ts +++ b/frontend/webapp/graphql/queries/compute-platform.ts @@ -17,16 +17,23 @@ export const GET_COMPUTE_PLATFORM = gql` `; export const GET_NAMESPACES = gql` - query GetK8sActualNamespace($namespaceName: String!) { + query GetK8sActualNamespace( + $namespaceName: String! + $instrumentationLabeled: Boolean + ) { computePlatform { k8sActualNamespace(name: $namespaceName) { name - k8sActualSources { + instrumentationLabelEnabled + k8sActualSources(instrumentationLabeled: $instrumentationLabeled) { kind name numberOfInstances } } + k8sActualSources { + name + } } } `; diff --git a/frontend/webapp/hooks/compute-platform/useNamespace.ts b/frontend/webapp/hooks/compute-platform/useNamespace.ts index 5f9263b58..ef83e1b97 100644 --- a/frontend/webapp/hooks/compute-platform/useNamespace.ts +++ b/frontend/webapp/hooks/compute-platform/useNamespace.ts @@ -14,11 +14,12 @@ type UseNamespaceHook = { }; export const useNamespace = ( - namespaceName: string | undefined + namespaceName: string | undefined, + instrumentationLabeled = null as boolean | null ): UseNamespaceHook => { const { data, loading, error } = useQuery(GET_NAMESPACES, { skip: !namespaceName, - variables: { namespaceName }, + variables: { namespaceName, instrumentationLabeled }, fetchPolicy: 'cache-first', }); diff --git a/frontend/webapp/hooks/setup/useConnectEnv.ts b/frontend/webapp/hooks/setup/useConnectEnv.ts index 0d037e67c..94834a032 100644 --- a/frontend/webapp/hooks/setup/useConnectEnv.ts +++ b/frontend/webapp/hooks/setup/useConnectEnv.ts @@ -7,9 +7,9 @@ import { DestinationInput, PersistNamespaceItemInput, } from '@/types'; -import { useSelector } from 'react-redux'; +import { useDispatch, useSelector } from 'react-redux'; import { useNamespace } from '../compute-platform'; -import { IAppState } from '@/store'; +import { IAppState, resetState } from '@/store'; type ConnectEnvResult = { success: boolean; @@ -31,15 +31,12 @@ export const useConnectEnv = () => { const [error, setError] = useState(null); // Getting data from Redux + const dispatch = useDispatch(); const sourcesList = useSelector(({ app }: { app: IAppState }) => app.sources); const namespaceFutureSelectAppsList = useSelector( ({ app }: { app: IAppState }) => app.namespaceFutureSelectAppsList ); - useEffect(() => { - console.log({ sourcesList, namespaceFutureSelectAppsList }); - }, [namespaceFutureSelectAppsList, sourcesList]); - const connectEnv = useCallback( async (destination: DestinationInput) => { setLoading(true); @@ -74,7 +71,7 @@ export const useConnectEnv = () => { ); } } - + dispatch(resetState()); // Create destination const destinationId = await createNewDestination(destination); diff --git a/frontend/webapp/hooks/sources/useConnectSourcesList.ts b/frontend/webapp/hooks/sources/useConnectSourcesList.ts index 9565453ec..b5fee7aec 100644 --- a/frontend/webapp/hooks/sources/useConnectSourcesList.ts +++ b/frontend/webapp/hooks/sources/useConnectSourcesList.ts @@ -7,7 +7,8 @@ export const useConnectSourcesList = ({ stateMenu, setSourcesList }) => { const { error, data } = useComputePlatform(); const { data: namespacesData } = useNamespace( - stateMenu.selectedOption?.value + stateMenu.selectedOption?.value, + false ); useEffect(() => { diff --git a/frontend/webapp/store/slices/app-slice.ts b/frontend/webapp/store/slices/app-slice.ts index 643894c65..73364d103 100644 --- a/frontend/webapp/store/slices/app-slice.ts +++ b/frontend/webapp/store/slices/app-slice.ts @@ -30,11 +30,17 @@ export const appSlice = createSlice({ ) => { state.namespaceFutureSelectAppsList = action.payload; }, + // New resetState reducer to reset the state to initial values + resetState: (state) => { + state.sources = initialState.sources; + state.namespaceFutureSelectAppsList = + initialState.namespaceFutureSelectAppsList; + }, }, }); // Action creators are generated for each case reducer function -export const { setSources, setNamespaceFutureSelectAppsList } = +export const { setSources, setNamespaceFutureSelectAppsList, resetState } = appSlice.actions; export const appReducer = appSlice.reducer; From 949d869b2c16dc772aae31215a5c126db366617b Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 15 Aug 2024 17:22:21 +0300 Subject: [PATCH 153/374] chore: wip --- frontend/webapp/app/layout.tsx | 2 +- .../add-destination-modal/index.tsx | 21 ++++++++--- .../connect-destination-modal-body/index.tsx | 36 ++++++++++--------- .../main/sources/choose-sources/index.tsx | 6 ---- 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/frontend/webapp/app/layout.tsx b/frontend/webapp/app/layout.tsx index 9a7036926..dfee65de7 100644 --- a/frontend/webapp/app/layout.tsx +++ b/frontend/webapp/app/layout.tsx @@ -43,7 +43,7 @@ export default function RootLayout({ {/* */} {children} - + {/* */} {/* */} diff --git a/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx index 7378c2020..3ed14e370 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/add-destination-modal/index.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState, useRef } from 'react'; import { useQuery } from '@apollo/client'; import { DestinationTypeItem } from '@/types'; import { GET_DESTINATION_TYPE } from '@/graphql'; @@ -15,6 +15,7 @@ interface DestinationCategory { name: string; items: DestinationTypeItem[]; } + function ModalActionComponent({ onNext, onBack, @@ -37,7 +38,7 @@ function ModalActionComponent({ }, { label: 'DONE', - onClick: onNext, + onClick: onNext, // This will trigger handleSubmit variant: 'primary', }, ] @@ -57,6 +58,8 @@ export function AddDestinationModal({ DestinationTypeItem[] >([]); + const submitRef = useRef<() => void | null>(null); + useEffect(() => { data && buildDestinationTypeList(); }, [data]); @@ -86,7 +89,10 @@ export function AddDestinationModal({ function renderModalBody() { return selectedItem ? ( - + ) : ( {}} + onNext={handleNext} onBack={() => setSelectedItem(undefined)} item={selectedItem} /> diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index 7a4bfec2a..39fba8fa4 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -1,26 +1,25 @@ import React, { useEffect, useMemo, useState } from 'react'; +import styled from 'styled-components'; +import { SideMenu } from '@/components'; +import { useQuery } from '@apollo/client'; +import { useConnectDestinationForm, useConnectEnv } from '@/hooks'; +import { GET_DESTINATION_TYPE_DETAILS } from '@/graphql'; +import { Body, Container, SideMenuWrapper } from '../styled'; +import { DynamicConnectDestinationFormFields } from '../dynamic-form-fields'; import { - DestinationDetailsResponse, - DestinationInput, - DestinationTypeItem, + StepProps, DynamicField, ExportedSignals, - StepProps, + DestinationInput, + DestinationTypeItem, + DestinationDetailsResponse, } from '@/types'; -import { SideMenu } from '@/components'; import { - Button, CheckboxList, Divider, Input, SectionTitle, } from '@/reuseable-components'; -import { Body, Container, SideMenuWrapper } from '../styled'; -import { GET_DESTINATION_TYPE_DETAILS } from '@/graphql'; -import { useQuery } from '@apollo/client'; -import styled from 'styled-components'; -import { DynamicConnectDestinationFormFields } from '../dynamic-form-fields'; -import { useConnectDestinationForm, useConnectEnv } from '@/hooks'; const SIDE_MENU_DATA: StepProps[] = [ { @@ -45,10 +44,12 @@ const FormContainer = styled.div` interface ConnectDestinationModalBodyProps { destination: DestinationTypeItem | undefined; + onSubmitRef: React.MutableRefObject<(() => void) | null>; } export function ConnectDestinationModalBody({ destination, + onSubmitRef, }: ConnectDestinationModalBodyProps) { const { data } = useQuery( GET_DESTINATION_TYPE_DETAILS, @@ -66,8 +67,7 @@ export function ConnectDestinationModalBody({ const [dynamicFields, setDynamicFields] = useState([]); const [formData, setFormData] = useState>({}); const { buildFormDynamicFields } = useConnectDestinationForm(); - const { connectEnv, result, loading, error } = useConnectEnv(); - + const { connectEnv } = useConnectEnv(); const monitors = useMemo(() => { if (!destination) return []; @@ -93,6 +93,11 @@ export function ConnectDestinationModalBody({ } }, [data]); + useEffect(() => { + // Assign handleSubmit to the onSubmitRef so it can be triggered externally + onSubmitRef.current = handleSubmit; + }, [formData, destinationName, exportedSignals]); + function handleDynamicFieldChange(name: string, value: any) { setFormData((prev) => ({ ...prev, [name]: value })); } @@ -149,9 +154,6 @@ export function ConnectDestinationModalBody({ fields={dynamicFields} onChange={handleDynamicFieldChange} /> - diff --git a/frontend/webapp/containers/main/sources/choose-sources/index.tsx b/frontend/webapp/containers/main/sources/choose-sources/index.tsx index d782ec1f8..6228bea41 100644 --- a/frontend/webapp/containers/main/sources/choose-sources/index.tsx +++ b/frontend/webapp/containers/main/sources/choose-sources/index.tsx @@ -61,7 +61,6 @@ export function ChooseSourcesContainer() { dispatch(setSources(selectedItems)); dispatch(setNamespaceFutureSelectAppsList(futureAppsCheckbox)); } - console.log({ selectedOption, selectedItems, futureAppsCheckbox }); router.push('/setup/choose-destination'); } @@ -107,11 +106,6 @@ export function ChooseSourcesContainer() { iconSrc: '/icons/common/arrow-black.svg', onClick: () => onNextClick(), variant: 'primary', - disabled: - !stateMenu.selectedOption || - Object.keys(stateMenu.selectedItems).every( - (value) => stateMenu.selectedItems[value].length === 0 - ), }, ]} /> From f8f90f830044e46c1e1d60265cdbfa080885bd66 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Thu, 15 Aug 2024 17:34:56 +0300 Subject: [PATCH 154/374] chore: wip --- frontend/webapp/app/(overview)/overview/page.tsx | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/frontend/webapp/app/(overview)/overview/page.tsx b/frontend/webapp/app/(overview)/overview/page.tsx index 633ecad9e..06ba59a7a 100644 --- a/frontend/webapp/app/(overview)/overview/page.tsx +++ b/frontend/webapp/app/(overview)/overview/page.tsx @@ -1,23 +1,10 @@ 'use client'; -import React, { useEffect } from 'react'; +import React from 'react'; import { OVERVIEW } from '@/utils'; import { OverviewHeader } from '@/components'; import { DataFlowContainer } from '@/containers'; -import { useQuery } from '@apollo/client'; -import { GET_COMPUTE_PLATFORM } from '@/graphql'; export default function OverviewPage() { - const { data, loading, error } = useQuery(GET_COMPUTE_PLATFORM); - - useEffect(() => { - if (error) { - console.error(error); - } - if (data) { - console.log(data); - } - }, [error, data]); - return ( <> From 617cdaf6ec7165fc20eff3afc8d6646bc898cf99 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 18 Aug 2024 10:46:46 +0300 Subject: [PATCH 155/374] chore: init configured destination --- frontend/graph/generated.go | 685 +++++++++++++++++- frontend/graph/model/destination.go | 13 +- frontend/graph/schema.graphqls | 11 + frontend/graph/schema.resolvers.go | 48 +- frontend/services/destinations.go | 38 +- .../configured-destinations-list/index.tsx | 126 ++++ .../destinations/add-destination/index.tsx | 1 + 7 files changed, 877 insertions(+), 45 deletions(-) create mode 100644 frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index c6b8cc0c4..d11c12513 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -40,6 +40,7 @@ type Config struct { type ResolverRoot interface { ComputePlatform() ComputePlatformResolver + ConfiguredDestination() ConfiguredDestinationResolver Destination() DestinationResolver K8sActualNamespace() K8sActualNamespaceResolver Mutation() MutationResolver @@ -67,6 +68,16 @@ type ComplexityRoot struct { Type func(childComplexity int) int } + ConfiguredDestination struct { + Conditions func(childComplexity int) int + DestinationType func(childComplexity int) int + ExportedSignals func(childComplexity int) int + Fields func(childComplexity int) int + Id func(childComplexity int) int + Name func(childComplexity int) int + Type func(childComplexity int) int + } + Destination struct { Conditions func(childComplexity int) int DestinationType func(childComplexity int) int @@ -155,6 +166,7 @@ type ComplexityRoot struct { Config func(childComplexity int) int DestinationTypeDetails func(childComplexity int, typeArg string) int DestinationTypes func(childComplexity int) int + Destinations func(childComplexity int) int } SourceContainerRuntimeDetails struct { @@ -174,9 +186,10 @@ type ComputePlatformResolver interface { K8sActualSource(ctx context.Context, obj *model.ComputePlatform, name *string, namespace *string, kind *string) (*model.K8sActualSource, error) } +type ConfiguredDestinationResolver interface { + Conditions(ctx context.Context, obj *model.ConfiguredDestination) ([]*model.Condition, error) +} type DestinationResolver interface { - Type(ctx context.Context, obj *model.Destination) (string, error) - Fields(ctx context.Context, obj *model.Destination) ([]string, error) Conditions(ctx context.Context, obj *model.Destination) ([]*model.Condition, error) @@ -192,6 +205,7 @@ type MutationResolver interface { type QueryResolver interface { ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) Config(ctx context.Context) (*model.GetConfigResponse, error) + Destinations(ctx context.Context) ([]*model.ConfiguredDestination, error) DestinationTypes(ctx context.Context) (*model.GetDestinationTypesResponse, error) DestinationTypeDetails(ctx context.Context, typeArg string) (*model.GetDestinationDetailsResponse, error) } @@ -302,6 +316,55 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Condition.Type(childComplexity), true + case "ConfiguredDestination.conditions": + if e.complexity.ConfiguredDestination.Conditions == nil { + break + } + + return e.complexity.ConfiguredDestination.Conditions(childComplexity), true + + case "ConfiguredDestination.destinationType": + if e.complexity.ConfiguredDestination.DestinationType == nil { + break + } + + return e.complexity.ConfiguredDestination.DestinationType(childComplexity), true + + case "ConfiguredDestination.exportedSignals": + if e.complexity.ConfiguredDestination.ExportedSignals == nil { + break + } + + return e.complexity.ConfiguredDestination.ExportedSignals(childComplexity), true + + case "ConfiguredDestination.fields": + if e.complexity.ConfiguredDestination.Fields == nil { + break + } + + return e.complexity.ConfiguredDestination.Fields(childComplexity), true + + case "ConfiguredDestination.id": + if e.complexity.ConfiguredDestination.Id == nil { + break + } + + return e.complexity.ConfiguredDestination.Id(childComplexity), true + + case "ConfiguredDestination.name": + if e.complexity.ConfiguredDestination.Name == nil { + break + } + + return e.complexity.ConfiguredDestination.Name(childComplexity), true + + case "ConfiguredDestination.type": + if e.complexity.ConfiguredDestination.Type == nil { + break + } + + return e.complexity.ConfiguredDestination.Type(childComplexity), true + case "Destination.conditions": if e.complexity.Destination.Conditions == nil { break @@ -663,6 +726,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.DestinationTypes(childComplexity), true + case "Query.destinations": + if e.complexity.Query.Destinations == nil { + break + } + + return e.complexity.Query.Destinations(childComplexity), true + case "SourceContainerRuntimeDetails.containerName": if e.complexity.SourceContainerRuntimeDetails.ContainerName == nil { break @@ -1456,14 +1526,324 @@ func (ec *executionContext) _Condition_lastTransitionTime(ctx context.Context, f if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Condition_lastTransitionTime(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Condition", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Condition_reason(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_reason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Reason, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Condition_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Condition", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Condition_message(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_message(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Condition_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Condition", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ConfiguredDestination_id(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ConfiguredDestination_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Id, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ConfiguredDestination_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ConfiguredDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ConfiguredDestination_name(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ConfiguredDestination_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ConfiguredDestination_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ConfiguredDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ConfiguredDestination_type(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ConfiguredDestination_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ConfiguredDestination_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ConfiguredDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ConfiguredDestination_exportedSignals(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ConfiguredDestination_exportedSignals(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExportedSignals, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.ExportedSignals) + fc.Result = res + return ec.marshalNExportedSignals2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐExportedSignals(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ConfiguredDestination_exportedSignals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ConfiguredDestination", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "traces": + return ec.fieldContext_ExportedSignals_traces(ctx, field) + case "metrics": + return ec.fieldContext_ExportedSignals_metrics(ctx, field) + case "logs": + return ec.fieldContext_ExportedSignals_logs(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ExportedSignals", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ConfiguredDestination_fields(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ConfiguredDestination_fields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Condition_lastTransitionTime(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ConfiguredDestination_fields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Condition", + Object: "ConfiguredDestination", Field: field, IsMethod: false, IsResolver: false, @@ -1474,8 +1854,8 @@ func (ec *executionContext) fieldContext_Condition_lastTransitionTime(_ context. return fc, nil } -func (ec *executionContext) _Condition_reason(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Condition_reason(ctx, field) +func (ec *executionContext) _ConfiguredDestination_destinationType(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ConfiguredDestination_destinationType(ctx, field) if err != nil { return graphql.Null } @@ -1488,35 +1868,50 @@ func (ec *executionContext) _Condition_reason(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Reason, nil + return obj.DestinationType, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(model.DestinationTypesCategoryItem) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNDestinationTypesCategoryItem2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypesCategoryItem(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Condition_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ConfiguredDestination_destinationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Condition", + Object: "ConfiguredDestination", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "type": + return ec.fieldContext_DestinationTypesCategoryItem_type(ctx, field) + case "displayName": + return ec.fieldContext_DestinationTypesCategoryItem_displayName(ctx, field) + case "imageUrl": + return ec.fieldContext_DestinationTypesCategoryItem_imageUrl(ctx, field) + case "supportedSignals": + return ec.fieldContext_DestinationTypesCategoryItem_supportedSignals(ctx, field) + case "testConnectionSupported": + return ec.fieldContext_DestinationTypesCategoryItem_testConnectionSupported(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DestinationTypesCategoryItem", field.Name) }, } return fc, nil } -func (ec *executionContext) _Condition_message(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Condition_message(ctx, field) +func (ec *executionContext) _ConfiguredDestination_conditions(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ConfiguredDestination_conditions(ctx, field) if err != nil { return graphql.Null } @@ -1529,7 +1924,7 @@ func (ec *executionContext) _Condition_message(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Message, nil + return ec.resolvers.ConfiguredDestination().Conditions(rctx, obj) }) if err != nil { ec.Error(ctx, err) @@ -1538,19 +1933,31 @@ func (ec *executionContext) _Condition_message(ctx context.Context, field graphq if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.([]*model.Condition) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOCondition2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Condition_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ConfiguredDestination_conditions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Condition", + Object: "ConfiguredDestination", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "type": + return ec.fieldContext_Condition_type(ctx, field) + case "status": + return ec.fieldContext_Condition_status(ctx, field) + case "lastTransitionTime": + return ec.fieldContext_Condition_lastTransitionTime(ctx, field) + case "reason": + return ec.fieldContext_Condition_reason(ctx, field) + case "message": + return ec.fieldContext_Condition_message(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Condition", field.Name) }, } return fc, nil @@ -1658,7 +2065,7 @@ func (ec *executionContext) _Destination_type(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Destination().Type(rctx, obj) + return obj.Type, nil }) if err != nil { ec.Error(ctx, err) @@ -1679,8 +2086,8 @@ func (ec *executionContext) fieldContext_Destination_type(_ context.Context, fie fc = &graphql.FieldContext{ Object: "Destination", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, @@ -3738,6 +4145,66 @@ func (ec *executionContext) fieldContext_Query_config(_ context.Context, field g return fc, nil } +func (ec *executionContext) _Query_destinations(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_destinations(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Destinations(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.ConfiguredDestination) + fc.Result = res + return ec.marshalNConfiguredDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConfiguredDestinationᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_destinations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ConfiguredDestination_id(ctx, field) + case "name": + return ec.fieldContext_ConfiguredDestination_name(ctx, field) + case "type": + return ec.fieldContext_ConfiguredDestination_type(ctx, field) + case "exportedSignals": + return ec.fieldContext_ConfiguredDestination_exportedSignals(ctx, field) + case "fields": + return ec.fieldContext_ConfiguredDestination_fields(ctx, field) + case "destinationType": + return ec.fieldContext_ConfiguredDestination_destinationType(ctx, field) + case "conditions": + return ec.fieldContext_ConfiguredDestination_conditions(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ConfiguredDestination", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _Query_destinationTypes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_destinationTypes(ctx, field) if err != nil { @@ -6475,40 +6942,57 @@ func (ec *executionContext) _Condition(ctx context.Context, sel ast.SelectionSet return out } -var destinationImplementors = []string{"Destination"} +var configuredDestinationImplementors = []string{"ConfiguredDestination"} -func (ec *executionContext) _Destination(ctx context.Context, sel ast.SelectionSet, obj *model.Destination) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, destinationImplementors) +func (ec *executionContext) _ConfiguredDestination(ctx context.Context, sel ast.SelectionSet, obj *model.ConfiguredDestination) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, configuredDestinationImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("Destination") + out.Values[i] = graphql.MarshalString("ConfiguredDestination") case "id": - out.Values[i] = ec._Destination_id(ctx, field, obj) + out.Values[i] = ec._ConfiguredDestination_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "name": - out.Values[i] = ec._Destination_name(ctx, field, obj) + out.Values[i] = ec._ConfiguredDestination_name(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "type": + out.Values[i] = ec._ConfiguredDestination_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "exportedSignals": + out.Values[i] = ec._ConfiguredDestination_exportedSignals(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "fields": + out.Values[i] = ec._ConfiguredDestination_fields(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "destinationType": + out.Values[i] = ec._ConfiguredDestination_destinationType(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "conditions": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Destination_type(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } + res = ec._ConfiguredDestination_conditions(ctx, field, obj) return res } @@ -6532,6 +7016,55 @@ func (ec *executionContext) _Destination(ctx context.Context, sel ast.SelectionS } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var destinationImplementors = []string{"Destination"} + +func (ec *executionContext) _Destination(ctx context.Context, sel ast.SelectionSet, obj *model.Destination) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, destinationImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Destination") + case "id": + out.Values[i] = ec._Destination_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "name": + out.Values[i] = ec._Destination_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "type": + out.Values[i] = ec._Destination_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } case "exportedSignals": out.Values[i] = ec._Destination_exportedSignals(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -7301,6 +7834,28 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "destinations": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_destinations(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "destinationTypes": field := field @@ -7835,6 +8390,60 @@ func (ec *executionContext) marshalNConditionStatus2githubᚗcomᚋodigosᚑio return v } +func (ec *executionContext) marshalNConfiguredDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConfiguredDestinationᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ConfiguredDestination) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNConfiguredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConfiguredDestination(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNConfiguredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConfiguredDestination(ctx context.Context, sel ast.SelectionSet, v *model.ConfiguredDestination) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._ConfiguredDestination(ctx, sel, v) +} + func (ec *executionContext) marshalNDestination2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestination(ctx context.Context, sel ast.SelectionSet, v model.Destination) graphql.Marshaler { return ec._Destination(ctx, sel, &v) } diff --git a/frontend/graph/model/destination.go b/frontend/graph/model/destination.go index 58a8bea11..cfb462519 100644 --- a/frontend/graph/model/destination.go +++ b/frontend/graph/model/destination.go @@ -1,7 +1,6 @@ package model import ( - "github.com/odigos-io/odigos/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -40,9 +39,19 @@ type ExportedSignals struct { type Destination struct { Id string `json:"id"` Name string `json:"name"` - Type common.DestinationType `json:"type"` + Type string `json:"type"` ExportedSignals ExportedSignals `json:"signals"` Fields map[string]string `json:"fields"` DestinationType DestinationTypesCategoryItem `json:"destination_type"` Conditions []metav1.Condition `json:"conditions,omitempty"` } + +type ConfiguredDestination struct { + Id string `json:"id"` + Name string `json:"name"` + Type string `json:"type"` + ExportedSignals ExportedSignals `json:"signals"` + Fields string `json:"fields"` + DestinationType DestinationTypesCategoryItem `json:"destination_type"` + Conditions []metav1.Condition `json:"conditions,omitempty"` +} diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index 95de2251e..1a50b7dda 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -154,6 +154,16 @@ type Destination { conditions: [Condition!] } +type ConfiguredDestination { + id: ID! + name: String! + type: String! + exportedSignals: ExportedSignals! + fields: String! + destinationType: DestinationTypesCategoryItem! + conditions: [Condition!] +} + type GetConfigResponse { installation: InstallationStatus! } @@ -204,6 +214,7 @@ input PersistNamespaceSourceInput { type Query { computePlatform: ComputePlatform config: GetConfigResponse + destinations: [ConfiguredDestination!]! destinationTypes: GetDestinationTypesResponse destinationTypeDetails(type: String!): GetDestinationDetailsResponse } diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 2106e1c71..e9511e77f 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -23,7 +23,6 @@ import ( // K8sActualNamespace is the resolver for the k8sActualNamespace field. func (r *computePlatformResolver) K8sActualNamespace(ctx context.Context, obj *model.ComputePlatform, name string) (*model.K8sActualNamespace, error) { - namespaceActualSources, err := services.GetWorkloadsInNamespace(ctx, name, nil) if err != nil { return nil, err @@ -63,9 +62,9 @@ func (r *computePlatformResolver) K8sActualSource(ctx context.Context, obj *mode return k8sActualSource, nil } -// Type is the resolver for the type field. -func (r *destinationResolver) Type(ctx context.Context, obj *model.Destination) (string, error) { - panic(fmt.Errorf("not implemented: Type - type")) +// Conditions is the resolver for the conditions field. +func (r *configuredDestinationResolver) Conditions(ctx context.Context, obj *model.ConfiguredDestination) ([]*model.Condition, error) { + panic(fmt.Errorf("not implemented: Conditions - conditions")) } // Fields is the resolver for the fields field. @@ -232,6 +231,31 @@ func (r *queryResolver) Config(ctx context.Context) (*model.GetConfigResponse, e return gqlResponse, nil } +// // Destinations is the resolver for the destinations field. +func (r *queryResolver) Destinations(ctx context.Context) ([]*model.ConfiguredDestination, error) { + // Fetch destinations from the Kubernetes client + odigosns := consts.DefaultOdigosNamespace + dests, err := kube.DefaultClient.OdigosClient.Destinations(odigosns).List(ctx, metav1.ListOptions{}) + if err != nil { + return nil, err + } + + var resp []*model.ConfiguredDestination + for _, dest := range dests.Items { + // Fetch secret fields for the destination + secretFields, err := services.GetDestinationSecretFields(ctx, odigosns, &dest) + if err != nil { + return nil, err + } + + // Convert the k8s destination to the GraphQL destination format + endpointDest := services.K8sDestinationToConfiguredDestination(dest, secretFields) + resp = append(resp, &endpointDest) + } + + return resp, nil +} + // DestinationTypes is the resolver for the destinationTypes field. func (r *queryResolver) DestinationTypes(ctx context.Context) (*model.GetDestinationTypesResponse, error) { destTypes := services.GetDestinationTypes() @@ -270,6 +294,11 @@ func (r *queryResolver) DestinationTypeDetails(ctx context.Context, typeArg stri // ComputePlatform returns ComputePlatformResolver implementation. func (r *Resolver) ComputePlatform() ComputePlatformResolver { return &computePlatformResolver{r} } +// ConfiguredDestination returns ConfiguredDestinationResolver implementation. +func (r *Resolver) ConfiguredDestination() ConfiguredDestinationResolver { + return &configuredDestinationResolver{r} +} + // Destination returns DestinationResolver implementation. func (r *Resolver) Destination() DestinationResolver { return &destinationResolver{r} } @@ -285,7 +314,18 @@ func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} } func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } type computePlatformResolver struct{ *Resolver } +type configuredDestinationResolver struct{ *Resolver } type destinationResolver struct{ *Resolver } type k8sActualNamespaceResolver struct{ *Resolver } type mutationResolver struct{ *Resolver } type queryResolver struct{ *Resolver } + +// !!! WARNING !!! +// The code below was going to be deleted when updating resolvers. It has been copied here so you have +// one last chance to move it out of harms way if you want. There are two reasons this happens: +// - When renaming or deleting a resolver the old code will be put in here. You can safely delete +// it when you're done. +// - You have helper methods in this file. Move them out to keep these resolver files clean. +func (r *configuredDestinationResolver) Fields(ctx context.Context, obj *model.ConfiguredDestination) ([]string, error) { + panic(fmt.Errorf("not implemented: Fields - fields")) +} diff --git a/frontend/services/destinations.go b/frontend/services/destinations.go index 30c1bc77a..22e60f529 100644 --- a/frontend/services/destinations.go +++ b/frontend/services/destinations.go @@ -170,7 +170,7 @@ func K8sDestinationToEndpointFormat(k8sDest v1alpha1.Destination, secretFields m return model.Destination{ Id: k8sDest.Name, Name: destName, - Type: destType, + Type: string(destType), ExportedSignals: model.ExportedSignals{ Traces: isSignalExported(k8sDest, common.TracesObservabilitySignal), Metrics: isSignalExported(k8sDest, common.MetricsObservabilitySignal), @@ -182,6 +182,42 @@ func K8sDestinationToEndpointFormat(k8sDest v1alpha1.Destination, secretFields m } } +func K8sDestinationToConfiguredDestination(k8sDest v1alpha1.Destination, secretFields map[string]string) model.ConfiguredDestination { + destType := k8sDest.Spec.Type + destName := k8sDest.Spec.DestinationName + mergedFields := mergeDataAndSecrets(k8sDest.Spec.Data, secretFields) + destTypeConfig := DestinationTypeConfigToCategoryItem(destinations.GetDestinationByType(string(destType))) + mergedFieldsJSON, err := json.Marshal(mergedFields) + if err != nil { + // Handle error appropriately + mergedFieldsJSON = []byte("{}") // Default to empty JSON object if marshalling fails + } + + var conditions []metav1.Condition + for _, condition := range k8sDest.Status.Conditions { + conditions = append(conditions, metav1.Condition{ + Type: condition.Type, + Status: condition.Status, + Message: condition.Message, + LastTransitionTime: condition.LastTransitionTime, + }) + } + + return model.ConfiguredDestination{ + Id: k8sDest.Name, + Name: destName, + Type: string(destType), + ExportedSignals: model.ExportedSignals{ + Traces: isSignalExported(k8sDest, common.TracesObservabilitySignal), + Metrics: isSignalExported(k8sDest, common.MetricsObservabilitySignal), + Logs: isSignalExported(k8sDest, common.LogsObservabilitySignal), + }, + Fields: string(mergedFieldsJSON), + DestinationType: destTypeConfig, + Conditions: conditions, + } +} + func isSignalExported(dest v1alpha1.Destination, signal common.ObservabilitySignal) bool { for _, s := range dest.Spec.Signals { if s == signal { diff --git a/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx new file mode 100644 index 000000000..bea90a189 --- /dev/null +++ b/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx @@ -0,0 +1,126 @@ +import React from 'react'; +import Image from 'next/image'; +import styled from 'styled-components'; +import { DestinationTypeItem } from '@/types'; +import { Text } from '@/reuseable-components'; + +const Container = styled.div` + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 12px; + align-self: stretch; + border-radius: 16px; + height: 100%; + max-height: 548px; + overflow-y: auto; +`; + +const ListItem = styled.div<{}>` + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + padding: 16px 0px; + transition: background 0.3s; + border-radius: 16px; + + cursor: pointer; + background: rgba(249, 249, 249, 0.04); + + &:hover { + background: rgba(68, 74, 217, 0.24); + } + &:last-child { + margin-bottom: 32px; + } +`; + +const ListItemContent = styled.div` + margin-left: 16px; + display: flex; + gap: 12px; +`; + +const DestinationIconWrapper = styled.div` + display: flex; + width: 36px; + height: 36px; + justify-content: center; + align-items: center; + gap: 8px; + border-radius: 8px; + background: linear-gradient( + 180deg, + rgba(249, 249, 249, 0.06) 0%, + rgba(249, 249, 249, 0.02) 100% + ); +`; + +const SignalsWrapper = styled.div` + display: flex; + gap: 4px; +`; + +const SignalText = styled(Text)` + color: rgba(249, 249, 249, 0.8); + font-size: 10px; + text-transform: capitalize; +`; + +const TextWrapper = styled.div` + display: flex; + flex-direction: column; + height: 36px; + justify-content: space-between; +`; + +interface DestinationsListProps { + items: DestinationTypeItem[]; + setSelectedItems: (item: DestinationTypeItem) => void; +} + +const ConfiguredDestinationsList: React.FC = ({ + items, + setSelectedItems, +}) => { + function renderSupportedSignals(item: DestinationTypeItem) { + const supportedSignals = item.supportedSignals; + const signals = Object.keys(supportedSignals); + const supportedSignalsList = signals.filter( + (signal) => supportedSignals[signal].supported + ); + + return supportedSignalsList.map((signal, index) => ( + + {signal} + {index < supportedSignalsList.length - 1 && ·} + + )); + } + + return ( + + {items.map((item) => ( + setSelectedItems(item)}> + + + destination + + + {item.displayName} + {renderSupportedSignals(item)} + + + + ))} + + ); +}; + +export { ConfiguredDestinationsList }; diff --git a/frontend/webapp/containers/main/destinations/add-destination/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/index.tsx index 725049875..262542412 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/index.tsx @@ -53,6 +53,7 @@ export function ChooseDestinationContainer() { handleOpenModal()} /> +
test
Date: Sun, 18 Aug 2024 13:56:33 +0300 Subject: [PATCH 156/374] chore: wip --- .../configured-destinations-list/index.tsx | 55 ++++++++++++------- .../connect-destination-modal-body/index.tsx | 32 ++++++++++- .../destinations/add-destination/index.tsx | 4 +- frontend/webapp/hooks/setup/useConnectEnv.ts | 4 +- frontend/webapp/store/slices/app-slice.ts | 29 ++++++++-- frontend/webapp/types/destinations.ts | 14 +++++ 6 files changed, 109 insertions(+), 29 deletions(-) diff --git a/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx index bea90a189..ddfe6c377 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx @@ -1,8 +1,10 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import Image from 'next/image'; import styled from 'styled-components'; -import { DestinationTypeItem } from '@/types'; +import { ConfiguredDestination, DestinationTypeItem } from '@/types'; import { Text } from '@/reuseable-components'; +import { useSelector } from 'react-redux'; +import { IAppState } from '@/store'; const Container = styled.div` display: flex; @@ -59,6 +61,7 @@ const DestinationIconWrapper = styled.div` const SignalsWrapper = styled.div` display: flex; + align-items: center; gap: 4px; `; @@ -75,34 +78,44 @@ const TextWrapper = styled.div` justify-content: space-between; `; -interface DestinationsListProps { - items: DestinationTypeItem[]; - setSelectedItems: (item: DestinationTypeItem) => void; -} - -const ConfiguredDestinationsList: React.FC = ({ - items, - setSelectedItems, -}) => { - function renderSupportedSignals(item: DestinationTypeItem) { - const supportedSignals = item.supportedSignals; +interface DestinationsListProps {} + +const ConfiguredDestinationsList: React.FC = ({}) => { + const destinations = useSelector( + ({ app }: { app: IAppState }) => app.configuredDestinationsList + ); + + function renderSupportedSignals(item: ConfiguredDestination) { + const supportedSignals = item.exportedSignals; const signals = Object.keys(supportedSignals); const supportedSignalsList = signals.filter( (signal) => supportedSignals[signal].supported ); - return supportedSignalsList.map((signal, index) => ( - - {signal} - {index < supportedSignalsList.length - 1 && ·} - - )); + return Object.keys(supportedSignals).map( + (signal, index) => + supportedSignals[signal] && ( + + monitor + + {signal} + {index < supportedSignalsList.length - 1 && ( + · + )} + + ) + ); } return ( - {items.map((item) => ( - setSelectedItems(item)}> + {destinations.map((item) => ( + >({}); const { buildFormDynamicFields } = useConnectDestinationForm(); const { connectEnv } = useConnectEnv(); + + const dispatch = useDispatch(); + const monitors = useMemo(() => { if (!destination) return []; @@ -107,18 +113,42 @@ export function ConnectDestinationModalBody({ } async function handleSubmit() { + console.log({ formData, destination, exportedSignals, dynamicFields }); const fields = Object.entries(formData).map(([name, value]) => ({ key: name, value, })); + function storeConfiguredDestination() { + const destinationTypeDetails = dynamicFields.map((field) => ({ + title: field.title, + value: formData[field.name], + })); + + destinationTypeDetails.unshift({ + title: 'Destination name', + value: destinationName, + }); + + const storedDestination: ConfiguredDestination = { + exportedSignals, + destinationTypeDetails, + type: destination?.type || '', + imageUrl: destination?.imageUrl || '', + category: destination?.category || '', + displayName: destination?.displayName || '', + }; + + dispatch(addConfiguredDestination(storedDestination)); + } + const body: DestinationInput = { name: destinationName, type: destination?.type || '', exportedSignals, fields, }; - await connectEnv(body); + await connectEnv(body, storeConfiguredDestination); } if (!destination) return null; diff --git a/frontend/webapp/containers/main/destinations/add-destination/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/index.tsx index 262542412..b7c3693ea 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/index.tsx @@ -4,6 +4,7 @@ import { useRouter } from 'next/navigation'; import { SectionTitle } from '@/reuseable-components'; import { AddDestinationModal } from './add-destination-modal'; import { AddDestinationButton, SetupHeader } from '@/components'; +import { ConfiguredDestinationsList } from './configured-destinations-list'; const AddDestinationButtonWrapper = styled.div` width: 100%; @@ -23,6 +24,7 @@ export function ChooseDestinationContainer() { const [isModalOpen, setModalOpen] = useState(false); const router = useRouter(); + const handleOpenModal = () => setModalOpen(true); const handleCloseModal = () => setModalOpen(false); @@ -53,7 +55,7 @@ export function ChooseDestinationContainer() { handleOpenModal()} /> -
test
+ { ); const connectEnv = useCallback( - async (destination: DestinationInput) => { + async (destination: DestinationInput, callback?: () => void) => { setLoading(true); setError(null); setResult(null); @@ -78,7 +78,7 @@ export const useConnectEnv = () => { if (!destinationId) { throw new Error('Error creating destination.'); } - + callback && callback(); setResult({ success: true, destinationId, diff --git a/frontend/webapp/store/slices/app-slice.ts b/frontend/webapp/store/slices/app-slice.ts index 73364d103..14f84f6a7 100644 --- a/frontend/webapp/store/slices/app-slice.ts +++ b/frontend/webapp/store/slices/app-slice.ts @@ -1,4 +1,4 @@ -import { K8sActualSource } from '@/types'; +import { ConfiguredDestination, K8sActualSource } from '@/types'; import { createSlice } from '@reduxjs/toolkit'; import type { PayloadAction } from '@reduxjs/toolkit'; @@ -7,11 +7,13 @@ export interface IAppState { [key: string]: K8sActualSource[]; }; namespaceFutureSelectAppsList: { [key: string]: boolean }; + configuredDestinationsList: ConfiguredDestination[]; } const initialState: IAppState = { sources: {}, namespaceFutureSelectAppsList: {}, + configuredDestinationsList: [], }; export const appSlice = createSlice({ @@ -30,17 +32,36 @@ export const appSlice = createSlice({ ) => { state.namespaceFutureSelectAppsList = action.payload; }, - // New resetState reducer to reset the state to initial values + addConfiguredDestination: ( + state, + action: PayloadAction + ) => { + state.configuredDestinationsList.push(action.payload); + }, + + setConfiguredDestinationsList: ( + state, + action: PayloadAction + ) => { + state.configuredDestinationsList = action.payload; + }, resetState: (state) => { state.sources = initialState.sources; state.namespaceFutureSelectAppsList = initialState.namespaceFutureSelectAppsList; + state.configuredDestinationsList = + initialState.configuredDestinationsList; }, }, }); // Action creators are generated for each case reducer function -export const { setSources, setNamespaceFutureSelectAppsList, resetState } = - appSlice.actions; +export const { + setSources, + setNamespaceFutureSelectAppsList, + setConfiguredDestinationsList, + addConfiguredDestination, + resetState, +} = appSlice.actions; export const appReducer = appSlice.reducer; diff --git a/frontend/webapp/types/destinations.ts b/frontend/webapp/types/destinations.ts index 80bcfb7e0..100778c9f 100644 --- a/frontend/webapp/types/destinations.ts +++ b/frontend/webapp/types/destinations.ts @@ -61,6 +61,20 @@ export interface DestinationInput { fields: { key: string; value: any }[]; } +type DestinationTypeDetail = { + title: string; + value: string; +}; + +export type ConfiguredDestination = { + displayName: string; + category: string; + type: string; + exportedSignals: ExportedSignals; + imageUrl: string; + destinationTypeDetails: DestinationTypeDetail[]; +}; + export interface DestinationType { fields: any; display_name: string; From 5b561e56be8652a6a5d7d305b96862e9ca0ca974 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 18 Aug 2024 15:29:17 +0300 Subject: [PATCH 157/374] chore: wip --- .../configured-destination-fields/index.tsx | 45 ++++++ .../webapp/components/destinations/index.ts | 1 + .../configured-destinations-list/index.tsx | 136 +++++++++++++----- frontend/webapp/types/destinations.ts | 2 +- 4 files changed, 148 insertions(+), 36 deletions(-) create mode 100644 frontend/webapp/components/destinations/configured-destination-fields/index.tsx diff --git a/frontend/webapp/components/destinations/configured-destination-fields/index.tsx b/frontend/webapp/components/destinations/configured-destination-fields/index.tsx new file mode 100644 index 000000000..926dc0fc9 --- /dev/null +++ b/frontend/webapp/components/destinations/configured-destination-fields/index.tsx @@ -0,0 +1,45 @@ +import { Text } from '@/reuseable-components'; +import { DestinationTypeDetail } from '@/types'; +import React from 'react'; +import styled from 'styled-components'; + +type ConfiguredDestinationFieldsProps = { + details: DestinationTypeDetail[]; +}; + +const ListContainer = styled.div` + display: flex; + flex-wrap: wrap; + gap: 40px; +`; + +const ListItem = styled.div``; + +const ItemTitle = styled(Text)` + color: #b8b8b8; + font-size: 10px; + line-height: 16px; +`; + +const ItemValue = styled(Text)` + word-break: break-all; + color: ${({ theme }) => theme.colors.text}; + font-size: 12px; + font-weight: 300; + line-height: 18px; +`; + +export const ConfiguredDestinationFields: React.FC< + ConfiguredDestinationFieldsProps +> = ({ details }) => { + return ( + + {details.map((detail, index) => ( + + {detail.title} + {detail.value} + + ))} + + ); +}; diff --git a/frontend/webapp/components/destinations/index.ts b/frontend/webapp/components/destinations/index.ts index e7e4b7330..9ca5e77cb 100644 --- a/frontend/webapp/components/destinations/index.ts +++ b/frontend/webapp/components/destinations/index.ts @@ -1,2 +1,3 @@ export * from './add-destination-button'; export * from './monitors-tap-list'; +export * from './configured-destination-fields'; diff --git a/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx index ddfe6c377..c9cc03751 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx @@ -1,10 +1,11 @@ -import React, { useEffect } from 'react'; +import React from 'react'; import Image from 'next/image'; +import { IAppState } from '@/store'; import styled from 'styled-components'; -import { ConfiguredDestination, DestinationTypeItem } from '@/types'; -import { Text } from '@/reuseable-components'; import { useSelector } from 'react-redux'; -import { IAppState } from '@/store'; +import { Divider, Text } from '@/reuseable-components'; +import { ConfiguredDestination } from '@/types'; +import { ConfiguredDestinationFields } from '@/components'; const Container = styled.div` display: flex; @@ -18,24 +19,27 @@ const Container = styled.div` overflow-y: auto; `; -const ListItem = styled.div<{}>` +const ListItem = styled.div` + width: 100%; + border-radius: 16px; + background: ${({ theme }) => theme.colors.translucent_bg}; +`; + +const ListItemBody = styled.div` + width: 100%; + padding: 16px; +`; + +const ListItemHeader = styled.div` display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 16px 0px; - transition: background 0.3s; - border-radius: 16px; - cursor: pointer; - background: rgba(249, 249, 249, 0.04); - - &:hover { - background: rgba(68, 74, 217, 0.24); - } - &:last-child { + /* &:last-child { margin-bottom: 32px; - } + } */ `; const ListItemContent = styled.div` @@ -78,12 +82,43 @@ const TextWrapper = styled.div` justify-content: space-between; `; +const ExpandIconContainer = styled.div` + display: flex; + justify-content: center; + align-items: center; + margin-right: 16px; +`; + +const IconBorder = styled.div` + height: 16px; + width: 1px; + margin-right: 12px; + background: ${({ theme }) => theme.colors.border}; +`; + +const ExpandIconWrapper = styled.div<{ expand?: boolean }>` + display: flex; + width: 36px; + height: 36px; + cursor: pointer; + justify-content: center; + align-items: center; + border-radius: 100%; + transition: background 0.3s ease 0s, transform 0.3s ease 0s; + transform: ${({ expand }) => (expand ? 'rotate(180deg)' : 'rotate(0deg)')}; + &:hover { + background: ${({ theme }) => theme.colors.translucent_bg}; + } +`; + interface DestinationsListProps {} -const ConfiguredDestinationsList: React.FC = ({}) => { - const destinations = useSelector( - ({ app }: { app: IAppState }) => app.configuredDestinationsList - ); +function ConfiguredDestinationsListItem({ + item, +}: { + item: ConfiguredDestination; +}) { + const [expand, setExpand] = React.useState(false); function renderSupportedSignals(item: ConfiguredDestination) { const supportedSignals = item.exportedSignals; @@ -112,25 +147,56 @@ const ConfiguredDestinationsList: React.FC = ({}) => { ); } + return ( + + + + + destination + + + {item.displayName} + {renderSupportedSignals(item)} + + + + + + setExpand(!expand)}> + destination + + + + + {expand && ( + + + + + )} + + ); +} + +const ConfiguredDestinationsList: React.FC = ({}) => { + const destinations = useSelector( + ({ app }: { app: IAppState }) => app.configuredDestinationsList + ); + return ( {destinations.map((item) => ( - - - - destination - - - {item.displayName} - {renderSupportedSignals(item)} - - - + ))} ); diff --git a/frontend/webapp/types/destinations.ts b/frontend/webapp/types/destinations.ts index 100778c9f..c08f24ba6 100644 --- a/frontend/webapp/types/destinations.ts +++ b/frontend/webapp/types/destinations.ts @@ -61,7 +61,7 @@ export interface DestinationInput { fields: { key: string; value: any }[]; } -type DestinationTypeDetail = { +export type DestinationTypeDetail = { title: string; value: string; }; From 5fce209659c094c81459a7b8d5b2956fb3c7342b Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 18 Aug 2024 15:43:31 +0300 Subject: [PATCH 158/374] chore: configured destinations list --- .../configured-destinations-list/index.tsx | 8 ++------ .../connect-destination-modal-body/index.tsx | 1 - frontend/webapp/hooks/setup/useConnectEnv.ts | 12 ++++-------- frontend/webapp/store/slices/app-slice.ts | 6 ++++++ 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx index c9cc03751..c9a4730bf 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx @@ -3,8 +3,8 @@ import Image from 'next/image'; import { IAppState } from '@/store'; import styled from 'styled-components'; import { useSelector } from 'react-redux'; -import { Divider, Text } from '@/reuseable-components'; import { ConfiguredDestination } from '@/types'; +import { Divider, Text } from '@/reuseable-components'; import { ConfiguredDestinationFields } from '@/components'; const Container = styled.div` @@ -12,8 +12,8 @@ const Container = styled.div` flex-direction: column; align-items: flex-start; gap: 12px; + margin-top: 24px; align-self: stretch; - border-radius: 16px; height: 100%; max-height: 548px; overflow-y: auto; @@ -36,10 +36,6 @@ const ListItemHeader = styled.div` justify-content: space-between; width: 100%; padding: 16px 0px; - - /* &:last-child { - margin-bottom: 32px; - } */ `; const ListItemContent = styled.div` diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index 43297abf4..358b25daf 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -113,7 +113,6 @@ export function ConnectDestinationModalBody({ } async function handleSubmit() { - console.log({ formData, destination, exportedSignals, dynamicFields }); const fields = Object.entries(formData).map(([name, value]) => ({ key: name, value, diff --git a/frontend/webapp/hooks/setup/useConnectEnv.ts b/frontend/webapp/hooks/setup/useConnectEnv.ts index b3112b928..16107b315 100644 --- a/frontend/webapp/hooks/setup/useConnectEnv.ts +++ b/frontend/webapp/hooks/setup/useConnectEnv.ts @@ -1,15 +1,11 @@ -import { useState, useCallback, useEffect } from 'react'; +import { useState, useCallback } from 'react'; import { useCreateSource } from '../sources'; import { useCreateDestination } from '../destinations'; -import { - K8sActualSource, - DestinationInput, - PersistNamespaceItemInput, -} from '@/types'; +import { DestinationInput, PersistNamespaceItemInput } from '@/types'; import { useDispatch, useSelector } from 'react-redux'; import { useNamespace } from '../compute-platform'; -import { IAppState, resetState } from '@/store'; +import { IAppState, resetSources } from '@/store'; type ConnectEnvResult = { success: boolean; @@ -71,7 +67,7 @@ export const useConnectEnv = () => { ); } } - dispatch(resetState()); + dispatch(resetSources()); // Create destination const destinationId = await createNewDestination(destination); diff --git a/frontend/webapp/store/slices/app-slice.ts b/frontend/webapp/store/slices/app-slice.ts index 14f84f6a7..3856944b6 100644 --- a/frontend/webapp/store/slices/app-slice.ts +++ b/frontend/webapp/store/slices/app-slice.ts @@ -45,6 +45,11 @@ export const appSlice = createSlice({ ) => { state.configuredDestinationsList = action.payload; }, + resetSources: (state) => { + state.sources = initialState.sources; + state.namespaceFutureSelectAppsList = + initialState.namespaceFutureSelectAppsList; + }, resetState: (state) => { state.sources = initialState.sources; state.namespaceFutureSelectAppsList = @@ -62,6 +67,7 @@ export const { setConfiguredDestinationsList, addConfiguredDestination, resetState, + resetSources, } = appSlice.actions; export const appReducer = appSlice.reducer; From 3aa2c688b8f11fb2f4a4350b024589e8adbf0294 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 18 Aug 2024 16:06:59 +0300 Subject: [PATCH 159/374] chore: wip --- .../app/setup/choose-destination/page.tsx | 11 ++++++ .../webapp/app/setup/choose-sources/page.tsx | 11 ++++++ frontend/webapp/app/setup/layout.tsx | 10 ------ .../webapp/components/setup/menu/index.tsx | 34 +++++++++++++++---- 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/frontend/webapp/app/setup/choose-destination/page.tsx b/frontend/webapp/app/setup/choose-destination/page.tsx index 92ffac25a..5c3d45c92 100644 --- a/frontend/webapp/app/setup/choose-destination/page.tsx +++ b/frontend/webapp/app/setup/choose-destination/page.tsx @@ -1,10 +1,21 @@ 'use client'; import React from 'react'; +import styled from 'styled-components'; +import { SideMenu } from '@/components'; import { ChooseDestinationContainer } from '@/containers/main'; +const SideMenuWrapper = styled.div` + position: absolute; + left: 24px; + top: 144px; +`; + export default function ChooseDestinationPage() { return ( <> + + + ); diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx index 3c0fbed5a..f26adbe68 100644 --- a/frontend/webapp/app/setup/choose-sources/page.tsx +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -1,10 +1,21 @@ 'use client'; import React from 'react'; +import styled from 'styled-components'; +import { SideMenu } from '@/components'; import { ChooseSourcesContainer } from '@/containers/main'; +const SideMenuWrapper = styled.div` + position: absolute; + left: 24px; + top: 144px; +`; + export default function ChooseSourcesPage() { return ( <> + + + ); diff --git a/frontend/webapp/app/setup/layout.tsx b/frontend/webapp/app/setup/layout.tsx index 8de0ce226..6e7cab11e 100644 --- a/frontend/webapp/app/setup/layout.tsx +++ b/frontend/webapp/app/setup/layout.tsx @@ -1,7 +1,6 @@ 'use client'; import React from 'react'; import styled from 'styled-components'; -import { SideMenu } from '@/components'; const LayoutContainer = styled.div` width: 100%; @@ -12,12 +11,6 @@ const LayoutContainer = styled.div` flex-direction: column; `; -const SideMenuWrapper = styled.div` - position: absolute; - left: 24px; - top: 144px; -`; - const MainContent = styled.div` display: flex; max-width: 1440px; @@ -33,9 +26,6 @@ export default function SetupLayout({ }) { return ( - - - {children} ); diff --git a/frontend/webapp/components/setup/menu/index.tsx b/frontend/webapp/components/setup/menu/index.tsx index 7bf3d5e33..89249f8ec 100644 --- a/frontend/webapp/components/setup/menu/index.tsx +++ b/frontend/webapp/components/setup/menu/index.tsx @@ -1,7 +1,7 @@ -import { Text } from '@/reuseable-components'; -import { StepProps } from '@/types'; import Image from 'next/image'; -import React from 'react'; +import { StepProps } from '@/types'; +import React, { useEffect } from 'react'; +import { Text } from '@/reuseable-components'; import styled, { css } from 'styled-components'; const Container = styled.div` @@ -14,7 +14,7 @@ const Step = styled.div<{ state: 'finish' | 'active' | 'disabled' }>` display: flex; gap: 16px; padding: 10px 0; - cursor: ${({ state }) => (state === 'disabled' ? 'not-allowed' : 'pointer')}; + cursor: ${({ state }) => (state === 'disabled' ? 'auto' : 'auto')}; opacity: ${({ state }) => (state === 'disabled' ? 0.5 : 1)}; transition: opacity 0.3s; @@ -59,7 +59,11 @@ const StepTitle = styled(Text)` const StepSubtitle = styled(Text)``; -const SideMenu: React.FC<{ data?: StepProps[] }> = ({ data }) => { +const SideMenu: React.FC<{ data?: StepProps[]; currentStep?: number }> = ({ + data, + currentStep, +}) => { + const [stepsList, setStepsList] = React.useState([]); const steps: StepProps[] = data || [ { title: 'INSTALLATION', @@ -70,6 +74,8 @@ const SideMenu: React.FC<{ data?: StepProps[] }> = ({ data }) => { { title: 'SOURCES', state: 'active', + subtitle: '', + stepNumber: 2, }, { @@ -78,10 +84,26 @@ const SideMenu: React.FC<{ data?: StepProps[] }> = ({ data }) => { stepNumber: 3, }, ]; + useEffect(() => { + console.log({ currentStep }); + if (currentStep) { + const currentSteps = (data || steps).map((step, index) => { + if (index < currentStep - 1) { + return { ...step, state: 'finish' as const }; + } else if (index === currentStep - 1) { + return { ...step, state: 'active' as const }; + } else { + return { ...step, state: 'disabled' as const }; + } + }); + console.log({ currentSteps }); + setStepsList(currentSteps); + } + }, [currentStep, data]); return ( - {steps.map((step, index) => ( + {stepsList.map((step, index) => ( {step.state === 'finish' && ( From 99937735da1681552899487bb2a4ffdbc865074f Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 18 Aug 2024 16:55:43 +0300 Subject: [PATCH 160/374] chore: notification note component --- .../destinations/add-destination/index.tsx | 30 ++++- .../icons/notification/warning-icon.svg | 3 + frontend/webapp/reuseable-components/index.ts | 1 + .../notification-note/index.tsx | 110 ++++++++++++++++++ 4 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 frontend/webapp/public/icons/notification/warning-icon.svg create mode 100644 frontend/webapp/reuseable-components/notification-note/index.tsx diff --git a/frontend/webapp/containers/main/destinations/add-destination/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/index.tsx index b7c3693ea..fa1bd340f 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/index.tsx @@ -1,10 +1,11 @@ import React, { useState } from 'react'; import styled from 'styled-components'; import { useRouter } from 'next/navigation'; -import { SectionTitle } from '@/reuseable-components'; +import { NotificationNote, SectionTitle } from '@/reuseable-components'; import { AddDestinationModal } from './add-destination-modal'; import { AddDestinationButton, SetupHeader } from '@/components'; import { ConfiguredDestinationsList } from './configured-destinations-list'; +import { useSelector } from 'react-redux'; const AddDestinationButtonWrapper = styled.div` width: 100%; @@ -20,11 +21,33 @@ const HeaderWrapper = styled.div` width: 100vw; `; +const NotificationNoteWrapper = styled.div` + margin-top: 24px; +`; + export function ChooseDestinationContainer() { const [isModalOpen, setModalOpen] = useState(false); const router = useRouter(); + const sourcesList = useSelector(({ app }) => app.sources); + console.log({ sourcesList }); + + const isSourcesListEmpty = () => { + const sourceLen = Object.keys(sourcesList).length === 0; + if (sourceLen) { + return true; + } + let empty = true; + for (const source in sourcesList) { + if (sourcesList[source].length > 0) { + empty = false; + break; + } + } + return empty; + }; + const handleOpenModal = () => setModalOpen(true); const handleCloseModal = () => setModalOpen(false); @@ -52,6 +75,11 @@ export function ChooseDestinationContainer() { title="Configure destinations" description="Add backend destinations where collected data will be sent and configure their settings." /> + {isSourcesListEmpty() && ( + + + + )} handleOpenModal()} /> diff --git a/frontend/webapp/public/icons/notification/warning-icon.svg b/frontend/webapp/public/icons/notification/warning-icon.svg new file mode 100644 index 000000000..eb152a716 --- /dev/null +++ b/frontend/webapp/public/icons/notification/warning-icon.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts index 1839e88d6..9054ef153 100644 --- a/frontend/webapp/reuseable-components/index.ts +++ b/frontend/webapp/reuseable-components/index.ts @@ -12,3 +12,4 @@ export * from './modal'; export * from './navigation-buttons'; export * from './tag'; export * from './checkbox-list'; +export * from './notification-note'; diff --git a/frontend/webapp/reuseable-components/notification-note/index.tsx b/frontend/webapp/reuseable-components/notification-note/index.tsx new file mode 100644 index 000000000..385994f26 --- /dev/null +++ b/frontend/webapp/reuseable-components/notification-note/index.tsx @@ -0,0 +1,110 @@ +import React from 'react'; +import styled, { css } from 'styled-components'; +import Image from 'next/image'; +import { Text } from '../text'; + +// Define the notification types +type NotificationType = 'warning' | 'error' | 'success' | 'info'; + +interface NotificationProps { + type: NotificationType; + text: string; +} + +const NotificationContainer = styled.div<{ type: NotificationType }>` + display: flex; + align-items: center; + padding: 12px 16px; + border-radius: 32px; + + background-color: ${({ type }) => { + switch (type) { + case 'warning': + return '#472300'; // Orange + case 'error': + return '#FF4C4C'; // Red + case 'success': + return '#28A745'; // Green + case 'info': + return '#2B2D66'; // Blue + default: + return '#2B2D66'; // Default to info color + } + }}; +`; + +const IconWrapper = styled.div` + margin-right: 12px; + display: flex; + justify-content: center; + align-items: center; +`; + +const Title = styled(Text)<{ type: NotificationType }>` + font-size: 14px; + color: ${({ type }) => { + switch (type) { + case 'warning': + return '#E9CF35'; // Orange + case 'error': + return '#FF4C4C'; // Red + case 'success': + return '#28A745'; // Green + case 'info': + return '#2B2D66'; // Blue + default: + return '#2B2D66'; // Default to info color + } + }}; +`; + +// Icons can be dynamically rendered based on the type +const NotificationIcon = ({ type }: { type: NotificationType }) => { + switch (type) { + case 'warning': + return ( + warning + ); + case 'error': + return ( + error + ); + case 'success': + return ( + success + ); + case 'info': + default: + return ( + info + ); + } +}; + +const NotificationNote: React.FC = ({ type, text }) => { + return ( + + + + + {text} + + ); +}; + +export { NotificationNote }; From 868593d881b829dba6f10e83c99271c803ea6b1d Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 18 Aug 2024 17:05:14 +0300 Subject: [PATCH 161/374] chore: wip --- .../configured-destinations-list/index.tsx | 16 +++++++--------- .../main/destinations/add-destination/index.tsx | 15 +++++++++------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx index c9a4730bf..a989f4164 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx @@ -1,8 +1,6 @@ import React from 'react'; import Image from 'next/image'; -import { IAppState } from '@/store'; import styled from 'styled-components'; -import { useSelector } from 'react-redux'; import { ConfiguredDestination } from '@/types'; import { Divider, Text } from '@/reuseable-components'; import { ConfiguredDestinationFields } from '@/components'; @@ -107,7 +105,9 @@ const ExpandIconWrapper = styled.div<{ expand?: boolean }>` } `; -interface DestinationsListProps {} +interface DestinationsListProps { + data: ConfiguredDestination[]; +} function ConfiguredDestinationsListItem({ item, @@ -184,14 +184,12 @@ function ConfiguredDestinationsListItem({ ); } -const ConfiguredDestinationsList: React.FC = ({}) => { - const destinations = useSelector( - ({ app }: { app: IAppState }) => app.configuredDestinationsList - ); - +const ConfiguredDestinationsList: React.FC = ({ + data, +}) => { return ( - {destinations.map((item) => ( + {data.map((item) => ( ))} diff --git a/frontend/webapp/containers/main/destinations/add-destination/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/index.tsx index fa1bd340f..0443c6bc3 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/index.tsx @@ -1,11 +1,12 @@ import React, { useState } from 'react'; +import { IAppState } from '@/store'; import styled from 'styled-components'; +import { useSelector } from 'react-redux'; import { useRouter } from 'next/navigation'; -import { NotificationNote, SectionTitle } from '@/reuseable-components'; import { AddDestinationModal } from './add-destination-modal'; import { AddDestinationButton, SetupHeader } from '@/components'; +import { NotificationNote, SectionTitle } from '@/reuseable-components'; import { ConfiguredDestinationsList } from './configured-destinations-list'; -import { useSelector } from 'react-redux'; const AddDestinationButtonWrapper = styled.div` width: 100%; @@ -31,13 +32,15 @@ export function ChooseDestinationContainer() { const router = useRouter(); const sourcesList = useSelector(({ app }) => app.sources); - console.log({ sourcesList }); - + const destinations = useSelector( + ({ app }: { app: IAppState }) => app.configuredDestinationsList + ); const isSourcesListEmpty = () => { const sourceLen = Object.keys(sourcesList).length === 0; if (sourceLen) { return true; } + let empty = true; for (const source in sourcesList) { if (sourcesList[source].length > 0) { @@ -75,7 +78,7 @@ export function ChooseDestinationContainer() { title="Configure destinations" description="Add backend destinations where collected data will be sent and configure their settings." /> - {isSourcesListEmpty() && ( + {isSourcesListEmpty() && destinations.length === 0 && ( @@ -83,7 +86,7 @@ export function ChooseDestinationContainer() { handleOpenModal()} /> - + Date: Sun, 18 Aug 2024 17:21:16 +0300 Subject: [PATCH 162/374] Revert "[GEN-1133] feat: configured destinations list" --- frontend/graph/generated.go | 685 +----------------- frontend/graph/model/destination.go | 13 +- frontend/graph/schema.graphqls | 11 - frontend/graph/schema.resolvers.go | 48 +- frontend/services/destinations.go | 38 +- .../app/setup/choose-destination/page.tsx | 11 - .../webapp/app/setup/choose-sources/page.tsx | 11 - frontend/webapp/app/setup/layout.tsx | 10 + .../configured-destination-fields/index.tsx | 45 -- .../webapp/components/destinations/index.ts | 1 - .../webapp/components/setup/menu/index.tsx | 34 +- .../configured-destinations-list/index.tsx | 199 ----- .../connect-destination-modal-body/index.tsx | 31 +- .../destinations/add-destination/index.tsx | 36 +- frontend/webapp/hooks/setup/useConnectEnv.ts | 16 +- .../icons/notification/warning-icon.svg | 3 - frontend/webapp/reuseable-components/index.ts | 1 - .../notification-note/index.tsx | 110 --- frontend/webapp/store/slices/app-slice.ts | 35 +- frontend/webapp/types/destinations.ts | 14 - 20 files changed, 77 insertions(+), 1275 deletions(-) delete mode 100644 frontend/webapp/components/destinations/configured-destination-fields/index.tsx delete mode 100644 frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx delete mode 100644 frontend/webapp/public/icons/notification/warning-icon.svg delete mode 100644 frontend/webapp/reuseable-components/notification-note/index.tsx diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index d11c12513..c6b8cc0c4 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -40,7 +40,6 @@ type Config struct { type ResolverRoot interface { ComputePlatform() ComputePlatformResolver - ConfiguredDestination() ConfiguredDestinationResolver Destination() DestinationResolver K8sActualNamespace() K8sActualNamespaceResolver Mutation() MutationResolver @@ -68,16 +67,6 @@ type ComplexityRoot struct { Type func(childComplexity int) int } - ConfiguredDestination struct { - Conditions func(childComplexity int) int - DestinationType func(childComplexity int) int - ExportedSignals func(childComplexity int) int - Fields func(childComplexity int) int - Id func(childComplexity int) int - Name func(childComplexity int) int - Type func(childComplexity int) int - } - Destination struct { Conditions func(childComplexity int) int DestinationType func(childComplexity int) int @@ -166,7 +155,6 @@ type ComplexityRoot struct { Config func(childComplexity int) int DestinationTypeDetails func(childComplexity int, typeArg string) int DestinationTypes func(childComplexity int) int - Destinations func(childComplexity int) int } SourceContainerRuntimeDetails struct { @@ -186,10 +174,9 @@ type ComputePlatformResolver interface { K8sActualSource(ctx context.Context, obj *model.ComputePlatform, name *string, namespace *string, kind *string) (*model.K8sActualSource, error) } -type ConfiguredDestinationResolver interface { - Conditions(ctx context.Context, obj *model.ConfiguredDestination) ([]*model.Condition, error) -} type DestinationResolver interface { + Type(ctx context.Context, obj *model.Destination) (string, error) + Fields(ctx context.Context, obj *model.Destination) ([]string, error) Conditions(ctx context.Context, obj *model.Destination) ([]*model.Condition, error) @@ -205,7 +192,6 @@ type MutationResolver interface { type QueryResolver interface { ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) Config(ctx context.Context) (*model.GetConfigResponse, error) - Destinations(ctx context.Context) ([]*model.ConfiguredDestination, error) DestinationTypes(ctx context.Context) (*model.GetDestinationTypesResponse, error) DestinationTypeDetails(ctx context.Context, typeArg string) (*model.GetDestinationDetailsResponse, error) } @@ -316,55 +302,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Condition.Type(childComplexity), true - case "ConfiguredDestination.conditions": - if e.complexity.ConfiguredDestination.Conditions == nil { - break - } - - return e.complexity.ConfiguredDestination.Conditions(childComplexity), true - - case "ConfiguredDestination.destinationType": - if e.complexity.ConfiguredDestination.DestinationType == nil { - break - } - - return e.complexity.ConfiguredDestination.DestinationType(childComplexity), true - - case "ConfiguredDestination.exportedSignals": - if e.complexity.ConfiguredDestination.ExportedSignals == nil { - break - } - - return e.complexity.ConfiguredDestination.ExportedSignals(childComplexity), true - - case "ConfiguredDestination.fields": - if e.complexity.ConfiguredDestination.Fields == nil { - break - } - - return e.complexity.ConfiguredDestination.Fields(childComplexity), true - - case "ConfiguredDestination.id": - if e.complexity.ConfiguredDestination.Id == nil { - break - } - - return e.complexity.ConfiguredDestination.Id(childComplexity), true - - case "ConfiguredDestination.name": - if e.complexity.ConfiguredDestination.Name == nil { - break - } - - return e.complexity.ConfiguredDestination.Name(childComplexity), true - - case "ConfiguredDestination.type": - if e.complexity.ConfiguredDestination.Type == nil { - break - } - - return e.complexity.ConfiguredDestination.Type(childComplexity), true - case "Destination.conditions": if e.complexity.Destination.Conditions == nil { break @@ -726,13 +663,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.DestinationTypes(childComplexity), true - case "Query.destinations": - if e.complexity.Query.Destinations == nil { - break - } - - return e.complexity.Query.Destinations(childComplexity), true - case "SourceContainerRuntimeDetails.containerName": if e.complexity.SourceContainerRuntimeDetails.ContainerName == nil { break @@ -1526,324 +1456,14 @@ func (ec *executionContext) _Condition_lastTransitionTime(ctx context.Context, f if resTmp == nil { return graphql.Null } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Condition_lastTransitionTime(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Condition", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _Condition_reason(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Condition_reason(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Reason, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Condition_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Condition", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _Condition_message(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Condition_message(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Message, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Condition_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Condition", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _ConfiguredDestination_id(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ConfiguredDestination_id(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Id, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_ConfiguredDestination_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ConfiguredDestination", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _ConfiguredDestination_name(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ConfiguredDestination_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_ConfiguredDestination_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ConfiguredDestination", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _ConfiguredDestination_type(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ConfiguredDestination_type(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_ConfiguredDestination_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ConfiguredDestination", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) _ConfiguredDestination_exportedSignals(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ConfiguredDestination_exportedSignals(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ExportedSignals, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(model.ExportedSignals) - fc.Result = res - return ec.marshalNExportedSignals2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐExportedSignals(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_ConfiguredDestination_exportedSignals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "ConfiguredDestination", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "traces": - return ec.fieldContext_ExportedSignals_traces(ctx, field) - case "metrics": - return ec.fieldContext_ExportedSignals_metrics(ctx, field) - case "logs": - return ec.fieldContext_ExportedSignals_logs(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ExportedSignals", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _ConfiguredDestination_fields(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ConfiguredDestination_fields(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Fields, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ConfiguredDestination_fields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Condition_lastTransitionTime(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ConfiguredDestination", + Object: "Condition", Field: field, IsMethod: false, IsResolver: false, @@ -1854,8 +1474,8 @@ func (ec *executionContext) fieldContext_ConfiguredDestination_fields(_ context. return fc, nil } -func (ec *executionContext) _ConfiguredDestination_destinationType(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ConfiguredDestination_destinationType(ctx, field) +func (ec *executionContext) _Condition_reason(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_reason(ctx, field) if err != nil { return graphql.Null } @@ -1868,50 +1488,35 @@ func (ec *executionContext) _ConfiguredDestination_destinationType(ctx context.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.DestinationType, nil + return obj.Reason, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(model.DestinationTypesCategoryItem) + res := resTmp.(*string) fc.Result = res - return ec.marshalNDestinationTypesCategoryItem2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationTypesCategoryItem(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ConfiguredDestination_destinationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Condition_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ConfiguredDestination", + Object: "Condition", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "type": - return ec.fieldContext_DestinationTypesCategoryItem_type(ctx, field) - case "displayName": - return ec.fieldContext_DestinationTypesCategoryItem_displayName(ctx, field) - case "imageUrl": - return ec.fieldContext_DestinationTypesCategoryItem_imageUrl(ctx, field) - case "supportedSignals": - return ec.fieldContext_DestinationTypesCategoryItem_supportedSignals(ctx, field) - case "testConnectionSupported": - return ec.fieldContext_DestinationTypesCategoryItem_testConnectionSupported(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type DestinationTypesCategoryItem", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _ConfiguredDestination_conditions(ctx context.Context, field graphql.CollectedField, obj *model.ConfiguredDestination) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_ConfiguredDestination_conditions(ctx, field) +func (ec *executionContext) _Condition_message(ctx context.Context, field graphql.CollectedField, obj *model.Condition) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Condition_message(ctx, field) if err != nil { return graphql.Null } @@ -1924,7 +1529,7 @@ func (ec *executionContext) _ConfiguredDestination_conditions(ctx context.Contex }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.ConfiguredDestination().Conditions(rctx, obj) + return obj.Message, nil }) if err != nil { ec.Error(ctx, err) @@ -1933,31 +1538,19 @@ func (ec *executionContext) _ConfiguredDestination_conditions(ctx context.Contex if resTmp == nil { return graphql.Null } - res := resTmp.([]*model.Condition) + res := resTmp.(*string) fc.Result = res - return ec.marshalOCondition2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConditionᚄ(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ConfiguredDestination_conditions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Condition_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "ConfiguredDestination", + Object: "Condition", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "type": - return ec.fieldContext_Condition_type(ctx, field) - case "status": - return ec.fieldContext_Condition_status(ctx, field) - case "lastTransitionTime": - return ec.fieldContext_Condition_lastTransitionTime(ctx, field) - case "reason": - return ec.fieldContext_Condition_reason(ctx, field) - case "message": - return ec.fieldContext_Condition_message(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Condition", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil @@ -2065,7 +1658,7 @@ func (ec *executionContext) _Destination_type(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Type, nil + return ec.resolvers.Destination().Type(rctx, obj) }) if err != nil { ec.Error(ctx, err) @@ -2086,8 +1679,8 @@ func (ec *executionContext) fieldContext_Destination_type(_ context.Context, fie fc = &graphql.FieldContext{ Object: "Destination", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, @@ -4145,66 +3738,6 @@ func (ec *executionContext) fieldContext_Query_config(_ context.Context, field g return fc, nil } -func (ec *executionContext) _Query_destinations(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_destinations(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Destinations(rctx) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]*model.ConfiguredDestination) - fc.Result = res - return ec.marshalNConfiguredDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConfiguredDestinationᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_destinations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ConfiguredDestination_id(ctx, field) - case "name": - return ec.fieldContext_ConfiguredDestination_name(ctx, field) - case "type": - return ec.fieldContext_ConfiguredDestination_type(ctx, field) - case "exportedSignals": - return ec.fieldContext_ConfiguredDestination_exportedSignals(ctx, field) - case "fields": - return ec.fieldContext_ConfiguredDestination_fields(ctx, field) - case "destinationType": - return ec.fieldContext_ConfiguredDestination_destinationType(ctx, field) - case "conditions": - return ec.fieldContext_ConfiguredDestination_conditions(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ConfiguredDestination", field.Name) - }, - } - return fc, nil -} - func (ec *executionContext) _Query_destinationTypes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_destinationTypes(ctx, field) if err != nil { @@ -6942,57 +6475,40 @@ func (ec *executionContext) _Condition(ctx context.Context, sel ast.SelectionSet return out } -var configuredDestinationImplementors = []string{"ConfiguredDestination"} +var destinationImplementors = []string{"Destination"} -func (ec *executionContext) _ConfiguredDestination(ctx context.Context, sel ast.SelectionSet, obj *model.ConfiguredDestination) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, configuredDestinationImplementors) +func (ec *executionContext) _Destination(ctx context.Context, sel ast.SelectionSet, obj *model.Destination) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, destinationImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("ConfiguredDestination") + out.Values[i] = graphql.MarshalString("Destination") case "id": - out.Values[i] = ec._ConfiguredDestination_id(ctx, field, obj) + out.Values[i] = ec._Destination_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "name": - out.Values[i] = ec._ConfiguredDestination_name(ctx, field, obj) + out.Values[i] = ec._Destination_name(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "type": - out.Values[i] = ec._ConfiguredDestination_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "exportedSignals": - out.Values[i] = ec._ConfiguredDestination_exportedSignals(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "fields": - out.Values[i] = ec._ConfiguredDestination_fields(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "destinationType": - out.Values[i] = ec._ConfiguredDestination_destinationType(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "conditions": field := field - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._ConfiguredDestination_conditions(ctx, field, obj) + res = ec._Destination_type(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } return res } @@ -7016,55 +6532,6 @@ func (ec *executionContext) _ConfiguredDestination(ctx context.Context, sel ast. } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var destinationImplementors = []string{"Destination"} - -func (ec *executionContext) _Destination(ctx context.Context, sel ast.SelectionSet, obj *model.Destination) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, destinationImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Destination") - case "id": - out.Values[i] = ec._Destination_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "name": - out.Values[i] = ec._Destination_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "type": - out.Values[i] = ec._Destination_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } case "exportedSignals": out.Values[i] = ec._Destination_exportedSignals(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -7834,28 +7301,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "destinations": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_destinations(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "destinationTypes": field := field @@ -8390,60 +7835,6 @@ func (ec *executionContext) marshalNConditionStatus2githubᚗcomᚋodigosᚑio return v } -func (ec *executionContext) marshalNConfiguredDestination2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConfiguredDestinationᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ConfiguredDestination) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNConfiguredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConfiguredDestination(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNConfiguredDestination2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐConfiguredDestination(ctx context.Context, sel ast.SelectionSet, v *model.ConfiguredDestination) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._ConfiguredDestination(ctx, sel, v) -} - func (ec *executionContext) marshalNDestination2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestination(ctx context.Context, sel ast.SelectionSet, v model.Destination) graphql.Marshaler { return ec._Destination(ctx, sel, &v) } diff --git a/frontend/graph/model/destination.go b/frontend/graph/model/destination.go index cfb462519..58a8bea11 100644 --- a/frontend/graph/model/destination.go +++ b/frontend/graph/model/destination.go @@ -1,6 +1,7 @@ package model import ( + "github.com/odigos-io/odigos/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -39,19 +40,9 @@ type ExportedSignals struct { type Destination struct { Id string `json:"id"` Name string `json:"name"` - Type string `json:"type"` + Type common.DestinationType `json:"type"` ExportedSignals ExportedSignals `json:"signals"` Fields map[string]string `json:"fields"` DestinationType DestinationTypesCategoryItem `json:"destination_type"` Conditions []metav1.Condition `json:"conditions,omitempty"` } - -type ConfiguredDestination struct { - Id string `json:"id"` - Name string `json:"name"` - Type string `json:"type"` - ExportedSignals ExportedSignals `json:"signals"` - Fields string `json:"fields"` - DestinationType DestinationTypesCategoryItem `json:"destination_type"` - Conditions []metav1.Condition `json:"conditions,omitempty"` -} diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index 1a50b7dda..95de2251e 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -154,16 +154,6 @@ type Destination { conditions: [Condition!] } -type ConfiguredDestination { - id: ID! - name: String! - type: String! - exportedSignals: ExportedSignals! - fields: String! - destinationType: DestinationTypesCategoryItem! - conditions: [Condition!] -} - type GetConfigResponse { installation: InstallationStatus! } @@ -214,7 +204,6 @@ input PersistNamespaceSourceInput { type Query { computePlatform: ComputePlatform config: GetConfigResponse - destinations: [ConfiguredDestination!]! destinationTypes: GetDestinationTypesResponse destinationTypeDetails(type: String!): GetDestinationDetailsResponse } diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index e9511e77f..2106e1c71 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -23,6 +23,7 @@ import ( // K8sActualNamespace is the resolver for the k8sActualNamespace field. func (r *computePlatformResolver) K8sActualNamespace(ctx context.Context, obj *model.ComputePlatform, name string) (*model.K8sActualNamespace, error) { + namespaceActualSources, err := services.GetWorkloadsInNamespace(ctx, name, nil) if err != nil { return nil, err @@ -62,9 +63,9 @@ func (r *computePlatformResolver) K8sActualSource(ctx context.Context, obj *mode return k8sActualSource, nil } -// Conditions is the resolver for the conditions field. -func (r *configuredDestinationResolver) Conditions(ctx context.Context, obj *model.ConfiguredDestination) ([]*model.Condition, error) { - panic(fmt.Errorf("not implemented: Conditions - conditions")) +// Type is the resolver for the type field. +func (r *destinationResolver) Type(ctx context.Context, obj *model.Destination) (string, error) { + panic(fmt.Errorf("not implemented: Type - type")) } // Fields is the resolver for the fields field. @@ -231,31 +232,6 @@ func (r *queryResolver) Config(ctx context.Context) (*model.GetConfigResponse, e return gqlResponse, nil } -// // Destinations is the resolver for the destinations field. -func (r *queryResolver) Destinations(ctx context.Context) ([]*model.ConfiguredDestination, error) { - // Fetch destinations from the Kubernetes client - odigosns := consts.DefaultOdigosNamespace - dests, err := kube.DefaultClient.OdigosClient.Destinations(odigosns).List(ctx, metav1.ListOptions{}) - if err != nil { - return nil, err - } - - var resp []*model.ConfiguredDestination - for _, dest := range dests.Items { - // Fetch secret fields for the destination - secretFields, err := services.GetDestinationSecretFields(ctx, odigosns, &dest) - if err != nil { - return nil, err - } - - // Convert the k8s destination to the GraphQL destination format - endpointDest := services.K8sDestinationToConfiguredDestination(dest, secretFields) - resp = append(resp, &endpointDest) - } - - return resp, nil -} - // DestinationTypes is the resolver for the destinationTypes field. func (r *queryResolver) DestinationTypes(ctx context.Context) (*model.GetDestinationTypesResponse, error) { destTypes := services.GetDestinationTypes() @@ -294,11 +270,6 @@ func (r *queryResolver) DestinationTypeDetails(ctx context.Context, typeArg stri // ComputePlatform returns ComputePlatformResolver implementation. func (r *Resolver) ComputePlatform() ComputePlatformResolver { return &computePlatformResolver{r} } -// ConfiguredDestination returns ConfiguredDestinationResolver implementation. -func (r *Resolver) ConfiguredDestination() ConfiguredDestinationResolver { - return &configuredDestinationResolver{r} -} - // Destination returns DestinationResolver implementation. func (r *Resolver) Destination() DestinationResolver { return &destinationResolver{r} } @@ -314,18 +285,7 @@ func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} } func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } type computePlatformResolver struct{ *Resolver } -type configuredDestinationResolver struct{ *Resolver } type destinationResolver struct{ *Resolver } type k8sActualNamespaceResolver struct{ *Resolver } type mutationResolver struct{ *Resolver } type queryResolver struct{ *Resolver } - -// !!! WARNING !!! -// The code below was going to be deleted when updating resolvers. It has been copied here so you have -// one last chance to move it out of harms way if you want. There are two reasons this happens: -// - When renaming or deleting a resolver the old code will be put in here. You can safely delete -// it when you're done. -// - You have helper methods in this file. Move them out to keep these resolver files clean. -func (r *configuredDestinationResolver) Fields(ctx context.Context, obj *model.ConfiguredDestination) ([]string, error) { - panic(fmt.Errorf("not implemented: Fields - fields")) -} diff --git a/frontend/services/destinations.go b/frontend/services/destinations.go index 22e60f529..30c1bc77a 100644 --- a/frontend/services/destinations.go +++ b/frontend/services/destinations.go @@ -170,7 +170,7 @@ func K8sDestinationToEndpointFormat(k8sDest v1alpha1.Destination, secretFields m return model.Destination{ Id: k8sDest.Name, Name: destName, - Type: string(destType), + Type: destType, ExportedSignals: model.ExportedSignals{ Traces: isSignalExported(k8sDest, common.TracesObservabilitySignal), Metrics: isSignalExported(k8sDest, common.MetricsObservabilitySignal), @@ -182,42 +182,6 @@ func K8sDestinationToEndpointFormat(k8sDest v1alpha1.Destination, secretFields m } } -func K8sDestinationToConfiguredDestination(k8sDest v1alpha1.Destination, secretFields map[string]string) model.ConfiguredDestination { - destType := k8sDest.Spec.Type - destName := k8sDest.Spec.DestinationName - mergedFields := mergeDataAndSecrets(k8sDest.Spec.Data, secretFields) - destTypeConfig := DestinationTypeConfigToCategoryItem(destinations.GetDestinationByType(string(destType))) - mergedFieldsJSON, err := json.Marshal(mergedFields) - if err != nil { - // Handle error appropriately - mergedFieldsJSON = []byte("{}") // Default to empty JSON object if marshalling fails - } - - var conditions []metav1.Condition - for _, condition := range k8sDest.Status.Conditions { - conditions = append(conditions, metav1.Condition{ - Type: condition.Type, - Status: condition.Status, - Message: condition.Message, - LastTransitionTime: condition.LastTransitionTime, - }) - } - - return model.ConfiguredDestination{ - Id: k8sDest.Name, - Name: destName, - Type: string(destType), - ExportedSignals: model.ExportedSignals{ - Traces: isSignalExported(k8sDest, common.TracesObservabilitySignal), - Metrics: isSignalExported(k8sDest, common.MetricsObservabilitySignal), - Logs: isSignalExported(k8sDest, common.LogsObservabilitySignal), - }, - Fields: string(mergedFieldsJSON), - DestinationType: destTypeConfig, - Conditions: conditions, - } -} - func isSignalExported(dest v1alpha1.Destination, signal common.ObservabilitySignal) bool { for _, s := range dest.Spec.Signals { if s == signal { diff --git a/frontend/webapp/app/setup/choose-destination/page.tsx b/frontend/webapp/app/setup/choose-destination/page.tsx index 5c3d45c92..92ffac25a 100644 --- a/frontend/webapp/app/setup/choose-destination/page.tsx +++ b/frontend/webapp/app/setup/choose-destination/page.tsx @@ -1,21 +1,10 @@ 'use client'; import React from 'react'; -import styled from 'styled-components'; -import { SideMenu } from '@/components'; import { ChooseDestinationContainer } from '@/containers/main'; -const SideMenuWrapper = styled.div` - position: absolute; - left: 24px; - top: 144px; -`; - export default function ChooseDestinationPage() { return ( <> - - - ); diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx index f26adbe68..3c0fbed5a 100644 --- a/frontend/webapp/app/setup/choose-sources/page.tsx +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -1,21 +1,10 @@ 'use client'; import React from 'react'; -import styled from 'styled-components'; -import { SideMenu } from '@/components'; import { ChooseSourcesContainer } from '@/containers/main'; -const SideMenuWrapper = styled.div` - position: absolute; - left: 24px; - top: 144px; -`; - export default function ChooseSourcesPage() { return ( <> - - - ); diff --git a/frontend/webapp/app/setup/layout.tsx b/frontend/webapp/app/setup/layout.tsx index 6e7cab11e..8de0ce226 100644 --- a/frontend/webapp/app/setup/layout.tsx +++ b/frontend/webapp/app/setup/layout.tsx @@ -1,6 +1,7 @@ 'use client'; import React from 'react'; import styled from 'styled-components'; +import { SideMenu } from '@/components'; const LayoutContainer = styled.div` width: 100%; @@ -11,6 +12,12 @@ const LayoutContainer = styled.div` flex-direction: column; `; +const SideMenuWrapper = styled.div` + position: absolute; + left: 24px; + top: 144px; +`; + const MainContent = styled.div` display: flex; max-width: 1440px; @@ -26,6 +33,9 @@ export default function SetupLayout({ }) { return ( + + + {children} ); diff --git a/frontend/webapp/components/destinations/configured-destination-fields/index.tsx b/frontend/webapp/components/destinations/configured-destination-fields/index.tsx deleted file mode 100644 index 926dc0fc9..000000000 --- a/frontend/webapp/components/destinations/configured-destination-fields/index.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { Text } from '@/reuseable-components'; -import { DestinationTypeDetail } from '@/types'; -import React from 'react'; -import styled from 'styled-components'; - -type ConfiguredDestinationFieldsProps = { - details: DestinationTypeDetail[]; -}; - -const ListContainer = styled.div` - display: flex; - flex-wrap: wrap; - gap: 40px; -`; - -const ListItem = styled.div``; - -const ItemTitle = styled(Text)` - color: #b8b8b8; - font-size: 10px; - line-height: 16px; -`; - -const ItemValue = styled(Text)` - word-break: break-all; - color: ${({ theme }) => theme.colors.text}; - font-size: 12px; - font-weight: 300; - line-height: 18px; -`; - -export const ConfiguredDestinationFields: React.FC< - ConfiguredDestinationFieldsProps -> = ({ details }) => { - return ( - - {details.map((detail, index) => ( - - {detail.title} - {detail.value} - - ))} - - ); -}; diff --git a/frontend/webapp/components/destinations/index.ts b/frontend/webapp/components/destinations/index.ts index 9ca5e77cb..e7e4b7330 100644 --- a/frontend/webapp/components/destinations/index.ts +++ b/frontend/webapp/components/destinations/index.ts @@ -1,3 +1,2 @@ export * from './add-destination-button'; export * from './monitors-tap-list'; -export * from './configured-destination-fields'; diff --git a/frontend/webapp/components/setup/menu/index.tsx b/frontend/webapp/components/setup/menu/index.tsx index 89249f8ec..7bf3d5e33 100644 --- a/frontend/webapp/components/setup/menu/index.tsx +++ b/frontend/webapp/components/setup/menu/index.tsx @@ -1,7 +1,7 @@ -import Image from 'next/image'; -import { StepProps } from '@/types'; -import React, { useEffect } from 'react'; import { Text } from '@/reuseable-components'; +import { StepProps } from '@/types'; +import Image from 'next/image'; +import React from 'react'; import styled, { css } from 'styled-components'; const Container = styled.div` @@ -14,7 +14,7 @@ const Step = styled.div<{ state: 'finish' | 'active' | 'disabled' }>` display: flex; gap: 16px; padding: 10px 0; - cursor: ${({ state }) => (state === 'disabled' ? 'auto' : 'auto')}; + cursor: ${({ state }) => (state === 'disabled' ? 'not-allowed' : 'pointer')}; opacity: ${({ state }) => (state === 'disabled' ? 0.5 : 1)}; transition: opacity 0.3s; @@ -59,11 +59,7 @@ const StepTitle = styled(Text)` const StepSubtitle = styled(Text)``; -const SideMenu: React.FC<{ data?: StepProps[]; currentStep?: number }> = ({ - data, - currentStep, -}) => { - const [stepsList, setStepsList] = React.useState([]); +const SideMenu: React.FC<{ data?: StepProps[] }> = ({ data }) => { const steps: StepProps[] = data || [ { title: 'INSTALLATION', @@ -74,8 +70,6 @@ const SideMenu: React.FC<{ data?: StepProps[]; currentStep?: number }> = ({ { title: 'SOURCES', state: 'active', - subtitle: '', - stepNumber: 2, }, { @@ -84,26 +78,10 @@ const SideMenu: React.FC<{ data?: StepProps[]; currentStep?: number }> = ({ stepNumber: 3, }, ]; - useEffect(() => { - console.log({ currentStep }); - if (currentStep) { - const currentSteps = (data || steps).map((step, index) => { - if (index < currentStep - 1) { - return { ...step, state: 'finish' as const }; - } else if (index === currentStep - 1) { - return { ...step, state: 'active' as const }; - } else { - return { ...step, state: 'disabled' as const }; - } - }); - console.log({ currentSteps }); - setStepsList(currentSteps); - } - }, [currentStep, data]); return ( - {stepsList.map((step, index) => ( + {steps.map((step, index) => ( {step.state === 'finish' && ( diff --git a/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx deleted file mode 100644 index a989f4164..000000000 --- a/frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx +++ /dev/null @@ -1,199 +0,0 @@ -import React from 'react'; -import Image from 'next/image'; -import styled from 'styled-components'; -import { ConfiguredDestination } from '@/types'; -import { Divider, Text } from '@/reuseable-components'; -import { ConfiguredDestinationFields } from '@/components'; - -const Container = styled.div` - display: flex; - flex-direction: column; - align-items: flex-start; - gap: 12px; - margin-top: 24px; - align-self: stretch; - height: 100%; - max-height: 548px; - overflow-y: auto; -`; - -const ListItem = styled.div` - width: 100%; - border-radius: 16px; - background: ${({ theme }) => theme.colors.translucent_bg}; -`; - -const ListItemBody = styled.div` - width: 100%; - padding: 16px; -`; - -const ListItemHeader = styled.div` - display: flex; - align-items: center; - justify-content: space-between; - width: 100%; - padding: 16px 0px; -`; - -const ListItemContent = styled.div` - margin-left: 16px; - display: flex; - gap: 12px; -`; - -const DestinationIconWrapper = styled.div` - display: flex; - width: 36px; - height: 36px; - justify-content: center; - align-items: center; - gap: 8px; - border-radius: 8px; - background: linear-gradient( - 180deg, - rgba(249, 249, 249, 0.06) 0%, - rgba(249, 249, 249, 0.02) 100% - ); -`; - -const SignalsWrapper = styled.div` - display: flex; - align-items: center; - gap: 4px; -`; - -const SignalText = styled(Text)` - color: rgba(249, 249, 249, 0.8); - font-size: 10px; - text-transform: capitalize; -`; - -const TextWrapper = styled.div` - display: flex; - flex-direction: column; - height: 36px; - justify-content: space-between; -`; - -const ExpandIconContainer = styled.div` - display: flex; - justify-content: center; - align-items: center; - margin-right: 16px; -`; - -const IconBorder = styled.div` - height: 16px; - width: 1px; - margin-right: 12px; - background: ${({ theme }) => theme.colors.border}; -`; - -const ExpandIconWrapper = styled.div<{ expand?: boolean }>` - display: flex; - width: 36px; - height: 36px; - cursor: pointer; - justify-content: center; - align-items: center; - border-radius: 100%; - transition: background 0.3s ease 0s, transform 0.3s ease 0s; - transform: ${({ expand }) => (expand ? 'rotate(180deg)' : 'rotate(0deg)')}; - &:hover { - background: ${({ theme }) => theme.colors.translucent_bg}; - } -`; - -interface DestinationsListProps { - data: ConfiguredDestination[]; -} - -function ConfiguredDestinationsListItem({ - item, -}: { - item: ConfiguredDestination; -}) { - const [expand, setExpand] = React.useState(false); - - function renderSupportedSignals(item: ConfiguredDestination) { - const supportedSignals = item.exportedSignals; - const signals = Object.keys(supportedSignals); - const supportedSignalsList = signals.filter( - (signal) => supportedSignals[signal].supported - ); - - return Object.keys(supportedSignals).map( - (signal, index) => - supportedSignals[signal] && ( - - monitor - - {signal} - {index < supportedSignalsList.length - 1 && ( - · - )} - - ) - ); - } - - return ( - - - - - destination - - - {item.displayName} - {renderSupportedSignals(item)} - - - - - - setExpand(!expand)}> - destination - - - - - {expand && ( - - - - - )} - - ); -} - -const ConfiguredDestinationsList: React.FC = ({ - data, -}) => { - return ( - - {data.map((item) => ( - - ))} - - ); -}; - -export { ConfiguredDestinationsList }; diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index 358b25daf..39fba8fa4 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -13,7 +13,6 @@ import { DestinationInput, DestinationTypeItem, DestinationDetailsResponse, - ConfiguredDestination, } from '@/types'; import { CheckboxList, @@ -21,8 +20,6 @@ import { Input, SectionTitle, } from '@/reuseable-components'; -import { addConfiguredDestination } from '@/store'; -import { useDispatch } from 'react-redux'; const SIDE_MENU_DATA: StepProps[] = [ { @@ -71,9 +68,6 @@ export function ConnectDestinationModalBody({ const [formData, setFormData] = useState>({}); const { buildFormDynamicFields } = useConnectDestinationForm(); const { connectEnv } = useConnectEnv(); - - const dispatch = useDispatch(); - const monitors = useMemo(() => { if (!destination) return []; @@ -118,36 +112,13 @@ export function ConnectDestinationModalBody({ value, })); - function storeConfiguredDestination() { - const destinationTypeDetails = dynamicFields.map((field) => ({ - title: field.title, - value: formData[field.name], - })); - - destinationTypeDetails.unshift({ - title: 'Destination name', - value: destinationName, - }); - - const storedDestination: ConfiguredDestination = { - exportedSignals, - destinationTypeDetails, - type: destination?.type || '', - imageUrl: destination?.imageUrl || '', - category: destination?.category || '', - displayName: destination?.displayName || '', - }; - - dispatch(addConfiguredDestination(storedDestination)); - } - const body: DestinationInput = { name: destinationName, type: destination?.type || '', exportedSignals, fields, }; - await connectEnv(body, storeConfiguredDestination); + await connectEnv(body); } if (!destination) return null; diff --git a/frontend/webapp/containers/main/destinations/add-destination/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/index.tsx index 0443c6bc3..725049875 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/index.tsx @@ -1,12 +1,9 @@ import React, { useState } from 'react'; -import { IAppState } from '@/store'; import styled from 'styled-components'; -import { useSelector } from 'react-redux'; import { useRouter } from 'next/navigation'; +import { SectionTitle } from '@/reuseable-components'; import { AddDestinationModal } from './add-destination-modal'; import { AddDestinationButton, SetupHeader } from '@/components'; -import { NotificationNote, SectionTitle } from '@/reuseable-components'; -import { ConfiguredDestinationsList } from './configured-destinations-list'; const AddDestinationButtonWrapper = styled.div` width: 100%; @@ -22,35 +19,10 @@ const HeaderWrapper = styled.div` width: 100vw; `; -const NotificationNoteWrapper = styled.div` - margin-top: 24px; -`; - export function ChooseDestinationContainer() { const [isModalOpen, setModalOpen] = useState(false); const router = useRouter(); - - const sourcesList = useSelector(({ app }) => app.sources); - const destinations = useSelector( - ({ app }: { app: IAppState }) => app.configuredDestinationsList - ); - const isSourcesListEmpty = () => { - const sourceLen = Object.keys(sourcesList).length === 0; - if (sourceLen) { - return true; - } - - let empty = true; - for (const source in sourcesList) { - if (sourcesList[source].length > 0) { - empty = false; - break; - } - } - return empty; - }; - const handleOpenModal = () => setModalOpen(true); const handleCloseModal = () => setModalOpen(false); @@ -78,15 +50,9 @@ export function ChooseDestinationContainer() { title="Configure destinations" description="Add backend destinations where collected data will be sent and configure their settings." /> - {isSourcesListEmpty() && destinations.length === 0 && ( - - - - )} handleOpenModal()} /> - { ); const connectEnv = useCallback( - async (destination: DestinationInput, callback?: () => void) => { + async (destination: DestinationInput) => { setLoading(true); setError(null); setResult(null); @@ -67,14 +71,14 @@ export const useConnectEnv = () => { ); } } - dispatch(resetSources()); + dispatch(resetState()); // Create destination const destinationId = await createNewDestination(destination); if (!destinationId) { throw new Error('Error creating destination.'); } - callback && callback(); + setResult({ success: true, destinationId, diff --git a/frontend/webapp/public/icons/notification/warning-icon.svg b/frontend/webapp/public/icons/notification/warning-icon.svg deleted file mode 100644 index eb152a716..000000000 --- a/frontend/webapp/public/icons/notification/warning-icon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts index 9054ef153..1839e88d6 100644 --- a/frontend/webapp/reuseable-components/index.ts +++ b/frontend/webapp/reuseable-components/index.ts @@ -12,4 +12,3 @@ export * from './modal'; export * from './navigation-buttons'; export * from './tag'; export * from './checkbox-list'; -export * from './notification-note'; diff --git a/frontend/webapp/reuseable-components/notification-note/index.tsx b/frontend/webapp/reuseable-components/notification-note/index.tsx deleted file mode 100644 index 385994f26..000000000 --- a/frontend/webapp/reuseable-components/notification-note/index.tsx +++ /dev/null @@ -1,110 +0,0 @@ -import React from 'react'; -import styled, { css } from 'styled-components'; -import Image from 'next/image'; -import { Text } from '../text'; - -// Define the notification types -type NotificationType = 'warning' | 'error' | 'success' | 'info'; - -interface NotificationProps { - type: NotificationType; - text: string; -} - -const NotificationContainer = styled.div<{ type: NotificationType }>` - display: flex; - align-items: center; - padding: 12px 16px; - border-radius: 32px; - - background-color: ${({ type }) => { - switch (type) { - case 'warning': - return '#472300'; // Orange - case 'error': - return '#FF4C4C'; // Red - case 'success': - return '#28A745'; // Green - case 'info': - return '#2B2D66'; // Blue - default: - return '#2B2D66'; // Default to info color - } - }}; -`; - -const IconWrapper = styled.div` - margin-right: 12px; - display: flex; - justify-content: center; - align-items: center; -`; - -const Title = styled(Text)<{ type: NotificationType }>` - font-size: 14px; - color: ${({ type }) => { - switch (type) { - case 'warning': - return '#E9CF35'; // Orange - case 'error': - return '#FF4C4C'; // Red - case 'success': - return '#28A745'; // Green - case 'info': - return '#2B2D66'; // Blue - default: - return '#2B2D66'; // Default to info color - } - }}; -`; - -// Icons can be dynamically rendered based on the type -const NotificationIcon = ({ type }: { type: NotificationType }) => { - switch (type) { - case 'warning': - return ( - warning - ); - case 'error': - return ( - error - ); - case 'success': - return ( - success - ); - case 'info': - default: - return ( - info - ); - } -}; - -const NotificationNote: React.FC = ({ type, text }) => { - return ( - - - - - {text} - - ); -}; - -export { NotificationNote }; diff --git a/frontend/webapp/store/slices/app-slice.ts b/frontend/webapp/store/slices/app-slice.ts index 3856944b6..73364d103 100644 --- a/frontend/webapp/store/slices/app-slice.ts +++ b/frontend/webapp/store/slices/app-slice.ts @@ -1,4 +1,4 @@ -import { ConfiguredDestination, K8sActualSource } from '@/types'; +import { K8sActualSource } from '@/types'; import { createSlice } from '@reduxjs/toolkit'; import type { PayloadAction } from '@reduxjs/toolkit'; @@ -7,13 +7,11 @@ export interface IAppState { [key: string]: K8sActualSource[]; }; namespaceFutureSelectAppsList: { [key: string]: boolean }; - configuredDestinationsList: ConfiguredDestination[]; } const initialState: IAppState = { sources: {}, namespaceFutureSelectAppsList: {}, - configuredDestinationsList: [], }; export const appSlice = createSlice({ @@ -32,42 +30,17 @@ export const appSlice = createSlice({ ) => { state.namespaceFutureSelectAppsList = action.payload; }, - addConfiguredDestination: ( - state, - action: PayloadAction - ) => { - state.configuredDestinationsList.push(action.payload); - }, - - setConfiguredDestinationsList: ( - state, - action: PayloadAction - ) => { - state.configuredDestinationsList = action.payload; - }, - resetSources: (state) => { - state.sources = initialState.sources; - state.namespaceFutureSelectAppsList = - initialState.namespaceFutureSelectAppsList; - }, + // New resetState reducer to reset the state to initial values resetState: (state) => { state.sources = initialState.sources; state.namespaceFutureSelectAppsList = initialState.namespaceFutureSelectAppsList; - state.configuredDestinationsList = - initialState.configuredDestinationsList; }, }, }); // Action creators are generated for each case reducer function -export const { - setSources, - setNamespaceFutureSelectAppsList, - setConfiguredDestinationsList, - addConfiguredDestination, - resetState, - resetSources, -} = appSlice.actions; +export const { setSources, setNamespaceFutureSelectAppsList, resetState } = + appSlice.actions; export const appReducer = appSlice.reducer; diff --git a/frontend/webapp/types/destinations.ts b/frontend/webapp/types/destinations.ts index c08f24ba6..80bcfb7e0 100644 --- a/frontend/webapp/types/destinations.ts +++ b/frontend/webapp/types/destinations.ts @@ -61,20 +61,6 @@ export interface DestinationInput { fields: { key: string; value: any }[]; } -export type DestinationTypeDetail = { - title: string; - value: string; -}; - -export type ConfiguredDestination = { - displayName: string; - category: string; - type: string; - exportedSignals: ExportedSignals; - imageUrl: string; - destinationTypeDetails: DestinationTypeDetail[]; -}; - export interface DestinationType { fields: any; display_name: string; From d304c3945e7c25fc0467903d5f82e4a1ea1d6e5e Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Sun, 18 Aug 2024 17:21:40 +0300 Subject: [PATCH 163/374] chore: fixed pr comments" --- frontend/webapp/app/setup/choose-destination/page.tsx | 8 +------- frontend/webapp/app/setup/choose-sources/page.tsx | 8 +------- frontend/webapp/app/setup/styled.ts | 7 +++++++ frontend/webapp/components/setup/menu/index.tsx | 3 +-- 4 files changed, 10 insertions(+), 16 deletions(-) create mode 100644 frontend/webapp/app/setup/styled.ts diff --git a/frontend/webapp/app/setup/choose-destination/page.tsx b/frontend/webapp/app/setup/choose-destination/page.tsx index 5c3d45c92..07187db2a 100644 --- a/frontend/webapp/app/setup/choose-destination/page.tsx +++ b/frontend/webapp/app/setup/choose-destination/page.tsx @@ -1,15 +1,9 @@ 'use client'; import React from 'react'; -import styled from 'styled-components'; import { SideMenu } from '@/components'; +import { SideMenuWrapper } from '../styled'; import { ChooseDestinationContainer } from '@/containers/main'; -const SideMenuWrapper = styled.div` - position: absolute; - left: 24px; - top: 144px; -`; - export default function ChooseDestinationPage() { return ( <> diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx index f26adbe68..a612ab2ae 100644 --- a/frontend/webapp/app/setup/choose-sources/page.tsx +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -1,14 +1,8 @@ 'use client'; import React from 'react'; -import styled from 'styled-components'; import { SideMenu } from '@/components'; import { ChooseSourcesContainer } from '@/containers/main'; - -const SideMenuWrapper = styled.div` - position: absolute; - left: 24px; - top: 144px; -`; +import { SideMenuWrapper } from '../styled'; export default function ChooseSourcesPage() { return ( diff --git a/frontend/webapp/app/setup/styled.ts b/frontend/webapp/app/setup/styled.ts new file mode 100644 index 000000000..2f543a644 --- /dev/null +++ b/frontend/webapp/app/setup/styled.ts @@ -0,0 +1,7 @@ +import styled from 'styled-components'; + +export const SideMenuWrapper = styled.div` + position: absolute; + left: 24px; + top: 144px; +`; diff --git a/frontend/webapp/components/setup/menu/index.tsx b/frontend/webapp/components/setup/menu/index.tsx index 89249f8ec..6c88467fe 100644 --- a/frontend/webapp/components/setup/menu/index.tsx +++ b/frontend/webapp/components/setup/menu/index.tsx @@ -85,7 +85,6 @@ const SideMenu: React.FC<{ data?: StepProps[]; currentStep?: number }> = ({ }, ]; useEffect(() => { - console.log({ currentStep }); if (currentStep) { const currentSteps = (data || steps).map((step, index) => { if (index < currentStep - 1) { @@ -96,7 +95,7 @@ const SideMenu: React.FC<{ data?: StepProps[]; currentStep?: number }> = ({ return { ...step, state: 'disabled' as const }; } }); - console.log({ currentSteps }); + setStepsList(currentSteps); } }, [currentStep, data]); From 68b2e044d9efab3400358a1225248894cd2ce7bd Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 19 Aug 2024 09:19:52 +0300 Subject: [PATCH 164/374] chore: wip --- .../connect-destination-modal-body/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index 358b25daf..629730301 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -2,9 +2,11 @@ import React, { useEffect, useMemo, useState } from 'react'; import styled from 'styled-components'; import { SideMenu } from '@/components'; import { useQuery } from '@apollo/client'; -import { useConnectDestinationForm, useConnectEnv } from '@/hooks'; +import { useDispatch } from 'react-redux'; +import { addConfiguredDestination } from '@/store'; import { GET_DESTINATION_TYPE_DETAILS } from '@/graphql'; import { Body, Container, SideMenuWrapper } from '../styled'; +import { useConnectDestinationForm, useConnectEnv } from '@/hooks'; import { DynamicConnectDestinationFormFields } from '../dynamic-form-fields'; import { StepProps, @@ -21,8 +23,6 @@ import { Input, SectionTitle, } from '@/reuseable-components'; -import { addConfiguredDestination } from '@/store'; -import { useDispatch } from 'react-redux'; const SIDE_MENU_DATA: StepProps[] = [ { From 7f7550e9060ee763a18ab956b94aff8ffd5e9bc7 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 19 Aug 2024 10:13:25 +0300 Subject: [PATCH 165/374] chore: wip --- .../webapp/app/setup/choose-sources/page.tsx | 2 +- frontend/webapp/app/setup/layout.tsx | 10 - .../configured-destination-fields/index.tsx | 45 ++++ .../webapp/components/destinations/index.ts | 1 + .../webapp/components/setup/menu/index.tsx | 14 +- .../choose-destination-modal-body/index.tsx | 2 +- .../configured-destinations-list/index.tsx | 199 ++++++++++++++++++ .../connect-destination-modal-body/index.tsx | 39 +++- .../destinations/add-destination/index.tsx | 36 +++- frontend/webapp/hooks/setup/useConnectEnv.ts | 16 +- .../icons/notification/warning-icon.svg | 3 + frontend/webapp/reuseable-components/index.ts | 1 + .../notification-note/index.tsx | 110 ++++++++++ frontend/webapp/store/slices/app-slice.ts | 35 ++- frontend/webapp/types/destinations.ts | 14 ++ 15 files changed, 488 insertions(+), 39 deletions(-) create mode 100644 frontend/webapp/components/destinations/configured-destination-fields/index.tsx create mode 100644 frontend/webapp/containers/main/destinations/add-destination/configured-destinations-list/index.tsx create mode 100644 frontend/webapp/public/icons/notification/warning-icon.svg create mode 100644 frontend/webapp/reuseable-components/notification-note/index.tsx diff --git a/frontend/webapp/app/setup/choose-sources/page.tsx b/frontend/webapp/app/setup/choose-sources/page.tsx index 4e716f9b2..a612ab2ae 100644 --- a/frontend/webapp/app/setup/choose-sources/page.tsx +++ b/frontend/webapp/app/setup/choose-sources/page.tsx @@ -1,8 +1,8 @@ 'use client'; import React from 'react'; import { SideMenu } from '@/components'; -import { SideMenuWrapper } from '../styled'; import { ChooseSourcesContainer } from '@/containers/main'; +import { SideMenuWrapper } from '../styled'; export default function ChooseSourcesPage() { return ( diff --git a/frontend/webapp/app/setup/layout.tsx b/frontend/webapp/app/setup/layout.tsx index 8de0ce226..6e7cab11e 100644 --- a/frontend/webapp/app/setup/layout.tsx +++ b/frontend/webapp/app/setup/layout.tsx @@ -1,7 +1,6 @@ 'use client'; import React from 'react'; import styled from 'styled-components'; -import { SideMenu } from '@/components'; const LayoutContainer = styled.div` width: 100%; @@ -12,12 +11,6 @@ const LayoutContainer = styled.div` flex-direction: column; `; -const SideMenuWrapper = styled.div` - position: absolute; - left: 24px; - top: 144px; -`; - const MainContent = styled.div` display: flex; max-width: 1440px; @@ -33,9 +26,6 @@ export default function SetupLayout({ }) { return ( - - - {children} ); diff --git a/frontend/webapp/components/destinations/configured-destination-fields/index.tsx b/frontend/webapp/components/destinations/configured-destination-fields/index.tsx new file mode 100644 index 000000000..926dc0fc9 --- /dev/null +++ b/frontend/webapp/components/destinations/configured-destination-fields/index.tsx @@ -0,0 +1,45 @@ +import { Text } from '@/reuseable-components'; +import { DestinationTypeDetail } from '@/types'; +import React from 'react'; +import styled from 'styled-components'; + +type ConfiguredDestinationFieldsProps = { + details: DestinationTypeDetail[]; +}; + +const ListContainer = styled.div` + display: flex; + flex-wrap: wrap; + gap: 40px; +`; + +const ListItem = styled.div``; + +const ItemTitle = styled(Text)` + color: #b8b8b8; + font-size: 10px; + line-height: 16px; +`; + +const ItemValue = styled(Text)` + word-break: break-all; + color: ${({ theme }) => theme.colors.text}; + font-size: 12px; + font-weight: 300; + line-height: 18px; +`; + +export const ConfiguredDestinationFields: React.FC< + ConfiguredDestinationFieldsProps +> = ({ details }) => { + return ( + + {details.map((detail, index) => ( + + {detail.title} + {detail.value} + + ))} + + ); +}; diff --git a/frontend/webapp/components/destinations/index.ts b/frontend/webapp/components/destinations/index.ts index e7e4b7330..9ca5e77cb 100644 --- a/frontend/webapp/components/destinations/index.ts +++ b/frontend/webapp/components/destinations/index.ts @@ -1,2 +1,3 @@ export * from './add-destination-button'; export * from './monitors-tap-list'; +export * from './configured-destination-fields'; diff --git a/frontend/webapp/components/setup/menu/index.tsx b/frontend/webapp/components/setup/menu/index.tsx index 925a9b42d..6c88467fe 100644 --- a/frontend/webapp/components/setup/menu/index.tsx +++ b/frontend/webapp/components/setup/menu/index.tsx @@ -1,7 +1,7 @@ -import { Text } from '@/reuseable-components'; -import { StepProps } from '@/types'; import Image from 'next/image'; +import { StepProps } from '@/types'; import React, { useEffect } from 'react'; +import { Text } from '@/reuseable-components'; import styled, { css } from 'styled-components'; const Container = styled.div` @@ -14,7 +14,7 @@ const Step = styled.div<{ state: 'finish' | 'active' | 'disabled' }>` display: flex; gap: 16px; padding: 10px 0; - cursor: ${({ state }) => (state === 'disabled' ? 'not-allowed' : 'pointer')}; + cursor: ${({ state }) => (state === 'disabled' ? 'auto' : 'auto')}; opacity: ${({ state }) => (state === 'disabled' ? 0.5 : 1)}; transition: opacity 0.3s; @@ -63,9 +63,7 @@ const SideMenu: React.FC<{ data?: StepProps[]; currentStep?: number }> = ({ data, currentStep, }) => { - const [stepsList, setStepsList] = React.useState( - null as any - ); + const [stepsList, setStepsList] = React.useState([]); const steps: StepProps[] = data || [ { title: 'INSTALLATION', @@ -76,6 +74,8 @@ const SideMenu: React.FC<{ data?: StepProps[]; currentStep?: number }> = ({ { title: 'SOURCES', state: 'active', + subtitle: '', + stepNumber: 2, }, { @@ -102,7 +102,7 @@ const SideMenu: React.FC<{ data?: StepProps[]; currentStep?: number }> = ({ return ( - {stepsList?.map((step, index) => ( + {stepsList.map((step, index) => ( {step.state === 'finish' && ( diff --git a/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx index 294c345f3..ae32bfb44 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx @@ -79,7 +79,7 @@ export function ChooseDestinationModalBody({ return ( - + theme.colors.translucent_bg}; +`; + +const ListItemBody = styled.div` + width: 100%; + padding: 16px; +`; + +const ListItemHeader = styled.div` + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + padding: 16px 0px; +`; + +const ListItemContent = styled.div` + margin-left: 16px; + display: flex; + gap: 12px; +`; + +const DestinationIconWrapper = styled.div` + display: flex; + width: 36px; + height: 36px; + justify-content: center; + align-items: center; + gap: 8px; + border-radius: 8px; + background: linear-gradient( + 180deg, + rgba(249, 249, 249, 0.06) 0%, + rgba(249, 249, 249, 0.02) 100% + ); +`; + +const SignalsWrapper = styled.div` + display: flex; + align-items: center; + gap: 4px; +`; + +const SignalText = styled(Text)` + color: rgba(249, 249, 249, 0.8); + font-size: 10px; + text-transform: capitalize; +`; + +const TextWrapper = styled.div` + display: flex; + flex-direction: column; + height: 36px; + justify-content: space-between; +`; + +const ExpandIconContainer = styled.div` + display: flex; + justify-content: center; + align-items: center; + margin-right: 16px; +`; + +const IconBorder = styled.div` + height: 16px; + width: 1px; + margin-right: 12px; + background: ${({ theme }) => theme.colors.border}; +`; + +const ExpandIconWrapper = styled.div<{ expand?: boolean }>` + display: flex; + width: 36px; + height: 36px; + cursor: pointer; + justify-content: center; + align-items: center; + border-radius: 100%; + transition: background 0.3s ease 0s, transform 0.3s ease 0s; + transform: ${({ expand }) => (expand ? 'rotate(180deg)' : 'rotate(0deg)')}; + &:hover { + background: ${({ theme }) => theme.colors.translucent_bg}; + } +`; + +interface DestinationsListProps { + data: ConfiguredDestination[]; +} + +function ConfiguredDestinationsListItem({ + item, +}: { + item: ConfiguredDestination; +}) { + const [expand, setExpand] = React.useState(false); + + function renderSupportedSignals(item: ConfiguredDestination) { + const supportedSignals = item.exportedSignals; + const signals = Object.keys(supportedSignals); + const supportedSignalsList = signals.filter( + (signal) => supportedSignals[signal].supported + ); + + return Object.keys(supportedSignals).map( + (signal, index) => + supportedSignals[signal] && ( + + monitor + + {signal} + {index < supportedSignalsList.length - 1 && ( + · + )} + + ) + ); + } + + return ( + + + + + destination + + + {item.displayName} + {renderSupportedSignals(item)} + + + + + + setExpand(!expand)}> + destination + + + + + {expand && ( + + + + + )} + + ); +} + +const ConfiguredDestinationsList: React.FC = ({ + data, +}) => { + return ( + + {data.map((item) => ( + + ))} + + ); +}; + +export { ConfiguredDestinationsList }; diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index 28b4d77a3..782dbc5a3 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -2,11 +2,9 @@ import React, { useEffect, useMemo, useState } from 'react'; import styled from 'styled-components'; import { SideMenu } from '@/components'; import { useQuery } from '@apollo/client'; -import { useDispatch } from 'react-redux'; -import { addConfiguredDestination } from '@/store'; +import { useConnectDestinationForm, useConnectEnv } from '@/hooks'; import { GET_DESTINATION_TYPE_DETAILS } from '@/graphql'; import { Body, Container, SideMenuWrapper } from '../styled'; -import { useConnectDestinationForm, useConnectEnv } from '@/hooks'; import { DynamicConnectDestinationFormFields } from '../dynamic-form-fields'; import { StepProps, @@ -15,6 +13,7 @@ import { DestinationInput, DestinationTypeItem, DestinationDetailsResponse, + ConfiguredDestination, } from '@/types'; import { CheckboxList, @@ -22,6 +21,8 @@ import { Input, SectionTitle, } from '@/reuseable-components'; +import { addConfiguredDestination } from '@/store'; +import { useDispatch } from 'react-redux'; const SIDE_MENU_DATA: StepProps[] = [ { @@ -44,6 +45,8 @@ const FormContainer = styled.div` gap: 24px; `; +// + interface ConnectDestinationModalBodyProps { destination: DestinationTypeItem | undefined; onSubmitRef: React.MutableRefObject<(() => void) | null>; @@ -70,6 +73,9 @@ export function ConnectDestinationModalBody({ const [formData, setFormData] = useState>({}); const { buildFormDynamicFields } = useConnectDestinationForm(); const { connectEnv } = useConnectEnv(); + + const dispatch = useDispatch(); + const monitors = useMemo(() => { if (!destination) return []; @@ -114,13 +120,36 @@ export function ConnectDestinationModalBody({ value, })); + function storeConfiguredDestination() { + const destinationTypeDetails = dynamicFields.map((field) => ({ + title: field.title, + value: formData[field.name], + })); + + destinationTypeDetails.unshift({ + title: 'Destination name', + value: destinationName, + }); + + const storedDestination: ConfiguredDestination = { + exportedSignals, + destinationTypeDetails, + type: destination?.type || '', + imageUrl: destination?.imageUrl || '', + category: destination?.category || '', + displayName: destination?.displayName || '', + }; + + dispatch(addConfiguredDestination(storedDestination)); + } + const body: DestinationInput = { name: destinationName, type: destination?.type || '', exportedSignals, fields, }; - await connectEnv(body); + await connectEnv(body, storeConfiguredDestination); } if (!destination) return null; @@ -128,7 +157,7 @@ export function ConnectDestinationModalBody({ return ( - + diff --git a/frontend/webapp/containers/main/destinations/add-destination/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/index.tsx index 725049875..0443c6bc3 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/index.tsx @@ -1,9 +1,12 @@ import React, { useState } from 'react'; +import { IAppState } from '@/store'; import styled from 'styled-components'; +import { useSelector } from 'react-redux'; import { useRouter } from 'next/navigation'; -import { SectionTitle } from '@/reuseable-components'; import { AddDestinationModal } from './add-destination-modal'; import { AddDestinationButton, SetupHeader } from '@/components'; +import { NotificationNote, SectionTitle } from '@/reuseable-components'; +import { ConfiguredDestinationsList } from './configured-destinations-list'; const AddDestinationButtonWrapper = styled.div` width: 100%; @@ -19,10 +22,35 @@ const HeaderWrapper = styled.div` width: 100vw; `; +const NotificationNoteWrapper = styled.div` + margin-top: 24px; +`; + export function ChooseDestinationContainer() { const [isModalOpen, setModalOpen] = useState(false); const router = useRouter(); + + const sourcesList = useSelector(({ app }) => app.sources); + const destinations = useSelector( + ({ app }: { app: IAppState }) => app.configuredDestinationsList + ); + const isSourcesListEmpty = () => { + const sourceLen = Object.keys(sourcesList).length === 0; + if (sourceLen) { + return true; + } + + let empty = true; + for (const source in sourcesList) { + if (sourcesList[source].length > 0) { + empty = false; + break; + } + } + return empty; + }; + const handleOpenModal = () => setModalOpen(true); const handleCloseModal = () => setModalOpen(false); @@ -50,9 +78,15 @@ export function ChooseDestinationContainer() { title="Configure destinations" description="Add backend destinations where collected data will be sent and configure their settings." /> + {isSourcesListEmpty() && destinations.length === 0 && ( + + + + )} handleOpenModal()} /> + { ); const connectEnv = useCallback( - async (destination: DestinationInput) => { + async (destination: DestinationInput, callback?: () => void) => { setLoading(true); setError(null); setResult(null); @@ -71,14 +67,14 @@ export const useConnectEnv = () => { ); } } - dispatch(resetState()); + dispatch(resetSources()); // Create destination const destinationId = await createNewDestination(destination); if (!destinationId) { throw new Error('Error creating destination.'); } - + callback && callback(); setResult({ success: true, destinationId, diff --git a/frontend/webapp/public/icons/notification/warning-icon.svg b/frontend/webapp/public/icons/notification/warning-icon.svg new file mode 100644 index 000000000..eb152a716 --- /dev/null +++ b/frontend/webapp/public/icons/notification/warning-icon.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts index 1839e88d6..9054ef153 100644 --- a/frontend/webapp/reuseable-components/index.ts +++ b/frontend/webapp/reuseable-components/index.ts @@ -12,3 +12,4 @@ export * from './modal'; export * from './navigation-buttons'; export * from './tag'; export * from './checkbox-list'; +export * from './notification-note'; diff --git a/frontend/webapp/reuseable-components/notification-note/index.tsx b/frontend/webapp/reuseable-components/notification-note/index.tsx new file mode 100644 index 000000000..385994f26 --- /dev/null +++ b/frontend/webapp/reuseable-components/notification-note/index.tsx @@ -0,0 +1,110 @@ +import React from 'react'; +import styled, { css } from 'styled-components'; +import Image from 'next/image'; +import { Text } from '../text'; + +// Define the notification types +type NotificationType = 'warning' | 'error' | 'success' | 'info'; + +interface NotificationProps { + type: NotificationType; + text: string; +} + +const NotificationContainer = styled.div<{ type: NotificationType }>` + display: flex; + align-items: center; + padding: 12px 16px; + border-radius: 32px; + + background-color: ${({ type }) => { + switch (type) { + case 'warning': + return '#472300'; // Orange + case 'error': + return '#FF4C4C'; // Red + case 'success': + return '#28A745'; // Green + case 'info': + return '#2B2D66'; // Blue + default: + return '#2B2D66'; // Default to info color + } + }}; +`; + +const IconWrapper = styled.div` + margin-right: 12px; + display: flex; + justify-content: center; + align-items: center; +`; + +const Title = styled(Text)<{ type: NotificationType }>` + font-size: 14px; + color: ${({ type }) => { + switch (type) { + case 'warning': + return '#E9CF35'; // Orange + case 'error': + return '#FF4C4C'; // Red + case 'success': + return '#28A745'; // Green + case 'info': + return '#2B2D66'; // Blue + default: + return '#2B2D66'; // Default to info color + } + }}; +`; + +// Icons can be dynamically rendered based on the type +const NotificationIcon = ({ type }: { type: NotificationType }) => { + switch (type) { + case 'warning': + return ( + warning + ); + case 'error': + return ( + error + ); + case 'success': + return ( + success + ); + case 'info': + default: + return ( + info + ); + } +}; + +const NotificationNote: React.FC = ({ type, text }) => { + return ( + + + + + {text} + + ); +}; + +export { NotificationNote }; diff --git a/frontend/webapp/store/slices/app-slice.ts b/frontend/webapp/store/slices/app-slice.ts index 73364d103..3856944b6 100644 --- a/frontend/webapp/store/slices/app-slice.ts +++ b/frontend/webapp/store/slices/app-slice.ts @@ -1,4 +1,4 @@ -import { K8sActualSource } from '@/types'; +import { ConfiguredDestination, K8sActualSource } from '@/types'; import { createSlice } from '@reduxjs/toolkit'; import type { PayloadAction } from '@reduxjs/toolkit'; @@ -7,11 +7,13 @@ export interface IAppState { [key: string]: K8sActualSource[]; }; namespaceFutureSelectAppsList: { [key: string]: boolean }; + configuredDestinationsList: ConfiguredDestination[]; } const initialState: IAppState = { sources: {}, namespaceFutureSelectAppsList: {}, + configuredDestinationsList: [], }; export const appSlice = createSlice({ @@ -30,17 +32,42 @@ export const appSlice = createSlice({ ) => { state.namespaceFutureSelectAppsList = action.payload; }, - // New resetState reducer to reset the state to initial values + addConfiguredDestination: ( + state, + action: PayloadAction + ) => { + state.configuredDestinationsList.push(action.payload); + }, + + setConfiguredDestinationsList: ( + state, + action: PayloadAction + ) => { + state.configuredDestinationsList = action.payload; + }, + resetSources: (state) => { + state.sources = initialState.sources; + state.namespaceFutureSelectAppsList = + initialState.namespaceFutureSelectAppsList; + }, resetState: (state) => { state.sources = initialState.sources; state.namespaceFutureSelectAppsList = initialState.namespaceFutureSelectAppsList; + state.configuredDestinationsList = + initialState.configuredDestinationsList; }, }, }); // Action creators are generated for each case reducer function -export const { setSources, setNamespaceFutureSelectAppsList, resetState } = - appSlice.actions; +export const { + setSources, + setNamespaceFutureSelectAppsList, + setConfiguredDestinationsList, + addConfiguredDestination, + resetState, + resetSources, +} = appSlice.actions; export const appReducer = appSlice.reducer; diff --git a/frontend/webapp/types/destinations.ts b/frontend/webapp/types/destinations.ts index 80bcfb7e0..c08f24ba6 100644 --- a/frontend/webapp/types/destinations.ts +++ b/frontend/webapp/types/destinations.ts @@ -61,6 +61,20 @@ export interface DestinationInput { fields: { key: string; value: any }[]; } +export type DestinationTypeDetail = { + title: string; + value: string; +}; + +export type ConfiguredDestination = { + displayName: string; + category: string; + type: string; + exportedSignals: ExportedSignals; + imageUrl: string; + destinationTypeDetails: DestinationTypeDetail[]; +}; + export interface DestinationType { fields: any; display_name: string; From bc58f29b78408f36bcbdb3dd6f1938e4f6340bce Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 19 Aug 2024 10:18:40 +0300 Subject: [PATCH 166/374] chore: init --- .../add-destination/choose-destination-modal-body/index.tsx | 2 +- .../add-destination/connect-destination-modal-body/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx index ae32bfb44..294c345f3 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/choose-destination-modal-body/index.tsx @@ -79,7 +79,7 @@ export function ChooseDestinationModalBody({ return ( - + - + From c330de67c0b1bca6aac539a689de0f5878586786 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 19 Aug 2024 15:33:17 +0300 Subject: [PATCH 167/374] chore: wip --- frontend/graph/generated.go | 442 +++++++++++++++++- frontend/graph/model/models_gen.go | 8 + frontend/graph/schema.graphqls | 11 + frontend/graph/schema.resolvers.go | 39 +- .../services/test_connection/conversion.go | 58 +++ .../test_connection/otlp_test_connection.go | 37 ++ .../otlphttp_test_connection.go | 36 ++ .../test_connection/test_connection.go | 157 +++++++ frontend/services/test_connection/utils.go | 43 ++ .../services/test_connection/utils_test.go | 56 +++ .../configured-destination-fields/index.tsx | 2 +- .../create.connection.form.tsx | 11 +- .../connect-destination-modal-body/index.tsx | 37 +- .../add-destination/test-connection/index.tsx | 80 ++++ .../webapp/graphql/mutations/destination.ts | 12 + frontend/webapp/hooks/destinations/index.ts | 2 +- .../hooks/destinations/useCheckConnection.ts | 29 -- .../hooks/destinations/useTestConnection.ts | 42 ++ .../icons/common/connection-succeeded.svg | 3 + .../public/icons/notification/error-icon.svg | 3 + .../fade-loader/helpers/animation.ts | 27 ++ .../fade-loader/helpers/unitConverter.ts | 77 +++ .../fade-loader/index.tsx | 137 ++++++ frontend/webapp/reuseable-components/index.ts | 1 + .../notification-note/index.tsx | 13 +- .../section-title/index.tsx | 24 +- frontend/webapp/types/destinations.ts | 7 +- 27 files changed, 1322 insertions(+), 72 deletions(-) create mode 100644 frontend/services/test_connection/conversion.go create mode 100644 frontend/services/test_connection/otlp_test_connection.go create mode 100644 frontend/services/test_connection/otlphttp_test_connection.go create mode 100644 frontend/services/test_connection/test_connection.go create mode 100644 frontend/services/test_connection/utils.go create mode 100644 frontend/services/test_connection/utils_test.go create mode 100644 frontend/webapp/containers/main/destinations/add-destination/test-connection/index.tsx delete mode 100644 frontend/webapp/hooks/destinations/useCheckConnection.ts create mode 100644 frontend/webapp/hooks/destinations/useTestConnection.ts create mode 100644 frontend/webapp/public/icons/common/connection-succeeded.svg create mode 100644 frontend/webapp/public/icons/notification/error-icon.svg create mode 100644 frontend/webapp/reuseable-components/fade-loader/helpers/animation.ts create mode 100644 frontend/webapp/reuseable-components/fade-loader/helpers/unitConverter.ts create mode 100644 frontend/webapp/reuseable-components/fade-loader/index.tsx diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index c6b8cc0c4..23247a13c 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -141,9 +141,10 @@ type ComplexityRoot struct { } Mutation struct { - CreateNewDestination func(childComplexity int, destination model.DestinationInput) int - PersistK8sNamespace func(childComplexity int, namespace model.PersistNamespaceItemInput) int - PersistK8sSources func(childComplexity int, namespace string, sources []*model.PersistNamespaceSourceInput) int + CreateNewDestination func(childComplexity int, destination model.DestinationInput) int + PersistK8sNamespace func(childComplexity int, namespace model.PersistNamespaceItemInput) int + PersistK8sSources func(childComplexity int, namespace string, sources []*model.PersistNamespaceSourceInput) int + TestConnectionForDestination func(childComplexity int, destination model.DestinationInput) int } ObservabilitySignalSupport struct { @@ -167,6 +168,14 @@ type ComplexityRoot struct { Metrics func(childComplexity int) int Traces func(childComplexity int) int } + + TestConnectionResponse struct { + DestinationType func(childComplexity int) int + Message func(childComplexity int) int + Reason func(childComplexity int) int + StatusCode func(childComplexity int) int + Succeeded func(childComplexity int) int + } } type ComputePlatformResolver interface { @@ -188,6 +197,7 @@ type MutationResolver interface { CreateNewDestination(ctx context.Context, destination model.DestinationInput) (*model.Destination, error) PersistK8sNamespace(ctx context.Context, namespace model.PersistNamespaceItemInput) (bool, error) PersistK8sSources(ctx context.Context, namespace string, sources []*model.PersistNamespaceSourceInput) (bool, error) + TestConnectionForDestination(ctx context.Context, destination model.DestinationInput) (*model.TestConnectionResponse, error) } type QueryResolver interface { ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) @@ -623,6 +633,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.PersistK8sSources(childComplexity, args["namespace"].(string), args["sources"].([]*model.PersistNamespaceSourceInput)), true + case "Mutation.testConnectionForDestination": + if e.complexity.Mutation.TestConnectionForDestination == nil { + break + } + + args, err := ec.field_Mutation_testConnectionForDestination_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.TestConnectionForDestination(childComplexity, args["destination"].(model.DestinationInput)), true + case "ObservabilitySignalSupport.supported": if e.complexity.ObservabilitySignalSupport.Supported == nil { break @@ -698,6 +720,41 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.SupportedSignals.Traces(childComplexity), true + case "TestConnectionResponse.destinationType": + if e.complexity.TestConnectionResponse.DestinationType == nil { + break + } + + return e.complexity.TestConnectionResponse.DestinationType(childComplexity), true + + case "TestConnectionResponse.message": + if e.complexity.TestConnectionResponse.Message == nil { + break + } + + return e.complexity.TestConnectionResponse.Message(childComplexity), true + + case "TestConnectionResponse.reason": + if e.complexity.TestConnectionResponse.Reason == nil { + break + } + + return e.complexity.TestConnectionResponse.Reason(childComplexity), true + + case "TestConnectionResponse.statusCode": + if e.complexity.TestConnectionResponse.StatusCode == nil { + break + } + + return e.complexity.TestConnectionResponse.StatusCode(childComplexity), true + + case "TestConnectionResponse.succeeded": + if e.complexity.TestConnectionResponse.Succeeded == nil { + break + } + + return e.complexity.TestConnectionResponse.Succeeded(childComplexity), true + } return 0, false } @@ -948,6 +1005,21 @@ func (ec *executionContext) field_Mutation_persistK8sSources_args(ctx context.Co return args, nil } +func (ec *executionContext) field_Mutation_testConnectionForDestination_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 model.DestinationInput + if tmp, ok := rawArgs["destination"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destination")) + arg0, err = ec.unmarshalNDestinationInput2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐDestinationInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["destination"] = arg0 + return args, nil +} + func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -3594,6 +3666,73 @@ func (ec *executionContext) fieldContext_Mutation_persistK8sSources(ctx context. return fc, nil } +func (ec *executionContext) _Mutation_testConnectionForDestination(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_testConnectionForDestination(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().TestConnectionForDestination(rctx, fc.Args["destination"].(model.DestinationInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TestConnectionResponse) + fc.Result = res + return ec.marshalNTestConnectionResponse2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐTestConnectionResponse(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_testConnectionForDestination(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "succeeded": + return ec.fieldContext_TestConnectionResponse_succeeded(ctx, field) + case "statusCode": + return ec.fieldContext_TestConnectionResponse_statusCode(ctx, field) + case "destinationType": + return ec.fieldContext_TestConnectionResponse_destinationType(ctx, field) + case "message": + return ec.fieldContext_TestConnectionResponse_message(ctx, field) + case "reason": + return ec.fieldContext_TestConnectionResponse_reason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TestConnectionResponse", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_testConnectionForDestination_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _ObservabilitySignalSupport_supported(ctx context.Context, field graphql.CollectedField, obj *model.ObservabilitySignalSupport) (ret graphql.Marshaler) { fc, err := ec.fieldContext_ObservabilitySignalSupport_supported(ctx, field) if err != nil { @@ -4200,6 +4339,217 @@ func (ec *executionContext) fieldContext_SupportedSignals_logs(_ context.Context return fc, nil } +func (ec *executionContext) _TestConnectionResponse_succeeded(ctx context.Context, field graphql.CollectedField, obj *model.TestConnectionResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TestConnectionResponse_succeeded(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Succeeded, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TestConnectionResponse_succeeded(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TestConnectionResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TestConnectionResponse_statusCode(ctx context.Context, field graphql.CollectedField, obj *model.TestConnectionResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TestConnectionResponse_statusCode(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.StatusCode, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TestConnectionResponse_statusCode(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TestConnectionResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TestConnectionResponse_destinationType(ctx context.Context, field graphql.CollectedField, obj *model.TestConnectionResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TestConnectionResponse_destinationType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DestinationType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TestConnectionResponse_destinationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TestConnectionResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TestConnectionResponse_message(ctx context.Context, field graphql.CollectedField, obj *model.TestConnectionResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TestConnectionResponse_message(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TestConnectionResponse_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TestConnectionResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TestConnectionResponse_reason(ctx context.Context, field graphql.CollectedField, obj *model.TestConnectionResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TestConnectionResponse_reason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Reason, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TestConnectionResponse_reason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TestConnectionResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Directive_name(ctx, field) if err != nil { @@ -7183,6 +7533,13 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "testConnectionForDestination": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_testConnectionForDestination(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -7464,6 +7821,56 @@ func (ec *executionContext) _SupportedSignals(ctx context.Context, sel ast.Selec return out } +var testConnectionResponseImplementors = []string{"TestConnectionResponse"} + +func (ec *executionContext) _TestConnectionResponse(ctx context.Context, sel ast.SelectionSet, obj *model.TestConnectionResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, testConnectionResponseImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("TestConnectionResponse") + case "succeeded": + out.Values[i] = ec._TestConnectionResponse_succeeded(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "statusCode": + out.Values[i] = ec._TestConnectionResponse_statusCode(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "destinationType": + out.Values[i] = ec._TestConnectionResponse_destinationType(ctx, field, obj) + case "message": + out.Values[i] = ec._TestConnectionResponse_message(ctx, field, obj) + case "reason": + out.Values[i] = ec._TestConnectionResponse_reason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { @@ -8060,6 +8467,21 @@ func (ec *executionContext) marshalNInstallationStatus2githubᚗcomᚋodigosᚑi return v } +func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { + res, err := graphql.UnmarshalInt(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { + res := graphql.MarshalInt(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + func (ec *executionContext) marshalNK8sActualNamespace2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐK8sActualNamespace(ctx context.Context, sel ast.SelectionSet, v []*model.K8sActualNamespace) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup @@ -8238,6 +8660,20 @@ func (ec *executionContext) marshalNSupportedSignals2githubᚗcomᚋodigosᚑio return ec._SupportedSignals(ctx, sel, &v) } +func (ec *executionContext) marshalNTestConnectionResponse2githubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐTestConnectionResponse(ctx context.Context, sel ast.SelectionSet, v model.TestConnectionResponse) graphql.Marshaler { + return ec._TestConnectionResponse(ctx, sel, &v) +} + +func (ec *executionContext) marshalNTestConnectionResponse2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐTestConnectionResponse(ctx context.Context, sel ast.SelectionSet, v *model.TestConnectionResponse) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._TestConnectionResponse(ctx, sel, v) +} + func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { return ec.___Directive(ctx, sel, &v) } diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index e09092c8b..e71638825 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -124,6 +124,14 @@ type SourceContainerRuntimeDetails struct { Language string `json:"language"` } +type TestConnectionResponse struct { + Succeeded bool `json:"succeeded"` + StatusCode int `json:"statusCode"` + DestinationType *string `json:"destinationType,omitempty"` + Message *string `json:"message,omitempty"` + Reason *string `json:"reason,omitempty"` +} + type ComputePlatformType string const ( diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index 95de2251e..9cfed5381 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -201,6 +201,14 @@ input PersistNamespaceSourceInput { selected: Boolean } +type TestConnectionResponse { + succeeded: Boolean! + statusCode: Int! + destinationType: String + message: String + reason: String +} + type Query { computePlatform: ComputePlatform config: GetConfigResponse @@ -215,4 +223,7 @@ type Mutation { namespace: String! sources: [PersistNamespaceSourceInput!]! ): Boolean! + testConnectionForDestination( + destination: DestinationInput! + ): TestConnectionResponse! } diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 2106e1c71..910c5273f 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -16,6 +16,7 @@ import ( "github.com/odigos-io/odigos/frontend/graph/model" "github.com/odigos-io/odigos/frontend/kube" "github.com/odigos-io/odigos/frontend/services" + testconnection "github.com/odigos-io/odigos/frontend/services/test_connection" "github.com/odigos-io/odigos/k8sutils/pkg/workload" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -23,7 +24,6 @@ import ( // K8sActualNamespace is the resolver for the k8sActualNamespace field. func (r *computePlatformResolver) K8sActualNamespace(ctx context.Context, obj *model.ComputePlatform, name string) (*model.K8sActualNamespace, error) { - namespaceActualSources, err := services.GetWorkloadsInNamespace(ctx, name, nil) if err != nil { return nil, err @@ -195,6 +195,43 @@ func (r *mutationResolver) PersistK8sSources(ctx context.Context, namespace stri return true, nil } +// TestConnectionForDestination is the resolver for the testConnectionForDestination field. +func (r *mutationResolver) TestConnectionForDestination(ctx context.Context, input model.DestinationInput) (*model.TestConnectionResponse, error) { + destType := common.DestinationType(input.Type) + + destConfig, err := services.GetDestinationTypeConfig(destType) + if err != nil { + return nil, err + } + + if !destConfig.Spec.TestConnectionSupported { + return nil, fmt.Errorf("destination type %s does not support test connection", input.Type) + } + + configurer, err := testconnection.ConvertDestinationToConfigurer(input) + if err != nil { + return nil, err + } + + // Assuming testconnection.TestConnection returns a struct with fields similar to res.Succeeded, res.StatusCode, etc. + res := testconnection.TestConnection(ctx, configurer) + if !res.Succeeded { + return &model.TestConnectionResponse{ + Succeeded: false, + StatusCode: res.StatusCode, + DestinationType: (*string)(&res.DestinationType), + Message: &res.Message, + Reason: (*string)(&res.Reason), + }, nil + } + + return &model.TestConnectionResponse{ + Succeeded: true, + StatusCode: 200, + DestinationType: (*string)(&res.DestinationType), + }, nil +} + // ComputePlatform is the resolver for the computePlatform field. func (r *queryResolver) ComputePlatform(ctx context.Context) (*model.ComputePlatform, error) { namespacesResponse := services.GetK8SNamespaces(ctx) diff --git a/frontend/services/test_connection/conversion.go b/frontend/services/test_connection/conversion.go new file mode 100644 index 000000000..aa26d882b --- /dev/null +++ b/frontend/services/test_connection/conversion.go @@ -0,0 +1,58 @@ +package testconnection + +import ( + "errors" + + "github.com/odigos-io/odigos/common" + "github.com/odigos-io/odigos/common/config" + "github.com/odigos-io/odigos/frontend/graph/model" +) + +// Implement the ExporterConfigurer interface +type DestinationConfigurer struct { + destination model.DestinationInput +} + +func (dc *DestinationConfigurer) GetSignals() []common.ObservabilitySignal { + var signals []common.ObservabilitySignal + if dc.destination.ExportedSignals.Traces { + signals = append(signals, common.TracesObservabilitySignal) + } + if dc.destination.ExportedSignals.Metrics { + signals = append(signals, common.MetricsObservabilitySignal) + } + if dc.destination.ExportedSignals.Logs { + signals = append(signals, common.LogsObservabilitySignal) + } + return signals +} + +func (dc *DestinationConfigurer) GetType() common.DestinationType { + // Convert the string type to common.DestinationType + return common.DestinationType(dc.destination.Type) +} + +func (dc *DestinationConfigurer) GetID() string { + // Generate a unique ID for the Exporter, you can base this on the destination name or type + return dc.destination.Name +} + +func (dc *DestinationConfigurer) GetConfig() map[string]string { + configMap := make(map[string]string) + for _, field := range dc.destination.Fields { + configMap[field.Key] = field.Value + } + return configMap +} + +func ConvertDestinationToConfigurer(destination model.DestinationInput) (config.ExporterConfigurer, error) { + + if destination.Type == "" { + return nil, errors.New("destination type is required") + } + + // Additional validation or conversion logic can be added here if needed + + // Return a new instance of DestinationConfigurer which implements ExporterConfigurer + return &DestinationConfigurer{destination: destination}, nil +} diff --git a/frontend/services/test_connection/otlp_test_connection.go b/frontend/services/test_connection/otlp_test_connection.go new file mode 100644 index 000000000..6a137e31b --- /dev/null +++ b/frontend/services/test_connection/otlp_test_connection.go @@ -0,0 +1,37 @@ +package testconnection + +import ( + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/exporter" + + "go.opentelemetry.io/collector/exporter/otlpexporter" +) + +var _ ExporterConnectionTester = &otlpExporterConnectionTester{} + +type otlpExporterConnectionTester struct { + f exporter.Factory +} + +func NewOTLPTester() *otlpExporterConnectionTester { + return &otlpExporterConnectionTester{ + f: otlpexporter.NewFactory(), + } +} + +func (t *otlpExporterConnectionTester) Factory() exporter.Factory { + return t.f +} + +func (t *otlpExporterConnectionTester) ModifyConfigForConnectionTest(cfg component.Config) component.Config { + otlpConf, ok := cfg.(*otlpexporter.Config) + if !ok { + return nil + } + + // currently using the default timeout config of the collector - 5 seconds + // Avoid batching and retries + otlpConf.QueueConfig.Enabled = false + otlpConf.RetryConfig.Enabled = false + return otlpConf +} diff --git a/frontend/services/test_connection/otlphttp_test_connection.go b/frontend/services/test_connection/otlphttp_test_connection.go new file mode 100644 index 000000000..42c12c166 --- /dev/null +++ b/frontend/services/test_connection/otlphttp_test_connection.go @@ -0,0 +1,36 @@ +package testconnection + +import ( + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/exporter" + "go.opentelemetry.io/collector/exporter/otlphttpexporter" +) + +var _ ExporterConnectionTester = &otlphttpExporterConnectionTester{} + +type otlphttpExporterConnectionTester struct { + f exporter.Factory +} + +func NewOTLPHTTPTester() *otlphttpExporterConnectionTester { + return &otlphttpExporterConnectionTester{ + f: otlphttpexporter.NewFactory(), + } +} + +func (t *otlphttpExporterConnectionTester) Factory() exporter.Factory { + return t.f +} + +func (t *otlphttpExporterConnectionTester) ModifyConfigForConnectionTest(cfg component.Config) component.Config { + otlpConf, ok := cfg.(*otlphttpexporter.Config) + if !ok { + return nil + } + + // currently using the default timeout config of the collector - 5 seconds + // Avoid batching and retries + otlpConf.QueueConfig.Enabled = false + otlpConf.RetryConfig.Enabled = false + return otlpConf +} diff --git a/frontend/services/test_connection/test_connection.go b/frontend/services/test_connection/test_connection.go new file mode 100644 index 000000000..3d1acdcc0 --- /dev/null +++ b/frontend/services/test_connection/test_connection.go @@ -0,0 +1,157 @@ +package testconnection + +import ( + "context" + "fmt" + "net/http" + "strings" + + "github.com/odigos-io/odigos/common" + "github.com/odigos-io/odigos/common/config" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/exporter" + "go.opentelemetry.io/collector/exporter/exportertest" + "go.opentelemetry.io/collector/pdata/ptrace" +) + +var ( + configres map[common.DestinationType]config.Configer + connectionTesters = []ExporterConnectionTester{ + NewOTLPTester(), // "otlp/" prefix + NewOTLPHTTPTester(), // "otlphttp/" prefix + } +) + +func init() { + var err error + configres, err = config.LoadConfigers() + if err != nil { + panic(1) + } +} + +type TestConnectionErrorReason string + +const ( + UnKnownDestination TestConnectionErrorReason = "unknown destination" + InvalidConfig TestConnectionErrorReason = "invalid config" + UnsupportedExporterType TestConnectionErrorReason = "unsupported exporter type" + FailedToConnect TestConnectionErrorReason = "failed to connect" +) + +type TestConnectionResult struct { + Succeeded bool + Message string + Reason TestConnectionErrorReason + StatusCode int + DestinationType common.DestinationType +} + +type ExporterConnectionTester interface { + // Factory returns the exporter factory for the exporter type. + // This is used to create the exporter instance for testing the connection. + Factory() exporter.Factory + // ModifyConfigForConnectionTest modifies the exporter configuration for testing the connection. + // Since the default configuration may have batching, retries, etc. which may not be suitable for testing the connection. + ModifyConfigForConnectionTest(component.Config) component.Config +} + +func getConnectionTester(exporterID string) ExporterConnectionTester { + for _, tester := range connectionTesters { + prefix := fmt.Sprintf("%s/", tester.Factory().Type().String()) + if strings.HasPrefix(exporterID, prefix) { + return tester + } + } + return nil +} + +func TestConnection(ctx context.Context, dest config.ExporterConfigurer) TestConnectionResult { + destType := dest.GetType() + configer, ok := configres[destType] + if !ok { + return TestConnectionResult{Succeeded: false, Reason: UnKnownDestination, DestinationType: destType, StatusCode: http.StatusNotImplemented} + } + + currentConfig := config.Config{ + Exporters: make(config.GenericMap), + Service: config.Service{ + Pipelines: make(map[string]config.Pipeline), + }, + } + err := configer.ModifyConfig(dest, ¤tConfig) + if err != nil { + return TestConnectionResult{Succeeded: false, Message: err.Error(), Reason: InvalidConfig, DestinationType: destType, StatusCode: http.StatusInternalServerError} + } + + exporters := currentConfig.Exporters + if len(exporters) == 0 { + return TestConnectionResult{Message: "no exporters found in config", Reason: InvalidConfig, DestinationType: destType, StatusCode: http.StatusInternalServerError, Succeeded: false} + } + + var exporterRawConfig config.GenericMap + var connectionTester ExporterConnectionTester + foundTester := false + for componentID, cfg := range exporters { + gm, ok := cfg.(config.GenericMap) + if !ok { + continue + } + ct := getConnectionTester(componentID) + if ct != nil { + connectionTester = ct + foundTester = true + exporterRawConfig = gm + break + } + } + + if !foundTester { + return TestConnectionResult{Succeeded: false, Message: "no supported exporter found in config", Reason: UnsupportedExporterType, DestinationType: destType, StatusCode: http.StatusNotFound} + } + + // before testing the connection, replace placeholders (if exists) in the config with actual values + replacePlaceholders(exporterRawConfig, dest.GetConfig()) + defaultConfig := connectionTester.Factory().CreateDefaultConfig() + connectionTester.ModifyConfigForConnectionTest(defaultConfig) + + // convert the user provided fields to a collector config + exportersConf := confmap.NewFromStringMap(exporterRawConfig) + if exportersConf == nil { + return TestConnectionResult{Succeeded: false, Message: "failed to create exporter config", Reason: InvalidConfig, DestinationType: destType, StatusCode: http.StatusInternalServerError} + } + + // unmarshal the user provided configuration into the default one, merging them + err = exportersConf.Unmarshal(&defaultConfig) + if err != nil { + return TestConnectionResult{Succeeded: false, Message: err.Error(), Reason: InvalidConfig, DestinationType: destType, StatusCode: http.StatusInternalServerError} + } + + if validator, ok := defaultConfig.(component.ConfigValidator); ok { + // if the component has a Validate method, call it to validate the configuration + err = validator.Validate() + if err != nil { + return TestConnectionResult{Succeeded: false, Message: err.Error(), Reason: InvalidConfig, DestinationType: destType, StatusCode: http.StatusInternalServerError} + } + } + + exporter, err := connectionTester.Factory().CreateTracesExporter(ctx, exportertest.NewNopCreateSettings(), defaultConfig) + if err != nil { + return TestConnectionResult{Succeeded: false, Message: err.Error(), Reason: InvalidConfig, DestinationType: destType, StatusCode: http.StatusInternalServerError} + } + + err = exporter.Start(ctx, nil) + if err != nil { + return TestConnectionResult{Succeeded: false, Message: err.Error(), Reason: FailedToConnect, DestinationType: destType, StatusCode: http.StatusInternalServerError} + } + + defer exporter.Shutdown(ctx) + err = exporter.ConsumeTraces(ctx, ptrace.NewTraces()) + if err != nil { + return TestConnectionResult{Succeeded: false, Message: err.Error(), Reason: FailedToConnect, DestinationType: destType, StatusCode: http.StatusInternalServerError} + } + + return TestConnectionResult{Succeeded: true, DestinationType: destType, StatusCode: http.StatusOK} +} diff --git a/frontend/services/test_connection/utils.go b/frontend/services/test_connection/utils.go new file mode 100644 index 000000000..aca670899 --- /dev/null +++ b/frontend/services/test_connection/utils.go @@ -0,0 +1,43 @@ +package testconnection + +import ( + "regexp" + "strings" + + "github.com/odigos-io/odigos/common/config" +) + +// replacePlaceholders replaces placeholder values in the given GenericMap with values from the fields map. +// It traverses the GenericMap recursively and processes each string value as a template. +// If a string value contains placeholders in the format {KEY}, it replaces them with corresponding values from the fields map. +// The function supports nested GenericMaps and map[string]interface{} structures. +func replacePlaceholders(gmap config.GenericMap, fields map[string]string) { + // Regular expression to match the ${KEY} pattern + re := regexp.MustCompile(`\$\{([^}]+)\}`) + + for key, value := range gmap { + switch v := value.(type) { + case string: + // Find all matches of the pattern ${KEY} + matches := re.FindAllStringSubmatch(v, -1) + for _, match := range matches { + if len(match) == 2 { + // match[0] is the entire match (${KEY}), match[1] is the key (KEY) + extractedKey := match[1] + if replacement, ok := fields[extractedKey]; ok { + // Replace only the ${KEY} part in the original string + v = strings.Replace(v, match[0], replacement, -1) + // Update the map with the new value + gmap[key] = v + } + } + } + case config.GenericMap: + replacePlaceholders(v, fields) + case map[string]interface{}: + replacePlaceholders(v, fields) + default: + // If the value is not a string or a map, we leave it as it is + } + } +} \ No newline at end of file diff --git a/frontend/services/test_connection/utils_test.go b/frontend/services/test_connection/utils_test.go new file mode 100644 index 000000000..48787fc9c --- /dev/null +++ b/frontend/services/test_connection/utils_test.go @@ -0,0 +1,56 @@ +package testconnection + +import ( + "testing" + + "github.com/odigos-io/odigos/common/config" + "github.com/stretchr/testify/assert" +) + +func TestReplacePlaceholders(t *testing.T) { + // Fields map with replacements + fields := map[string]string{ + "MY_KEY1": "MY_VALUE1", + "MY_KEY2": "MY_VALUE2", + } + + gmap := config.GenericMap{ + "key1": "${MY_KEY1}", + "key2": 123, + "key3": config.GenericMap{ + "nestedKey1": "${MY_KEY2}", // replaced with MY_VALUE2 + "nestedKey2": "someValue", // no replacement + "nestedKey3": "${MY_KEY3}", // no replacement + "nestedKey4": "some prefix: ${MY_KEY2}", // replaced with "some prefix: MY_VALUE2" + }, + } + + replacePlaceholders(gmap, fields) + assert.Equal(t, "MY_VALUE1", gmap["key1"]) + assert.Equal(t, config.GenericMap{ + "nestedKey1": "MY_VALUE2", + "nestedKey2": "someValue", + "nestedKey3": "${MY_KEY3}", + "nestedKey4": "some prefix: MY_VALUE2", + }, gmap["key3"]) + assert.Equal(t, 123, gmap["key2"]) + + // don't change the original map if no placeholders are found + gmap = config.GenericMap{ + "key1": "value1", + "key2": 123, + "key3": config.GenericMap{ + "nestedKey1": "value2", + "nestedKey2": "someValue", + }, + } + + replacePlaceholders(gmap, fields) + assert.Equal(t, "value1", gmap["key1"]) + assert.Equal(t, config.GenericMap{ + "nestedKey1": "value2", + "nestedKey2": "someValue", + }, gmap["key3"]) + assert.Equal(t, 123, gmap["key2"]) + +} \ No newline at end of file diff --git a/frontend/webapp/components/destinations/configured-destination-fields/index.tsx b/frontend/webapp/components/destinations/configured-destination-fields/index.tsx index 926dc0fc9..b5d55f571 100644 --- a/frontend/webapp/components/destinations/configured-destination-fields/index.tsx +++ b/frontend/webapp/components/destinations/configured-destination-fields/index.tsx @@ -23,9 +23,9 @@ const ItemTitle = styled(Text)` const ItemValue = styled(Text)` word-break: break-all; + width: 90%; color: ${({ theme }) => theme.colors.text}; font-size: 12px; - font-weight: 300; line-height: 18px; `; diff --git a/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx b/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx index ef12a6b33..1c50b0f4b 100644 --- a/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx +++ b/frontend/webapp/components/setup/connection/create.connection.form/create.connection.form.tsx @@ -1,7 +1,7 @@ 'use client'; import React, { useState, useEffect } from 'react'; import theme from '@/styles/palette'; -import { useCheckConnection, useKeyDown } from '@/hooks'; +import { useTestConnection, useKeyDown } from '@/hooks'; import { Field, SelectedDestination } from '@/types'; import { renderFields } from './dynamic.fields'; import { @@ -81,7 +81,7 @@ export function CreateConnectionForm({ destinationNameValue || '' ); - const { checkDestinationConnection, isLoading } = useCheckConnection(); + const { testConnection } = useTestConnection(); useEffect(() => { setInitialDynamicFields(); @@ -209,7 +209,7 @@ export function CreateConnectionForm({ type: destination.type, }; try { - checkDestinationConnection(body, setIsConnectionTested); + // testConnection(body); } catch (error) {} } @@ -251,7 +251,8 @@ export function CreateConnectionForm({ disabled={isCreateButtonDisabled} onClick={handleCheckDestinationConnection} > - {isLoading ? ( +
+ {/* {isLoading ? ( ) : isConnectionTested.enabled === null ? ( @@ -265,7 +266,7 @@ export function CreateConnectionForm({ {isConnectionTested.message} - )} + )} */} )} (''); const [dynamicFields, setDynamicFields] = useState([]); const [formData, setFormData] = useState>({}); @@ -164,9 +169,35 @@ export function ConnectDestinationModalBody({ {}} + actionButton={ + destination.testConnectionSupported ? ( + setShowConnectionError(true)} + destination={{ + name: destinationName, + type: destination?.type || '', + exportedSignals, + fields: Object.entries(formData).map(([name, value]) => ({ + key: name, + value, + })), + }} + /> + ) : ( + <> + ) + } /> + {showConnectionError && ( + + + + )} void; +} + +const ActionButton = styled(Button)<{ isTestConnectionSuccess?: boolean }>` + display: flex; + align-items: center; + gap: 8px; + background-color: ${({ theme, isTestConnectionSuccess }) => + isTestConnectionSuccess ? 'rgba(129, 175, 101, 0.16)' : 'transparent'}; +`; + +const ActionButtonText = styled(Text)<{ isTestConnectionSuccess?: boolean }>` + font-family: ${({ theme }) => theme.font_family.secondary}; + font-weight: 500; + text-decoration: underline; + text-transform: uppercase; + font-size: 14px; + line-height: 157.143%; + color: ${({ theme, isTestConnectionSuccess }) => + isTestConnectionSuccess ? '#81AF65' : theme.colors.white}; +`; + +const TestConnection: React.FC = ({ + destination, + onError, +}) => { + const [isTestConnectionSuccess, setIsTestConnectionSuccess] = + useState(false); + const { testConnection, loading, error } = useTestConnection(); + + const onButtonClick = async () => { + if (!destination) { + return; + } + + const res = await testConnection(destination); + if (res) { + setIsTestConnectionSuccess(res.succeeded); + !res.succeeded && onError && onError(); + } + }; + return ( + + {isTestConnectionSuccess && ( + checkmark + )} + {loading && } + + {loading + ? 'Checking' + : isTestConnectionSuccess + ? 'Connection ok' + : 'Test Connection'} + + + ); +}; + +export { TestConnection }; diff --git a/frontend/webapp/graphql/mutations/destination.ts b/frontend/webapp/graphql/mutations/destination.ts index 0cbdcc12e..1c0f4ae01 100644 --- a/frontend/webapp/graphql/mutations/destination.ts +++ b/frontend/webapp/graphql/mutations/destination.ts @@ -7,3 +7,15 @@ export const CREATE_DESTINATION = gql` } } `; + +export const TEST_CONNECTION_MUTATION = gql` + mutation TestConnection($destination: DestinationInput!) { + testConnectionForDestination(destination: $destination) { + succeeded + statusCode + destinationType + message + reason + } + } +`; diff --git a/frontend/webapp/hooks/destinations/index.ts b/frontend/webapp/hooks/destinations/index.ts index ec9bba927..ccb9e9a9d 100644 --- a/frontend/webapp/hooks/destinations/index.ts +++ b/frontend/webapp/hooks/destinations/index.ts @@ -1,4 +1,4 @@ export * from './useDestinations'; -export * from './useCheckConnection'; +export * from './useTestConnection'; export * from './useConnectDestinationForm'; export * from './useCreateDestination'; diff --git a/frontend/webapp/hooks/destinations/useCheckConnection.ts b/frontend/webapp/hooks/destinations/useCheckConnection.ts deleted file mode 100644 index 52b9e6624..000000000 --- a/frontend/webapp/hooks/destinations/useCheckConnection.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { AxiosError } from 'axios'; -import { useMutation } from 'react-query'; -import { checkConnection } from '@/services'; - -export function useCheckConnection() { - const { mutateAsync, isLoading } = useMutation(checkConnection); - - const checkDestinationConnection = async (body, callback) => { - try { - await mutateAsync(body, { - onSuccess: (res) => - callback({ - enabled: true, - message: res.message, - }), - onError: (error: AxiosError) => - callback({ - enabled: false, - message: 'Please check your input and try again.', - }), - }); - } catch (error) {} - }; - - return { - isLoading, - checkDestinationConnection, - }; -} diff --git a/frontend/webapp/hooks/destinations/useTestConnection.ts b/frontend/webapp/hooks/destinations/useTestConnection.ts new file mode 100644 index 000000000..a5838db92 --- /dev/null +++ b/frontend/webapp/hooks/destinations/useTestConnection.ts @@ -0,0 +1,42 @@ +import { DestinationInput } from '@/types'; +import { useMutation } from '@apollo/client'; +import { TEST_CONNECTION_MUTATION } from '@/graphql'; + +interface TestConnectionResponse { + succeeded: boolean; + statusCode: number; + destinationType: string; + message: string; + reason: string; +} + +interface UseTestConnectionResult { + testConnection: ( + destination: DestinationInput + ) => Promise; + loading: boolean; + error?: Error; +} + +export const useTestConnection = (): UseTestConnectionResult => { + const [testConnectionMutation, { loading, error }] = useMutation< + { testConnectionForDestination: TestConnectionResponse }, + { destination: DestinationInput } + >(TEST_CONNECTION_MUTATION); + + const testConnection = async ( + destination: DestinationInput + ): Promise => { + try { + const { data } = await testConnectionMutation({ + variables: { destination }, + }); + return data?.testConnectionForDestination; + } catch (err) { + console.error('Error testing connection:', err); + return undefined; + } + }; + + return { testConnection, loading, error }; +}; diff --git a/frontend/webapp/public/icons/common/connection-succeeded.svg b/frontend/webapp/public/icons/common/connection-succeeded.svg new file mode 100644 index 000000000..4a4e6b385 --- /dev/null +++ b/frontend/webapp/public/icons/common/connection-succeeded.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/webapp/public/icons/notification/error-icon.svg b/frontend/webapp/public/icons/notification/error-icon.svg new file mode 100644 index 000000000..f4c444996 --- /dev/null +++ b/frontend/webapp/public/icons/notification/error-icon.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/frontend/webapp/reuseable-components/fade-loader/helpers/animation.ts b/frontend/webapp/reuseable-components/fade-loader/helpers/animation.ts new file mode 100644 index 000000000..b49f46caf --- /dev/null +++ b/frontend/webapp/reuseable-components/fade-loader/helpers/animation.ts @@ -0,0 +1,27 @@ +export const createAnimation = ( + loaderName: string, + frames: string, + suffix: string +): string => { + const animationName = `react-spinners-${loaderName}-${suffix}`; + + if (typeof window == 'undefined' || !window.document) { + return animationName; + } + + const styleEl = document.createElement('style'); + document.head.appendChild(styleEl); + const styleSheet = styleEl.sheet; + + const keyFrames = ` + @keyframes ${animationName} { + ${frames} + } + `; + + if (styleSheet) { + styleSheet.insertRule(keyFrames, 0); + } + + return animationName; +}; diff --git a/frontend/webapp/reuseable-components/fade-loader/helpers/unitConverter.ts b/frontend/webapp/reuseable-components/fade-loader/helpers/unitConverter.ts new file mode 100644 index 000000000..5579c1942 --- /dev/null +++ b/frontend/webapp/reuseable-components/fade-loader/helpers/unitConverter.ts @@ -0,0 +1,77 @@ +interface LengthObject { + value: number; + unit: string; +} + +const cssUnit: { [unit: string]: boolean } = { + cm: true, + mm: true, + in: true, + px: true, + pt: true, + pc: true, + em: true, + ex: true, + ch: true, + rem: true, + vw: true, + vh: true, + vmin: true, + vmax: true, + '%': true, +}; + +/** + * If size is a number, append px to the value as default unit. + * If size is a string, validate against list of valid units. + * If unit is valid, return size as is. + * If unit is invalid, console warn issue, replace with px as the unit. + * + * @param {(number | string)} size + * @return {LengthObject} LengthObject + */ +export function parseLengthAndUnit(size: number | string): LengthObject { + if (typeof size === 'number') { + return { + value: size, + unit: 'px', + }; + } + let value: number; + const valueString: string = (size.match(/^[0-9.]*/) || '').toString(); + if (valueString.includes('.')) { + value = parseFloat(valueString); + } else { + value = parseInt(valueString, 10); + } + + const unit: string = (size.match(/[^0-9]*$/) || '').toString(); + + if (cssUnit[unit]) { + return { + value, + unit, + }; + } + + console.warn( + `React Spinners: ${size} is not a valid css value. Defaulting to ${value}px.` + ); + + return { + value, + unit: 'px', + }; +} + +/** + * Take value as an input and return valid css value + * + * @param {(number | string)} value + * @return {string} valid css value + */ +export function cssValue(value: number | string): string { + const lengthWithunit = parseLengthAndUnit(value); + + return `${lengthWithunit.value}${lengthWithunit.unit}`; +} diff --git a/frontend/webapp/reuseable-components/fade-loader/index.tsx b/frontend/webapp/reuseable-components/fade-loader/index.tsx new file mode 100644 index 000000000..b90c6c9d3 --- /dev/null +++ b/frontend/webapp/reuseable-components/fade-loader/index.tsx @@ -0,0 +1,137 @@ +import React, { CSSProperties, DetailedHTMLProps, HTMLAttributes } from 'react'; + +import { cssValue, parseLengthAndUnit } from './helpers/unitConverter'; +import { createAnimation } from './helpers/animation'; +import theme from '@/styles/theme'; + +export type LengthType = number | string; + +interface CommonProps + extends DetailedHTMLProps, HTMLSpanElement> { + color?: string; + loading?: boolean; + cssOverride?: CSSProperties; + speedMultiplier?: number; +} + +interface LoaderHeightWidthRadiusProps extends CommonProps { + height?: LengthType; + width?: LengthType; + radius?: LengthType; + margin?: LengthType; +} + +const fade = createAnimation( + 'FadeLoader', + '50% {opacity: 0.3} 100% {opacity: 1}', + 'fade' +); + +function FadeLoader({ + loading = true, + color = theme.colors.text, + speedMultiplier = 1, + cssOverride = {}, + height = 4, + width = 1.5, + radius = 2, + margin = 2, + ...additionalprops +}: LoaderHeightWidthRadiusProps): JSX.Element | null { + const { value } = parseLengthAndUnit(margin); + const radiusValue = value + 4.2; + const quarter = radiusValue / 2 + radiusValue / 5.5; + + const wrapper: React.CSSProperties = { + display: 'inherit', + position: 'relative', + fontSize: '0', + top: radiusValue, + left: radiusValue, + width: `${radiusValue * 3}px`, + height: `${radiusValue * 3}px`, + ...cssOverride, + }; + + const style = (i: number): React.CSSProperties => { + return { + position: 'absolute', + width: cssValue(width), + height: cssValue(height), + margin: cssValue(margin), + backgroundColor: color, + borderRadius: cssValue(radius), + transition: '2s', + animationFillMode: 'both', + animation: `${fade} ${1.2 / speedMultiplier}s ${ + i * 0.12 + }s infinite ease-in-out`, + }; + }; + + const a: React.CSSProperties = { + ...style(1), + top: `${radiusValue}px`, + left: '0', + }; + const b: React.CSSProperties = { + ...style(2), + top: `${quarter}px`, + left: `${quarter}px`, + transform: 'rotate(-45deg)', + }; + const c: React.CSSProperties = { + ...style(3), + top: '0', + left: `${radiusValue}px`, + transform: 'rotate(90deg)', + }; + const d: React.CSSProperties = { + ...style(4), + top: `${-1 * quarter}px`, + left: `${quarter}px`, + transform: 'rotate(45deg)', + }; + const e: React.CSSProperties = { + ...style(5), + top: `${-1 * radiusValue}px`, + left: '0', + }; + const f: React.CSSProperties = { + ...style(6), + top: `${-1 * quarter}px`, + left: `${-1 * quarter}px`, + transform: 'rotate(-45deg)', + }; + const g: React.CSSProperties = { + ...style(7), + top: '0', + left: `${-1 * radiusValue}px`, + transform: 'rotate(90deg)', + }; + const h: React.CSSProperties = { + ...style(8), + top: `${quarter}px`, + left: `${-1 * quarter}px`, + transform: 'rotate(45deg)', + }; + + if (!loading) { + return null; + } + + return ( + + + + + + + + + + + ); +} + +export { FadeLoader }; diff --git a/frontend/webapp/reuseable-components/index.ts b/frontend/webapp/reuseable-components/index.ts index 9054ef153..19d56da91 100644 --- a/frontend/webapp/reuseable-components/index.ts +++ b/frontend/webapp/reuseable-components/index.ts @@ -13,3 +13,4 @@ export * from './navigation-buttons'; export * from './tag'; export * from './checkbox-list'; export * from './notification-note'; +export * from './fade-loader'; diff --git a/frontend/webapp/reuseable-components/notification-note/index.tsx b/frontend/webapp/reuseable-components/notification-note/index.tsx index 385994f26..cc0d9381f 100644 --- a/frontend/webapp/reuseable-components/notification-note/index.tsx +++ b/frontend/webapp/reuseable-components/notification-note/index.tsx @@ -22,7 +22,7 @@ const NotificationContainer = styled.div<{ type: NotificationType }>` case 'warning': return '#472300'; // Orange case 'error': - return '#FF4C4C'; // Red + return 'rgba(226, 90, 90, 0.12);'; case 'success': return '#28A745'; // Green case 'info': @@ -45,20 +45,19 @@ const Title = styled(Text)<{ type: NotificationType }>` color: ${({ type }) => { switch (type) { case 'warning': - return '#E9CF35'; // Orange + return '#E9CF35'; case 'error': - return '#FF4C4C'; // Red + return '#E25A5A'; case 'success': - return '#28A745'; // Green + return '#28A745'; case 'info': - return '#2B2D66'; // Blue + return '#2B2D66'; default: - return '#2B2D66'; // Default to info color + return '#2B2D66'; } }}; `; -// Icons can be dynamically rendered based on the type const NotificationIcon = ({ type }: { type: NotificationType }) => { switch (type) { case 'warning': diff --git a/frontend/webapp/reuseable-components/section-title/index.tsx b/frontend/webapp/reuseable-components/section-title/index.tsx index cbd024bc4..055a87448 100644 --- a/frontend/webapp/reuseable-components/section-title/index.tsx +++ b/frontend/webapp/reuseable-components/section-title/index.tsx @@ -1,13 +1,11 @@ import React from 'react'; import { Text } from '../text'; -import { Button } from '../button'; import styled from 'styled-components'; interface SectionTitleProps { title: string; description: string; - buttonText?: string; - onButtonClick?: () => void; + actionButton?: React.ReactNode; // Accept a React node as the action button } const Container = styled.div` @@ -27,22 +25,10 @@ const Title = styled(Text)``; const Description = styled(Text)``; -const ActionButton = styled(Button)``; - -const ActionButtonText = styled(Text)` - font-family: ${({ theme }) => theme.font_family.secondary}; - font-weight: 500; - text-decoration: underline; - text-transform: uppercase; - font-size: 14px; - line-height: 157.143%; -`; - const SectionTitle: React.FC = ({ title, description, - buttonText, - onButtonClick, + actionButton, // Use the custom action button }) => { return ( @@ -54,11 +40,7 @@ const SectionTitle: React.FC = ({ {description} - {buttonText && onButtonClick && ( - - {buttonText} - - )} + {actionButton &&
{actionButton}
}
); }; diff --git a/frontend/webapp/types/destinations.ts b/frontend/webapp/types/destinations.ts index c08f24ba6..47d3b088e 100644 --- a/frontend/webapp/types/destinations.ts +++ b/frontend/webapp/types/destinations.ts @@ -54,11 +54,16 @@ export interface ExportedSignals { traces: boolean; } +interface FieldInput { + key: string; + value: string; +} + export interface DestinationInput { name: string; type: string; exportedSignals: ExportedSignals; - fields: { key: string; value: any }[]; + fields: FieldInput[]; } export type DestinationTypeDetail = { From d201c37b9a90054d20edc687d2a580d0c9eb2782 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 19 Aug 2024 15:39:41 +0300 Subject: [PATCH 168/374] chore: wip --- .../connect-destination-modal-body/index.tsx | 2 +- .../add-destination/test-connection/index.tsx | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index 7754fe78f..498b58c32 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -171,7 +171,7 @@ export function ConnectDestinationModalBody({ description="Connect selected destination with Odigos." actionButton={ destination.testConnectionSupported ? ( - setShowConnectionError(true)} destination={{ name: destinationName, diff --git a/frontend/webapp/containers/main/destinations/add-destination/test-connection/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/test-connection/index.tsx index e28683402..48da795ca 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/test-connection/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/test-connection/index.tsx @@ -1,9 +1,9 @@ -import { useTestConnection } from '@/hooks'; -import { Button, FadeLoader, Text } from '@/reuseable-components'; -import { DestinationInput } from '@/types'; import Image from 'next/image'; -import React, { useState } from 'react'; import styled from 'styled-components'; +import React, { useState } from 'react'; +import { DestinationInput } from '@/types'; +import { useTestConnection } from '@/hooks'; +import { Button, FadeLoader, Text } from '@/reuseable-components'; interface TestConnectionProps { destination: DestinationInput | undefined; @@ -14,7 +14,7 @@ const ActionButton = styled(Button)<{ isTestConnectionSuccess?: boolean }>` display: flex; align-items: center; gap: 8px; - background-color: ${({ theme, isTestConnectionSuccess }) => + background-color: ${({ isTestConnectionSuccess }) => isTestConnectionSuccess ? 'rgba(129, 175, 101, 0.16)' : 'transparent'}; `; From 7cdef05ca5d0220a6ec21f42ec73aaff590a9c2c Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 19 Aug 2024 15:57:50 +0300 Subject: [PATCH 169/374] chore: init --- frontend/graph/schema.resolvers.go | 1 - .../connect-destination-modal-body/index.tsx | 35 ++++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 910c5273f..983b6a218 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -213,7 +213,6 @@ func (r *mutationResolver) TestConnectionForDestination(ctx context.Context, inp return nil, err } - // Assuming testconnection.TestConnection returns a struct with fields similar to res.Succeeded, res.StatusCode, etc. res := testconnection.TestConnection(ctx, configurer) if !res.Succeeded { return &model.TestConnectionResponse{ diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index 498b58c32..aa3e0b4ed 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -2,9 +2,12 @@ import React, { useEffect, useMemo, useState } from 'react'; import styled from 'styled-components'; import { SideMenu } from '@/components'; import { useQuery } from '@apollo/client'; -import { useConnectDestinationForm, useConnectEnv } from '@/hooks'; +import { useDispatch } from 'react-redux'; +import { addConfiguredDestination } from '@/store'; +import { TestConnection } from '../test-connection'; import { GET_DESTINATION_TYPE_DETAILS } from '@/graphql'; import { Body, Container, SideMenuWrapper } from '../styled'; +import { useConnectDestinationForm, useConnectEnv } from '@/hooks'; import { DynamicConnectDestinationFormFields } from '../dynamic-form-fields'; import { StepProps, @@ -22,9 +25,6 @@ import { NotificationNote, SectionTitle, } from '@/reuseable-components'; -import { addConfiguredDestination } from '@/store'; -import { useDispatch } from 'react-redux'; -import { TestConnection } from '../test-connection'; const SIDE_MENU_DATA: StepProps[] = [ { @@ -60,26 +60,27 @@ export function ConnectDestinationModalBody({ destination, onSubmitRef, }: ConnectDestinationModalBodyProps) { - const { data } = useQuery( - GET_DESTINATION_TYPE_DETAILS, - { - variables: { type: destination?.type }, - skip: !destination, - } - ); + const [formData, setFormData] = useState>({}); + const [destinationName, setDestinationName] = useState(''); + const [showConnectionError, setShowConnectionError] = useState(false); + const [dynamicFields, setDynamicFields] = useState([]); const [exportedSignals, setExportedSignals] = useState({ logs: false, metrics: false, traces: false, }); - const [showConnectionError, setShowConnectionError] = useState(false); - const [destinationName, setDestinationName] = useState(''); - const [dynamicFields, setDynamicFields] = useState([]); - const [formData, setFormData] = useState>({}); - const { buildFormDynamicFields } = useConnectDestinationForm(); - const { connectEnv } = useConnectEnv(); const dispatch = useDispatch(); + const { connectEnv } = useConnectEnv(); + const { buildFormDynamicFields } = useConnectDestinationForm(); + + const { data } = useQuery( + GET_DESTINATION_TYPE_DETAILS, + { + variables: { type: destination?.type }, + skip: !destination, + } + ); const monitors = useMemo(() => { if (!destination) return []; From ffde50852a79a81d3ab5d0bed23f1ab6114a5787 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 19 Aug 2024 16:47:24 +0300 Subject: [PATCH 170/374] chore: wip --- .../dynamic-form-fields/index.tsx | 10 +- .../destinations/useConnectDestinationForm.ts | 10 +- frontend/webapp/reuseable-components/index.ts | 1 + .../reuseable-components/textarea/index.tsx | 157 ++++++++++++++++++ 4 files changed, 167 insertions(+), 11 deletions(-) create mode 100644 frontend/webapp/reuseable-components/textarea/index.tsx diff --git a/frontend/webapp/containers/main/destinations/add-destination/dynamic-form-fields/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/dynamic-form-fields/index.tsx index 196767bcf..190be415d 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/dynamic-form-fields/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/dynamic-form-fields/index.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { INPUT_TYPES } from '@/utils/constants/string'; -import { Dropdown, Input } from '@/reuseable-components'; +import { Dropdown, Input, TextArea } from '@/reuseable-components'; export function DynamicConnectDestinationFormFields({ fields, @@ -35,7 +35,13 @@ export function DynamicConnectDestinationFormFields({ case INPUT_TYPES.KEY_VALUE_PAIR: return
; case INPUT_TYPES.TEXTAREA: - return
; + return ( +