iot-dashboard
Version:
A generic dashboard application based on JavaScript, HTML and CSS. http://iot-dashboard.org
492 lines (491 loc) • 19.3 kB
HTML
<html lang="en">
<head>
<title>Code coverage report for src/modal/modalDialog.ui.tsx</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/modal/</a> modalDialog.ui.tsx
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">54.79% </span>
<span class="quiet">Statements</span>
<span class='fraction'>40/73</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">27.59% </span>
<span class="quiet">Branches</span>
<span class='fraction'>8/29</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">37.04% </span>
<span class="quiet">Functions</span>
<span class='fraction'>10/27</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">56.52% </span>
<span class="quiet">Lines</span>
<span class='fraction'>39/69</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">10×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4×</span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) <span class="cstat-no" title="statement not covered" >if (b.hasOwnProperty(p)) <span class="cstat-no" title="statement not covered" >d[p] = b[p];</span></span>
function __() { this.constructor = d; }
d.prototype = b === null ? <span class="branch-0 cbranch-no" title="branch not covered" >Object.create(b) </span>: (__.prototype = b.prototype, new __());
};
var React = require('react');
var react_redux_1 = require('react-redux');
var Modal = require('./modalDialog.js');
var ModalDialog = (function (_super) {
__extends(ModalDialog, _super);
function ModalDialog(props) {
_super.call(this, props);
this.state = { screen: this.screenSize() };
}
ModalDialog.prototype.componentDidMount = <span class="fstat-no" title="function not covered" >function () {</span>
<span class="cstat-no" title="statement not covered" > var _this = this;</span>
<span class="cstat-no" title="statement not covered" > var $modal = $('.ui.modal.' + this.props.id);</span>
<span class="cstat-no" title="statement not covered" > $modal.modal({</span>
detachable: false,
closable: false,
observeChanges: true,
onApprove: <span class="fstat-no" title="function not covered" >function ($element) {</span> <span class="cstat-no" title="statement not covered" >return false; </span>},
onDeny: <span class="fstat-no" title="function not covered" >function ($element) {</span> <span class="cstat-no" title="statement not covered" >return false; </span>},
transition: "fade",
onVisible: <span class="fstat-no" title="function not covered" >function () {</span>
// This is to update the Browser Scrollbar, at least needed in WebKit
<span class="cstat-no" title="statement not covered" > if (typeof document !== 'undefined') {</span>
<span class="cstat-no" title="statement not covered" > var n_1 = document.createTextNode(' ');</span>
<span class="cstat-no" title="statement not covered" > $modal.append(n_1);</span>
<span class="cstat-no" title="statement not covered" > setTimeout(<span class="fstat-no" title="function not covered" >function () {</span></span>
<span class="cstat-no" title="statement not covered" > n_1.parentNode.removeChild(n_1);</span>
}, 0);
}
}
});
<span class="cstat-no" title="statement not covered" > $(window).resize(<span class="fstat-no" title="function not covered" >function () {</span></span>
<span class="cstat-no" title="statement not covered" > _this.setState({ screen: _this.screenSize() });</span>
});
};
ModalDialog.prototype.screenSize = function () {
<span class="missing-if-branch" title="else path not taken" >E</span>if (typeof window === 'undefined') {
console.log("Running on nodeJS!");
return {
height: 500,
width: 500
};
}
<span class="cstat-no" title="statement not covered" > return {</span>
height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
width: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
};
};
ModalDialog.prototype.onClick = <span class="fstat-no" title="function not covered" >function (e, action) {</span>
<span class="cstat-no" title="statement not covered" > if (action.onClick(e)) {</span>
// Closing is done externally (by redux)
<span class="cstat-no" title="statement not covered" > this.props.closeDialog();</span>
}
};
ModalDialog.prototype.render = function () {
var _this = this;
var key = 0;
var actions = this.props.actions.map(function (action) {
return React.createElement("div", {key: key++, className: action.className, onClick: <span class="fstat-no" title="function not covered" >function (e) {</span> <span class="cstat-no" title="statement not covered" >return _this.onClick(e, action); </span>}},
action.label,
action.iconClass ? React.createElement("i", {className: action.iconClass}) : null);
});
var props = this.props;
// TODO: realize Modals with React, then isOpen gets handy:
//const isOpen = props.dialogState.dialogId == props.id && props.dialogState.isVisible;
var height = this.state.screen.height;
var width = this.state.screen.width;
return React.createElement("div", {id: this.props.id, className: 'ui modal ' + this.props.id, style: { width: width - 80, top: 40, left: 40, margin: 1, minHeight: "500px" }},
React.createElement("div", {className: "header"}, props.title),
this.props.dialogState.isVisible ?
<span class="branch-0 cbranch-no" title="branch not covered" > React.createElement("div", {className: "content", style: { overflowY: 'scroll', height: height - 300, minHeight: "500px" }}, </span>
this.props.dialogState.errors ?
this.props.dialogState.errors.map(<span class="fstat-no" title="function not covered" >function (message, i) {</span>
<span class="cstat-no" title="statement not covered" > return React.createElement(ModalUserMessageComponent, {key: i, userMessage: message});</span>
})
: null,
props.children)
: null,
React.createElement("div", {className: "actions"}, actions));
};
return ModalDialog;
}(React.Component));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = react_redux_1.connect(function (state, ownProps) {
return {
dialogState: state.modalDialog
};
}, function (dispatch) {
return {
closeDialog: <span class="fstat-no" title="function not covered" >function () {</span> <span class="cstat-no" title="statement not covered" >return dispatch(Modal.closeModal()); </span>}
};
})(ModalDialog);
var ModalUserMessage = (function (_super) {
__extends(ModalUserMessage, _super);
<span class="fstat-no" title="function not covered" > function ModalUserMessage() {</span>
<span class="cstat-no" title="statement not covered" > _super.apply(this, arguments);</span>
}
ModalUserMessage.prototype.close = <span class="fstat-no" title="function not covered" >function () {</span>
<span class="cstat-no" title="statement not covered" > this.props.close(this.props.userMessage);</span>
};
ModalUserMessage.prototype.render = <span class="fstat-no" title="function not covered" >function () {</span>
<span class="cstat-no" title="statement not covered" > var _this = this;</span>
<span class="cstat-no" title="statement not covered" > var theme = "error";</span>
<span class="cstat-no" title="statement not covered" > if (this.props.userMessage.kind === "info") {</span>
<span class="cstat-no" title="statement not covered" > theme = "success";</span>
}
<span class="cstat-no" title="statement not covered" > if (this.props.userMessage.kind === "error") {</span>
<span class="cstat-no" title="statement not covered" > theme = "error";</span>
}
<span class="cstat-no" title="statement not covered" > return React.createElement("div", {className: "slds-notify_container slds-is-relative slds-m-bottom--x-small"}, </span>
React.createElement("div", {className: "slds-notify slds-notify--alert slds-theme--alert-texture slds-theme--" + theme, role: "alert"},
React.createElement("button", {className: "slds-button slds-notify__close slds-button--icon-inverse", onClick: <span class="fstat-no" title="function not covered" >function () {</span> <span class="cstat-no" title="statement not covered" >return _this.close(); </span>}},
React.createElement("svg", {"aria-hidden": "true", className: "slds-button__icon"},
React.createElement("use", {xlinkHref: "assets/icons/utility-sprite/svg/symbols.svg#close"})
),
React.createElement("span", {className: "slds-assistive-text"}, "Close")),
React.createElement("span", {className: "slds-assistive-text"}, this.props.userMessage.kind),
React.createElement("h2", null, this.props.userMessage.text))
);
};
return ModalUserMessage;
}(React.Component));
var ModalUserMessageComponent = react_redux_1.connect(<span class="fstat-no" title="function not covered" >function (state, ownProps) {</span>
<span class="cstat-no" title="statement not covered" > return {</span>
userMessage: ownProps.userMessage
};
}, <span class="fstat-no" title="function not covered" >function (dispatch) {</span>
<span class="cstat-no" title="statement not covered" > return {</span>
close: <span class="fstat-no" title="function not covered" >function (message) {</span>
<span class="cstat-no" title="statement not covered" > dispatch(Modal.deleteUserMessage(message));</span>
}
};
})(ModalUserMessage);
</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Nov 04 2016 11:23:08 GMT+0000 (UTC)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>