feat: Enhance JSBundle Api to declare auxiliary asset files required for extending components (#6308)

feat: add support for auxiliary asset files to jsBundle

Signed-off-by: lingbo <lingbo@lingbohome.com>
This commit is contained in:
凌波
2024-12-12 16:58:55 +08:00
committed by GitHub
parent af14da361b
commit 54f4a9b893
5 changed files with 284 additions and 65 deletions

View File

@@ -10,6 +10,27 @@ type JSBundleSpec struct {
Raw []byte `json:"raw,omitempty"`
// +optional
RawFrom RawFrom `json:"rawFrom,omitempty"`
// +optional
Assets Assets `json:"assets,omitempty"`
}
type Assets struct {
Style *AuxiliaryStyle `json:"style,omitempty"`
Files []FileLocation `json:"files,omitempty"`
}
type AuxiliaryStyle struct {
Link string `json:"link,omitempty"`
Endpoint `json:",inline"`
}
type FileLocation struct {
Name string `json:"name,omitempty"`
Link string `json:"link,omitempty"`
// Set the MIME Type of the file, if not specified, it will be provided by the content-type response header in the upstream service by default.
// +optional
MIMEType *string `json:"mimeType,omitempty"`
Endpoint `json:",inline"`
}
type RawFrom struct {

View File

@@ -1,4 +1,5 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Code generated by controller-gen. DO NOT EDIT.
@@ -106,6 +107,49 @@ func (in *APIServiceStatus) DeepCopy() *APIServiceStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Assets) DeepCopyInto(out *Assets) {
*out = *in
if in.Style != nil {
in, out := &in.Style, &out.Style
*out = new(AuxiliaryStyle)
(*in).DeepCopyInto(*out)
}
if in.Files != nil {
in, out := &in.Files, &out.Files
*out = make([]FileLocation, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Assets.
func (in *Assets) DeepCopy() *Assets {
if in == nil {
return nil
}
out := new(Assets)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AuxiliaryStyle) DeepCopyInto(out *AuxiliaryStyle) {
*out = *in
in.Endpoint.DeepCopyInto(&out.Endpoint)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuxiliaryStyle.
func (in *AuxiliaryStyle) DeepCopy() *AuxiliaryStyle {
if in == nil {
return nil
}
out := new(AuxiliaryStyle)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ConfigMapKeyRef) DeepCopyInto(out *ConfigMapKeyRef) {
*out = *in
@@ -295,6 +339,27 @@ func (in *ExtensionEntryStatus) DeepCopy() *ExtensionEntryStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FileLocation) DeepCopyInto(out *FileLocation) {
*out = *in
if in.MIMEType != nil {
in, out := &in.MIMEType, &out.MIMEType
*out = new(string)
**out = **in
}
in.Endpoint.DeepCopyInto(&out.Endpoint)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileLocation.
func (in *FileLocation) DeepCopy() *FileLocation {
if in == nil {
return nil
}
out := new(FileLocation)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JSBundle) DeepCopyInto(out *JSBundle) {
*out = *in
@@ -363,6 +428,7 @@ func (in *JSBundleSpec) DeepCopyInto(out *JSBundleSpec) {
copy(*out, *in)
}
in.RawFrom.DeepCopyInto(&out.RawFrom)
in.Assets.DeepCopyInto(&out.Assets)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSBundleSpec.