Skip to content

Commit

Permalink
Merge pull request #610 from Jougan-0/removeDedupliaction
Browse files Browse the repository at this point in the history
remove deduplication for models w/signoff
  • Loading branch information
Jougan-0 authored Oct 15, 2024
2 parents 05d562e + 7b3c050 commit 140d9a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions models/registration/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func (rh *RegistrationHelper) register(pkg PackagingUnit) {
rh.svgBaseDir,
model.Name,
model.Name,
true,
)
if svgCompletePath != "" {
model.Metadata.SvgComplete = &svgCompletePath
Expand Down Expand Up @@ -120,6 +121,7 @@ func (rh *RegistrationHelper) register(pkg PackagingUnit) {
rh.svgBaseDir,
comp.Model.Name,
comp.Component.Kind,
false,
)
}

Expand Down
10 changes: 4 additions & 6 deletions 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(svgColor, svgWhite, svgComplete string, baseDir, dirname, filename string) (svgColorPath, svgWhitePath, svgCompletePath string) {
func WriteAndReplaceSVGWithFileSystemPath(svgColor, svgWhite, svgComplete string, baseDir, dirname, filename string, isModel bool) (svgColorPath, svgWhitePath, svgCompletePath string) {
filename = strings.ToLower(filename)
successCreatingDirectory := false
defer func() {
Expand All @@ -40,7 +40,7 @@ func WriteAndReplaceSVGWithFileSystemPath(svgColor, svgWhite, svgComplete string
hash := md5.Sum([]byte(svgColor))
hashString := hex.EncodeToString(hash[:])
pathsvg := hashCheckSVG[hashString]
if pathsvg != "" { // the image has already been loaded, point the component to that path
if pathsvg != "" && !isModel { // the image has already been loaded, point the component to that path
svgColorPath = pathsvg
goto White
}
Expand All @@ -59,7 +59,7 @@ func WriteAndReplaceSVGWithFileSystemPath(svgColor, svgWhite, svgComplete string

}
White:
if svgWhite != "" {
if svgWhite != "" && !isModel {
path := filepath.Join(baseDir, dirname, "white")
err := os.MkdirAll(path, 0777)
if err != nil {
Expand Down Expand Up @@ -90,7 +90,7 @@ White:

}
Complete:
if svgComplete != "" {
if svgComplete != "" && !isModel {
path := filepath.Join(baseDir, dirname, "complete")
err := os.MkdirAll(path, 0777)
if err != nil {
Expand Down Expand Up @@ -123,8 +123,6 @@ Complete:
return
}

// func WriteAndReplaceSVGWithFileSystemPath(metadata map[string]interface{}, baseDir, dirname, filename string) {

func getRelativePathForAPI(baseDir, path string) string {
ui := strings.TrimPrefix(baseDir, "../../")
return filepath.Join(ui, path)
Expand Down

0 comments on commit 140d9a5

Please sign in to comment.