Skip to content

Commit

Permalink
⚡ add blueprint spec version
Browse files Browse the repository at this point in the history
  • Loading branch information
zcubbs committed May 20, 2024
1 parent fb4d23a commit 5fbbba4
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 35 deletions.
5 changes: 3 additions & 2 deletions cmd/server/api/rpc_get_blueprints.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ func (s *Server) GetBlueprints(_ context.Context, req *pb.GetBlueprintListReques
blueprints := make([]*pb.Blueprint, 0)
for _, bpt := range blueprint.GetAllBlueprints() {
blueprints = append(blueprints, &pb.Blueprint{
Spec: toSpecPb(bpt.Spec),
Type: string(bpt.Type),
Spec: toSpecPb(bpt.Spec),
Type: string(bpt.Type),
Version: bpt.Spec.Version,
})
}

Expand Down
3 changes: 3 additions & 0 deletions cmd/server/docs/swagger/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@
},
"type": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
Expand Down
50 changes: 30 additions & 20 deletions proto/gen/v1/blueprint.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/gen/v1/blueprint_service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/gen/v1/blueprint_service_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/gen/v1/empty.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/gen/v1/rpc_generate_project.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/gen/v1/rpc_get_blueprints.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/gen/v1/rpc_get_bucket_objects.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/gen/v1/rpc_ping.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions proto/v1/blueprint.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ option go_package = "github.com/zcubbs/power";
message Blueprint {
Spec spec = 1;
string type = 2;
string version = 3;
}

message Spec {
Expand Down
4 changes: 3 additions & 1 deletion web/start/src/components/BlueprintCustomizationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ const BlueprintCustomizationDialog: React.FC<BlueprintCustomizationDialogProps>
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
<Button variant="outline">Use</Button>
<Button variant="secondary">
Use
</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
Expand Down
13 changes: 8 additions & 5 deletions web/start/src/components/BlueprintTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ const BlueprintTile: React.FC<BlueprintTileProps> = ({blueprint}) => {

const getColoredBadge = () => {
if (blueprint.type === 'built-in') {
return <Badge variant="secondary">Built-in</Badge>;
return <Badge variant="secondary" className="text-sm">Built-in</Badge>;
} else if (blueprint.type === 'plugin') {
return <Badge variant="default">Plugin</Badge>;
return <Badge variant="secondary" className="text-sm">Plugin</Badge>;
} else if (blueprint.type === 'registrar') {
return <Badge variant="default">Registrar</Badge>;
return <Badge variant="secondary" className="text-sm">Registrar</Badge>;
} else {
return <Badge variant="outline">Unknown</Badge>;
return <Badge variant="outline" className="text-sm">Unknown</Badge>;
}
}

return (
<Card className="rounded-lg shadow-lg">
<CardHeader>
<CardTitle className="text-xl font-bold">
<CardTitle className="text-xl font-bold shadow-lg">
{blueprint.spec.name}
</CardTitle>
<CardDescription>{blueprint.spec.description}</CardDescription>
Expand All @@ -73,6 +73,9 @@ const BlueprintTile: React.FC<BlueprintTileProps> = ({blueprint}) => {
<div className="flex items-center justify-between col-span-2">
<div className="flex items-center">
{getColoredBadge()}
<Badge variant="secondary" className="ml-2 fw-bold text-sm">
{blueprint.version}
</Badge>
</div>
<div className="flex items-center justify-end col-span-2">
<BlueprintCustomizationDialog blueprint={blueprint} onGenerate={handleGenerate}/>
Expand Down
1 change: 1 addition & 0 deletions web/start/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export interface Blueprint {
spec: Spec;
type: string;
version: string;
}

export interface Spec {
Expand Down

0 comments on commit 5fbbba4

Please sign in to comment.