From 2881bcc037b79f46ee118cee8e0dcc4badbc3664 Mon Sep 17 00:00:00 2001 From: jayeshsadhwani99 Date: Wed, 24 Apr 2024 14:19:44 +0530 Subject: [PATCH] manifest working --- web/package-lock.json | 55 ++++++++++++++----- web/package.json | 1 + .../connectors/SlackManifestGenerator.jsx | 23 +++++++- .../HandleInputRender/HandleInputRender.jsx | 2 +- web/src/constants/api/integrations.ts | 2 +- .../integrations/api/generateManifestApi.ts | 7 ++- 6 files changed, 69 insertions(+), 21 deletions(-) diff --git a/web/package-lock.json b/web/package-lock.json index a85a77857..2eb3bc87b 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -19,6 +19,7 @@ "dayjs": "^1.11.7", "echarts-for-react": "^3.0.2", "framer-motion": "^11.1.5", + "highlight.js": "^11.9.0", "nprogress": "^0.2.0", "posthog-js": "^1.115.0", "react": "^18.2.0", @@ -7688,6 +7689,14 @@ "node": ">=10" } }, + "node_modules/cosmiconfig/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "engines": { + "node": ">= 6" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -8042,6 +8051,14 @@ "postcss": "^8.2.15" } }, + "node_modules/cssnano/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "engines": { + "node": ">= 6" + } + }, "node_modules/csso": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/csso/-/csso-4.2.0.tgz", @@ -10265,6 +10282,14 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "node_modules/fork-ts-checker-webpack-plugin/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "engines": { + "node": ">= 6" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -11008,6 +11033,14 @@ "he": "bin/he" } }, + "node_modules/highlight.js": { + "version": "11.9.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.9.0.tgz", + "integrity": "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw==", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/hoist-non-react-statics": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", @@ -18803,17 +18836,6 @@ "url": "https://github.com/sponsors/antonk52" } }, - "node_modules/postcss-load-config/node_modules/yaml": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.1.tgz", - "integrity": "sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==", - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14" - } - }, "node_modules/postcss-loader": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-6.2.1.tgz", @@ -24319,11 +24341,14 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, "node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.1.tgz", + "integrity": "sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==", + "bin": { + "yaml": "bin.mjs" + }, "engines": { - "node": ">= 6" + "node": ">= 14" } }, "node_modules/yargs": { diff --git a/web/package.json b/web/package.json index 87c3dc979..e2313303c 100644 --- a/web/package.json +++ b/web/package.json @@ -14,6 +14,7 @@ "dayjs": "^1.11.7", "echarts-for-react": "^3.0.2", "framer-motion": "^11.1.5", + "highlight.js": "^11.9.0", "nprogress": "^0.2.0", "posthog-js": "^1.115.0", "react": "^18.2.0", diff --git a/web/src/components/Integration/connectors/SlackManifestGenerator.jsx b/web/src/components/Integration/connectors/SlackManifestGenerator.jsx index 8523b2243..2c316be1a 100644 --- a/web/src/components/Integration/connectors/SlackManifestGenerator.jsx +++ b/web/src/components/Integration/connectors/SlackManifestGenerator.jsx @@ -6,6 +6,11 @@ import { connectorSelector } from "../../../store/features/integrations/integrat import { useGenerateManifestMutation } from "../../../store/features/integrations/api/generateManifestApi.ts"; import { showSnackbar } from "../../../store/features/snackbar/snackbarSlice.ts"; import { CircularProgress } from "@mui/material"; +import hljs from "highlight.js/lib/core"; +import yaml from "highlight.js/lib/languages/yaml"; +import "highlight.js/styles/default.css"; + +hljs.registerLanguage("yaml", yaml); function SlackManifestGenerator() { const [host, setHost] = useState(""); @@ -24,6 +29,10 @@ function SlackManifestGenerator() { triggerManifest(host); }; + const handleCopy = () => { + navigator.clipboard.writeText(currentConnector.manifest); + }; + return (
-
-
- {currentConnector.manifest} +
+
           
)} diff --git a/web/src/components/common/HandleInputRender/HandleInputRender.jsx b/web/src/components/common/HandleInputRender/HandleInputRender.jsx index 9226e8c00..72999ad92 100644 --- a/web/src/components/common/HandleInputRender/HandleInputRender.jsx +++ b/web/src/components/common/HandleInputRender/HandleInputRender.jsx @@ -23,7 +23,7 @@ export const HandleInputRender = ({ option }) => { option.handleChange ? option.handleChange(val) diff --git a/web/src/constants/api/integrations.ts b/web/src/constants/api/integrations.ts index c230c9b39..de21de030 100644 --- a/web/src/constants/api/integrations.ts +++ b/web/src/constants/api/integrations.ts @@ -10,7 +10,7 @@ export const GET_CONNECTOR_ASSETS = "/connectors/assets/models/get"; export const GET_SLACK_ASSETS = "/connectors/assets/models/get"; export const UPDATE_SLACK_RCA = "/connectors/alertops/slack/alerts/auto_rca/update_state"; -export const GENERATE_MANIFEST = ""; +export const GENERATE_MANIFEST = "/connectors/slack/app_manifest/create"; export const GOOGLE_SPACES_LIST = "/connectors/integrations/handlers/g_chat/list_spaces"; diff --git a/web/src/store/features/integrations/api/generateManifestApi.ts b/web/src/store/features/integrations/api/generateManifestApi.ts index ad9322b4d..0f1f1c88b 100644 --- a/web/src/store/features/integrations/api/generateManifestApi.ts +++ b/web/src/store/features/integrations/api/generateManifestApi.ts @@ -15,7 +15,12 @@ export const generateManifestApi = apiSlice.injectEndpoints({ onQueryStarted: async (_, { dispatch, queryFulfilled }) => { try { const { data } = await queryFulfilled; - dispatch(setKey({ key: "manifest", value: data.manifest })); + dispatch( + setKey({ + key: "manifest", + value: data.app_manifest, + }), + ); } catch (e) { console.log(e); }