Skip to content

Commit 12e580b

Browse files
committed
Error messages now working and tests running OK
1 parent fb3559b commit 12e580b

16 files changed

+222
-148
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ package-lock.json
1919

2020
website/node_modules
2121
website/app/bower_components
22+
website/failed_tests
23+
website/test/e2e/failed_tests

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"angular-elastic": "2.5.1",
4747
"angular-messages": "1.7.8",
4848
"angular-sanitize": "1.7.8",
49+
"angular-animate": "1.7.8",
4950
"angular-ui-bootstrap": "1.3.2 || 2.5.6",
5051
"angular-ui-grid": "^4.8.1",
5152
"async": "3.1.0",

src/client/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ declare module fng {
282282
modelName: string;
283283
formName: string;
284284
alertTitle: any;
285+
errorVisible: boolean;
285286
errorMessage: any;
286287
errorHideTimer: number;
287288
save: any;
@@ -337,6 +338,7 @@ declare module fng {
337338
getListData: any;
338339
dismissError: () => void;
339340
stickError: () => void;
341+
clearTimeout: () => void;
340342
handleHttpError: (response: any) => void;
341343
dropConversionWatcher: () => void;
342344
}

src/client/js/controllers/base.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module fng.controllers {
1818
allowLocationChange: true // Set when the data arrives..
1919
};
2020

21+
$scope.errorVisible = false;
2122
angular.extend($scope, routingService.parsePathFunc()($location.$$path));
2223

2324
// Load context menu. For /person/client/:id/edit we need

src/client/js/forms-angular.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module fng {
2929
export var formsAngular = angular.module('formsAngular', [
3030
'ngSanitize',
3131
'ngMessages',
32+
'ngAnimate',
3233
'ui.bootstrap',
3334
'infinite-scroll',
3435
'monospaced.elastic'

src/client/js/services/record-handler.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,10 +908,20 @@ module fng.services {
908908
$scope.errorHideTimer = window.setTimeout(function() {
909909
$scope.dismissError();
910910
$scope.$digest();
911-
}, 2000 + (1000 * ($scope.alertTitle + $scope.errorMessage).length / 40));
911+
}, 1000 + (1000 * ($scope.alertTitle + $scope.errorMessage).length / 50));
912+
$scope.errorVisible = true;
912913
};
913914

914-
$scope.dismissError = function(fade = false) {
915+
$scope.clearTimeout = function() {
916+
if ($scope.errorHideTimer) {
917+
clearTimeout($scope.errorHideTimer);
918+
delete $scope.errorHideTimer;
919+
}
920+
};
921+
922+
$scope.dismissError = function () {
923+
$scope.clearTimeout;
924+
$scope.errorVisible = false;
915925
delete $scope.errorMessage;
916926
delete $scope.alertTitle;
917927
};

src/client/less/forms-angular-bs-common.less

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,18 @@ button#saveButton[disabled]:hover + #why-disabled.showwhy {
212212
}
213213

214214
#display-error {
215-
transition: opacity .5s ease-in-out;
216215
position: fixed;
217216
top: 60px;
218217
width: 100%;
218+
z-index: 109;
219+
}
220+
221+
#display-error.ng-hide {
222+
opacity: 0;
223+
}
224+
#display-error.ng-hide-add,
225+
#display-error.ng-hide-remove {
226+
transition: all linear 0.5s;
219227
}
220228

