Skip to content

Commit

Permalink
Merge pull request #554 from Jougan-0/makeFunctionGlobal
Browse files Browse the repository at this point in the history
make WriteAndReplaceSVGWithFileSystemPath global w/signoff
  • Loading branch information
Jougan-0 authored Aug 9, 2024
2 parents 077f1b5 + 1b1fd8b commit ca535ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions models/registration/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ func (rh *RegistrationHelper) Register(entity RegisterableEntity) {
register will return an error if it is not able to register the `model`.
If there are errors when registering other entities, they are handled properly but does not stop the registration process.
*/
func (rh *RegistrationHelper)register(pkg packagingUnit) {
func (rh *RegistrationHelper) register(pkg packagingUnit) {
// 1. Register the model
model := pkg.model

// Dont register anything else if registrant is not there
if model.Registrant.Hostname == "" {
err := ErrMissingRegistrant(model.Name)
rh.regErrStore.InsertEntityRegError(model.Registrant.Hostname, "",entity.Model, model.Name, err)
rh.regErrStore.InsertEntityRegError(model.Registrant.Hostname, "", entity.Model, model.Name, err)
return
}
writeAndReplaceSVGWithFileSystemPath(model.Metadata, rh.svgBaseDir, model.Name, model.Name) //Write SVG for models
WriteAndReplaceSVGWithFileSystemPath(model.Metadata, rh.svgBaseDir, model.Name, model.Name) //Write SVG for models
_, _, err := rh.regManager.RegisterEntity(
v1beta1.Host{Hostname: model.Registrant.Hostname},
&model,
Expand All @@ -61,7 +61,7 @@ func (rh *RegistrationHelper)register(pkg packagingUnit) {
// If model cannot be registered, don't register anything else
if err != nil {
err = ErrRegisterEntity(err, string(model.Type()), model.DisplayName)
rh.regErrStore.InsertEntityRegError(model.Registrant.Hostname, "",entity.Model, model.Name, err)
rh.regErrStore.InsertEntityRegError(model.Registrant.Hostname, "", entity.Model, model.Name, err)
return
}

Expand All @@ -70,7 +70,7 @@ func (rh *RegistrationHelper)register(pkg packagingUnit) {
// 2. Register components
for _, comp := range pkg.components {
comp.Model = model
writeAndReplaceSVGWithFileSystemPath(comp.Metadata, rh.svgBaseDir, comp.Model.Name, comp.Component.Kind) //Write SVG on components
WriteAndReplaceSVGWithFileSystemPath(comp.Metadata, rh.svgBaseDir, comp.Model.Name, comp.Component.Kind) //Write SVG on components
_, _, err := rh.regManager.RegisterEntity(
v1beta1.Host{Hostname: hostname},
&comp,
Expand Down
2 changes: 1 addition & 1 deletion models/registration/svg_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func writeHashCheckSVG(key string, val string) {
mx.Unlock()
}

func writeAndReplaceSVGWithFileSystemPath(metadata map[string]interface{}, baseDir, dirname, filename string) {
func WriteAndReplaceSVGWithFileSystemPath(metadata map[string]interface{}, baseDir, dirname, filename string) {
filename = strings.ToLower(filename)
successCreatingDirectory := false
defer func() {
Expand Down

0 comments on commit ca535ba

Please sign in to comment.