mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-27 16:17:34 +00:00
Update samples for "vela show xxx --web" (#1616)
* Update samples for "vela show xxx --web" Also stop generating components/traits docs under docs/en/end-user and remove the command from Makefile Fix #1602 * fix doc build issue * Update references/plugins/references.go Co-authored-by: Jianbo Sun <wonderflow.sun@gmail.com> * Enhance --web feature for "vela show" - Find the capability in "vela-system" if notfound in the current ns - Don't depend on local capabilities * add ut for GetCapabilityByName in references/plugins/cluster.go * add ut for GetNamespacedCapabilitiesFromCluster in references/plugins/cluster.go * add ut for GenerateTerraformCapabilityProperties in references/plugins/references.go * fix import issue Co-authored-by: Jianbo Sun <wonderflow.sun@gmail.com>
This commit is contained in:
committed by
yangsoon
co-authored by
Jianbo Sun
parent
2fdd33a80a
commit
e01ff21d30
@@ -80,7 +80,7 @@ func NewCapabilityShowCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra
|
||||
return err
|
||||
}
|
||||
if webSite {
|
||||
return startReferenceDocsSite(ctx, c, ioStreams, capabilityName)
|
||||
return startReferenceDocsSite(ctx, velaEnv.Namespace, c, ioStreams, capabilityName)
|
||||
}
|
||||
return ShowReferenceConsole(ctx, c, ioStreams, capabilityName, velaEnv.Namespace)
|
||||
},
|
||||
@@ -94,7 +94,7 @@ func NewCapabilityShowCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra
|
||||
return cmd
|
||||
}
|
||||
|
||||
func startReferenceDocsSite(ctx context.Context, c common.Args, ioStreams cmdutil.IOStreams, capabilityName string) error {
|
||||
func startReferenceDocsSite(ctx context.Context, ns string, c common.Args, ioStreams cmdutil.IOStreams, capabilityName string) error {
|
||||
home, err := system.GetVelaHomeDir()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -113,13 +113,11 @@ func startReferenceDocsSite(ctx context.Context, c common.Args, ioStreams cmduti
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
capabilities, _, err := plugins.SyncDefinitionsToLocal(ctx, c, definitionPath)
|
||||
capabilities, err := plugins.GetNamespacedCapabilitiesFromCluster(ctx, ns, c, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// check input capability is valid
|
||||
// check whether input capability is valid
|
||||
var capabilityIsValid bool
|
||||
var capabilityType types.CapType
|
||||
for _, c := range capabilities {
|
||||
@@ -378,7 +376,7 @@ func ShowReferenceConsole(ctx context.Context, c common.Args, ioStreams cmdutil.
|
||||
return err
|
||||
}
|
||||
case types.TerraformCategory:
|
||||
propertyConsole, err = ref.GenerateTerraformCapabilityProperties(capability)
|
||||
propertyConsole, err = ref.GenerateTerraformCapabilityProperties(*capability)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user