Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend: use "console" api instead of "dataplane" api for wasm trans… #1314

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions frontend/src/components/RequireAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export default class RequireAuth extends Component<{children: ReactNode}> {
canDeleteSchemas: true,
canManageSchemaRegistry: true,
canViewSchemas: true,
canListTransforms: true,
canCreateTransforms: true,
canDeleteTransforms: true,
seat: null as any,
user: { providerID: -1, providerName: 'debug provider', id: 'debug', internalIdentifier: 'debug', meta: { avatarUrl: '', email: '', name: 'local fake user for debugging' } }
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { createConnectTransport } from '@connectrpc/connect-web';
import { ConsoleService } from './protogen/redpanda/api/console/v1alpha1/console_service_connect';
import { SecurityService } from './protogen/redpanda/api/console/v1alpha1/security_connect';
import { RedpandaConnectService } from './protogen/redpanda/api/console/v1alpha1/rp_connect_connect';
import { TransformService } from './protogen/redpanda/api/dataplane/v1alpha1/transform_connect';
import { TransformService } from './protogen/redpanda/api/console/v1alpha1/transform_connect';

declare const __webpack_public_path__: string;

Expand Down
22 changes: 16 additions & 6 deletions frontend/src/state/backendApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ const apiStore = {
canDeleteSchemas: true,
canManageSchemaRegistry: true,
canViewSchemas: true,
canListTransforms: true,
canCreateTransforms: true,
canDeleteTransforms: true,
seat: null as any,
user: { providerID: -1, providerName: 'debug provider', id: 'debug', internalIdentifier: 'debug', meta: { avatarUrl: '', email: '', name: 'local fake user for debugging' } }
};
Expand Down Expand Up @@ -1697,13 +1700,16 @@ export const transformsApi = observable({
const transforms: TransformMetadata[] = [];
let nextPageToken = '';
while (true) {
const res = await client.listTransforms({ pageSize: 500, pageToken: nextPageToken });
const res = await client.listTransforms({ request: { pageSize: 500, pageToken: nextPageToken } });
const r = res.response;
if (!r)
break;

transforms.push(...res.transforms);
transforms.push(...r.transforms);

if (!res.nextPageToken || res.nextPageToken.length == 0)
if (!r.nextPageToken || r.nextPageToken.length == 0)
break;
nextPageToken = res.nextPageToken;
nextPageToken = r.nextPageToken;
}

runInAction(() => {
Expand All @@ -1718,7 +1724,11 @@ export const transformsApi = observable({
const client = appConfig.transformsClient;
if (!client) throw new Error('transforms client is not initialized');

const r = await client.getTransform({ name });
const res = await client.getTransform({ request: { name } });
const r = res.response;
if (!r)
throw new Error('got empty response from getTransform');

if (!r.transform) return;

this.transformDetails.set(r.transform.name, r.transform);
Expand All @@ -1728,7 +1738,7 @@ export const transformsApi = observable({
const client = appConfig.transformsClient;
if (!client) throw new Error('transforms client is not initialized');

await client.deleteTransform({ name });
await client.deleteTransform({ request: { name } });
},

});
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/state/restInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,10 @@ export interface UserData {
canCreateSchemas: boolean;
canDeleteSchemas: boolean;
canManageSchemaRegistry: boolean;

canListTransforms: boolean;
canCreateTransforms: boolean;
canDeleteTransforms: boolean;
}
export type UserPermissions = Exclude<keyof UserData, 'user' | 'seat'>;

Expand Down
Loading