diff options
| author | bozo.kopic <bozo@kopic.xyz> | 2022-06-26 17:28:49 +0200 |
|---|---|---|
| committer | bozo.kopic <bozo@kopic.xyz> | 2022-06-26 17:28:49 +0200 |
| commit | 75cc60fd42c58cadc28f5eb4499f197604254aba (patch) | |
| tree | 48513c9c59dd24207100fc2cf2c3118c8145dd72 /src_js | |
| parent | 7ae36a21d031c3d71e9015823c61380f88b0595d (diff) | |
WIP native implementation
Diffstat (limited to 'src_js')
| -rw-r--r-- | src_js/common.js | 9 | ||||
| -rw-r--r-- | src_js/states.js | 1 | ||||
| -rw-r--r-- | src_js/vt.js | 13 |
3 files changed, 9 insertions, 14 deletions
diff --git a/src_js/common.js b/src_js/common.js index 7d4213c..b489914 100644 --- a/src_js/common.js +++ b/src_js/common.js @@ -10,7 +10,7 @@ import * as states from './states'; const calculateUrl = URI.resolve(window.location.href, './calculate'); -const generateOutputUrl = URI.resolve(window.location.href, './generate_output'); +const generateUrl = URI.resolve(window.location.href, './generate'); let panelCounter = 0; let itemCounter = 0; @@ -20,9 +20,8 @@ export async function calculate() { r.set('calculating', true); try { const method = r.get('form', 'method'); - const native = r.get('form', 'native'); const params = createCalculateParams(); - const res = await fetch(`${calculateUrl}?method=${method}&native=${native}`, { + const res = await fetch(`${calculateUrl}?method=${method}`, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(params) @@ -45,10 +44,10 @@ export async function calculate() { } -export async function generateOutput() { +export async function generate() { try { const result = r.get('result'); - const res = await fetch(`${generateOutputUrl}?output_type=pdf`, { + const res = await fetch(`${generateUrl}?output_format=pdf`, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(result) diff --git a/src_js/states.js b/src_js/states.js index efc31b9..bf3584e 100644 --- a/src_js/states.js +++ b/src_js/states.js @@ -4,7 +4,6 @@ export const main = { method: 'forward_greedy', cut_width: 0.3, min_initial_usage: false, - native: false, panels: [], items: [] }, diff --git a/src_js/vt.js b/src_js/vt.js index b016018..84d80a0 100644 --- a/src_js/vt.js +++ b/src_js/vt.js @@ -62,7 +62,9 @@ function leftPanel() { ['label', 'Method'], selectInput(r.get('form', 'method'), [['forward_greedy', 'Forward greedy'], - ['greedy', 'Greedy']], + ['greedy', 'Greedy'], + ['forward_greedy_native', 'Forward greedy (native)'], + ['greedy_native', 'Greedy (native)'],], val => r.set(['form', 'method'], val)), ['label', 'Cut width'], numberInput(r.get('form', 'cut_width'), @@ -71,11 +73,7 @@ function leftPanel() { ['label'], checkboxInput('Minimize initial panel usage', r.get('form', 'min_initial_usage'), - val => r.set(['form', 'min_initial_usage'], val)), - ['label'], - checkboxInput('Use native implementation (experimental)', - r.get('form', 'native'), - val => r.set(['form', 'native'], val)) + val => r.set(['form', 'min_initial_usage'], val)) ], ['div.content', leftPanelPanels(), @@ -308,7 +306,7 @@ function rightPanel() { ['div.toolbar', ['button', { on: { - click: common.generateOutput + click: common.generate }}, ['span.fa.fa-file-pdf-o'], ' PDF' @@ -465,7 +463,6 @@ function textInput(value, validator, onChange) { function numberInput(value, validator, onChange) { - return ['input', { props: { type: 'number', |
