implement export all
This commit is contained in:
@@ -11,8 +11,8 @@ interface Plan {
|
||||
|
||||
const makePlanButtons = (planId: string, deleted: boolean) =>
|
||||
deleted
|
||||
? `<button onclick="doAction('undelete','${planId}')">restore</button><button onclick="doAction('perm-delete','${planId}')">perm delete</button>`
|
||||
: `<button onclick="openPlan('${planId}')">open</button><button onclick="sharePlan('${planId}')">share</button><button onclick="doAction('rename','${planId}')">rename</button><button onclick="doAction('move','${planId}')">move</button><button onclick="doAction('delete','${planId}')">delete</button>`;
|
||||
? `<button class="btn" onclick="doAction('undelete','${planId}')">restore</button><button class="btn" onclick="doAction('perm-delete','${planId}')">perm delete</button>`
|
||||
: `<button class="btn" onclick="openPlan('${planId}')">open</button><button class="btn" onclick="sharePlan('${planId}')">share</button><button class="btn" onclick="doAction('rename','${planId}')">rename</button><button class="btn" onclick="doAction('move','${planId}')">move</button><button class="btn" onclick="doAction('delete','${planId}')">delete</button>`;
|
||||
|
||||
const makePlanItem = (plan: Plan, deleted: boolean) =>
|
||||
`<li>${plan.folder}${plan.folder && '/'}${plan.name} - ${plan.lastUpdated.toLocaleString()} - ${makePlanButtons(plan.id, deleted)}</li>`;
|
||||
@@ -82,19 +82,6 @@ function doAction(action, planId) {
|
||||
}
|
||||
});
|
||||
}
|
||||
function exportPlans() {
|
||||
fetch('/api/export/${userId}')
|
||||
.catch((e) => {
|
||||
e.text().then((text) => {
|
||||
alert(text);
|
||||
});
|
||||
})
|
||||
.then((r) => {
|
||||
r.text().then((text) => {
|
||||
alert(text);
|
||||
});
|
||||
});
|
||||
}
|
||||
function openPlan(planId) {
|
||||
window.open(\`${config.api.publicDomain}share#\${planId}\`);
|
||||
}
|
||||
@@ -165,7 +152,7 @@ function deleteAccount() {
|
||||
<p>Please note: anything modifying data will require you to enter your PIN again as both the web view you are looking at and server behind it are completely stateless for simplicity.</p>
|
||||
<p>DateTimeStamps on this page are all displayed in the US Eastern time zone. I don't care enough to make this extremely basic page dynamic.</p>
|
||||
<h3>${userName}'s Plans:</h3>
|
||||
<button onclick="exportPlans()" disabled style="color:black;cursor:not-allowed;">WIP: export all plans</button>
|
||||
<a href="/api/export/${userId}" download="${userName}-plans.zip" class="btn">download all plans</a>
|
||||
<ul>
|
||||
${plans.map((plan) => makePlanItem(plan, false)).join('')}
|
||||
</ul>
|
||||
@@ -173,6 +160,6 @@ ${plans.map((plan) => makePlanItem(plan, false)).join('')}
|
||||
<ul>
|
||||
${deletedPlans.map((plan) => makePlanItem(plan, true)).join('')}
|
||||
</ul>
|
||||
<button onclick="deleteAccount()">Delete my account</button>
|
||||
<button class="btn" onclick="deleteAccount()">Delete my account</button>
|
||||
</div>`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user