improve workspace export

This commit is contained in:
Stewart Allen 2024-05-31 13:42:24 -04:00
commit 2dcb08e2b9
2 changed files with 40 additions and 28 deletions

View file

@ -618,23 +618,24 @@ gapp.register("kiri.init", [], (root, exports) => {
}); });
} }
function profileExport(workspace) { function profileExport() {
let checked = workspace ? ' checked' : '';
const opt = {pre: [ const opt = {pre: [
"<div class='f-col a-center'>", "<div class='f-col a-center gap5 mlr10'>",
` <h3>${workspace ? "Workspace" : "Profile"} Export</h3>`, " <h3>Workspace Export</h3>",
" <label>This will create a backup of</label>", " <label>This will create a backup of your</label>",
workspace ? " <label>workspace, devices, and settings</label>",
" <label>your workspace and settings</label>" : " <span class='mt10'><input id='excwork' type='checkbox'>&nbsp;Exclude meshes</span>",
" <label>your device profiles and settings</label><br>",
` <div class='f-row' style="display:${workspace ? 'none' : ''}">`,
` <input id='incwork' type='checkbox'${checked}>&nbsp;include workspace`,
" </div>",
"</div>" "</div>"
]}; ]};
uc.confirm("Export Filename", {ok:true, cancel: false}, "workspace", opt).then(name => { let suggestion = "workspace";
if (name) { let file = api.widgets.all()[0]?.meta.file || '';
let work = $('incwork').checked; if (file) {
suggestion = `${suggestion}_${file.split('.')[0]}`.replaceAll(' ','_');
};
uc.confirm("Filename", {ok:true, cancel: false}, suggestion, opt).then(name => {
if (!name) return;
let work = !$('excwork').checked;
let json = api.conf.export({work, clear:true}); let json = api.conf.export({work, clear:true});
kiri.client.zip([ kiri.client.zip([
@ -645,7 +646,6 @@ gapp.register("kiri.init", [], (root, exports) => {
api.show.progress(0); api.show.progress(0);
api.util.download(output, `${name}.kmz`); api.util.download(output, `${name}.kmz`);
}); });
}
}); });
} }
@ -2907,9 +2907,9 @@ gapp.register("kiri.init", [], (root, exports) => {
{ {
let { event } = api; let { event } = api;
let next = 0; let next = 0;
let list = ['rotate','scale','mesh','select']; let list = ['rotate','scale','mesh'];
event.on("tool.next", () => { event.on("tool.next", () => {
event.emit("tool.show", list[next++ % 4]); event.emit("tool.show", list[next++ % list.length]);
}); });
event.on("tool.show", tictac => { event.on("tool.show", tictac => {
if (typeof(tictac) === 'string') { if (typeof(tictac) === 'string') {

View file

@ -418,6 +418,12 @@ th, tr, td, label {
.gap3 { .gap3 {
gap: 3px; gap: 3px;
} }
.gap4 {
gap: 4px;
}
.gap5 {
gap: 5px;
}
.grid { .grid {
display: grid; display: grid;
} }
@ -492,6 +498,12 @@ th, tr, td, label {
.mh85 { .mh85 {
max-height: 85%; max-height: 85%;
} }
.mlr10 {
margin: 0 10px 0 10px;
}
.mt10 {
margin-top: 5px;
}
:-moz-any() { :-moz-any() {
overflow-x: hidden !important; overflow-x: hidden !important;
@ -787,7 +799,7 @@ th, tr, td, label {
#float-tools { #float-tools {
position: absolute; position: absolute;
margin: 0 0 0 5px; margin: 0 0 0 5px;
top: 35px; top: 50px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
z-index: 16; z-index: 16;