|
|
@ -881,7 +881,7 @@ define([
|
|
|
|
if (typeof(data.load) !== "function" || typeof(data.make) !== "function") {
|
|
|
|
if (typeof(data.load) !== "function" || typeof(data.make) !== "function") {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
UIElements.openSnapshotsModal(common, data.load, data.make);
|
|
|
|
UIElements.openSnapshotsModal(common, data.load, data.make, data.remove);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
@ -3312,12 +3312,14 @@ define([
|
|
|
|
Messages.snapshots_button = "Snapshots";
|
|
|
|
Messages.snapshots_button = "Snapshots";
|
|
|
|
Messages.snapshots_new = "New snapshot"; // XXX
|
|
|
|
Messages.snapshots_new = "New snapshot"; // XXX
|
|
|
|
Messages.snapshots_placeholder = "Snapshot title"; // XXX
|
|
|
|
Messages.snapshots_placeholder = "Snapshot title"; // XXX
|
|
|
|
Messages.snapshots_open = "Open";
|
|
|
|
Messages.snapshots_open = "View";
|
|
|
|
UIElements.openSnapshotsModal = function (common, load, make) {
|
|
|
|
Messages.snapshots_delete = "Delete";
|
|
|
|
|
|
|
|
UIElements.openSnapshotsModal = function (common, load, make, remove) {
|
|
|
|
var metadataMgr = common.getMetadataMgr();
|
|
|
|
var metadataMgr = common.getMetadataMgr();
|
|
|
|
var md = metadataMgr.getMetadata();
|
|
|
|
var md = metadataMgr.getMetadata();
|
|
|
|
var snapshots = md.snapshots || {};
|
|
|
|
var snapshots = md.snapshots || {};
|
|
|
|
var modal;
|
|
|
|
var modal;
|
|
|
|
|
|
|
|
var readOnly = common.getMetadataMgr().getPrivateData().readOnly;
|
|
|
|
|
|
|
|
|
|
|
|
var list = Object.keys(snapshots).sort(function (h1, h2) {
|
|
|
|
var list = Object.keys(snapshots).sort(function (h1, h2) {
|
|
|
|
var s1 = snapshots[h1];
|
|
|
|
var s1 = snapshots[h1];
|
|
|
@ -3325,15 +3327,43 @@ define([
|
|
|
|
return s1.time - s2.time;
|
|
|
|
return s1.time - s2.time;
|
|
|
|
}).map(function (hash) {
|
|
|
|
}).map(function (hash) {
|
|
|
|
var s = snapshots[hash];
|
|
|
|
var s = snapshots[hash];
|
|
|
|
var button = h('button.btn.btn-secondary', Messages.snapshots_open);
|
|
|
|
|
|
|
|
$(button).click(function () {
|
|
|
|
var openButton = h('button.cp-snapshot-view.btn.btn-light', [
|
|
|
|
|
|
|
|
h('i.fa.fa-eye'),
|
|
|
|
|
|
|
|
h('span', Messages.snapshots_open)
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
$(openButton).click(function () {
|
|
|
|
load(hash, s);
|
|
|
|
load(hash, s);
|
|
|
|
if (modal && modal.closeModal) { modal.closeModal(); }
|
|
|
|
if (modal && modal.closeModal) {
|
|
|
|
|
|
|
|
modal.closeModal();
|
|
|
|
|
|
|
|
UIElements.openSnapshotsModal(common, load, make, remove);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var deleteButton = h('button.cp-snapshot-delete.btn.btn-light', [
|
|
|
|
|
|
|
|
h('i.fa.fa-trash'),
|
|
|
|
|
|
|
|
h('span', Messages.snapshots_delete)
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
UI.confirmButton(deleteButton, {
|
|
|
|
|
|
|
|
classes: 'btn-danger'
|
|
|
|
|
|
|
|
}, function () {
|
|
|
|
|
|
|
|
remove(hash, s);
|
|
|
|
|
|
|
|
if (modal && modal.closeModal) {
|
|
|
|
|
|
|
|
modal.closeModal();
|
|
|
|
|
|
|
|
UIElements.openSnapshotsModal(common, load, make, remove);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return h('span.cp-snapshot-element', [
|
|
|
|
return h('span.cp-snapshot-element', [
|
|
|
|
h('i.fa.fa-camera'),
|
|
|
|
h('i.fa.fa-camera'),
|
|
|
|
h('span.cp-snapshot-title', s.title),
|
|
|
|
h('span.cp-snapshot-title', [
|
|
|
|
button
|
|
|
|
h('span', s.title),
|
|
|
|
|
|
|
|
h('span.cp-snapshot-time', new Date(s.time).toLocaleString())
|
|
|
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
h('span.cp-snapshot-buttons', [
|
|
|
|
|
|
|
|
readOnly ? undefined : deleteButton,
|
|
|
|
|
|
|
|
openButton,
|
|
|
|
|
|
|
|
])
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -3341,11 +3371,11 @@ define([
|
|
|
|
placeholder: Messages.snapshots_placeholder
|
|
|
|
placeholder: Messages.snapshots_placeholder
|
|
|
|
});
|
|
|
|
});
|
|
|
|
var $input = $(input);
|
|
|
|
var $input = $(input);
|
|
|
|
var content = h('div', [
|
|
|
|
var content = h('div.cp-snapshots-modal', [
|
|
|
|
h('h4', Messages.snapshots_button),
|
|
|
|
h('h5', Messages.snapshots_button),
|
|
|
|
h('div.cp-snapshots-container', list),
|
|
|
|
h('div.cp-snapshots-container', list),
|
|
|
|
h('h5', Messages.snapshots_new),
|
|
|
|
readOnly ? undefined : h('h6', Messages.snapshots_new),
|
|
|
|
input
|
|
|
|
readOnly ? undefined : input
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
var buttons = [{
|
|
|
|
var buttons = [{
|
|
|
@ -3353,9 +3383,11 @@ define([
|
|
|
|
name: Messages.filePicker_close,
|
|
|
|
name: Messages.filePicker_close,
|
|
|
|
onClick: function () {},
|
|
|
|
onClick: function () {},
|
|
|
|
keys: [27],
|
|
|
|
keys: [27],
|
|
|
|
}, {
|
|
|
|
}];
|
|
|
|
|
|
|
|
if (!readOnly) {
|
|
|
|
|
|
|
|
buttons.push({
|
|
|
|
className: 'primary',
|
|
|
|
className: 'primary',
|
|
|
|
icon: 'fa-camera',
|
|
|
|
iconClass: '.fa.fa-camera',
|
|
|
|
name: Messages.snapshots_new,
|
|
|
|
name: Messages.snapshots_new,
|
|
|
|
onClick: function () {
|
|
|
|
onClick: function () {
|
|
|
|
var val = $input.val();
|
|
|
|
var val = $input.val();
|
|
|
@ -3363,7 +3395,8 @@ define([
|
|
|
|
make(val);
|
|
|
|
make(val);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
keys: [],
|
|
|
|
keys: [],
|
|
|
|
}];
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
modal = UI.openCustomModal(UI.dialog.customModal(content, {buttons: buttons }));
|
|
|
|
modal = UI.openCustomModal(UI.dialog.customModal(content, {buttons: buttons }));
|
|
|
|
setTimeout(function () {
|
|
|
|
setTimeout(function () {
|
|
|
|