Repository: nifi Updated Branches: refs/heads/master b59d3ece7 -> 7db78e87a
http://git-wip-us.apache.org/repos/asf/nifi/blob/7db78e87/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-breadcrumbs-controller.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-breadcrumbs-controller.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-breadcrumbs-controller.js new file mode 100644 index 0000000..6f27e41 --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-breadcrumbs-controller.js @@ -0,0 +1,171 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* global nf, d3 */ + +nf.ng.BreadcrumbsCtrl = (function () { + + function BreadcrumbsCtrl(ServiceProvider, $sanitize) { + function BreadcrumbsCtrl() { + this.breadcrumbs = []; + }; + BreadcrumbsCtrl.prototype = { + constructor: BreadcrumbsCtrl, + + /** + * Initialize the Breadcrumbs controller. + */ + init: function () { + if (ServiceProvider.BreadcrumbsCtrl === undefined) { + ServiceProvider.register('BreadcrumbsCtrl', breadcrumbsCtrl); + } + }, + + /** + * Generate the breadcrumbs. + * + * @param {object} processGroup The process group used to generate breadcrumbs + */ + generateBreadcrumbs: function (processGroup) { + //explicitly sanitize processGroup.name + processGroup.name = $sanitize(processGroup.name); + this.breadcrumbs.unshift(processGroup); + + if (nf.Common.isDefinedAndNotNull(processGroup.parent)) { + this.generateBreadcrumbs(processGroup.parent); + } + }, + + /** + * Reset the breadcrumbs. + */ + resetBreadcrumbs: function () { + this.breadcrumbs = []; + }, + + /** + * Get the breadcrumbs. + */ + getBreadcrumbs: function () { + return this.breadcrumbs; + }, + + /** + * Update the breadcrumbs css. + * + * @param {object} style The style to be applied. + */ + updateBreadcrumbsCss: function(style){ + $('#breadcrumbs').css(style); + }, + + /** + * Reset initial scroll position. + */ + resetScrollPosition: function(){ + var title = $('#data-flow-title-container'); + var titlePosition = title.position(); + var titleWidth = title.outerWidth(); + var titleRight = titlePosition.left + titleWidth; + + var padding = $('#breadcrumbs-right-border').width(); + var viewport = $('#data-flow-title-viewport'); + var viewportWidth = viewport.width(); + var viewportRight = viewportWidth - padding; + + // if the title's right is past the viewport's right, shift accordingly + if (titleRight > viewportRight) { + // adjust the position + title.css('left', (titlePosition.left - (titleRight - viewportRight)) + 'px'); + } else { + title.css('left', '10px'); + } + }, + + /** + * Registers a scroll event on the `element` + * + * @param {object} element The element event listener will be registered upon. + */ + registerMouseWheelEvent: function(element){ + // mousewheel -> IE, Chrome + // DOMMouseScroll -> FF + // wheel -> FF, IE + + // still having issues with this in IE :/ + element.on('DOMMouseScroll mousewheel', function (evt, d) { + if (nf.Common.isUndefinedOrNull(evt.originalEvent)) { + return; + } + + var title = $('#data-flow-title-container'); + var titlePosition = title.position(); + var titleWidth = title.outerWidth(); + var titleRight = titlePosition.left + titleWidth; + + var padding = $('#breadcrumbs-right-border').width(); + var viewport = $('#data-flow-title-viewport'); + var viewportWidth = viewport.width(); + var viewportRight = viewportWidth - padding; + + // if the width of the title is larger than the viewport + if (titleWidth > viewportWidth) { + var adjust = false; + + var delta = 0; + + //Chrome and Safari both have evt.originalEvent.detail defined but + //evt.originalEvent.wheelDelta holds the correct value so we must + //check for evt.originalEvent.wheelDelta first! + if (nf.Common.isDefinedAndNotNull(evt.originalEvent.wheelDelta)) { + delta = evt.originalEvent.wheelDelta; + } else if (nf.Common.isDefinedAndNotNull(evt.originalEvent.detail)) { + delta = -evt.originalEvent.detail; + } + + // determine the increment + if (delta > 0 && titleRight > viewportRight) { + var increment = -25; + adjust = true; + } else if (delta < 0 && (titlePosition.left - padding) < 0) { + increment = 25; + + // don't shift too far + if (titlePosition.left + increment > padding) { + increment = padding - titlePosition.left; + } + + adjust = true; + } + + if (adjust) { + // adjust the position + title.css('left', (titlePosition.left + increment) + 'px'); + } + } + }); + } + }; + var breadcrumbsCtrl = new BreadcrumbsCtrl(); + breadcrumbsCtrl.init(); + return breadcrumbsCtrl; + } + + BreadcrumbsCtrl.$inject = ['ServiceProvider', '$sanitize']; + + return BreadcrumbsCtrl; +}()); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/7db78e87/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-app-controller.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-app-controller.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-app-controller.js new file mode 100644 index 0000000..596852b --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-app-controller.js @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* global nf, d3 */ + +nf.ng.Canvas.AppCtrl = (function () { + + function AppCtrl($scope, ServiceProvider) { + function AppCtrl(ServiceProvider) { + //global nf namespace for reference throughout angular app + this.nf = nf; + //any registered angular service is available through the ServiceProvider + this.ServiceProvider = ServiceProvider; + }; + AppCtrl.prototype = { + constructor: AppCtrl + }; + var appCtrl = new AppCtrl(ServiceProvider); + $scope.AppCtrl = appCtrl; + + //For production angular applications .scope() is unavailable so we set + //the root scope of the bootstrapped app on the bridge + nf.ng.Bridge.setRootScope($scope); + } + + AppCtrl.$inject=['$scope', 'ServiceProvider']; + + return AppCtrl; +}()); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/7db78e87/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/directives/nf-ng-breadcrumbs-directive.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/directives/nf-ng-breadcrumbs-directive.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/directives/nf-ng-breadcrumbs-directive.js new file mode 100644 index 0000000..33c0d8e --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/directives/nf-ng-breadcrumbs-directive.js @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* global nf, d3 */ + +nf.ng.BreadcrumbsDirective = (function () { + + function BreadcrumbsDirective(BreadcrumbsCtrl) { + return { + restrict: 'E', + templateUrl: 'views/nf-ng-breadcrumbs-directive-view.html', + scope: { + 'breadcrumbs': '=', + 'clickFunc': '=', + 'highlightCrumbId': '=', + 'separatorFunc': '=' + }, + link: function (scope, element, attrs) { + BreadcrumbsCtrl.registerMouseWheelEvent(element); + scope.BreadcrumbsCtrl = BreadcrumbsCtrl; + } + }; + } + + BreadcrumbsDirective.$inject = ['BreadcrumbsCtrl']; + + return BreadcrumbsDirective; +}()); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/7db78e87/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-header.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-header.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-header.js index 09cf3c5..80cabe4 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-header.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-header.js @@ -281,59 +281,6 @@ nf.CanvasHeader = (function () { } }); - // mousewheel -> IE, Chrome - // DOMMouseScroll -> FF - // wheel -> FF, IE - - // still having issues with this in IE :/ - $('#data-flow-title-viewport').on('DOMMouseScroll mousewheel', function (evt, d) { - if (nf.Common.isUndefinedOrNull(evt.originalEvent)) { - return; - } - - var title = $('#data-flow-title-container'); - var titlePosition = title.position(); - var titleWidth = title.outerWidth(); - var titleRight = titlePosition.left + titleWidth; - - var padding = $('#breadcrumbs-right-border').width(); - var viewport = $('#data-flow-title-viewport'); - var viewportWidth = viewport.width(); - var viewportRight = viewportWidth - padding; - - // if the width of the title is larger than the viewport - if (titleWidth > viewportWidth) { - var adjust = false; - - var delta = 0; - if (nf.Common.isDefinedAndNotNull(evt.originalEvent.detail)) { - delta = -evt.originalEvent.detail; - } else if (nf.Common.isDefinedAndNotNull(evt.originalEvent.wheelDelta)) { - delta = evt.originalEvent.wheelDelta; - } - - // determine the increment - if (delta > 0 && titleRight > viewportRight) { - var increment = -25; - adjust = true; - } else if (delta < 0 && (titlePosition.left - padding) < 0) { - increment = 25; - - // don't shift too far - if (titlePosition.left + increment > padding) { - increment = padding - titlePosition.left; - } - - adjust = true; - } - - if (adjust) { - // adjust the position - title.css('left', (titlePosition.left + increment) + 'px'); - } - } - }); - var toolbar = $('#toolbar'); var groupButton = $('#action-group'); $(window).on('resize', function () { http://git-wip-us.apache.org/repos/asf/nifi/blob/7db78e87/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js index abe9f97..ae3323b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js @@ -19,6 +19,25 @@ $(document).ready(function () { if (nf.Canvas.SUPPORTS_SVG) { + //Create App + var app = angular.module('ngCanvasApp', ['ngResource', 'ngRoute', 'ngMaterial', 'ngSanitize', 'ngMessages']); + + //Configure App + app.config(nf.ng.Canvas.AppConfig); + + //App Controllers + app.controller('ngCanvasAppCtrl', nf.ng.Canvas.AppCtrl); + + //App Services + app.factory('ServiceProvider', nf.ng.ServiceProvider); + app.factory('BreadcrumbsCtrl', nf.ng.BreadcrumbsCtrl); + + //App Directives + app.directive('breadcrumbsDirective', nf.ng.BreadcrumbsDirective); + + //Manually Boostrap App + angular.bootstrap($('body'), ['ngCanvasApp'], { strictDi: true }); + // initialize the NiFi nf.Canvas.init(); } else { @@ -71,37 +90,7 @@ nf.Canvas = (function () { d3Script: 'js/d3/d3.min.js' } }; - - /** - * Generates the breadcrumbs. - * - * @argument {object} processGroup The process group - */ - var generateBreadcrumbs = function (processGroup) { - // create the link for loading the correct group - var groupLink = $('<span class="link"></span>').text(processGroup.name).click(function () { - nf.CanvasUtils.enterGroup(processGroup.id); - }); - - // make the current group bold - if (nf.Canvas.getGroupId() === processGroup.id) { - groupLink.css('font-weight', 'bold'); - } - - // if there is a parent, create the appropriate mark up - if (nf.Common.isDefinedAndNotNull(processGroup.parent)) { - var separator = $('<span>»</span>').css({ - 'color': '#598599', - 'margin': '0 10px' - }); - $('#data-flow-title-container').append(generateBreadcrumbs(processGroup.parent)).append(separator); - } - - // append this link - $('#data-flow-title-container').append(groupLink); - return groupLink; - }; - + /** * Loads D3. */ @@ -524,6 +513,11 @@ nf.Canvas = (function () { 'width': canvasContainer.width() }); + //breadcrumbs + nf.ng.Bridge.call('AppCtrl.ServiceProvider.BreadcrumbsCtrl', + 'AppCtrl.ServiceProvider.BreadcrumbsCtrl.updateBreadcrumbsCss', + {'bottom': bottom + 'px'}); + // body $('#canvas-body').css({ 'height': windowHeight + 'px', @@ -805,8 +799,11 @@ nf.Canvas = (function () { nf.Canvas.setGroupName(processGroup.name); // update the breadcrumbs - $('#data-flow-title-container').empty(); - generateBreadcrumbs(processGroup); + nf.ng.Bridge.call('AppCtrl.ServiceProvider.BreadcrumbsCtrl', + 'AppCtrl.ServiceProvider.BreadcrumbsCtrl.resetBreadcrumbs'); + nf.ng.Bridge.call('AppCtrl.ServiceProvider.BreadcrumbsCtrl', + 'AppCtrl.ServiceProvider.BreadcrumbsCtrl.generateBreadcrumbs', + processGroup); // set the parent id if applicable if (nf.Common.isDefinedAndNotNull(processGroup.parent)) { @@ -912,23 +909,8 @@ nf.Canvas = (function () { var settingsXhr = nf.Settings.loadSettings(false); // don't reload the status as we want to wait for deferreds to complete $.when(processGroupXhr, statusXhr, settingsXhr).done(function (processGroupResult) { // adjust breadcrumbs if necessary - var title = $('#data-flow-title-container'); - var titlePosition = title.position(); - var titleWidth = title.outerWidth(); - var titleRight = titlePosition.left + titleWidth; - - var padding = $('#breadcrumbs-right-border').width(); - var viewport = $('#data-flow-title-viewport'); - var viewportWidth = viewport.width(); - var viewportRight = viewportWidth - padding; - - // if the title's right is past the viewport's right, shift accordingly - if (titleRight > viewportRight) { - // adjust the position - title.css('left', (titlePosition.left - (titleRight - viewportRight)) + 'px'); - } else { - title.css('left', '10px'); - } + nf.ng.Bridge.call('AppCtrl.ServiceProvider.BreadcrumbsCtrl', + 'AppCtrl.ServiceProvider.BreadcrumbsCtrl.resetScrollPosition'); // don't load the status until the graph is loaded reloadStatus(nf.Canvas.getGroupId()).done(function () { http://git-wip-us.apache.org/repos/asf/nifi/blob/7db78e87/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-ng-canvas-app-config.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-ng-canvas-app-config.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-ng-canvas-app-config.js new file mode 100644 index 0000000..314a06e --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-ng-canvas-app-config.js @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* global nf, d3 */ + +nf.ng.Canvas.AppConfig = (function () { + + function AppConfig($mdThemingProvider, $compileProvider) { + //Enable production mode, to re-enable debug mode open up a + //console and call 'angular.reloadWithDebugInfo();' + $compileProvider.debugInfoEnabled(false); + //Define app palettes + var basePaletteMap = $mdThemingProvider.extendPalette("grey", { + "contrastDefaultColor": "light", + "contrastDarkColors": ["100"], //hues which contrast should be "dark" by default + "contrastLightColors": ["600"], //hues which contrast should be "light" by default + "500": "728E9B" + }); + var accentPaletteMap = $mdThemingProvider.extendPalette("grey", { + "contrastDefaultColor": "dark", + "contrastDarkColors": ["100"], + "contrastLightColors": ["600"], + "500": "BA554A" + }); + $mdThemingProvider.definePalette("basePalette", basePaletteMap); + $mdThemingProvider.definePalette("accentPalette", accentPaletteMap); + $mdThemingProvider.theme("default").primaryPalette("basePalette", { + "default": "500", + "hue-1": "50", // use for the <code>md-hue-1</code> class + "hue-2": "300", // use for the <code>md-hue-2</code> class + "hue-3": "600" // use for the <code>md-hue-3</code> class + }).accentPalette("accentPalette", { + "default": "500", + "hue-1": "50", + "hue-2": "300", + "hue-3": "600" + }); + } + + AppConfig.$inject=['$mdThemingProvider', '$compileProvider']; + + return AppConfig; +}()); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/7db78e87/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-ng-canvas-namespace.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-ng-canvas-namespace.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-ng-canvas-namespace.js new file mode 100644 index 0000000..787e09e --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-ng-canvas-namespace.js @@ -0,0 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// register the nf.ng.Canvas namespace +if (!nf.ng.Canvas) + nf.ng.Canvas = {}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/7db78e87/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js index 64b1c50..92e830b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js @@ -101,7 +101,7 @@ nf.Settings = (function () { document.title = response.config.name; // set the data flow title and close the shell - $('#data-flow-title-container').children('span.link:first-child').text(response.config.name); + nf.Canvas.reload(); // close the settings dialog nf.Dialog.showOkDialog({ http://git-wip-us.apache.org/repos/asf/nifi/blob/7db78e87/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ng-bridge.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ng-bridge.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ng-bridge.js new file mode 100644 index 0000000..920b665 --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ng-bridge.js @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* global nf, d3 */ + +nf.ng.Bridge = (function () { + + function AngularBridge() { + this.rootScope; + }; + AngularBridge.prototype = { + constructor: AngularBridge, + /** + * Sets the root scope for the angular application being bridged. + * + * @param {object} scope An object that refers to the application model. + */ + setRootScope: function(scope){ + this.rootScope = scope; + }, + /** + * Inspects the root scope of the bridged angular application to look up + * objects (to be provided as the `this` context) and invoke methods. + * + * @param {string} thisArg The value of `this` provided for the call to `fun`. + * Note that this may not be the actual value seen + * by the method: if the method is a function in + * non-strict mode code, null and undefined will be + * replaced with the global object, and primitive + * values will be boxed. + * @param {string} fun The function to call. + * @param [, arg1[, arg2[, ...]]] Arguments for the `fun` + * @returns {*} The value of the `fun` if `fun` returns a value. + * + */ + call: function (thisArg, fun) { + var thisArgArray = thisArg.split("."); + thisArg = this.rootScope; + angular.forEach(thisArgArray, function (value) { + thisArg = thisArg[value]; + }); + var funArray = fun.split("."); + fun = this.rootScope; + angular.forEach(funArray, function (value) { + fun = fun[value]; + }); + var args = Array.prototype.slice.call(arguments, 2); + var result = fun.apply(thisArg, args); + this.rootScope.$apply(); + if(result){ + return result; + } + } + }; + var angularBridge = new AngularBridge(); + + return angularBridge; +}()); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/7db78e87/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ng-namespace.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ng-namespace.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ng-namespace.js new file mode 100644 index 0000000..87b790a --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ng-namespace.js @@ -0,0 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// register the nf.ng namespace +if (!nf.ng) + nf.ng = {}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/7db78e87/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ng-service-provider.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ng-service-provider.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ng-service-provider.js new file mode 100644 index 0000000..1ad6f0d --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ng-service-provider.js @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* global nf, d3 */ + +nf.ng.ServiceProvider = (function () { + + function ServiceProvider() { + function ServiceProvider() { + }; + ServiceProvider.prototype = { + constructor: ServiceProvider, + /** + * Registers the given `object` by `name`. + * + * @param {string} name The lookup name of the object being registered + * @param {object} object The object to register + */ + register: function(name, object) { + serviceProvider[name] = object; + }, + /** + * Removes the given object from the registry. + * + * @param {string objectName The lookup name of the object to remove from the registry + */ + remove: function(objectName) { + delete serviceProvider[objectName]; + } + }; + var serviceProvider = new ServiceProvider(); + return serviceProvider; + } + + ServiceProvider.$inject=[]; + + return ServiceProvider; +}()); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/7db78e87/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/views/nf-ng-breadcrumbs-directive-view.html ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/views/nf-ng-breadcrumbs-directive-view.html b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/views/nf-ng-breadcrumbs-directive-view.html new file mode 100644 index 0000000..5bfa3cb --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/views/nf-ng-breadcrumbs-directive-view.html @@ -0,0 +1,34 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<div id="breadcrumbs"> + <div id="data-flow-title-viewport"> + <div id="breadcrumbs-left-border"></div> + <div id="data-flow-title-container"> + <span ng-repeat="crumb in breadcrumbs"> + <span ng-if="separatorFunc(crumb.parent)" style="margin: 0 12px;"> + » + </span> + <span class="link" + ng-class="(highlightCrumbId === crumb.id) ? 'link-bold' : ''" + ng-click="clickFunc(crumb.id)"> + {{crumb.name}} + </span> + </span> + </div> + <div id="breadcrumbs-right-border"></div> + </div> +</div> \ No newline at end of file
