This commit is contained in:
Mark Payne 2015-04-10 14:55:23 -04:00
commit f1c36e64f1
6 changed files with 67 additions and 37 deletions

View File

@ -29,4 +29,4 @@
<input type="hidden" name="caption" value="" /> <input type="hidden" name="caption" value="" />
</form> </form>
</div> </div>
<div id="trancation-message">Showing up to 1.5kb</div> <div id="truncation-message">Showing up to 1.5 KB</div>

View File

@ -87,7 +87,7 @@
padding: 2px; padding: 2px;
} }
#trancation-message { #truncation-message {
position: absolute; position: absolute;
left: 100px; left: 100px;
bottom: 35px; bottom: 35px;

View File

@ -1375,37 +1375,59 @@
var add = function () { var add = function () {
var propertyName = $.trim(newPropertyNameField.val()); var propertyName = $.trim(newPropertyNameField.val());
// ensure the property name and value is specified // ensure the property name is specified
if (propertyName !== '') { if (propertyName !== '') {
// load the descriptor and add the property var propertyGrid = table.data('gridInstance');
options.descriptorDeferred(propertyName).done(function(response) { var propertyData = propertyGrid.getData();
var descriptor = response.propertyDescriptor;
// store the descriptor for use later // ensure the property name is unique
var descriptors = table.data('descriptors'); var existingPropertyId = null;
if (!nf.Common.isUndefined(descriptors)) { $.each(propertyData.getItems(), function (_, item) {
descriptors[descriptor.name] = descriptor; if (propertyName === item.property) {
existingPropertyId = item.id;
return false;
} }
});
// add a row for the new property if (existingPropertyId === null) {
var propertyGrid = table.data('gridInstance'); // load the descriptor and add the property
var propertyData = propertyGrid.getData(); options.descriptorDeferred(propertyName).done(function(response) {
var id = propertyData.getLength(); var descriptor = response.propertyDescriptor;
propertyData.addItem({
id: id, // store the descriptor for use later
hidden: false, var descriptors = table.data('descriptors');
property: propertyName, if (!nf.Common.isUndefined(descriptors)) {
displayName: propertyName, descriptors[descriptor.name] = descriptor;
previousValue: null, }
value: null,
type: 'userDefined' // add a row for the new property
var id = propertyData.getLength();
propertyData.addItem({
id: id,
hidden: false,
property: propertyName,
displayName: propertyName,
previousValue: null,
value: null,
type: 'userDefined'
});
// select the new properties row
var row = propertyData.getRowById(id);
propertyGrid.setSelectedRows([row]);
propertyGrid.scrollRowIntoView(row);
});
} else {
nf.Dialog.showOkDialog({
dialogContent: 'A property with this name already exists.',
overlayBackground: false
}); });
// select the new properties row // select the existing properties row
var row = propertyData.getRowById(id); var row = propertyData.getRowById(existingPropertyId);
propertyGrid.setSelectedRows([row]); propertyGrid.setSelectedRows([row]);
propertyGrid.scrollRowIntoView(row); propertyGrid.scrollRowIntoView(row);
}); }
} else { } else {
nf.Dialog.showOkDialog({ nf.Dialog.showOkDialog({
dialogContent: 'Property name must be specified.', dialogContent: 'Property name must be specified.',

View File

@ -311,8 +311,9 @@ nf.CanvasUtils = (function () {
// if we've reached the last line, use single line ellipsis // if we've reached the last line, use single line ellipsis
if (++i >= lineCount) { if (++i >= lineCount) {
// restore the current word // get the remainder using the current word and
var remainder = [word].concat(words); // reversing whats left
var remainder = [word].concat(words.reverse());
// apply ellipsis to the last line // apply ellipsis to the last line
nf.CanvasUtils.ellipsis(tspan, remainder.join(' ')); nf.CanvasUtils.ellipsis(tspan, remainder.join(' '));
@ -322,7 +323,7 @@ nf.CanvasUtils = (function () {
} else { } else {
tspan.text(word); tspan.text(word);
// other prep the line for the next iteration // prep the line for the next iteration
line = [word]; line = [word];
} }
} }

View File

@ -529,9 +529,11 @@ nf.Canvas = (function () {
}; };
// listen for browser resize events to reset the graph size // listen for browser resize events to reset the graph size
$(window).on('resize', function () { $(window).on('resize', function (e) {
updateGraphSize(); if (e.target === window) {
nf.Settings.resetTableSize(); updateGraphSize();
nf.Settings.resetTableSize();
}
}).on('keydown', function (evt) { }).on('keydown', function (evt) {
var isCtrl = evt.ctrlKey || evt.metaKey; var isCtrl = evt.ctrlKey || evt.metaKey;

View File

@ -14,6 +14,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* global Slick */
$(document).ready(function () { $(document).ready(function () {
ua.editable = $('#attribute-updater-editable').text() === 'true'; ua.editable = $('#attribute-updater-editable').text() === 'true';
ua.init(); ua.init();
@ -43,10 +46,12 @@ var ua = {
var actionsGrid = ua.initActionsGrid(); var actionsGrid = ua.initActionsGrid();
// enable grid resizing // enable grid resizing
$(window).resize(function () { $(window).resize(function (e) {
conditionsGrid.resizeCanvas(); if (e.target === window) {
actionsGrid.resizeCanvas(); conditionsGrid.resizeCanvas();
ua.resizeSelectedRuleNameField(); actionsGrid.resizeCanvas();
ua.resizeSelectedRuleNameField();
}
}); });
// initialize the rule list // initialize the rule list