|
22 | 22 | var $decimalPlacesDropdown = $("#decimal-places-dropdown");
|
23 | 23 | var $checkOptionBuildName = $("#check-option-build-name");
|
24 | 24 | var $checkOptionMeasurementName = $("#check-option-measurement-name");
|
| 25 | + var $checkOptionDelta = $("#check-option-delta"); |
25 | 26 |
|
26 | 27 | return {
|
27 | 28 | load: function (widgetSettings, widgetConfigurationContext) {
|
|
94 | 95 | $checkOptionMeasurementName.prop('checked', false);
|
95 | 96 | }
|
96 | 97 |
|
| 98 | + // If show delta has been previously selected, set the checkbox value |
| 99 | + if (settings && settings.checkOptionDelta == true) { |
| 100 | + $checkOptionDelta.prop('checked', true); |
| 101 | + } |
| 102 | + // Otherwise, mark the box as unchecked |
| 103 | + else { |
| 104 | + $checkOptionDelta.prop('checked', false); |
| 105 | + } |
| 106 | + |
97 | 107 | // If a build definition change has been made, prepare to persist the new values
|
98 | 108 | $buildDefinitionDropdown.on("change", function () {
|
99 | 109 | // Output diagnostics info to console
|
|
105 | 115 | coverageMeasurement: $coverageMeasurementDropdown.val(),
|
106 | 116 | decimalPlaces: $decimalPlacesDropdown.val(),
|
107 | 117 | checkOptionBuildName: $checkOptionBuildName.prop('checked'),
|
108 |
| - checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked') |
| 118 | + checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked'), |
| 119 | + checkOptionDelta: $checkOptionDelta.prop('checked') |
109 | 120 | })
|
110 | 121 | };
|
111 | 122 | var eventName = WidgetHelpers.WidgetEvent.ConfigurationChange;
|
|
124 | 135 | coverageMeasurement: $coverageMeasurementDropdown.val(),
|
125 | 136 | decimalPlaces: $decimalPlacesDropdown.val(),
|
126 | 137 | checkOptionBuildName: $checkOptionBuildName.prop('checked'),
|
127 |
| - checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked') |
| 138 | + checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked'), |
| 139 | + checkOptionDelta: $checkOptionDelta.prop('checked') |
128 | 140 | })
|
129 | 141 | };
|
130 | 142 | var eventName = WidgetHelpers.WidgetEvent.ConfigurationChange;
|
|
143 | 155 | coverageMeasurement: $coverageMeasurementDropdown.val(),
|
144 | 156 | decimalPlaces: $decimalPlacesDropdown.val(),
|
145 | 157 | checkOptionBuildName: $checkOptionBuildName.prop('checked'),
|
146 |
| - checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked') |
| 158 | + checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked'), |
| 159 | + checkOptionDelta: $checkOptionDelta.prop('checked') |
147 | 160 | })
|
148 | 161 | };
|
149 | 162 | var eventName = WidgetHelpers.WidgetEvent.ConfigurationChange;
|
|
162 | 175 | coverageMeasurement: $coverageMeasurementDropdown.val(),
|
163 | 176 | decimalPlaces: $decimalPlacesDropdown.val(),
|
164 | 177 | checkOptionBuildName: $checkOptionBuildName.prop('checked'),
|
165 |
| - checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked') |
| 178 | + checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked'), |
| 179 | + checkOptionDelta: $checkOptionDelta.prop('checked') |
166 | 180 |
|
167 | 181 | })
|
168 | 182 | };
|
|
182 | 196 | coverageMeasurement: $coverageMeasurementDropdown.val(),
|
183 | 197 | decimalPlaces: $decimalPlacesDropdown.val(),
|
184 | 198 | checkOptionBuildName: $checkOptionBuildName.prop('checked'),
|
185 |
| - checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked') |
| 199 | + checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked'), |
| 200 | + checkOptionDelta: $checkOptionDelta.prop('checked') |
| 201 | + }) |
| 202 | + }; |
| 203 | + var eventName = WidgetHelpers.WidgetEvent.ConfigurationChange; |
| 204 | + var eventArgs = WidgetHelpers.WidgetEvent.Args(customSettings); |
| 205 | + widgetConfigurationContext.notify(eventName, eventArgs); |
| 206 | + }); |
| 207 | + |
| 208 | + // If a show delta change has been made, prepare to persist the new values |
| 209 | + $checkOptionDelta.on("change", function () { |
| 210 | + // Output diagnostics info to console |
| 211 | + console.log('event: checkOptionDelta.change'); |
186 | 212 |
|
| 213 | + var customSettings = { |
| 214 | + data: JSON.stringify({ |
| 215 | + buildDefinition: $buildDefinitionDropdown.val(), |
| 216 | + coverageMeasurement: $coverageMeasurementDropdown.val(), |
| 217 | + decimalPlaces: $decimalPlacesDropdown.val(), |
| 218 | + checkOptionBuildName: $checkOptionBuildName.prop('checked'), |
| 219 | + checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked'), |
| 220 | + checkOptionDelta: $checkOptionDelta.prop('checked') |
187 | 221 | })
|
188 | 222 | };
|
189 | 223 | var eventName = WidgetHelpers.WidgetEvent.ConfigurationChange;
|
|
204 | 238 | coverageMeasurement: $coverageMeasurementDropdown.val(),
|
205 | 239 | decimalPlaces: $decimalPlacesDropdown.val(),
|
206 | 240 | checkOptionBuildName: $checkOptionBuildName.prop('checked'),
|
207 |
| - checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked') |
208 |
| - |
| 241 | + checkOptionMeasurementName: $checkOptionMeasurementName.prop('checked'), |
| 242 | + checkOptionDelta: $checkOptionDelta.prop('checked') |
209 | 243 | })
|
210 | 244 | };
|
211 | 245 | return WidgetHelpers.WidgetConfigurationSave.Valid(customSettings);
|
|
260 | 294 | <label for="check-option-build-name">Show the name of the build</label><br/>
|
261 | 295 | <input type="checkbox" id="check-option-measurement-name" name="check-option-measurement-name">
|
262 | 296 | <label for="check-option-measurement-name">Show the name of the coverage measurement</label><br />
|
| 297 | + <input type="checkbox" id="check-option-delta" name="check-option-delta"> |
| 298 | + <label for="check-option-delta">Show the delta from previous build's coverage</label><br /> |
263 | 299 | </fieldset>
|
264 | 300 | </div>
|
265 | 301 | </div>
|
|
0 commit comments