Skip to content

Commit ad668c8

Browse files
authored
webui: add flash to device switch
1 parent 3828499 commit ad668c8

File tree

5 files changed

+31
-2
lines changed

5 files changed

+31
-2
lines changed

webui/index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,14 @@
190190
<div class="card-title" slot="headline" data-i18n="title_kernel">Kernel</div>
191191
<div id="kernel-info"></div>
192192
</div>
193-
<div class="module-list content-padding" id="kpm-embed-list"></div>
193+
<div class="switch-card content-padding patch-only">
194+
<label>
195+
<div data-i18n="label_flash_to_device">Flash to device</div>
196+
<md-switch selected id="flash-to-device"></md-switch>
197+
</label>
198+
<md-ripple></md-ripple>
199+
</div>
200+
<div class="module-list content-padding patch-only" id="kpm-embed-list"></div>
194201
<div class="trailing-btn content-padding" id="patch-options">
195202
<md-filled-button class="patch-only" id="embed" data-i18n="button_embed_kpm">Embed KPM</md-filled-button>
196203
<md-filled-button class="patch-only" id="start" data-i18n="button_start">Start</md-filled-button>

webui/page/patch.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ async function embedKPM() {
333333
function patch(type) {
334334
const terminal = document.querySelector('#patch-terminal');
335335
const pageContent = terminal.closest('.page-content');
336+
const flashToDevice = document.getElementById('flash-to-device');
337+
336338
const onOutput = (data) => {
337339
terminal.innerHTML += `<div>${data}</div>`;
338340
pageContent.scrollTo({ top: pageContent.scrollHeight, behavior: 'smooth' });
@@ -348,7 +350,7 @@ function patch(type) {
348350
args.push(
349351
`${modDir}/patch/boot_patch.sh`,
350352
bootDev,
351-
'true'
353+
flashToDevice.selected ? 'true' : 'false'
352354
);
353355

354356
// New kpm

webui/public/locales/strings/en.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<string name="label_show_system_app">Show system app</string>
3636
<string name="label_system_default">System Default</string>
3737
<string name="label_trigger_event">Trigger Event</string>
38+
<string name="label_flash_to_device">Flash to Device</string>
3839
<!-- Status -->
3940
<string name="status_not_installed">Not installed</string>
4041
<string name="status_working">Working 😋</string>

webui/public/locales/strings/zh-CN.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<string name="label_show_system_app">显示系统应用</string>
3636
<string name="label_system_default">系统默认</string>
3737
<string name="label_trigger_event">触发事件</string>
38+
<string name="label_flash_to_device">直接安装</string>
3839
<!-- Status -->
3940
<string name="status_not_installed">未安装</string>
4041
<string name="status_working">工作中 😋</string>

webui/styles.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,24 @@ body {
221221
transition: all 0.2s ease;
222222
}
223223

224+
.switch-card {
225+
width: 100%;
226+
border-radius: 20px;
227+
background-color: var(--md-sys-color-tonal-surface);
228+
word-wrap: break-word;
229+
position: relative;
230+
}
231+
232+
.switch-card label {
233+
display: flex;
234+
justify-content: space-between;
235+
align-items: center;
236+
width: 100%;
237+
padding: 20px;
238+
box-sizing: border-box;
239+
font-size: 1.1em;
240+
}
241+
224242
.search-hidden {
225243
display: none !important;
226244
}

0 commit comments

Comments
 (0)