NIFI-4436:

- Addressing miscellaneous minor UX issues.
- Updating comments UX for all components.
- Updating the styling of PG and RPG to be more consistent.
- Adding the icons for nested versioned process groups.
- Calculating the number/states of nested versioned process groups.
This commit is contained in:
Matt Gilman 2017-11-28 16:22:11 -05:00 committed by Bryan Bende
parent e1606701c7
commit d34fb5e2ef
No known key found for this signature in database
GPG Key ID: A0DDA9ED50711C39
20 changed files with 689 additions and 217 deletions

View File

@ -30,7 +30,7 @@ public class ProcessGroupDTO extends ComponentDTO {
private String name; private String name;
private String comments; private String comments;
private Map<String, String> variables; private Map<String, String> variables;
private VersionControlInformationDTO versionControlInfo; private VersionControlInformationDTO versionControlInformation;
private Integer runningCount; private Integer runningCount;
private Integer stoppedCount; private Integer stoppedCount;
@ -39,6 +39,12 @@ public class ProcessGroupDTO extends ComponentDTO {
private Integer activeRemotePortCount; private Integer activeRemotePortCount;
private Integer inactiveRemotePortCount; private Integer inactiveRemotePortCount;
private Integer upToDateCount;
private Integer locallyModifiedCount;
private Integer staleCount;
private Integer locallyModifiedAndStaleCount;
private Integer syncFailureCount;
private Integer inputPortCount; private Integer inputPortCount;
private Integer outputPortCount; private Integer outputPortCount;
@ -204,6 +210,51 @@ public class ProcessGroupDTO extends ComponentDTO {
this.inactiveRemotePortCount = inactiveRemotePortCount; this.inactiveRemotePortCount = inactiveRemotePortCount;
} }
@ApiModelProperty("The number of up to date versioned process groups in the process group.")
public Integer getUpToDateCount() {
return upToDateCount;
}
public void setUpToDateCount(Integer upToDateCount) {
this.upToDateCount = upToDateCount;
}
@ApiModelProperty("The number of locally modified versioned process groups in the process group.")
public Integer getLocallyModifiedCount() {
return locallyModifiedCount;
}
public void setLocallyModifiedCount(Integer locallyModifiedCount) {
this.locallyModifiedCount = locallyModifiedCount;
}
@ApiModelProperty("The number of stale versioned process groups in the process group.")
public Integer getStaleCount() {
return staleCount;
}
public void setStaleCount(Integer staleCount) {
this.staleCount = staleCount;
}
@ApiModelProperty("The number of locally modified and stale versioned process groups in the process group.")
public Integer getLocallyModifiedAndStaleCount() {
return locallyModifiedAndStaleCount;
}
public void setLocallyModifiedAndStaleCount(Integer locallyModifiedAndStaleCount) {
this.locallyModifiedAndStaleCount = locallyModifiedAndStaleCount;
}
@ApiModelProperty("The number of versioned process groups in the process group that are unable to sync to a registry.")
public Integer getSyncFailureCount() {
return syncFailureCount;
}
public void setSyncFailureCount(Integer syncFailureCount) {
this.syncFailureCount = syncFailureCount;
}
@ApiModelProperty(value = "The variables that are configured for the Process Group. Note that this map contains only " @ApiModelProperty(value = "The variables that are configured for the Process Group. Note that this map contains only "
+ "those variables that are defined on this Process Group and not any variables that are defined in the parent " + "those variables that are defined on this Process Group and not any variables that are defined in the parent "
+ "Process Group, etc. I.e., this Map will not contain all variables that are accessible by components in this " + "Process Group, etc. I.e., this Map will not contain all variables that are accessible by components in this "
@ -219,10 +270,10 @@ public class ProcessGroupDTO extends ComponentDTO {
@ApiModelProperty("The Version Control information that indicates which Flow Registry, and where in the Flow Registry, " @ApiModelProperty("The Version Control information that indicates which Flow Registry, and where in the Flow Registry, "
+ "this Process Group is tracking to; or null if this Process Group is not under version control") + "this Process Group is tracking to; or null if this Process Group is not under version control")
public VersionControlInformationDTO getVersionControlInformation() { public VersionControlInformationDTO getVersionControlInformation() {
return versionControlInfo; return versionControlInformation;
} }
public void setVersionControlInformation(final VersionControlInformationDTO versionControlInfo) { public void setVersionControlInformation(final VersionControlInformationDTO versionControlInformation) {
this.versionControlInfo = versionControlInfo; this.versionControlInformation = versionControlInformation;
} }
} }

View File

@ -18,10 +18,11 @@ package org.apache.nifi.groups;
public class ProcessGroupCounts { public class ProcessGroupCounts {
private final int inputPortCount, outputPortCount, runningCount, stoppedCount, invalidCount, disabledCount, activeRemotePortCount, inactiveRemotePortCount; private final int inputPortCount, outputPortCount, runningCount, stoppedCount, invalidCount, disabledCount, activeRemotePortCount, inactiveRemotePortCount,
upToDateCount, locallyModifiedCount, staleCount, locallyModifiedAndStaleCount, syncFailureCount;
public ProcessGroupCounts(final int inputPortCount, final int outputPortCount, final int runningCount, public ProcessGroupCounts(int inputPortCount, int outputPortCount, int runningCount, int stoppedCount, int invalidCount, int disabledCount, int activeRemotePortCount,
final int stoppedCount, final int invalidCount, final int disabledCount, final int activeRemotePortCount, final int inactiveRemotePortCount) { int inactiveRemotePortCount, int upToDateCount, int locallyModifiedCount, int staleCount, int locallyModifiedAndStaleCount, int syncFailureCount) {
this.inputPortCount = inputPortCount; this.inputPortCount = inputPortCount;
this.outputPortCount = outputPortCount; this.outputPortCount = outputPortCount;
this.runningCount = runningCount; this.runningCount = runningCount;
@ -30,6 +31,11 @@ public class ProcessGroupCounts {
this.disabledCount = disabledCount; this.disabledCount = disabledCount;
this.activeRemotePortCount = activeRemotePortCount; this.activeRemotePortCount = activeRemotePortCount;
this.inactiveRemotePortCount = inactiveRemotePortCount; this.inactiveRemotePortCount = inactiveRemotePortCount;
this.upToDateCount = upToDateCount;
this.locallyModifiedCount = locallyModifiedCount;
this.staleCount = staleCount;
this.locallyModifiedAndStaleCount = locallyModifiedAndStaleCount;
this.syncFailureCount = syncFailureCount;
} }
public int getInputPortCount() { public int getInputPortCount() {
@ -63,4 +69,24 @@ public class ProcessGroupCounts {
public int getInactiveRemotePortCount() { public int getInactiveRemotePortCount() {
return inactiveRemotePortCount; return inactiveRemotePortCount;
} }
public int getUpToDateCount() {
return upToDateCount;
}
public int getLocallyModifiedCount() {
return locallyModifiedCount;
}
public int getStaleCount() {
return staleCount;
}
public int getLocallyModifiedAndStaleCount() {
return locallyModifiedAndStaleCount;
}
public int getSyncFailureCount() {
return syncFailureCount;
}
} }

View File

@ -73,7 +73,7 @@ public interface RemoteProcessGroup extends ComponentAuthorizable, Positionable,
RemoteGroupPort getOutputPort(String id); RemoteGroupPort getOutputPort(String id);
ProcessGroupCounts getCounts(); RemoteProcessGroupCounts getCounts();
void refreshFlowContents() throws CommunicationsException; void refreshFlowContents() throws CommunicationsException;

View File

@ -0,0 +1,36 @@
/*
* 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.
*/
package org.apache.nifi.groups;
public class RemoteProcessGroupCounts {
private final int inputPortCount, outputPortCount;
public RemoteProcessGroupCounts(int inputPortCount, int outputPortCount) {
this.inputPortCount = inputPortCount;
this.outputPortCount = outputPortCount;
}
public int getInputPortCount() {
return inputPortCount;
}
public int getOutputPortCount() {
return outputPortCount;
}
}

View File

@ -127,6 +127,11 @@ public class TemplateUtils {
processGroupDTO.setOutputPortCount(null); processGroupDTO.setOutputPortCount(null);
processGroupDTO.setRunningCount(null); processGroupDTO.setRunningCount(null);
processGroupDTO.setStoppedCount(null); processGroupDTO.setStoppedCount(null);
processGroupDTO.setUpToDateCount(null);
processGroupDTO.setLocallyModifiedCount(null);
processGroupDTO.setStaleCount(null);
processGroupDTO.setLocallyModifiedAndStaleCount(null);
processGroupDTO.setSyncFailureCount(null);
scrubSnippet(processGroupDTO.getContents()); scrubSnippet(processGroupDTO.getContents());
} }

View File

@ -16,31 +16,6 @@
*/ */
package org.apache.nifi.groups; package org.apache.nifi.groups;
import static java.util.Objects.requireNonNull;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
@ -139,6 +114,31 @@ import org.apache.nifi.web.api.dto.TemplateDTO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Function;
import java.util.stream.Collectors;
import static java.util.Objects.requireNonNull;
public final class StandardProcessGroup implements ProcessGroup { public final class StandardProcessGroup implements ProcessGroup {
private final String id; private final String id;
@ -278,6 +278,12 @@ public final class StandardProcessGroup implements ProcessGroup {
int activeRemotePorts = 0; int activeRemotePorts = 0;
int inactiveRemotePorts = 0; int inactiveRemotePorts = 0;
int upToDate = 0;
int locallyModified = 0;
int stale = 0;
int locallyModifiedAndStale = 0;
int syncFailure = 0;
readLock.lock(); readLock.lock();
try { try {
for (final ProcessorNode procNode : processors.values()) { for (final ProcessorNode procNode : processors.values()) {
@ -324,6 +330,27 @@ public final class StandardProcessGroup implements ProcessGroup {
stopped += childCounts.getStoppedCount(); stopped += childCounts.getStoppedCount();
invalid += childCounts.getInvalidCount(); invalid += childCounts.getInvalidCount();
disabled += childCounts.getDisabledCount(); disabled += childCounts.getDisabledCount();
// update the vci counts for this child group
final VersionControlInformation vci = childGroup.getVersionControlInformation();
if (vci != null) {
if (vci.isModified() && !vci.isCurrent()) {
locallyModifiedAndStale += 1;
} else if (!vci.isCurrent()) {
stale += 1;
} else if (vci.isModified()) {
locallyModified += 1;
} else {
upToDate += 1;
}
}
// update the vci counts for all nested groups within the child
upToDate += childCounts.getUpToDateCount();
locallyModified += childCounts.getLocallyModifiedCount();
stale += childCounts.getStaleCount();
locallyModifiedAndStale += childCounts.getLocallyModifiedAndStaleCount();
syncFailure += childCounts.getSyncFailureCount();
} }
for (final RemoteProcessGroup remoteGroup : findAllRemoteProcessGroups()) { for (final RemoteProcessGroup remoteGroup : findAllRemoteProcessGroups()) {
@ -358,8 +385,8 @@ public final class StandardProcessGroup implements ProcessGroup {
readLock.unlock(); readLock.unlock();
} }
return new ProcessGroupCounts(inputPortCount, outputPortCount, running, stopped, return new ProcessGroupCounts(inputPortCount, outputPortCount, running, stopped, invalid, disabled, activeRemotePorts,
invalid, disabled, activeRemotePorts, inactiveRemotePorts); inactiveRemotePorts, upToDate, locallyModified, stale, locallyModifiedAndStale, syncFailure);
} }
@Override @Override

View File

@ -16,8 +16,43 @@
*/ */
package org.apache.nifi.remote; package org.apache.nifi.remote;
import static java.util.Objects.requireNonNull; import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.authorization.Resource;
import org.apache.nifi.authorization.resource.Authorizable;
import org.apache.nifi.authorization.resource.ResourceFactory;
import org.apache.nifi.authorization.resource.ResourceType;
import org.apache.nifi.components.ValidationResult;
import org.apache.nifi.connectable.ConnectableType;
import org.apache.nifi.connectable.Connection;
import org.apache.nifi.connectable.Port;
import org.apache.nifi.connectable.Position;
import org.apache.nifi.controller.FlowController;
import org.apache.nifi.controller.ProcessScheduler;
import org.apache.nifi.controller.ScheduledState;
import org.apache.nifi.controller.exception.CommunicationsException;
import org.apache.nifi.engine.FlowEngine;
import org.apache.nifi.events.BulletinFactory;
import org.apache.nifi.events.EventReporter;
import org.apache.nifi.groups.ProcessGroup;
import org.apache.nifi.groups.ProcessGroupCounts;
import org.apache.nifi.groups.RemoteProcessGroup;
import org.apache.nifi.groups.RemoteProcessGroupCounts;
import org.apache.nifi.groups.RemoteProcessGroupPortDescriptor;
import org.apache.nifi.remote.protocol.SiteToSiteTransportProtocol;
import org.apache.nifi.remote.protocol.http.HttpProxy;
import org.apache.nifi.remote.util.SiteToSiteRestApiClient;
import org.apache.nifi.reporting.BulletinRepository;
import org.apache.nifi.reporting.ComponentType;
import org.apache.nifi.reporting.Severity;
import org.apache.nifi.util.FormatUtils;
import org.apache.nifi.util.NiFiProperties;
import org.apache.nifi.web.api.dto.ControllerDTO;
import org.apache.nifi.web.api.dto.PortDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.SSLContext;
import javax.ws.rs.core.Response;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
@ -47,42 +82,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.net.ssl.SSLContext; import static java.util.Objects.requireNonNull;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.authorization.Resource;
import org.apache.nifi.authorization.resource.Authorizable;
import org.apache.nifi.authorization.resource.ResourceFactory;
import org.apache.nifi.authorization.resource.ResourceType;
import org.apache.nifi.components.ValidationResult;
import org.apache.nifi.connectable.ConnectableType;
import org.apache.nifi.connectable.Connection;
import org.apache.nifi.connectable.Port;
import org.apache.nifi.connectable.Position;
import org.apache.nifi.controller.FlowController;
import org.apache.nifi.controller.ProcessScheduler;
import org.apache.nifi.controller.ScheduledState;
import org.apache.nifi.controller.exception.CommunicationsException;
import org.apache.nifi.engine.FlowEngine;
import org.apache.nifi.events.BulletinFactory;
import org.apache.nifi.events.EventReporter;
import org.apache.nifi.groups.ProcessGroup;
import org.apache.nifi.groups.ProcessGroupCounts;
import org.apache.nifi.groups.RemoteProcessGroup;
import org.apache.nifi.groups.RemoteProcessGroupPortDescriptor;
import org.apache.nifi.remote.protocol.SiteToSiteTransportProtocol;
import org.apache.nifi.remote.protocol.http.HttpProxy;
import org.apache.nifi.remote.util.SiteToSiteRestApiClient;
import org.apache.nifi.reporting.BulletinRepository;
import org.apache.nifi.reporting.ComponentType;
import org.apache.nifi.reporting.Severity;
import org.apache.nifi.util.FormatUtils;
import org.apache.nifi.util.NiFiProperties;
import org.apache.nifi.web.api.dto.ControllerDTO;
import org.apache.nifi.web.api.dto.PortDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Represents the Root Process Group of a remote NiFi Instance. Holds * Represents the Root Process Group of a remote NiFi Instance. Holds
@ -137,7 +137,7 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup {
// Maps a Port Name to a PullingPort that can be used to receive files from that port // Maps a Port Name to a PullingPort that can be used to receive files from that port
private final Map<String, StandardRemoteGroupPort> outputPorts = new HashMap<>(); private final Map<String, StandardRemoteGroupPort> outputPorts = new HashMap<>();
private ProcessGroupCounts counts = new ProcessGroupCounts(0, 0, 0, 0, 0, 0, 0, 0); private RemoteProcessGroupCounts counts = new RemoteProcessGroupCounts(0, 0);
private Long refreshContentsTimestamp = null; private Long refreshContentsTimestamp = null;
private Boolean destinationSecure; private Boolean destinationSecure;
private Integer listeningPort; private Integer listeningPort;
@ -829,7 +829,7 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup {
} }
@Override @Override
public ProcessGroupCounts getCounts() { public RemoteProcessGroupCounts getCounts() {
readLock.lock(); readLock.lock();
try { try {
return counts; return counts;
@ -838,7 +838,7 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup {
} }
} }
private void setCounts(final ProcessGroupCounts counts) { private void setCounts(final RemoteProcessGroupCounts counts) {
writeLock.lock(); writeLock.lock();
try { try {
this.counts = counts; this.counts = counts;
@ -910,39 +910,12 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup {
if (dto.getOutputPortCount() != null) { if (dto.getOutputPortCount() != null) {
outputPortCount = dto.getOutputPortCount(); outputPortCount = dto.getOutputPortCount();
} }
int runningCount = 0;
if (dto.getRunningCount() != null) {
runningCount = dto.getRunningCount();
}
int stoppedCount = 0;
if (dto.getStoppedCount() != null) {
stoppedCount = dto.getStoppedCount();
}
int invalidCount = 0;
if (dto.getInvalidCount() != null) {
invalidCount = dto.getInvalidCount();
}
int disabledCount = 0;
if (dto.getDisabledCount() != null) {
disabledCount = dto.getDisabledCount();
}
int activeRemotePortCount = 0;
if (dto.getActiveRemotePortCount() != null) {
activeRemotePortCount = dto.getActiveRemotePortCount();
}
int inactiveRemotePortCount = 0;
if (dto.getInactiveRemotePortCount() != null) {
inactiveRemotePortCount = dto.getInactiveRemotePortCount();
}
this.listeningPort = dto.getRemoteSiteListeningPort(); this.listeningPort = dto.getRemoteSiteListeningPort();
this.listeningHttpPort = dto.getRemoteSiteHttpListeningPort(); this.listeningHttpPort = dto.getRemoteSiteHttpListeningPort();
this.destinationSecure = dto.isSiteToSiteSecure(); this.destinationSecure = dto.isSiteToSiteSecure();
final ProcessGroupCounts newCounts = new ProcessGroupCounts(inputPortCount, outputPortCount, final RemoteProcessGroupCounts newCounts = new RemoteProcessGroupCounts(inputPortCount, outputPortCount);
runningCount, stoppedCount, invalidCount, disabledCount, activeRemotePortCount, inactiveRemotePortCount);
setCounts(newCounts); setCounts(newCounts);
this.refreshContentsTimestamp = System.currentTimeMillis(); this.refreshContentsTimestamp = System.currentTimeMillis();
} finally { } finally {

View File

@ -16,9 +16,7 @@
*/ */
package org.apache.nifi.web; package org.apache.nifi.web;
import javax.ws.rs.WebApplicationException; import com.google.common.collect.Sets;
import javax.ws.rs.core.Response;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.nifi.action.Action; import org.apache.nifi.action.Action;
import org.apache.nifi.action.Component; import org.apache.nifi.action.Component;
@ -269,8 +267,8 @@ import org.apache.nifi.web.util.SnippetUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.google.common.collect.Sets; import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
@ -3018,6 +3016,8 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
final ControllerDTO controllerDTO = new ControllerDTO(); final ControllerDTO controllerDTO = new ControllerDTO();
controllerDTO.setId(controllerFacade.getRootGroupId()); controllerDTO.setId(controllerFacade.getRootGroupId());
controllerDTO.setInstanceId(controllerFacade.getInstanceId()); controllerDTO.setInstanceId(controllerFacade.getInstanceId());
controllerDTO.setName(controllerFacade.getName());
controllerDTO.setComments(controllerFacade.getComments());
controllerDTO.setInputPorts(inputPortDtos); controllerDTO.setInputPorts(inputPortDtos);
controllerDTO.setOutputPorts(outputPortDtos); controllerDTO.setOutputPorts(outputPortDtos);
controllerDTO.setInputPortCount(inputPortDtos.size()); controllerDTO.setInputPortCount(inputPortDtos.size());

View File

@ -101,6 +101,7 @@ import org.apache.nifi.flowfile.attributes.CoreAttributes;
import org.apache.nifi.groups.ProcessGroup; import org.apache.nifi.groups.ProcessGroup;
import org.apache.nifi.groups.ProcessGroupCounts; import org.apache.nifi.groups.ProcessGroupCounts;
import org.apache.nifi.groups.RemoteProcessGroup; import org.apache.nifi.groups.RemoteProcessGroup;
import org.apache.nifi.groups.RemoteProcessGroupCounts;
import org.apache.nifi.history.History; import org.apache.nifi.history.History;
import org.apache.nifi.nar.ExtensionManager; import org.apache.nifi.nar.ExtensionManager;
import org.apache.nifi.nar.NarClassLoaders; import org.apache.nifi.nar.NarClassLoaders;
@ -1648,7 +1649,7 @@ public final class DtoFactory {
dto.setInactiveRemoteOutputPortCount(inactiveRemoteOutputPortCount); dto.setInactiveRemoteOutputPortCount(inactiveRemoteOutputPortCount);
dto.setVersionedComponentId(group.getVersionedComponentId().orElse(null)); dto.setVersionedComponentId(group.getVersionedComponentId().orElse(null));
final ProcessGroupCounts counts = group.getCounts(); final RemoteProcessGroupCounts counts = group.getCounts();
if (counts != null) { if (counts != null) {
dto.setInputPortCount(counts.getInputPortCount()); dto.setInputPortCount(counts.getInputPortCount());
dto.setOutputPortCount(counts.getOutputPortCount()); dto.setOutputPortCount(counts.getOutputPortCount());
@ -2175,6 +2176,11 @@ public final class DtoFactory {
dto.setOutputPortCount(counts.getOutputPortCount()); dto.setOutputPortCount(counts.getOutputPortCount());
dto.setActiveRemotePortCount(counts.getActiveRemotePortCount()); dto.setActiveRemotePortCount(counts.getActiveRemotePortCount());
dto.setInactiveRemotePortCount(counts.getInactiveRemotePortCount()); dto.setInactiveRemotePortCount(counts.getInactiveRemotePortCount());
dto.setUpToDateCount(counts.getUpToDateCount());
dto.setLocallyModifiedCount(counts.getLocallyModifiedCount());
dto.setStaleCount(counts.getStaleCount());
dto.setLocallyModifiedAndStaleCount(counts.getLocallyModifiedAndStaleCount());
dto.setSyncFailureCount(counts.getSyncFailureCount());
return dto; return dto;
} }
@ -3453,6 +3459,12 @@ public final class DtoFactory {
copy.setActiveRemotePortCount(original.getActiveRemotePortCount()); copy.setActiveRemotePortCount(original.getActiveRemotePortCount());
copy.setInactiveRemotePortCount(original.getInactiveRemotePortCount()); copy.setInactiveRemotePortCount(original.getInactiveRemotePortCount());
copy.setUpToDateCount(original.getUpToDateCount());
copy.setLocallyModifiedCount(original.getLocallyModifiedCount());
copy.setStaleCount(original.getStaleCount());
copy.setLocallyModifiedAndStaleCount(original.getLocallyModifiedAndStaleCount());
copy.setSyncFailureCount(original.getSyncFailureCount());
if (original.getVariables() != null) { if (original.getVariables() != null) {
copy.setVariables(new HashMap<>(original.getVariables())); copy.setVariables(new HashMap<>(original.getVariables()));
} }

View File

@ -17,10 +17,8 @@
<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %> <%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
<div id="revert-local-changes-dialog" layout="column" class="hidden large-dialog"> <div id="revert-local-changes-dialog" layout="column" class="hidden large-dialog">
<div class="dialog-content"> <div class="dialog-content">
<div class="setting"> <div class="setting local-changes-message">
<div class="setting-field"> <span id="revert-local-changes-message"></span>&nbsp;<span style="font-weight: bold;">Revert will remove all changes.</span>
Are you sure you want to revert changes? All flow configuration changes detailed below will be reverted to the last version.
</div>
</div> </div>
<span id="revert-local-changes-process-group-id" class="hidden"></span> <span id="revert-local-changes-process-group-id" class="hidden"></span>
<div id="revert-local-changes-filter-controls"> <div id="revert-local-changes-filter-controls">

View File

@ -17,10 +17,8 @@
<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %> <%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
<div id="show-local-changes-dialog" layout="column" class="hidden large-dialog"> <div id="show-local-changes-dialog" layout="column" class="hidden large-dialog">
<div class="dialog-content"> <div class="dialog-content">
<div class="setting"> <div class="setting local-changes-message">
<div class="setting-field"> <span id="show-local-changes-message"></span>
The following changes have been made to the flow since the last version.
</div>
</div> </div>
<div id="show-local-changes-filter-controls"> <div id="show-local-changes-filter-controls">
<div id="show-local-changes-filter-status" class="filter-status"> <div id="show-local-changes-filter-status" class="filter-status">

View File

@ -269,17 +269,21 @@ div.progress-label {
#revert-local-changes-table, #show-local-changes-table { #revert-local-changes-table, #show-local-changes-table {
position: absolute; position: absolute;
top: 80px; top: 78px;
left: 0px; left: 0px;
right: 0px; right: 0px;
bottom: 0px; bottom: 0px;
height: 225px; height: 350px;
} }
#revert-local-changes-filter, #show-local-changes-filter { #revert-local-changes-filter, #show-local-changes-filter {
width: 173px; width: 173px;
} }
div.local-changes-message {
font-size: 13px;
}
/* /*
Variable Registry Variable Registry
*/ */

View File

@ -136,6 +136,11 @@ text.active-thread-count {
font-weight: bold; font-weight: bold;
} }
path.component-comments {
fill: #000;
stroke: #000;
}
/* /*
Selection Selection
*/ */
@ -471,5 +476,4 @@ text.remote-process-group-transmission-secure {
text.remote-process-group-last-refresh { text.remote-process-group-last-refresh {
fill: #728e9b; fill: #728e9b;
text-anchor: end;
} }

View File

@ -153,6 +153,38 @@ div.context-menu-provenance {
text-shadow: 0 0 4px rgba(255,255,255,1); text-shadow: 0 0 4px rgba(255,255,255,1);
} }
.up-to-date {
float: left;
color: #3da67a !important;
fill: #3da67a !important;
margin-top: 0px !important;
text-shadow: 0 0 4px rgba(255,255,255,1);
}
.locally-modified {
float: left;
color: #747474 !important;
fill: #747474 !important;
margin-top: 0px !important;
text-shadow: 0 0 4px rgba(255,255,255,1);
}
.stale {
float: left;
color: #c7685d !important;
fill: #c7685d !important;
margin-top: 0px !important;
text-shadow: 0 0 4px rgba(255,255,255,1);
}
.locally-modified-and-stale {
float: left;
color: #c7685d !important;
fill: #c7685d !important;
margin-top: 0px !important;
text-shadow: 0 0 4px rgba(255,255,255,1);
}
div.valid { div.valid {
float: left; float: left;
background-color: transparent; background-color: transparent;

View File

@ -378,6 +378,10 @@
}); });
return refreshGraph; return refreshGraph;
} else {
return $.Deferred(function (deferred) {
deferred.reject();
}).promise();
} }
}, },

View File

@ -126,13 +126,16 @@
var localChangesData = localChangesGrid.getData(); var localChangesData = localChangesGrid.getData();
localChangesData.setItems([]); localChangesData.setItems([]);
localChangesData.setFilterArgs({
searchString: ''
});
} }
filterInput.val(''); filterInput.val('');
displayedLabel.text('0'); displayedLabel.text('0');
totalLabel.text('0'); totalLabel.text('0');
} };
/** /**
* Clears the version grid * Clears the version grid
@ -386,9 +389,18 @@
var sort = function (sortDetails, data) { var sort = function (sortDetails, data) {
// defines a function for sorting // defines a function for sorting
var comparer = function (a, b) { var comparer = function (a, b) {
var aString = nfCommon.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; var aIsBlank = nfCommon.isBlank(a[sortDetails.columnId]);
var bString = nfCommon.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; var bIsBlank = nfCommon.isBlank(b[sortDetails.columnId]);
return aString === bString ? 0 : aString > bString ? 1 : -1;
if (aIsBlank && bIsBlank) {
return 0;
} else if (aIsBlank) {
return 1;
} else if (bIsBlank) {
return -1;
}
return a[sortDetails.columnId] === b[sortDetails.columnId] ? 0 : a[sortDetails.columnId] > b[sortDetails.columnId] ? 1 : -1;
}; };
// perform the sort // perform the sort
@ -584,7 +596,7 @@
}, },
{ {
id: 'differenceType', id: 'differenceType',
name: 'Type', name: 'Change Type',
field: 'differenceType', field: 'differenceType',
formatter: valueFormatter, formatter: valueFormatter,
sortable: true, sortable: true,
@ -596,8 +608,7 @@
field: 'difference', field: 'difference',
formatter: valueFormatter, formatter: valueFormatter,
sortable: true, sortable: true,
resizable: true, resizable: true
minWidth: 300
}, },
{ {
id: 'actions', id: 'actions',
@ -614,22 +625,21 @@
inlineFilters: false inlineFilters: false
}); });
localChangesData.setFilterArgs({ localChangesData.setFilterArgs({
searchString: '', searchString: getFilterText()
property: 'componentName'
}); });
localChangesData.setFilter(filter); localChangesData.setFilter(filter);
// initialize the sort // initialize the sort
sort({ sort({
columnId: 'version', columnId: 'componentName',
sortAsc: false sortAsc: true
}, localChangesData); }, localChangesData);
// initialize the grid // initialize the grid
var localChangesGrid = new Slick.Grid(localChangesTable, localChangesData, localChangesColumns, gridOptions); var localChangesGrid = new Slick.Grid(localChangesTable, localChangesData, localChangesColumns, gridOptions);
localChangesGrid.setSelectionModel(new Slick.RowSelectionModel()); localChangesGrid.setSelectionModel(new Slick.RowSelectionModel());
localChangesGrid.registerPlugin(new Slick.AutoTooltips()); localChangesGrid.registerPlugin(new Slick.AutoTooltips());
localChangesGrid.setSortColumn('version', false); localChangesGrid.setSortColumn('componentName', true);
localChangesGrid.onSort.subscribe(function (e, args) { localChangesGrid.onSort.subscribe(function (e, args) {
sort({ sort({
columnId: args.sortCol.id, columnId: args.sortCol.id,
@ -650,9 +660,13 @@
if (componentDifference.componentType === 'Controller Service') { if (componentDifference.componentType === 'Controller Service') {
nfProcessGroupConfiguration.showConfiguration(componentDifference.processGroupId).done(function () { nfProcessGroupConfiguration.showConfiguration(componentDifference.processGroupId).done(function () {
nfProcessGroupConfiguration.selectControllerService(componentDifference.componentId); nfProcessGroupConfiguration.selectControllerService(componentDifference.componentId);
localChangesTable.closest('.large-dialog').modal('hide');
}); });
} else { } else {
nfCanvasUtils.showComponent(componentDifference.processGroupId, componentDifference.componentId); nfCanvasUtils.showComponent(componentDifference.processGroupId, componentDifference.componentId).done(function () {
localChangesTable.closest('.large-dialog').modal('hide');
});
} }
} }
} }
@ -1240,10 +1254,11 @@
* Shows local changes for the specified process group. * Shows local changes for the specified process group.
* *
* @param processGroupId * @param processGroupId
* @param localChangesMessage
* @param localChangesTable * @param localChangesTable
* @param totalLabel * @param totalLabel
*/ */
var loadLocalChanges = function (processGroupId, localChangesTable, totalLabel) { var loadLocalChanges = function (processGroupId, localChangesMessage, localChangesTable, totalLabel) {
var localChangesGrid = localChangesTable.data('gridInstance'); var localChangesGrid = localChangesTable.data('gridInstance');
var localChangesData = localChangesGrid.getData(); var localChangesData = localChangesGrid.getData();
@ -1255,7 +1270,19 @@
localChangesGrid.resetActiveCell(); localChangesGrid.resetActiveCell();
localChangesData.setItems([]); localChangesData.setItems([]);
return $.ajax({ // load the necessary details
var loadMessage = getVersionControlInformation(processGroupId).done(function (response) {
if (nfCommon.isDefinedAndNotNull(response.versionControlInformation)) {
var vci = response.versionControlInformation;
localChangesMessage.text('The following changes have been made to ' + vci.flowName + ' (Version ' + vci.version + ').');
} else {
nfDialog.showOkDialog({
headerText: 'Change Version',
dialogContent: 'This Process Group is not currently under version control.'
});
}
});
var loadChanges = $.ajax({
type: 'GET', type: 'GET',
url: '../nifi-api/process-groups/' + encodeURIComponent(processGroupId) + '/local-modifications', url: '../nifi-api/process-groups/' + encodeURIComponent(processGroupId) + '/local-modifications',
dataType: 'json' dataType: 'json'
@ -1292,6 +1319,8 @@
}); });
} }
}).fail(nfErrorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
return $.when(loadMessage, loadChanges);
}; };
/** /**
@ -1593,7 +1622,7 @@
// init the show local changes dialog // init the show local changes dialog
$('#show-local-changes-dialog').modal({ $('#show-local-changes-dialog').modal({
scrollableContentStyle: 'scrollable', scrollableContentStyle: 'scrollable',
headerText: 'Local Changes', headerText: 'Show Local Changes',
buttons: [{ buttons: [{
buttonText: 'Close', buttonText: 'Close',
color: { color: {
@ -1711,7 +1740,7 @@
* @param processGroupId * @param processGroupId
*/ */
revertLocalChanges: function (processGroupId) { revertLocalChanges: function (processGroupId) {
loadLocalChanges(processGroupId, $('#revert-local-changes-table'), $('#total-revert-local-changes-entries')).done(function () { loadLocalChanges(processGroupId, $('#revert-local-changes-message'), $('#revert-local-changes-table'), $('#total-revert-local-changes-entries')).done(function () {
$('#revert-local-changes-process-group-id').text(processGroupId); $('#revert-local-changes-process-group-id').text(processGroupId);
$('#revert-local-changes-dialog').modal('show'); $('#revert-local-changes-dialog').modal('show');
}); });
@ -1723,7 +1752,7 @@
* @param processGroupId * @param processGroupId
*/ */
showLocalChanges: function (processGroupId) { showLocalChanges: function (processGroupId) {
loadLocalChanges(processGroupId, $('#show-local-changes-table'), $('#total-show-local-changes-entries')).done(function () { loadLocalChanges(processGroupId, $('#show-local-changes-message'), $('#show-local-changes-table'), $('#total-show-local-changes-entries')).done(function () {
$('#show-local-changes-dialog').modal('show'); $('#show-local-changes-dialog').modal('show');
}); });
}, },

View File

@ -280,6 +280,17 @@
} }
}); });
// --------
// comments
// --------
details.append('path')
.attr({
'class': 'component-comments',
'transform': 'translate(' + (portData.dimensions.width - 2) + ', ' + (portData.dimensions.height - 10) + ')',
'd': 'm0,0 l0,8 l-8,0 z'
});
// ------------------- // -------------------
// active thread count // active thread count
// ------------------- // -------------------
@ -321,9 +332,43 @@
}).append('title').text(function (d) { }).append('title').text(function (d) {
return d.component.name; return d.component.name;
}); });
// update the port comments
port.select('path.component-comments')
.style('visibility', nfCommon.isBlank(portData.component.comments) ? 'hidden' : 'visible')
.each(function () {
// get the tip
var tip = d3.select('#comments-tip-' + portData.id);
// if there are validation errors generate a tooltip
if (nfCommon.isBlank(portData.component.comments)) {
// remove the tip if necessary
if (!tip.empty()) {
tip.remove();
}
} else {
// create the tip if necessary
if (tip.empty()) {
tip = d3.select('#port-tooltips').append('div')
.attr('id', function () {
return 'comments-tip-' + portData.id;
})
.attr('class', 'tooltip nifi-tooltip');
}
// update the tip
tip.text(portData.component.comments);
// add the tooltip
nfCanvasUtils.canvasTooltip(tip, d3.select(this));
}
});
} else { } else {
// clear the port name // clear the port name
port.select('text.port-name').text(null); port.select('text.port-name').text(null);
// clear the port comments
port.select('path.component-comments').style('visibility', false);
} }
// populate the stats // populate the stats
@ -519,6 +564,7 @@
// remove any associated tooltips // remove any associated tooltips
$('#run-status-tip-' + d.id).remove(); $('#run-status-tip-' + d.id).remove();
$('#bulletin-tip-' + d.id).remove(); $('#bulletin-tip-' + d.id).remove();
$('#comments-tip-' + d.id).remove();
}); });
}; };

