From 3f7c927d9be30d530903c112a3ba69cbb247c68a Mon Sep 17 00:00:00 2001 From: Aitor Algorta Date: Mon, 12 Feb 2024 15:29:29 +0100 Subject: [PATCH 1/3] wip --- frontend/control-center/src/actions/streams/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/control-center/src/actions/streams/index.ts b/frontend/control-center/src/actions/streams/index.ts index 26619e2e6..50027f49f 100644 --- a/frontend/control-center/src/actions/streams/index.ts +++ b/frontend/control-center/src/actions/streams/index.ts @@ -69,7 +69,8 @@ export const getTopicInfo = (topicName: string) => async (dispatch: Dispatch async (dispatch: Dispatch) => { - return getData('subjects').then(response => { + return getData('schemas.list').then(response => { + console.log(response); dispatch(setTopicSchemasAction(response)); return Promise.resolve(true); }); From da9ca7bfb2fed170003e57a7efaf457501f655ce Mon Sep 17 00:00:00 2001 From: Aitor Algorta Date: Tue, 13 Feb 2024 16:20:47 +0100 Subject: [PATCH 2/3] update schemas api --- .../src/actions/streams/index.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/frontend/control-center/src/actions/streams/index.ts b/frontend/control-center/src/actions/streams/index.ts index 50027f49f..3df88fe5f 100644 --- a/frontend/control-center/src/actions/streams/index.ts +++ b/frontend/control-center/src/actions/streams/index.ts @@ -77,7 +77,7 @@ export const getSchemas = () => async (dispatch: Dispatch) => { }; export const getSchemaVersions = (topicName: string) => async (dispatch: Dispatch) => { - return getData(`subjects/${topicName}/versions`).then(response => { + return getData(`schemas.versions?topicName=${topicName}`).then(response => { if (response.error_code && response.error_code.toString().includes('404') && !topicName.includes('-value')) { return Promise.reject('404 Not Found'); } else { @@ -92,7 +92,7 @@ export const getSchemaInfo = (topicName: string, version?: string) => async (dis if (version) { v = version; } - return getData(`subjects/${topicName}/versions/${v}`).then(response => { + return getData(`schemas.info?topicName=${topicName}&version=${v}`).then(response => { if (response.error_code && response.error_code.toString().includes('404') && !topicName.includes('-value')) { return Promise.reject('404 Not Found'); } else { @@ -106,7 +106,7 @@ export const setSchemaSchema = (topicName: string, schema: string) => async () = const body = { schema: JSON.stringify({...JSON.parse(schema)}), }; - return postData(`subjects/${topicName}/versions`, body).then(response => { + return postData(`schemas.update?topicName=${topicName}`, body).then(response => { if (response.error_code && response.error_code.toString().includes('404') && !topicName.includes('-value')) { return Promise.reject('404 Not Found'); } @@ -120,7 +120,7 @@ export const createSchema = (topicName: string, schema: string) => async () => { const body = { schema: JSON.stringify({...JSON.parse(schema)}), }; - return postData(`subjects/${topicName}/versions`, body) + return postData(`schemas.create?topicName=${topicName}`, body) .then(response => { if (response.id) return Promise.resolve(true); if (response.message) return Promise.reject(response.message); @@ -135,7 +135,7 @@ export const checkCompatibilityOfNewSchema = (topicName: string, schema: string, const body = { schema: JSON.stringify({...JSON.parse(schema)}), }; - return postData(`compatibility/subjects/${topicName}/versions/${version}`, body) + return postData(`schemas.compatibility?topicName=${topicName}&version=${version}`, body) .then(response => { if (response.error_code && response.error_code.toString().includes('404') && !topicName.includes('-value')) { return Promise.reject('404 Not Found'); @@ -155,7 +155,7 @@ export const checkCompatibilityOfNewSchema = (topicName: string, schema: string, }; export const deleteSchema = (topicName: string) => async () => { - return deleteData(`subjects/${topicName}`).then(response => { + return deleteData(`schemas.delete?topicName=${topicName}`).then(response => { if (response.error_code && response.error_code.toString().includes('404') && !topicName.includes('-value')) { return Promise.reject('404 Not Found'); } @@ -164,11 +164,7 @@ export const deleteSchema = (topicName: string) => async () => { }; export const getLastMessage = (topicName: string) => async (dispatch: Dispatch) => { - const body = { - ksql: `PRINT '${topicName}' FROM BEGINNING LIMIT 1;`, - streamsProperties: {}, - }; - return postData('query', body).then(response => { + return getData(`schemas.lastMessage?topicName=${topicName}`).then(response => { dispatch(setLastMessage(response)); return Promise.resolve(true); }); From abce21497a5a7828e0e7f2c7eb6c6b643f078d52 Mon Sep 17 00:00:00 2001 From: Aitor Algorta Date: Wed, 14 Feb 2024 15:14:04 +0100 Subject: [PATCH 3/3] change content type for sschemas manager --- frontend/control-center/src/actions/streams/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/control-center/src/actions/streams/index.ts b/frontend/control-center/src/actions/streams/index.ts index 3df88fe5f..2813ef3e8 100644 --- a/frontend/control-center/src/actions/streams/index.ts +++ b/frontend/control-center/src/actions/streams/index.ts @@ -190,11 +190,10 @@ async function postData(url: string, body: any) { const response = await fetch(apiHostUrl + '/' + url, { method: 'POST', headers: { - 'Content-Type': 'application/vnd.schemaregistry.v1+json', + 'Content-Type': 'application/json', }, body: JSON.stringify(body), }); - return response.json(); }