This commit is contained in:
Mateusz Gruszczyński
2026-09-18 23:57:28 +02:00
parent 00cbe975bb
commit be3708f14d
17 changed files with 424 additions and 83 deletions
+65 -1
View File
@@ -10342,4 +10342,68 @@ select.select-native-proxy[aria-invalid="true"]+.custom-select .custom-select-tr
.public-custom-chart-wrap {
min-height: 140px;
}
}
}
/* Keep Flow interpretation compact on every viewport. Details are opt-in. */
.flow-natural-preview {
display: block;
min-height: 0;
max-height: none;
padding: 0;
overflow: hidden;
}
.flow-preview-toggle {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
min-height: 40px;
padding: 8px 14px;
border: 0;
border-radius: 0;
background: var(--surface);
color: var(--text);
text-align: left;
cursor: pointer;
}
.flow-preview-toggle strong {
font-size: .8rem;
}
.flow-preview-toggle-icon {
color: var(--muted);
font-size: 1rem;
transition: transform .15s ease;
}
.flow-preview-details {
display: none;
flex-direction: column;
align-items: stretch;
gap: 8px;
max-height: 34dvh;
padding: 9px 14px 11px;
overflow: auto;
}
.flow-natural-preview.is-expanded .flow-preview-details {
display: flex;
}
.flow-natural-preview.is-expanded .flow-preview-toggle {
border-bottom: 1px solid var(--line);
}
.flow-natural-preview.is-expanded .flow-preview-toggle-icon {
transform: rotate(180deg);
}
.flow-natural-preview .flow-preview-runtime {
justify-content: start;
text-align: left;
}
.flow-natural-preview .flow-preview-runtime span {
white-space: normal;
}
+12 -1
View File
@@ -731,6 +731,17 @@ function flowSourcePayload() {
};
}
function flowExportSharedInputs() {
if (!app.flowDraft) return [];
const ids = new Set((app.flowDraft.nodes || [])
.filter(node => node.kind === 'shared_input')
.map(node => node.config?.input_id)
.filter(Boolean));
return (app.flowSharedInputs || [])
.filter(item => ids.has(item.id))
.map(item => JSON.parse(JSON.stringify(item)));
}
function downloadJsonFile(filename, data) {
const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
const url = URL.createObjectURL(blob); const a = document.createElement('a');
@@ -743,7 +754,7 @@ async function exportFlow() {
try {
const envelope = app.flowDraft.id && !app.flowDirty
? await api(`/api/flows/${encodeURIComponent(app.flowDraft.id)}/export`)
: { format: 'gree-controller-flow', version: 1, exported_at: new Date().toISOString(), flow: flowSourcePayload() };
: { format: 'gree-controller-flow', version: 1, exported_at: new Date().toISOString(), shared_inputs: flowExportSharedInputs(), flow: flowSourcePayload() };
const safe = (flowSourcePayload()?.name || 'flow').replace(/[^a-z0-9_-]+/gi, '-').replace(/^-+|-+$/g, '').toLowerCase() || 'flow';
downloadJsonFile(`${safe}.flow.json`, envelope); toast(tr('flow.exported'));
} catch (error) { toast(error.message, true); }