From 8b136fa41b908914dc20293c79baa4a9f010fdc4 Mon Sep 17 00:00:00 2001 From: Arif-tekdi-technologies Date: Thu, 10 Oct 2024 16:41:52 +0530 Subject: [PATCH 01/12] Issue #PS-2103: Add Workspace UI implementation in admin portal --- next.config.mjs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index ceddf3d4..00eef5fc 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -47,10 +47,6 @@ const nextConfig = { source: "/api/:path*", // Match /api/ routes destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/api/:path*`, // Forward them to proxy.js }, - { - source: "/assets/public/:path*", // Match any URL starting with /assets/public/ - destination: `${process.env.CLOUD_STORAGE_URL}/:path*`, // Forward to S3, stripping "/assets/public" - }, ]; }, webpack: (config, { isServer }) => { From 03e302592f2b31a707b75b614efe66150a67b156 Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Fri, 11 Oct 2024 12:30:19 +0530 Subject: [PATCH 02/12] Issue #PS-000 chore: sidebar changes --- .../workspace/content/allContents/index.tsx | 21 ++++++++----------- src/pages/workspace/content/create/index.tsx | 21 ++++++++----------- src/pages/workspace/content/draft/index.tsx | 21 ++++++++----------- src/pages/workspace/content/publish/index.tsx | 21 ++++++++----------- .../workspace/content/submitted/index.tsx | 21 ++++++++----------- 5 files changed, 45 insertions(+), 60 deletions(-) diff --git a/src/pages/workspace/content/allContents/index.tsx b/src/pages/workspace/content/allContents/index.tsx index 69545aa7..ae2ae03f 100644 --- a/src/pages/workspace/content/allContents/index.tsx +++ b/src/pages/workspace/content/allContents/index.tsx @@ -1,24 +1,21 @@ -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; -import React from 'react' -import dynamic from 'next/dynamic'; - +import { serverSideTranslations } from "next-i18next/serverSideTranslations"; +import React from "react"; +import dynamic from "next/dynamic"; // @ts-ignore -const Content = dynamic(() => import('editor/Content'), { ssr: false }); +const Content = dynamic(() => import("editor/Content"), { ssr: false }); const content = () => { - return ( - - ) -} - -export default content + return ; +}; +export default content; export async function getStaticProps({ locale }: any) { return { props: { + noLayout: true, ...(await serverSideTranslations(locale, ["common"])), }, }; -} \ No newline at end of file +} diff --git a/src/pages/workspace/content/create/index.tsx b/src/pages/workspace/content/create/index.tsx index 99108c51..1a8b5962 100644 --- a/src/pages/workspace/content/create/index.tsx +++ b/src/pages/workspace/content/create/index.tsx @@ -1,24 +1,21 @@ -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; -import React from 'react' -import dynamic from 'next/dynamic'; - +import { serverSideTranslations } from "next-i18next/serverSideTranslations"; +import React from "react"; +import dynamic from "next/dynamic"; // @ts-ignore -const Create = dynamic(() => import('editor/Create'), { ssr: false }); +const Create = dynamic(() => import("editor/Create"), { ssr: false }); const create = () => { - return ( - - ) -} - -export default create + return ; +}; +export default create; export async function getStaticProps({ locale }: any) { return { props: { + noLayout: true, ...(await serverSideTranslations(locale, ["common"])), }, }; -} \ No newline at end of file +} diff --git a/src/pages/workspace/content/draft/index.tsx b/src/pages/workspace/content/draft/index.tsx index 744b5e78..f94e95a8 100644 --- a/src/pages/workspace/content/draft/index.tsx +++ b/src/pages/workspace/content/draft/index.tsx @@ -1,24 +1,21 @@ -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; -import React from 'react' -import dynamic from 'next/dynamic'; - +import { serverSideTranslations } from "next-i18next/serverSideTranslations"; +import React from "react"; +import dynamic from "next/dynamic"; // @ts-ignore -const Draft = dynamic(() => import('editor/Draft'), { ssr: false }); +const Draft = dynamic(() => import("editor/Draft"), { ssr: false }); const draft = () => { - return ( - - ) -} - -export default draft + return ; +}; +export default draft; export async function getStaticProps({ locale }: any) { return { props: { + noLayout: true, ...(await serverSideTranslations(locale, ["common"])), }, }; -} \ No newline at end of file +} diff --git a/src/pages/workspace/content/publish/index.tsx b/src/pages/workspace/content/publish/index.tsx index 9d5f5829..8d78e70f 100644 --- a/src/pages/workspace/content/publish/index.tsx +++ b/src/pages/workspace/content/publish/index.tsx @@ -1,24 +1,21 @@ -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; -import React from 'react' -import dynamic from 'next/dynamic'; - +import { serverSideTranslations } from "next-i18next/serverSideTranslations"; +import React from "react"; +import dynamic from "next/dynamic"; // @ts-ignore -const Publish = dynamic(() => import('editor/Publish'), { ssr: false }); +const Publish = dynamic(() => import("editor/Publish"), { ssr: false }); const publish = () => { - return ( - - ) -} - -export default publish + return ; +}; +export default publish; export async function getStaticProps({ locale }: any) { return { props: { + noLayout: true, ...(await serverSideTranslations(locale, ["common"])), }, }; -} \ No newline at end of file +} diff --git a/src/pages/workspace/content/submitted/index.tsx b/src/pages/workspace/content/submitted/index.tsx index 141dbaa5..2b78004b 100644 --- a/src/pages/workspace/content/submitted/index.tsx +++ b/src/pages/workspace/content/submitted/index.tsx @@ -1,24 +1,21 @@ -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; -import React from 'react' -import dynamic from 'next/dynamic'; - +import { serverSideTranslations } from "next-i18next/serverSideTranslations"; +import React from "react"; +import dynamic from "next/dynamic"; // @ts-ignore -const Submitted = dynamic(() => import('editor/Submitted'), { ssr: false }); +const Submitted = dynamic(() => import("editor/Submitted"), { ssr: false }); const submitted = () => { - return ( - - ) -} - -export default submitted + return ; +}; +export default submitted; export async function getStaticProps({ locale }: any) { return { props: { + noLayout: true, ...(await serverSideTranslations(locale, ["common"])), }, }; -} \ No newline at end of file +} From d351e719cbcf4b3c5ac638b24bca241e9fff9958 Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Fri, 11 Oct 2024 12:45:40 +0530 Subject: [PATCH 03/12] Issue #PS-000 chore: sidebar changes --- src/pages/editor.tsx | 31 ++++++++++++++----------------- src/styles/globals.css | 11 +++++------ 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/pages/editor.tsx b/src/pages/editor.tsx index 5a39e126..209b67e3 100644 --- a/src/pages/editor.tsx +++ b/src/pages/editor.tsx @@ -1,24 +1,21 @@ -import React from 'react' -import dynamic from 'next/dynamic'; -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; - +import React from "react"; +import dynamic from "next/dynamic"; +import { serverSideTranslations } from "next-i18next/serverSideTranslations"; // @ts-ignore -const Editors = dynamic(() => import('editor/Editor'), { ssr: false }); +const Editors = dynamic(() => import("editor/Editor"), { ssr: false }); const Editor = () => { - return ( - - ) -} - -export default Editor + return ; +}; +export default Editor; export async function getStaticProps({ locale }: any) { - return { - props: { - ...(await serverSideTranslations(locale, ["common"])), - }, - }; - } \ No newline at end of file + return { + props: { + noLayout: true, + ...(await serverSideTranslations(locale, ["common"])), + }, + }; +} diff --git a/src/styles/globals.css b/src/styles/globals.css index 52800b78..8ef3c55f 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -79,19 +79,18 @@ ul.MuiList-root li.MuiMenuItem-root[data-value=""] { .ka-thead-cell { font-weight: 600; } -.ka-thead-cell-content -{ +.ka-thead-cell-content { font-weight: normal !important; } .sb-bg-color-primary { - display: none !important; } - .css-14cfeht-MuiContainer-root { - background-color: white; +} -} \ No newline at end of file +.add-to-library { + overflow-y: auto; +} From e7ba729b558ec9acda0173351facbec3de892282 Mon Sep 17 00:00:00 2001 From: Arif-tekdi-technologies Date: Fri, 11 Oct 2024 14:20:52 +0530 Subject: [PATCH 04/12] Issue #PS-2103: Add Workspace UI implementation in admin portal --- next.config.mjs | 59 +++++++++++++++++++++++++++++++++++++ src/pages/upload-editor.tsx | 24 +++++++++++++++ src/styles/globals.css | 13 ++------ 3 files changed, 85 insertions(+), 11 deletions(-) create mode 100644 src/pages/upload-editor.tsx diff --git a/next.config.mjs b/next.config.mjs index 00eef5fc..ccde837d 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -12,6 +12,21 @@ const remotes = (isServer) => { }; }; +const PORTAL_BASE_URL = "https://staging.sunbirded.org"; + +const routes = { + API: { + GENERAL: { + CONTENT_PREVIEW: "/content/preview/:path*", + CONTENT_PLUGINS: "/content-plugins/:path*", + ASSET_PUBLIC: "/assets/public/:path*", + GENERIC_EDITOR: "/generic-editor/:path*", + CONTENT_EDITOR: "/editor/content/:path*", + ASSET_IMAGE: "/assets/images/:path*", + }, + }, +}; + const nextConfig = { eslint: { // Disabling on production builds because we're running checks on PRs via GitHub Actions. @@ -35,10 +50,22 @@ const nextConfig = { source: "/action/asset/v1/upload/:identifier*", // Match asset upload routes destination: `${process.env.WORKSPACE_BASE_URL}/api/fileUpload`, // Forward asset uploads to fileUpload.js }, + { + source: "/action/content/v3/upload/url/:identifier*", // Match content upload with 'url' in the path + destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/action/content/v3/upload/url/:identifier*`, // Forward to proxy route with path as query param + }, + { + source: "/action/content/v3/upload/:identifier*", // Match content upload routes + destination: `${process.env.WORKSPACE_BASE_URL}/api/fileUpload`, // Forward content uploads to fileUpload.js + }, { source: "/action/asset/:path*", // Match other /action/asset routes destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/action/asset/:path*`, // Forward other /action/asset requests to proxy.js }, + { + source: "/action/content/:path*", // Match other /action/asset routes + destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/action/content/:path*`, // Forward other /action/asset requests to proxy.js + }, { source: "/action/:path*", // Match any other routes starting with /action/ destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/action/:path*`, // Forward them to proxy.js @@ -47,6 +74,38 @@ const nextConfig = { source: "/api/:path*", // Match /api/ routes destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/api/:path*`, // Forward them to proxy.js }, + { + source: "/assets/public/:path*", // Match any URL starting with /assets/public/ + destination: `${process.env.CLOUD_STORAGE_URL}/:path*`, // Forward to S3, stripping "/assets/public" + }, + { + source: routes.API.GENERAL.CONTENT_PREVIEW, + destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.CONTENT_PREVIEW}`, // Proxy to portal + }, + { + source: routes.API.GENERAL.CONTENT_PLUGINS, + destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.CONTENT_PLUGINS}`, // Proxy to portal + }, + { + source: routes.API.GENERAL.ASSET_PUBLIC, + destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.ASSET_PUBLIC}`, // Proxy to portal + }, + { + source: routes.API.GENERAL.GENERIC_EDITOR, + destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.GENERIC_EDITOR}`, // Proxy to portal + }, + { + source: routes.API.GENERAL.CONTENT_EDITOR, + destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.CONTENT_EDITOR}`, // Proxy to portal + }, + { + source: routes.API.GENERAL.ASSET_IMAGE, + destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.ASSET_IMAGE}`, // Proxy to portal + }, + { + source: "/app/telemetry", // Match telemetry route + destination: "/api/telemetry", // Redirect to telemetry proxy + }, ]; }, webpack: (config, { isServer }) => { diff --git a/src/pages/upload-editor.tsx b/src/pages/upload-editor.tsx new file mode 100644 index 00000000..2d113875 --- /dev/null +++ b/src/pages/upload-editor.tsx @@ -0,0 +1,24 @@ +import React from 'react' +import dynamic from 'next/dynamic'; +import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; + + +// @ts-ignore +const UploadEditor = dynamic(() => import('editor/UploadEditor'), { ssr: false }); + +const Editor = () => { + return ( + + ) +} + +export default Editor + + +export async function getStaticProps({ locale }: any) { + return { + props: { + ...(await serverSideTranslations(locale, ["common"])), + }, + }; + } \ No newline at end of file diff --git a/src/styles/globals.css b/src/styles/globals.css index 52800b78..49d5f70e 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -79,19 +79,10 @@ ul.MuiList-root li.MuiMenuItem-root[data-value=""] { .ka-thead-cell { font-weight: 600; } -.ka-thead-cell-content -{ +.ka-thead-cell-content { font-weight: normal !important; } -.sb-bg-color-primary { - - display: none !important; -} - - .css-14cfeht-MuiContainer-root { - background-color: white; - -} \ No newline at end of file +} From b573598c3a776252094a17549196c83c82000f23 Mon Sep 17 00:00:00 2001 From: Arif-tekdi-technologies Date: Fri, 11 Oct 2024 14:33:35 +0530 Subject: [PATCH 05/12] Issue #PS-2103: Add Workspace UI implementation in admin portal --- src/styles/globals.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/styles/globals.css b/src/styles/globals.css index 21c53cfc..fd60d0e6 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -87,10 +87,6 @@ ul.MuiList-root li.MuiMenuItem-root[data-value=""] { background-color: white; } -.sb-bg-color-primary { - display: none !important; -} - .css-14cfeht-MuiContainer-root { background-color: white; } From 96b64c504efc72815c4127eb5b7f80bb0922c4d6 Mon Sep 17 00:00:00 2001 From: Arif-tekdi-technologies Date: Fri, 11 Oct 2024 14:39:10 +0530 Subject: [PATCH 06/12] Issue #PS-2103: Add Workspace UI implementation in admin portal --- next.config.mjs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index ccde837d..036ed39e 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -74,10 +74,6 @@ const nextConfig = { source: "/api/:path*", // Match /api/ routes destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/api/:path*`, // Forward them to proxy.js }, - { - source: "/assets/public/:path*", // Match any URL starting with /assets/public/ - destination: `${process.env.CLOUD_STORAGE_URL}/:path*`, // Forward to S3, stripping "/assets/public" - }, { source: routes.API.GENERAL.CONTENT_PREVIEW, destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.CONTENT_PREVIEW}`, // Proxy to portal From 98b426e9469e402b5d8fb2bc13e6b3aea5f87288 Mon Sep 17 00:00:00 2001 From: Arif-tekdi-technologies Date: Fri, 11 Oct 2024 15:30:15 +0530 Subject: [PATCH 07/12] Issue #PS-2103: Add Workspace UI implementation in admin portal --- src/pages/upload-editor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/upload-editor.tsx b/src/pages/upload-editor.tsx index 2d113875..3dae636c 100644 --- a/src/pages/upload-editor.tsx +++ b/src/pages/upload-editor.tsx @@ -14,10 +14,10 @@ const Editor = () => { export default Editor - export async function getStaticProps({ locale }: any) { return { props: { + noLayout: true, ...(await serverSideTranslations(locale, ["common"])), }, }; From 403c6109bc981be65fadc68c139ec0db88e5bb81 Mon Sep 17 00:00:00 2001 From: Rajnish Dargan Date: Mon, 14 Oct 2024 12:25:19 +0530 Subject: [PATCH 08/12] Issue #PS-2194 feat: Fix content-upload and asset upload in admin portal --- next.config.mjs | 17 ++++++----- src/pages/api/fileUpload.ts | 56 +++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 9 deletions(-) create mode 100644 src/pages/api/fileUpload.ts diff --git a/next.config.mjs b/next.config.mjs index 036ed39e..196635c4 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -19,7 +19,6 @@ const routes = { GENERAL: { CONTENT_PREVIEW: "/content/preview/:path*", CONTENT_PLUGINS: "/content-plugins/:path*", - ASSET_PUBLIC: "/assets/public/:path*", GENERIC_EDITOR: "/generic-editor/:path*", CONTENT_EDITOR: "/editor/content/:path*", ASSET_IMAGE: "/assets/images/:path*", @@ -48,15 +47,15 @@ const nextConfig = { return [ { source: "/action/asset/v1/upload/:identifier*", // Match asset upload routes - destination: `${process.env.WORKSPACE_BASE_URL}/api/fileUpload`, // Forward asset uploads to fileUpload.js + destination: '/api/fileUpload' // Forward asset uploads to fileUpload proxy }, { source: "/action/content/v3/upload/url/:identifier*", // Match content upload with 'url' in the path destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/action/content/v3/upload/url/:identifier*`, // Forward to proxy route with path as query param }, { - source: "/action/content/v3/upload/:identifier*", // Match content upload routes - destination: `${process.env.WORKSPACE_BASE_URL}/api/fileUpload`, // Forward content uploads to fileUpload.js + source: '/action/content/v3/upload/:identifier*', // Match content upload routes + destination: '/api/fileUpload', // Forward asset uploads to fileUpload proxy }, { source: "/action/asset/:path*", // Match other /action/asset routes @@ -74,6 +73,10 @@ const nextConfig = { source: "/api/:path*", // Match /api/ routes destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/api/:path*`, // Forward them to proxy.js }, + { + source: '/assets/public/:path*', // Match any URL starting with /assets/public/ + destination: `${process.env.WORKSPACE_BASE_URL}/assets/public/:path*`, // Forward to workspace proxy + }, { source: routes.API.GENERAL.CONTENT_PREVIEW, destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.CONTENT_PREVIEW}`, // Proxy to portal @@ -82,10 +85,6 @@ const nextConfig = { source: routes.API.GENERAL.CONTENT_PLUGINS, destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.CONTENT_PLUGINS}`, // Proxy to portal }, - { - source: routes.API.GENERAL.ASSET_PUBLIC, - destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.ASSET_PUBLIC}`, // Proxy to portal - }, { source: routes.API.GENERAL.GENERIC_EDITOR, destination: `${PORTAL_BASE_URL}${routes.API.GENERAL.GENERIC_EDITOR}`, // Proxy to portal @@ -100,7 +99,7 @@ const nextConfig = { }, { source: "/app/telemetry", // Match telemetry route - destination: "/api/telemetry", // Redirect to telemetry proxy + destination: `${process.env.WORKSPACE_BASE_URL}/api/telemetry`, // Redirect to telemetry proxy }, ]; }, diff --git a/src/pages/api/fileUpload.ts b/src/pages/api/fileUpload.ts new file mode 100644 index 00000000..635dc738 --- /dev/null +++ b/src/pages/api/fileUpload.ts @@ -0,0 +1,56 @@ +import type { NextApiRequest, NextApiResponse } from 'next'; + +export const config = { + api: { + bodyParser: false, // Disable body parsing so we can handle it manually + }, +}; + +export default async function handler(req: NextApiRequest, res: NextApiResponse) { + console.log('req.url ====>', req.url) + if (req.method === 'POST') { + try { + // Create a new Headers object to ensure valid header types + const headers = new Headers(); + + // Forward the incoming request headers, filtering out invalid headers + for (const [key, value] of Object.entries(req.headers)) { + // Exclude 'content-length' as it can cause issues + if (key.toLowerCase() !== 'content-length') { + headers.append(key, value as string); + } + } + + // Read the request body as a stream + const body = await new Promise((resolve, reject) => { + const chunks: Buffer[] = []; + req.on('data', (chunk) => { + chunks.push(Buffer.from(chunk)); + }); + req.on('end', () => { + resolve(Buffer.concat(chunks)); + }); + req.on('error', (err) => { + reject(err); + }); + }); + + // Forward the request to the middleware API + const response = await fetch(`${process.env.WORKSPACE_BASE_URL}` + `${req.url}`, { + method: 'POST', + headers: headers, // Use the new Headers object + body, // Pass the request body as a Buffer + }); + + // Forward the middleware response back to the client + const data = await response.json(); + res.status(response.status).json(data); + } catch (error) { + console.error('Error proxying request:', error); + res.status(500).json({ error: 'Internal Server Error' }); + } + } else { + res.setHeader('Allow', ['POST']); + res.status(405).end(`Method ${req.method} Not Allowed`); + } +} From 455bcea9ccb643c6a011be77fdb4349538a1f366 Mon Sep 17 00:00:00 2001 From: Rajnish Dargan Date: Mon, 14 Oct 2024 12:26:43 +0530 Subject: [PATCH 09/12] Issue #PS-2194 feat: Replacing QS editor WC from project-sunbird to tekdi web component --- src/pages/_document.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx index c5f5fea9..5779813f 100644 --- a/src/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -7,10 +7,10 @@ export default function Document() { From 14889da548f42bb6356c8241450381c390e2491f Mon Sep 17 00:00:00 2001 From: Arif-tekdi-technologies Date: Mon, 14 Oct 2024 15:22:47 +0530 Subject: [PATCH 10/12] Issue #1817 feat: View course planner on admin app UI development --- src/pages/importCsv.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/importCsv.tsx b/src/pages/importCsv.tsx index 3cb17426..77754a20 100644 --- a/src/pages/importCsv.tsx +++ b/src/pages/importCsv.tsx @@ -350,7 +350,7 @@ const ImportCsv = () => { > {t("COURSE_PLANNER.IMPORT_PLANNER")} - + */}