Fix stock import UI bugs: dead code, fragile data attr, double-click, silent duplicates

- Remove unused stockMappingsCache variable (dead code after selectStockMappingRow removal)
- Move data-description from SVG to button element for reliable access
- Add disabled guard on bulk add/ignore buttons to prevent duplicate requests
- Return explicit error in UpsertIgnoreRule when rule already exists

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
mchusandClaude Opus 4.6 committed 2026-02-06 23:30:01 +03:00
1 parent 5f2969a85a
commit 72ff842f5d
2 files changed
+72 -53

No files matched your search

+9 -2
View File
@@ -496,11 +496,18 @@ func (s *StockImportService) UpsertIgnoreRule(target, matchType, pattern string)
if target == "" || matchType == "" || pattern == "" {
return fmt.Errorf("target, match_type and pattern are required")
}
return s.db.Clauses(clause.OnConflict{DoNothing: true}).Create(&models.StockIgnoreRule{
res := s.db.Clauses(clause.OnConflict{DoNothing: true}).Create(&models.StockIgnoreRule{
Target: target,
MatchType: matchType,
Pattern: pattern,
}).Error
})
if res.Error != nil {
return res.Error
}
if res.RowsAffected == 0 {
return fmt.Errorf("rule already exists")
}
return nil
}
func (s *StockImportService) DeleteIgnoreRule(id uint) (int64, error) {