mirror of
https://github.com/Macrame-App/Macrame
synced 2025-12-29 07:19:26 +00:00
Macro recorder update, Macro service added (for the panels)
This commit is contained in:
parent
d07b6eb820
commit
4ce03f7a4b
6 changed files with 48 additions and 24 deletions
|
|
@ -48,17 +48,21 @@ func ListMacros(w http.ResponseWriter, r *http.Request) {
|
|||
log.Println(err)
|
||||
}
|
||||
|
||||
var fileNames []string
|
||||
var macroList []structs.MacroInfo
|
||||
|
||||
for _, file := range files {
|
||||
filename := filepath.Base(file.Name())
|
||||
filename = strings.TrimSuffix(filename, filepath.Ext(filename))
|
||||
filename = strings.Replace(filename, "_", " ", -1)
|
||||
macroname := strings.TrimSuffix(filename, filepath.Ext(filename))
|
||||
nicename := strings.Replace(macroname, "_", " ", -1)
|
||||
|
||||
fileNames = append(fileNames, filename)
|
||||
log.Println(macroname, nicename)
|
||||
macroList = append(macroList, structs.MacroInfo{
|
||||
Name: nicename,
|
||||
Macroname: macroname,
|
||||
})
|
||||
}
|
||||
|
||||
json.NewEncoder(w).Encode(fileNames)
|
||||
json.NewEncoder(w).Encode(macroList)
|
||||
}
|
||||
|
||||
func DeleteMacro(w http.ResponseWriter, r *http.Request) {}
|
||||
|
|
|
|||
|
|
@ -17,3 +17,8 @@ type NewMacro struct {
|
|||
Name string `json:"name"`
|
||||
Steps []Step `json:"steps"`
|
||||
}
|
||||
|
||||
type MacroInfo struct {
|
||||
Name string `json:"name"`
|
||||
Macroname string `json:"macroname"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue