attrs WIP

This commit is contained in:
zadam 2020-06-21 23:41:51 +02:00
parent f117ae4915
commit 22302e8200
5 changed files with 74 additions and 16 deletions

View file

@ -0,0 +1,2 @@
UPDATE attributes SET type = 'label', name = 'label:' || name WHERE type = 'label-definition';
UPDATE attributes SET type = 'label', name = 'relation:' || name WHERE type = 'relation-definition';

View file

@ -94,8 +94,8 @@ const TPL = `
z-index: 1000;
padding: 10px;
position: absolute;
max-width: 400px;
max-height: 500px;
max-width: 600px;
max-height: 600px;
overflow: auto;
}
@ -104,9 +104,61 @@ const TPL = `
margin-top: 10px;
margin-bottom: 10px;
}
.attr-edit {
width: 100%;
}
.attr-edit th {
text-align: left;
}
.attr-edit td input {
width: 100%;
}
</style>
<div class="attr-extras" style="display: none;">
<h5>Label detail</h5>
<table class="attr-edit">
<tr>
<th>Name:</th>
<td><input type="text" class="form-control form-control-sm" /></td>
</tr>
<tr>
<th>Value:</th>
<td><input type="text" class="form-control form-control-sm" /></td>
</tr>
<tr>
<th>Inheritable:</th>
<td><input type="checkbox" class="form-control form-control-sm" /></td>
</tr>
<tr>
<td colspan="2">
<div style="display: flex; justify-content: space-between">
<div>
<button type="submit" class="btn btn-sm btn-primary">Save</button>
<button type="submit" class="btn btn-sm btn-secondary">Cancel</button>
</div>
<div>
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
</div>
</div>
</td>
</tr>
</table>
<br/>
<h5>Other notes with this label</h5>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="match-value-too">
<label class="form-check-label" for="match-value-too">match value too</label>
</div>
<div class="attr-extras-title"></div>
<ul class="attr-extras-list"></ul>
@ -152,11 +204,11 @@ export default class NoteAttributesWidget extends TabAwareWidget {
this.$attrExtras.hide();
});
this.$editor.on('blur', () => {
this.save();
this.$attrExtras.hide();
});
// this.$editor.on('blur', () => {
// this.save();
//
// this.$attrExtras.hide();
// });
return this.$widget;
}
@ -253,6 +305,8 @@ export default class NoteAttributesWidget extends TabAwareWidget {
);
}
this.$attrExtrasTitle.hide();
this.$attrExtrasList.empty();
const displayedResults = results.length <= DISPLAYED_NOTES ? results : results.slice(0, DISPLAYED_NOTES);

View file

@ -4,7 +4,7 @@ const build = require('./build');
const packageJson = require('../../package');
const {TRILIUM_DATA_DIR} = require('./data_dir');
const APP_DB_VERSION = 158;
const APP_DB_VERSION = 159;
const SYNC_VERSION = 14;
const CLIPPER_PROTOCOL_VERSION = "1.0";
@ -16,4 +16,4 @@ module.exports = {
buildRevision: build.buildRevision,
dataDirectory: TRILIUM_DATA_DIR,
clipperProtocolVersion: CLIPPER_PROTOCOL_VERSION
};
};

View file

@ -9,7 +9,6 @@ const sqlInit = require('./sql_init');
const syncMutexService = require('./sync_mutex');
const attributeService = require('./attributes');
const cls = require('./cls');
const utils = require('./utils');
const Database = require('better-sqlite3');
function regularBackup() {
@ -100,12 +99,15 @@ if (!fs.existsSync(dataDir.BACKUP_DIR)) {
fs.mkdirSync(dataDir.BACKUP_DIR, 0o700);
}
sqlInit.dbReady.then(() => {
setInterval(cls.wrap(regularBackup), 4 * 60 * 60 * 1000);
// hack
setTimeout(() => {
sqlInit.dbReady.then(() => {
setInterval(cls.wrap(regularBackup), 4 * 60 * 60 * 1000);
// kickoff first backup soon after start up
setTimeout(cls.wrap(regularBackup), 5 * 60 * 1000);
});
// kickoff first backup soon after start up
setTimeout(cls.wrap(regularBackup), 5 * 60 * 1000);
});
}, 5000);
module.exports = {
backupNow,

View file

@ -42,7 +42,7 @@ function getAndClearSyncRows() {
}
function addSyncRow(syncRow) {
const syncRows = getSyncRows();
const syncRows = namespace.get('syncRows') || [];
syncRows.push(syncRow);