mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-11 18:24:43 +02:00
Desktop: Add "Retry all" button to sync status screen for items that could not be uploaded
This commit is contained in:
parent
75b66a9fff
commit
ca487ade9a
@ -147,7 +147,10 @@ function StatusScreen(props: Props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (section.canRetryAll) {
|
if (section.canRetryAll) {
|
||||||
itemsHtml.push(renderSectionRetryAllHtml(section.title, section.retryAllHandler));
|
itemsHtml.push(renderSectionRetryAllHtml(section.title, async () => {
|
||||||
|
await section.retryAllHandler();
|
||||||
|
void resfreshScreen();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
return <div key={key}>{itemsHtml}</div>;
|
return <div key={key}>{itemsHtml}</div>;
|
||||||
|
@ -140,6 +140,28 @@ export default class ReportService {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private addRetryAllHandler(section: ReportSection): ReportSection {
|
||||||
|
const retryHandlers: Function[] = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < section.body.length; i++) {
|
||||||
|
const item: RerportItemOrString = section.body[i];
|
||||||
|
if (typeof item !== 'string' && item.canRetry) {
|
||||||
|
retryHandlers.push(item.retryHandler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retryHandlers.length) {
|
||||||
|
section.canRetryAll = true;
|
||||||
|
section.retryAllHandler = async () => {
|
||||||
|
for (const retryHandler of retryHandlers) {
|
||||||
|
await retryHandler();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return section;
|
||||||
|
}
|
||||||
|
|
||||||
async status(syncTarget: number): Promise<ReportSection[]> {
|
async status(syncTarget: number): Promise<ReportSection[]> {
|
||||||
const r = await this.syncStatus(syncTarget);
|
const r = await this.syncStatus(syncTarget);
|
||||||
const sections: ReportSection[] = [];
|
const sections: ReportSection[] = [];
|
||||||
@ -175,6 +197,8 @@ export default class ReportService {
|
|||||||
|
|
||||||
section.body.push({ type: ReportItemType.CloseList });
|
section.body.push({ type: ReportItemType.CloseList });
|
||||||
|
|
||||||
|
section = this.addRetryAllHandler(section);
|
||||||
|
|
||||||
sections.push(section);
|
sections.push(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,23 +224,7 @@ export default class ReportService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const retryHandlers: Function[] = [];
|
section = this.addRetryAllHandler(section);
|
||||||
|
|
||||||
for (let i = 0; i < section.body.length; i++) {
|
|
||||||
const item: RerportItemOrString = section.body[i];
|
|
||||||
if (typeof item !== 'string' && item.canRetry) {
|
|
||||||
retryHandlers.push(item.retryHandler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (retryHandlers.length > 1) {
|
|
||||||
section.canRetryAll = true;
|
|
||||||
section.retryAllHandler = async () => {
|
|
||||||
for (const retryHandler of retryHandlers) {
|
|
||||||
await retryHandler();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
sections.push(section);
|
sections.push(section);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user