View File

@ -85,19 +85,6 @@
// privately scoped functions // privately scoped functions
// -------------------------- // --------------------------
/**
* Gets the process group comments.
*
* @param {object} d
*/
var getProcessGroupComments = function (d) {
if (nfCommon.isBlank(d.component.comments)) {
return 'No comments specified';
} else {
return d.component.comments;
}
};
/** /**
* Determines whether the specified process group is under version control. * Determines whether the specified process group is under version control.
* *
@ -296,6 +283,19 @@
'fill': '#e3e8eb' 'fill': '#e3e8eb'
}); });
details.append('rect')
.attr({
'x': 0,
'y': function () {
return processGroupData.dimensions.height - 24;
},
'width': function () {
return processGroupData.dimensions.width;
},
'height': 24,
'fill': '#e3e8eb'
});
// -------- // --------
// contents // contents
// -------- // --------
@ -397,6 +397,87 @@
'class': 'process-group-disabled-count process-group-contents-count' 'class': 'process-group-disabled-count process-group-contents-count'
}); });
// current icon
details.append('text')
.attr({
'x': 10,
'y': function () {
return processGroupData.dimensions.height - 7;
},
'class': 'process-group-up-to-date process-group-contents-icon',
'font-family': 'FontAwesome'
})
.text('\uf00c');
// current count
details.append('text')
.attr({
'y': function () {
return processGroupData.dimensions.height - 7;
},
'class': 'process-group-up-to-date-count process-group-contents-count'
});
// modified icon
details.append('text')
.attr({
'y': function () {
return processGroupData.dimensions.height - 7;
},
'class': 'process-group-locally-modified process-group-contents-icon',
'font-family': 'FontAwesome'
})
.text('\uf069');
// modified count
details.append('text')
.attr({
'y': function () {
return processGroupData.dimensions.height - 7;
},
'class': 'process-group-locally-modified-count process-group-contents-count'
});
// not current icon
details.append('text')
.attr({
'y': function () {
return processGroupData.dimensions.height - 7;
},
'class': 'process-group-stale process-group-contents-icon',
'font-family': 'FontAwesome'
})
.text('\uf0aa');
// not current count
details.append('text')
.attr({
'y': function () {
return processGroupData.dimensions.height - 7;
},
'class': 'process-group-stale-count process-group-contents-count'
});
// modified and not current icon
details.append('text')
.attr({
'y': function () {
return processGroupData.dimensions.height - 7;
},
'class': 'process-group-locally-modified-and-stale process-group-contents-icon',
'font-family': 'FontAwesome'
})
.text('\uf06a');
// modified and not current count
details.append('text')
.attr({
'y': function () {
return processGroupData.dimensions.height - 7;
},
'class': 'process-group-locally-modified-and-stale-count process-group-contents-count'
});
// ---------------- // ----------------
// stats background // stats background
// ---------------- // ----------------
@ -676,14 +757,11 @@
// comments // comments
// -------- // --------
// process group comments details.append('path')
details.append('text')
.attr({ .attr({
'x': 10, 'class': 'component-comments',
'y': 160, 'transform': 'translate(' + (processGroupData.dimensions.width - 2) + ', ' + (processGroupData.dimensions.height - 10) + ')',
'width': 342, 'd': 'm0,0 l0,8 l-8,0 z'
'height': 22,
'class': 'process-group-comments'
}); });
// ------------------- // -------------------
@ -928,20 +1006,35 @@
}); });
// update the process group comments // update the process group comments
details.select('text.process-group-comments') processGroup.select('path.component-comments')
.each(function (d) { .style('visibility', nfCommon.isBlank(processGroupData.component.comments) ? 'hidden' : 'visible')
var processGroupComments = d3.select(this); .each(function () {
// get the tip
var tip = d3.select('#comments-tip-' + processGroupData.id);
// reset the process group name to handle any previous state // if there are validation errors generate a tooltip
processGroupComments.text(null).selectAll('tspan, title').remove(); if (nfCommon.isBlank(processGroupData.component.comments)) {
// remove the tip if necessary
if (!tip.empty()) {
tip.remove();
}
} else {
// create the tip if necessary
if (tip.empty()) {
tip = d3.select('#process-group-tooltips').append('div')
.attr('id', function () {
return 'comments-tip-' + processGroupData.id;
})
.attr('class', 'tooltip nifi-tooltip');
}
// apply ellipsis to the port name as necessary // update the tip
nfCanvasUtils.ellipsis(processGroupComments, getProcessGroupComments(d)); tip.text(processGroupData.component.comments);
}).classed('unset', function (d) {
return nfCommon.isBlank(d.component.comments); // add the tooltip
}).append('title').text(function (d) { nfCanvasUtils.canvasTooltip(tip, d3.select(this));
return getProcessGroupComments(d); }
}); });
// update the process group name // update the process group name
processGroup.select('text.process-group-name') processGroup.select('text.process-group-name')
@ -977,12 +1070,102 @@
.text(function (d) { .text(function (d) {
return d.component.name; return d.component.name;
}); });
// up to date current
var upToDate = details.select('text.process-group-up-to-date')
.classed('up-to-date', function (d) {
return d.component.upToDateCount > 0;
})
.classed('zero', function (d) {
return d.component.upToDateCount === 0;
});
var upToDateCount = details.select('text.process-group-up-to-date-count')
.attr('x', function () {
var currentCountX = parseInt(upToDate.attr('x'), 10);
return currentCountX + Math.round(upToDate.node().getComputedTextLength()) + CONTENTS_VALUE_SPACER;
})
.text(function (d) {
return d.component.upToDateCount;
});
// update locally modified
var locallyModified = details.select('text.process-group-locally-modified')
.classed('locally-modified', function (d) {
return d.component.locallyModifiedCount > 0;
})
.classed('zero', function (d) {
return d.component.locallyModifiedCount === 0;
})
.attr('x', function () {
var currentX = parseInt(upToDateCount.attr('x'), 10);
return currentX + Math.round(upToDateCount.node().getComputedTextLength()) + CONTENTS_SPACER;
});
var locallyModifiedCount = details.select('text.process-group-locally-modified-count')
.attr('x', function () {
var modifiedCountX = parseInt(locallyModified.attr('x'), 10);
return modifiedCountX + Math.round(locallyModified.node().getComputedTextLength()) + CONTENTS_VALUE_SPACER;
})
.text(function (d) {
return d.component.locallyModifiedCount;
});
// update stale
var stale = details.select('text.process-group-stale')
.classed('stale', function (d) {
return d.component.staleCount > 0;
})
.classed('zero', function (d) {
return d.component.staleCount === 0;
})
.attr('x', function () {
var modifiedX = parseInt(locallyModifiedCount.attr('x'), 10);
return modifiedX + Math.round(locallyModifiedCount.node().getComputedTextLength()) + CONTENTS_SPACER;
});
var staleCount = details.select('text.process-group-stale-count')
.attr('x', function () {
var notCurrentCountX = parseInt(stale.attr('x'), 10);
return notCurrentCountX + Math.round(stale.node().getComputedTextLength()) + CONTENTS_VALUE_SPACER;
})
.text(function (d) {
return d.component.staleCount;
});
// update locally modified and stale
var locallyModifiedAndStale = details.select('text.process-group-locally-modified-and-stale')
.classed('locally-modified-and-stale', function (d) {
return d.component.locallyModifiedAndStaleCount > 0;
})
.classed('zero', function (d) {
return d.component.locallyModifiedAndStaleCount === 0;
})
.attr('x', function () {
var runningX = parseInt(staleCount.attr('x'), 10);
return runningX + Math.round(staleCount.node().getComputedTextLength()) + CONTENTS_SPACER;
});
details.select('text.process-group-locally-modified-and-stale-count')
.attr('x', function () {
var modifiedAndNotCurrentCountX = parseInt(locallyModifiedAndStale.attr('x'), 10);
return modifiedAndNotCurrentCountX + Math.round(locallyModifiedAndStale.node().getComputedTextLength()) + CONTENTS_VALUE_SPACER;
})
.text(function (d) {
return d.component.locallyModifiedAndStaleCount;
});
} else { } else {
// update version control information // update version control information
processGroup.select('text.version-control').style('visibility', false).text(''); processGroup.select('text.version-control').style('visibility', false).text('');
// clear the process group comments // clear the process group comments
details.select('text.process-group-comments').text(null); processGroup.select('path.component-comments').style('visibility', false);
// clear the encapsulate versioned pg counts
details.select('text.process-group-up-to-date').style('visibility', false);
details.select('text.process-group-up-to-date-count').style('visibility', false);
details.select('text.process-group-locally-modified').style('visibility', false);
details.select('text.process-group-locally-modified-count').style('visibility', false);
details.select('text.process-group-stale').style('visibility', false);
details.select('text.process-group-stale-count').style('visibility', false);
details.select('text.process-group-locally-modified-and-stale').style('visibility', false);
details.select('text.process-group-locally-modified-and-stale-count').style('visibility', false);
// clear the process group name // clear the process group name
processGroup.select('text.process-group-name') processGroup.select('text.process-group-name')
@ -1136,6 +1319,7 @@
// remove any associated tooltips // remove any associated tooltips
$('#bulletin-tip-' + d.id).remove(); $('#bulletin-tip-' + d.id).remove();
$('#version-control-tip-' + d.id).remove(); $('#version-control-tip-' + d.id).remove();
$('#comments-tip-' + d.id).remove();
}); });
}; };

View File

@ -520,6 +520,17 @@
}) })
.text('5 min'); .text('5 min');
// --------
// comments
// --------
details.append('path')
.attr({
'class': 'component-comments',
'transform': 'translate(' + (processorData.dimensions.width - 2) + ', ' + (processorData.dimensions.height - 10) + ')',
'd': 'm0,0 l0,8 l-8,0 z'
});
// ------------------- // -------------------
// active thread count // active thread count
// ------------------- // -------------------
@ -608,6 +619,37 @@
}).append('title').text(function (d) { }).append('title').text(function (d) {
return nfCommon.formatBundle(d.component.bundle); return nfCommon.formatBundle(d.component.bundle);
}); });
// update the processor comments
processor.select('path.component-comments')
.style('visibility', nfCommon.isBlank(processorData.component.config.comments) ? 'hidden' : 'visible')
.each(function () {
// get the tip
var tip = d3.select('#comments-tip-' + processorData.id);
// if there are validation errors generate a tooltip
if (nfCommon.isBlank(processorData.component.config.comments)) {
// remove the tip if necessary
if (!tip.empty()) {
tip.remove();
}
} else {
// create the tip if necessary
if (tip.empty()) {
tip = d3.select('#processor-tooltips').append('div')
.attr('id', function () {
return 'comments-tip-' + processorData.id;
})
.attr('class', 'tooltip nifi-tooltip');
}
// update the tip
tip.text(processorData.component.config.comments);
// add the tooltip
nfCanvasUtils.canvasTooltip(tip, d3.select(this));
}
});
} else { } else {
// clear the processor name // clear the processor name
processor.select('text.processor-name').text(null); processor.select('text.processor-name').text(null);
@ -617,6 +659,9 @@
// clear the processor bundle // clear the processor bundle
processor.select('text.processor-bundle').text(null); processor.select('text.processor-bundle').text(null);
// clear the processor comments
processor.select('path.component-comments').style('visibility', false);
} }
// populate the stats // populate the stats
@ -903,6 +948,7 @@
// remove any associated tooltips // remove any associated tooltips
$('#run-status-tip-' + d.id).remove(); $('#run-status-tip-' + d.id).remove();
$('#bulletin-tip-' + d.id).remove(); $('#bulletin-tip-' + d.id).remove();
$('#comments-tip-' + d.id).remove();
}); });
}; };

View File

@ -83,19 +83,6 @@
// privately scoped functions // privately scoped functions
// -------------------------- // --------------------------
/**
* Gets the process group comments.
*
* @param {object} d
*/
var getProcessGroupComments = function (d) {
if (nfCommon.isBlank(d.component.comments)) {
return 'No comments specified';
} else {
return d.component.comments;
}
};
/** /**
* Selects the remote process group elements against the current remote process group map. * Selects the remote process group elements against the current remote process group map.
*/ */
@ -182,9 +169,6 @@
remoteProcessGroup.call(nfSelectable.activate).call(nfContextMenu.activate).call(nfQuickSelect.activate); remoteProcessGroup.call(nfSelectable.activate).call(nfContextMenu.activate).call(nfQuickSelect.activate);
}; };
// attempt of space between component count and icon for process group contents
var CONTENTS_SPACER = 5;
/** /**
* Updates the process groups in the specified selection. * Updates the process groups in the specified selection.
* *
@ -438,20 +422,6 @@
}) })
.text('5 min'); .text('5 min');
// --------
// comments
// --------
// process group comments
details.append('text')
.attr({
'x': 10,
'y': 121,
'width': 342,
'height': 22,
'class': 'remote-process-group-comments'
});
// ------------------- // -------------------
// last refreshed time // last refreshed time
// ------------------- // -------------------
@ -471,11 +441,22 @@
details.append('text') details.append('text')
.attr({ .attr({
'x': 370, 'x': 10,
'y': 150, 'y': 150,
'class': 'remote-process-group-last-refresh' 'class': 'remote-process-group-last-refresh'
}); });
// --------
// comments
// --------
details.append('path')
.attr({
'class': 'component-comments',
'transform': 'translate(' + (remoteProcessGroupData.dimensions.width - 2) + ', ' + (remoteProcessGroupData.dimensions.height - 10) + ')',
'd': 'm0,0 l0,8 l-8,0 z'
});
// ------------------- // -------------------
// active thread count // active thread count
// ------------------- // -------------------
@ -579,21 +560,36 @@
// update comments // update comments
// --------------- // ---------------
// update the process group comments // update the remote process group comments
details.select('text.remote-process-group-comments') details.select('path.component-comments')
.each(function (d) { .style('visibility', nfCommon.isBlank(remoteProcessGroupData.component.comments) ? 'hidden' : 'visible')
var remoteProcessGroupComments = d3.select(this); .each(function () {
// get the tip
var tip = d3.select('#comments-tip-' + remoteProcessGroupData.id);
// reset the processor name to handle any previous state // if there are validation errors generate a tooltip
remoteProcessGroupComments.text(null).selectAll('tspan, title').remove(); if (nfCommon.isBlank(remoteProcessGroupData.component.comments)) {
// remove the tip if necessary
if (!tip.empty()) {
tip.remove();
}
} else {
// create the tip if necessary
if (tip.empty()) {
tip = d3.select('#remote-process-group-tooltips').append('div')
.attr('id', function () {
return 'comments-tip-' + remoteProcessGroupData.id;
})
.attr('class', 'tooltip nifi-tooltip');
}
// apply ellipsis to the port name as necessary // update the tip
nfCanvasUtils.ellipsis(remoteProcessGroupComments, getProcessGroupComments(d)); tip.text(remoteProcessGroupData.component.comments);
}).classed('unset', function (d) {
return nfCommon.isBlank(d.component.comments); // add the tooltip
}).append('title').text(function (d) { nfCanvasUtils.canvasTooltip(tip, d3.select(this));
return getProcessGroupComments(d); }
}); });
// -------------- // --------------
// last refreshed // last refreshed
@ -628,8 +624,8 @@
// clear the transmission secure icon // clear the transmission secure icon
details.select('text.remote-process-group-transmission-secure').text(null); details.select('text.remote-process-group-transmission-secure').text(null);
// clear the process group comments // clear the comments
details.select('text.remote-process-group-comments').text(null); details.select('path.component-comments').style('visibility', false);
// clear the last refresh // clear the last refresh
details.select('text.remote-process-group-last-refresh').text(null); details.select('text.remote-process-group-last-refresh').text(null);
@ -853,6 +849,7 @@
$('#bulletin-tip-' + d.id).remove(); $('#bulletin-tip-' + d.id).remove();
$('#authorization-issues-' + d.id).remove(); $('#authorization-issues-' + d.id).remove();
$('#transmission-secure-' + d.id).remove(); $('#transmission-secure-' + d.id).remove();
$('#comments-tip-' + d.id).remove();
}); });
}; };