feat(merge_component): sync new recipe version

add re-read and sync new file after saving, the new file should be appeared on the file list
This commit is contained in:
pakintada@gmail.com 2024-03-04 13:49:11 +07:00
parent 09c21301d6
commit 860dc05cde
2 changed files with 12 additions and 0 deletions

View file

@ -407,7 +407,16 @@ export class MergeComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
to_send
).subscribe({
next: (value) => {
// do alert user with the new filename
// this is ok case
if((value.result as string).includes(".json")){
alert("Upgrade success! New recipe file is " + value.result);
window.location.reload();
} else {
// this is error case
alert(value.result);
}
}
});
}

View file

@ -916,6 +916,9 @@ func (rr *RecipeRouter) upgradeVersion(w http.ResponseWriter, r *http.Request) {
return
}
// refresh recipe files so the running server can see the new file without restart itself
rr.data.AllRecipeFiles = helpers.ScanRecipeFiles(rr.data.Countries)
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]interface{}{
"result": result,