221229
input[type="checkbox"].ng-invalid::after {
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<div id="display-error" ng-style="{opacity : errorMessage ? '1' : '0', 'z-index' : errorMessage ? '130' : '0'}" class="row-fluid">
2-
<div class="alert alert-error offset1 span10 alert-warning ">
3-
<button type="button" class="close" ng-click="dismissError()"><i class="icon-remove"></i></button>
4-
<button type="button" class="close" ng-click="stickError()"><i class="icon-stop"></i></button>
5-
<h4>{{alertTitle}}</h4>
6-
<div ng-bind-html="errorMessage"></div>
7-
</div>
1+
<div id="display-error" ng-show="errorVisible" class="row-fluid ng-hide">
2+
<div class="alert alert-error offset1 span10">
3+
<button type="button" id="err-hide" class="close" ng-click="dismissError()"><i class="icon-remove"></i></button>
4+
<button type="button" id="err-pin" class="close" ng-click="stickError()"><i class="icon-stop"></i></button>
5+
<h4 id="err-title">{{alertTitle}}</h4>
6+
<div id="err-msg" ng-bind-html="errorMessage"></div>
7+
</div>
88
</div>
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<div id="display-error" ng-style="{opacity : errorMessage ? '1' : '0', 'z-index' : errorMessage ? '130' : '0'}" class="row">
2-
<div class="alert col-md-offset-1 col-md-10 alert-warning ">
3-
<button type="button" class="close" ng-click="dismissError()"><i class="glyphicon glyphicon-remove"></i></button>
4-
<button type="button" class="close" ng-click="stickError()"><i class="glyphicon glyphicon-pushpin"></i></button>
5-
<h4>{{alertTitle}}</h4>
6-
<div ng-bind-html="errorMessage"></div>
7-
</div>
1+
<div id="display-error" ng-show="errorVisible" class="row ng-hide">
2+
<div class="alert alert-error col-md-offset-1 col-md-10 alert-danger">
3+
<button type="button" id="err-hide" class="close" ng-click="dismissError()"><i class="glyphicon glyphicon-remove"></i></button>
4+
<button type="button" id="err-pin" class="close" ng-click="stickError()"><i class="glyphicon glyphicon-pushpin"></i></button>
5+
<h4 id="err-title">{{alertTitle}}</h4>
6+
<div id="err-msg" ng-bind-html="errorMessage"></div>
7+
</div>
88
</div>

test/karma.conf.js

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,65 @@
11
module.exports = function(config) {
2-
config.set({
3-
basePath: '../',
4-
frameworks: ['jasmine'],
5-
files: [
6-
"node_modules/angular/angular.js",
7-
"node_modules/angular-sanitize/angular-sanitize.js",
8-
"node_modules/lodash/lodash.js",
9-
"node_modules/ng-infinite-scroll/build/ng-infinite-scroll.js",
10-
'node_modules/angular-mocks/angular-mocks.js',
11-
'node_modules/angular-messages/angular-messages.js',
12-
'node_modules/angular-elastic/elastic.js',
13-
'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js',
14-
'dist/client/forms-angular.js',
15-
'src/client/template/*.html',
16-
'test/example-directives/*.js',
17-
'test/helpers/karma-helpers.js',
18-
'test/unit/**/*.js'
19-
],
2+
config.set({
3+
basePath: '../',
4+
frameworks: ['jasmine'],
5+
files: [
6+
"node_modules/angular/angular.js",
7+
"node_modules/angular-sanitize/angular-sanitize.js",
8+
"node_modules/angular-animate/angular-animate.js",
9+
"node_modules/lodash/lodash.js",
10+
"node_modules/ng-infinite-scroll/build/ng-infinite-scroll.js",
11+
'node_modules/angular-mocks/angular-mocks.js',
12+
'node_modules/angular-messages/angular-messages.js',
13+
'node_modules/angular-elastic/elastic.js',
14+
'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js',
15+
'dist/client/forms-angular.js',
16+
'src/client/template/*.html',
17+
'test/example-directives/*.js',
18+
'test/helpers/karma-helpers.js',
19+
'test/unit/**/*.js'
20+
],
2021

21-
autoWatch : true,
22-
usePolling: true,
22+
autoWatch : true,
23+
usePolling: true,
2324

24-
customLaunchers: {
25-
ChromeHeadless: {
26-
base: 'Chrome',
27-
flags: [
28-
'--headless',
29-
'--disable-gpu',
30-
// Without a remote debugging port, Google Chrome exits immediately.
31-
'--remote-debugging-port=9222'
32-
]
33-
}
34-
},
25+
customLaunchers: {
26+
ChromeHeadless: {
27+
base: 'Chrome',
28+
flags: [
29+
'--headless',
30+
'--disable-gpu',
31+
// Without a remote debugging port, Google Chrome exits immediately.
32+
'--remote-debugging-port=9222'
33+
]
34+
}
35+
},
3536

36-
browsers : ['ChromeHeadless'],
37-
// browsers : ['Firefox', 'ChromeHeadless'],
37+
browsers : ['ChromeHeadless'],
38+
// browsers : ['Firefox', 'ChromeHeadless'],
3839

39-
// use dots reporter, as travis terminal does not support escaping sequences
40-
// possible values: 'dots', 'progress'
41-
// CLI --reporters progress
42-
reporters: ['progress', 'junit'],
40+
// use dots reporter, as travis terminal does not support escaping sequences
41+
// possible values: 'dots', 'progress'
42+
// CLI --reporters progress
43+
reporters: ['progress', 'junit'],
4344

44-
junitReporter: {
45-
outputDir: 'test_out',
46-
outputFile: 'test_out/unit.xml',
47-
suite: 'unit'
48-
},
49-
plugins: [
50-
'karma-jasmine',
51-
'karma-chrome-launcher',
52-
'karma-firefox-launcher',
53-
'karma-ng-html2js-preprocessor',
54-
'karma-junit-reporter'
55-
],
56-
ngHtml2JsPreprocessor: {
57-
// strip this from the file path
58-
stripPrefix: 'src/client/'
59-
},
60-
preprocessors: {
61-
'src/client/template/*.html': 'ng-html2js'
62-
}
63-
});
45+
junitReporter: {
46+
outputDir: 'test_out',
47+
outputFile: 'test_out/unit.xml',
48+
suite: 'unit'
49+
},
50+
plugins: [
51+
'karma-jasmine',
52+
'karma-chrome-launcher',
53+
'karma-firefox-launcher',
54+
'karma-ng-html2js-preprocessor',
55+
'karma-junit-reporter'
56+
],
57+
ngHtml2JsPreprocessor: {
58+
// strip this from the file path
59+
stripPrefix: 'src/client/'
60+
},
61+
preprocessors: {
62+
'src/client/template/*.html': 'ng-html2js'
63+
}
64+
});
6465
};

test/karma.midway.conf.js

Lines changed: 62 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,70 @@
11
module.exports = function(config) {
2-
config.set({
3-
basePath: '../',
4-
frameworks: ['jasmine'],
5-
files: [
6-
"node_modules/angular/angular.js",
7-
"node_modules/angular-sanitize/angular-sanitize.js",
8-
"node_modules/lodash/lodash.js",
9-
"node_modules/ng-infinite-scroll/build/ng-infinite-scroll.js",
10-
'node_modules/angular-mocks/angular-mocks.js',
11-
'node_modules/angular-messages/angular-messages.js',
12-
'node_modules/angular-elastic/elastic.js',
13-
'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js',
14-
'dist/client/forms-angular.js',
15-
'src/client/template/*.html',
16-
'test/example-directives/*.js',
17-
'test/helpers/karma-helpers.js',
18-
'test/template/*.html',
19-
'test/midway/**/*.js'
20-
],
2+
config.set({
3+
basePath: '../',
4+
frameworks: ['jasmine'],
5+
files: [
6+
"node_modules/angular/angular.js",
7+
"node_modules/angular-sanitize/angular-sanitize.js",
8+
"node_modules/angular-animate/angular-animate.js",
9+
"node_modules/lodash/lodash.js",
10+
"node_modules/ng-infinite-scroll/build/ng-infinite-scroll.js",
11+
'node_modules/angular-mocks/angular-mocks.js',
12+
'node_modules/angular-messages/angular-messages.js',
13+
'node_modules/angular-elastic/elastic.js',
14+
'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js',
15+
'dist/client/forms-angular.js',
16+
'src/client/template/*.html',
17+
'test/example-directives/*.js',
18+
'test/helpers/karma-helpers.js',
19+
'test/template/*.html',
20+
'test/midway/**/*.js'
21+
],
2122

22-
client: {
23-
captureConsole: true
24-
},
25-
autoWatch : true,
26-
usePolling: true,
23+
client: {
24+
captureConsole: true
25+
},
26+
autoWatch : true,
27+
usePolling: true,
2728

28-
customLaunchers: {
29-
ChromeHeadless: {
30-
base: 'Chrome',
31-
flags: [
32-
'--headless',
33-
'--disable-gpu',
34-
// Without a remote debugging port, Google Chrome exits immediately.
35-
'--remote-debugging-port=9222'
36-
]
37-
}
38-
},
29+
customLaunchers: {
30+
ChromeHeadless: {
31+
base: 'Chrome',
32+
flags: [
33+
'--headless',
34+
'--disable-gpu',
35+
// Without a remote debugging port, Google Chrome exits immediately.
36+
'--remote-debugging-port=9222'
37+
]
38+
}
39+
},
3940

40-
browsers : ['ChromeHeadless'],
41-
// browsers : ['Firefox', 'ChromeHeadless'],
41+
browsers : ['ChromeHeadless'],
42+
// browsers : ['Firefox', 'ChromeHeadless'],
4243

43-
// use dots reporter, as travis terminal does not support escaping sequences
44-
// possible values: 'dots', 'progress'
45-
// CLI --reporters progress
46-
reporters: ['progress', 'junit'],
44+
// use dots reporter, as travis terminal does not support escaping sequences
45+
// possible values: 'dots', 'progress'
46+
// CLI --reporters progress
47+
reporters: ['progress', 'junit'],
4748

48-
junitReporter: {
49-
outputFile: 'test_out/unit.xml',
50-
suite: 'midway'
51-
},
52-
plugins: [
53-
'karma-jasmine',
54-
'karma-chrome-launcher',
55-
'karma-firefox-launcher',
56-
'karma-ng-html2js-preprocessor',
57-
'karma-junit-reporter'
58-
],
59-
ngHtml2JsPreprocessor: {
60-
// strip this from the file path
61-
stripPrefix: 'src/client/'
62-
},
63-
preprocessors: {
64-
'src/client/template/*.html': 'ng-html2js',
65-
'test/template/*.html': 'ng-html2js'
66-
}
67-
});
49+
junitReporter: {
50+
outputFile: 'test_out/unit.xml',
51+
suite: 'midway'
52+
},
53+
plugins: [
54+
'karma-jasmine',
55+
'karma-chrome-launcher',
56+
'karma-firefox-launcher',
57+
'karma-ng-html2js-preprocessor',
58+
'karma-junit-reporter'
59+
],
60+
ngHtml2JsPreprocessor: {
61+
// strip this from the file path
62+
stripPrefix: 'src/client/'
63+
},
64+
preprocessors: {
65+
'src/client/template/*.html': 'ng-html2js',
66+
'test/template/*.html': 'ng-html2js'
67+
}
68+
});
6869
};
6970

website/app/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<script src="angular/angular.js"></script>
6666
<script src="angular-route/angular-route.js"></script>
6767
<script src="angular-sanitize/angular-sanitize.js"></script>
68+
<script src="angular-animate/angular-animate.js"></script>
6869
<script src="angular-messages/angular-messages.js"></script>
6970
<script src="angular-ui-bootstrap/dist/ui-bootstrap-tpls.js"></script>
7071
<script src="ng-infinite-scroll/build/ng-infinite-scroll.js"></script>

0 commit comments

Comments
 (0)