Skip to content

Commit 33f870e

Browse files
authored
feat: improve namespace selector UI/UX (#2161)
1 parent ea7120b commit 33f870e

File tree

73 files changed

+4612
-3408
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+4612
-3408
lines changed

connect-go/gen/proto/wg/cosmo/platform/v1/platform.pb.go

Lines changed: 3208 additions & 2795 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

connect-go/gen/proto/wg/cosmo/platform/v1/platformv1connect/platform.connect.go

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

connect/src/wg/cosmo/platform/v1/platform-PlatformService_connectquery.ts

Lines changed: 17 additions & 1 deletion
Large diffs are not rendered by default.

connect/src/wg/cosmo/platform/v1/platform_connect.ts

Lines changed: 12 additions & 1 deletion
Large diffs are not rendered by default.

connect/src/wg/cosmo/platform/v1/platform_pb.ts

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20142,6 +20142,239 @@ export class GetNamespaceResponse extends Message<GetNamespaceResponse> {
2014220142
}
2014320143
}
2014420144

20145+
/**
20146+
* @generated from message wg.cosmo.platform.v1.WorkspaceNamespace
20147+
*/
20148+
export class WorkspaceNamespace extends Message<WorkspaceNamespace> {
20149+
/**
20150+
* @generated from field: string id = 1;
20151+
*/
20152+
id = "";
20153+
20154+
/**
20155+
* @generated from field: string name = 2;
20156+
*/
20157+
name = "";
20158+
20159+
/**
20160+
* @generated from field: repeated wg.cosmo.platform.v1.WorkspaceFederatedGraph graphs = 3;
20161+
*/
20162+
graphs: WorkspaceFederatedGraph[] = [];
20163+
20164+
constructor(data?: PartialMessage<WorkspaceNamespace>) {
20165+
super();
20166+
proto3.util.initPartial(data, this);
20167+
}
20168+
20169+
static readonly runtime: typeof proto3 = proto3;
20170+
static readonly typeName = "wg.cosmo.platform.v1.WorkspaceNamespace";
20171+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
20172+
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
20173+
{ no: 2, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
20174+
{ no: 3, name: "graphs", kind: "message", T: WorkspaceFederatedGraph, repeated: true },
20175+
]);
20176+
20177+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WorkspaceNamespace {
20178+
return new WorkspaceNamespace().fromBinary(bytes, options);
20179+
}
20180+
20181+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): WorkspaceNamespace {
20182+
return new WorkspaceNamespace().fromJson(jsonValue, options);
20183+
}
20184+
20185+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): WorkspaceNamespace {
20186+
return new WorkspaceNamespace().fromJsonString(jsonString, options);
20187+
}
20188+
20189+
static equals(a: WorkspaceNamespace | PlainMessage<WorkspaceNamespace> | undefined, b: WorkspaceNamespace | PlainMessage<WorkspaceNamespace> | undefined): boolean {
20190+
return proto3.util.equals(WorkspaceNamespace, a, b);
20191+
}
20192+
}
20193+
20194+
/**
20195+
* @generated from message wg.cosmo.platform.v1.WorkspaceFederatedGraph
20196+
*/
20197+
export class WorkspaceFederatedGraph extends Message<WorkspaceFederatedGraph> {
20198+
/**
20199+
* @generated from field: string id = 1;
20200+
*/
20201+
id = "";
20202+
20203+
/**
20204+
* @generated from field: string targetId = 2;
20205+
*/
20206+
targetId = "";
20207+
20208+
/**
20209+
* @generated from field: string name = 3;
20210+
*/
20211+
name = "";
20212+
20213+
/**
20214+
* @generated from field: bool isContract = 4;
20215+
*/
20216+
isContract = false;
20217+
20218+
/**
20219+
* @generated from field: repeated wg.cosmo.platform.v1.WorkspaceSubgraph subgraphs = 5;
20220+
*/
20221+
subgraphs: WorkspaceSubgraph[] = [];
20222+
20223+
constructor(data?: PartialMessage<WorkspaceFederatedGraph>) {
20224+
super();
20225+
proto3.util.initPartial(data, this);
20226+
}
20227+
20228+
static readonly runtime: typeof proto3 = proto3;
20229+
static readonly typeName = "wg.cosmo.platform.v1.WorkspaceFederatedGraph";
20230+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
20231+
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
20232+
{ no: 2, name: "targetId", kind: "scalar", T: 9 /* ScalarType.STRING */ },
20233+
{ no: 3, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
20234+
{ no: 4, name: "isContract", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
20235+
{ no: 5, name: "subgraphs", kind: "message", T: WorkspaceSubgraph, repeated: true },
20236+
]);
20237+
20238+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WorkspaceFederatedGraph {
20239+
return new WorkspaceFederatedGraph().fromBinary(bytes, options);
20240+
}
20241+
20242+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): WorkspaceFederatedGraph {
20243+
return new WorkspaceFederatedGraph().fromJson(jsonValue, options);
20244+
}
20245+
20246+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): WorkspaceFederatedGraph {
20247+
return new WorkspaceFederatedGraph().fromJsonString(jsonString, options);
20248+
}
20249+
20250+
static equals(a: WorkspaceFederatedGraph | PlainMessage<WorkspaceFederatedGraph> | undefined, b: WorkspaceFederatedGraph | PlainMessage<WorkspaceFederatedGraph> | undefined): boolean {
20251+
return proto3.util.equals(WorkspaceFederatedGraph, a, b);
20252+
}
20253+
}
20254+
20255+
/**
20256+
* @generated from message wg.cosmo.platform.v1.WorkspaceSubgraph
20257+
*/
20258+
export class WorkspaceSubgraph extends Message<WorkspaceSubgraph> {
20259+
/**
20260+
* @generated from field: string id = 1;
20261+
*/
20262+
id = "";
20263+
20264+
/**
20265+
* @generated from field: string targetId = 2;
20266+
*/
20267+
targetId = "";
20268+
20269+
/**
20270+
* @generated from field: string name = 3;
20271+
*/
20272+
name = "";
20273+
20274+
constructor(data?: PartialMessage<WorkspaceSubgraph>) {
20275+
super();
20276+
proto3.util.initPartial(data, this);
20277+
}
20278+
20279+
static readonly runtime: typeof proto3 = proto3;
20280+
static readonly typeName = "wg.cosmo.platform.v1.WorkspaceSubgraph";
20281+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
20282+
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
20283+
{ no: 2, name: "targetId", kind: "scalar", T: 9 /* ScalarType.STRING */ },
20284+
{ no: 3, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
20285+
]);
20286+
20287+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WorkspaceSubgraph {
20288+
return new WorkspaceSubgraph().fromBinary(bytes, options);
20289+
}
20290+
20291+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): WorkspaceSubgraph {
20292+
return new WorkspaceSubgraph().fromJson(jsonValue, options);
20293+
}
20294+
20295+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): WorkspaceSubgraph {
20296+
return new WorkspaceSubgraph().fromJsonString(jsonString, options);
20297+
}
20298+
20299+
static equals(a: WorkspaceSubgraph | PlainMessage<WorkspaceSubgraph> | undefined, b: WorkspaceSubgraph | PlainMessage<WorkspaceSubgraph> | undefined): boolean {
20300+
return proto3.util.equals(WorkspaceSubgraph, a, b);
20301+
}
20302+
}
20303+
20304+
/**
20305+
* @generated from message wg.cosmo.platform.v1.GetWorkspaceRequest
20306+
*/
20307+
export class GetWorkspaceRequest extends Message<GetWorkspaceRequest> {
20308+
constructor(data?: PartialMessage<GetWorkspaceRequest>) {
20309+
super();
20310+
proto3.util.initPartial(data, this);
20311+
}
20312+
20313+
static readonly runtime: typeof proto3 = proto3;
20314+
static readonly typeName = "wg.cosmo.platform.v1.GetWorkspaceRequest";
20315+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
20316+
]);
20317+
20318+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetWorkspaceRequest {
20319+
return new GetWorkspaceRequest().fromBinary(bytes, options);
20320+
}
20321+
20322+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetWorkspaceRequest {
20323+
return new GetWorkspaceRequest().fromJson(jsonValue, options);
20324+
}
20325+
20326+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetWorkspaceRequest {
20327+
return new GetWorkspaceRequest().fromJsonString(jsonString, options);
20328+
}
20329+
20330+
static equals(a: GetWorkspaceRequest | PlainMessage<GetWorkspaceRequest> | undefined, b: GetWorkspaceRequest | PlainMessage<GetWorkspaceRequest> | undefined): boolean {
20331+
return proto3.util.equals(GetWorkspaceRequest, a, b);
20332+
}
20333+
}
20334+
20335+
/**
20336+
* @generated from message wg.cosmo.platform.v1.GetWorkspaceResponse
20337+
*/
20338+
export class GetWorkspaceResponse extends Message<GetWorkspaceResponse> {
20339+
/**
20340+
* @generated from field: wg.cosmo.platform.v1.Response response = 1;
20341+
*/
20342+
response?: Response;
20343+
20344+
/**
20345+
* @generated from field: repeated wg.cosmo.platform.v1.WorkspaceNamespace namespaces = 2;
20346+
*/
20347+
namespaces: WorkspaceNamespace[] = [];
20348+
20349+
constructor(data?: PartialMessage<GetWorkspaceResponse>) {
20350+
super();
20351+
proto3.util.initPartial(data, this);
20352+
}
20353+
20354+
static readonly runtime: typeof proto3 = proto3;
20355+
static readonly typeName = "wg.cosmo.platform.v1.GetWorkspaceResponse";
20356+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
20357+
{ no: 1, name: "response", kind: "message", T: Response },
20358+
{ no: 2, name: "namespaces", kind: "message", T: WorkspaceNamespace, repeated: true },
20359+
]);
20360+
20361+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetWorkspaceResponse {
20362+
return new GetWorkspaceResponse().fromBinary(bytes, options);
20363+
}
20364+
20365+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetWorkspaceResponse {
20366+
return new GetWorkspaceResponse().fromJson(jsonValue, options);
20367+
}
20368+
20369+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetWorkspaceResponse {
20370+
return new GetWorkspaceResponse().fromJsonString(jsonString, options);
20371+
}
20372+
20373+
static equals(a: GetWorkspaceResponse | PlainMessage<GetWorkspaceResponse> | undefined, b: GetWorkspaceResponse | PlainMessage<GetWorkspaceResponse> | undefined): boolean {
20374+
return proto3.util.equals(GetWorkspaceResponse, a, b);
20375+
}
20376+
}
20377+
2014520378
/**
2014620379
* @generated from message wg.cosmo.platform.v1.PushCacheWarmerOperationRequest
2014720380
*/

