Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ignore pending config changes in custom sections #1217

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/components/layout/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,14 @@ export default class AppBar extends Mixins(StateMixin, ServicesMixin, FilesMixin
return false
}
if (!this.ignoreDefaultBedMeshPendingConfigurationChanges) {
return true
}
const saveConfigPendingItemsKeys = Object.keys(this.saveConfigPendingItems)
const sectionsToIgnore = this.sectionsToIgnorePendingConfigurationChanges
return saveConfigPendingItemsKeys.length > 1 || saveConfigPendingItemsKeys[0] !== 'bed_mesh default'
return (
sectionsToIgnore.length === 0 ||
Object.keys(this.saveConfigPendingItems)
.filter(key => !sectionsToIgnore.includes(key))
.length > 0
)
}
get devicePowerComponentEnabled () {
Expand All @@ -268,8 +269,8 @@ export default class AppBar extends Mixins(StateMixin, ServicesMixin, FilesMixin
return this.$store.state.config.uiSettings.general.showSaveConfigAndRestart as boolean
}
get ignoreDefaultBedMeshPendingConfigurationChanges (): boolean {
return this.$store.state.config.uiSettings.general.ignoreDefaultBedMeshPendingConfigurationChanges as boolean
get sectionsToIgnorePendingConfigurationChanges (): string[] {
return this.$store.state.config.uiSettings.general.sectionsToIgnorePendingConfigurationChanges as string[]
}
get showUploadAndPrint (): boolean {
Expand Down
7 changes: 3 additions & 4 deletions src/components/settings/FileEditorSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,11 @@ export default class FileEditorSettings extends Mixins(StateMixin) {
}

set autoEditExtensions (value: string[]) {
value = value.map((ext: string) => ext.startsWith('.') ? ext : `.${ext}`)
value = value.filter((ext: string, index: number) => value.indexOf(ext) === index) // deduplicate entries

this.$store.dispatch('config/saveByPath', {
path: 'uiSettings.editor.autoEditExtensions',
value: value.sort(),
value: [
...new Set(value.map(ext => ext.startsWith('.') ? ext : `.${ext}`))
].sort((a, b) => a.localeCompare(b)),
server: true
})
}
Expand Down
30 changes: 19 additions & 11 deletions src/components/settings/GeneralSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,25 @@
@click.native.stop
/>
</app-setting>
</template>

<template v-if="showSaveConfigAndRestart && confirmOnSaveConfigAndRestart">
<v-divider />

<app-setting
:title="$t('app.setting.label.ignore_default_bed_mesh_pending_configuration_changes')"
:title="$t('app.setting.label.sections_to_ignore_pending_configuration_changes')"
>
<v-switch
v-model="ignoreDefaultBedMeshPendingConfigurationChanges"
hide-details
class="mb-5"
@click.native.stop
<v-combobox
v-model="sectionsToIgnorePendingConfigurationChanges"
:items="['bed_mesh default', 'bed_tilt']"
filled
dense
hide-selected
hide-details="auto"
multiple
small-chips
append-icon=""
deletable-chips
/>
</app-setting>
</template>
Expand Down Expand Up @@ -402,14 +410,14 @@ export default class GeneralSettings extends Mixins(StateMixin) {
})
}

get ignoreDefaultBedMeshPendingConfigurationChanges (): boolean {
return this.$store.state.config.uiSettings.general.ignoreDefaultBedMeshPendingConfigurationChanges as boolean
get sectionsToIgnorePendingConfigurationChanges (): string[] {
return this.$store.state.config.uiSettings.general.sectionsToIgnorePendingConfigurationChanges as string[]
}

set ignoreDefaultBedMeshPendingConfigurationChanges (value: boolean) {
set sectionsToIgnorePendingConfigurationChanges (value: string[]) {
this.$store.dispatch('config/saveByPath', {
path: 'uiSettings.general.ignoreDefaultBedMeshPendingConfigurationChanges',
value,
path: 'uiSettings.general.sectionsToIgnorePendingConfigurationChanges',
value: [...new Set(value)].sort((a, b) => a.localeCompare(b)),
server: true
})
}
Expand Down
1 change: 0 additions & 1 deletion src/locales/af.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,6 @@ app:
height: Hoogte
gcode_coords: Gebruik GCode-koordinate
icon: Ikoon
ignore_default_bed_mesh_pending_configuration_changes: Ignoreer verstek bedmaas hangende konfigurasie veranderinge
invert_x_control: Keer X-beheer om
invert_y_control: Keer Y-beheer om
invert_z_control: Keer Z-beheer om
Expand Down
2 changes: 0 additions & 2 deletions src/locales/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,6 @@ app:
collector: Kollektor
dotted: Gepunktet
axes: Achsen
ignore_default_bed_mesh_pending_configuration_changes: Ausstehende Änderungen
der Bettnivellierung ignorieren
camera_url_snapshot: Kamera-Snapshot-URL
camera_url_stream: Kamera-Stream-URL
default_min_layer_height: Standard minimum Schichthöhe
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@ app:
height: Height
gcode_coords: Use GCode Coordinates
icon: Icon
ignore_default_bed_mesh_pending_configuration_changes: Ignore default bed mesh Pending Configuration Changes
invert_x_control: Invert X control
invert_y_control: Invert Y control
invert_z_control: Invert Z control
Expand All @@ -568,6 +567,7 @@ app:
retraction_icon_size: Retraction Icon Size
right_y: Right Y-Axis
save_and_restore_view_state: Save and restore view state
sections_to_ignore_pending_configuration_changes: Sections to ignore Pending Configuration Changes
show_animations: Show animations
show_barometric_pressure: Show barometric pressure
show_chart: Show chart
Expand Down
1 change: 0 additions & 1 deletion src/locales/hu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ app:
height: Magasság
gcode_coords: G-Kód koordináták használata
icon: Ikon
ignore_default_bed_mesh_pending_configuration_changes: Az alapértelmezett ágyháló figyelmen kívül hagyása - Függő konfigurációs módosítások
invert_x_control: Fordított (X) vezérlés
invert_y_control: Fordított (Y) vezérlés
invert_z_control: Fordított (Z) vezérlés
Expand Down
2 changes: 0 additions & 2 deletions src/locales/pl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,6 @@ app:
show_barometric_pressure: Pokaż ciśnienie barometryczne
show_gas_resistance: Pokaż opór gazu
show_upload_and_print: Pokaż przycisk „Wgraj i drukuj” w górnym pasku nawigacyjnym
ignore_default_bed_mesh_pending_configuration_changes: Ignoruj domyślną siatkę
stołu w oczekiwaniu na zmiany konfiguracji
optional: Opcjonalne
save_and_restore_view_state: Zapisz i przywróć stan widoku
thermal_preset_gcode: G-Code
Expand Down
1 change: 0 additions & 1 deletion src/locales/ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ app:
height: Высота
gcode_coords: Испрользовать координаты GCode
icon: Иконка
ignore_default_bed_mesh_pending_configuration_changes: Игнорировать запланированные изменения сетки стола
invert_x_control: Инвертировать управление по оси X
invert_y_control: Инвертировать управление по оси Y
invert_z_control: Инвертировать управление по оси Z
Expand Down
1 change: 0 additions & 1 deletion src/locales/zh-CN.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ app:
height: 高度
gcode_coords: 使用 GCode 坐标
icon: 图标
ignore_default_bed_mesh_pending_configuration_changes: 忽略默认的床网,等待配置更改
invert_x_control: 反转X轴控制
invert_y_control: 反转Y轴控制
invert_z_control: 反转Z轴控制
Expand Down
2 changes: 1 addition & 1 deletion src/store/config/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const defaultState = (): ConfigState => {
confirmOnEstop: false,
confirmOnPowerDeviceChange: false,
confirmOnSaveConfigAndRestart: true,
ignoreDefaultBedMeshPendingConfigurationChanges: false,
sectionsToIgnorePendingConfigurationChanges: [],
dateFormat: 'iso',
timeFormat: 'iso',
textSortOrder: 'default',
Expand Down
2 changes: 1 addition & 1 deletion src/store/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export interface GeneralConfig {
confirmOnEstop: boolean;
confirmOnPowerDeviceChange: boolean;
confirmOnSaveConfigAndRestart: boolean;
ignoreDefaultBedMeshPendingConfigurationChanges: boolean;
sectionsToIgnorePendingConfigurationChanges: string[];
dateFormat: string;
timeFormat: string;
textSortOrder: TextSortOrder;
Expand Down
2 changes: 1 addition & 1 deletion src/util/is-key-of.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const isKeyOf = <T extends object>(key: string | number | symbol, parent: T): key is keyof T => {
const isKeyOf = <T extends object>(key: PropertyKey, parent: T): key is keyof T => {
return key in parent
}

Expand Down