Implement TR-069 Upload method

This commit is contained in:
Zaid Abdulla committed 2020-12-08 17:21:18 -08:00
1 parent d29448e3a7
commit dae521ae89
22 files changed
+1016 -68

No files matched your search

+47
View File
@@ -184,6 +184,44 @@ function renderStagingDownload(task: StageTask): Children {
];
}
function renderStagingUpload(task: StageTask): Children {
if (!task.fileName || !task.fileType) invalid.add(task);
else invalid.delete(task);
const typesList = [
"",
"1 Vendor Configuration File",
"2 Vendor Log File",
].map((t) =>
m(
"option",
{ disabled: !t, value: t, selected: (task.fileType || "") === t },
t
)
);
return [
"Fetch ",
m(
"select",
{
onchange: (e) => {
task.fileType = e.target.value;
task.fileName = task.fileType.replace(/\s+/g, "_") + ".txt";
},
},
typesList
),
" as ",
m("input", {
onchange: (e) => {
task.fileName = e.target.value;
},
value: task.fileName || "",
}),
];
}
function renderStaging(staging: Set<StageTask>): Child[] {
const elements: Child[] = [];
@@ -204,6 +242,7 @@ function renderStaging(staging: Set<StageTask>): Child[] {
if (s.name === "setParameterValues")
elms = renderStagingSpv(s, queueFunc, cancelFunc);
else if (s.name === "download") elms = renderStagingDownload(s);
else if (s.name === "upload") elms = renderStagingUpload(s);
const queue = m(
"button.primary",
@@ -323,6 +362,14 @@ function renderQueue(queue: Set<QueueTask>): Child[] {
m(".actions", actions)
)
);
} else if (t.name === "upload") {
details.push(
m(
`div.${t.status}`,
`Fetch file ${t.fileName} (${t.fileType})`,
m(".actions", actions)
)
);
} else {
details.push(m(`div.${t.status}`, t.name, m(".actions", actions)));
}