2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * Modifications to the original nifi code for the ONAP project are made
18 * available under the Apache License, Version 2.0
21 /* global define, module, require, exports */
26 (function (root, factory) {
27 if (typeof define === 'function' && define.amd) {
37 'nf.ProcessGroupConfiguration',
40 function ($, nfNgBridge, nfErrorHandler, nfDialog, nfStorage, nfCommon, nfClient, nfCanvasUtils, nfProcessGroup, nfProcessGroupConfiguration, nfGraph, nfBirdseye) {
41 return (nf.FlowVersion = factory($, nfNgBridge, nfErrorHandler, nfDialog, nfStorage, nfCommon, nfClient, nfCanvasUtils, nfProcessGroup, nfProcessGroupConfiguration, nfGraph, nfBirdseye));
43 } else if (typeof exports === 'object' && typeof module === 'object') {
44 module.exports = (nf.FlowVerison =
45 factory(require('jquery'),
46 require('nf.ng.Bridge'),
47 require('nf.ErrorHandler'),
49 require('nf.Storage'),
52 require('nf.CanvasUtils'),
53 require('nf.ProcessGroup'),
54 require('nf.ProcessGroupConfiguration'),
56 require('nf.Birdseye')));
58 nf.FlowVersion = factory(root.$,
67 root.nf.ProcessGroupConfiguration,
71 }(this, function ($, nfNgBridge, nfErrorHandler, nfDialog, nfStorage, nfCommon, nfClient, nfCanvasUtils, nfProcessGroup, nfProcessGroupConfiguration, nfGraph, nfBirdseye) {
74 var serverTimeOffset = null;
77 forceFitColumns: true,
78 enableTextSelectionOnCells: true,
79 enableCellNavigation: true,
80 enableColumnReorder: false,
87 * Reset the save flow version dialog.
89 var resetSaveFlowVersionDialog = function () {
90 $('#save-flow-version-registry-combo').combo('destroy').hide();
91 $('#save-flow-version-bucket-combo').combo('destroy').hide();
93 $('#save-flow-version-label').text('');
95 $('#save-flow-version-registry').text('').hide();
96 $('#save-flow-version-bucket').text('').hide();
98 $('#save-flow-version-name').text('').hide();
99 $('#save-flow-version-description').removeClass('unset blank').text('').hide();
101 $('#save-flow-version-name-field').val('').hide();
102 $('#save-flow-version-description-field').val('').hide();
103 $('#save-flow-version-change-comments').val('');
105 $('#save-flow-version-process-group-id').removeData('versionControlInformation').removeData('revision').text('');
109 * Reset the revert local changes dialog.
111 var resetRevertLocalChangesDialog = function () {
112 $('#revert-local-changes-process-group-id').text('');
114 clearLocalChangesGrid($('#revert-local-changes-table'), $('#revert-local-changes-filter'), $('#displayed-revert-local-changes-entries'), $('#total-revert-local-changes-entries'));
118 * Reset the show local changes dialog.
120 var resetShowLocalChangesDialog = function () {
121 clearLocalChangesGrid($('#show-local-changes-table'), $('#show-local-changes-filter'), $('#displayed-show-local-changes-entries'), $('#total-show-local-changes-entries'));
125 * Clears the local changes grid.
127 var clearLocalChangesGrid = function (localChangesTable, filterInput, displayedLabel, totalLabel) {
128 var localChangesGrid = localChangesTable.data('gridInstance');
129 if (nfCommon.isDefinedAndNotNull(localChangesGrid)) {
130 localChangesGrid.setSelectedRows([]);
131 localChangesGrid.resetActiveCell();
133 var localChangesData = localChangesGrid.getData();
134 localChangesData.setItems([]);
135 localChangesData.setFilterArgs({
142 displayedLabel.text('0');
143 totalLabel.text('0');
147 * Clears the version grid
149 var clearFlowVersionsGrid = function () {
150 var importFlowVersionGrid = $('#import-flow-version-table').data('gridInstance');
151 if (nfCommon.isDefinedAndNotNull(importFlowVersionGrid)) {
152 importFlowVersionGrid.setSelectedRows([]);
153 importFlowVersionGrid.resetActiveCell();
155 var importFlowVersionData = importFlowVersionGrid.getData();
156 importFlowVersionData.setItems([]);
161 * Reset the import flow version dialog.
163 var resetImportFlowVersionDialog = function () {
164 $('#import-flow-version-dialog').removeData('pt');
166 $('#import-flow-version-registry-combo').combo('destroy').hide();
167 $('#import-flow-version-bucket-combo').combo('destroy').hide();
168 $('#import-flow-version-name-combo').combo('destroy').hide();
170 $('#import-flow-version-registry').text('').hide();
171 $('#import-flow-version-bucket').text('').hide();
172 $('#import-flow-version-name').text('').hide();
174 clearFlowVersionsGrid();
176 $('#import-flow-version-process-group-id').removeData('versionControlInformation').removeData('revision').text('');
178 $('#import-flow-version-container').hide();
179 $('#import-flow-version-label').text('');
183 * Loads the registries into the specified registry combo.
186 * @param registryCombo
189 * @param selectBucket
191 * @returns {deferred}
193 var loadRegistries = function (dialog, registryCombo, bucketCombo, flowCombo, selectBucket, bucketCheck) {
196 url: '../nifi-api/flow/registries',
198 }).done(function (registriesResponse) {
201 if (nfCommon.isDefinedAndNotNull(registriesResponse.registries) && registriesResponse.registries.length > 0) {
202 registriesResponse.registries.sort(function (a, b) {
203 return a.registry.name > b.registry.name;
206 $.each(registriesResponse.registries, function (_, registryEntity) {
207 var registry = registryEntity.registry;
211 description: nfCommon.escapeHtml(registry.description)
216 text: 'No available registries',
218 optionClass: 'unset',
223 // load the registries
224 registryCombo.combo({
226 select: function (selectedOption) {
227 selectRegistry(dialog, selectedOption, bucketCombo, flowCombo, selectBucket, bucketCheck)
230 }).fail(nfErrorHandler.handleAjaxError);
234 * Loads the buckets for the specified registryIdentifier for the current user.
236 * @param registryIdentifier
239 * @param selectBucket
243 var loadBuckets = function (registryIdentifier, bucketCombo, flowCombo, selectBucket, bucketCheck) {
246 url: '../nifi-api/flow/registries/' + encodeURIComponent(registryIdentifier) + '/buckets',
248 }).done(function (response) {
251 if (nfCommon.isDefinedAndNotNull(response.buckets) && response.buckets.length > 0) {
252 response.buckets.sort(function (a, b) {
253 if (a.permissions.canRead === false && b.permissions.canRead === false) {
255 } else if (a.permissions.canRead === false) {
257 } else if (b.permissions.canRead === false) {
261 return a.bucket.name > b.bucket.name;
264 $.each(response.buckets, function (_, bucketEntity) {
265 if (bucketEntity.permissions.canRead === true) {
266 var bucket = bucketEntity.bucket;
268 if (bucketCheck(bucketEntity)) {
272 description: nfCommon.escapeHtml(bucket.description)
279 if (buckets.length === 0) {
281 text: 'No available buckets',
283 optionClass: 'unset',
287 if (nfCommon.isDefinedAndNotNull(flowCombo)) {
288 flowCombo.combo('destroy').combo({
290 text: 'No available flows',
292 optionClass: 'unset',
300 bucketCombo.combo('destroy').combo({
304 }).fail(nfErrorHandler.handleAjaxError);
308 * Select handler for the registries combo.
311 * @param selectedOption
314 * @param selectBucket
317 var selectRegistry = function (dialog, selectedOption, bucketCombo, flowCombo, selectBucket, bucketCheck) {
318 var showNoBucketsAvailable = function () {
319 bucketCombo.combo('destroy').combo({
321 text: 'No available buckets',
323 optionClass: 'unset',
328 if (nfCommon.isDefinedAndNotNull(flowCombo)) {
329 flowCombo.combo('destroy').combo({
331 text: 'No available flows',
333 optionClass: 'unset',
339 dialog.modal('refreshButtons');
342 if (selectedOption.disabled === true) {
343 showNoBucketsAvailable();
345 bucketCombo.combo('destroy').combo({
347 text: 'Loading buckets...',
349 optionClass: 'unset',
354 if (nfCommon.isDefinedAndNotNull(flowCombo)) {
355 flowCombo.combo('destroy').combo({
357 text: 'Loading flows...',
359 optionClass: 'unset',
364 clearFlowVersionsGrid();
367 loadBuckets(selectedOption.value, bucketCombo, flowCombo, selectBucket, bucketCheck).fail(function () {
368 showNoBucketsAvailable();
374 * Select handler for the buckets combo.
376 * @param selectedOption
378 var selectBucketSaveFlowVersion = function (selectedOption) {
379 $('#save-flow-version-dialog').modal('refreshButtons');
383 * Saves a flow version.
385 * @desc for lines 390-396: when a dflow is committed, then environment dropdown selection is enabled.
386 * If Env is pre-selected and enabled =>submit button is enabled
389 var saveFlowVersion = function () {
390 var processGroupId = $('#save-flow-version-process-group-id').text();
391 var processGroupRevision = $('#save-flow-version-process-group-id').data('revision');
393 $('#environmentType').prop('disabled', false);
394 console.log("test submit btn..... ");
396 if($('#environmentType').val() && !$('#environmentType').prop("disabled")){
397 $('#operate-submit-btn').prop('disabled', false);
398 console.log("button is enabled bcz env is already selected and not disabled");
401 var saveFlowVersionRequest = {
402 processGroupRevision: nfClient.getRevision({
404 version: processGroupRevision.version
407 'disconnectedNodeAcknowledged': nfStorage.isDisconnectionAcknowledged()
410 var versionControlInformation = $('#save-flow-version-process-group-id').data('versionControlInformation');
411 if (nfCommon.isDefinedAndNotNull(versionControlInformation)) {
412 saveFlowVersionRequest['versionedFlow'] = {
413 registryId: versionControlInformation.registryId,
414 bucketId: versionControlInformation.bucketId,
415 flowId: versionControlInformation.flowId,
416 comments: $('#save-flow-version-change-comments').val()
419 var selectedRegistry = $('#save-flow-version-registry-combo').combo('getSelectedOption');
420 var selectedBucket = $('#save-flow-version-bucket-combo').combo('getSelectedOption');
422 saveFlowVersionRequest['versionedFlow'] = {
423 registryId: selectedRegistry.value,
424 bucketId: selectedBucket.value,
425 flowName: $('#save-flow-version-name-field').val(),
426 description: $('#save-flow-version-description-field').val(),
427 comments: $('#save-flow-version-change-comments').val()
433 data: JSON.stringify(saveFlowVersionRequest),
434 url: '../nifi-api/versions/process-groups/' + encodeURIComponent(processGroupId),
436 contentType: 'application/json'
437 }).fail(nfErrorHandler.handleAjaxError)
443 * Sorts the specified data using the specified sort details.
445 * @param {object} sortDetails
446 * @param {object} data
448 var sort = function (sortDetails, data) {
449 // defines a function for sorting
450 var comparer = function (a, b) {
451 var aIsBlank = nfCommon.isBlank(a[sortDetails.columnId]);
452 var bIsBlank = nfCommon.isBlank(b[sortDetails.columnId]);
454 if (aIsBlank && bIsBlank) {
456 } else if (aIsBlank) {
458 } else if (bIsBlank) {
462 return a[sortDetails.columnId] === b[sortDetails.columnId] ? 0 : a[sortDetails.columnId] > b[sortDetails.columnId] ? 1 : -1;
466 data.sort(comparer, sortDetails.sortAsc);
469 var initImportFlowVersionTable = function () {
470 var importFlowVersionTable = $('#import-flow-version-table');
472 var valueFormatter = function (row, cell, value, columnDef, dataContext) {
473 return nfCommon.escapeHtml(value);
476 var timestampFormatter = function (row, cell, value, columnDef, dataContext) {
477 // get the current user time to properly convert the server time
478 var now = new Date();
480 // convert the user offset to millis
481 var userTimeOffset = now.getTimezoneOffset() * 60 * 1000;
483 // create the proper date by adjusting by the offsets
484 var date = new Date(dataContext.timestamp + userTimeOffset + serverTimeOffset);
485 return nfCommon.formatDateTime(date);
488 // define the column model for flow versions
489 var importFlowVersionColumns = [
494 formatter: valueFormatter,
504 formatter: timestampFormatter,
511 id: 'changeComments',
516 formatter: valueFormatter
520 // initialize the dataview
521 var importFlowVersionData = new Slick.Data.DataView({
525 // initialize the sort
529 }, importFlowVersionData);
531 // initialize the grid
532 var importFlowVersionGrid = new Slick.Grid(importFlowVersionTable, importFlowVersionData, importFlowVersionColumns, gridOptions);
533 importFlowVersionGrid.setSelectionModel(new Slick.RowSelectionModel());
534 importFlowVersionGrid.registerPlugin(new Slick.AutoTooltips());
535 importFlowVersionGrid.setSortColumn('version', false);
536 importFlowVersionGrid.onSort.subscribe(function (e, args) {
538 columnId: args.sortCol.id,
539 sortAsc: args.sortAsc
540 }, importFlowVersionData);
542 importFlowVersionGrid.onSelectedRowsChanged.subscribe(function (e, args) {
543 $('#import-flow-version-dialog').modal('refreshButtons');
545 importFlowVersionGrid.onDblClick.subscribe(function (e, args) {
546 if ($('#import-flow-version-label').is(':visible')) {
549 importFlowVersion().always(function () {
550 $('#import-flow-version-dialog').modal('hide');
555 // wire up the dataview to the grid
556 importFlowVersionData.onRowCountChanged.subscribe(function (e, args) {
557 importFlowVersionGrid.updateRowCount();
558 importFlowVersionGrid.render();
560 importFlowVersionData.onRowsChanged.subscribe(function (e, args) {
561 importFlowVersionGrid.invalidateRows(args.rows);
562 importFlowVersionGrid.render();
564 importFlowVersionData.syncGridSelection(importFlowVersionGrid, true);
566 // hold onto an instance of the grid
567 importFlowVersionTable.data('gridInstance', importFlowVersionGrid);
571 * Initializes the specified local changes table.
573 * @param localChangesTable
575 * @param displayedLabel
578 var initLocalChangesTable = function (localChangesTable, filterInput, displayedLabel, totalLabel) {
580 var getFilterText = function () {
581 return filterInput.val();
584 var applyFilter = function () {
586 var localChangesGrid = localChangesTable.data('gridInstance');
588 // ensure the grid has been initialized
589 if (nfCommon.isDefinedAndNotNull(localChangesGrid)) {
590 var localChangesData = localChangesGrid.getData();
592 // update the search criteria
593 localChangesData.setFilterArgs({
594 searchString: getFilterText()
596 localChangesData.refresh();
600 var filter = function (item, args) {
601 if (args.searchString === '') {
606 // perform the row filtering
607 var filterExp = new RegExp(args.searchString, 'i');
613 // determine if the item matches the filter
614 var matchesId = item['componentId'].search(filterExp) >= 0;
615 var matchesDifferenceType = item['differenceType'].search(filterExp) >= 0;
616 var matchesDifference = item['difference'].search(filterExp) >= 0;
618 // conditionally consider the component name
619 var matchesComponentName = false;
620 if (nfCommon.isDefinedAndNotNull(item['componentName'])) {
621 matchesComponentName = item['componentName'].search(filterExp) >= 0;
624 return matchesId || matchesComponentName || matchesDifferenceType || matchesDifference;
627 // initialize the component state filter
628 filterInput.on('keyup', function () {
632 var valueFormatter = function (row, cell, value, columnDef, dataContext) {
633 return nfCommon.escapeHtml(value);
636 var actionsFormatter = function (row, cell, value, columnDef, dataContext) {
639 if (dataContext.differenceType !== 'Component Removed' && nfCommon.isDefinedAndNotNull(dataContext.processGroupId)) {
640 markup += '<div class="pointer go-to-component fa fa-long-arrow-right" title="Go To"></div>';
646 // define the column model for local changes
647 var localChangesColumns = [
650 name: 'Component Name',
651 field: 'componentName',
652 formatter: valueFormatter,
657 id: 'differenceType',
659 field: 'differenceType',
660 formatter: valueFormatter,
668 formatter: valueFormatter,
675 formatter: actionsFormatter,
682 // initialize the dataview
683 var localChangesData = new Slick.Data.DataView({
686 localChangesData.setFilterArgs({
687 searchString: getFilterText()
689 localChangesData.setFilter(filter);
691 // initialize the sort
693 columnId: 'componentName',
695 }, localChangesData);
697 // initialize the grid
698 var localChangesGrid = new Slick.Grid(localChangesTable, localChangesData, localChangesColumns, gridOptions);
699 localChangesGrid.setSelectionModel(new Slick.RowSelectionModel());
700 localChangesGrid.registerPlugin(new Slick.AutoTooltips());
701 localChangesGrid.setSortColumn('componentName', true);
702 localChangesGrid.onSort.subscribe(function (e, args) {
704 columnId: args.sortCol.id,
705 sortAsc: args.sortAsc
706 }, localChangesData);
709 // configure a click listener
710 localChangesGrid.onClick.subscribe(function (e, args) {
711 var target = $(e.target);
713 // get the node at this row
714 var componentDifference = localChangesData.getItem(args.row);
716 // determine the desired action
717 if (localChangesGrid.getColumns()[args.cell].id === 'actions') {
718 if (target.hasClass('go-to-component')) {
719 if (componentDifference.componentType === 'Controller Service') {
720 nfProcessGroupConfiguration.showConfiguration(componentDifference.processGroupId).done(function () {
721 nfProcessGroupConfiguration.selectControllerService(componentDifference.componentId);
723 localChangesTable.closest('.large-dialog').modal('hide');
726 nfCanvasUtils.showComponent(componentDifference.processGroupId, componentDifference.componentId).done(function () {
727 localChangesTable.closest('.large-dialog').modal('hide');
734 // wire up the dataview to the grid
735 localChangesData.onRowCountChanged.subscribe(function (e, args) {
736 localChangesGrid.updateRowCount();
737 localChangesGrid.render();
739 // update the total number of displayed items
740 displayedLabel.text(nfCommon.formatInteger(args.current));
742 localChangesData.onRowsChanged.subscribe(function (e, args) {
743 localChangesGrid.invalidateRows(args.rows);
744 localChangesGrid.render();
746 localChangesData.syncGridSelection(localChangesGrid, true);
748 // hold onto an instance of the grid
749 localChangesTable.data('gridInstance', localChangesGrid);
751 // initialize the number of display items
752 displayedLabel.text('0');
753 totalLabel.text('0');
757 * Shows the import flow version dialog.
759 var showImportFlowVersionDialog = function () {
760 var pt = $('#new-process-group-dialog').data('pt');
761 $('#import-flow-version-dialog').data('pt', pt);
763 // update the registry and bucket visibility
764 var registryCombo = $('#import-flow-version-registry-combo').combo('destroy').combo({
766 text: 'Loading registries...',
768 optionClass: 'unset',
772 var bucketCombo = $('#import-flow-version-bucket-combo').combo('destroy').combo({
774 text: 'Loading buckets...',
776 optionClass: 'unset',
780 var flowCombo = $('#import-flow-version-name-combo').combo('destroy').combo({
782 text: 'Loading flows...',
784 optionClass: 'unset',
789 loadRegistries($('#import-flow-version-dialog'), registryCombo, bucketCombo, flowCombo, selectBucketImportVersion, function (bucketEntity) {
791 }).done(function () {
792 // show the import dialog
793 $('#import-flow-version-dialog').modal('setHeaderText', 'Import Version').modal('setButtonModel', [{
794 buttonText: 'Import',
800 disabled: disableImportOrChangeButton,
803 importFlowVersion().always(function () {
804 $('#import-flow-version-dialog').modal('hide');
809 buttonText: 'Cancel',
817 $(this).modal('hide');
822 // hide the new process group dialog
823 $('#new-process-group-dialog').modal('hide');
828 * Loads the flow versions for the specified registry, bucket, and flow.
830 * @param registryIdentifier
831 * @param bucketIdentifier
832 * @param flowIdentifier
835 var loadFlowVersions = function (registryIdentifier, bucketIdentifier, flowIdentifier) {
836 var importFlowVersionGrid = $('#import-flow-version-table').data('gridInstance');
837 var importFlowVersionData = importFlowVersionGrid.getData();
840 importFlowVersionData.beginUpdate();
842 // remove the current versions
843 importFlowVersionGrid.setSelectedRows([]);
844 importFlowVersionGrid.resetActiveCell();
845 importFlowVersionData.setItems([]);
849 url: '../nifi-api/flow/registries/' + encodeURIComponent(registryIdentifier) + '/buckets/' + encodeURIComponent(bucketIdentifier) + '/flows/' + encodeURIComponent(flowIdentifier) + '/versions',
851 }).done(function (response) {
852 if (nfCommon.isDefinedAndNotNull(response.versionedFlowSnapshotMetadataSet) && response.versionedFlowSnapshotMetadataSet.length > 0) {
853 $.each(response.versionedFlowSnapshotMetadataSet, function (_, entity) {
854 importFlowVersionData.addItem($.extend({
855 id: entity.versionedFlowSnapshotMetadata.version
856 }, entity.versionedFlowSnapshotMetadata));
859 nfDialog.showOkDialog({
860 headerText: 'Flow Versions',
861 dialogContent: 'This flow does not have any versions available.'
864 }).fail(nfErrorHandler.handleAjaxError).always(function () {
866 importFlowVersionData.endUpdate();
869 importFlowVersionData.reSort();
870 importFlowVersionGrid.invalidate();
875 * Loads the versioned flows from the specified registry and bucket.
877 * @param registryIdentifier
878 * @param bucketIdentifier
882 var loadFlows = function (registryIdentifier, bucketIdentifier, selectFlow) {
885 url: '../nifi-api/flow/registries/' + encodeURIComponent(registryIdentifier) + '/buckets/' + encodeURIComponent(bucketIdentifier) + '/flows',
887 }).done(function (response) {
888 var versionedFlows = [];
890 if (nfCommon.isDefinedAndNotNull(response.versionedFlows) && response.versionedFlows.length > 0) {
891 response.versionedFlows.sort(function (a, b) {
892 return a.versionedFlow.flowName > b.versionedFlow.flowName;
895 $.each(response.versionedFlows, function (_, versionedFlowEntity) {
896 var versionedFlow = versionedFlowEntity.versionedFlow;
897 versionedFlows.push({
898 text: versionedFlow.flowName,
899 value: versionedFlow.flowId,
900 description: nfCommon.escapeHtml(versionedFlow.description)
904 versionedFlows.push({
905 text: 'No available flows',
907 optionClass: 'unset',
913 $('#import-flow-version-name-combo').combo('destroy').combo({
914 options: versionedFlows,
915 select: function (selectedFlow) {
916 if (nfCommon.isDefinedAndNotNull(selectedFlow.value)) {
917 selectFlow(registryIdentifier, bucketIdentifier, selectedFlow.value)
919 var importFlowVersionGrid = $('#import-flow-version-table').data('gridInstance');
920 var importFlowVersionData = importFlowVersionGrid.getData();
922 // clear the current values
923 importFlowVersionData.beginUpdate();
924 importFlowVersionData.setItems([]);
925 importFlowVersionData.endUpdate();
929 }).fail(nfErrorHandler.handleAjaxError);
933 * Handler when a versioned flow is selected.
935 * @param registryIdentifier
936 * @param bucketIdentifier
937 * @param flowIdentifier
939 var selectVersionedFlow = function (registryIdentifier, bucketIdentifier, flowIdentifier) {
940 loadFlowVersions(registryIdentifier, bucketIdentifier, flowIdentifier).done(function () {
941 $('#import-flow-version-dialog').modal('refreshButtons');
946 * Handler when a bucket is selected.
948 * @param selectedBucket
950 var selectBucketImportVersion = function (selectedBucket) {
951 // clear the flow versions grid
952 clearFlowVersionsGrid();
954 if (nfCommon.isDefinedAndNotNull(selectedBucket.value)) {
955 // mark the flows as loading
956 $('#import-flow-version-name-combo').combo('destroy').combo({
958 text: 'Loading flows...',
960 optionClass: 'unset',
965 var selectedRegistry = $('#import-flow-version-registry-combo').combo('getSelectedOption');
967 // load the flows for the currently selected registry and bucket
968 loadFlows(selectedRegistry.value, selectedBucket.value, selectVersionedFlow);
970 // mark no flows available
971 $('#import-flow-version-name-combo').combo('destroy').combo({
973 text: 'No available flows',
975 optionClass: 'unset',
983 * Imports the selected flow version.
985 var importFlowVersion = function () {
986 var pt = $('#import-flow-version-dialog').data('pt');
988 var selectedRegistry = $('#import-flow-version-registry-combo').combo('getSelectedOption');
989 var selectedBucket = $('#import-flow-version-bucket-combo').combo('getSelectedOption');
990 var selectedFlow = $('#import-flow-version-name-combo').combo('getSelectedOption');
992 var importFlowVersionGrid = $('#import-flow-version-table').data('gridInstance');
993 var selectedVersionIndex = importFlowVersionGrid.getSelectedRows();
994 var selectedVersion = importFlowVersionGrid.getDataItem(selectedVersionIndex[0]);
996 var processGroupEntity = {
997 'revision': nfClient.getRevision({
1002 'disconnectedNodeAcknowledged': nfStorage.isDisconnectionAcknowledged(),
1008 'versionControlInformation': {
1009 'registryId': selectedRegistry.value,
1010 'bucketId': selectedBucket.value,
1011 'flowId': selectedFlow.value,
1012 'version': selectedVersion.version
1019 data: JSON.stringify(processGroupEntity),
1020 url: '../nifi-api/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/process-groups',
1022 contentType: 'application/json'
1023 }).done(function (response) {
1024 // add the process group to the graph
1026 'processGroups': [response]
1031 // update component visibility
1032 nfGraph.updateVisibility();
1034 // update the birdseye
1035 nfBirdseye.refresh();
1036 }).fail(nfErrorHandler.handleAjaxError);
1040 * Determines whether the import/change button is disabled.
1042 * @returns {boolean}
1044 var disableImportOrChangeButton = function () {
1045 var importFlowVersionGrid = $('#import-flow-version-table').data('gridInstance');
1046 if (nfCommon.isDefinedAndNotNull(importFlowVersionGrid)) {
1047 var selected = importFlowVersionGrid.getSelectedRows();
1049 // if the version label is visible, this is a change version request so disable when
1050 // the version that represents the current version is selected
1051 if ($('#import-flow-version-label').is(':visible')) {
1052 if (selected.length === 1) {
1053 var selectedFlow = importFlowVersionGrid.getDataItem(selected[0]);
1055 var currentVersion = parseInt($('#import-flow-version-label').text(), 10);
1056 return currentVersion === selectedFlow.version;
1061 // if importing, enable when a single row is selecting
1062 return selected.length !== 1;
1070 * Changes the flow version for the currently selected Process Group.
1072 * @returns {deferred}
1074 var changeFlowVersion = function () {
1075 var changeTimer = null;
1076 var changeRequest = null;
1077 var cancelled = false;
1079 var processGroupId = $('#import-flow-version-process-group-id').text();
1080 var processGroupRevision = $('#import-flow-version-process-group-id').data('revision');
1081 var versionControlInformation = $('#import-flow-version-process-group-id').data('versionControlInformation');
1083 var importFlowVersionGrid = $('#import-flow-version-table').data('gridInstance');
1084 var selectedVersionIndex = importFlowVersionGrid.getSelectedRows();
1085 var selectedVersion = importFlowVersionGrid.getDataItem(selectedVersionIndex[0]);
1087 // update the button model of the change version status dialog
1088 $('#change-version-status-dialog').modal('setButtonModel', [{
1096 click: function () {
1099 $('#change-version-status-dialog').modal('setButtonModel', []);
1101 // we are waiting for the next poll attempt
1102 if (changeTimer !== null) {
1104 clearTimeout(changeTimer);
1106 // cancel the change request
1107 completeChangeRequest();
1113 // hide the import dialog immediately
1114 $('#import-flow-version-dialog').modal('hide');
1116 var submitChangeRequest = function () {
1117 var changeVersionRequest = {
1118 'processGroupRevision': nfClient.getRevision({
1120 'version': processGroupRevision.version
1123 'disconnectedNodeAcknowledged': nfStorage.isDisconnectionAcknowledged(),
1124 'versionControlInformation': {
1125 'groupId': processGroupId,
1126 'registryId': versionControlInformation.registryId,
1127 'bucketId': versionControlInformation.bucketId,
1128 'flowId': versionControlInformation.flowId,
1129 'version': selectedVersion.version
1135 data: JSON.stringify(changeVersionRequest),
1136 url: '../nifi-api/versions/update-requests/process-groups/' + encodeURIComponent(processGroupId),
1138 contentType: 'application/json'
1139 }).done(function () {
1140 // initialize the progress bar value
1143 // show the progress dialog
1144 $('#change-version-status-dialog').modal('show');
1145 }).fail(nfErrorHandler.handleAjaxError);
1148 var pollChangeRequest = function () {
1149 getChangeRequest().done(processChangeResponse);
1152 var getChangeRequest = function () {
1155 url: changeRequest.uri,
1157 }).fail(completeChangeRequest).fail(nfErrorHandler.handleAjaxError);
1160 var completeChangeRequest = function () {
1161 if (cancelled === true) {
1162 // update the message to indicate successful completion
1163 $('#change-version-status-message').text('The change version request has been cancelled.');
1165 // update the button model
1166 $('#change-version-status-dialog').modal('setButtonModel', [{
1167 buttonText: 'Close',
1174 click: function () {
1175 $(this).modal('hide');
1181 if (nfCommon.isDefinedAndNotNull(changeRequest)) {
1184 url: changeRequest.uri + '?' + $.param({
1185 'disconnectedNodeAcknowledged': nfStorage.isDisconnectionAcknowledged()
1188 }).done(function (response) {
1189 changeRequest = response.request;
1191 // update the component that was changing
1192 updateProcessGroup(processGroupId);
1194 if (nfCommon.isDefinedAndNotNull(changeRequest.failureReason)) {
1195 // hide the progress dialog
1196 $('#change-version-status-dialog').modal('hide');
1198 nfDialog.showOkDialog({
1199 headerText: 'Change Version',
1200 dialogContent: nfCommon.escapeHtml(changeRequest.failureReason)
1203 // update the percent complete
1204 updateProgress(changeRequest.percentCompleted);
1206 // update the message to indicate successful completion
1207 $('#change-version-status-message').text('This Process Group version has changed.');
1209 // update the button model
1210 $('#change-version-status-dialog').modal('setButtonModel', [{
1211 buttonText: 'Close',
1218 click: function () {
1219 $(this).modal('hide');
1228 var processChangeResponse = function (response) {
1229 changeRequest = response.request;
1231 if (changeRequest.complete === true || cancelled === true) {
1232 completeChangeRequest();
1234 // update the percent complete
1235 updateProgress(changeRequest.percentCompleted);
1237 // update the status of the listing request
1238 $('#change-version-status-message').text(changeRequest.state);
1240 changeTimer = setTimeout(function () {
1241 // clear the timer since we've been invoked
1244 // poll revert request
1245 pollChangeRequest();
1250 submitChangeRequest().done(processChangeResponse);
1254 * Gets the version control information for the specified process group id.
1256 * @param processGroupId
1257 * @return {deferred}
1259 var getVersionControlInformation = function (processGroupId) {
1260 return $.Deferred(function (deferred) {
1261 if (processGroupId === nfCanvasUtils.getGroupId()) {
1264 url: '../nifi-api/versions/process-groups/' + encodeURIComponent(processGroupId),
1266 }).done(function (response) {
1267 deferred.resolve(response);
1268 }).fail(function () {
1272 var processGroup = nfProcessGroup.get(processGroupId);
1273 if (processGroup.permissions.canRead === true && processGroup.permissions.canWrite === true) {
1275 'processGroupRevision': processGroup.revision,
1276 'versionControlInformation': processGroup.component.versionControlInformation
1286 * Updates the specified process group with the specified version control information.
1288 * @param processGroupId
1289 * @param versionControlInformation
1291 var updateVersionControlInformation = function (processGroupId, versionControlInformation) {
1292 // refresh either selected PG or bread crumb to reflect connected/tracking status
1293 if (nfCanvasUtils.getGroupId() === processGroupId) {
1294 nfNgBridge.injector.get('breadcrumbsCtrl').updateVersionControlInformation(processGroupId, versionControlInformation);
1295 nfNgBridge.digest();
1297 nfProcessGroup.reload(processGroupId);
1302 * Updates the specified process group following an operation that may change it's contents.
1304 * @param processGroupId
1306 var updateProcessGroup = function (processGroupId) {
1307 if (nfCanvasUtils.getGroupId() === processGroupId) {
1308 // if reverting/changing current PG... reload/refresh this group/canvas
1312 url: '../nifi-api/flow/process-groups/' + encodeURIComponent(processGroupId),
1314 }).done(function (response) {
1315 // update the graph components
1316 nfGraph.set(response.processGroupFlow.flow);
1318 // update the component visibility
1319 nfGraph.updateVisibility();
1321 // update the breadcrumbs
1322 var breadcrumbsCtrl = nfNgBridge.injector.get('breadcrumbsCtrl');
1323 breadcrumbsCtrl.resetBreadcrumbs();
1324 breadcrumbsCtrl.generateBreadcrumbs(response.processGroupFlow.breadcrumb);
1326 // inform Angular app values have changed
1327 nfNgBridge.digest();
1328 }).fail(nfErrorHandler.handleAjaxError);
1330 // if reverting selected PG... reload selected PG to update counts, etc
1331 nfProcessGroup.reload(processGroupId);
1336 * Updates the progress bar to the specified percent complete.
1338 * @param percentComplete
1340 var updateProgress = function (percentComplete) {
1341 // remove existing labels
1342 var progressBar = $('#change-version-percent-complete');
1343 progressBar.find('div.progress-label').remove();
1344 progressBar.find('md-progress-linear').remove();
1346 // update the progress
1347 var label = $('<div class="progress-label"></div>').text(percentComplete + '%');
1348 (nfNgBridge.injector.get('$compile')($('<md-progress-linear ng-cloak ng-value="' + percentComplete + '" class="md-hue-2" md-mode="determinate" aria-label="Searching Queue"></md-progress-linear>'))(nfNgBridge.rootScope)).appendTo(progressBar);
1349 progressBar.append(label);
1353 * Shows local changes for the specified process group.
1355 * @param processGroupId
1356 * @param localChangesMessage
1357 * @param localChangesTable
1360 var loadLocalChanges = function (processGroupId, localChangesMessage, localChangesTable, totalLabel) {
1361 var localChangesGrid = localChangesTable.data('gridInstance');
1362 var localChangesData = localChangesGrid.getData();
1365 localChangesData.beginUpdate();
1367 // remove the current versions
1368 localChangesGrid.setSelectedRows([]);
1369 localChangesGrid.resetActiveCell();
1370 localChangesData.setItems([]);
1372 // load the necessary details
1373 var loadMessage = getVersionControlInformation(processGroupId).done(function (response) {
1374 if (nfCommon.isDefinedAndNotNull(response.versionControlInformation)) {
1375 var vci = response.versionControlInformation;
1376 localChangesMessage.text('The following changes have been made to ' + vci.flowName + ' (Version ' + vci.version + ').');
1378 nfDialog.showOkDialog({
1379 headerText: 'Change Version',
1380 dialogContent: 'This Process Group is not currently under version control.'
1384 var loadChanges = $.ajax({
1386 url: '../nifi-api/process-groups/' + encodeURIComponent(processGroupId) + '/local-modifications',
1388 }).done(function (response) {
1389 if (nfCommon.isDefinedAndNotNull(response.componentDifferences) && response.componentDifferences.length > 0) {
1390 var totalDifferences = 0;
1391 $.each(response.componentDifferences, function (_, componentDifference) {
1392 $.each(componentDifference.differences, function (_, difference) {
1393 localChangesData.addItem({
1394 id: totalDifferences++,
1395 componentId: componentDifference.componentId,
1396 componentName: componentDifference.componentName,
1397 componentType: componentDifference.componentType,
1398 processGroupId: componentDifference.processGroupId,
1399 differenceType: difference.differenceType,
1400 difference: difference.difference
1406 localChangesData.endUpdate();
1409 localChangesData.reSort();
1410 localChangesGrid.invalidate();
1412 // update the total displayed
1413 totalLabel.text(nfCommon.formatInteger(totalDifferences));
1415 nfDialog.showOkDialog({
1416 headerText: 'Local Changes',
1417 dialogContent: 'This Process Group does not have any local changes.'
1420 }).fail(nfErrorHandler.handleAjaxError);
1422 return $.when(loadMessage, loadChanges);
1426 * Revert local changes for the specified process group.
1428 * @param processGroupId
1430 var revertLocalChanges = function (processGroupId) {
1431 getVersionControlInformation(processGroupId).done(function (response) {
1432 if (nfCommon.isDefinedAndNotNull(response.versionControlInformation)) {
1433 var revertTimer = null;
1434 var revertRequest = null;
1435 var cancelled = false;
1437 // update the button model of the revert status dialog
1438 $('#change-version-status-dialog').modal('setButtonModel', [{
1446 click: function () {
1449 $('#change-version-status-dialog').modal('setButtonModel', []);
1451 // we are waiting for the next poll attempt
1452 if (revertTimer !== null) {
1454 clearTimeout(revertTimer);
1456 // cancel the revert request
1457 completeRevertRequest();
1463 // hide the import dialog immediately
1464 $('#import-flow-version-dialog').modal('hide');
1466 var submitRevertRequest = function () {
1467 var revertFlowVersionRequest = {
1468 'processGroupRevision': nfClient.getRevision({
1470 'version': response.processGroupRevision.version
1473 'disconnectedNodeAcknowledged': nfStorage.isDisconnectionAcknowledged(),
1474 'versionControlInformation': response.versionControlInformation
1479 data: JSON.stringify(revertFlowVersionRequest),
1480 url: '../nifi-api/versions/revert-requests/process-groups/' + encodeURIComponent(processGroupId),
1482 contentType: 'application/json'
1483 }).done(function () {
1484 // initialize the progress bar value
1487 // show the progress dialog
1488 $('#change-version-status-dialog').modal('show');
1489 }).fail(nfErrorHandler.handleAjaxError);
1492 var pollRevertRequest = function () {
1493 getRevertRequest().done(processRevertResponse);
1496 var getRevertRequest = function () {
1499 url: revertRequest.uri,
1501 }).fail(completeRevertRequest).fail(nfErrorHandler.handleAjaxError);
1504 var completeRevertRequest = function () {
1505 if (cancelled === true) {
1506 // update the message to indicate successful completion
1507 $('#change-version-status-message').text('The revert request has been cancelled.');
1509 // update the button model
1510 $('#change-version-status-dialog').modal('setButtonModel', [{
1511 buttonText: 'Close',
1518 click: function () {
1519 $(this).modal('hide');
1525 if (nfCommon.isDefinedAndNotNull(revertRequest)) {
1528 url: revertRequest.uri + '?' + $.param({
1529 'disconnectedNodeAcknowledged': nfStorage.isDisconnectionAcknowledged()
1532 }).done(function (response) {
1533 revertRequest = response.request;
1535 // update the component that was changing
1536 updateProcessGroup(processGroupId);
1538 if (nfCommon.isDefinedAndNotNull(revertRequest.failureReason)) {
1539 // hide the progress dialog
1540 $('#change-version-status-dialog').modal('hide');
1542 nfDialog.showOkDialog({
1543 headerText: 'Revert Local Changes',
1544 dialogContent: nfCommon.escapeHtml(revertRequest.failureReason)
1547 // update the percent complete
1548 updateProgress(revertRequest.percentCompleted);
1550 // update the message to indicate successful completion
1551 $('#change-version-status-message').text('This Process Group version has changed.');
1553 // update the button model
1554 $('#change-version-status-dialog').modal('setButtonModel', [{
1555 buttonText: 'Close',
1562 click: function () {
1563 $(this).modal('hide');
1572 var processRevertResponse = function (response) {
1573 revertRequest = response.request;
1575 if (revertRequest.complete === true || cancelled === true) {
1576 completeRevertRequest();
1578 // update the percent complete
1579 updateProgress(revertRequest.percentCompleted);
1581 // update the status of the revert request
1582 $('#change-version-status-message').text(revertRequest.state);
1584 revertTimer = setTimeout(function () {
1585 // clear the timer since we've been invoked
1588 // poll revert request
1589 pollRevertRequest();
1594 submitRevertRequest().done(processRevertResponse);
1596 nfDialog.showOkDialog({
1597 headerText: 'Revert Changes',
1598 dialogContent: 'This Process Group is not currently under version control.'
1601 }).fail(nfErrorHandler.handleAjaxError);
1605 init: function (timeOffset) {
1606 serverTimeOffset = timeOffset;
1608 // initialize the flow version dialog
1609 $('#save-flow-version-dialog').modal({
1610 scrollableContentStyle: 'scrollable',
1611 headerText: 'Save Flow Version',
1619 disabled: function () {
1620 if ($('#save-flow-version-registry-combo').is(':visible')) {
1621 var selectedRegistry = $('#save-flow-version-registry-combo').combo('getSelectedOption');
1622 var selectedBucket = $('#save-flow-version-bucket-combo').combo('getSelectedOption');
1624 if (nfCommon.isDefinedAndNotNull(selectedRegistry) && nfCommon.isDefinedAndNotNull(selectedBucket)) {
1625 return selectedRegistry.disabled === true || selectedBucket.disabled === true;
1634 click: function () {
1635 var processGroupId = $('#save-flow-version-process-group-id').text();
1636 saveFlowVersion().done(function (response) {
1637 updateVersionControlInformation(processGroupId, response.versionControlInformation);
1640 $(this).modal('hide');
1644 buttonText: 'Cancel',
1651 click: function () {
1652 $(this).modal('hide');
1657 close: function () {
1658 resetSaveFlowVersionDialog();
1663 // initialize the import flow version dialog
1664 $('#import-flow-version-dialog').modal({
1665 scrollableContentStyle: 'scrollable',
1667 close: function () {
1668 resetImportFlowVersionDialog();
1673 // configure the drop request status dialog
1674 $('#change-version-status-dialog').modal({
1675 scrollableContentStyle: 'scrollable',
1676 headerText: 'Change Flow Version',
1678 close: function () {
1679 // clear the current button model
1680 $('#change-version-status-dialog').modal('setButtonModel', []);
1685 // init the revert local changes dialog
1686 $('#revert-local-changes-dialog').modal({
1687 scrollableContentStyle: 'scrollable',
1688 headerText: 'Revert Local Changes',
1690 buttonText: 'Revert',
1697 click: function () {
1698 var processGroupId = $('#revert-local-changes-process-group-id').text();
1699 revertLocalChanges(processGroupId);
1701 $(this).modal('hide');
1705 buttonText: 'Cancel',
1712 click: function () {
1713 $(this).modal('hide');
1718 close: function () {
1719 resetRevertLocalChangesDialog();
1724 // init the show local changes dialog
1725 $('#show-local-changes-dialog').modal({
1726 scrollableContentStyle: 'scrollable',
1727 headerText: 'Show Local Changes',
1729 buttonText: 'Close',
1736 click: function () {
1737 $(this).modal('hide');
1742 close: function () {
1743 resetShowLocalChangesDialog();
1748 // handle the click for the process group import
1749 $('#import-process-group-link').on('click', function() {
1750 showImportFlowVersionDialog();
1753 // initialize the import flow version table
1754 initImportFlowVersionTable();
1755 initLocalChangesTable($('#revert-local-changes-table'), $('#revert-local-changes-filter'), $('#displayed-revert-local-changes-entries'), $('#total-revert-local-changes-entries'));
1756 initLocalChangesTable($('#show-local-changes-table'), $('#show-local-changes-filter'), $('#displayed-show-local-changes-entries'), $('#total-show-local-changes-entries'));
1760 * Shows the flow version dialog.
1762 * @param processGroupId
1764 showFlowVersionDialog: function (processGroupId) {
1765 var focusName = true;
1767 return $.Deferred(function (deferred) {
1768 getVersionControlInformation(processGroupId).done(function (groupVersionControlInformation) {
1769 if (nfCommon.isDefinedAndNotNull(groupVersionControlInformation.versionControlInformation)) {
1770 var versionControlInformation = groupVersionControlInformation.versionControlInformation;
1772 // update the registry and bucket visibility
1773 $('#save-flow-version-registry').text(versionControlInformation.registryName).show();
1774 $('#save-flow-version-bucket').text(versionControlInformation.bucketName).show();
1775 $('#save-flow-version-label').text(versionControlInformation.version + 1);
1777 $('#save-flow-version-name').text(versionControlInformation.flowName).show();
1778 nfCommon.populateField('save-flow-version-description', versionControlInformation.flowDescription);
1779 $('#save-flow-version-description').show();
1781 // record the versionControlInformation
1782 $('#save-flow-version-process-group-id').data('versionControlInformation', versionControlInformation);
1784 // reposition the version label
1785 $('#save-flow-version-label').css('margin-top', '-15px');
1790 // update the registry and bucket visibility
1791 var registryCombo = $('#save-flow-version-registry-combo').combo('destroy').combo({
1793 text: 'Loading registries...',
1795 optionClass: 'unset',
1799 var bucketCombo = $('#save-flow-version-bucket-combo').combo('destroy').combo({
1801 text: 'Loading buckets...',
1803 optionClass: 'unset',
1808 // set the initial version
1809 $('#save-flow-version-label').text(1);
1811 $('#save-flow-version-name-field').show();
1812 $('#save-flow-version-description-field').show();
1814 // reposition the version label
1815 $('#save-flow-version-label').css('margin-top', '0');
1817 loadRegistries($('#save-flow-version-dialog'), registryCombo, bucketCombo, null, selectBucketSaveFlowVersion, function (bucketEntity) {
1818 return bucketEntity.permissions.canWrite === true;
1819 }).done(function () {
1821 }).fail(function () {
1826 // record the revision
1827 $('#save-flow-version-process-group-id').data('revision', groupVersionControlInformation.processGroupRevision).text(processGroupId);
1828 }).fail(nfErrorHandler.handleAjaxError);
1829 }).done(function () {
1830 $('#save-flow-version-dialog').modal('show');
1833 $('#save-flow-version-name-field').focus();
1835 $('#save-flow-version-change-comments').focus();
1837 }).fail(function () {
1838 $('#save-flow-version-dialog').modal('refreshButtons');
1843 * Reverts local changes for the specified Process Group.
1845 * @param processGroupId
1847 revertLocalChanges: function (processGroupId) {
1848 loadLocalChanges(processGroupId, $('#revert-local-changes-message'), $('#revert-local-changes-table'), $('#total-revert-local-changes-entries')).done(function () {
1849 $('#revert-local-changes-process-group-id').text(processGroupId);
1850 $('#revert-local-changes-dialog').modal('show');
1855 * Shows local changes for the specified process group.
1857 * @param processGroupId
1859 showLocalChanges: function (processGroupId) {
1860 loadLocalChanges(processGroupId, $('#show-local-changes-message'), $('#show-local-changes-table'), $('#total-show-local-changes-entries')).done(function () {
1861 $('#show-local-changes-dialog').modal('show');
1866 * Shows the change flow version dialog.
1868 * @param processGroupId
1870 showChangeFlowVersionDialog: function (processGroupId) {
1871 return $.Deferred(function (deferred) {
1872 getVersionControlInformation(processGroupId).done(function (groupVersionControlInformation) {
1873 if (nfCommon.isDefinedAndNotNull(groupVersionControlInformation.versionControlInformation)) {
1874 var versionControlInformation = groupVersionControlInformation.versionControlInformation;
1876 // update the registry and bucket visibility
1877 $('#import-flow-version-registry').text(versionControlInformation.registryName).show();
1878 $('#import-flow-version-bucket').text(versionControlInformation.bucketName).show();
1879 $('#import-flow-version-name').text(versionControlInformation.flowName).show();
1881 // show the current version information
1882 $('#import-flow-version-container').show();
1883 $('#import-flow-version-label').text(versionControlInformation.version);
1885 // record the versionControlInformation
1886 $('#import-flow-version-process-group-id').data('versionControlInformation', versionControlInformation).data('revision', groupVersionControlInformation.processGroupRevision).text(processGroupId);
1888 // load the flow versions
1889 loadFlowVersions(versionControlInformation.registryId, versionControlInformation.bucketId, versionControlInformation.flowId).done(function () {
1891 }).fail(function () {
1892 nfDialog.showOkDialog({
1893 headerText: 'Change Version',
1894 dialogContent: 'Unable to load available versions for this Process Group.'
1900 nfDialog.showOkDialog({
1901 headerText: 'Change Version',
1902 dialogContent: 'This Process Group is not currently under version control.'
1907 }).fail(nfErrorHandler.handleAjaxError);
1908 }).done(function () {
1910 $('#import-flow-version-dialog').modal('setHeaderText', 'Change Version').modal('setButtonModel', [{
1911 buttonText: 'Change',
1917 disabled: disableImportOrChangeButton,
1919 click: function () {
1920 changeFlowVersion();
1924 buttonText: 'Cancel',
1931 click: function () {
1932 $(this).modal('hide');
1940 * Stops version control for the specified Process Group.
1942 * @param processGroupId
1944 stopVersionControl: function (processGroupId) {
1945 // prompt the user before disconnecting
1946 nfDialog.showYesNoDialog({
1947 headerText: 'Stop Version Control',
1948 dialogContent: 'Are you sure you want to stop version control?',
1950 yesText: 'Disconnect',
1951 yesHandler: function () {
1954 url: '../nifi-api/versions/process-groups/' + encodeURIComponent(processGroupId),
1956 }).done(function (response) {
1957 if (nfCommon.isDefinedAndNotNull(response.versionControlInformation)) {
1958 var revision = nfClient.getRevision({
1960 version: response.processGroupRevision.version
1966 url: '../nifi-api/versions/process-groups/' + encodeURIComponent(processGroupId) + '?' + $.param($.extend({
1967 'disconnectedNodeAcknowledged': nfStorage.isDisconnectionAcknowledged()
1970 contentType: 'application/json'
1971 }).done(function (response) {
1972 updateVersionControlInformation(processGroupId, undefined);
1974 nfDialog.showOkDialog({
1975 headerText: 'Disconnect',
1976 dialogContent: 'This Process Group is no longer under version control.'
1978 }).fail(nfErrorHandler.handleAjaxError);
1980 nfDialog.showOkDialog({
1981 headerText: 'Disconnect',
1982 dialogContent: 'This Process Group is not currently under version control.'
1985 }).fail(nfErrorHandler.handleAjaxError);