Skip to content

Commit

Permalink
chore(server, web): support infoboxBlock extension type (#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyshx authored Mar 22, 2024
1 parent 06f7019 commit 459c94f
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 14 deletions.
1 change: 1 addition & 0 deletions server/gql/plugin.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ enum PluginExtensionType {
Story
StoryPage
StoryBlock
InfoboxBlock
}

type PluginExtension {
Expand Down
1 change: 1 addition & 0 deletions server/internal/adapter/gql/generated.go

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

2 changes: 2 additions & 0 deletions server/internal/adapter/gql/gqlmodel/convert_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func ToPluginExtensionType(t plugin.ExtensionType) PluginExtensionType {
return PluginExtensionTypeVisualizer
case plugin.ExtensionTypeInfobox:
return PluginExtensionTypeInfobox
case plugin.ExtensionTypeInfoboxBlock:
return PluginExtensionTypeInfoboxBlock
case plugin.ExtensionTypeCluster:
return PluginExtensionTypeCluster
case plugin.ExtensionTypeStory:
Expand Down
22 changes: 12 additions & 10 deletions server/internal/adapter/gql/gqlmodel/models_gen.go

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

2 changes: 1 addition & 1 deletion server/internal/usecase/interactor/nlslayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func (i *NLSLayer) AddNLSInfoboxBlock(ctx context.Context, inp interfaces.AddNLS
if err != nil {
return nil, nil, err
}
if extension.Type() != plugin.ExtensionTypeBlock {
if extension.Type() != plugin.ExtensionTypeInfoboxBlock {
return nil, nil, interfaces.ErrExtensionTypeMustBeBlock
}
property, err := property.New().NewID().Schema(extension.Schema()).Scene(l.Scene()).Build()
Expand Down
1 change: 1 addition & 0 deletions server/pkg/builtin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var (
PropertySchemaIDVisualizerBetaCesium = property.MustSchemaID("reearth/cesium-beta")
PropertySchemaIDInfobox = property.MustSchemaID("reearth/infobox")
PropertySchemaIDBetaInfobox = property.MustSchemaID("reearth/infobox-beta")
PropertySchemaIDInfoboxBlock = property.MustSchemaID("reearth/infoboxBlock")
PropertySchemaIDStory = property.MustSchemaID("reearth/story")
PropertySchemaIDStoryPage = property.MustSchemaID("reearth/storyPage")
PropertySchemaIDStoryBlock = property.MustSchemaID("reearth/storyBlock")
Expand Down
6 changes: 3 additions & 3 deletions server/pkg/builtin/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2631,7 +2631,7 @@ extensions:
value: true
- id: textInfoboxBetaBlock
name: Text
type: block
type: infoboxBlock
description: Infobox Text Block
schema:
groups:
Expand All @@ -2653,7 +2653,7 @@ extensions:
ui: multiline
- id: imageInfoboxBetaBlock
name: Image
type: block
type: infoboxBlock
description: Infobox Image Block
schema:
groups:
Expand All @@ -2673,7 +2673,7 @@ extensions:
type: string
title: Image
- id: propertyInfoboxBetaBlock
type: block
type: infoboxBlock
name: Property List Block
description: Infobox Property List Block
schema:
Expand Down
1 change: 1 addition & 0 deletions server/pkg/plugin/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var (
ExtensionTypeBlock ExtensionType = "block"
ExtensionTypeVisualizer ExtensionType = "visualizer"
ExtensionTypeInfobox ExtensionType = "infobox"
ExtensionTypeInfoboxBlock ExtensionType = "infoboxBlock"
ExtensionTypeCluster ExtensionType = "cluster"

ExtensionTypeStory ExtensionType = "story"
Expand Down
2 changes: 2 additions & 0 deletions server/pkg/plugin/manifest/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ func (i Extension) extension(pluginID plugin.ID, sys bool, te *TranslatedExtensi
typ = plugin.ExtensionTypeVisualizer
case "infobox":
typ = plugin.ExtensionTypeInfobox
case "infoboxBlock":
typ = plugin.ExtensionTypeInfoboxBlock
case "cluster":
typ = plugin.ExtensionTypeCluster
case "story":
Expand Down
1 change: 1 addition & 0 deletions web/src/classic/gql/graphql-client-api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,7 @@ export enum PluginExtensionType {
Block = 'BLOCK',
Cluster = 'Cluster',
Infobox = 'INFOBOX',
InfoboxBlock = 'InfoboxBlock',
Primitive = 'PRIMITIVE',
Story = 'Story',
StoryBlock = 'StoryBlock',
Expand Down
6 changes: 6 additions & 0 deletions web/src/classic/gql/graphql.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13397,6 +13397,12 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "InfoboxBlock",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "PRIMITIVE",
"description": null,
Expand Down
1 change: 1 addition & 0 deletions web/src/services/gql/__gen__/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1713,6 +1713,7 @@ export enum PluginExtensionType {
Block = 'BLOCK',
Cluster = 'Cluster',
Infobox = 'INFOBOX',
InfoboxBlock = 'InfoboxBlock',
Primitive = 'PRIMITIVE',
Story = 'Story',
StoryBlock = 'StoryBlock',
Expand Down

0 comments on commit 459c94f

Please sign in to comment.