Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deduplication for models w/signoff #610

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading