Skip to content

Commit e3964f2

Browse files
committed
Fixes and enhancements
1 parent 69d9b53 commit e3964f2

20 files changed

+264
-43
lines changed

eform-client/e2e/spec.e2e-spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ describe('Header image button', () => {
2424
settingsPage.saveButton.click();
2525
browser.refresh();
2626
expect(browser.isElementPresent(settingsPage.headerImageMatcher)).toBeFalsy();
27+
browser.sleep(2000);
2728
settingsPage.SiteHeader.resetButton.click();
2829
done();
2930
});

eform-client/gulpfile.js

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,41 @@
1-
const gulp = require('gulp');
21
const protractor = require('gulp-protractor').protractor;
2+
const gulp = require('gulp');
3+
const runSequence = require('run-sequence');
4+
const spawn = require('child_process').spawn;
5+
6+
const runSpawn = function(done, task, opt_arg, opt_io) {
7+
opt_arg = typeof opt_arg !== 'undefined' ? opt_arg : [];
8+
var stdio = 'inherit';
9+
if (opt_io === 'ignore') {
10+
stdio = 'ignore';
11+
}
12+
var child = spawn(task, opt_arg, {stdio: stdio});
13+
var running = false;
14+
child.on('close', function() {
15+
if (!running) {
16+
running = true;
17+
done();
18+
}
19+
});
20+
child.on('error', function() {
21+
if (!running) {
22+
console.error('gulp encountered a child error');
23+
running = true;
24+
done();
25+
}
26+
});
27+
};
328

29+
gulp.task('webdriver:update', function(done) {
30+
runSpawn(done, 'node', ['./node_modules/protractor/bin/webdriver-manager', 'update']);
31+
});
32+
33+
gulp.task('tests', function(done) {
34+
runSequence(['webdriver:update'], "e2e-tests" ,done);
35+
});
436

5-
gulp.task("tests", function (done) {
6-
gulp.src(['e2e/**/*.js'], {read: false})
37+
gulp.task("e2e-tests", function (done) {
38+
gulp.src(['e2e/!**!/!*.js'], {read: false})
739
.pipe(protractor({
840
configFile: 'protractor.conf.js'
941
})

eform-client/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"ngx-gallery": "^3.1.4",
4747
"pnotify": "^3.2.0",
4848
"rxjs": "^5.4.2",
49+
"selenium-standalone-jar": "^3.0.1",
4950
"trumbowyg": "^2.5.1",
5051
"ts-helpers": "^1.1.1",
5152
"wowjs": "^1.1.3",
@@ -72,6 +73,8 @@
7273
"path": "^0.12.7",
7374
"phantomjs-prebuilt": "^2.1.16",
7475
"protractor": "~5.1.0",
76+
"run-sequence": "^2.2.1",
77+
"selenium-server-standalone-jar": "^3.8.1",
7578
"ts-node": "~2.0.0",
7679
"tslint": "~4.5.0",
7780
"typescript": "~2.2.0"

eform-client/protractor.conf.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33

44
/*global jasmine */
55
var SpecReporter = require('jasmine-spec-reporter');
6-
76
exports.config = {
8-
allScriptsTimeout: 11000,
7+
allScriptsTimeout: 20000,
98
specs: [
109
'./e2e/**/*.e2e-spec.ts'
1110
],
1211
capabilities: {
1312
'browserName': 'chrome'
1413
},
15-
directConnect: true,
14+
// directConnect: false,
1615
baseUrl: 'http://localhost:4200/',
1716
framework: 'jasmine',
1817
jasmineNodeOpts: {
1918
showColors: true,
2019
defaultTimeoutInterval: 60000,
21-
print: function() {}
20+
print: function () {
21+
}
2222
},
2323
useAllAngular2AppRoots: true,
24-
beforeLaunch: function() {
24+
beforeLaunch: function () {
2525
require('ts-node').register({
2626
project: 'e2e'
2727
});
2828
},
29-
onPrepare: function() {
29+
onPrepare: function () {
3030
jasmine.getEnv().addReporter(new SpecReporter());
3131
}
3232
};

eform-client/src/app/components/auth/auth.component.css

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
.panel {
1212
border: 0;
13-
}
13+
}
1414

1515
.user-addon {
1616
padding-left: 13px;
@@ -22,6 +22,11 @@
2222
padding-right: 12px;
2323
}
2424

25+
.lock-addon {
26+
padding-left: 15px;
27+
padding-right: 14px;
28+
}
29+
2530
.p-header-wrapper {
2631
margin-top: 35px;
2732
margin-bottom: 15px;
@@ -34,3 +39,8 @@
3439
.p-description {
3540
font-weight: 500;
3641
}
42+
43+
.link-block {
44+
margin-bottom: 5px;
45+
display: block;
46+
}

eform-client/src/app/components/auth/auth.component.html

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,36 @@
3434
</ng-container>
3535

3636
<ng-container *ngIf="!showLoginForm">
37-
<form [formGroup]="formRestore">
38-
<div class="input-group input-group-md">
39-
<span class="input-group-addon envelope-addon"><i class="fa fa-envelope" aria-hidden="true"></i></span>
40-
<input formControlName="email" type="text" name="email" id="email" class="form-control" placeholder="Email" required>
41-
</div>
42-
<br>
43-
<button type="submit" class="btn btn-ar btn-success btn-block" [disabled]="!email.valid" (click)="submitRestoreForm()">Restore password</button>
44-
</form>
45-
<a (click)="toggleLoginForm(true)" class="forgot-password" style="cursor: pointer">
46-
Back to login
47-
</a>
37+
<ng-container *ngIf="!showAdminResetForm">
38+
<form [formGroup]="formRestore">
39+
<div class="input-group input-group-md">
40+
<span class="input-group-addon envelope-addon"><i class="fa fa-envelope" aria-hidden="true"></i></span>
41+
<input formControlName="email" type="text" name="email" id="email" class="form-control" placeholder="Email" required>
42+
</div>
43+
<br>
44+
<button type="submit" class="btn btn-ar btn-success btn-block" [disabled]="!email.valid" (click)="submitRestoreForm()">Restore password</button>
45+
</form>
46+
<a (click)="showAdminResetForm = !showAdminResetForm" class="forgot-password link-block" style="cursor: pointer">
47+
Reset admin password
48+
</a>
49+
<a (click)="toggleLoginForm(true)" class="forgot-password link-block" style="cursor: pointer">
50+
Back to login
51+
</a>
52+
</ng-container>
53+
<ng-container *ngIf="showAdminResetForm">
54+
<form [formGroup]="formReset">
55+
<div class="input-group input-group-md">
56+
<span class="input-group-addon lock-addon"><i class="fa fa-unlock-alt" aria-hidden="true"></i></span>
57+
<input formControlName="secretKey" type="text" name="secretKey" id="secretKey" class="form-control" placeholder="Secret code" required>
58+
</div>
59+
<br>
60+
<button type="submit" class="btn btn-ar btn-success btn-block" [disabled]="!secretKey.valid" (click)="submitResetAdminForm()">Reset password</button>
61+
</form>
62+
<a (click)="toggleLoginForm(true)" class="forgot-password" style="cursor: pointer">
63+
Back to login
64+
</a>
65+
</ng-container>
66+
4867
</ng-container>
4968

5069
</div>

eform-client/src/app/components/auth/auth.component.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ import {LoginPageSettingsModel} from 'app/models/settings/login-page-settings.mo
1616
export class AuthComponent implements OnInit {
1717
formLogin: FormGroup;
1818
formRestore: FormGroup;
19+
formReset: FormGroup;
20+
1921
username: AbstractControl;
2022
email: AbstractControl;
2123
password: AbstractControl;
24+
secretKey: AbstractControl;
25+
2226
loginPageSettings: LoginPageSettingsModel = new LoginPageSettingsModel;
2327
loginImage: any;
2428

2529
showLoginForm: boolean = true;
30+
showAdminResetForm = false;
2631
error: string;
2732

2833
constructor(private router: Router,
@@ -56,6 +61,21 @@ export class AuthComponent implements OnInit {
5661
);
5762
}
5863

64+
65+
submitResetAdminForm() {
66+
debugger;
67+
const secretKey = this.formReset.getRawValue().secretKey;
68+
this.authService.resetAdminPassword(secretKey).subscribe((result) => {
69+
if (result && result.success) {
70+
this.notifyService.success({text: result.message});
71+
this.secretKey.reset();
72+
this.toggleLoginForm(true);
73+
} else {
74+
this.notifyService.error({text: result.message});
75+
}
76+
});
77+
}
78+
5979
ngOnInit() {
6080
this.settingsService.connectionStringExist().subscribe((result) => {
6181
if (result && result.success === false) {
@@ -79,9 +99,16 @@ export class AuthComponent implements OnInit {
7999
[Validators.required, Validators.email]
80100
]
81101
});
102+
this.formReset = this.fb.group({
103+
secretKey: [
104+
'',
105+
[Validators.required]
106+
]
107+
});
82108
this.username = this.formLogin.get('username');
83109
this.password = this.formLogin.get('password');
84110
this.email = this.formRestore.get('email');
111+
this.secretKey = this.formReset.get('secretKey')
85112
}
86113

87114
getSettings() {
@@ -99,5 +126,6 @@ export class AuthComponent implements OnInit {
99126

100127
toggleLoginForm(toggle: boolean) {
101128
this.showLoginForm = toggle;
129+
this.showAdminResetForm = false;
102130
}
103131
}

eform-client/src/app/modules/cases/cases.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ import {
2626
TrumbowygComponent
2727
} from './components/case-elements';
2828
import {CollapseModule} from 'ngx-bootstrap';
29+
import {Ng2Bs3ModalModule} from 'ng2-bs3-modal/ng2-bs3-modal';
2930

3031
@NgModule({
3132
imports: [
3233
CommonModule,
3334
NgxGalleryModule,
3435
FormsModule,
3536
CasesRoutingModule,
36-
CollapseModule.forRoot()
37+
CollapseModule.forRoot(),
38+
Ng2Bs3ModalModule
3739
],
3840
declarations: [CasesComponent,
3941
TrumbowygComponent,

eform-client/src/app/modules/cases/components/case-edit-switch/case-edit-switch.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<element-timer [(fieldValue)]="dataItem.fieldValues[0]"></element-timer>
4646
</div>
4747
<div *ngSwitchCase="'Signature'">
48-
<element-signature [(fieldValue)]="dataItem.fieldValues[0]"></element-signature>
48+
<element-signature [fieldValues]="dataItem.fieldValues"></element-signature>
4949
</div>
5050
<div *ngSwitchCase="'FieldContainer'">
5151
<element-container [(fieldValue)]="dataItem.dataItemList" [dataItemLabel]="dataItem.label"></element-container>

eform-client/src/app/modules/cases/components/case-elements/element-picture/element-picture.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<img class="img-thumbnail img-responsive" width="119px" style="cursor: pointer; margin-bottom: 10px"
55
[src]="image.src" (click)="openPicture(i)"/>
66
<figcaption>
7-
<button class="btn btn-ar btn-default" (click)="rotatePicture(image)"><i class="fa fa-repeat" aria-hidden="true"></i></button>
7+
<button class="btn btn-ar btn-default" [disabled]="isRotateLocked" (click)="rotatePicture(image)"><i class="fa fa-repeat" aria-hidden="true"></i></button>
88
<button class="btn btn-ar btn-danger" (click)="deletePicture(image)"><i class="fa fa-trash-o" aria-hidden="true"></i></button>
99
<button [disabled]="!image.googleMapsLat && !image.googleMapsLon"
1010
(click)="openGpsWindow(image.googleMapsUrl)" class="btn btn-ar btn-success" style="padding-left: 13px; padding-right: 13px">

0 commit comments

Comments
 (0)