fix multiple UI bugs, closes #2616

This commit is contained in:
zadam 2022-02-07 22:50:28 +01:00
parent 1c4358086d
commit 0ca9bff61b
6 changed files with 44 additions and 44 deletions

View File

@ -42,8 +42,10 @@ class EtapiToken extends AbstractEntity {
/** @type {boolean} */ /** @type {boolean} */
this.isDeleted = !!row.isDeleted; this.isDeleted = !!row.isDeleted;
if (this.etapiTokenId) {
this.becca.etapiTokens[this.etapiTokenId] = this; this.becca.etapiTokens[this.etapiTokenId] = this;
} }
}
init() { init() {
if (this.etapiTokenId) { if (this.etapiTokenId) {

View File

@ -62,12 +62,12 @@ export default class EtapiOptions {
return; return;
} }
const {token} = await server.post('etapi-tokens', {tokenName}); const {authToken} = await server.post('etapi-tokens', {tokenName});
await promptDialog.ask({ await promptDialog.ask({
title: "ETAPI token created", title: "ETAPI token created",
message: 'Copy the created token into clipboard. Trilium stores the token hashed and this is the last time you see it.', message: 'Copy the created token into clipboard. Trilium stores the token hashed and this is the last time you see it.',
defaultValue: token defaultValue: authToken
}); });
this.refreshTokens(); this.refreshTokens();

View File

@ -51,7 +51,8 @@ $dialog.on("hidden.bs.modal", () => {
} }
}); });
$form.on('submit', () => { $form.on('submit', e => {
e.preventDefault();
resolve($answer.val()); resolve($answer.val());
$dialog.modal('hide'); $dialog.modal('hide');

View File

@ -9,9 +9,7 @@ function getTokens() {
} }
function createToken(req) { function createToken(req) {
return { return etapiTokenService.createToken(req.body.tokenName);
authToken: etapiTokenService.createToken(req.body.tokenName)
};
} }
function patchToken(req) { function patchToken(req) {

View File

@ -93,8 +93,7 @@ function deleteToken(etapiTokenId) {
return; // ok, already deleted return; // ok, already deleted
} }
etapiToken.isDeleted = true; etapiToken.markAsDeletedSimple();
etapiToken.save();
} }
module.exports = { module.exports = {

View File

@ -1,5 +1,5 @@
<div id="prompt-dialog" class="modal mx-auto" tabindex="-1" role="dialog"> <div id="prompt-dialog" class="modal mx-auto" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document"> <div class="modal-dialog modal-lg" role="document">
<div class="modal-content"> <div class="modal-content">
<form id="prompt-dialog-form"> <form id="prompt-dialog-form">
<div class="modal-header"> <div class="modal-header">