fix: validate account on mapping PUT; gate folders btn during run; prune stale mapping keys; drop dead export
This commit is contained in:
@@ -228,11 +228,20 @@ func (s *Server) handleProbeAccountFolders(w http.ResponseWriter, r *http.Reques
|
||||
|
||||
// handleSetAccountFolderMapping persists one account's rename map + excluded set.
|
||||
func (s *Server) handleSetAccountFolderMapping(w http.ResponseWriter, r *http.Request) {
|
||||
taskID, err := pathID(r, "id")
|
||||
if err != nil {
|
||||
http.Error(w, "bad id", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
accID, err := pathID(r, "accountId")
|
||||
if err != nil {
|
||||
http.Error(w, "bad account id", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if _, ok := s.findAccount(r, taskID, accID); !ok {
|
||||
http.Error(w, "account not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
var body struct {
|
||||
Mapping map[string]string `json:"mapping"`
|
||||
Excluded []string `json:"excluded"`
|
||||
|
||||
@@ -103,9 +103,6 @@ export const probeFolders = (
|
||||
creds: { src_login: string; src_pass: string; dst_login: string; dst_pass: string },
|
||||
) => api<ProbeResult>(`/api/tasks/${taskId}/probe`, jsonBody(creds))
|
||||
|
||||
export const setFolderMapping = (taskId: number, mapping: Record<string, string>) =>
|
||||
api(`/api/tasks/${taskId}/folder-mapping`, { ...jsonBody({ mapping }), method: 'PUT' })
|
||||
|
||||
export const probeAccountFolders = (taskId: number, accId: number) =>
|
||||
api<ProbeResult>(`/api/tasks/${taskId}/accounts/${accId}/probe`, { method: 'POST' })
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ export function FolderMappingModal({
|
||||
const valueFor = (src: string) => choice[src] ?? defaultDst(src, dstFolders, initialMapping)
|
||||
|
||||
function confirm() {
|
||||
const mapping: Record<string, string> = { ...initialMapping }
|
||||
const mapping: Record<string, string> = {}
|
||||
const excluded: string[] = []
|
||||
for (const src of srcFolders) {
|
||||
if (synced[src] === false) {
|
||||
|
||||
@@ -577,7 +577,7 @@ export function TaskDetail({ id }: { id: number }) {
|
||||
<td className="num-cell">{a.errors}</td>
|
||||
<td className="num-cell">
|
||||
<div className="row-actions">
|
||||
{a.status !== 'running' && (
|
||||
{a.status !== 'running' && data?.task.status !== 'running' && (
|
||||
<button
|
||||
type="button"
|
||||
className="link-btn"
|
||||
|
||||
Reference in New Issue
Block a user