|
215 | 215 | $('#filelocation').append(directory);
|
216 | 216 | });
|
217 | 217 |
|
218 |
| - //GetData(); |
219 | 218 | });
|
220 | 219 |
|
221 | 220 | // Client function called from the dataHub when meta data gets recieved
|
|
350 | 349 | $('#recordCount').text(data.length);
|
351 | 350 |
|
352 | 351 | });
|
| 352 | + dataHub.getMappingCompilerErrors().done(function (data) { |
| 353 | + errorList = data; |
| 354 | +
|
| 355 | + if (errorList.length == 0) { |
| 356 | + if ($('#error-count').length) |
| 357 | + hideErrorMessage(); |
| 358 | +
|
| 359 | + $('#modal-errors').modal('hide'); |
| 360 | + } else if (errorList.length > 0) { |
| 361 | + var anchor = $('<a href="#" id="error-count">'); |
| 362 | +
|
| 363 | + if (data.length == 1) |
| 364 | + anchor.append('1 error'); |
| 365 | + else |
| 366 | + anchor.append(data.length + ' errors'); |
| 367 | +
|
| 368 | + UpdateErrorModal(); |
| 369 | + showErrorMessage(anchor.prop('outerHTML') + ' occurred during mapping compilation.'); |
| 370 | +
|
| 371 | + $('#error-count').click(function (e) { |
| 372 | + $('#modal-errors').modal('show'); |
| 373 | + return false; |
| 374 | + }); |
| 375 | + } |
| 376 | + }).fail(function (error) { |
| 377 | + showErrorMessage(error); |
| 378 | + }); |
| 379 | +
|
353 | 380 | });
|
354 | 381 |
|
355 | 382 | }
|
356 | 383 |
|
357 | 384 | $scope.getExpressions = function (item) {
|
358 | 385 | var fieldString = "";
|
359 | 386 | $.each(item.FieldMappings, function (i, fieldMapping) {
|
360 |
| - fieldString += fieldMapping.Field.Identifier + ' to ' + fieldMapping.Expression; |
| 387 | + fieldString += fieldMapping.Field.Identifier + ' to ' + fieldMapping.Expression + (fieldMapping.TimeWindowExpression != null? ' ' + fieldMapping.TimeWindowExpression: ''); |
361 | 388 | if (i < item.FieldMappings.length - 1)
|
362 | 389 | fieldString += ', ';
|
363 | 390 | });
|
|
491 | 518 |
|
492 | 519 |
|
493 | 520 | });
|
494 |
| -
|
495 |
| - function GetData() { |
496 |
| - udts = []; |
497 |
| - mappings = []; |
498 |
| -
|
499 |
| - $('#identifier').val(""); |
500 |
| - $('#types').empty(); |
501 |
| - $('#userdefinedmappings tbody').empty(); |
502 |
| -
|
503 |
| - dataHub.getDefinedTypes().done(function (data) { |
504 |
| - $.each(data, function (i, dataType) { |
505 |
| - if (dataType.IsUserDefined) { |
506 |
| - $('#types').append($('<option />').val(dataType.Category + '~' + dataType.Identifier + '~' + dataType.IsArray + '~' + dataType.IsUserDefined + '~' + i).text(dataType.Category + ' ' + dataType.Identifier)); |
507 |
| - udts.push(dataType); |
508 |
| - } |
509 |
| - }); |
510 |
| -
|
511 |
| - UpdateTypeMappings(); |
512 |
| -
|
513 |
| - dataHub.getDefinedMappings().done(function (data) { |
514 |
| - $.each(data, function (i, typeMapping) { |
515 |
| - var fieldsString = ''; |
516 |
| -
|
517 |
| - mappings.push(typeMapping); |
518 |
| -
|
519 |
| - $.each(typeMapping.FieldMappings, function (i, fieldMapping) { |
520 |
| - fieldsString += fieldMapping.Field.Identifier + ' to ' + fieldMapping.Expression; |
521 |
| - if (i < typeMapping.FieldMappings.length - 1) |
522 |
| - fieldsString += ', '; |
523 |
| - }); |
524 |
| -
|
525 |
| - $('#userdefinedmappings tbody').append($('<tr><td>' + typeMapping.Type.Category + ' ' + typeMapping.Type.Identifier + '</td><td>' + typeMapping.Identifier + '</td><td>' + fieldsString + '</td><td><button id="updatebtn' + i + '"class="btn btn-link" hub-dependent><span class="glyphicon glyphicon-pencil"></span></button><button id="btn' + i + '" class="btn btn-link" hub-dependent><span class="glyphicon glyphicon-remove-sign"></span></button></td></tr>')); |
526 |
| -
|
527 |
| - $('#btn' + i).one('click', function (e) { |
528 |
| - RemoveMapping(typeMapping); |
529 |
| - }); |
530 |
| -
|
531 |
| - $('#updatebtn' + i).on('click', function (e) { |
532 |
| - UpdateMapping(typeMapping); |
533 |
| - }); |
534 |
| - }); |
535 |
| -
|
536 |
| - }).fail(function (error) { |
537 |
| - showErrorMessage(error); |
538 |
| - }); |
539 |
| - }).fail(function (error) { |
540 |
| - showErrorMessage(error); |
541 |
| - }); |
542 |
| -
|
543 |
| - dataHub.getMappingCompilerErrors().done(function (data) { |
544 |
| - errorList = data; |
545 |
| -
|
546 |
| - if (errorList.length == 0) { |
547 |
| - if ($('#error-count').length) |
548 |
| - hideErrorMessage(); |
549 |
| -
|
550 |
| - $('#modal-errors').modal('hide'); |
551 |
| - } else if (errorList.length > 0) { |
552 |
| - var anchor = $('<a href="#" id="error-count">'); |
553 |
| -
|
554 |
| - if (data.length == 1) |
555 |
| - anchor.append('1 error'); |
556 |
| - else |
557 |
| - anchor.append(data.length + ' errors'); |
558 |
| -
|
559 |
| - UpdateErrorModal(); |
560 |
| - showErrorMessage(anchor.prop('outerHTML') + ' occurred during mapping compilation.'); |
561 |
| -
|
562 |
| - $('#error-count').click(function (e) { |
563 |
| - $('#modal-errors').modal('show'); |
564 |
| - return false; |
565 |
| - }); |
566 |
| - } |
567 |
| - }).fail(function (error) { |
568 |
| - showErrorMessage(error); |
569 |
| - }); |
570 |
| - } |
571 | 521 |
|
572 | 522 | function UpdateTypeMappings() {
|
573 | 523 | $('#modals').children().remove();
|
|
740 | 690 |
|
741 | 691 | }
|
742 | 692 | else if ($(d).is('select')) {
|
743 |
| - $(d).val(data.FieldMappings[i].Expression.split(' ')[0]); |
| 693 | + $(d).val(data.FieldMappings[i].Expression); |
744 | 694 | }
|
745 | 695 | else if ($(d).is('input')) {
|
746 |
| - $(d).val(data.FieldMappings[i].Expression.split(' ')[0]); |
| 696 | + $(d).val(data.FieldMappings[i].Expression); |
747 | 697 | }
|
748 | 698 | });
|
749 | 699 |
|
750 | 700 | $.each($('#fields li div').children('[id*="timeWindow"]'), function (i, d) {
|
751 |
| - $(d).val(data.FieldMappings[i].Expression.split(' ')[1]); |
| 701 | + $(d).val(data.FieldMappings[i].TimeWindowExpression); |
752 | 702 | });
|
753 | 703 |
|
754 | 704 | $('#addnewmapping').attr('disabled', false);
|
|
0 commit comments