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="" />
</form>
</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;
}
#trancation-message {
#truncation-message {
position: absolute;
left: 100px;
bottom: 35px;

View File

@ -1375,37 +1375,59 @@
var add = function () {
var propertyName = $.trim(newPropertyNameField.val());
// ensure the property name and value is specified
// ensure the property name is specified
if (propertyName !== '') {
// load the descriptor and add the property
options.descriptorDeferred(propertyName).done(function(response) {
var descriptor = response.propertyDescriptor;
// store the descriptor for use later
var descriptors = table.data('descriptors');
if (!nf.Common.isUndefined(descriptors)) {
descriptors[descriptor.name] = descriptor;
var propertyGrid = table.data('gridInstance');
var propertyData = propertyGrid.getData();
// ensure the property name is unique
var existingPropertyId = null;
$.each(propertyData.getItems(), function (_, item) {
if (propertyName === item.property) {
existingPropertyId = item.id;
return false;
}
});
if (existingPropertyId === null) {
// load the descriptor and add the property
options.descriptorDeferred(propertyName).done(function(response) {
var descriptor = response.propertyDescriptor;
// add a row for the new property
var propertyGrid = table.data('gridInstance');
var propertyData = propertyGrid.getData();
var id = propertyData.getLength();
propertyData.addItem({
id: id,
hidden: false,
property: propertyName,
displayName: propertyName,
previousValue: null,
value: null,
type: 'userDefined'
// store the descriptor for use later
var descriptors = table.data('descriptors');
if (!nf.Common.isUndefined(descriptors)) {
descriptors[descriptor.name] = descriptor;
}
// 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);
});
// select the new properties row
var row = propertyData.getRowById(id);
} else {
nf.Dialog.showOkDialog({
dialogContent: 'A property with this name already exists.',
overlayBackground: false
});
// select the existing properties row
var row = propertyData.getRowById(existingPropertyId);
propertyGrid.setSelectedRows([row]);
propertyGrid.scrollRowIntoView(row);
});
}
} else {
nf.Dialog.showOkDialog({
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 (++i >= lineCount) {
// restore the current word
var remainder = [word].concat(words);
// get the remainder using the current word and
// reversing whats left
var remainder = [word].concat(words.reverse());
// apply ellipsis to the last line
nf.CanvasUtils.ellipsis(tspan, remainder.join(' '));
@ -322,7 +323,7 @@ nf.CanvasUtils = (function () {
} else {
tspan.text(word);
// other prep the line for the next iteration
// prep the line for the next iteration
line = [word];
}
}

View File

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

View File

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