[ 
https://issues.apache.org/jira/browse/NIFI-3380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15922821#comment-15922821
 ] 

ASF GitHub Bot commented on NIFI-3380:
--------------------------------------

Github user scottyaslan commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1585#discussion_r105746988
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-version.js
 ---
    @@ -0,0 +1,340 @@
    +/*
    + * 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 */
    +
    +/**
    + * Views state for a given component.
    + */
    +(function (root, factory) {
    +    if (typeof define === 'function' && define.amd) {
    +        define(['jquery',
    +                'nf.ErrorHandler',
    +                'nf.Common',
    +                'nf.Client',
    +                'nf.CanvasUtils',
    +                'nf.ng.Bridge'],
    +            function ($, Slick, nfErrorHandler, nfCommon, nfClient, 
nfCanvasUtils, nfNgBridge) {
    +                return (nf.ComponentState = factory($, nfErrorHandler, 
nfCommon, nfClient, nfCanvasUtils, nfNgBridge));
    +            });
    +    } else if (typeof exports === 'object' && typeof module === 'object') {
    +        module.exports = (nf.ComponentState =
    +            factory(require('jquery'),
    +                require('nf.ErrorHandler'),
    +                require('nf.Common',
    +                require('nf.Client'),
    +                require('nf.CanvasUtils'),
    +                require('nf.ng.Bridge'))));
    +    } else {
    +        nf.ComponentVersion = factory(root.$,
    +            root.nf.ErrorHandler,
    +            root.nf.Common,
    +            root.nf.Client,
    +            root.nf.CanvasUtils,
    +            root.nf.ng.Bridge);
    +    }
    +}(this, function ($, nfErrorHandler, nfCommon, nfClient, nfCanvasUtils, 
nfNgBridge) {
    +    'use strict';
    +
    +    var versionMap;
    +    var nfSettings;
    +    var nfProcessGroupConfiguration;
    +
    +    /**
    +     * Gets the URI for retrieving available types/bundles
    +     *
    +     * @param {object} componentEntity
    +     * @returns {string} uri
    +     */
    +    var getTypeUri = function (componentEntity) {
    +        if (componentEntity.type === 'ReportingTask') {
    +            return '../nifi-api/flow/reporting-task-types';
    +        } else if (componentEntity.type === 'ControllerService') {
    +            return '../nifi-api/flow/controller-service-types';
    +        } else {
    +            return '../nifi-api/flow/processor-types';
    +        }
    +    };
    +
    +    /**
    +     * Gets the field to use to access the returned types/bundles.
    +     *
    +     * @param {object} componentEntity
    +     * @returns {string} field
    +     */
    +    var getTypeField = function (componentEntity) {
    +        if (componentEntity.type === 'ReportingTask') {
    +            return 'reportingTaskTypes';
    +        } else if (componentEntity.type === 'ControllerService') {
    +            return 'controllerServiceTypes';
    +        } else {
    +            return 'processorTypes';
    +        }
    +    };
    +
    +    /**
    +     * Reset the dialog.
    +     */
    +    var resetDialog = function () {
    +        // clear the versions
    +        var versions = versionMap.keys();
    +        $.each(versions, function (_, version) {
    +            versionMap.remove(version);
    +        });
    +
    +        // clear the service apis
    +        $('#component-version-controller-service-apis').empty();
    +        $('#component-version-controller-service-apis-container').hide();
    +
    +        // clear the fields
    +        $('#component-version-name').text('');
    +        $('#component-version-bundle').text('');
    +        $('#component-version-tags').text('');
    +        $('#component-version-restriction').removeClass('unset').text('');
    +        $('#component-version-description').text('');
    +
    +        // destroy the version combo
    +        $('#component-version-selector').combo('destroy');
    +
    +        // removed the stored data
    +        $('#component-version-dialog').removeData('component');
    +    };
    +
    +    /**
    +     * Sets the specified option.
    +     *
    +     * @param {object} selectedOption
    +     */
    +    var select = function (selectedOption) {
    +        var documentedType = versionMap.get(selectedOption.value);
    +
    +        // set any restriction
    +        if (nfCommon.isDefinedAndNotNull(documentedType.usageRestriction)) 
{
    +            
$('#component-version-restriction').text(documentedType.usageRestriction);
    +        } else {
    +            $('#component-version-restriction').addClass('unset').text('No 
restriction');
    +        }
    +
    +        // update the service apis if necessary
    +        if (!nfCommon.isEmpty(documentedType.controllerServiceApis)) {
    +            var formattedControllerServiceApis = 
nfCommon.getFormattedServiceApis(documentedType.controllerServiceApis);
    +            var serviceTips = 
nfCommon.formatUnorderedList(formattedControllerServiceApis);
    +            
$('#component-version-controller-service-apis').empty().append(serviceTips);
    +            
$('#component-version-controller-service-apis-container').show();
    +        }
    +
    +        // update the tags and description
    +        $('#component-version-tags').text(documentedType.tags.join(', '));
    +        
$('#component-version-description').text(documentedType.description);
    +    };
    +
    +    return {
    +        init: function (settings, processGroupConfiguration) {
    +            versionMap = d3.map();
    +            nfSettings = settings;
    +            nfProcessGroupConfiguration = processGroupConfiguration;
    --- End diff --
    
    Should be able to remove the injection of the nfProcessGroupConfiguration 
module here too...


> Multiple Versions of the Same Component
> ---------------------------------------
>
>                 Key: NIFI-3380
>                 URL: https://issues.apache.org/jira/browse/NIFI-3380
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>            Reporter: Bryan Bende
>            Assignee: Bryan Bende
>             Fix For: 1.2.0
>
>
> This ticket is to track the work for supporting multiple versions of the same 
> component within NiFi. The overall design for this feature is described in 
> detail at the following wiki page:
> https://cwiki.apache.org/confluence/display/NIFI/Multiple+Versions+of+the+Same+Extension
> This ticket will track only the core NiFi work, and a separate ticket will be 
> created to track enhancements for the NAR Maven Plugin.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to