Skip to content

Commit a4056a8

Browse files
ert78gbmondalaci
authored andcommitted
feat(device): Add confirmation question before reset the configuration (#449)
* feat(device): Add confirmation question before reset the configuration * feat(device): text change * style: fix ts-lint error
1 parent 6b46c85 commit a4056a8

File tree

6 files changed

+29
-6
lines changed

6 files changed

+29
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
"scripts": {
5252
"postinstall": "lerna bootstrap",
53-
"test":"run-p -sn test:test-serializer test:uhk-common",
53+
"test": "run-p -sn test:test-serializer test:uhk-common",
5454
"test:test-serializer": "lerna exec --scope test-serializer npm test",
5555
"test:uhk-common": "lerna exec --scope uhk-common npm test",
5656
"test:uhk-web": "lerna exec --scope uhk-web npm test",

packages/uhk-web/package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uhk-web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"@types/jquery": "3.2.9",
4040
"@types/node-hid": "0.5.2",
4141
"@types/usb": "1.1.3",
42+
"angular-confirmation-popover": "3.2.0",
4243
"angular-notifier": "2.0.0",
4344
"autoprefixer": "6.5.3",
4445
"bootstrap": "3.3.7",

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ <h1>
66
<ul class="list-unstyled btn-list">
77
<li>
88
<button class="btn btn-danger"
9-
(click)="resetUserConfiguration()">Reset user configuration including all your keymaps and macros
10-
</button>
9+
mwlConfirmationPopover
10+
title="Are you sure?"
11+
placement="bottom"
12+
confirmText="Yes"
13+
cancelText="No"
14+
(confirm)="resetUserConfiguration()">Reset user configuration
15+
</button> - including all your keymaps and macros
1116
</li>
1217
<li>
1318
<button class="btn btn-default"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ export class DeviceSettingsComponent {
2222
this.store.dispatch(new ResetUserConfigurationAction());
2323
}
2424

25-
saveConfigurationInJSONFormat(){
25+
saveConfigurationInJSONFormat() {
2626
this.store.dispatch(new SaveUserConfigInJsonFileAction());
2727
}
2828

29-
saveConfigurationInBINFormat(){
29+
saveConfigurationInBINFormat() {
3030
this.store.dispatch(new SaveUserConfigInBinaryFileAction());
3131
}
3232
}

packages/uhk-web/src/app/shared.module.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { CommonModule } from '@angular/common';
33
import { FormsModule } from '@angular/forms';
44
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
55
import { NotifierModule } from 'angular-notifier';
6+
import { ConfirmationPopoverModule } from 'angular-confirmation-popover';
67

78
import { DragulaModule } from 'ng2-dragula/ng2-dragula';
89
import { Select2Module } from 'ng2-select2/ng2-select2';
@@ -163,7 +164,10 @@ import { UhkDeviceLoadedGuard } from './services/uhk-device-loaded.guard';
163164
DragulaModule,
164165
routing,
165166
Select2Module,
166-
NotifierModule.withConfig(angularNotifierConfig)
167+
NotifierModule.withConfig(angularNotifierConfig),
168+
ConfirmationPopoverModule.forRoot({
169+
confirmButtonType: 'danger' // set defaults here
170+
})
167171
],
168172
providers: [
169173
SvgModuleProviderService,

0 commit comments

Comments
 (0)