Skip to content

Commit 6b46c85

Browse files
ert78gbmondalaci
authored andcommitted
feat(device): Add save config buttons to the Device settings page (#447)
* feat(device): Add save config buttons to the Device settings page * feat(device): Set danger style to the reset user-config buttone
1 parent 737897b commit 6b46c85

File tree

4 files changed

+34
-16
lines changed

4 files changed

+34
-16
lines changed

packages/uhk-web/src/app/app.component.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,4 @@ export class MainAppComponent {
5959
clickedOnProgressButton(action: Action) {
6060
return this.store.dispatch(action);
6161
}
62-
63-
@HostListener('window:keydown.alt.j', ['$event'])
64-
onAltJ(event: KeyboardEvent): void {
65-
event.preventDefault();
66-
event.stopPropagation();
67-
this.store.dispatch(new SaveUserConfigInJsonFileAction());
68-
}
69-
70-
@HostListener('window:keydown.alt.b', ['$event'])
71-
onAltB(event: KeyboardEvent): void {
72-
event.preventDefault();
73-
event.stopPropagation();
74-
this.store.dispatch(new SaveUserConfigInBinaryFileAction());
75-
}
7662
}
Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
<h1>
22
<i class="fa fa-cog"></i>
3-
<span>Device settings...</span>
3+
<span>Device settings</span>
44
</h1>
5-
<a (click)="resetUserConfiguration()">Reset user configuration</a>
5+
6+
<ul class="list-unstyled btn-list">
7+
<li>
8+
<button class="btn btn-danger"
9+
(click)="resetUserConfiguration()">Reset user configuration including all your keymaps and macros
10+
</button>
11+
</li>
12+
<li>
13+
<button class="btn btn-default"
14+
(click)="saveConfigurationInJSONFormat()">Save device JSON configuration
15+
</button>
16+
</li>
17+
<li>
18+
<button class="btn btn-default"
19+
(click)="saveConfigurationInBINFormat()">Save device binary configuration
20+
</button>
21+
</li>
22+
</ul>

packages/uhk-web/src/app/components/device/settings/device-settings.component.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Store } from '@ngrx/store';
33

44
import { AppState } from '../../../store';
55
import { ResetUserConfigurationAction } from '../../../store/actions/device';
6+
import { SaveUserConfigInBinaryFileAction, SaveUserConfigInJsonFileAction } from '../../../store/actions/user-config';
67

78
@Component({
89
selector: 'device-settings',
@@ -20,4 +21,12 @@ export class DeviceSettingsComponent {
2021
resetUserConfiguration() {
2122
this.store.dispatch(new ResetUserConfigurationAction());
2223
}
24+
25+
saveConfigurationInJSONFormat(){
26+
this.store.dispatch(new SaveUserConfigInJsonFileAction());
27+
}
28+
29+
saveConfigurationInBINFormat(){
30+
this.store.dispatch(new SaveUserConfigInBinaryFileAction());
31+
}
2332
}

packages/uhk-web/src/styles.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,9 @@
5959
.select2-container--default .select2-dropdown--below .select2-results > .select2-results__options {
6060
max-height: 300px;
6161
}
62+
63+
ul.btn-list {
64+
& li {
65+
margin-top: 0.5em;
66+
}
67+
}

0 commit comments

Comments
 (0)