@@ -7332,11 +7332,42 @@ let vue = new __WEBPACK_IMPORTED_MODULE_9_vue__["a" /* default */]({
7332
7332
this.saves = instance_names;
7333
7333
});
7334
7334
},
7335
- handle_save_click : function(save) {
7335
+ handle_save_mouseover : function(save) {
7336
7336
local_db.get_instance(save).getItem('plan').then((value) => {
7337
7337
this.save_preview_src = value;
7338
7338
});
7339
7339
},
7340
+ rename_save: function(save) {
7341
+ // Renaming a save is quite involved
7342
+ // 1. Prompt for new name of save
7343
+ // 2. Create a new instance
7344
+ // 3. Populate the new instance with the values of the old instance
7345
+ // 4. Add a pointer to the new instance in instances_db
7346
+ // 5. Delete the old instance and the pointer to it in instances_db
7347
+ const instance = local_db.get_instance(save);
7348
+ __WEBPACK_IMPORTED_MODULE_8_vex_js___default.a.dialog.prompt({
7349
+ message: 'Enter new name for save. If save name already exists, ' +
7350
+ 'it will override the previous save!',
7351
+ callback: (new_name) => {
7352
+ const new_instance = __WEBPACK_IMPORTED_MODULE_0_localforage___default.a.createInstance({
7353
+ name: new_name
7354
+ });
7355
+ instance.iterate( (value, key) => {
7356
+ new_instance.setItem(key, value);
7357
+ });
7358
+ // Add pointer to the new save in index_db
7359
+ const instances_db = __WEBPACK_IMPORTED_MODULE_0_localforage___default.a.createInstance({
7360
+ name: 'instances'
7361
+ });
7362
+ instances_db.getItem('instances').then((instances) => {
7363
+ instances_db.setItem('instances', instances.concat(new_name));
7364
+ // Clear the old key and the reference to it in instances_db
7365
+ this.delete_instance(save);
7366
+ this.update_saves();
7367
+ });
7368
+ }
7369
+ });
7370
+ },
7340
7371
sort_data: function(sort_by) {
7341
7372
this.labels = this.labels.sort( (a,b) => {
7342
7373
if (typeof a[sort_by] === 'number') {
@@ -7644,11 +7675,20 @@ let vue = new __WEBPACK_IMPORTED_MODULE_9_vue__["a" /* default */]({
7644
7675
});
7645
7676
instances_db.clear().then(() => this.update_saves());
7646
7677
},
7647
- /*
7648
7678
delete_instance: function(db_name) {
7649
- //TODO
7679
+ const instances_db = __WEBPACK_IMPORTED_MODULE_0_localforage___default.a.createInstance({
7680
+ name: 'instances'
7681
+ });
7682
+ instances_db.getItem('instances').then((instances) => {
7683
+ let idx = instances.indexOf(db_name);
7684
+ let new_instances = instances;
7685
+ new_instances.splice(idx, 1);
7686
+ instances_db.setItem('instances', new_instances).then(() => {
7687
+ local_db.get_instance(db_name).clear();
7688
+ this.update_saves();
7689
+ });
7690
+ });
7650
7691
},
7651
- */
7652
7692
save_data: function(db_name = new Date().toISOString()) {
7653
7693
const db = local_db.create_instance(db_name);
7654
7694
let p1 = db.setItem('building', globals.BUILDING);
@@ -7657,7 +7697,9 @@ let vue = new __WEBPACK_IMPORTED_MODULE_9_vue__["a" /* default */]({
7657
7697
let p4 = db.setItem('id', globals.ID);
7658
7698
let p5 = db.setItem('plan', globals.PLAN);
7659
7699
7660
- Promise.all([p1, p2, p3, p4, p5]).then(() => this.update_saves());
7700
+ Promise.all([p1, p2, p3, p4, p5]).then(() => {
7701
+ this.update_saves();
7702
+ });
7661
7703
},
7662
7704
load_data: function (db_name) {
7663
7705
let db = local_db.get_instance(db_name);
@@ -19571,7 +19613,7 @@ exports = module.exports = __webpack_require__(9)(undefined);
19571
19613
19572
19614
19573
19615
// module
19574
- exports.push([module.i, "* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nhtml, body {\n margin: 0;\n padding: 0;\n font-family: sans-serif;\n height: 100%;\n width: 100%;\n}\n\n\ncanvas {\n align-self: flex-start;\n padding: 0;\n margin: 0;\n border: 1px solid black; display: block;\n background-color: rgba(220, 220, 220, 1);\n}\n\nnav {\n width: 100%;\n position: fixed;\n}\n\nnav li {\n display: inline-block;\n min-width: 200px;\n height: 40px;\n text-align: center;\n line-height: 40px;/* centers text vertically */\n font-size: 24px;\n border: 1px solid black;\n border-bottom: none;\n border-radius: 0.5rem 0.5rem 0 0;\n margin-right: 2px;\n padding-left: 10px;\n padding-right: 10px;\n}\n\nnav li:hover {\n cursor: pointer;\n background-color: rgba(240, 220, 200, 1);\n}\n\nnav .active {\n background-color: rgba(240, 220, 200, 1);\n}\n\n\n.hidden {\n /*\n display: none;\n */\n}\n\n.wrapper {\n margin-left: 10px;\n margin-right: 10px;\n height: 100%;\n display: flex;\n}\n\n.page-1, .page-2, .page-3 {\n margin-top: 40px; \n height: calc(100%-40px);\n width: 100%;\n } \n\n.page-1 {\n display: flex;\n}\n\n.col1, .col2 {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n padding-bottom: 10px;\n}\n\n.col1 {\n width:100%;\n}\n\n.col2 {\n width: 400px;\n }\n\n.button {\n width: 0.1px;\n height: 0.1px;\n opacity: 0;\n overflow: hidden;\n z-index: -1;\n}\n\n.button + label, .label {\n font-size: 30px;\n display: inline-block;\n border: 2px solid black;\n padding: 10px;\n background-color: rgba(255, 255, 255, 1.0);\n color: black;\n text-decoration: none;\n}\n.button + label, .label{\n cursor:pointer;\n}\n.button + label:hover, .label:hover{\n background-color: rgba(240, 220, 200, 1);\n}\n\n#img-preview {\n min-height: 300px;\n min-width: 300px;\n border: 2px solid black;\n}\n\n.edit-bar {\n}\n\n.nav {\n font-size: 30px;\n width: 80px;\n height: 80px;\n display: inline-block;\n border: 2px solid black;\n padding: 10px;\n background-color: rgba(255, 255, 255, 1.0);\n color: black;\n text-decoration: none;\n cursor:pointer;\n}\n\n.nav:hover {\n background-color: rgba(240, 220, 200, 1);\n}\n\n", ""]);
19616
+ exports.push([module.i, "* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nhtml, body {\n margin: 0;\n padding: 0;\n font-family: sans-serif;\n height: 100%;\n width: 100%;\n}\n\n\ncanvas {\n align-self: flex-start;\n padding: 0;\n margin: 0;\n border: 1px solid black; display: block;\n background-color: rgba(220, 220, 220, 1);\n}\n\nnav {\n width: 100%;\n position: fixed;\n}\n\nnav li {\n display: inline-block;\n min-width: 200px;\n height: 40px;\n text-align: center;\n line-height: 40px;/* centers text vertically */\n font-size: 24px;\n border: 1px solid black;\n border-bottom: none;\n border-radius: 0.5rem 0.5rem 0 0;\n margin-right: 2px;\n padding-left: 10px;\n padding-right: 10px;\n}\n\nnav li:hover {\n cursor: pointer;\n background-color: rgba(240, 220, 200, 1);\n}\n\nnav .active {\n background-color: rgba(240, 220, 200, 1);\n}\n\n\n.hidden {\n /*\n display: none;\n */\n}\n\n.wrapper {\n margin-left: 10px;\n margin-right: 10px;\n height: 100%;\n display: flex;\n}\n\n.page-1, .page-2, .page-3 {\n margin-top: 40px; \n height: calc(100%-40px);\n width: 100%;\n } \n\n.page-1 {\n display: flex;\n}\n\n.col1, .col2 {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n padding-bottom: 10px;\n}\n\n.col1 {\n width:100%;\n}\n\n.col2 {\n width: 400px;\n }\n\n.button {\n width: 0.1px;\n height: 0.1px;\n opacity: 0;\n overflow: hidden;\n z-index: -1;\n}\n\n.button + label, .label {\n font-size: 30px;\n display: inline-block;\n border: 2px solid black;\n padding: 10px;\n background-color: rgba(255, 255, 255, 1.0);\n color: black;\n text-decoration: none;\n}\n.button + label, .label{\n cursor:pointer;\n}\n.button + label:hover, .label:hover{\n background-color: rgba(240, 220, 200, 1);\n}\n\n#img-preview {\n min-height: 300px;\n min-width: 300px;\n border: 2px solid black;\n}\n\n.edit-bar {\n}\n\n.nav {\n font-size: 30px;\n width: 80px;\n height: 80px;\n display: inline-block;\n border: 2px solid black;\n padding: 10px;\n background-color: rgba(255, 255, 255, 1.0);\n color: black;\n text-decoration: none;\n cursor:pointer;\n}\n\n.nav:hover {\n background-color: rgba(240, 220, 200, 1);\n}\n\n.delete {\n text-align: center;\n color: red;\n text-decoration: underline;\n}\n\n.delete:hover {\n cursor: pointer;\n}\n\n", ""]);
19575
19617
19576
19618
// exports
19577
19619
@@ -19711,7 +19753,7 @@ exports = module.exports = __webpack_require__(9)(undefined);
19711
19753
19712
19754
19713
19755
// module
19714
- exports.push([module.i, "#tag-tables, #tag-tables tr, #tag-tables td {\n width: 400px;\n font-family: monospace;\n text-align: center;\n border-collapse: collapse;\n border: 1px solid black;\n}\n\n#tag-tables thead {\n display: block;\n}\n\n#tag-tables tbody {\n display: block;\n height: 425px;\n max-height: 425px;\n overflow-y:scroll;\n}\n\n#tag-tables tr:hover {\n background-color: rgba(200, 200, 200, 1);\n}\n#tag-tables td .editable {\n text-decoration: underline; \n}\n\n#tag-tables td {\n padding-top: 4px;\n padding-bottom: 4px;\n}\n\n#tag-tables a {\n text-align: center;\n color: red;\n text-decoration: underline;\n}\n\n#tag-tables a:hover {\n cursor: pointer;\n}\n\n#tag-tables td img:hover {\n cursor: pointer;\n}\n", ""]);
19756
+ exports.push([module.i, "#tag-tables, #tag-tables tr, #tag-tables td {\n width: 400px;\n font-family: monospace;\n text-align: center;\n border-collapse: collapse;\n border: 1px solid black;\n}\n\n#tag-tables thead {\n display: block;\n}\n\n#tag-tables tbody {\n display: block;\n height: 425px;\n max-height: 425px;\n overflow-y:scroll;\n}\n\n#tag-tables tr:hover {\n background-color: rgba(200, 200, 200, 1);\n}\n#tag-tables td .editable {\n text-decoration: underline; \n}\n\n#tag-tables td {\n padding-top: 4px;\n padding-bottom: 4px;\n}\n\n#tag-tables td img:hover {\n cursor: pointer;\n}\n", ""]);
19715
19757
19716
19758
// exports
19717
19759
0 commit comments