controlplane/src/core/bufservices/PlatformService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ import { getClientsFromAnalytics } from './federated-graph/getClientsFromAnalyti
168168
import { validateAndFetchPluginData } from './plugin/validateAndFetchPluginData.js';
169169
import { linkSubgraph } from './subgraph/linkSubgraph.js';
170170
import { unlinkSubgraph } from './subgraph/unlinkSubgraph.js';
171+
import { getWorkspace } from './workspace/getWorkspace.js';
171172

172173
export default function (opts: RouterOptions): Partial<ServiceImpl<typeof PlatformService>> {
173174
return {
@@ -790,6 +791,10 @@ export default function (opts: RouterOptions): Partial<ServiceImpl<typeof Platfo
790791
return getNamespace(opts, req, ctx);
791792
},
792793

794+
getWorkspace: (req, ctx) => {
795+
return getWorkspace(opts, req, ctx);
796+
},
797+
793798
listRouterCompatibilityVersions: () => {
794799
return listRouterCompatibilityVersions();
795800
},

controlplane/src/core/bufservices/federated-graph/getFederatedGraphById.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export function getFederatedGraphById(
6060
const list = await subgraphRepo.listByFederatedGraph({
6161
federatedGraphTargetId: federatedGraph.targetId,
6262
published: false,
63+
rbac: authContext.rbac,
6364
});
6465

6566
const featureFlags = await featureFlagRepo.getFeatureFlagsByFederatedGraph({

controlplane/src/core/bufservices/federated-graph/getFederatedGraphs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function getFederatedGraphs(
4848
const list: FederatedGraphDTO[] = await fedGraphRepo.list({
4949
limit: req.limit,
5050
offset: req.offset,
51-
namespaceId,
51+
namespaceIds: namespaceId ? [namespaceId] : undefined,
5252
supportsFederation: req.supportsFederation,
5353
rbac: authContext.rbac,
5454
});

controlplane/src/core/bufservices/namespace/deleteNamespace.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,15 @@ export function deleteNamespace(
8080
const namespaceRepo = new NamespaceRepository(tx, authContext.organizationId);
8181
const auditLogRepo = new AuditLogRepository(tx);
8282

83+
const namespaceIds = [ns.id];
8384
const federatedGraphs = await federatedGraphRepo.list({
84-
namespaceId: ns.id,
85+
namespaceIds,
8586
offset: 0,
8687
limit: 0,
8788
});
8889

8990
const subgraphs = await subgraphRepo.list({
90-
namespaceId: ns.id,
91+
namespaceIds,
9192
offset: 0,
9293
limit: 0,
9394
excludeFeatureSubgraphs: false,

0 commit comments

Comments
 (0)