generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: populate verb right panel and verb schema (#1452)
Updates: - Populate right panel with ingress and calls - Add verb schema tab to view the verb's schema - Fix layout bugs on call list - Refactor and reuse code Fixes #734 Fixes #1377 ![Screenshot 2024-05-09 at 1 02 11 PM](https://github.com/TBD54566975/ftl/assets/51647/5c7d2d52-af06-45c3-98cb-c4ecb0d3d7e3) ![Screenshot 2024-05-09 at 12 56 12 PM](https://github.com/TBD54566975/ftl/assets/51647/2040746d-c2f0-4860-9119-f47f67819e53)
- Loading branch information
1 parent
3066d64
commit ffa5eca
Showing
17 changed files
with
249 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package controller | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/TBD54566975/ftl/backend/schema" | ||
"github.com/alecthomas/assert/v2" | ||
) | ||
|
||
func TestVerbSchemaString(t *testing.T) { | ||
verb := &schema.Verb{ | ||
Name: "Echo", | ||
Request: &schema.Ref{Module: "foo", Name: "EchoRequest"}, | ||
Response: &schema.Ref{Module: "foo", Name: "EchoResponse"}, | ||
} | ||
sch := &schema.Schema{ | ||
Modules: []*schema.Module{ | ||
{Name: "foo", Decls: []schema.Decl{ | ||
verb, | ||
&schema.Data{ | ||
Name: "EchoRequest", | ||
Fields: []*schema.Field{ | ||
{Name: "Name", Type: &schema.String{}}, | ||
{Name: "Nested", Type: &schema.Ref{Module: "foo", Name: "Nested"}}, | ||
{Name: "External", Type: &schema.Ref{Module: "bar", Name: "BarData"}}, | ||
}, | ||
}, | ||
&schema.Data{ | ||
Name: "EchoResponse", | ||
Fields: []*schema.Field{ | ||
{Name: "Message", Type: &schema.String{}}, | ||
}, | ||
}, | ||
&schema.Data{ | ||
Name: "Nested", | ||
Fields: []*schema.Field{ | ||
{Name: "Field", Type: &schema.String{}}, | ||
}, | ||
}, | ||
}}, | ||
{Name: "bar", Decls: []schema.Decl{ | ||
verb, | ||
&schema.Data{ | ||
Name: "BarData", | ||
Export: true, | ||
Fields: []*schema.Field{ | ||
{Name: "Name", Type: &schema.String{}}, | ||
}, | ||
}}, | ||
}}, | ||
} | ||
|
||
expected := `data EchoRequest { | ||
Name String | ||
Nested foo.Nested | ||
External bar.BarData | ||
} | ||
data Nested { | ||
Field String | ||
} | ||
export data BarData { | ||
Name String | ||
} | ||
data EchoResponse { | ||
Message String | ||
} | ||
verb Echo(foo.EchoRequest) foo.EchoResponse` | ||
|
||
schemaString, err := verbSchemaString(sch, verb) | ||
assert.NoError(t, err) | ||
assert.Equal(t, expected, schemaString) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const RightPanelAttribute = ({ name, value }: { name?: string, value?: string }) => { | ||
return ( | ||
<div className='flex justify-between space-x-2 items-center text-sm'> | ||
<span className='text-gray-500 dark:text-gray-400'>{name}</span> | ||
<span className='flex-1 min-w-0 text-right' title={value}> | ||
<pre className='whitespace-pre-wrap overflow-x-scroll'>{value}</pre> | ||
</span> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.