From a35664a77c6c39187411870cfd1124945dcb35a0 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Mon, 8 May 2017 11:04:51 +0200 Subject: [PATCH 001/360] [hotfix] Temporarily deactivate RocksDB checkpointing tests --- ...endEventTimeWindowCheckpointingITCase.java | 3 ++ .../PartitionedStateCheckpointingITCase.java | 30 +++++++++---------- ...endEventTimeWindowCheckpointingITCase.java | 3 ++ .../streaming/runtime/PartitionerITCase.java | 1 + 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java index 352f9f7397e839..716a127b0777d8 100644 --- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java +++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java @@ -18,6 +18,9 @@ package org.apache.flink.test.checkpointing; +import org.junit.Ignore; + +@Ignore public class IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase extends AbstractEventTimeWindowCheckpointingITCase { public IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase() { diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/PartitionedStateCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/PartitionedStateCheckpointingITCase.java index 517c82b404146c..358ac9154830d4 100644 --- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/PartitionedStateCheckpointingITCase.java +++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/PartitionedStateCheckpointingITCase.java @@ -18,19 +18,6 @@ package org.apache.flink.test.checkpointing; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Random; -import java.util.concurrent.ConcurrentHashMap; - import org.apache.flink.api.common.functions.RichMapFunction; import org.apache.flink.api.common.state.ValueState; import org.apache.flink.api.common.state.ValueStateDescriptor; @@ -50,6 +37,19 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Random; +import java.util.concurrent.ConcurrentHashMap; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + /** * A simple test that runs a streaming topology with checkpointing enabled. * @@ -88,9 +88,9 @@ public static Collection parameters() throws IOException { syncMemBackend, asyncMemBackend, syncFsBackend, - asyncFsBackend, + asyncFsBackend/**, fullRocksDbBackend, - incRocksDbBackend); + incRocksDbBackend**/); } @Parameterized.Parameter diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java index da2bbc7502e976..02bb749634cdfa 100644 --- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java +++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java @@ -18,6 +18,9 @@ package org.apache.flink.test.checkpointing; +import org.junit.Ignore; + +@Ignore public class RocksDbBackendEventTimeWindowCheckpointingITCase extends AbstractEventTimeWindowCheckpointingITCase { public RocksDbBackendEventTimeWindowCheckpointingITCase() { diff --git a/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/PartitionerITCase.java b/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/PartitionerITCase.java index 3a125bab7d47f4..35e4f9cdeaa215 100644 --- a/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/PartitionerITCase.java +++ b/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/PartitionerITCase.java @@ -30,6 +30,7 @@ import org.apache.flink.test.streaming.runtime.util.NoOpIntMap; import org.apache.flink.test.streaming.runtime.util.TestListResultSink; +import org.junit.Ignore; import org.junit.Test; import java.util.Arrays; From 9c85ed23323cb75f347f44937c48253a76c49d4b Mon Sep 17 00:00:00 2001 From: Kurt Young Date: Sun, 30 Apr 2017 16:56:00 +0800 Subject: [PATCH 002/360] [FLINK-6394] [runtime] Respect object reuse configuration when executing group combining function This closes #3803. --- .../sort/CombiningUnilateralSortMerger.java | 48 +++++++++---- .../util/NonReusingKeyGroupedIterator.java | 1 + .../CombiningUnilateralSortMergerITCase.java | 71 ++++++++++++++++++- 3 files changed, 107 insertions(+), 13 deletions(-) diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/CombiningUnilateralSortMerger.java b/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/CombiningUnilateralSortMerger.java index a02ced2adabbd9..5500f37f10bcee 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/CombiningUnilateralSortMerger.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/CombiningUnilateralSortMerger.java @@ -33,6 +33,7 @@ import org.apache.flink.runtime.memory.MemoryAllocationException; import org.apache.flink.runtime.memory.MemoryManager; import org.apache.flink.runtime.util.EmptyMutableObjectIterator; +import org.apache.flink.runtime.util.NonReusingKeyGroupedIterator; import org.apache.flink.runtime.util.ReusingKeyGroupedIterator; import org.apache.flink.util.Collector; import org.apache.flink.util.MutableObjectIterator; @@ -162,7 +163,8 @@ protected ThreadBase getSpillingThread(ExceptionHandler exceptio List sortReadMemory, List writeMemory, int maxFileHandles) { return new CombiningSpillingThread(exceptionHandler, queues, parentTask, - memoryManager, ioManager, serializerFactory.getSerializer(), comparator, sortReadMemory, writeMemory, maxFileHandles); + memoryManager, ioManager, serializerFactory.getSerializer(), + comparator, sortReadMemory, writeMemory, maxFileHandles, objectReuseEnabled); } // ------------------------------------------------------------------------ @@ -172,16 +174,20 @@ protected ThreadBase getSpillingThread(ExceptionHandler exceptio protected class CombiningSpillingThread extends SpillingThread { private final TypeComparator comparator2; - + + private final boolean objectReuseEnabled; + public CombiningSpillingThread(ExceptionHandler exceptionHandler, CircularQueues queues, AbstractInvokable parentTask, MemoryManager memManager, IOManager ioManager, TypeSerializer serializer, TypeComparator comparator, - List sortReadMemory, List writeMemory, int maxNumFileHandles) + List sortReadMemory, List writeMemory, int maxNumFileHandles, + boolean objectReuseEnabled) { super(exceptionHandler, queues, parentTask, memManager, ioManager, serializer, comparator, sortReadMemory, writeMemory, maxNumFileHandles); this.comparator2 = comparator.duplicate(); + this.objectReuseEnabled = objectReuseEnabled; } /** @@ -315,7 +321,8 @@ else if (element == endMarker()) { // set up the combining helpers final InMemorySorter buffer = element.buffer; - final CombineValueIterator iter = new CombineValueIterator(buffer, this.serializer.createInstance()); + final CombineValueIterator iter = new CombineValueIterator( + buffer, this.serializer.createInstance(), this.objectReuseEnabled); final WriterCollector collector = new WriterCollector(output, this.serializer); int i = 0; @@ -454,7 +461,6 @@ protected ChannelWithBlockCount mergeChannels(List channe // the list with the target iterators final MergeIterator mergeIterator = getMergingIterator(channelIDs, readBuffers, channelAccesses, null); - final ReusingKeyGroupedIterator groupedIter = new ReusingKeyGroupedIterator(mergeIterator, this.serializer, this.comparator2); // create a new channel writer final FileIOChannel.ID mergedChannelID = this.ioManager.createChannel(); @@ -469,8 +475,18 @@ protected ChannelWithBlockCount mergeChannels(List channe // combine and write to disk try { - while (groupedIter.nextKey()) { - combineStub.combine(groupedIter.getValues(), collector); + if (objectReuseEnabled) { + final ReusingKeyGroupedIterator groupedIter = new ReusingKeyGroupedIterator<>( + mergeIterator, this.serializer, this.comparator2); + while (groupedIter.nextKey()) { + combineStub.combine(groupedIter.getValues(), collector); + } + } else { + final NonReusingKeyGroupedIterator groupedIter = new NonReusingKeyGroupedIterator<>( + mergeIterator, this.comparator2); + while (groupedIter.nextKey()) { + combineStub.combine(groupedIter.getValues(), collector); + } } } catch (Exception e) { @@ -505,7 +521,9 @@ private static final class CombineValueIterator implements Iterator, Itera private final InMemorySorter buffer; // the buffer from which values are returned - private E record; + private E recordReuse; + + private final boolean objectReuseEnabled; private int last; // the position of the last value to be returned @@ -519,9 +537,10 @@ private static final class CombineValueIterator implements Iterator, Itera * @param buffer * The buffer to get the values from. */ - public CombineValueIterator(InMemorySorter buffer, E instance) { + public CombineValueIterator(InMemorySorter buffer, E instance, boolean objectReuseEnabled) { this.buffer = buffer; - this.record = instance; + this.recordReuse = instance; + this.objectReuseEnabled = objectReuseEnabled; } /** @@ -547,9 +566,14 @@ public boolean hasNext() { public E next() { if (this.position <= this.last) { try { - this.record = this.buffer.getRecord(this.record, this.position); + E record; + if (objectReuseEnabled) { + record = this.buffer.getRecord(this.recordReuse, this.position); + } else { + record = this.buffer.getRecord(this.position); + } this.position++; - return this.record; + return record; } catch (IOException ioex) { LOG.error("Error retrieving a value from a buffer.", ioex); diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/util/NonReusingKeyGroupedIterator.java b/flink-runtime/src/main/java/org/apache/flink/runtime/util/NonReusingKeyGroupedIterator.java index 6f4448c9b33bc8..221cf243d40a21 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/util/NonReusingKeyGroupedIterator.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/util/NonReusingKeyGroupedIterator.java @@ -164,6 +164,7 @@ public TypeComparator getComparatorWithCurrentReference() { * * @return Iterator over all values that belong to the current key. */ + @Override public ValuesIterator getValues() { return this.valuesIterator; } diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/operators/sort/CombiningUnilateralSortMergerITCase.java b/flink-runtime/src/test/java/org/apache/flink/runtime/operators/sort/CombiningUnilateralSortMergerITCase.java index fba0a6fd7f8f3b..fa675f69e24c3c 100644 --- a/flink-runtime/src/test/java/org/apache/flink/runtime/operators/sort/CombiningUnilateralSortMergerITCase.java +++ b/flink-runtime/src/test/java/org/apache/flink/runtime/operators/sort/CombiningUnilateralSortMergerITCase.java @@ -19,6 +19,7 @@ package org.apache.flink.runtime.operators.sort; import java.io.IOException; +import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.NoSuchElementException; @@ -183,6 +184,42 @@ public void testCombineSpilling() throws Exception { Assert.assertTrue(comb.opened == comb.closed); } + @Test + public void testCombineSpillingDisableObjectReuse() throws Exception { + int noKeys = 100; + int noKeyCnt = 10000; + + TestData.MockTuple2Reader> reader = TestData.getIntIntTupleReader(); + + LOG.debug("initializing sortmerger"); + + MaterializedCountCombiner comb = new MaterializedCountCombiner(); + + // set maxNumFileHandles = 2 to trigger multiple channel merging + Sorter> merger = new CombiningUnilateralSortMerger<>(comb, + this.memoryManager, this.ioManager, reader, this.parentTask, this.serializerFactory2, this.comparator2, + 0.01, 2, 0.005f, true /* use large record handler */, false); + + final Tuple2 rec = new Tuple2<>(); + + for (int i = 0; i < noKeyCnt; i++) { + rec.setField(i, 0); + for (int j = 0; j < noKeys; j++) { + rec.setField(j, 1); + reader.emit(rec); + } + } + reader.close(); + + MutableObjectIterator> iterator = merger.getIterator(); + Iterator result = getReducingIterator(iterator, serializerFactory2.getSerializer(), comparator2.duplicate()); + while (result.hasNext()) { + Assert.assertEquals(4950, result.next().intValue()); + } + + merger.close(); + } + @Test public void testSortAndValidate() throws Exception { @@ -332,7 +369,39 @@ public void close() throws Exception { closed = true; } } - + + // -------------------------------------------------------------------------------------------- + + public static class MaterializedCountCombiner + extends RichGroupReduceFunction, Tuple2> + implements GroupCombineFunction, Tuple2> + { + private static final long serialVersionUID = 1L; + + @Override + public void combine(Iterable> values, Collector> out) { + ArrayList> valueList = new ArrayList<>(); + for (Tuple2 next : values) { + valueList.add(next); + } + + int count = 0; + Tuple2 rec = new Tuple2<>(); + for (Tuple2 tuple : valueList) { + rec.setField(tuple.f0, 0); + count += tuple.f1; + } + rec.setField(count, 1); + out.collect(rec); + } + + @Override + public void reduce(Iterable> values, + Collector> out) throws Exception + { + } + } + private static Iterator getReducingIterator(MutableObjectIterator> data, TypeSerializer> serializer, TypeComparator> comparator) { final ReusingKeyGroupedIterator> groupIter = new ReusingKeyGroupedIterator<> (data, serializer, comparator); From 8dd05c0530c87ed85703c396ac7dccee1fc86ac3 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Tue, 9 May 2017 11:23:30 +0200 Subject: [PATCH 003/360] [FLINK-6506] [build] Tests in flink-tests exceed memory resources on containerized Travis --- flink-tests/pom.xml | 3 +++ tools/travis_mvn_watchdog.sh | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/flink-tests/pom.xml b/flink-tests/pom.xml index e5e3e891cf924c..b17ef04c381d49 100644 --- a/flink-tests/pom.xml +++ b/flink-tests/pom.xml @@ -342,6 +342,9 @@ under the License. org.apache.curator:curator-client org.apache.curator:curator-framework + + ${flink.forkCountTestPackage} false diff --git a/tools/travis_mvn_watchdog.sh b/tools/travis_mvn_watchdog.sh index 20afa87a831955..d747f911471deb 100755 --- a/tools/travis_mvn_watchdog.sh +++ b/tools/travis_mvn_watchdog.sh @@ -45,7 +45,7 @@ LOG4J_PROPERTIES=${HERE}/log4j-travis.properties # Maven command to run. We set the forkCount manually, because otherwise Maven sees too many cores # on the Travis VMs. -MVN="mvn -Dflink.forkCount=2 -B $PROFILE -Dlog.dir=${ARTIFACTS_DIR} -Dlog4j.configuration=file://$LOG4J_PROPERTIES clean install" +MVN="mvn -Dflink.forkCount=2 -Dflink.forkCountTestPackage=1 -B $PROFILE -Dlog.dir=${ARTIFACTS_DIR} -Dlog4j.configuration=file://$LOG4J_PROPERTIES clean install" MVN_PID="${ARTIFACTS_DIR}/watchdog.mvn.pid" MVN_EXIT="${ARTIFACTS_DIR}/watchdog.mvn.exit" @@ -75,6 +75,7 @@ upload_artifacts_s3() { echo "COMPRESSING build artifacts." cd $ARTIFACTS_DIR + dmesg > container.log tar -zcvf $ARTIFACTS_FILE * # Upload to secured S3 From 77d57f1be05ee35c7f097a6e06e79d99c16d9d0c Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Tue, 9 May 2017 11:25:28 +0200 Subject: [PATCH 004/360] [hotfix] Revert: Temporarily deactivate RocksDB checkpointing tests --- ...endEventTimeWindowCheckpointingITCase.java | 3 -- .../PartitionedStateCheckpointingITCase.java | 30 +++++++++---------- ...endEventTimeWindowCheckpointingITCase.java | 3 -- .../streaming/runtime/PartitionerITCase.java | 1 - 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java index 716a127b0777d8..352f9f7397e839 100644 --- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java +++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase.java @@ -18,9 +18,6 @@ package org.apache.flink.test.checkpointing; -import org.junit.Ignore; - -@Ignore public class IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase extends AbstractEventTimeWindowCheckpointingITCase { public IncrementalRocksDbBackendEventTimeWindowCheckpointingITCase() { diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/PartitionedStateCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/PartitionedStateCheckpointingITCase.java index 358ac9154830d4..517c82b404146c 100644 --- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/PartitionedStateCheckpointingITCase.java +++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/PartitionedStateCheckpointingITCase.java @@ -18,6 +18,19 @@ package org.apache.flink.test.checkpointing; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Random; +import java.util.concurrent.ConcurrentHashMap; + import org.apache.flink.api.common.functions.RichMapFunction; import org.apache.flink.api.common.state.ValueState; import org.apache.flink.api.common.state.ValueStateDescriptor; @@ -37,19 +50,6 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Random; -import java.util.concurrent.ConcurrentHashMap; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - /** * A simple test that runs a streaming topology with checkpointing enabled. * @@ -88,9 +88,9 @@ public static Collection parameters() throws IOException { syncMemBackend, asyncMemBackend, syncFsBackend, - asyncFsBackend/**, + asyncFsBackend, fullRocksDbBackend, - incRocksDbBackend**/); + incRocksDbBackend); } @Parameterized.Parameter diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java index 02bb749634cdfa..da2bbc7502e976 100644 --- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java +++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/RocksDbBackendEventTimeWindowCheckpointingITCase.java @@ -18,9 +18,6 @@ package org.apache.flink.test.checkpointing; -import org.junit.Ignore; - -@Ignore public class RocksDbBackendEventTimeWindowCheckpointingITCase extends AbstractEventTimeWindowCheckpointingITCase { public RocksDbBackendEventTimeWindowCheckpointingITCase() { diff --git a/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/PartitionerITCase.java b/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/PartitionerITCase.java index 35e4f9cdeaa215..3a125bab7d47f4 100644 --- a/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/PartitionerITCase.java +++ b/flink-tests/src/test/java/org/apache/flink/test/streaming/runtime/PartitionerITCase.java @@ -30,7 +30,6 @@ import org.apache.flink.test.streaming.runtime.util.NoOpIntMap; import org.apache.flink.test.streaming.runtime.util.TestListResultSink; -import org.junit.Ignore; import org.junit.Test; import java.util.Arrays; From 21961481e6fd53f001158b1348f9ff8ea7eab4a3 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 4 May 2017 13:51:36 +0200 Subject: [PATCH 005/360] [FLINK-5742] [docs] allow sidenav to work for widths down to 992 This closes #3821 --- docs/_layouts/base.html | 4 ++-- docs/page/css/flink.css | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/_layouts/base.html b/docs/_layouts/base.html index 35499cd2867b97..88df5c974487ac 100644 --- a/docs/_layouts/base.html +++ b/docs/_layouts/base.html @@ -69,10 +69,10 @@ the _layouts directory goes here. {% endcomment %}
-
+
{% include sidenav.html %}
-
+
{% if page.mathjax %} {% include latex_commands.html %} {% endif %} diff --git a/docs/page/css/flink.css b/docs/page/css/flink.css index b6d49472535f14..c0a7917e8fe397 100644 --- a/docs/page/css/flink.css +++ b/docs/page/css/flink.css @@ -30,6 +30,11 @@ body { background: #f8f8f8; } +@media (min-width: 992px) and (max-width: 1200px) { + #contentcol { float: left; width: 70%; } + #sidenavcol { float: left; width: 30%; } +} + /*============================================================================= Per page TOC =============================================================================*/ From fd910f2c969b6c8ef555e68532ffad2fbc674828 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 3 May 2017 16:44:03 +0200 Subject: [PATCH 006/360] [FLINK-6438] [docs] Added a few links to the docs home page, and made some other small adjustments. This closes #3823 --- docs/index.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index a74f88028465c6..ef9317fa2eef57 100644 --- a/docs/index.md +++ b/docs/index.md @@ -33,9 +33,13 @@ Apache Flink is an open source platform for distributed stream and batch data pr - **Concepts**: Start with the basic concepts of Flink's [Dataflow Programming Model](concepts/programming-model.html) and [Distributed Runtime Environment](concepts/runtime.html). This will help you to fully understand the other parts of the documentation, including the setup and programming guides. It is highly recommended to read these sections first. -- **Quickstarts**: [Run an example program](quickstart/setup_quickstart.html) on your local machine or [write a simple program](quickstart/run_example_quickstart.html) working on live Wikipedia edits. +- **Quickstarts**: [Run an example program](quickstart/setup_quickstart.html) on your local machine or [study some examples](examples/index.html). -- **Programming Guides**: You can check out our guides about [basic concepts](dev/api_concepts.html) and the [DataStream API](dev/datastream_api.html) or [DataSet API](dev/batch/index.html) to learn how to write your first Flink programs. +- **Programming Guides**: You can check out our guides about [basic API concepts](dev/api_concepts.html) and the [DataStream API](dev/datastream_api.html) or [DataSet API](dev/batch/index.html) to learn how to write your first Flink programs. + +## Deployment + +Before putting your Flink job into production, be sure to read the [Production Readiness Checklist](ops/production_ready.html). ## Migration Guide @@ -44,3 +48,12 @@ While all parts of the API that were marked as public and stable are still suppo newer interfaces where applicable. For users that plan to upgrade a Flink system in production, we recommend reading the guide on [upgrading Apache Flink](ops/upgrading.html). + +## External Resources + +- **Flink Forward**: Talks from past conferences are available at the [Flink Forward](http://flink-forward.org/) website and on [YouTube](https://www.youtube.com/channel/UCY8_lgiZLZErZPF47a2hXMA). [Robust Stream Processing with Apache Flink](http://berlin.flink-forward.org/kb_sessions/robust-stream-processing-with-apache-flink/) is a good place to start. + +- **Training**: The [training materials](http://dataartisans.github.io/flink-training/) from data Artisans include slides, exercises, and sample solutions. + +- **Blogs**: The [Apache Flink](https://flink.apache.org/blog/) and [data Artisans](https://data-artisans.com/blog/) blogs publish frequent, +in-depth technical articles about Flink. From 4556b49c80108e83d67a56ac5039f631dd681a96 Mon Sep 17 00:00:00 2001 From: sunjincheng121 Date: Mon, 8 May 2017 16:41:31 +0800 Subject: [PATCH 007/360] [FLINK-6479] [table] Fix IOOBE in DataStreamGroupWindowAggregate. This closes #3841. --- .../DataStreamGroupWindowAggregate.scala | 2 +- .../table/GroupWindowAggregationsITCase.scala | 32 +++++++++++++++ .../scala/stream/table/GroupWindowTest.scala | 41 ++++++++++++++++++- 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamGroupWindowAggregate.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamGroupWindowAggregate.scala index 1be1896a96fdf9..c38e5af5607683 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamGroupWindowAggregate.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamGroupWindowAggregate.scala @@ -134,7 +134,7 @@ class DataStreamGroupWindowAggregate( namedAggregates, namedProperties) - val keyedAggOpName = s"groupBy: (${groupingToString(schema.logicalType, grouping)}), " + + val keyedAggOpName = s"groupBy: (${groupingToString(inputSchema.logicalType, grouping)}), " + s"window: ($window), " + s"select: ($aggString)" val nonKeyedAggOpName = s"window: ($window), select: ($aggString)" diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/table/GroupWindowAggregationsITCase.scala b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/table/GroupWindowAggregationsITCase.scala index 2c027a9046d4d1..846fe3e83991c1 100644 --- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/table/GroupWindowAggregationsITCase.scala +++ b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/table/GroupWindowAggregationsITCase.scala @@ -175,6 +175,38 @@ class GroupWindowAggregationsITCase extends StreamingMultipleProgramsTestBase { "Hi,1,1,1,1,1,1,1,1970-01-01 00:00:00.0,1970-01-01 00:00:00.005") assertEquals(expected.sorted, StreamITCase.testResults.sorted) } + + @Test + def testGroupWindowWithoutKeyInProjection(): Unit = { + val data = List( + (1L, 1, "Hi", 1, 1), + (2L, 2, "Hello", 2, 2), + (4L, 2, "Hello", 2, 2), + (8L, 3, "Hello world", 3, 3), + (16L, 3, "Hello world", 3, 3)) + + val env = StreamExecutionEnvironment.getExecutionEnvironment + env.setParallelism(1) + val tEnv = TableEnvironment.getTableEnvironment(env) + StreamITCase.testResults = mutable.MutableList() + + val stream = env.fromCollection(data) + val table = stream.toTable(tEnv, 'long, 'int, 'string, 'int2, 'int3, 'proctime.proctime) + + val weightAvgFun = new WeightedAvg + + val windowedTable = table + .window(Slide over 2.rows every 1.rows on 'proctime as 'w) + .groupBy('w, 'int2, 'int3, 'string) + .select(weightAvgFun('long, 'int)) + + val results = windowedTable.toDataStream[Row] + results.addSink(new StreamITCase.StringSink) + env.execute() + + val expected = Seq("12", "8", "2", "3", "1") + assertEquals(expected.sorted, StreamITCase.testResults.sorted) + } } object GroupWindowAggregationsITCase { diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/table/GroupWindowTest.scala b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/table/GroupWindowTest.scala index 0573ff33231596..ef071b777f8aa1 100644 --- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/table/GroupWindowTest.scala +++ b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/table/GroupWindowTest.scala @@ -19,7 +19,7 @@ package org.apache.flink.table.api.scala.stream.table import org.apache.flink.api.scala._ -import org.apache.flink.table.api.java.utils.UserDefinedAggFunctions.WeightedAvgWithMerge +import org.apache.flink.table.api.java.utils.UserDefinedAggFunctions.{WeightedAvg, WeightedAvgWithMerge} import org.apache.flink.table.api.ValidationException import org.apache.flink.table.api.scala._ import org.apache.flink.table.expressions.WindowReference @@ -791,6 +791,45 @@ class GroupWindowTest extends TableTestBase { util.verifyTable(windowedTable, expected) } + @Test + def testSlidingWindowWithUDAF(): Unit = { + val util = streamTestUtil() + val table = util.addTable[(Long, Int, String, Int, Int)]( + 'long, + 'int, + 'string, + 'int2, + 'int3, + 'proctime.proctime) + + val weightAvgFun = new WeightedAvg + + val windowedTable = table + .window(Slide over 2.rows every 1.rows on 'proctime as 'w) + .groupBy('w, 'int2, 'int3, 'string) + .select(weightAvgFun('long, 'int)) + + val expected = + unaryNode( + "DataStreamCalc", + unaryNode( + "DataStreamGroupWindowAggregate", + streamTableNode(0), + term("groupBy", "string, int2, int3"), + term("window", SlidingGroupWindow(WindowReference("w"), 'proctime, 2.rows, 1.rows)), + term( + "select", + "string", + "int2", + "int3", + "WeightedAvg(long, int) AS TMP_0") + ), + term("select","TMP_0") + ) + + util.verifyTable(windowedTable, expected) + } + @Test def testSlideWindowStartEnd(): Unit = { val util = streamTestUtil() From 34cff3563357bbcac8d516391e03feb37c89641b Mon Sep 17 00:00:00 2001 From: godfreyhe Date: Wed, 3 May 2017 20:59:34 +0800 Subject: [PATCH 008/360] [FLINK-6436] [table] Fix code-gen bug when using a scalar UDF in a UDTF join condition. This closes #3815. --- .../table/plan/nodes/CommonCorrelate.scala | 13 +++++++++- .../utils/UserDefinedScalarFunctions.scala | 9 +++++-- .../DataSetUserDefinedFunctionITCase.scala | 24 ++++++++++++++++--- .../DataStreamUserDefinedFunctionITCase.scala | 22 +++++++++++++++-- 4 files changed, 60 insertions(+), 8 deletions(-) diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/CommonCorrelate.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/CommonCorrelate.scala index 44a109e3b2b028..c95f2f78d29c12 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/CommonCorrelate.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/CommonCorrelate.scala @@ -18,7 +18,7 @@ package org.apache.flink.table.plan.nodes import org.apache.calcite.rel.`type`.RelDataType -import org.apache.calcite.rex.{RexCall, RexNode} +import org.apache.calcite.rex.{RexCall, RexInputRef, RexNode, RexShuttle} import org.apache.calcite.sql.SemiJoinType import org.apache.flink.api.common.functions.FlatMapFunction import org.apache.flink.api.common.typeinfo.TypeInformation @@ -143,6 +143,17 @@ trait CommonCorrelate[T] { |getCollector().collect(${crossResultExpr.resultTerm}); |""".stripMargin } else { + + // adjust indicies of InputRefs to adhere to schema expected by generator + val changeInputRefIndexShuttle = new RexShuttle { + override def visitInputRef(inputRef: RexInputRef): RexNode = { + new RexInputRef(inputSchema.physicalArity + inputRef.getIndex, inputRef.getType) + } + } + // Run generateExpression to add init statements (ScalarFunctions) of condition to generator. + // The generated expression is discarded. + generator.generateExpression(condition.get.accept(changeInputRefIndexShuttle)) + val filterGenerator = new CodeGenerator(config, false, udtfTypeInfo, None, pojoFieldMapping) filterGenerator.input1Term = filterGenerator.input2Term val filterCondition = filterGenerator.generateExpression(condition.get) diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/utils/UserDefinedScalarFunctions.scala b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/utils/UserDefinedScalarFunctions.scala index 8972a7719ca5f6..528556968bf56f 100644 --- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/utils/UserDefinedScalarFunctions.scala +++ b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/utils/UserDefinedScalarFunctions.scala @@ -25,11 +25,10 @@ import org.apache.flink.table.api.Types import org.apache.flink.table.functions.{ScalarFunction, FunctionContext} import org.junit.Assert +import scala.annotation.varargs import scala.collection.mutable import scala.io.Source -import scala.annotation.varargs - case class SimplePojo(name: String, age: Int) object Func0 extends ScalarFunction { @@ -263,3 +262,9 @@ object Func17 extends ScalarFunction { a.mkString(", ") } } + +object Func18 extends ScalarFunction { + def eval(str: String, prefix: String): Boolean = { + str.startsWith(prefix) + } +} diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/dataset/DataSetUserDefinedFunctionITCase.scala b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/dataset/DataSetUserDefinedFunctionITCase.scala index 20bbf8b3aa47f7..b69dd494f8f74b 100644 --- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/dataset/DataSetUserDefinedFunctionITCase.scala +++ b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/dataset/DataSetUserDefinedFunctionITCase.scala @@ -24,9 +24,9 @@ import org.apache.flink.api.scala.util.CollectionDataSets import org.apache.flink.table.api.TableEnvironment import org.apache.flink.table.api.java.utils.UserDefinedTableFunctions.JavaTableFunc0 import org.apache.flink.table.api.scala._ -import org.apache.flink.table.api.scala.batch.utils.TableProgramsTestBase.TableConfigMode import org.apache.flink.table.api.scala.batch.utils.TableProgramsClusterTestBase -import org.apache.flink.table.expressions.utils.{Func13, RichFunc2} +import org.apache.flink.table.api.scala.batch.utils.TableProgramsTestBase.TableConfigMode +import org.apache.flink.table.expressions.utils.{Func1, Func13, Func18, RichFunc2} import org.apache.flink.table.utils._ import org.apache.flink.test.util.MultipleProgramsTestBase.TestExecutionMode import org.apache.flink.test.util.TestBaseUtils @@ -143,7 +143,7 @@ class DataSetUserDefinedFunctionITCase( val pojo = new PojoTableFunc() val result = in .join(pojo('c)) - .where(('age > 20)) + .where('age > 20) .select('c, 'name, 'age) .toDataSet[Row] @@ -170,6 +170,24 @@ class DataSetUserDefinedFunctionITCase( TestBaseUtils.compareResultAsText(results.asJava, expected) } + @Test + def testUserDefinedTableFunctionWithScalarFunctionInCondition(): Unit = { + val env = ExecutionEnvironment.getExecutionEnvironment + val tableEnv = TableEnvironment.getTableEnvironment(env, config) + val in = testData(env).toTable(tableEnv).as('a, 'b, 'c) + val func0 = new TableFunc0 + + val result = in + .join(func0('c)) + .where(Func18('name, "J") && (Func1('a) < 3) && Func1('age) > 20) + .select('c, 'name, 'age) + .toDataSet[Row] + + val results = result.collect() + val expected = "Jack#22,Jack,22" + TestBaseUtils.compareResultAsText(results.asJava, expected) + } + @Test def testLongAndTemporalTypes(): Unit = { val env = ExecutionEnvironment.getExecutionEnvironment diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/datastream/DataStreamUserDefinedFunctionITCase.scala b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/datastream/DataStreamUserDefinedFunctionITCase.scala index 2e8a065e79c428..b3d9c6f7e95e67 100644 --- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/datastream/DataStreamUserDefinedFunctionITCase.scala +++ b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/datastream/DataStreamUserDefinedFunctionITCase.scala @@ -23,7 +23,7 @@ import org.apache.flink.streaming.util.StreamingMultipleProgramsTestBase import org.apache.flink.table.api.TableEnvironment import org.apache.flink.table.api.scala._ import org.apache.flink.table.api.scala.stream.utils.{StreamITCase, StreamTestData} -import org.apache.flink.table.expressions.utils.{Func13, RichFunc2} +import org.apache.flink.table.expressions.utils.{Func13, Func18, RichFunc2} import org.apache.flink.table.utils._ import org.apache.flink.types.Row import org.junit.Assert._ @@ -51,7 +51,7 @@ class DataStreamUserDefinedFunctionITCase extends StreamingMultipleProgramsTestB .join(func0('c) as('d, 'e)) .select('c, 'd, 'e) .join(pojoFunc0('c)) - .where(('age > 20)) + .where('age > 20) .select('c, 'name, 'age) .toDataStream[Row] @@ -81,6 +81,24 @@ class DataStreamUserDefinedFunctionITCase extends StreamingMultipleProgramsTestB assertEquals(expected.sorted, StreamITCase.testResults.sorted) } + @Test + def testUserDefinedTableFunctionWithScalarFunction(): Unit = { + val t = testData(env).toTable(tEnv).as('a, 'b, 'c) + val func0 = new TableFunc0 + + val result = t + .join(func0('c) as('d, 'e)) + .where(Func18('d, "J")) + .select('c, 'd, 'e) + .toDataStream[Row] + + result.addSink(new StreamITCase.StringSink) + env.execute() + + val expected = mutable.MutableList("Jack#22,Jack,22", "John#19,John,19") + assertEquals(expected.sorted, StreamITCase.testResults.sorted) + } + @Test def testUserDefinedTableFunctionWithParameter(): Unit = { val tableFunc1 = new RichTableFunc1 From dd799c746cc464550222b9b126e3f60c5259df9f Mon Sep 17 00:00:00 2001 From: Hequn Cheng Date: Mon, 8 May 2017 20:55:51 +0800 Subject: [PATCH 009/360] [FLINK-6486] [table] Pass RowTypeInfo to CodeGenerator instead of CRowTypeInfo. This closes #3850. --- .../table/plan/nodes/datastream/DataStreamGroupAggregate.scala | 2 +- .../plan/nodes/datastream/DataStreamGroupWindowAggregate.scala | 2 +- .../table/plan/nodes/datastream/DataStreamOverAggregate.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamGroupAggregate.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamGroupAggregate.scala index 18f1fc89b76edd..506c0cb930c86b 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamGroupAggregate.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamGroupAggregate.scala @@ -115,7 +115,7 @@ class DataStreamGroupAggregate( val generator = new CodeGenerator( tableEnv.getConfig, false, - inputDS.getType) + inputSchema.physicalTypeInfo) val aggString = aggregationToString( inputSchema.logicalType, diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamGroupWindowAggregate.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamGroupWindowAggregate.scala index c38e5af5607683..ef207b0adba25e 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamGroupWindowAggregate.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamGroupWindowAggregate.scala @@ -142,7 +142,7 @@ class DataStreamGroupWindowAggregate( val generator = new CodeGenerator( tableEnv.getConfig, false, - inputDS.getType) + inputSchema.physicalTypeInfo) val needMerge = window match { case SessionGroupWindow(_, _, _) => true diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamOverAggregate.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamOverAggregate.scala index e823cd6a5b9b91..40612421a65fb2 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamOverAggregate.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamOverAggregate.scala @@ -116,7 +116,7 @@ class DataStreamOverAggregate( val generator = new CodeGenerator( tableEnv.getConfig, false, - inputDS.getType) + inputSchema.physicalTypeInfo) val timeType = schema.logicalType .getFieldList From 28a89d1cac79063245bbc1ad9d262e3bc94b17b9 Mon Sep 17 00:00:00 2001 From: rtudoran Date: Mon, 8 May 2017 20:30:57 +0200 Subject: [PATCH 010/360] [FLINK-6476] [table] Add support to convert DataSet[Row] and DataStream[Row] to Table. This closes #3849. --- .../flink/table/api/TableEnvironment.scala | 18 ++++++++ .../table/api/java/stream/sql/SqlITCase.java | 42 +++++++++++++++++++ .../flink/table/TableEnvironmentTest.scala | 22 ++++++++++ .../api/scala/stream/sql/SqlITCase.scala | 36 ++++++++++++++++ 4 files changed, 118 insertions(+) diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/TableEnvironment.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/TableEnvironment.scala index bb0de3e529037e..bf4a8e072037a1 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/TableEnvironment.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/TableEnvironment.scala @@ -63,6 +63,7 @@ import org.apache.flink.table.sinks.TableSink import org.apache.flink.table.sources.{DefinedFieldNames, TableSource} import org.apache.flink.table.validate.FunctionCatalog import org.apache.flink.types.Row +import org.apache.flink.api.java.typeutils.RowTypeInfo import _root_.scala.collection.JavaConverters._ import _root_.scala.collection.mutable.HashMap @@ -677,6 +678,23 @@ abstract class TableEnvironment(val config: TableConfig) { case _ => throw new TableException( "Field reference expression or alias on field expression expected.") } + case r: RowTypeInfo => { + exprs.zipWithIndex flatMap { + case (UnresolvedFieldReference(name), idx) => + Some((idx, name)) + case (Alias(UnresolvedFieldReference(origName), name, _), _) => + val idx = r.getFieldIndex(origName) + if (idx < 0) { + throw new TableException(s"$origName is not a field of type $r") + } + Some((idx, name)) + case (_: TimeAttribute, _) => + None + case _ => throw new TableException( + "Field reference expression or alias on field expression expected.") + } + + } case tpe => throw new TableException( s"Source of type $tpe cannot be converted into Table.") } diff --git a/flink-libraries/flink-table/src/test/java/org/apache/flink/table/api/java/stream/sql/SqlITCase.java b/flink-libraries/flink-table/src/test/java/org/apache/flink/table/api/java/stream/sql/SqlITCase.java index 7c01d2bbfe6181..0c0b37e32acdd3 100644 --- a/flink-libraries/flink-table/src/test/java/org/apache/flink/table/api/java/stream/sql/SqlITCase.java +++ b/flink-libraries/flink-table/src/test/java/org/apache/flink/table/api/java/stream/sql/SqlITCase.java @@ -30,11 +30,53 @@ import org.apache.flink.streaming.util.StreamingMultipleProgramsTestBase; import org.apache.flink.table.api.java.stream.utils.StreamTestData; import org.junit.Test; +import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.RowTypeInfo; import java.util.ArrayList; import java.util.List; public class SqlITCase extends StreamingMultipleProgramsTestBase { + + @Test + public void testRowRegisterRowWithNames() throws Exception { + StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); + StreamTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env); + StreamITCase.clear(); + + List data = new ArrayList<>(); + data.add(Row.of(1, 1L, "Hi")); + data.add(Row.of(2, 2L, "Hello")); + data.add(Row.of(3, 2L, "Hello world")); + + TypeInformation[] types = { + BasicTypeInfo.INT_TYPE_INFO, + BasicTypeInfo.LONG_TYPE_INFO, + BasicTypeInfo.STRING_TYPE_INFO}; + String names[] = {"a","b","c"}; + + RowTypeInfo typeInfo = new RowTypeInfo(types, names); + + DataStream ds = env.fromCollection(data).returns(typeInfo); + + Table in = tableEnv.fromDataStream(ds, "a,b,c"); + tableEnv.registerTable("MyTableRow", in); + + String sqlQuery = "SELECT a,c FROM MyTableRow"; + Table result = tableEnv.sql(sqlQuery); + + DataStream resultSet = tableEnv.toDataStream(result, Row.class); + resultSet.addSink(new StreamITCase.StringSink()); + env.execute(); + + List expected = new ArrayList<>(); + expected.add("1,Hi"); + expected.add("2,Hello"); + expected.add("3,Hello world"); + + StreamITCase.compareWithList(expected); + } @Test public void testSelect() throws Exception { diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/TableEnvironmentTest.scala b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/TableEnvironmentTest.scala index ba3b5918f59588..98a8edbd6f5a66 100644 --- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/TableEnvironmentTest.scala +++ b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/TableEnvironmentTest.scala @@ -53,6 +53,28 @@ class TableEnvironmentTest extends TableTestBase { val genericRowType = new GenericTypeInfo[Row](classOf[Row]) + @Test + def testGetFieldInfoRow(): Unit = { + val fieldInfo = tEnv.getFieldInfo(rowType) + + fieldInfo._1.zip(Array("f0", "f1", "f2")).foreach(x => assertEquals(x._2, x._1)) + fieldInfo._2.zip(Array(0, 1, 2)).foreach(x => assertEquals(x._2, x._1)) + } + + @Test + def testGetFieldInfoRowNames(): Unit = { + val fieldInfo = tEnv.getFieldInfo( + rowType, + Array( + UnresolvedFieldReference("name1"), + UnresolvedFieldReference("name2"), + UnresolvedFieldReference("name3") + )) + + fieldInfo._1.zip(Array("name1", "name2", "name3")).foreach(x => assertEquals(x._2, x._1)) + fieldInfo._2.zip(Array(0, 1, 2)).foreach(x => assertEquals(x._2, x._1)) + } + @Test def testGetFieldInfoTuple(): Unit = { val fieldInfo = tEnv.getFieldInfo(tupleType) diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/sql/SqlITCase.scala b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/sql/SqlITCase.scala index 4147358a7c959d..ba8c1850d14850 100644 --- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/sql/SqlITCase.scala +++ b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/sql/SqlITCase.scala @@ -23,12 +23,48 @@ import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment import org.apache.flink.table.api.TableEnvironment import org.apache.flink.table.api.scala._ import org.apache.flink.table.api.scala.stream.utils.{StreamITCase, StreamTestData, StreamingWithStateTestBase} +import org.apache.flink.api.common.typeinfo.BasicTypeInfo +import org.apache.flink.api.java.typeutils.RowTypeInfo +import org.apache.flink.api.common.typeinfo.TypeInformation import org.apache.flink.types.Row import org.junit.Assert._ import org.junit._ class SqlITCase extends StreamingWithStateTestBase { + /** test row stream registered table **/ + @Test + def testRowRegister(): Unit = { + + val env = StreamExecutionEnvironment.getExecutionEnvironment + val tEnv = TableEnvironment.getTableEnvironment(env) + StreamITCase.clear + + val sqlQuery = "SELECT * FROM MyTableRow WHERE c < 3" + + val data = List( + Row.of("Hello", "Worlds", Int.box(1)), + Row.of("Hello", "Hiden", Int.box(5)), + Row.of("Hello again", "Worlds", Int.box(2))) + + implicit val tpe: TypeInformation[Row] = new RowTypeInfo( + BasicTypeInfo.STRING_TYPE_INFO, + BasicTypeInfo.STRING_TYPE_INFO, + BasicTypeInfo.INT_TYPE_INFO) // tpe is automatically + + val ds = env.fromCollection(data) + + val t = ds.toTable(tEnv).as('a, 'b, 'c) + tEnv.registerTable("MyTableRow", t) + + val result = tEnv.sql(sqlQuery).toDataStream[Row] + result.addSink(new StreamITCase.StringSink) + env.execute() + + val expected = List("Hello,Worlds,1","Hello again,Worlds,2") + assertEquals(expected.sorted, StreamITCase.testResults.sorted) + } + /** test unbounded groupby (without window) **/ @Test def testUnboundedGroupby(): Unit = { From 949d16e8a00656fa1ee1b235c8ca704331b09f55 Mon Sep 17 00:00:00 2001 From: twalthr Date: Wed, 15 Feb 2017 11:05:38 +0100 Subject: [PATCH 011/360] [FLINK-5070] [types] Unable to use Scala's BeanProperty with classes This closes #3318 --- .../api/java/typeutils/TypeExtractor.java | 12 ++------ .../scala/typeutils/TypeExtractionTest.scala | 28 +++++++++++++++---- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java index 2b9eed9e013fa1..a5f236ff62bae0 100644 --- a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java +++ b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java @@ -1711,9 +1711,6 @@ private boolean isValidPojoField(Field f, Class clazz, ArrayList typeHi // return type is same as field type (or the generic variant of it) (m.getGenericReturnType().equals( fieldType ) || (fieldTypeWrapper != null && m.getReturnType().equals( fieldTypeWrapper )) || (fieldTypeGeneric != null && m.getGenericReturnType().equals(fieldTypeGeneric)) ) ) { - if(hasGetter) { - throw new IllegalStateException("Detected more than one getter"); - } hasGetter = true; } // check for setters (_$eq for scala) @@ -1723,9 +1720,6 @@ private boolean isValidPojoField(Field f, Class clazz, ArrayList typeHi // return type is void. m.getReturnType().equals(Void.TYPE) ) { - if(hasSetter) { - throw new IllegalStateException("Detected more than one setter"); - } hasSetter = true; } } @@ -1733,10 +1727,10 @@ private boolean isValidPojoField(Field f, Class clazz, ArrayList typeHi return true; } else { if(!hasGetter) { - LOG.debug(clazz+" does not contain a getter for field "+f.getName() ); + LOG.info(clazz+" does not contain a getter for field "+f.getName() ); } if(!hasSetter) { - LOG.debug(clazz+" does not contain a setter for field "+f.getName() ); + LOG.info(clazz+" does not contain a setter for field "+f.getName() ); } return false; } @@ -1771,7 +1765,7 @@ else if (typeHierarchy.size() <= 1) { for (Field field : fields) { Type fieldType = field.getGenericType(); if(!isValidPojoField(field, clazz, typeHierarchy)) { - LOG.info(clazz + " is not a valid POJO type"); + LOG.info(clazz + " is not a valid POJO type because not all fields are valid POJO fields."); return null; } try { diff --git a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/TypeExtractionTest.scala b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/TypeExtractionTest.scala index 0462ffa5329cc4..d5b7867a20010c 100644 --- a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/TypeExtractionTest.scala +++ b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/TypeExtractionTest.scala @@ -20,22 +20,34 @@ package org.apache.flink.api.scala.typeutils import org.apache.flink.api.common.io.FileInputFormat import org.apache.flink.api.common.typeinfo.{BasicTypeInfo, TypeInformation} -import org.apache.flink.api.java.typeutils.ResultTypeQueryable +import org.apache.flink.api.java.typeutils.{PojoTypeInfo, ResultTypeQueryable} import org.apache.flink.api.scala._ -import org.apache.flink.api.scala.typeutils.TypeExtractionTest.CustomTypeInputFormat +import org.apache.flink.api.scala.typeutils.TypeExtractionTest.{CustomBeanClass, CustomTypeInputFormat} import org.apache.flink.util.TestLogger -import org.junit.Assert.assertEquals +import org.junit.Assert._ import org.junit.Test import org.scalatest.junit.JUnitSuiteLike +import scala.beans.BeanProperty + class TypeExtractionTest extends TestLogger with JUnitSuiteLike { @Test def testResultTypeQueryable(): Unit = { val env = ExecutionEnvironment.getExecutionEnvironment - val productedType = env.createInput(new CustomTypeInputFormat).getType() - assertEquals(productedType, BasicTypeInfo.LONG_TYPE_INFO) + val producedType = env.createInput(new CustomTypeInputFormat).getType() + assertEquals(producedType, BasicTypeInfo.LONG_TYPE_INFO) + } + + @Test + def testBeanPropertyClass(): Unit = { + val env = ExecutionEnvironment.getExecutionEnvironment + val producedType = env.fromElements(new CustomBeanClass()).getType() + assertTrue(producedType.isInstanceOf[PojoTypeInfo[_]]) + val pojoTypeInfo = producedType.asInstanceOf[PojoTypeInfo[_]] + assertEquals(pojoTypeInfo.getTypeAt(0), BasicTypeInfo.INT_TYPE_INFO) + assertEquals(pojoTypeInfo.getTypeAt(1), BasicTypeInfo.LONG_TYPE_INFO) } } @@ -50,4 +62,10 @@ object TypeExtractionTest { override def nextRecord(reuse: String): String = throw new UnsupportedOperationException() } + + class CustomBeanClass( + @BeanProperty var prop: Int, + var prop2: Long) { + def this() = this(0, 0L) + } } From 2e044d468157576fa6dd8946590b4ab684c2c043 Mon Sep 17 00:00:00 2001 From: twalthr Date: Mon, 27 Mar 2017 10:33:58 +0200 Subject: [PATCH 012/360] [FLINK-6157] [core] Make TypeInformation fully serializable This closes #3619. --- flink-connectors/flink-avro/pom.xml | 15 +- .../api/java/typeutils/AvroTypeInfoTest.java | 37 +++++ .../flink-hadoop-compatibility/pom.xml | 13 ++ .../java/typeutils/WritableTypeInfoTest.java | 37 ++--- .../typeinfo/BasicArrayTypeInfoTest.java | 42 +++++ .../common/typeinfo/BasicTypeInfoTest.java | 46 ++++++ .../typeinfo/FractionalTypeInfoTest.java | 35 ++++ .../common/typeinfo/IntegerTypeInfoTest.java | 37 +++++ .../common/typeinfo/NothingTypeInfoTest.java | 34 ++++ .../common/typeinfo/NumericTypeInfoTest.java | 39 +++++ .../typeinfo/PrimitiveArrayTypeInfoTest.java | 41 +++++ .../common/typeinfo/SqlTimeTypeInfoTest.java | 36 ++++ .../typeutils/TypeInformationTestBase.java | 155 ++++++++++++++++++ .../java/typeutils/EitherTypeInfoTest.java | 42 ++--- .../api/java/typeutils/EnumTypeInfoTest.java | 35 ++-- .../java/typeutils/GenericTypeInfoTest.java | 34 ++-- .../java/typeutils/ListTypeInfoTest.java} | 38 ++--- .../api/java/typeutils/MapTypeInfoTest.java | 37 +++++ .../java/typeutils/MissingTypeInfoTest.java | 29 ++-- .../typeutils/ObjectArrayTypeInfoTest.java | 46 ++---- .../api/java/typeutils/PojoTypeInfoTest.java | 82 ++------- .../api/java/typeutils/RowTypeInfoTest.java | 60 ++----- .../api/java/typeutils/TupleTypeInfoTest.java | 49 ++---- .../api/java/typeutils/ValueTypeInfoTest.java | 46 +++--- .../flink/types/BasicArrayTypeInfoTest.java | 56 ------- .../types/PrimitiveArrayTypeInfoTest.java | 56 ------- flink-scala/pom.xml | 13 ++ .../typeutils/CaseClassTypeInfoTest.scala | 51 ++---- .../scala/typeutils/EitherTypeInfoTest.scala | 39 ++--- .../typeutils/EnumValueTypeInfoTest.scala | 36 ++-- .../scala/typeutils/OptionTypeInfoTest.scala | 38 +---- .../typeutils/ScalaNothingTypeInfoTest.scala | 31 ++++ .../typeutils/TraversableTypeInfoTest.scala | 46 ++---- .../api/scala/typeutils/TryTypeInfoTest.scala | 40 +---- .../scala/typeutils/UnitTypeInfoTest.scala | 31 ++++ flink-tests/pom.xml | 33 +++- .../TypeInfoTestCoverageTest.java | 62 +++++++ 37 files changed, 958 insertions(+), 639 deletions(-) create mode 100644 flink-connectors/flink-avro/src/test/java/org/apache/flink/api/java/typeutils/AvroTypeInfoTest.java create mode 100644 flink-core/src/test/java/org/apache/flink/api/common/typeinfo/BasicArrayTypeInfoTest.java create mode 100644 flink-core/src/test/java/org/apache/flink/api/common/typeinfo/BasicTypeInfoTest.java create mode 100644 flink-core/src/test/java/org/apache/flink/api/common/typeinfo/FractionalTypeInfoTest.java create mode 100644 flink-core/src/test/java/org/apache/flink/api/common/typeinfo/IntegerTypeInfoTest.java create mode 100644 flink-core/src/test/java/org/apache/flink/api/common/typeinfo/NothingTypeInfoTest.java create mode 100644 flink-core/src/test/java/org/apache/flink/api/common/typeinfo/NumericTypeInfoTest.java create mode 100644 flink-core/src/test/java/org/apache/flink/api/common/typeinfo/PrimitiveArrayTypeInfoTest.java create mode 100644 flink-core/src/test/java/org/apache/flink/api/common/typeinfo/SqlTimeTypeInfoTest.java create mode 100644 flink-core/src/test/java/org/apache/flink/api/common/typeutils/TypeInformationTestBase.java rename flink-core/src/test/java/org/apache/flink/{types/NothingTypeInfoTest.java => api/java/typeutils/ListTypeInfoTest.java} (53%) create mode 100644 flink-core/src/test/java/org/apache/flink/api/java/typeutils/MapTypeInfoTest.java delete mode 100644 flink-core/src/test/java/org/apache/flink/types/BasicArrayTypeInfoTest.java delete mode 100644 flink-core/src/test/java/org/apache/flink/types/PrimitiveArrayTypeInfoTest.java create mode 100644 flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/ScalaNothingTypeInfoTest.scala create mode 100644 flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/UnitTypeInfoTest.scala create mode 100644 flink-tests/src/test/java/org/apache/flink/test/completeness/TypeInfoTestCoverageTest.java diff --git a/flink-connectors/flink-avro/pom.xml b/flink-connectors/flink-avro/pom.xml index fb44a21ca824b2..76914eed1ac63c 100644 --- a/flink-connectors/flink-avro/pom.xml +++ b/flink-connectors/flink-avro/pom.xml @@ -154,8 +154,21 @@ under the License. + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + - + diff --git a/flink-connectors/flink-avro/src/test/java/org/apache/flink/api/java/typeutils/AvroTypeInfoTest.java b/flink-connectors/flink-avro/src/test/java/org/apache/flink/api/java/typeutils/AvroTypeInfoTest.java new file mode 100644 index 00000000000000..e0bb1a13559651 --- /dev/null +++ b/flink-connectors/flink-avro/src/test/java/org/apache/flink/api/java/typeutils/AvroTypeInfoTest.java @@ -0,0 +1,37 @@ +/* + * 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.flink.api.java.typeutils; + +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; +import org.apache.flink.api.io.avro.generated.Address; +import org.apache.flink.api.io.avro.generated.User; + +/** + * Test for {@link AvroTypeInfo}. + */ +public class AvroTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected AvroTypeInfo[] getTestData() { + return new AvroTypeInfo[] { + new AvroTypeInfo<>(Address.class), + new AvroTypeInfo<>(User.class), + }; + } +} diff --git a/flink-connectors/flink-hadoop-compatibility/pom.xml b/flink-connectors/flink-hadoop-compatibility/pom.xml index 46e20ef656841e..6f2008933d6393 100644 --- a/flink-connectors/flink-hadoop-compatibility/pom.xml +++ b/flink-connectors/flink-hadoop-compatibility/pom.xml @@ -176,6 +176,19 @@ under the License. + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + org.apache.maven.plugins maven-surefire-plugin diff --git a/flink-connectors/flink-hadoop-compatibility/src/test/java/org/apache/flink/api/java/typeutils/WritableTypeInfoTest.java b/flink-connectors/flink-hadoop-compatibility/src/test/java/org/apache/flink/api/java/typeutils/WritableTypeInfoTest.java index eb9cdf0297b00a..666ab8439c1c69 100644 --- a/flink-connectors/flink-hadoop-compatibility/src/test/java/org/apache/flink/api/java/typeutils/WritableTypeInfoTest.java +++ b/flink-connectors/flink-hadoop-compatibility/src/test/java/org/apache/flink/api/java/typeutils/WritableTypeInfoTest.java @@ -18,34 +18,23 @@ package org.apache.flink.api.java.typeutils; -import org.apache.flink.util.TestLogger; -import org.apache.hadoop.io.Writable; -import org.junit.Test; - import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; +import org.apache.hadoop.io.Writable; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; - -public class WritableTypeInfoTest extends TestLogger { - - @Test - public void testWritableTypeInfoEquality() { - WritableTypeInfo tpeInfo1 = new WritableTypeInfo<>(TestClass.class); - WritableTypeInfo tpeInfo2 = new WritableTypeInfo<>(TestClass.class); - - assertEquals(tpeInfo1, tpeInfo2); - assertEquals(tpeInfo1.hashCode(), tpeInfo2.hashCode()); - } - - @Test - public void testWritableTypeInfoInequality() { - WritableTypeInfo tpeInfo1 = new WritableTypeInfo<>(TestClass.class); - WritableTypeInfo tpeInfo2 = new WritableTypeInfo<>(AlternateClass.class); - - assertNotEquals(tpeInfo1, tpeInfo2); +/** + * Test for {@link WritableTypeInfo}. + */ +public class WritableTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected WritableTypeInfo[] getTestData() { + return new WritableTypeInfo[] { + new WritableTypeInfo<>(TestClass.class), + new WritableTypeInfo<>(AlternateClass.class) + }; } // ------------------------------------------------------------------------ diff --git a/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/BasicArrayTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/BasicArrayTypeInfoTest.java new file mode 100644 index 00000000000000..7a51808ad65f84 --- /dev/null +++ b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/BasicArrayTypeInfoTest.java @@ -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. + */ + +package org.apache.flink.api.common.typeinfo; + +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; + +/** + * Test for {@link BasicArrayTypeInfo}. + */ +public class BasicArrayTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected BasicArrayTypeInfo[] getTestData() { + return new BasicArrayTypeInfo[] { + BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO, + BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO, + BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO, + BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO, + BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO, + BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO, + BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO, + BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO, + BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO + }; + } +} diff --git a/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/BasicTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/BasicTypeInfoTest.java new file mode 100644 index 00000000000000..cd4511aeb2dc6c --- /dev/null +++ b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/BasicTypeInfoTest.java @@ -0,0 +1,46 @@ +/* + * 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.flink.api.common.typeinfo; + +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; + +/** + * Test for {@link BasicTypeInfo}. + */ +public class BasicTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected BasicTypeInfo[] getTestData() { + return new BasicTypeInfo[] { + BasicTypeInfo.STRING_TYPE_INFO, + BasicTypeInfo.BOOLEAN_TYPE_INFO, + BasicTypeInfo.BYTE_TYPE_INFO, + BasicTypeInfo.SHORT_TYPE_INFO, + BasicTypeInfo.INT_TYPE_INFO, + BasicTypeInfo.LONG_TYPE_INFO, + BasicTypeInfo.FLOAT_TYPE_INFO, + BasicTypeInfo.DOUBLE_TYPE_INFO, + BasicTypeInfo.CHAR_TYPE_INFO, + BasicTypeInfo.DATE_TYPE_INFO, + BasicTypeInfo.VOID_TYPE_INFO, + BasicTypeInfo.BIG_INT_TYPE_INFO, + BasicTypeInfo.BIG_DEC_TYPE_INFO + }; + } +} diff --git a/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/FractionalTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/FractionalTypeInfoTest.java new file mode 100644 index 00000000000000..87c4db5600dcfc --- /dev/null +++ b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/FractionalTypeInfoTest.java @@ -0,0 +1,35 @@ +/* + * 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.flink.api.common.typeinfo; + +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; + +/** + * Test for {@link FractionalTypeInfo}. + */ +public class FractionalTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected FractionalTypeInfo[] getTestData() { + return new FractionalTypeInfo[] { + (FractionalTypeInfo) BasicTypeInfo.FLOAT_TYPE_INFO, + (FractionalTypeInfo) BasicTypeInfo.DOUBLE_TYPE_INFO + }; + } +} diff --git a/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/IntegerTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/IntegerTypeInfoTest.java new file mode 100644 index 00000000000000..b5fd41f5e58980 --- /dev/null +++ b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/IntegerTypeInfoTest.java @@ -0,0 +1,37 @@ +/* + * 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.flink.api.common.typeinfo; + +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; + +/** + * Test for {@link IntegerTypeInfo}. + */ +public class IntegerTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected IntegerTypeInfo[] getTestData() { + return new IntegerTypeInfo[] { + (IntegerTypeInfo) BasicTypeInfo.BYTE_TYPE_INFO, + (IntegerTypeInfo) BasicTypeInfo.SHORT_TYPE_INFO, + (IntegerTypeInfo) BasicTypeInfo.INT_TYPE_INFO, + (IntegerTypeInfo) BasicTypeInfo.LONG_TYPE_INFO + }; + } +} diff --git a/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/NothingTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/NothingTypeInfoTest.java new file mode 100644 index 00000000000000..a4771db6cd4b6e --- /dev/null +++ b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/NothingTypeInfoTest.java @@ -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. + */ + +package org.apache.flink.api.common.typeinfo; + +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; + +/** + * Test for {@link NothingTypeInfo}. + */ +public class NothingTypeInfoTest extends TypeInformationTestBase { + + @Override + protected NothingTypeInfo[] getTestData() { + return new NothingTypeInfo[] { + new NothingTypeInfo() + }; + } +} diff --git a/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/NumericTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/NumericTypeInfoTest.java new file mode 100644 index 00000000000000..49dd722275c108 --- /dev/null +++ b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/NumericTypeInfoTest.java @@ -0,0 +1,39 @@ +/* + * 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.flink.api.common.typeinfo; + +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; + +/** + * Test for {@link NumericTypeInfo}. + */ +public class NumericTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected NumericTypeInfo[] getTestData() { + return new NumericTypeInfo[] { + (NumericTypeInfo) BasicTypeInfo.BYTE_TYPE_INFO, + (NumericTypeInfo) BasicTypeInfo.SHORT_TYPE_INFO, + (NumericTypeInfo) BasicTypeInfo.INT_TYPE_INFO, + (NumericTypeInfo) BasicTypeInfo.LONG_TYPE_INFO, + (NumericTypeInfo) BasicTypeInfo.FLOAT_TYPE_INFO, + (NumericTypeInfo) BasicTypeInfo.DOUBLE_TYPE_INFO + }; + } +} diff --git a/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/PrimitiveArrayTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/PrimitiveArrayTypeInfoTest.java new file mode 100644 index 00000000000000..867ccad1a6c760 --- /dev/null +++ b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/PrimitiveArrayTypeInfoTest.java @@ -0,0 +1,41 @@ +/* + * 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.flink.api.common.typeinfo; + +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; + +/** + * Test for {@link PrimitiveArrayTypeInfoTest}. + */ +public class PrimitiveArrayTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected PrimitiveArrayTypeInfo[] getTestData() { + return new PrimitiveArrayTypeInfo[] { + PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO, + PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO, + PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO, + PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO, + PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO, + PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO, + PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO, + PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO + }; + } +} diff --git a/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/SqlTimeTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/SqlTimeTypeInfoTest.java new file mode 100644 index 00000000000000..892ab2b7fe0aff --- /dev/null +++ b/flink-core/src/test/java/org/apache/flink/api/common/typeinfo/SqlTimeTypeInfoTest.java @@ -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.flink.api.common.typeinfo; + +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; + +/** + * Test for {@link SqlTimeTypeInfo}. + */ +public class SqlTimeTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected SqlTimeTypeInfo[] getTestData() { + return new SqlTimeTypeInfo[] { + SqlTimeTypeInfo.DATE, + SqlTimeTypeInfo.TIME, + SqlTimeTypeInfo.TIMESTAMP + }; + } +} diff --git a/flink-core/src/test/java/org/apache/flink/api/common/typeutils/TypeInformationTestBase.java b/flink-core/src/test/java/org/apache/flink/api/common/typeutils/TypeInformationTestBase.java new file mode 100644 index 00000000000000..bd35070a0d522f --- /dev/null +++ b/flink-core/src/test/java/org/apache/flink/api/common/typeutils/TypeInformationTestBase.java @@ -0,0 +1,155 @@ +/* + * 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.flink.api.common.typeutils; + +import java.io.IOException; +import org.apache.flink.api.common.ExecutionConfig; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.util.InstantiationUtil; +import org.apache.flink.util.TestLogger; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +/** + * Abstract test base for type information. + */ +public abstract class TypeInformationTestBase> extends TestLogger { + + protected abstract T[] getTestData(); + + @Test + public void testHashcodeAndEquals() throws Exception { + final T[] testData = getTestData(); + final TypeInformation unrelatedTypeInfo = new UnrelatedTypeInfo(); + + for (T typeInfo : testData) { + // check for implemented hashCode and equals + if (typeInfo.getClass().getMethod("hashCode").getDeclaringClass() == Object.class) { + throw new AssertionError("Type information does not implement own hashCode method: " + + typeInfo.getClass().getCanonicalName()); + } + if (typeInfo.getClass().getMethod("equals", Object.class).getDeclaringClass() == Object.class) { + throw new AssertionError("Type information does not implement own equals method: " + + typeInfo.getClass().getCanonicalName()); + } + + // compare among test data + for (T otherTypeInfo : testData) { + assertTrue("canEqual() returns inconsistent results.", typeInfo.canEqual(otherTypeInfo)); + // test equality + if (typeInfo == otherTypeInfo) { + assertTrue("hashCode() returns inconsistent results.", typeInfo.hashCode() == otherTypeInfo.hashCode()); + assertEquals("equals() is false for same object.", typeInfo, otherTypeInfo); + } + // test inequality + else { + assertNotEquals("equals() returned true for different objects.", typeInfo, otherTypeInfo); + } + } + + // compare with unrelated type + assertFalse("Type information allows to compare with unrelated type.", typeInfo.canEqual(unrelatedTypeInfo)); + assertNotEquals(typeInfo, unrelatedTypeInfo); + } + } + + @Test + public void testSerialization() { + final T[] testData = getTestData(); + + for (T typeInfo : testData) { + final byte[] serialized; + try { + serialized = InstantiationUtil.serializeObject(typeInfo); + } catch (IOException e) { + throw new AssertionError("Could not serialize type information: " + typeInfo, e); + } + final T deserialized; + try { + deserialized = InstantiationUtil.deserializeObject(serialized, getClass().getClassLoader()); + } catch (IOException | ClassNotFoundException e) { + throw new AssertionError("Could not deserialize type information: " + typeInfo, e); + } + if (typeInfo.hashCode() != deserialized.hashCode() || !typeInfo.equals(deserialized)) { + throw new AssertionError("Deserialized type information differs from original one."); + } + } + } + + private static class UnrelatedTypeInfo extends TypeInformation { + + @Override + public boolean isBasicType() { + return false; + } + + @Override + public boolean isTupleType() { + return false; + } + + @Override + public int getArity() { + return 0; + } + + @Override + public int getTotalFields() { + return 0; + } + + @Override + public Class getTypeClass() { + return null; + } + + @Override + public boolean isKeyType() { + return false; + } + + @Override + public TypeSerializer createSerializer(ExecutionConfig config) { + return null; + } + + @Override + public String toString() { + return null; + } + + @Override + public boolean equals(Object obj) { + return false; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public boolean canEqual(Object obj) { + return false; + } + } +} diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/EitherTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/EitherTypeInfoTest.java index 13009eef69933b..a5e340e86d2aa7 100644 --- a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/EitherTypeInfoTest.java +++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/EitherTypeInfoTest.java @@ -18,37 +18,21 @@ package org.apache.flink.api.java.typeutils; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; - import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; import org.apache.flink.api.java.tuple.Tuple2; -import org.apache.flink.util.TestLogger; -import org.junit.Test; - -public class EitherTypeInfoTest extends TestLogger { - - @Test - public void testEitherTypeEquality() { - EitherTypeInfo eitherInfo1 = new EitherTypeInfo( - BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO); - EitherTypeInfo eitherInfo2 = new EitherTypeInfo( - BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO); - - assertEquals(eitherInfo1, eitherInfo2); - assertEquals(eitherInfo1.hashCode(), eitherInfo2.hashCode()); - } - - @Test - public void testEitherTypeInequality() { - EitherTypeInfo eitherInfo1 = new EitherTypeInfo( - BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO); - - EitherTypeInfo> eitherInfo2 = new EitherTypeInfo>( - BasicTypeInfo.INT_TYPE_INFO, new TupleTypeInfo>( - TypeExtractor.getForClass(Double.class), TypeExtractor.getForClass(String.class))); - - assertNotEquals(eitherInfo1, eitherInfo2); +/** + * Test for {@link EitherTypeInfo}. + */ +public class EitherTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected EitherTypeInfo[] getTestData() { + return new EitherTypeInfo[] { + new EitherTypeInfo<>(BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO), + new EitherTypeInfo<>(BasicTypeInfo.INT_TYPE_INFO, + new TupleTypeInfo>(TypeExtractor.getForClass(Double.class), TypeExtractor.getForClass(String.class))) + }; } } diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/EnumTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/EnumTypeInfoTest.java index b200566e782250..2023f7fdb3c4d5 100644 --- a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/EnumTypeInfoTest.java +++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/EnumTypeInfoTest.java @@ -18,11 +18,21 @@ package org.apache.flink.api.java.typeutils; -import org.apache.flink.util.TestLogger; -import org.junit.Test; -import static org.junit.Assert.*; +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; -public class EnumTypeInfoTest extends TestLogger { +/** + * Test for {@link EnumTypeInfo}. + */ +public class EnumTypeInfoTest extends TypeInformationTestBase> { + + @Override + @SuppressWarnings("unchecked") + protected EnumTypeInfo[] getTestData() { + return new EnumTypeInfo[] { + (EnumTypeInfo) new EnumTypeInfo(TestEnum.class), + (EnumTypeInfo) new EnumTypeInfo(AlternativeEnum.class) + }; + } enum TestEnum { ONE, TWO @@ -31,21 +41,4 @@ enum TestEnum { enum AlternativeEnum { ONE, TWO } - - @Test - public void testEnumTypeEquality() { - EnumTypeInfo enumTypeInfo1 = new EnumTypeInfo(TestEnum.class); - EnumTypeInfo enumTypeInfo2 = new EnumTypeInfo(TestEnum.class); - - assertEquals(enumTypeInfo1, enumTypeInfo2); - assertEquals(enumTypeInfo1.hashCode(), enumTypeInfo2.hashCode()); - } - - @Test - public void testEnumTypeInequality() { - EnumTypeInfo enumTypeInfo1 = new EnumTypeInfo(TestEnum.class); - EnumTypeInfo enumTypeInfo2 = new EnumTypeInfo(AlternativeEnum.class); - - assertNotEquals(enumTypeInfo1, enumTypeInfo2); - } } diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/GenericTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/GenericTypeInfoTest.java index fad43df362ac73..8dbcc99cdc4573 100644 --- a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/GenericTypeInfoTest.java +++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/GenericTypeInfoTest.java @@ -18,30 +18,22 @@ package org.apache.flink.api.java.typeutils; -import org.apache.flink.util.TestLogger; -import org.junit.Test; -import static org.junit.Assert.*; +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; -public class GenericTypeInfoTest extends TestLogger { +/** + * Test for {@link GenericTypeInfo}. + */ +public class GenericTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected GenericTypeInfo[] getTestData() { + return new GenericTypeInfo[] { + new GenericTypeInfo<>(TestClass.class), + new GenericTypeInfo<>(AlternativeClass.class) + }; + } static class TestClass {} static class AlternativeClass {} - @Test - public void testGenericTypeInfoEquality() { - GenericTypeInfo tpeInfo1 = new GenericTypeInfo<>(TestClass.class); - GenericTypeInfo tpeInfo2 = new GenericTypeInfo<>(TestClass.class); - - assertEquals(tpeInfo1, tpeInfo2); - assertEquals(tpeInfo1.hashCode(), tpeInfo2.hashCode()); - } - - @Test - public void testGenericTypeInfoInequality() { - GenericTypeInfo tpeInfo1 = new GenericTypeInfo<>(TestClass.class); - GenericTypeInfo tpeInfo2 = new GenericTypeInfo<>(AlternativeClass.class); - - assertNotEquals(tpeInfo1, tpeInfo2); - } - } diff --git a/flink-core/src/test/java/org/apache/flink/types/NothingTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/ListTypeInfoTest.java similarity index 53% rename from flink-core/src/test/java/org/apache/flink/types/NothingTypeInfoTest.java rename to flink-core/src/test/java/org/apache/flink/api/java/typeutils/ListTypeInfoTest.java index a7976eef96e640..58cabfd22d190a 100644 --- a/flink-core/src/test/java/org/apache/flink/types/NothingTypeInfoTest.java +++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/ListTypeInfoTest.java @@ -16,32 +16,22 @@ * limitations under the License. */ -package org.apache.flink.types; +package org.apache.flink.api.java.typeutils; import org.apache.flink.api.common.typeinfo.BasicTypeInfo; -import org.apache.flink.api.common.typeinfo.NothingTypeInfo; -import org.apache.flink.util.TestLogger; -import org.junit.Test; +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; -import static org.junit.Assert.*; - -public class NothingTypeInfoTest extends TestLogger { - - @Test - public void testNothingTypeInfoEquality() { - NothingTypeInfo tpeInfo1 = new NothingTypeInfo(); - NothingTypeInfo tpeInfo2 = new NothingTypeInfo(); - - assertEquals(tpeInfo1, tpeInfo2); - assertEquals(tpeInfo1.hashCode(), tpeInfo2.hashCode()); - } - - @Test - public void testNothingTypeInfoInequality() { - NothingTypeInfo tpeInfo1 = new NothingTypeInfo(); - BasicTypeInfo tpeInfo2 = BasicTypeInfo.getInfoFor(Integer.class); - - assertNotEquals(tpeInfo1, tpeInfo2); - assertNotEquals(tpeInfo2, tpeInfo1); +/** + * Test for {@link ListTypeInfo}. + */ +public class ListTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected ListTypeInfo[] getTestData() { + return new ListTypeInfo[] { + new ListTypeInfo<>(BasicTypeInfo.STRING_TYPE_INFO), + new ListTypeInfo<>(BasicTypeInfo.BOOLEAN_TYPE_INFO), + new ListTypeInfo<>(Object.class), + }; } } diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/MapTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/MapTypeInfoTest.java new file mode 100644 index 00000000000000..5f3fc06dbfdf4b --- /dev/null +++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/MapTypeInfoTest.java @@ -0,0 +1,37 @@ +/* + * 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.flink.api.java.typeutils; + +import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; + +/** + * Test for {@link MapTypeInfo}. + */ +public class MapTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected MapTypeInfo[] getTestData() { + return new MapTypeInfo[] { + new MapTypeInfo<>(BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO), + new MapTypeInfo<>(BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO), + new MapTypeInfo<>(String.class, Boolean.class) + }; + } +} diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/MissingTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/MissingTypeInfoTest.java index ee57475f4389a7..cccc14df5130e4 100644 --- a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/MissingTypeInfoTest.java +++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/MissingTypeInfoTest.java @@ -19,29 +19,26 @@ package org.apache.flink.api.java.typeutils; import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; import org.apache.flink.util.TestLogger; import org.junit.Test; import static org.junit.Assert.*; -public class MissingTypeInfoTest extends TestLogger { - static final String functionName = "foobar"; - static final InvalidTypesException testException = new InvalidTypesException("Test exception."); +public class MissingTypeInfoTest extends TypeInformationTestBase { + private static final String functionName = "foobar"; + private static final InvalidTypesException testException = new InvalidTypesException("Test exception."); - @Test - public void testMissingTypeInfoEquality() { - MissingTypeInfo tpeInfo1 = new MissingTypeInfo(functionName, testException); - MissingTypeInfo tpeInfo2 = new MissingTypeInfo(functionName, testException); - - assertEquals(tpeInfo1, tpeInfo2); - assertEquals(tpeInfo1.hashCode(), tpeInfo2.hashCode()); + @Override + protected MissingTypeInfo[] getTestData() { + return new MissingTypeInfo[] { + new MissingTypeInfo(functionName, testException), + new MissingTypeInfo("alt" + functionName, testException) + }; } - @Test - public void testMissingTypeInfoInequality() { - MissingTypeInfo tpeInfo1 = new MissingTypeInfo(functionName, testException); - MissingTypeInfo tpeInfo2 = new MissingTypeInfo("alt" + functionName, testException); - - assertNotEquals(tpeInfo1, tpeInfo2); + @Override + public void testSerialization() { + // this class is not intended to be serialized } } diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/ObjectArrayTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/ObjectArrayTypeInfoTest.java index f3b39c0327a357..655c28ad8e7a75 100644 --- a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/ObjectArrayTypeInfoTest.java +++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/ObjectArrayTypeInfoTest.java @@ -18,41 +18,21 @@ package org.apache.flink.api.java.typeutils; -import org.apache.flink.util.TestLogger; -import org.junit.Test; - import java.util.ArrayList; +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; -import static org.junit.Assert.*; - -public class ObjectArrayTypeInfoTest extends TestLogger { - - public static class TestClass{} - - @Test - public void testObjectArrayTypeInfoEquality() { - ObjectArrayTypeInfo tpeInfo1 = ObjectArrayTypeInfo.getInfoFor( - TestClass[].class, - new GenericTypeInfo(TestClass.class)); - - ObjectArrayTypeInfo tpeInfo2 = ObjectArrayTypeInfo.getInfoFor( - TestClass[].class, - new GenericTypeInfo(TestClass.class)); - - assertEquals(tpeInfo1, tpeInfo2); - assertEquals(tpeInfo1.hashCode(), tpeInfo2.hashCode()); +/** + * Test for {@link ObjectArrayTypeInfo}. + */ +public class ObjectArrayTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected ObjectArrayTypeInfo[] getTestData() { + return new ObjectArrayTypeInfo[] { + ObjectArrayTypeInfo.getInfoFor(TestClass[].class, new GenericTypeInfo<>(TestClass.class)), + ObjectArrayTypeInfo.getInfoFor(TestClass[].class, new PojoTypeInfo<>(TestClass.class, new ArrayList())) + }; } - @Test - public void testObjectArrayTypeInfoInequality() { - ObjectArrayTypeInfo tpeInfo1 = ObjectArrayTypeInfo.getInfoFor( - TestClass[].class, - new GenericTypeInfo(TestClass.class)); - - ObjectArrayTypeInfo tpeInfo2 = ObjectArrayTypeInfo.getInfoFor( - TestClass[].class, - new PojoTypeInfo(TestClass.class, new ArrayList())); - - assertNotEquals(tpeInfo1, tpeInfo2); - } + public static class TestClass {} } diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/PojoTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/PojoTypeInfoTest.java index dbe51152edaf6a..0af4ed5fe5eea3 100644 --- a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/PojoTypeInfoTest.java +++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/PojoTypeInfoTest.java @@ -18,75 +18,21 @@ package org.apache.flink.api.java.typeutils; -import static org.junit.Assert.*; - -import org.apache.flink.api.common.typeinfo.TypeInformation; -import org.apache.flink.util.InstantiationUtil; -import org.junit.Test; - -import java.io.IOException; - -public class PojoTypeInfoTest { - - @Test - public void testPojoTypeInfoEquality() { - try { - TypeInformation info1 = TypeExtractor.getForClass(TestPojo.class); - TypeInformation info2 = TypeExtractor.getForClass(TestPojo.class); - - assertTrue(info1 instanceof PojoTypeInfo); - assertTrue(info2 instanceof PojoTypeInfo); - - assertTrue(info1.equals(info2)); - assertTrue(info1.hashCode() == info2.hashCode()); - } - catch (Exception e) { - e.printStackTrace(); - fail(e.getMessage()); - } - } - - @Test - public void testPojoTypeInfoInequality() { - try { - TypeInformation info1 = TypeExtractor.getForClass(TestPojo.class); - TypeInformation info2 = TypeExtractor.getForClass(AlternatePojo.class); - - assertTrue(info1 instanceof PojoTypeInfo); - assertTrue(info2 instanceof PojoTypeInfo); - - assertFalse(info1.equals(info2)); - } - catch (Exception e) { - e.printStackTrace(); - fail(e.getMessage()); - } - } +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; - @Test - public void testSerializabilityOfPojoTypeInfo() throws IOException, ClassNotFoundException { - PojoTypeInfo pojoTypeInfo = (PojoTypeInfo)TypeExtractor.getForClass(TestPojo.class); - - byte[] serializedPojoTypeInfo = InstantiationUtil.serializeObject(pojoTypeInfo); - PojoTypeInfo deserializedPojoTypeInfo = (PojoTypeInfo)InstantiationUtil.deserializeObject( - serializedPojoTypeInfo, - getClass().getClassLoader()); - - assertEquals(pojoTypeInfo, deserializedPojoTypeInfo); - } - - @Test - public void testPrimitivePojo() { - TypeInformation info1 = TypeExtractor.getForClass(PrimitivePojo.class); - - assertTrue(info1 instanceof PojoTypeInfo); - } - - @Test - public void testUnderscorePojo() { - TypeInformation info1 = TypeExtractor.getForClass(UnderscorePojo.class); - - assertTrue(info1 instanceof PojoTypeInfo); +/** + * Test for {@link PojoTypeInfo}. + */ +public class PojoTypeInfoTest extends TypeInformationTestBase>{ + + @Override + protected PojoTypeInfo[] getTestData() { + return new PojoTypeInfo[] { + (PojoTypeInfo) TypeExtractor.getForClass(TestPojo.class), + (PojoTypeInfo) TypeExtractor.getForClass(AlternatePojo.class), + (PojoTypeInfo) TypeExtractor.getForClass(PrimitivePojo.class), + (PojoTypeInfo) TypeExtractor.getForClass(UnderscorePojo.class) + }; } public static final class TestPojo { diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/RowTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/RowTypeInfoTest.java index 45f616c275ea01..03d1e0484b60b9 100644 --- a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/RowTypeInfoTest.java +++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/RowTypeInfoTest.java @@ -20,6 +20,7 @@ import org.apache.flink.api.common.typeinfo.BasicTypeInfo; import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.api.common.typeutils.CompositeType.FlatFieldDescriptor; +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; import org.junit.Test; import java.util.ArrayList; @@ -29,7 +30,10 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; -public class RowTypeInfoTest { +/** + * Test for {@link RowTypeInfo}. + */ +public class RowTypeInfoTest extends TypeInformationTestBase { private static TypeInformation[] typeList = new TypeInformation[]{ BasicTypeInfo.INT_TYPE_INFO, new RowTypeInfo( @@ -38,6 +42,15 @@ public class RowTypeInfoTest { BasicTypeInfo.STRING_TYPE_INFO }; + @Override + protected RowTypeInfo[] getTestData() { + return new RowTypeInfo[] { + new RowTypeInfo(BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO), + new RowTypeInfo(BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.BOOLEAN_TYPE_INFO), + new RowTypeInfo(typeList) + }; + } + @Test(expected = IllegalArgumentException.class) public void testWrongNumberOfFieldNames() { new RowTypeInfo(typeList, new String[]{"int", "string"}); @@ -92,13 +105,7 @@ public void testGetFlatFields() { @Test public void testGetTypeAt() { - RowTypeInfo typeInfo = new RowTypeInfo( - BasicTypeInfo.INT_TYPE_INFO, - new RowTypeInfo( - BasicTypeInfo.SHORT_TYPE_INFO, - BasicTypeInfo.BIG_DEC_TYPE_INFO - ), - BasicTypeInfo.STRING_TYPE_INFO); + RowTypeInfo typeInfo = new RowTypeInfo(typeList); assertArrayEquals(new String[]{"f0", "f1", "f2"}, typeInfo.getFieldNames()); @@ -108,45 +115,12 @@ public void testGetTypeAt() { assertEquals(BasicTypeInfo.BIG_DEC_TYPE_INFO, typeInfo.getTypeAt("f1.1")); } - @Test - public void testRowTypeInfoEquality() { - RowTypeInfo typeInfo1 = new RowTypeInfo( - BasicTypeInfo.INT_TYPE_INFO, - BasicTypeInfo.STRING_TYPE_INFO); - - RowTypeInfo typeInfo2 = new RowTypeInfo( - BasicTypeInfo.INT_TYPE_INFO, - BasicTypeInfo.STRING_TYPE_INFO); - - assertEquals(typeInfo1, typeInfo2); - assertEquals(typeInfo1.hashCode(), typeInfo2.hashCode()); - } - - @Test - public void testRowTypeInfoInequality() { - RowTypeInfo typeInfo1 = new RowTypeInfo( - BasicTypeInfo.INT_TYPE_INFO, - BasicTypeInfo.STRING_TYPE_INFO); - - RowTypeInfo typeInfo2 = new RowTypeInfo( - BasicTypeInfo.INT_TYPE_INFO, - BasicTypeInfo.BOOLEAN_TYPE_INFO); - - assertNotEquals(typeInfo1, typeInfo2); - assertNotEquals(typeInfo1.hashCode(), typeInfo2.hashCode()); - } - @Test public void testNestedRowTypeInfo() { - RowTypeInfo typeInfo = new RowTypeInfo( - BasicTypeInfo.INT_TYPE_INFO, - new RowTypeInfo( - BasicTypeInfo.SHORT_TYPE_INFO, - BasicTypeInfo.BIG_DEC_TYPE_INFO - ), - BasicTypeInfo.STRING_TYPE_INFO); + RowTypeInfo typeInfo = new RowTypeInfo(typeList); assertEquals("Row(f0: Short, f1: BigDecimal)", typeInfo.getTypeAt("f1").toString()); assertEquals("Short", typeInfo.getTypeAt("f1.f0").toString()); } + } diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/TupleTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/TupleTypeInfoTest.java index b6cff34caeab85..3a9887713657ab 100644 --- a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/TupleTypeInfoTest.java +++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/TupleTypeInfoTest.java @@ -21,21 +21,31 @@ import org.apache.flink.api.common.ExecutionConfig; import org.apache.flink.api.common.typeinfo.BasicTypeInfo; import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; import org.apache.flink.api.common.typeutils.TypeSerializer; import org.apache.flink.api.java.tuple.Tuple1; -import org.apache.flink.api.java.tuple.Tuple2; -import org.apache.flink.util.TestLogger; -import org.junit.Assert; +import static org.junit.Assert.assertTrue; import org.junit.Test; -public class TupleTypeInfoTest extends TestLogger { +/** + * Test for {@link TupleTypeInfo}. + */ +public class TupleTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected TupleTypeInfo[] getTestData() { + return new TupleTypeInfo[] { + new TupleTypeInfo<>(BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO), + new TupleTypeInfo<>(BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.BOOLEAN_TYPE_INFO) + }; + } @Test public void testTupleTypeInfoSymmetricEqualityRelation() { TupleTypeInfo> tupleTypeInfo = new TupleTypeInfo<>(BasicTypeInfo.INT_TYPE_INFO); TupleTypeInfoBase anonymousTupleTypeInfo = new TupleTypeInfoBase( - (Class)Tuple1.class, + Tuple1.class, (TypeInformation)BasicTypeInfo.INT_TYPE_INFO) { private static final long serialVersionUID = -7985593598027660836L; @@ -64,33 +74,6 @@ public int getFieldIndex(String fieldName) { boolean tupleVsAnonymous = tupleTypeInfo.equals(anonymousTupleTypeInfo); boolean anonymousVsTuple = anonymousTupleTypeInfo.equals(tupleTypeInfo); - Assert.assertTrue("Equality relation should be symmetric", tupleVsAnonymous == anonymousVsTuple); - } - - @Test - public void testTupleTypeInfoEquality() { - TupleTypeInfo> tupleTypeInfo1 = new TupleTypeInfo<>( - BasicTypeInfo.INT_TYPE_INFO, - BasicTypeInfo.STRING_TYPE_INFO); - - TupleTypeInfo> tupleTypeInfo2 = new TupleTypeInfo<>( - BasicTypeInfo.INT_TYPE_INFO, - BasicTypeInfo.STRING_TYPE_INFO); - - Assert.assertEquals(tupleTypeInfo1, tupleTypeInfo2); - Assert.assertEquals(tupleTypeInfo1.hashCode(), tupleTypeInfo2.hashCode()); - } - - @Test - public void testTupleTypeInfoInequality() { - TupleTypeInfo> tupleTypeInfo1 = new TupleTypeInfo<>( - BasicTypeInfo.INT_TYPE_INFO, - BasicTypeInfo.STRING_TYPE_INFO); - - TupleTypeInfo> tupleTypeInfo2 = new TupleTypeInfo<>( - BasicTypeInfo.INT_TYPE_INFO, - BasicTypeInfo.BOOLEAN_TYPE_INFO); - - Assert.assertNotEquals(tupleTypeInfo1, tupleTypeInfo2); + assertTrue("Equality relation should be symmetric", tupleVsAnonymous == anonymousVsTuple); } } diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/ValueTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/ValueTypeInfoTest.java index 4a579c86bec93c..b67d7545b3c34e 100644 --- a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/ValueTypeInfoTest.java +++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/ValueTypeInfoTest.java @@ -18,6 +18,7 @@ package org.apache.flink.api.java.typeutils; +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; import org.apache.flink.core.memory.DataInputView; import org.apache.flink.core.memory.DataOutputView; import org.apache.flink.types.Record; @@ -30,7 +31,26 @@ import static org.junit.Assert.*; -public class ValueTypeInfoTest extends TestLogger { +/** + * Test for {@link ListTypeInfo}. + */ +public class ValueTypeInfoTest extends TypeInformationTestBase> { + + @Override + protected ValueTypeInfo[] getTestData() { + return new ValueTypeInfo[] { + new ValueTypeInfo<>(TestClass.class), + new ValueTypeInfo<>(AlternativeClass.class), + new ValueTypeInfo<>(Record.class), + }; + } + + @Test + public void testValueTypeEqualsWithNull() throws Exception { + ValueTypeInfo tpeInfo = new ValueTypeInfo<>(Record.class); + + Assert.assertFalse(tpeInfo.equals(null)); + } public static class TestClass implements Value { private static final long serialVersionUID = -492760806806568285L; @@ -60,28 +80,4 @@ public void read(DataInputView in) throws IOException { } } - - @Test - public void testValueTypeInfoEquality() { - ValueTypeInfo tpeInfo1 = new ValueTypeInfo<>(TestClass.class); - ValueTypeInfo tpeInfo2 = new ValueTypeInfo<>(TestClass.class); - - assertEquals(tpeInfo1, tpeInfo2); - assertEquals(tpeInfo1.hashCode(), tpeInfo2.hashCode()); - } - - @Test - public void testValueTyepInfoInequality() { - ValueTypeInfo tpeInfo1 = new ValueTypeInfo<>(TestClass.class); - ValueTypeInfo tpeInfo2 = new ValueTypeInfo<>(AlternativeClass.class); - - assertNotEquals(tpeInfo1, tpeInfo2); - } - - @Test - public void testValueTypeEqualsWithNull() throws Exception { - ValueTypeInfo tpeInfo = new ValueTypeInfo<>(Record.class); - - Assert.assertFalse(tpeInfo.equals(null)); - } } diff --git a/flink-core/src/test/java/org/apache/flink/types/BasicArrayTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/types/BasicArrayTypeInfoTest.java deleted file mode 100644 index 3e086ff823d550..00000000000000 --- a/flink-core/src/test/java/org/apache/flink/types/BasicArrayTypeInfoTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.flink.types; - -import org.apache.flink.api.common.typeinfo.BasicArrayTypeInfo; -import org.apache.flink.util.TestLogger; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; - -public class BasicArrayTypeInfoTest extends TestLogger { - - static Class[] classes = {String[].class, Integer[].class, Boolean[].class, Byte[].class, - Short[].class, Long[].class, Float[].class, Double[].class, Character[].class}; - - @Test - public void testBasicArrayTypeInfoEquality() { - for (Class clazz: classes) { - BasicArrayTypeInfo tpeInfo1 = BasicArrayTypeInfo.getInfoFor(clazz); - BasicArrayTypeInfo tpeInfo2 = BasicArrayTypeInfo.getInfoFor(clazz); - - assertEquals(tpeInfo1, tpeInfo2); - assertEquals(tpeInfo1.hashCode(), tpeInfo2.hashCode()); - } - } - - @Test - public void testBasicArrayTypeInfoInequality() { - for (Class clazz1: classes) { - for (Class clazz2: classes) { - if (!clazz1.equals(clazz2)) { - BasicArrayTypeInfo tpeInfo1 = BasicArrayTypeInfo.getInfoFor(clazz1); - BasicArrayTypeInfo tpeInfo2 = BasicArrayTypeInfo.getInfoFor(clazz2); - assertNotEquals(tpeInfo1, tpeInfo2); - } - } - } - } -} diff --git a/flink-core/src/test/java/org/apache/flink/types/PrimitiveArrayTypeInfoTest.java b/flink-core/src/test/java/org/apache/flink/types/PrimitiveArrayTypeInfoTest.java deleted file mode 100644 index 7ef14f934d927a..00000000000000 --- a/flink-core/src/test/java/org/apache/flink/types/PrimitiveArrayTypeInfoTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.flink.types; - -import org.apache.flink.api.common.typeinfo.PrimitiveArrayTypeInfo; -import org.apache.flink.util.TestLogger; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; - -public class PrimitiveArrayTypeInfoTest extends TestLogger { - - static Class[] classes = {int[].class, boolean[].class, byte[].class, - short[].class, long[].class, float[].class, double[].class, char[].class}; - - @Test - public void testPrimitiveArrayTypeInfoEquality() { - for (Class clazz: classes) { - PrimitiveArrayTypeInfo tpeInfo1 = PrimitiveArrayTypeInfo.getInfoFor(clazz); - PrimitiveArrayTypeInfo tpeInfo2 = PrimitiveArrayTypeInfo.getInfoFor(clazz); - - assertEquals(tpeInfo1, tpeInfo2); - assertEquals(tpeInfo1.hashCode(), tpeInfo2.hashCode()); - } - } - - @Test - public void testBasicArrayTypeInfoInequality() { - for (Class clazz1: classes) { - for (Class clazz2: classes) { - if (!clazz1.equals(clazz2)) { - PrimitiveArrayTypeInfo tpeInfo1 = PrimitiveArrayTypeInfo.getInfoFor(clazz1); - PrimitiveArrayTypeInfo tpeInfo2 = PrimitiveArrayTypeInfo.getInfoFor(clazz2); - assertNotEquals(tpeInfo1, tpeInfo2); - } - } - } - } -} diff --git a/flink-scala/pom.xml b/flink-scala/pom.xml index f4c8246ddca3b6..6c9a933c9a3c38 100644 --- a/flink-scala/pom.xml +++ b/flink-scala/pom.xml @@ -220,6 +220,19 @@ under the License. + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + diff --git a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/CaseClassTypeInfoTest.scala b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/CaseClassTypeInfoTest.scala index 479483f6c77875..088cc705a92b45 100644 --- a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/CaseClassTypeInfoTest.scala +++ b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/CaseClassTypeInfoTest.scala @@ -20,54 +20,27 @@ package org.apache.flink.api.scala.typeutils import org.apache.flink.api.common.ExecutionConfig import org.apache.flink.api.common.typeinfo.BasicTypeInfo -import org.apache.flink.api.common.typeutils.TypeSerializer -import org.apache.flink.util.TestLogger -import org.junit.Test -import org.scalatest.junit.JUnitSuiteLike +import org.apache.flink.api.common.typeutils.{TypeInformationTestBase, TypeSerializer} -class CaseClassTypeInfoTest extends TestLogger with JUnitSuiteLike { +/** + * Test for [[CaseClassTypeInfo]]. + */ +class CaseClassTypeInfoTest extends TypeInformationTestBase[CaseClassTypeInfo[_]] { - @Test - def testCaseClassTypeInfoEquality(): Unit = { - val tpeInfo1 = new CaseClassTypeInfo[Tuple2[Int, String]]( - classOf[Tuple2[Int, String]], + override protected def getTestData: Array[CaseClassTypeInfo[_]] = Array( + new CaseClassTypeInfo[(Int, String)]( + classOf[(Int, String)], Array(), Array(BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO), Array("_1", "_2")) { override def createSerializer(config: ExecutionConfig): TypeSerializer[(Int, String)] = ??? - } - - val tpeInfo2 = new CaseClassTypeInfo[Tuple2[Int, String]]( - classOf[Tuple2[Int, String]], - Array(), - Array(BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO), - Array("_1", "_2")) { - override def createSerializer(config: ExecutionConfig): TypeSerializer[(Int, String)] = ??? - } - - assert(tpeInfo1.equals(tpeInfo2)) - assert(tpeInfo1.hashCode() == tpeInfo2.hashCode()) - } - - @Test - def testCaseClassTypeInfoInequality(): Unit = { - val tpeInfo1 = new CaseClassTypeInfo[Tuple2[Int, String]]( - classOf[Tuple2[Int, String]], - Array(), - Array(BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO), - Array("_1", "_2")) { - override def createSerializer(config: ExecutionConfig): TypeSerializer[(Int, String)] = ??? - } - - val tpeInfo2 = new CaseClassTypeInfo[Tuple2[Int, Boolean]]( - classOf[Tuple2[Int, Boolean]], + }, + new CaseClassTypeInfo[(Int, Boolean)]( + classOf[(Int, Boolean)], Array(), Array(BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.BOOLEAN_TYPE_INFO), Array("_1", "_2")) { override def createSerializer(config: ExecutionConfig): TypeSerializer[(Int, Boolean)] = ??? } - - assert(!tpeInfo1.equals(tpeInfo2)) - } - + ) } diff --git a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/EitherTypeInfoTest.scala b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/EitherTypeInfoTest.scala index e23a6a04937ed5..fc9811e5a9cd8c 100644 --- a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/EitherTypeInfoTest.scala +++ b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/EitherTypeInfoTest.scala @@ -19,41 +19,24 @@ package org.apache.flink.api.scala.typeutils import org.apache.flink.api.common.typeinfo.BasicTypeInfo -import org.apache.flink.util.TestLogger -import org.junit.Test -import org.scalatest.junit.JUnitSuiteLike +import org.apache.flink.api.common.typeutils.TypeInformationTestBase -class EitherTypeInfoTest extends TestLogger with JUnitSuiteLike { +/** + * Test for [[EitherTypeInfo]]. + */ +class EitherTypeInfoTest extends TypeInformationTestBase[EitherTypeInfo[_, _, _]] { - @Test - def testEitherTypeEquality(): Unit = { - val eitherTypeInfo1 = new EitherTypeInfo[Integer, String, Either[Integer, String]]( - classOf[Either[Integer,String]], - BasicTypeInfo.INT_TYPE_INFO, - BasicTypeInfo.STRING_TYPE_INFO - ) - val eitherTypeInfo2 = new EitherTypeInfo[Integer, String, Either[Integer, String]]( - classOf[Either[Integer,String]], - BasicTypeInfo.INT_TYPE_INFO, - BasicTypeInfo.STRING_TYPE_INFO - ) - - assert(eitherTypeInfo1.equals(eitherTypeInfo2)) - assert(eitherTypeInfo1.hashCode() == eitherTypeInfo2.hashCode()) - } - - @Test - def testEitherTypeInequality(): Unit = { - val eitherTypeInfo1 = new EitherTypeInfo[Integer, Integer, Either[Integer, Integer]]( + override protected def getTestData: Array[EitherTypeInfo[_, _, _]] = Array( + new EitherTypeInfo[Integer, Integer, Either[Integer, Integer]]( classOf[Either[Integer,Integer]], BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO - ) - val eitherTypeInfo2 = new EitherTypeInfo[Integer, String, Either[Integer, String]]( + ), + new EitherTypeInfo[Integer, String, Either[Integer, String]]( classOf[Either[Integer,String]], BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO ) - assert(!eitherTypeInfo1.equals(eitherTypeInfo2)) - } + ) + } diff --git a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/EnumValueTypeInfoTest.scala b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/EnumValueTypeInfoTest.scala index acd6a39400b2f2..14ca0e8abd134f 100644 --- a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/EnumValueTypeInfoTest.scala +++ b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/EnumValueTypeInfoTest.scala @@ -18,39 +18,23 @@ package org.apache.flink.api.scala.typeutils +import org.apache.flink.api.common.typeutils.TypeInformationTestBase import org.apache.flink.api.scala.typeutils.AlternateEnumeration.AlternateEnumeration import org.apache.flink.api.scala.typeutils.TestEnumeration.TestEnumeration -import org.apache.flink.util.TestLogger -import org.junit.Test -import org.scalatest.junit.JUnitSuiteLike -class EnumValueTypeInfoTest extends TestLogger with JUnitSuiteLike { +/** + * Test for [[EnumValueTypeInfo]]. + */ +class EnumValueTypeInfoTest extends TypeInformationTestBase[EnumValueTypeInfo[_]] { - @Test - def testEnumValueTypeInfoEquality(): Unit = { - val enumTypeInfo1 = new EnumValueTypeInfo[TestEnumeration.type]( + override protected def getTestData: Array[EnumValueTypeInfo[_]] = Array( + new EnumValueTypeInfo[TestEnumeration.type]( TestEnumeration, - classOf[TestEnumeration]) - val enumTypeInfo2 = new EnumValueTypeInfo[TestEnumeration.type]( - TestEnumeration, - classOf[TestEnumeration]) - - assert(enumTypeInfo1.equals(enumTypeInfo2)) - assert(enumTypeInfo1.hashCode() == enumTypeInfo2.hashCode()) - } - - @Test - def testEnumValueTypeInfoInequality(): Unit = { - val enumTypeInfo1 = new EnumValueTypeInfo[TestEnumeration.type]( - TestEnumeration, - classOf[TestEnumeration]) - val enumTypeInfo2 = new EnumValueTypeInfo[AlternateEnumeration.type]( + classOf[TestEnumeration]), + new EnumValueTypeInfo[AlternateEnumeration.type]( AlternateEnumeration, classOf[AlternateEnumeration]) - - assert(!enumTypeInfo1.equals(enumTypeInfo2)) - } - + ) } object TestEnumeration extends Enumeration { diff --git a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/OptionTypeInfoTest.scala b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/OptionTypeInfoTest.scala index b7656581bbe518..3effb0d36fe23e 100644 --- a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/OptionTypeInfoTest.scala +++ b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/OptionTypeInfoTest.scala @@ -19,36 +19,16 @@ package org.apache.flink.api.scala.typeutils import org.apache.flink.api.common.typeinfo.BasicTypeInfo -import org.apache.flink.api.java.typeutils.GenericTypeInfo -import org.apache.flink.util.TestLogger -import org.junit.Test -import org.scalatest.junit.{JUnitSuiteLike, JUnitSuite} +import org.apache.flink.api.common.typeutils.TypeInformationTestBase -class OptionTypeInfoTest extends TestLogger with JUnitSuiteLike { +/** + * Test for [[OptionTypeInfo]]. + */ +class OptionTypeInfoTest extends TypeInformationTestBase[OptionTypeInfo[_, _]] { - @Test - def testOptionTypeEquality: Unit = { - val optionTypeInfo1 = new OptionTypeInfo[Integer, Option[Integer]](BasicTypeInfo.INT_TYPE_INFO) - val optionTypeInfo2 = new OptionTypeInfo[Integer, Option[Integer]](BasicTypeInfo.INT_TYPE_INFO) - - assert(optionTypeInfo1.equals(optionTypeInfo2)) - assert(optionTypeInfo1.hashCode == optionTypeInfo2.hashCode) - } - - @Test - def testOptionTypeInequality: Unit = { - val optionTypeInfo1 = new OptionTypeInfo[Integer, Option[Integer]](BasicTypeInfo.INT_TYPE_INFO) - val optionTypeInfo2 = new OptionTypeInfo[String, Option[String]](BasicTypeInfo.STRING_TYPE_INFO) - - assert(!optionTypeInfo1.equals(optionTypeInfo2)) - } - - @Test - def testOptionTypeInequalityWithDifferentType: Unit = { - val optionTypeInfo = new OptionTypeInfo[Integer, Option[Integer]](BasicTypeInfo.INT_TYPE_INFO) - val genericTypeInfo = new GenericTypeInfo[Double](Double.getClass.asInstanceOf[Class[Double]]) - - assert(!optionTypeInfo.equals(genericTypeInfo)) - } + override protected def getTestData: Array[OptionTypeInfo[_, _]] = Array( + new OptionTypeInfo[Integer, Option[Integer]](BasicTypeInfo.INT_TYPE_INFO), + new OptionTypeInfo[String, Option[String]](BasicTypeInfo.STRING_TYPE_INFO) + ) } diff --git a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/ScalaNothingTypeInfoTest.scala b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/ScalaNothingTypeInfoTest.scala new file mode 100644 index 00000000000000..0193de9e41fbe8 --- /dev/null +++ b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/ScalaNothingTypeInfoTest.scala @@ -0,0 +1,31 @@ +/* + * 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.flink.api.scala.typeutils + +import org.apache.flink.api.common.typeutils.TypeInformationTestBase + +/** + * Test for [[ScalaNothingTypeInfo]]. + */ +class ScalaNothingTypeInfoTest extends TypeInformationTestBase[ScalaNothingTypeInfo] { + + override protected def getTestData: Array[ScalaNothingTypeInfo] = Array( + new ScalaNothingTypeInfo + ) +} diff --git a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/TraversableTypeInfoTest.scala b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/TraversableTypeInfoTest.scala index e83b3261b922ab..f337de13346505 100644 --- a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/TraversableTypeInfoTest.scala +++ b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/TraversableTypeInfoTest.scala @@ -19,50 +19,26 @@ package org.apache.flink.api.scala.typeutils import org.apache.flink.api.common.ExecutionConfig -import org.apache.flink.api.common.typeinfo.{TypeInformation, BasicTypeInfo} -import org.apache.flink.api.common.typeutils.TypeSerializer -import org.apache.flink.util.TestLogger -import org.junit.Test -import org.scalatest.junit.JUnitSuiteLike +import org.apache.flink.api.common.typeinfo.{BasicTypeInfo, TypeInformation} +import org.apache.flink.api.common.typeutils.{TypeInformationTestBase, TypeSerializer} -class TraversableTypeInfoTest extends TestLogger with JUnitSuiteLike { +/** + * Test for [[TraversableTypeInfo]]. + */ +class TraversableTypeInfoTest extends TypeInformationTestBase[TraversableTypeInfo[_, _]] { - @Test - def testTraversableTypeInfoEquality(): Unit = { - val tpeInfo1 = new TraversableTypeInfo[Seq[Int], Int]( + override protected def getTestData: Array[TraversableTypeInfo[_, _]] = Array( + new TraversableTypeInfo[Seq[Int], Int]( classOf[Seq[Int]], BasicTypeInfo.INT_TYPE_INFO.asInstanceOf[TypeInformation[Int]]) { override def createSerializer(executionConfig: ExecutionConfig): TypeSerializer[Seq[Int]] = ??? - } - - val tpeInfo2 = new TraversableTypeInfo[Seq[Int], Int]( - classOf[Seq[Int]], - BasicTypeInfo.INT_TYPE_INFO.asInstanceOf[TypeInformation[Int]]) { - override def createSerializer(executionConfig: ExecutionConfig): TypeSerializer[Seq[Int]] = - ??? - } - - assert(tpeInfo1.equals(tpeInfo2)) - } - - @Test - def testTraversableTypeInfoInequality(): Unit = { - val tpeInfo1 = new TraversableTypeInfo[Seq[Int], Int]( - classOf[Seq[Int]], - BasicTypeInfo.INT_TYPE_INFO.asInstanceOf[TypeInformation[Int]]) { - override def createSerializer(executionConfig: ExecutionConfig): TypeSerializer[Seq[Int]] = - ??? - } - - val tpeInfo2 = new TraversableTypeInfo[List[Int], Int]( + }, + new TraversableTypeInfo[List[Int], Int]( classOf[List[Int]], BasicTypeInfo.INT_TYPE_INFO.asInstanceOf[TypeInformation[Int]]) { override def createSerializer(executionConfig: ExecutionConfig): TypeSerializer[List[Int]] = ??? } - - assert(!tpeInfo1.equals(tpeInfo2)) - } - + ) } diff --git a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/TryTypeInfoTest.scala b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/TryTypeInfoTest.scala index 5e689512587aa5..05d18212065b92 100644 --- a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/TryTypeInfoTest.scala +++ b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/TryTypeInfoTest.scala @@ -19,39 +19,17 @@ package org.apache.flink.api.scala.typeutils import org.apache.flink.api.common.typeinfo.BasicTypeInfo -import org.apache.flink.api.java.typeutils.GenericTypeInfo -import org.apache.flink.util.TestLogger -import org.junit.Test -import org.scalatest.junit.JUnitSuiteLike +import org.apache.flink.api.common.typeutils.TypeInformationTestBase import scala.util.Try -class TryTypeInfoTest extends TestLogger with JUnitSuiteLike { +/** + * Test for [[TryTypeInfo]]. + */ +class TryTypeInfoTest extends TypeInformationTestBase[TryTypeInfo[_, _]] { - @Test - def testTryTypeEquality(): Unit = { - val TryTypeInfo1 = new TryTypeInfo[Integer, Try[Integer]](BasicTypeInfo.INT_TYPE_INFO) - val TryTypeInfo2 = new TryTypeInfo[Integer, Try[Integer]](BasicTypeInfo.INT_TYPE_INFO) - - assert(TryTypeInfo1.equals(TryTypeInfo2)) - assert(TryTypeInfo1.hashCode == TryTypeInfo2.hashCode) - } - - @Test - def testTryTypeInequality(): Unit = { - val TryTypeInfo1 = new TryTypeInfo[Integer, Try[Integer]](BasicTypeInfo.INT_TYPE_INFO) - val TryTypeInfo2 = new TryTypeInfo[String, Try[String]](BasicTypeInfo.STRING_TYPE_INFO) - - //noinspection ComparingUnrelatedTypes - assert(!TryTypeInfo1.equals(TryTypeInfo2)) - } - - @Test - def testTryTypeInequalityWithDifferentType(): Unit = { - val TryTypeInfo = new TryTypeInfo[Integer, Try[Integer]](BasicTypeInfo.INT_TYPE_INFO) - val genericTypeInfo = new GenericTypeInfo[Double](Double.getClass.asInstanceOf[Class[Double]]) - - //noinspection ComparingUnrelatedTypes - assert(!TryTypeInfo.equals(genericTypeInfo)) - } + override protected def getTestData: Array[TryTypeInfo[_, _]] = Array( + new TryTypeInfo[Integer, Try[Integer]](BasicTypeInfo.INT_TYPE_INFO), + new TryTypeInfo[String, Try[String]](BasicTypeInfo.STRING_TYPE_INFO) + ) } diff --git a/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/UnitTypeInfoTest.scala b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/UnitTypeInfoTest.scala new file mode 100644 index 00000000000000..1f22c5ac10d421 --- /dev/null +++ b/flink-scala/src/test/scala/org/apache/flink/api/scala/typeutils/UnitTypeInfoTest.scala @@ -0,0 +1,31 @@ +/* + * 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.flink.api.scala.typeutils + +import org.apache.flink.api.common.typeutils.TypeInformationTestBase + +/** + * Test for [[UnitTypeInfo]]. + */ +class UnitTypeInfoTest extends TypeInformationTestBase[UnitTypeInfo] { + + override protected def getTestData: Array[UnitTypeInfo] = Array( + new UnitTypeInfo + ) +} diff --git a/flink-tests/pom.xml b/flink-tests/pom.xml index b17ef04c381d49..62feff350c38ec 100644 --- a/flink-tests/pom.xml +++ b/flink-tests/pom.xml @@ -94,11 +94,19 @@ under the License. ${project.version} test - + + + org.apache.flink + flink-scala_2.10 + ${project.version} + test + + org.apache.flink flink-scala_2.10 ${project.version} + test-jar test @@ -138,6 +146,29 @@ under the License. test + + org.apache.flink + flink-hadoop-compatibility_2.10 + ${project.version} + test-jar + test + + + + org.apache.flink + flink-avro_2.10 + ${project.version} + test-jar + test + + + + org.apache.flink + flink-avro_2.10 + ${project.version} + test + + org.apache.flink flink-optimizer_2.10 diff --git a/flink-tests/src/test/java/org/apache/flink/test/completeness/TypeInfoTestCoverageTest.java b/flink-tests/src/test/java/org/apache/flink/test/completeness/TypeInfoTestCoverageTest.java new file mode 100644 index 00000000000000..b4549a84b1e328 --- /dev/null +++ b/flink-tests/src/test/java/org/apache/flink/test/completeness/TypeInfoTestCoverageTest.java @@ -0,0 +1,62 @@ +/* + * 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.flink.test.completeness; + +import java.lang.reflect.Modifier; +import java.util.Set; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.common.typeutils.TypeInformationTestBase; +import org.apache.flink.util.TestLogger; +import static org.junit.Assert.assertTrue; +import org.junit.Test; +import org.reflections.Reflections; + +/** + * Scans the class path for type information and checks if there is a test for it. + */ +public class TypeInfoTestCoverageTest extends TestLogger { + + @Test + public void testTypeInfoTestCoverage() { + Reflections reflections = new Reflections("org.apache.flink"); + + Set> typeInfos = reflections.getSubTypesOf(TypeInformation.class); + Set> typeInfoTests = reflections.getSubTypesOf(TypeInformationTestBase.class); + + // check if a test exists for each type information + for (Class typeInfo : typeInfos) { + // we skip abstract classes and inner classes to skip type information defined in test classes + if (Modifier.isAbstract(typeInfo.getModifiers()) || + Modifier.isPrivate(typeInfo.getModifiers()) || + typeInfo.getName().contains("Test$") || + typeInfo.getName().contains("TestBase$") || + typeInfo.getName().contains("ITCase$") || + typeInfo.getName().contains("$$anon")) { + continue; + } + boolean found = false; + for (Class typeInfoTest : typeInfoTests) { + if (typeInfoTest.getName().equals(typeInfo.getName() + "Test")) { + found = true; + } + } + assertTrue("Could not find test that corresponds to " + typeInfo.getName(), found); + } + } +} From 35b74f2bc2247fe00f894167ce49ab063f2a7e8b Mon Sep 17 00:00:00 2001 From: zentol Date: Thu, 27 Apr 2017 15:56:48 +0200 Subject: [PATCH 013/360] [FLINK-6396] Fix FsSavepointStreamFactoryTest on Windows --- .../state/filesystem/FsSavepointStreamFactoryTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FsSavepointStreamFactoryTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FsSavepointStreamFactoryTest.java index a29d29cb7a0d90..3095a09590f048 100644 --- a/flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FsSavepointStreamFactoryTest.java +++ b/flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FsSavepointStreamFactoryTest.java @@ -23,6 +23,7 @@ import java.io.File; import org.apache.flink.api.common.JobID; +import org.apache.flink.core.fs.FileStatus; import org.apache.flink.core.fs.Path; import org.apache.flink.runtime.state.filesystem.FsCheckpointStreamFactory.FsCheckpointStateOutputStream; import org.junit.Rule; @@ -48,7 +49,8 @@ public void testSavepointStreamDirectoryLayout() throws Exception { jobId, 0); - File[] listed = testRoot.listFiles(); + Path root = new Path(testRoot.getAbsolutePath()); + FileStatus[] listed = root.getFileSystem().listStatus(root); assertNotNull(listed); assertEquals(0, listed.length); @@ -59,9 +61,9 @@ public void testSavepointStreamDirectoryLayout() throws Exception { FileStateHandle handle = (FileStateHandle) stream.closeAndGetHandle(); - listed = testRoot.listFiles(); + listed = root.getFileSystem().listStatus(root); assertNotNull(listed); assertEquals(1, listed.length); - assertEquals(handle.getFilePath().getPath(), listed[0].getPath()); + assertEquals(handle.getFilePath().getPath(), listed[0].getPath().getPath()); } } From e5adf11342337994ea9da3f50ce7b587086bf820 Mon Sep 17 00:00:00 2001 From: zentol Date: Wed, 3 May 2017 15:49:03 +0200 Subject: [PATCH 014/360] [FLINK-5720] Deprecate DataStream#fold() --- .../streaming/state/RocksDBFoldingState.java | 3 +++ .../api/common/functions/FoldFunction.java | 3 +++ .../api/common/functions/RichFoldFunction.java | 3 +++ .../api/common/functions/RuntimeContext.java | 3 +++ .../flink/api/common/state/FoldingState.java | 3 +++ .../common/state/FoldingStateDescriptor.java | 3 +++ .../api/common/state/KeyedStateStore.java | 5 ++++- .../flink/api/common/state/StateBinder.java | 3 +++ .../api/java/typeutils/TypeExtractor.java | 8 ++++++++ .../state/AbstractKeyedStateBackend.java | 5 ++++- .../runtime/state/heap/HeapFoldingState.java | 7 +++++-- .../state/internal/InternalFoldingState.java | 3 +++ .../api/datastream/AllWindowedStream.java | 18 ++++++++++++++++++ .../streaming/api/datastream/KeyedStream.java | 6 ++++++ .../api/datastream/WindowedStream.java | 18 ++++++++++++++++++ .../windowing/FoldApplyAllWindowFunction.java | 3 +++ .../FoldApplyProcessAllWindowFunction.java | 3 +++ .../FoldApplyProcessWindowFunction.java | 3 +++ .../windowing/FoldApplyWindowFunction.java | 3 +++ .../api/operators/StreamGroupedFold.java | 3 +++ .../api/scala/AllWindowedStream.scala | 10 ++++++++-- .../streaming/api/scala/KeyedStream.scala | 3 +++ .../streaming/api/scala/WindowedStream.scala | 8 +++++++- 23 files changed, 120 insertions(+), 7 deletions(-) diff --git a/flink-contrib/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBFoldingState.java b/flink-contrib/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBFoldingState.java index 26dc3ddb2bf29f..d5d9fce0189b30 100644 --- a/flink-contrib/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBFoldingState.java +++ b/flink-contrib/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBFoldingState.java @@ -39,7 +39,10 @@ * @param The type of the namespace. * @param The type of the values that can be folded into the state. * @param The type of the value in the folding state. + * + * @deprecated will be removed in a future version */ +@Deprecated public class RocksDBFoldingState extends AbstractRocksDBState, FoldingStateDescriptor, ACC> implements InternalFoldingState { diff --git a/flink-core/src/main/java/org/apache/flink/api/common/functions/FoldFunction.java b/flink-core/src/main/java/org/apache/flink/api/common/functions/FoldFunction.java index b52828eb30e443..b3fd700c748aa4 100644 --- a/flink-core/src/main/java/org/apache/flink/api/common/functions/FoldFunction.java +++ b/flink-core/src/main/java/org/apache/flink/api/common/functions/FoldFunction.java @@ -38,8 +38,11 @@ * * @param Type of the initial input and the returned element * @param Type of the elements that the group/list/stream contains + * + * @deprecated use {@link AggregateFunction} instead */ @Public +@Deprecated public interface FoldFunction extends Function, Serializable { /** * The core method of FoldFunction, combining two values into one value of the same type. diff --git a/flink-core/src/main/java/org/apache/flink/api/common/functions/RichFoldFunction.java b/flink-core/src/main/java/org/apache/flink/api/common/functions/RichFoldFunction.java index 245550d8f47c68..516e1b4ac98dea 100644 --- a/flink-core/src/main/java/org/apache/flink/api/common/functions/RichFoldFunction.java +++ b/flink-core/src/main/java/org/apache/flink/api/common/functions/RichFoldFunction.java @@ -28,8 +28,11 @@ * * @param Type of the initial input and the returned element * @param Type of the elements that the group/list/stream contains + * + *@deprecated use {@link RichAggregateFunction} instead */ @Public +@Deprecated public abstract class RichFoldFunction extends AbstractRichFunction implements FoldFunction { private static final long serialVersionUID = 1L; diff --git a/flink-core/src/main/java/org/apache/flink/api/common/functions/RuntimeContext.java b/flink-core/src/main/java/org/apache/flink/api/common/functions/RuntimeContext.java index 2978f3abe6a5c3..38155f6e375529 100644 --- a/flink-core/src/main/java/org/apache/flink/api/common/functions/RuntimeContext.java +++ b/flink-core/src/main/java/org/apache/flink/api/common/functions/RuntimeContext.java @@ -394,8 +394,11 @@ public interface RuntimeContext { * * @throws UnsupportedOperationException Thrown, if no partitioned state is available for the * function (function is not part of a KeyedStream). + * + * @deprecated will be removed in a future version */ @PublicEvolving + @Deprecated FoldingState getFoldingState(FoldingStateDescriptor stateProperties); /** diff --git a/flink-core/src/main/java/org/apache/flink/api/common/state/FoldingState.java b/flink-core/src/main/java/org/apache/flink/api/common/state/FoldingState.java index 684a6121afedc4..7e45399986044e 100644 --- a/flink-core/src/main/java/org/apache/flink/api/common/state/FoldingState.java +++ b/flink-core/src/main/java/org/apache/flink/api/common/state/FoldingState.java @@ -35,6 +35,9 @@ * * @param Type of the values folded into the state * @param Type of the value in the state + * + * @deprecated will be removed in a future version */ @PublicEvolving +@Deprecated public interface FoldingState extends AppendingState {} diff --git a/flink-core/src/main/java/org/apache/flink/api/common/state/FoldingStateDescriptor.java b/flink-core/src/main/java/org/apache/flink/api/common/state/FoldingStateDescriptor.java index 73bfaa88ae0cfd..f7609c39bf134d 100644 --- a/flink-core/src/main/java/org/apache/flink/api/common/state/FoldingStateDescriptor.java +++ b/flink-core/src/main/java/org/apache/flink/api/common/state/FoldingStateDescriptor.java @@ -32,8 +32,11 @@ * * @param Type of the values folded int othe state * @param Type of the value in the state + * + * @deprecated will be removed in a future version in favor of {@link AggregatingStateDescriptor} */ @PublicEvolving +@Deprecated public class FoldingStateDescriptor extends StateDescriptor, ACC> { private static final long serialVersionUID = 1L; diff --git a/flink-core/src/main/java/org/apache/flink/api/common/state/KeyedStateStore.java b/flink-core/src/main/java/org/apache/flink/api/common/state/KeyedStateStore.java index 2187f6c5073a3e..ea9ac41d71c6ce 100644 --- a/flink-core/src/main/java/org/apache/flink/api/common/state/KeyedStateStore.java +++ b/flink-core/src/main/java/org/apache/flink/api/common/state/KeyedStateStore.java @@ -193,8 +193,11 @@ public interface KeyedStateStore { * * @throws UnsupportedOperationException Thrown, if no partitioned state is available for the * function (function is not part of a KeyedStream). + * + * @deprecated will be removed in a future version */ @PublicEvolving + @Deprecated FoldingState getFoldingState(FoldingStateDescriptor stateProperties); /** @@ -236,4 +239,4 @@ public interface KeyedStateStore { */ @PublicEvolving MapState getMapState(MapStateDescriptor stateProperties); -} \ No newline at end of file +} diff --git a/flink-core/src/main/java/org/apache/flink/api/common/state/StateBinder.java b/flink-core/src/main/java/org/apache/flink/api/common/state/StateBinder.java index 9df7a47c53cd91..a37392394a4f2e 100644 --- a/flink-core/src/main/java/org/apache/flink/api/common/state/StateBinder.java +++ b/flink-core/src/main/java/org/apache/flink/api/common/state/StateBinder.java @@ -68,7 +68,10 @@ AggregatingState createAggregatingState( * * @param Type of the values folded into the state * @param Type of the value in the state + * + * @deprecated will be removed in a future version */ + @Deprecated FoldingState createFoldingState(FoldingStateDescriptor stateDesc) throws Exception; /** diff --git a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java index a5f236ff62bae0..f1bf9575bb41fa 100644 --- a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java +++ b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java @@ -177,13 +177,21 @@ public static TypeInformation getFlatMapReturnTypes(FlatMapFuncti return getUnaryOperatorReturnType((Function) flatMapInterface, FlatMapFunction.class, false, true, inType, functionName, allowMissing); } + /** + * @deprecated will be removed in a future version + */ @PublicEvolving + @Deprecated public static TypeInformation getFoldReturnTypes(FoldFunction foldInterface, TypeInformation inType) { return getFoldReturnTypes(foldInterface, inType, null, false); } + /** + * @deprecated will be removed in a future version + */ @PublicEvolving + @Deprecated public static TypeInformation getFoldReturnTypes(FoldFunction foldInterface, TypeInformation inType, String functionName, boolean allowMissing) { return getUnaryOperatorReturnType((Function) foldInterface, FoldFunction.class, false, false, inType, functionName, allowMissing); diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/state/AbstractKeyedStateBackend.java b/flink-runtime/src/main/java/org/apache/flink/runtime/state/AbstractKeyedStateBackend.java index 47ebe3b73f5585..2b225df39de2ef 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/state/AbstractKeyedStateBackend.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/state/AbstractKeyedStateBackend.java @@ -195,8 +195,11 @@ protected abstract InternalAggregatingState createAggreg * * @param The type of the namespace. * @param Type of the values folded into the state - * @param Type of the value in the state * + * @param Type of the value in the state + * + * @deprecated will be removed in a future version */ + @Deprecated protected abstract InternalFoldingState createFoldingState( TypeSerializer namespaceSerializer, FoldingStateDescriptor stateDesc) throws Exception; diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapFoldingState.java b/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapFoldingState.java index dad6d0d48d6cc7..3a77ccafb2f534 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapFoldingState.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapFoldingState.java @@ -36,7 +36,10 @@ * @param The type of the namespace. * @param The type of the values that can be folded into the state. * @param The type of the value in the folding state. + * + * @deprecated will be removed in a future version */ +@Deprecated public class HeapFoldingState extends AbstractHeapState, FoldingStateDescriptor> implements InternalFoldingState { @@ -84,7 +87,7 @@ public void add(T value) throws IOException { } } - static final class FoldTransformation implements StateTransformationFunction { + private static final class FoldTransformation implements StateTransformationFunction { private final FoldingStateDescriptor stateDescriptor; private final FoldFunction foldFunction; @@ -99,4 +102,4 @@ public ACC apply(ACC previousState, T value) throws Exception { return foldFunction.fold((previousState != null) ? previousState : stateDescriptor.getDefaultValue(), value); } } -} \ No newline at end of file +} diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/state/internal/InternalFoldingState.java b/flink-runtime/src/main/java/org/apache/flink/runtime/state/internal/InternalFoldingState.java index eb58ce50f4a95f..4ef258f9305807 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/state/internal/InternalFoldingState.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/state/internal/InternalFoldingState.java @@ -28,5 +28,8 @@ * @param The type of the namespace * @param Type of the values folded into the state * @param Type of the value in the state + * + * @deprecated will be removed in a future version */ +@Deprecated public interface InternalFoldingState extends InternalAppendingState, FoldingState {} diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java index 0d953a9fdc9a9f..7ea65fc007060a 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java @@ -754,7 +754,10 @@ public SingleOutputStreamOperator aggregate( * * @param function The fold function. * @return The data stream that is the result of applying the fold function to the window. + * + * @deprecated use {@link #aggregate(AggregateFunction)} instead */ + @Deprecated public SingleOutputStreamOperator fold(R initialValue, FoldFunction function) { if (function instanceof RichFunction) { throw new UnsupportedOperationException("FoldFunction of fold can not be a RichFunction. " + @@ -774,7 +777,10 @@ public SingleOutputStreamOperator fold(R initialValue, FoldFunction * * @param function The fold function. * @return The data stream that is the result of applying the fold function to the window. + * + * @deprecated use {@link #aggregate(AggregateFunction, TypeInformation, TypeInformation)} instead */ + @Deprecated public SingleOutputStreamOperator fold(R initialValue, FoldFunction function, TypeInformation resultType) { if (function instanceof RichFunction) { throw new UnsupportedOperationException("FoldFunction of fold can not be a RichFunction. " + @@ -795,8 +801,11 @@ public SingleOutputStreamOperator fold(R initialValue, FoldFunction * @param foldFunction The fold function that is used for incremental aggregation. * @param function The window function. * @return The data stream that is the result of applying the window function to the window. + * + * @deprecated use {@link #aggregate(AggregateFunction, ProcessAllWindowFunction)} instead */ @PublicEvolving + @Deprecated public SingleOutputStreamOperator fold(ACC initialValue, FoldFunction foldFunction, AllWindowFunction function) { TypeInformation foldAccumulatorType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(), @@ -821,8 +830,11 @@ public SingleOutputStreamOperator fold(ACC initialValue, FoldFunctio * @param foldAccumulatorType Type information for the result type of the fold function * @param resultType Type information for the result type of the window function * @return The data stream that is the result of applying the window function to the window. + * + * @deprecated use {@link #aggregate(AggregateFunction, AllWindowFunction, TypeInformation, TypeInformation, TypeInformation)} instead */ @PublicEvolving + @Deprecated public SingleOutputStreamOperator fold(ACC initialValue, FoldFunction foldFunction, AllWindowFunction function, @@ -901,8 +913,11 @@ public SingleOutputStreamOperator fold(ACC initialValue, * @param foldFunction The fold function that is used for incremental aggregation. * @param function The window function. * @return The data stream that is the result of applying the window function to the window. + * + * @deprecated use {@link #aggregate(AggregateFunction, ProcessAllWindowFunction)} instead */ @PublicEvolving + @Deprecated public SingleOutputStreamOperator fold(ACC initialValue, FoldFunction foldFunction, ProcessAllWindowFunction function) { TypeInformation foldAccumulatorType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(), @@ -927,8 +942,11 @@ public SingleOutputStreamOperator fold(ACC initialValue, FoldFunctio * @param foldAccumulatorType Type information for the result type of the fold function * @param resultType Type information for the result type of the window function * @return The data stream that is the result of applying the window function to the window. + * + * @deprecated use {@link #aggregate(AggregateFunction, ProcessAllWindowFunction, TypeInformation, TypeInformation, TypeInformation)} instead */ @PublicEvolving + @Deprecated public SingleOutputStreamOperator fold(ACC initialValue, FoldFunction foldFunction, ProcessAllWindowFunction function, diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java index 9334c660f6282e..e3171c37631dc6 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java @@ -416,7 +416,10 @@ public SingleOutputStreamOperator reduce(ReduceFunction reducer) { * @param initialValue * The initialValue passed to the folders for each key. * @return The transformed DataStream. + * + * @deprecated will be removed in a future version */ + @Deprecated public SingleOutputStreamOperator fold(R initialValue, FoldFunction folder) { TypeInformation outType = TypeExtractor.getFoldReturnTypes( @@ -748,8 +751,11 @@ public QueryableStateStream asQueryableState( * @param queryableStateName Name under which to the publish the queryable state instance * @param stateDescriptor State descriptor to create state instance from * @return Queryable state instance + * + * @deprecated will be removed in a future version */ @PublicEvolving + @Deprecated public QueryableStateStream asQueryableState( String queryableStateName, FoldingStateDescriptor stateDescriptor) { diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java index 2d7dafef316a2d..7913e956060bb2 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java @@ -487,7 +487,10 @@ public SingleOutputStreamOperator reduce(ReduceFunction reduceFunction * * @param function The fold function. * @return The data stream that is the result of applying the fold function to the window. + * + * @deprecated use {@link #aggregate(AggregationFunction)} instead */ + @Deprecated public SingleOutputStreamOperator fold(R initialValue, FoldFunction function) { if (function instanceof RichFunction) { throw new UnsupportedOperationException("FoldFunction can not be a RichFunction. " + @@ -507,7 +510,10 @@ public SingleOutputStreamOperator fold(R initialValue, FoldFunction * * @param function The fold function. * @return The data stream that is the result of applying the fold function to the window. + * + * @deprecated use {@link #aggregate(AggregateFunction, TypeInformation, TypeInformation)} instead */ + @Deprecated public SingleOutputStreamOperator fold(R initialValue, FoldFunction function, TypeInformation resultType) { if (function instanceof RichFunction) { throw new UnsupportedOperationException("FoldFunction can not be a RichFunction. " + @@ -528,8 +534,11 @@ public SingleOutputStreamOperator fold(R initialValue, FoldFunction * @param foldFunction The fold function that is used for incremental aggregation. * @param function The window function. * @return The data stream that is the result of applying the window function to the window. + * + * @deprecated use {@link #aggregate(AggregateFunction, WindowFunction)} instead */ @PublicEvolving + @Deprecated public SingleOutputStreamOperator fold(ACC initialValue, FoldFunction foldFunction, WindowFunction function) { TypeInformation foldAccumulatorType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(), @@ -554,8 +563,11 @@ public SingleOutputStreamOperator fold(ACC initialValue, FoldFunctio * @param foldAccumulatorType Type information for the result type of the fold function * @param resultType Type information for the result type of the window function * @return The data stream that is the result of applying the window function to the window. + * + * @deprecated use {@link #aggregate(AggregateFunction, ProcessWindowFunction, TypeInformation, TypeInformation, TypeInformation)} instead */ @PublicEvolving + @Deprecated public SingleOutputStreamOperator fold(ACC initialValue, FoldFunction foldFunction, WindowFunction function, @@ -638,8 +650,11 @@ public SingleOutputStreamOperator fold(ACC initialValue, * @param foldFunction The fold function that is used for incremental aggregation. * @param windowFunction The window function. * @return The data stream that is the result of applying the window function to the window. + * + * @deprecated use {@link #aggregate(AggregateFunction, WindowFunction)} instead */ @PublicEvolving + @Deprecated public SingleOutputStreamOperator fold(ACC initialValue, FoldFunction foldFunction, ProcessWindowFunction windowFunction) { if (foldFunction instanceof RichFunction) { throw new UnsupportedOperationException("FoldFunction can not be a RichFunction."); @@ -667,7 +682,10 @@ public SingleOutputStreamOperator fold(ACC initialValue, FoldFunctio * @param windowFunction The process window function. * @param windowResultType The process window function result type. * @return The data stream that is the result of applying the fold function to the window. + * + * @deprecated use {@link #aggregate(AggregateFunction, WindowFunction, TypeInformation, TypeInformation, TypeInformation)} instead */ + @Deprecated @Internal public SingleOutputStreamOperator fold( ACC initialValue, diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyAllWindowFunction.java index 30662f002d716c..2069f7a4626cd7 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyAllWindowFunction.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyAllWindowFunction.java @@ -37,8 +37,11 @@ /** * Internal {@link AllWindowFunction} that is used for implementing a fold on a window configuration * that only allows {@link AllWindowFunction} and cannot directly execute a {@link FoldFunction}. + * + * @deprecated will be removed in a future version */ @Internal +@Deprecated public class FoldApplyAllWindowFunction extends WrappingFunction> implements AllWindowFunction, OutputTypeConfigurable { diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java index 38244dd0a25dc6..8982c7102621ae 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java @@ -39,8 +39,11 @@ * Internal {@link ProcessAllWindowFunction} that is used for implementing a fold on a window * configuration that only allows {@link ProcessAllWindowFunction} and cannot directly execute a * {@link FoldFunction}. + * + * @deprecated will be removed in a future version */ @Internal +@Deprecated public class FoldApplyProcessAllWindowFunction extends RichProcessAllWindowFunction implements OutputTypeConfigurable { diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java index 1b2c2e252fb6ab..0e0356a640bac5 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java @@ -39,8 +39,11 @@ * Internal {@link ProcessWindowFunction} that is used for implementing a fold on a window * configuration that only allows {@link ProcessWindowFunction} and cannot directly execute a * {@link FoldFunction}. + * + * @deprecated will be removed in a future version */ @Internal +@Deprecated public class FoldApplyProcessWindowFunction extends RichProcessWindowFunction implements OutputTypeConfigurable { diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyWindowFunction.java index 770deb0e493870..865dbc9548bedc 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyWindowFunction.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyWindowFunction.java @@ -37,8 +37,11 @@ /** * Internal {@link WindowFunction} that is used for implementing a fold on a window configuration * that only allows {@link WindowFunction} and cannot directly execute a {@link FoldFunction}. + * + * @deprecated will be removed in a future version */ @Internal +@Deprecated public class FoldApplyWindowFunction extends WrappingFunction> implements WindowFunction, OutputTypeConfigurable { diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedFold.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedFold.java index 1ed717812a497c..07c5c900bf9540 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedFold.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedFold.java @@ -35,8 +35,11 @@ /** * A {@link StreamOperator} for executing a {@link FoldFunction} on a * {@link org.apache.flink.streaming.api.datastream.KeyedStream}. + * + * @deprecated will be removed in a future version */ @Internal +@Deprecated public class StreamGroupedFold extends AbstractUdfStreamOperator> implements OneInputStreamOperator, OutputTypeConfigurable { diff --git a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/AllWindowedStream.scala b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/AllWindowedStream.scala index 757e45f8d4fc3c..bbdcf4a9322f2d 100644 --- a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/AllWindowedStream.scala +++ b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/AllWindowedStream.scala @@ -401,7 +401,8 @@ class AllWindowedStream[T, W <: Window](javaStream: JavaAllWStream[T, W]) { * * @param function The fold function. * @return The data stream that is the result of applying the fold function to the window. - */ + */ + @deprecated("use [[aggregate()]] instead") def fold[R: TypeInformation]( initialValue: R, function: FoldFunction[T,R]): DataStream[R] = { @@ -421,7 +422,8 @@ class AllWindowedStream[T, W <: Window](javaStream: JavaAllWStream[T, W]) { * * @param function The fold function. * @return The data stream that is the result of applying the fold function to the window. - */ + */ + @deprecated("use [[aggregate()]] instead") def fold[R: TypeInformation](initialValue: R)(function: (R, T) => R): DataStream[R] = { if (function == null) { throw new NullPointerException("Fold function must not be null.") @@ -444,6 +446,7 @@ class AllWindowedStream[T, W <: Window](javaStream: JavaAllWStream[T, W]) { * @param windowFunction The window function. * @return The data stream that is the result of applying the window function to the window. */ + @deprecated("use [[aggregate()]] instead") def fold[ACC: TypeInformation, R: TypeInformation]( initialValue: ACC, preAggregator: FoldFunction[T, ACC], @@ -474,6 +477,7 @@ class AllWindowedStream[T, W <: Window](javaStream: JavaAllWStream[T, W]) { * @param windowFunction The process window function. * @return The data stream that is the result of applying the window function to the window. */ + @deprecated("use [[aggregate()]] instead") @PublicEvolving def fold[ACC: TypeInformation, R: TypeInformation]( initialValue: ACC, @@ -505,6 +509,7 @@ class AllWindowedStream[T, W <: Window](javaStream: JavaAllWStream[T, W]) { * @param windowFunction The window function. * @return The data stream that is the result of applying the window function to the window. */ + @deprecated("use [[aggregate()]] instead") def fold[ACC: TypeInformation, R: TypeInformation]( initialValue: ACC, preAggregator: (ACC, T) => ACC, @@ -540,6 +545,7 @@ class AllWindowedStream[T, W <: Window](javaStream: JavaAllWStream[T, W]) { * @param windowFunction The window function. * @return The data stream that is the result of applying the window function to the window. */ + @deprecated("use [[aggregate()]] instead") @PublicEvolving def fold[ACC: TypeInformation, R: TypeInformation]( initialValue: ACC, diff --git a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/KeyedStream.scala b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/KeyedStream.scala index d5ef89f9e34131..aaeb1ec3eab369 100644 --- a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/KeyedStream.scala +++ b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/KeyedStream.scala @@ -184,6 +184,7 @@ class KeyedStream[T, K](javaStream: KeyedJavaStream[T, K]) extends DataStream[T] * using an associative fold function and an initial value. An independent * aggregate is kept per key. */ + @deprecated("will be removed in a future version") def fold[R: TypeInformation](initialValue: R, folder: FoldFunction[T,R]): DataStream[R] = { if (folder == null) { @@ -201,6 +202,7 @@ class KeyedStream[T, K](javaStream: KeyedJavaStream[T, K]) extends DataStream[T] * using an associative fold function and an initial value. An independent * aggregate is kept per key. */ + @deprecated("will be removed in a future version") def fold[R: TypeInformation](initialValue: R)(fun: (R,T) => R): DataStream[R] = { if (fun == null) { throw new NullPointerException("Fold function must not be null.") @@ -507,6 +509,7 @@ class KeyedStream[T, K](javaStream: KeyedJavaStream[T, K]) extends DataStream[T] * @return Queryable state instance */ @PublicEvolving + @deprecated("will be removed in a future version") def asQueryableState[ACC]( queryableStateName: String, stateDescriptor: FoldingStateDescriptor[T, ACC]) : QueryableStateStream[K, ACC] = { diff --git a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/WindowedStream.scala b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/WindowedStream.scala index 4e0e1a490de57b..0f8a6e0f35877d 100644 --- a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/WindowedStream.scala +++ b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/WindowedStream.scala @@ -382,6 +382,7 @@ class WindowedStream[T, K, W <: Window](javaStream: JavaWStream[T, K, W]) { * @param function The fold function. * @return The data stream that is the result of applying the fold function to the window. */ + @deprecated("use [[aggregate()]] instead") def fold[R: TypeInformation]( initialValue: R, function: FoldFunction[T,R]): DataStream[R] = { @@ -401,7 +402,8 @@ class WindowedStream[T, K, W <: Window](javaStream: JavaWStream[T, K, W]) { * * @param function The fold function. * @return The data stream that is the result of applying the fold function to the window. - */ + */ + @deprecated("use [[aggregate()]] instead") def fold[R: TypeInformation](initialValue: R)(function: (R, T) => R): DataStream[R] = { if (function == null) { throw new NullPointerException("Fold function must not be null.") @@ -423,6 +425,7 @@ class WindowedStream[T, K, W <: Window](javaStream: JavaWStream[T, K, W]) { * @param function The window function. * @return The data stream that is the result of applying the window function to the window. */ + @deprecated("use [[aggregate()]] instead") def fold[ACC: TypeInformation, R: TypeInformation]( initialValue: ACC, foldFunction: FoldFunction[T, ACC], @@ -452,6 +455,7 @@ class WindowedStream[T, K, W <: Window](javaStream: JavaWStream[T, K, W]) { * @param windowFunction The window function. * @return The data stream that is the result of applying the window function to the window. */ + @deprecated("use [[aggregate()]] instead") def fold[ACC: TypeInformation, R: TypeInformation]( initialValue: ACC, foldFunction: (ACC, T) => ACC, @@ -486,6 +490,7 @@ class WindowedStream[T, K, W <: Window](javaStream: JavaWStream[T, K, W]) { * @param function The process window function. * @return The data stream that is the result of applying the window function to the window. */ + @deprecated("use [[aggregate()]] instead") @PublicEvolving def fold[R: TypeInformation, ACC: TypeInformation]( initialValue: ACC, @@ -516,6 +521,7 @@ class WindowedStream[T, K, W <: Window](javaStream: JavaWStream[T, K, W]) { * @param function The process window function. * @return The data stream that is the result of applying the window function to the window. */ + @deprecated("use [[aggregate()]] instead") @PublicEvolving def fold[R: TypeInformation, ACC: TypeInformation]( initialValue: ACC, From e76a0aa9e2324c4647509379fe4125d8dc576ff0 Mon Sep 17 00:00:00 2001 From: zentol Date: Wed, 3 May 2017 15:57:05 +0200 Subject: [PATCH 015/360] [FLINK-6164] Make ProcessWindowFunction a RichFunction --- .../FoldApplyProcessAllWindowFunction.java | 2 +- .../FoldApplyProcessWindowFunction.java | 2 +- .../windowing/ProcessAllWindowFunction.java | 4 +- .../windowing/ProcessWindowFunction.java | 4 +- .../ReduceApplyProcessAllWindowFunction.java | 3 +- .../ReduceApplyProcessWindowFunction.java | 2 +- .../RichProcessAllWindowFunction.java | 53 ++----------------- .../windowing/RichProcessWindowFunction.java | 53 ++----------------- .../functions/InternalWindowFunctionTest.java | 11 ++-- ...ignedProcessingTimeWindowOperatorTest.java | 4 +- .../function/ProcessAllWindowFunction.scala | 7 ++- .../function/ProcessWindowFunction.scala | 6 ++- .../RichProcessAllWindowFunction.scala | 53 +------------------ .../function/RichProcessWindowFunction.scala | 53 +------------------ .../ScalaProcessWindowFunctionWrapper.scala | 20 +++---- ...IdentityRichProcessAllWindowFunction.scala | 4 +- ...ingIdentityRichProcessWindowFunction.scala | 4 +- 17 files changed, 45 insertions(+), 240 deletions(-) diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java index 8982c7102621ae..1d392523a0c42d 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessAllWindowFunction.java @@ -45,7 +45,7 @@ @Internal @Deprecated public class FoldApplyProcessAllWindowFunction - extends RichProcessAllWindowFunction + extends ProcessAllWindowFunction implements OutputTypeConfigurable { private static final long serialVersionUID = 1L; diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java index 0e0356a640bac5..fa4fe8608e6df9 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/FoldApplyProcessWindowFunction.java @@ -45,7 +45,7 @@ @Internal @Deprecated public class FoldApplyProcessWindowFunction - extends RichProcessWindowFunction + extends ProcessWindowFunction implements OutputTypeConfigurable { private static final long serialVersionUID = 1L; diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ProcessAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ProcessAllWindowFunction.java index 4d247a71f76b95..34a37bfcfea676 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ProcessAllWindowFunction.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ProcessAllWindowFunction.java @@ -19,7 +19,7 @@ package org.apache.flink.streaming.api.functions.windowing; import org.apache.flink.annotation.PublicEvolving; -import org.apache.flink.api.common.functions.Function; +import org.apache.flink.api.common.functions.AbstractRichFunction; import org.apache.flink.api.common.state.KeyedStateStore; import org.apache.flink.streaming.api.windowing.windows.Window; import org.apache.flink.util.Collector; @@ -33,7 +33,7 @@ * @param The type of {@code Window} that this window function can be applied on. */ @PublicEvolving -public abstract class ProcessAllWindowFunction implements Function { +public abstract class ProcessAllWindowFunction extends AbstractRichFunction { private static final long serialVersionUID = 1L; diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ProcessWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ProcessWindowFunction.java index 2c80e9e7d9d4e5..506b6109f5519b 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ProcessWindowFunction.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ProcessWindowFunction.java @@ -19,7 +19,7 @@ package org.apache.flink.streaming.api.functions.windowing; import org.apache.flink.annotation.PublicEvolving; -import org.apache.flink.api.common.functions.Function; +import org.apache.flink.api.common.functions.AbstractRichFunction; import org.apache.flink.api.common.state.KeyedStateStore; import org.apache.flink.streaming.api.windowing.windows.Window; import org.apache.flink.util.Collector; @@ -34,7 +34,7 @@ * @param The type of {@code Window} that this window function can be applied on. */ @PublicEvolving -public abstract class ProcessWindowFunction implements Function { +public abstract class ProcessWindowFunction extends AbstractRichFunction { private static final long serialVersionUID = 1L; diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessAllWindowFunction.java index d1f9ccdf3a9694..e7e66099a7520a 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessAllWindowFunction.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessAllWindowFunction.java @@ -32,8 +32,7 @@ * {@link ReduceFunction}. */ @Internal -public class ReduceApplyProcessAllWindowFunction - extends RichProcessAllWindowFunction { +public class ReduceApplyProcessAllWindowFunction extends ProcessAllWindowFunction { private static final long serialVersionUID = 1L; diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessWindowFunction.java index 836726d850874e..18037b77a4e8b9 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessWindowFunction.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/ReduceApplyProcessWindowFunction.java @@ -33,7 +33,7 @@ */ @Internal public class ReduceApplyProcessWindowFunction - extends RichProcessWindowFunction { + extends ProcessWindowFunction { private static final long serialVersionUID = 1L; diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichProcessAllWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichProcessAllWindowFunction.java index 1130fa5ef86306..a800870ff05908 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichProcessAllWindowFunction.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichProcessAllWindowFunction.java @@ -19,10 +19,6 @@ package org.apache.flink.streaming.api.functions.windowing; import org.apache.flink.annotation.PublicEvolving; -import org.apache.flink.api.common.functions.IterationRuntimeContext; -import org.apache.flink.api.common.functions.RichFunction; -import org.apache.flink.api.common.functions.RuntimeContext; -import org.apache.flink.configuration.Configuration; import org.apache.flink.streaming.api.windowing.windows.Window; /** @@ -32,53 +28,12 @@ * @param The type of the input value. * @param The type of the output value. * @param The type of {@code Window} that this window function can be applied on. + * + * @deprecated use {@link ProcessAllWindowFunction} instead */ @PublicEvolving -public abstract class RichProcessAllWindowFunction - extends ProcessAllWindowFunction - implements RichFunction { +@Deprecated +public abstract class RichProcessAllWindowFunction extends ProcessAllWindowFunction { private static final long serialVersionUID = 1L; - - - // -------------------------------------------------------------------------------------------- - // Runtime context access - // -------------------------------------------------------------------------------------------- - - private transient RuntimeContext runtimeContext; - - @Override - public void setRuntimeContext(RuntimeContext t) { - this.runtimeContext = t; - } - - @Override - public RuntimeContext getRuntimeContext() { - if (this.runtimeContext != null) { - return this.runtimeContext; - } else { - throw new IllegalStateException("The runtime context has not been initialized."); - } - } - - @Override - public IterationRuntimeContext getIterationRuntimeContext() { - if (this.runtimeContext == null) { - throw new IllegalStateException("The runtime context has not been initialized."); - } else if (this.runtimeContext instanceof IterationRuntimeContext) { - return (IterationRuntimeContext) this.runtimeContext; - } else { - throw new IllegalStateException("This stub is not part of an iteration step function."); - } - } - - // -------------------------------------------------------------------------------------------- - // Default life cycle methods - // -------------------------------------------------------------------------------------------- - - @Override - public void open(Configuration parameters) throws Exception {} - - @Override - public void close() throws Exception {} } diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichProcessWindowFunction.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichProcessWindowFunction.java index ac55bc6c786e3c..83da0659169dd9 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichProcessWindowFunction.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/RichProcessWindowFunction.java @@ -19,10 +19,6 @@ package org.apache.flink.streaming.api.functions.windowing; import org.apache.flink.annotation.PublicEvolving; -import org.apache.flink.api.common.functions.IterationRuntimeContext; -import org.apache.flink.api.common.functions.RichFunction; -import org.apache.flink.api.common.functions.RuntimeContext; -import org.apache.flink.configuration.Configuration; import org.apache.flink.streaming.api.windowing.windows.Window; /** @@ -33,53 +29,12 @@ * @param The type of the output value. * @param The type of the key. * @param The type of {@code Window} that this window function can be applied on. + * + * @deprecated use {@link ProcessWindowFunction} instead */ @PublicEvolving -public abstract class RichProcessWindowFunction - extends ProcessWindowFunction - implements RichFunction { +@Deprecated +public abstract class RichProcessWindowFunction extends ProcessWindowFunction { private static final long serialVersionUID = 1L; - - - // -------------------------------------------------------------------------------------------- - // Runtime context access - // -------------------------------------------------------------------------------------------- - - private transient RuntimeContext runtimeContext; - - @Override - public void setRuntimeContext(RuntimeContext t) { - this.runtimeContext = t; - } - - @Override - public RuntimeContext getRuntimeContext() { - if (this.runtimeContext != null) { - return this.runtimeContext; - } else { - throw new IllegalStateException("The runtime context has not been initialized."); - } - } - - @Override - public IterationRuntimeContext getIterationRuntimeContext() { - if (this.runtimeContext == null) { - throw new IllegalStateException("The runtime context has not been initialized."); - } else if (this.runtimeContext instanceof IterationRuntimeContext) { - return (IterationRuntimeContext) this.runtimeContext; - } else { - throw new IllegalStateException("This stub is not part of an iteration step function."); - } - } - - // -------------------------------------------------------------------------------------------- - // Default life cycle methods - // -------------------------------------------------------------------------------------------- - - @Override - public void open(Configuration parameters) throws Exception {} - - @Override - public void close() throws Exception {} } diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/windowing/functions/InternalWindowFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/windowing/functions/InternalWindowFunctionTest.java index 4b8057f5a6bcb3..4b0f5ab2d5c077 100644 --- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/windowing/functions/InternalWindowFunctionTest.java +++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/windowing/functions/InternalWindowFunctionTest.java @@ -24,11 +24,10 @@ import org.apache.flink.api.common.typeinfo.BasicTypeInfo; import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.configuration.Configuration; +import org.apache.flink.streaming.api.functions.windowing.ProcessAllWindowFunction; import org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction; import org.apache.flink.streaming.util.functions.StreamingFunctionUtils; import org.apache.flink.streaming.api.functions.windowing.RichAllWindowFunction; -import org.apache.flink.streaming.api.functions.windowing.RichProcessAllWindowFunction; -import org.apache.flink.streaming.api.functions.windowing.RichProcessWindowFunction; import org.apache.flink.streaming.api.functions.windowing.RichWindowFunction; import org.apache.flink.streaming.api.operators.OutputTypeConfigurable; import org.apache.flink.streaming.api.windowing.windows.TimeWindow; @@ -612,7 +611,7 @@ public Set merge(Set a, Set b) { } public static class ProcessWindowFunctionMock - extends RichProcessWindowFunction + extends ProcessWindowFunction implements OutputTypeConfigurable { private static final long serialVersionUID = 1L; @@ -626,7 +625,7 @@ public void process(Long aLong, ProcessWindowFunction, String, Long, TimeWindow> + extends ProcessWindowFunction, String, Long, TimeWindow> implements OutputTypeConfigurable { private static final long serialVersionUID = 1L; @@ -640,7 +639,7 @@ public void process(Long aLong, ProcessWindowFunction, String, L } public static class AggregateProcessAllWindowFunctionMock - extends RichProcessAllWindowFunction, String, TimeWindow> + extends ProcessAllWindowFunction, String, TimeWindow> implements OutputTypeConfigurable { private static final long serialVersionUID = 1L; @@ -679,7 +678,7 @@ public void apply(TimeWindow window, Iterable values, Collector ou } public static class ProcessAllWindowFunctionMock - extends RichProcessAllWindowFunction + extends ProcessAllWindowFunction implements OutputTypeConfigurable { private static final long serialVersionUID = 1L; diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingAlignedProcessingTimeWindowOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingAlignedProcessingTimeWindowOperatorTest.java index a8d31548aefdd4..2f7e3020bd5a8d 100644 --- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingAlignedProcessingTimeWindowOperatorTest.java +++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AccumulatingAlignedProcessingTimeWindowOperatorTest.java @@ -35,9 +35,7 @@ import org.apache.flink.runtime.state.StreamStateHandle; import org.apache.flink.runtime.taskmanager.TaskManagerRuntimeInfo; import org.apache.flink.runtime.util.TestingTaskManagerRuntimeInfo; -import org.apache.flink.streaming.api.functions.windowing.RichWindowFunction; import org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction; -import org.apache.flink.streaming.api.functions.windowing.RichProcessWindowFunction; import org.apache.flink.streaming.api.functions.windowing.WindowFunction; import org.apache.flink.streaming.api.windowing.windows.TimeWindow; import org.apache.flink.streaming.runtime.operators.windowing.functions.InternalIterableProcessWindowFunction; @@ -1038,7 +1036,7 @@ private void assertInvalidParameter(long windowSize, long windowSlide) { // ------------------------------------------------------------------------ - private static class StatefulFunction extends RichProcessWindowFunction { + private static class StatefulFunction extends ProcessWindowFunction { // we use a concurrent map here even though there is no concurrency, to // get "volatile" style access to entries diff --git a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/ProcessAllWindowFunction.scala b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/ProcessAllWindowFunction.scala index 2f0e48e0b5cd88..49911e4a165c7e 100644 --- a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/ProcessAllWindowFunction.scala +++ b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/ProcessAllWindowFunction.scala @@ -18,10 +18,8 @@ package org.apache.flink.streaming.api.scala.function -import java.io.Serializable - import org.apache.flink.annotation.PublicEvolving -import org.apache.flink.api.common.functions.Function +import org.apache.flink.api.common.functions.AbstractRichFunction import org.apache.flink.api.common.state.KeyedStateStore import org.apache.flink.streaming.api.windowing.windows.Window import org.apache.flink.util.Collector @@ -35,7 +33,8 @@ import org.apache.flink.util.Collector * @tparam W The type of the window. */ @PublicEvolving -abstract class ProcessAllWindowFunction[IN, OUT, W <: Window] extends Function with Serializable { +abstract class ProcessAllWindowFunction[IN, OUT, W <: Window] + extends AbstractRichFunction { /** * Evaluates the window and outputs none or several elements. * diff --git a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/ProcessWindowFunction.scala b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/ProcessWindowFunction.scala index bc79a267d6eb2f..d2075db836aefc 100644 --- a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/ProcessWindowFunction.scala +++ b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/ProcessWindowFunction.scala @@ -21,7 +21,7 @@ package org.apache.flink.streaming.api.scala.function import java.io.Serializable import org.apache.flink.annotation.PublicEvolving -import org.apache.flink.api.common.functions.Function +import org.apache.flink.api.common.functions.AbstractRichFunction import org.apache.flink.api.common.state.KeyedStateStore import org.apache.flink.streaming.api.windowing.windows.Window import org.apache.flink.util.Collector @@ -36,7 +36,9 @@ import org.apache.flink.util.Collector * @tparam W The type of the window. */ @PublicEvolving -abstract class ProcessWindowFunction[IN, OUT, KEY, W <: Window] extends Function with Serializable { +abstract class ProcessWindowFunction[IN, OUT, KEY, W <: Window] + extends AbstractRichFunction { + /** * Evaluates the window and outputs none or several elements. * diff --git a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/RichProcessAllWindowFunction.scala b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/RichProcessAllWindowFunction.scala index 22d64a83698d3c..6edc1e610aa03a 100644 --- a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/RichProcessAllWindowFunction.scala +++ b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/RichProcessAllWindowFunction.scala @@ -18,11 +18,7 @@ package org.apache.flink.streaming.api.scala.function -import java.beans.Transient - import org.apache.flink.annotation.Public -import org.apache.flink.api.common.functions.{IterationRuntimeContext, RichFunction, RuntimeContext} -import org.apache.flink.configuration.Configuration import org.apache.flink.streaming.api.windowing.windows.Window /** @@ -34,53 +30,8 @@ import org.apache.flink.streaming.api.windowing.windows.Window * @tparam W The type of the window. */ @Public +@deprecated("use [[ProcessAllWindowFunction]] instead") abstract class RichProcessAllWindowFunction[IN, OUT, W <: Window] - extends ProcessAllWindowFunction[IN, OUT, W] - with RichFunction { - - @Transient - private var runtimeContext: RuntimeContext = null - - // -------------------------------------------------------------------------------------------- - // Runtime context access - // -------------------------------------------------------------------------------------------- - - override def setRuntimeContext(t: RuntimeContext) { - this.runtimeContext = t - } - - override def getRuntimeContext: RuntimeContext = { - if (this.runtimeContext != null) { - this.runtimeContext - } - else { - throw new IllegalStateException("The runtime context has not been initialized.") - } - } - - override def getIterationRuntimeContext: IterationRuntimeContext = { - if (this.runtimeContext == null) { - throw new IllegalStateException("The runtime context has not been initialized.") - } - else { - this.runtimeContext match { - case iterationRuntimeContext: IterationRuntimeContext => iterationRuntimeContext - case _ => - throw new IllegalStateException("This stub is not part of an iteration step function.") - } - } - } - - // -------------------------------------------------------------------------------------------- - // Default life cycle methods - // -------------------------------------------------------------------------------------------- - - @throws[Exception] - override def open(parameters: Configuration) { - } - - @throws[Exception] - override def close() { - } + extends ProcessAllWindowFunction[IN, OUT, W] { } diff --git a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/RichProcessWindowFunction.scala b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/RichProcessWindowFunction.scala index 320685a9427d27..d9cd27506591b6 100644 --- a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/RichProcessWindowFunction.scala +++ b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/RichProcessWindowFunction.scala @@ -18,11 +18,7 @@ package org.apache.flink.streaming.api.scala.function -import java.beans.Transient - import org.apache.flink.annotation.Public -import org.apache.flink.api.common.functions.{IterationRuntimeContext, RichFunction, RuntimeContext} -import org.apache.flink.configuration.Configuration import org.apache.flink.streaming.api.windowing.windows.Window /** @@ -35,53 +31,8 @@ import org.apache.flink.streaming.api.windowing.windows.Window * @tparam W The type of the window. */ @Public +@deprecated("use [[ProcessWindowFunction]] instead") abstract class RichProcessWindowFunction[IN, OUT, KEY, W <: Window] - extends ProcessWindowFunction[IN, OUT, KEY, W] - with RichFunction { - - @Transient - private var runtimeContext: RuntimeContext = null - - // -------------------------------------------------------------------------------------------- - // Runtime context access - // -------------------------------------------------------------------------------------------- - - override def setRuntimeContext(t: RuntimeContext) { - this.runtimeContext = t - } - - override def getRuntimeContext: RuntimeContext = { - if (this.runtimeContext != null) { - this.runtimeContext - } - else { - throw new IllegalStateException("The runtime context has not been initialized.") - } - } - - override def getIterationRuntimeContext: IterationRuntimeContext = { - if (this.runtimeContext == null) { - throw new IllegalStateException("The runtime context has not been initialized.") - } - else { - this.runtimeContext match { - case iterationRuntimeContext: IterationRuntimeContext => iterationRuntimeContext - case _ => - throw new IllegalStateException("This stub is not part of an iteration step function.") - } - } - } - - // -------------------------------------------------------------------------------------------- - // Default life cycle methods - // -------------------------------------------------------------------------------------------- - - @throws[Exception] - override def open(parameters: Configuration) { - } - - @throws[Exception] - override def close() { - } + extends ProcessWindowFunction[IN, OUT, KEY, W] { } diff --git a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/util/ScalaProcessWindowFunctionWrapper.scala b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/util/ScalaProcessWindowFunctionWrapper.scala index 263373eeac7f3f..bc4b7ddd54c1fb 100644 --- a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/util/ScalaProcessWindowFunctionWrapper.scala +++ b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/function/util/ScalaProcessWindowFunctionWrapper.scala @@ -21,13 +21,9 @@ package org.apache.flink.streaming.api.scala.function.util import org.apache.flink.api.common.functions.RuntimeContext import org.apache.flink.configuration.Configuration import org.apache.flink.streaming.api.functions.windowing.{ProcessWindowFunction => JProcessWindowFunction} -import org.apache.flink.streaming.api.functions.windowing.{RichProcessWindowFunction => JRichProcessWindowFunction} -import org.apache.flink.streaming.api.functions.windowing.{RichProcessAllWindowFunction => JRichProcessAllWindowFunction} import org.apache.flink.streaming.api.functions.windowing.{ProcessAllWindowFunction => JProcessAllWindowFunction} import org.apache.flink.streaming.api.scala.function.{ProcessWindowFunction => ScalaProcessWindowFunction} import org.apache.flink.streaming.api.scala.function.{ProcessAllWindowFunction => ScalaProcessAllWindowFunction} -import org.apache.flink.streaming.api.scala.function.{RichProcessWindowFunction => ScalaRichProcessWindowFunction} -import org.apache.flink.streaming.api.scala.function.{RichProcessAllWindowFunction => ScalaRichProcessAllWindowFunction} import org.apache.flink.streaming.api.windowing.windows.Window import org.apache.flink.util.Collector @@ -43,7 +39,7 @@ import scala.collection.JavaConverters._ */ final class ScalaProcessWindowFunctionWrapper[IN, OUT, KEY, W <: Window]( private[this] val func: ScalaProcessWindowFunction[IN, OUT, KEY, W]) - extends JRichProcessWindowFunction[IN, OUT, KEY, W] { + extends JProcessWindowFunction[IN, OUT, KEY, W] { override def process( key: KEY, @@ -82,7 +78,7 @@ final class ScalaProcessWindowFunctionWrapper[IN, OUT, KEY, W <: Window]( override def setRuntimeContext(t: RuntimeContext): Unit = { super.setRuntimeContext(t) func match { - case rfunc: ScalaRichProcessWindowFunction[IN, OUT, KEY, W] => rfunc.setRuntimeContext(t) + case rfunc: ScalaProcessWindowFunction[IN, OUT, KEY, W] => rfunc.setRuntimeContext(t) case _ => } } @@ -90,7 +86,7 @@ final class ScalaProcessWindowFunctionWrapper[IN, OUT, KEY, W <: Window]( override def open(parameters: Configuration): Unit = { super.open(parameters) func match { - case rfunc: ScalaRichProcessWindowFunction[IN, OUT, KEY, W] => rfunc.open(parameters) + case rfunc: ScalaProcessWindowFunction[IN, OUT, KEY, W] => rfunc.open(parameters) case _ => } } @@ -98,7 +94,7 @@ final class ScalaProcessWindowFunctionWrapper[IN, OUT, KEY, W <: Window]( override def close(): Unit = { super.close() func match { - case rfunc: ScalaRichProcessWindowFunction[IN, OUT, KEY, W] => rfunc.close() + case rfunc: ScalaProcessWindowFunction[IN, OUT, KEY, W] => rfunc.close() case _ => } } @@ -114,7 +110,7 @@ final class ScalaProcessWindowFunctionWrapper[IN, OUT, KEY, W <: Window]( */ final class ScalaProcessAllWindowFunctionWrapper[IN, OUT, W <: Window]( private[this] val func: ScalaProcessAllWindowFunction[IN, OUT, W]) - extends JRichProcessAllWindowFunction[IN, OUT, W] { + extends JProcessAllWindowFunction[IN, OUT, W] { override def process( context: JProcessAllWindowFunction[IN, OUT, W]#Context, @@ -145,7 +141,7 @@ final class ScalaProcessAllWindowFunctionWrapper[IN, OUT, W <: Window]( override def setRuntimeContext(t: RuntimeContext): Unit = { super.setRuntimeContext(t) func match { - case rfunc : ScalaRichProcessAllWindowFunction[IN, OUT, W] => rfunc.setRuntimeContext(t) + case rfunc : ScalaProcessAllWindowFunction[IN, OUT, W] => rfunc.setRuntimeContext(t) case _ => } } @@ -153,7 +149,7 @@ final class ScalaProcessAllWindowFunctionWrapper[IN, OUT, W <: Window]( override def open(parameters: Configuration): Unit = { super.open(parameters) func match { - case rfunc : ScalaRichProcessAllWindowFunction[IN, OUT, W] => rfunc.open(parameters) + case rfunc : ScalaProcessAllWindowFunction[IN, OUT, W] => rfunc.open(parameters) case _ => } } @@ -161,7 +157,7 @@ final class ScalaProcessAllWindowFunctionWrapper[IN, OUT, W <: Window]( override def close(): Unit = { super.close() func match { - case rfunc : ScalaRichProcessAllWindowFunction[IN, OUT, W] => rfunc.close() + case rfunc : ScalaProcessAllWindowFunction[IN, OUT, W] => rfunc.close() case _ => } } diff --git a/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/testutils/CheckingIdentityRichProcessAllWindowFunction.scala b/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/testutils/CheckingIdentityRichProcessAllWindowFunction.scala index df005fa63a83a2..146452b78c8572 100644 --- a/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/testutils/CheckingIdentityRichProcessAllWindowFunction.scala +++ b/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/testutils/CheckingIdentityRichProcessAllWindowFunction.scala @@ -20,13 +20,13 @@ package org.apache.flink.streaming.api.scala.testutils import org.apache.flink.api.common.functions.RuntimeContext import org.apache.flink.configuration.Configuration -import org.apache.flink.streaming.api.scala.function.RichProcessAllWindowFunction +import org.apache.flink.streaming.api.scala.function.ProcessAllWindowFunction import org.apache.flink.streaming.api.windowing.windows.Window import org.apache.flink.util.Collector class CheckingIdentityRichProcessAllWindowFunction[T, W <: Window] - extends RichProcessAllWindowFunction[T, T, W] { + extends ProcessAllWindowFunction[T, T, W] { override def process(context: Context, input: Iterable[T], out: Collector[T]): Unit = { for (value <- input) { diff --git a/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/testutils/CheckingIdentityRichProcessWindowFunction.scala b/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/testutils/CheckingIdentityRichProcessWindowFunction.scala index d62f2d3465a649..2ec179a90d3fa7 100644 --- a/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/testutils/CheckingIdentityRichProcessWindowFunction.scala +++ b/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/testutils/CheckingIdentityRichProcessWindowFunction.scala @@ -20,13 +20,13 @@ package org.apache.flink.streaming.api.scala.testutils import org.apache.flink.api.common.functions.RuntimeContext import org.apache.flink.configuration.Configuration -import org.apache.flink.streaming.api.scala.function.RichProcessWindowFunction +import org.apache.flink.streaming.api.scala.function.ProcessWindowFunction import org.apache.flink.streaming.api.windowing.windows.Window import org.apache.flink.util.Collector class CheckingIdentityRichProcessWindowFunction[T, K, W <: Window] - extends RichProcessWindowFunction[T, T, K, W] { + extends ProcessWindowFunction[T, T, K, W] { override def process(key: K, context: Context, input: Iterable[T], out: Collector[T]): Unit = { for (value <- input) { From bb03c07d98988b31d1cece020a3b35abbdaa714f Mon Sep 17 00:00:00 2001 From: zentol Date: Fri, 5 May 2017 12:13:10 +0200 Subject: [PATCH 016/360] [FLINK-6459] Move origin header ConfigOption to JMOptions --- .../org/apache/flink/configuration/ConfigConstants.java | 6 ------ .../org/apache/flink/configuration/JobManagerOptions.java | 8 ++++++++ .../apache/flink/runtime/webmonitor/WebMonitorConfig.java | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/flink-core/src/main/java/org/apache/flink/configuration/ConfigConstants.java b/flink-core/src/main/java/org/apache/flink/configuration/ConfigConstants.java index 975a3d49cf052f..61c1b27ecbeed5 100644 --- a/flink-core/src/main/java/org/apache/flink/configuration/ConfigConstants.java +++ b/flink-core/src/main/java/org/apache/flink/configuration/ConfigConstants.java @@ -1333,12 +1333,6 @@ public final class ConfigConstants { key("jobmanager.web.address") .noDefaultValue(); - /** The config parameter defining the Access-Control-Allow-Origin header for all - * responses from the web-frontend. */ - public static final ConfigOption JOB_MANAGER_WEB_ACCESS_CONTROL_ALLOW_ORIGIN = - key("jobmanager.web.access-control-allow-origin") - .defaultValue("*"); - /** The config key for the port of the JobManager web frontend. * Setting this value to {@code -1} disables the web frontend. */ public static final int DEFAULT_JOB_MANAGER_WEB_FRONTEND_PORT = 8081; diff --git a/flink-core/src/main/java/org/apache/flink/configuration/JobManagerOptions.java b/flink-core/src/main/java/org/apache/flink/configuration/JobManagerOptions.java index 5481d7a32f5c36..140ba2e7545679 100644 --- a/flink-core/src/main/java/org/apache/flink/configuration/JobManagerOptions.java +++ b/flink-core/src/main/java/org/apache/flink/configuration/JobManagerOptions.java @@ -100,6 +100,14 @@ public class JobManagerOptions { key("jobmanager.web.port") .defaultValue(8081); + /** + * The config parameter defining the Access-Control-Allow-Origin header for all + * responses from the web-frontend. + */ + public static final ConfigOption WEB_ACCESS_CONTROL_ALLOW_ORIGIN = + key("jobmanager.web.access-control-allow-origin") + .defaultValue("*"); + /** * Config parameter to override SSL support for the JobManager Web UI */ diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorConfig.java b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorConfig.java index 11e94b0a32e75e..d95d13a0e946e3 100644 --- a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorConfig.java +++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorConfig.java @@ -21,6 +21,7 @@ import org.apache.flink.configuration.ConfigConstants; import org.apache.flink.configuration.Configuration; +import org.apache.flink.configuration.JobManagerOptions; public class WebMonitorConfig { @@ -80,6 +81,6 @@ public boolean isProgramSubmitEnabled() { } public String getAllowOrigin() { - return config.getString(ConfigConstants.JOB_MANAGER_WEB_ACCESS_CONTROL_ALLOW_ORIGIN); + return config.getString(JobManagerOptions.WEB_ACCESS_CONTROL_ALLOW_ORIGIN); } } From a85b1881d184c02075441f57f3364ec80b2d4f4d Mon Sep 17 00:00:00 2001 From: zentol Date: Wed, 23 Nov 2016 16:59:22 +0100 Subject: [PATCH 017/360] [FLINK-5101] Track pending records in CassandraSinkBase --- .../cassandra/CassandraPojoSink.java | 7 ++- .../cassandra/CassandraSinkBase.java | 56 ++++++++++++++----- 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraPojoSink.java b/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraPojoSink.java index 650c481cb851c9..9cfb2f8934348f 100644 --- a/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraPojoSink.java +++ b/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraPojoSink.java @@ -17,6 +17,7 @@ package org.apache.flink.streaming.connectors.cassandra; +import com.datastax.driver.core.ResultSet; import com.datastax.driver.mapping.Mapper; import com.datastax.driver.mapping.MappingManager; import com.google.common.util.concurrent.ListenableFuture; @@ -31,7 +32,7 @@ * * @param Type of the elements emitted by this sink */ -public class CassandraPojoSink extends CassandraSinkBase { +public class CassandraPojoSink extends CassandraSinkBase { private static final long serialVersionUID = 1L; @@ -61,7 +62,7 @@ public void open(Configuration configuration) { } @Override - public ListenableFuture send(IN value) { - return mapper.saveAsync(value); + public ListenableFuture send(IN value) { + return session.executeAsync(mapper.saveQuery(value)); } } diff --git a/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSinkBase.java b/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSinkBase.java index 49b1efacbe5767..b281525b27fd3b 100644 --- a/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSinkBase.java +++ b/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSinkBase.java @@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; +import java.util.concurrent.atomic.AtomicInteger; /** * CassandraSinkBase is the common abstract class of {@link CassandraPojoSink} and {@link CassandraTupleSink}. @@ -40,11 +41,13 @@ public abstract class CassandraSinkBase extends RichSinkFunction { protected transient Cluster cluster; protected transient Session session; - protected transient Throwable exception = null; + protected transient volatile Throwable exception; protected transient FutureCallback callback; private final ClusterBuilder builder; + private final AtomicInteger updatesPending = new AtomicInteger(); + protected CassandraSinkBase(ClusterBuilder builder) { this.builder = builder; ClosureCleaner.clean(builder, true); @@ -55,11 +58,24 @@ public void open(Configuration configuration) { this.callback = new FutureCallback() { @Override public void onSuccess(V ignored) { + int pending = updatesPending.decrementAndGet(); + if (pending == 0) { + synchronized (updatesPending) { + updatesPending.notifyAll(); + } + } } @Override public void onFailure(Throwable t) { + int pending = updatesPending.decrementAndGet(); + if (pending == 0) { + synchronized (updatesPending) { + updatesPending.notifyAll(); + } + } exception = t; + LOG.error("Error while sending value.", t); } }; @@ -70,29 +86,43 @@ public void onFailure(Throwable t) { @Override public void invoke(IN value) throws Exception { if (exception != null) { - throw new IOException("invoke() failed", exception); + throw new IOException("Error while sending value.", exception); } ListenableFuture result = send(value); + updatesPending.incrementAndGet(); Futures.addCallback(result, callback); } public abstract ListenableFuture send(IN value); @Override - public void close() { + public void close() throws Exception { try { - if (session != null) { - session.close(); + if (exception != null) { + throw new IOException("Error while sending value.", exception); } - } catch (Exception e) { - LOG.error("Error while closing session.", e); - } - try { - if (cluster != null) { - cluster.close(); + + while (updatesPending.get() > 0) { + synchronized (updatesPending) { + updatesPending.wait(); + } + } + + } finally { + try { + if (session != null) { + session.close(); + } + } catch (Exception e) { + LOG.error("Error while closing session.", e); + } + try { + if (cluster != null) { + cluster.close(); + } + } catch (Exception e) { + LOG.error("Error while closing cluster.", e); } - } catch (Exception e) { - LOG.error("Error while closing cluster.", e); } } } From 5d6b5a6773a795a3266b6298ae26d4f158ce18c4 Mon Sep 17 00:00:00 2001 From: zentol Date: Wed, 10 May 2017 12:07:42 +0200 Subject: [PATCH 018/360] [FLINK-5101] Refactor CassandraConnectorITCase --- .../cassandra/CassandraConnectorITCase.java | 213 ++++++++---------- 1 file changed, 89 insertions(+), 124 deletions(-) diff --git a/flink-connectors/flink-connector-cassandra/src/test/java/org/apache/flink/streaming/connectors/cassandra/CassandraConnectorITCase.java b/flink-connectors/flink-connector-cassandra/src/test/java/org/apache/flink/streaming/connectors/cassandra/CassandraConnectorITCase.java index f2e8f8bd433a7e..06f3c352da8507 100644 --- a/flink-connectors/flink-connector-cassandra/src/test/java/org/apache/flink/streaming/connectors/cassandra/CassandraConnectorITCase.java +++ b/flink-connectors/flink-connector-cassandra/src/test/java/org/apache/flink/streaming/connectors/cassandra/CassandraConnectorITCase.java @@ -28,39 +28,24 @@ import org.apache.cassandra.service.CassandraDaemon; import org.apache.flink.api.common.ExecutionConfig; -import org.apache.flink.api.common.typeinfo.TypeHint; -import org.apache.flink.api.common.typeinfo.TypeInformation; -import org.apache.flink.api.java.DataSet; -import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.common.JobID; +import org.apache.flink.api.common.io.InputFormat; +import org.apache.flink.api.common.io.OutputFormat; import org.apache.flink.api.java.tuple.Tuple3; import org.apache.flink.api.java.typeutils.TupleTypeInfo; import org.apache.flink.api.java.typeutils.TypeExtractor; import org.apache.flink.batch.connectors.cassandra.CassandraInputFormat; import org.apache.flink.batch.connectors.cassandra.CassandraOutputFormat; -import org.apache.flink.configuration.ConfigConstants; import org.apache.flink.configuration.Configuration; -import org.apache.flink.runtime.io.network.api.writer.ResultPartitionWriter; -import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster; +import org.apache.flink.core.io.InputSplit; import org.apache.flink.runtime.testutils.CommonTestUtils; -import org.apache.flink.streaming.api.datastream.DataStream; -import org.apache.flink.streaming.api.datastream.DataStreamSource; -import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; -import org.apache.flink.streaming.api.functions.source.SourceFunction; import org.apache.flink.streaming.runtime.operators.WriteAheadSinkTestBase; -import org.apache.flink.streaming.util.TestStreamEnvironment; -import org.apache.flink.test.util.TestEnvironment; -import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.runner.RunWith; - -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -71,6 +56,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; +import java.util.List; +import java.util.Random; import java.util.Scanner; import java.util.UUID; @@ -100,12 +87,15 @@ protected Cluster buildCluster(Cluster.Builder builder) { private static Cluster cluster; private static Session session; + private static final String TABLE_NAME_PREFIX = "flink_"; + private static final String TABLE_NAME_VARIABLE = "$TABLE"; private static final String CREATE_KEYSPACE_QUERY = "CREATE KEYSPACE flink WITH replication= {'class':'SimpleStrategy', 'replication_factor':1};"; - private static final String DROP_KEYSPACE_QUERY = "DROP KEYSPACE flink;"; - private static final String CREATE_TABLE_QUERY = "CREATE TABLE flink.test (id text PRIMARY KEY, counter int, batch_id int);"; - private static final String CLEAR_TABLE_QUERY = "TRUNCATE flink.test;"; - private static final String INSERT_DATA_QUERY = "INSERT INTO flink.test (id, counter, batch_id) VALUES (?, ?, ?)"; - private static final String SELECT_DATA_QUERY = "SELECT * FROM flink.test;"; + private static final String CREATE_TABLE_QUERY = "CREATE TABLE flink." + TABLE_NAME_VARIABLE + " (id text PRIMARY KEY, counter int, batch_id int);"; + private static final String INSERT_DATA_QUERY = "INSERT INTO flink." + TABLE_NAME_VARIABLE + " (id, counter, batch_id) VALUES (?, ?, ?)"; + private static final String SELECT_DATA_QUERY = "SELECT * FROM flink." + TABLE_NAME_VARIABLE + ';'; + + private static final Random random = new Random(); + private int tableID; private static final ArrayList> collection = new ArrayList<>(20); @@ -129,12 +119,6 @@ public void stop() { } } - private static LocalFlinkMiniCluster flinkCluster; - - // ------------------------------------------------------------------------ - // Cluster Setup (Cassandra & Flink) - // ------------------------------------------------------------------------ - @BeforeClass public static void startCassandra() throws IOException { @@ -173,39 +157,39 @@ public static void startCassandra() throws IOException { cassandra.start(); } - try { - Thread.sleep(1000 * 10); - } catch (InterruptedException e) { //give cassandra a few seconds to start up + // start establishing a connection within 30 seconds + long start = System.nanoTime(); + long deadline = start + 30_000_000_000L; + while (true) { + try { + cluster = builder.getCluster(); + session = cluster.connect(); + break; + } catch (Exception e) { + if (System.nanoTime() > deadline) { + throw e; + } + try { + Thread.sleep(500); + } catch (InterruptedException ignored) { + } + } } - - cluster = builder.getCluster(); - session = cluster.connect(); + LOG.debug("Connection established after {}ms.", System.currentTimeMillis() - start); session.execute(CREATE_KEYSPACE_QUERY); - session.execute(CREATE_TABLE_QUERY); - } - - @BeforeClass - public static void startFlink() throws Exception { - Configuration config = new Configuration(); - config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, 4); - - flinkCluster = new LocalFlinkMiniCluster(config); - flinkCluster.start(); + session.execute(CREATE_TABLE_QUERY.replace(TABLE_NAME_VARIABLE, TABLE_NAME_PREFIX + "initial")); } - @AfterClass - public static void stopFlink() { - if (flinkCluster != null) { - flinkCluster.stop(); - flinkCluster = null; - } + @Before + public void createTable() { + tableID = random.nextInt(Integer.MAX_VALUE); + session.execute(injectTableName(CREATE_TABLE_QUERY)); } @AfterClass public static void closeCassandra() { if (session != null) { - session.executeAsync(DROP_KEYSPACE_QUERY); session.close(); } @@ -223,21 +207,6 @@ public static void closeCassandra() { } } - // ------------------------------------------------------------------------ - // Test preparation & cleanup - // ------------------------------------------------------------------------ - - @Before - public void initializeExecutionEnvironment() { - TestStreamEnvironment.setAsContext(flinkCluster, 4); - new TestEnvironment(flinkCluster, 4, false).setAsContext(); - } - - @After - public void deleteSchema() throws Exception { - session.executeAsync(CLEAR_TABLE_QUERY); - } - // ------------------------------------------------------------------------ // Exactly-once Tests // ------------------------------------------------------------------------ @@ -245,7 +214,7 @@ public void deleteSchema() throws Exception { @Override protected CassandraTupleWriteAheadSink> createSink() throws Exception { return new CassandraTupleWriteAheadSink<>( - INSERT_DATA_QUERY, + injectTableName(INSERT_DATA_QUERY), TypeExtractor.getForObject(new Tuple3<>("", 0, 0)).createSerializer(new ExecutionConfig()), builder, new CassandraCommitter(builder)); @@ -264,7 +233,7 @@ protected Tuple3 generateValue(int counter, int checkp @Override protected void verifyResultsIdealCircumstances(CassandraTupleWriteAheadSink> sink) { - ResultSet result = session.execute(SELECT_DATA_QUERY); + ResultSet result = session.execute(injectTableName(SELECT_DATA_QUERY)); ArrayList list = new ArrayList<>(); for (int x = 1; x <= 60; x++) { list.add(x); @@ -279,7 +248,7 @@ protected void verifyResultsIdealCircumstances(CassandraTupleWriteAheadSink> sink) { - ResultSet result = session.execute(SELECT_DATA_QUERY); + ResultSet result = session.execute(injectTableName(SELECT_DATA_QUERY)); ArrayList list = new ArrayList<>(); for (int x = 1; x <= 60; x++) { list.add(x); @@ -294,7 +263,7 @@ protected void verifyResultsDataPersistenceUponMissedNotify(CassandraTupleWriteA @Override protected void verifyResultsDataDiscardingUponRestore(CassandraTupleWriteAheadSink> sink) { - ResultSet result = session.execute(SELECT_DATA_QUERY); + ResultSet result = session.execute(injectTableName(SELECT_DATA_QUERY)); ArrayList list = new ArrayList<>(); for (int x = 1; x <= 20; x++) { list.add(x); @@ -324,7 +293,7 @@ protected void verifyResultsWhenReScaling( } ArrayList actual = new ArrayList<>(); - ResultSet result = session.execute(SELECT_DATA_QUERY); + ResultSet result = session.execute(injectTableName(SELECT_DATA_QUERY)); for (Row s : result) { actual.add(s.getInt("counter")); } @@ -335,16 +304,17 @@ protected void verifyResultsWhenReScaling( @Test public void testCassandraCommitter() throws Exception { - CassandraCommitter cc1 = new CassandraCommitter(builder); - cc1.setJobId("job"); + String jobID = new JobID().toString(); + CassandraCommitter cc1 = new CassandraCommitter(builder, "flink_auxiliary_cc"); + cc1.setJobId(jobID); cc1.setOperatorId("operator"); - CassandraCommitter cc2 = new CassandraCommitter(builder); - cc2.setJobId("job"); + CassandraCommitter cc2 = new CassandraCommitter(builder, "flink_auxiliary_cc"); + cc2.setJobId(jobID); cc2.setOperatorId("operator"); - CassandraCommitter cc3 = new CassandraCommitter(builder); - cc3.setJobId("job"); + CassandraCommitter cc3 = new CassandraCommitter(builder, "flink_auxiliary_cc"); + cc3.setJobId(jobID); cc3.setOperatorId("operator1"); cc1.createResource(); @@ -370,8 +340,8 @@ public void testCassandraCommitter() throws Exception { cc2.close(); cc3.close(); - cc1 = new CassandraCommitter(builder); - cc1.setJobId("job"); + cc1 = new CassandraCommitter(builder, "flink_auxiliary_cc"); + cc1.setJobId(jobID); cc1.setOperatorId("operator"); cc1.open(); @@ -389,70 +359,65 @@ public void testCassandraCommitter() throws Exception { @Test public void testCassandraTupleAtLeastOnceSink() throws Exception { - StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); - env.setParallelism(1); + CassandraTupleSink> sink = new CassandraTupleSink<>(injectTableName(INSERT_DATA_QUERY), builder); - DataStream> source = env.fromCollection(collection); - source.addSink(new CassandraTupleSink>(INSERT_DATA_QUERY, builder)); + sink.open(new Configuration()); + + for (Tuple3 value : collection) { + sink.send(value); + } - env.execute(); + sink.close(); - ResultSet rs = session.execute(SELECT_DATA_QUERY); + ResultSet rs = session.execute(injectTableName(SELECT_DATA_QUERY)); Assert.assertEquals(20, rs.all().size()); } @Test public void testCassandraPojoAtLeastOnceSink() throws Exception { - StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); - env.setParallelism(1); - - DataStreamSource source = env - .addSource(new SourceFunction() { - - private boolean running = true; - private volatile int cnt = 0; - - @Override - public void run(SourceContext ctx) throws Exception { - while (running) { - ctx.collect(new Pojo(UUID.randomUUID().toString(), cnt, 0)); - cnt++; - if (cnt == 20) { - cancel(); - } - } - } + session.execute(CREATE_TABLE_QUERY.replace(TABLE_NAME_VARIABLE, "test")); - @Override - public void cancel() { - running = false; - } - }); + CassandraPojoSink sink = new CassandraPojoSink<>(Pojo.class, builder); - source.addSink(new CassandraPojoSink<>(Pojo.class, builder)); + sink.open(new Configuration()); - env.execute(); + for (int x = 0; x < 20; x++) { + sink.send(new Pojo(UUID.randomUUID().toString(), x, 0)); + } - ResultSet rs = session.execute(SELECT_DATA_QUERY); + sink.close(); + + ResultSet rs = session.execute(SELECT_DATA_QUERY.replace(TABLE_NAME_VARIABLE, "test")); Assert.assertEquals(20, rs.all().size()); } @Test public void testCassandraBatchFormats() throws Exception { - ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); - env.setParallelism(1); + OutputFormat> sink = new CassandraOutputFormat<>(injectTableName(INSERT_DATA_QUERY), builder); + sink.configure(new Configuration()); + sink.open(0, 1); - DataSet> dataSet = env.fromCollection(collection); - dataSet.output(new CassandraOutputFormat>(INSERT_DATA_QUERY, builder)); + for (Tuple3 value : collection) { + sink.writeRecord(value); + } - env.execute("Write data"); + sink.close(); - DataSet> inputDS = env.createInput( - new CassandraInputFormat>(SELECT_DATA_QUERY, builder), - TypeInformation.of(new TypeHint>(){})); + InputFormat, InputSplit> source = new CassandraInputFormat<>(injectTableName(SELECT_DATA_QUERY), builder); + source.configure(new Configuration()); + source.open(null); + List> result = new ArrayList<>(); + + while (!source.reachedEnd()) { + result.add(source.nextRecord(new Tuple3())); + } + + source.close(); + Assert.assertEquals(20, result.size()); + } - long count = inputDS.count(); - Assert.assertEquals(count, 20L); + private String injectTableName(String target) { + return target.replace(TABLE_NAME_VARIABLE, TABLE_NAME_PREFIX + tableID); } } From 4882f366686e4c97a3442962ca2e9b5b0f0b8d19 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 20 Feb 2017 18:20:45 +0100 Subject: [PATCH 019/360] [FLINK-5819] [webui] implements numeric option on metrics graphs This closes #3367 --- .../jobs/job.plan.node-list.metrics.jade | 2 +- .../app/scripts/common/filters.coffee | 34 +++++++++++++++++++ .../app/scripts/modules/jobs/jobs.ctrl.coffee | 4 +++ .../scripts/modules/jobs/metrics.dir.coffee | 24 +++++++++---- .../scripts/modules/jobs/metrics.svc.coffee | 15 ++++++-- .../web-dashboard/app/styles/metric.styl | 5 +++ .../web-dashboard/web/css/index.css | 2 +- .../web-dashboard/web/js/hs/index.js | 4 +-- .../web-dashboard/web/js/index.js | 4 +-- .../web-dashboard/web/js/vendor.js | 10 +++--- .../jobs/job.plan.node-list.metrics.html | 2 +- 11 files changed, 85 insertions(+), 21 deletions(-) diff --git a/flink-runtime-web/web-dashboard/app/partials/jobs/job.plan.node-list.metrics.jade b/flink-runtime-web/web-dashboard/app/partials/jobs/job.plan.node-list.metrics.jade index fd7382f50b5e02..f3ec8dc0217331 100644 --- a/flink-runtime-web/web-dashboard/app/partials/jobs/job.plan.node-list.metrics.jade +++ b/flink-runtime-web/web-dashboard/app/partials/jobs/job.plan.node-list.metrics.jade @@ -41,7 +41,7 @@ nav.navbar.navbar-default.navbar-secondary-additional.navbar-secondary-additiona ul.metric-row(ng-if="nodeid && metrics.length > 0" dnd-list="metrics" dnd-drop="dropped(event, index, item, external, type, external)") li.metric-col(ng-repeat="metric in metrics track by metric.id" dnd-draggable="metric" dnd-dragstart="dragStart()" dnd-dragend="dragEnd()" dnd-canceled="dragEnd()" ng-class="{big: metric.size != 'small'}") - metrics-graph(metric="metric" window="window" get-values="getValues(metric.id)" remove-metric="removeMetric(metric)" set-metric-size="setMetricSize") + metrics-graph(metric="metric" window="window" get-values="getValues(metric.id)" remove-metric="removeMetric(metric)" set-metric-size="setMetricSize" set-metric-view="setMetricView") .clearfix diff --git a/flink-runtime-web/web-dashboard/app/scripts/common/filters.coffee b/flink-runtime-web/web-dashboard/app/scripts/common/filters.coffee index a3ce508cc5c52b..e2b83391e89751 100644 --- a/flink-runtime-web/web-dashboard/app/scripts/common/filters.coffee +++ b/flink-runtime-web/web-dashboard/app/scripts/common/filters.coffee @@ -98,3 +98,37 @@ angular.module('flinkApp') .filter "increment", -> (number) -> parseInt(number) + 1 + +.filter "humanizeChartNumeric", ['humanizeBytesFilter', 'humanizeDurationFilter', (humanizeBytesFilter, humanizeDurationFilter)-> + (value, metric)-> + return_val = '' + if value != null + if /bytes/i.test(metric.id) && /persecond/i.test(metric.id) + return_val = humanizeBytesFilter(value) + ' / s' + else if /bytes/i.test(metric.id) + return_val = humanizeBytesFilter(value) + else if /persecond/i.test(metric.id) + return_val = value + ' / s' + else if /time/i.test(metric.id) || /latency/i.test(metric.id) + return_val = humanizeDurationFilter(value, true) + else + return_val = value + return return_val +] + +.filter "humanizeChartNumericTitle", ['humanizeDurationFilter', (humanizeDurationFilter)-> + (value, metric)-> + return_val = '' + if value != null + if /bytes/i.test(metric.id) && /persecond/i.test(metric.id) + return_val = value + ' Bytes / s' + else if /bytes/i.test(metric.id) + return_val = value + ' Bytes' + else if /persecond/i.test(metric.id) + return_val = value + ' / s' + else if /time/i.test(metric.id) || /latency/i.test(metric.id) + return_val = humanizeDurationFilter(value, false) + else + return_val = value + return return_val +] diff --git a/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.ctrl.coffee b/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.ctrl.coffee index f25c94d1173fc3..d4315ea2499b4b 100644 --- a/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.ctrl.coffee +++ b/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.ctrl.coffee @@ -385,6 +385,10 @@ angular.module('flinkApp') MetricsService.setMetricSize($scope.jobid, $scope.nodeid, metric, size) loadMetrics() + $scope.setMetricView = (metric, view) -> + MetricsService.setMetricView($scope.jobid, $scope.nodeid, metric, view) + loadMetrics() + $scope.getValues = (metric) -> MetricsService.getValues($scope.jobid, $scope.nodeid, metric) diff --git a/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/metrics.dir.coffee b/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/metrics.dir.coffee index adfc09f17944ec..a3787488f5e7ec 100644 --- a/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/metrics.dir.coffee +++ b/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/metrics.dir.coffee @@ -33,8 +33,16 @@ angular.module('flinkApp')
- + +
+
{{value | humanizeChartNumeric:metric}}
+
+
+
+ + +
' replace: true scope: @@ -42,6 +50,7 @@ angular.module('flinkApp') window: "=" removeMetric: "&" setMetricSize: "=" + setMetricView: "=" getValues: "&" link: (scope, element, attrs) -> @@ -106,10 +115,13 @@ angular.module('flinkApp') scope.setSize = (size) -> scope.setMetricSize(scope.metric, size) - scope.showChart() + scope.setView = (view) -> + scope.setMetricView(scope.metric, view) + scope.showChart() if view == 'chart' + + scope.showChart() if scope.metric.view == 'chart' scope.$on 'metrics:data:update', (event, timestamp, data) -> -# scope.value = parseInt(data[scope.metric.id]) scope.value = parseFloat(data[scope.metric.id]) scope.data[0].values.push { @@ -120,8 +132,8 @@ angular.module('flinkApp') if scope.data[0].values.length > scope.window scope.data[0].values.shift() - scope.showChart() - scope.chart.clearHighlights() + scope.showChart() if scope.metric.view == 'chart' + scope.chart.clearHighlights() if scope.metric.view == 'chart' scope.chart.tooltip.hidden(true) element.find(".metric-title").qtip({ @@ -135,4 +147,4 @@ angular.module('flinkApp') style: { classes: 'qtip-light qtip-timeline-bar' } - }); + }); \ No newline at end of file diff --git a/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/metrics.svc.coffee b/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/metrics.svc.coffee index 9b9fab77827dcd..fbe3d6d8e5cdf2 100644 --- a/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/metrics.svc.coffee +++ b/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/metrics.svc.coffee @@ -110,7 +110,7 @@ angular.module('flinkApp') @addMetric = (jobid, nodeid, metricid) -> @setupLSFor(jobid, nodeid) - @metrics[jobid][nodeid].push({id: metricid, size: 'small'}) + @metrics[jobid][nodeid].push({id: metricid, size: 'small', view: 'chart'}) @saveSetup() @@ -128,7 +128,16 @@ angular.module('flinkApp') i = @metrics[jobid][nodeid].indexOf(metric.id) i = _.findIndex(@metrics[jobid][nodeid], { id: metric.id }) if i == -1 - @metrics[jobid][nodeid][i] = { id: metric.id, size: size } if i != -1 + @metrics[jobid][nodeid][i] = { id: metric.id, size: size, view: metric.view } if i != -1 + + @saveSetup() + + @setMetricView = (jobid, nodeid, metric, view) => + if @metrics[jobid][nodeid]? + i = @metrics[jobid][nodeid].indexOf(metric.id) + i = _.findIndex(@metrics[jobid][nodeid], { id: metric.id }) if i == -1 + + @metrics[jobid][nodeid][i] = { id: metric.id, size: metric.size, view: view } if i != -1 @saveSetup() @@ -148,7 +157,7 @@ angular.module('flinkApp') @getMetricsSetup = (jobid, nodeid) => { names: _.map(@metrics[jobid][nodeid], (value) => - if _.isString(value) then { id: value, size: "small" } else value + if _.isString(value) then { id: value, size: "small", view: "chart" } else value ) } diff --git a/flink-runtime-web/web-dashboard/app/styles/metric.styl b/flink-runtime-web/web-dashboard/app/styles/metric.styl index 972352f1c6f6c2..94c494838a9bfd 100644 --- a/flink-runtime-web/web-dashboard/app/styles/metric.styl +++ b/flink-runtime-web/web-dashboard/app/styles/metric.styl @@ -67,6 +67,11 @@ $metric-row-height = 180px + 85px background-color: transparent height: $metric-row-height position: relative + .metric-numeric + text-align: center; + margin-top: 75px; + font-size: 40px; + font-weight: bold; .panel-heading padding: 0px 10px diff --git a/flink-runtime-web/web-dashboard/web/css/index.css b/flink-runtime-web/web-dashboard/web/css/index.css index 7f2099879be120..db615b1fb00813 100644 --- a/flink-runtime-web/web-dashboard/web/css/index.css +++ b/flink-runtime-web/web-dashboard/web/css/index.css @@ -1 +1 @@ -#main,#sidebar,body,html{height:100%}#content,#sidebar{-webkit-transition:.4s;-moz-transition:.4s;-o-transition:.4s;-ms-transition:.4s}.gutter{background-color:transparent;background-repeat:no-repeat;background-position:50%}.gutter-vertical{cursor:row-resize;background-image:url(../images/grips/horizontal.png)}#sidebar{overflow:hidden;position:fixed;left:-250px;top:0;bottom:0;width:250px;background:#151515;transition:.4s;-webkit-box-shadow:inset -10px 0 10px rgba(0,0,0,.2);box-shadow:inset -10px 0 10px rgba(0,0,0,.2)}#sidebar.sidebar-visible{left:0}#sidebar .logo{width:auto;height:22px}#sidebar .logo img{display:inline-block}#sidebar .navbar-static-top{overflow:hidden;height:51px}#sidebar .navbar-static-top .navbar-header{width:100%}#sidebar .navbar-brand.navbar-brand-text{font-size:14px;font-weight:700;color:#fff;padding-left:0}#sidebar .nav>li>a{color:#aaa;margin-bottom:1px}#sidebar .nav>li>a:focus,#sidebar .nav>li>a:hover{background-color:rgba(40,40,40,.5)}#sidebar .nav>li>a.active{background-color:rgba(100,100,100,.5)}#content{background-color:#fff;margin-left:0;padding-top:70px;height:100%;transition:.4s}.table .table,.table.table-inner{background-color:transparent}#content .navbar-main,#content .navbar-main-additional{-webkit-transition:.4s;-moz-transition:.4s;-o-transition:.4s;-ms-transition:.4s;transition:.4s}#content .navbar-main-additional{margin-top:51px;border-bottom:none;padding:0 20px}#content .navbar-main-additional .nav-tabs{margin:0 -20px;padding:0 20px}#content .navbar-secondary-additional{border:none;padding:0 20px;margin-bottom:0}#content .navbar-secondary-additional .nav-tabs{margin:0 -20px}#content.sidebar-visible{margin-left:250px}#content.sidebar-visible .navbar-main,#content.sidebar-visible .navbar-main-additional{left:250px}#content #fold-button{display:inline-block;margin-left:20px}#content #content-inner{padding:0 20px 20px}#content #content-inner.has-navbar-main-additional{padding-top:42px}.table#add-file-table span.btn,.table#job-submit-table td>span.btn{padding:2px 4px;font-size:14px}.page-header{margin:0 0 20px}.nav>li>a,.nav>li>a:focus,.nav>li>a:hover{color:#aaa;background-color:transparent;border-bottom:2px solid transparent}.nav>li.active>a,.nav>li.active>a:focus,.nav>li.active>a:hover{color:#000;border-bottom:2px solid #000}.nav.nav-tabs{margin-bottom:20px}.table th{font-weight:400;color:#999}.table td.td-long{width:20%;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}.table.table-clickable tr{cursor:pointer}.table.table-properties{table-layout:fixed;white-space:nowrap}.table.table-properties td{width:50%;white-space:nowrap;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis}.table.table-body-hover>tbody{border-top:none;border-left:2px solid transparent}.table.table-body-hover>tbody.active{border-left:2px solid #000}.table.table-body-hover>tbody.active td.tab-column li.active,.table.table-body-hover>tbody.active td:not(.tab-column),.table.table-body-hover>tbody:hover td.tab-column li.active,.table.table-body-hover>tbody:hover td:not(.tab-column){background-color:#f0f0f0}.table.table-activable td.tab-column,.table.table-activable th.tab-column{border-top:none;width:47px}.table.table-activable td.tab-column{border-right:1px solid #ddd}.table.table-activable td{position:relative}.table.table-no-border td,.table.table-no-border th{border-top:none!important}.table#job-submit-table{table-layout:fixed;white-space:nowrap}.table#job-submit-table td.td-large{width:40%}.table#job-submit-table td{width:15%}.table#job-submit-table td>input{height:28px;font-size:14px}.table#add-file-table{table-layout:fixed}.table#add-file-table span.btn{position:relative;overflow:hidden;border-radius:2px;margin-top:-3px}.table#add-file-table td#add-file-button{width:100px}.table#add-file-table td#add-file-button input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;opacity:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);outline:0;cursor:inherit;display:block}.timeline-canvas .timeline-insidelabel,.timeline-canvas .timeline-series,svg.graph .node{cursor:pointer}.table#add-file-table td#add-file-name{width:250px;-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.table#add-file-table td#add-file-status{width:100%}.table#add-file-table td#add-file-status span.btn-progress-bar{padding:0!important;width:100%;background-color:#f5f5f5;text-align:left}.table#add-file-table td#add-file-status span.btn-progress{padding:2px;font-size:10px}.table span.error-area{color:red}.table span.row-button{padding:1px 2px;margin:0;border:none!important}.table .small-label{text-transform:uppercase;font-size:13px;color:#999}span.icon-wrapper{width:1.2em;display:inline-block}.panel.panel-dashboard .huge{font-size:28px}.panel.panel-lg{font-size:16px}.panel.panel-lg .badge{font-size:14px}.navbar-secondary{overflow:auto}.navbar-main .navbar-title,.navbar-main .navbar-title-job,.navbar-main .panel-title,.navbar-main-additional .navbar-title,.navbar-main-additional .navbar-title-job,.navbar-main-additional .panel-title,.navbar-secondary .navbar-title,.navbar-secondary .navbar-title-job,.navbar-secondary .panel-title,.navbar-secondary-additional .navbar-title,.navbar-secondary-additional .navbar-title-job,.navbar-secondary-additional .panel-title,.panel.panel-multi .navbar-title,.panel.panel-multi .navbar-title-job,.panel.panel-multi .panel-title{float:left;font-size:18px;padding:12px 20px 13px 10px;color:#333;display:inline-block}.navbar-main .navbar-info,.navbar-main .panel-info,.navbar-main-additional .navbar-info,.navbar-main-additional .panel-info,.navbar-secondary .navbar-info,.navbar-secondary .panel-info,.navbar-secondary-additional .navbar-info,.navbar-secondary-additional .panel-info,.panel.panel-multi .navbar-info,.panel.panel-multi .panel-info{float:left;font-size:14px;padding:15px;color:#999;display:inline-block;border-right:1px solid #e7e7e7;overflow:hidden}.navbar-main .navbar-info .overflow,.navbar-main .panel-info .overflow,.navbar-main-additional .navbar-info .overflow,.navbar-main-additional .panel-info .overflow,.navbar-secondary .navbar-info .overflow,.navbar-secondary .panel-info .overflow,.navbar-secondary-additional .navbar-info .overflow,.navbar-secondary-additional .panel-info .overflow,.panel.panel-multi .navbar-info .overflow,.panel.panel-multi .panel-info .overflow{position:absolute;display:block;-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden;height:22px;line-height:22px;vertical-align:middle}.navbar-main .navbar-info.first,.navbar-main .panel-info.first,.navbar-main-additional .navbar-info.first,.navbar-main-additional .panel-info.first,.navbar-secondary .navbar-info.first,.navbar-secondary .panel-info.first,.navbar-secondary-additional .navbar-info.first,.navbar-secondary-additional .panel-info.first,.panel.panel-multi .navbar-info.first,.panel.panel-multi .panel-info.first{border-left:1px solid #e7e7e7}.navbar-main .navbar-info.last,.navbar-main .panel-info.last,.navbar-main-additional .navbar-info.last,.navbar-main-additional .panel-info.last,.navbar-secondary .navbar-info.last,.navbar-secondary .panel-info.last,.navbar-secondary-additional .navbar-info.last,.navbar-secondary-additional .panel-info.last,.panel.panel-multi .navbar-info.last,.panel.panel-multi .panel-info.last{border-right:none}.panel.panel-multi .panel-heading{padding:0}.panel.panel-multi .panel-heading .panel-info.thin{padding:8px 10px}.panel.panel-multi .panel-body{padding:10px;background-color:#fdfdfd;color:#999;font-size:13px}.panel.panel-multi .panel-body.clean{color:inherit;font-size:inherit}.navbar-main-additional,.navbar-secondary-additional{min-height:40px;background-color:#fdfdfd}.navbar-main-additional .navbar-info,.navbar-secondary-additional .navbar-info{font-size:13px;padding:10px 15px}.nav-top-affix.affix{width:100%;top:50px;margin-left:-20px;padding-left:20px;margin-right:-20px;padding-right:20px;background-color:#fff;z-index:1}.badge-default[href]:focus,.badge-default[href]:hover{background-color:grey}.badge-primary{background-color:#428bca}.badge-primary[href]:focus,.badge-primary[href]:hover{background-color:#3071a9}.badge-success{background-color:#5cb85c}.badge-success[href]:focus,.badge-success[href]:hover{background-color:#449d44}.badge-info{background-color:#5bc0de}.badge-info[href]:focus,.badge-info[href]:hover{background-color:#31b0d5}.badge-warning{background-color:#f0ad4e}.badge-warning[href]:focus,.badge-warning[href]:hover{background-color:#ec971f}.badge-danger{background-color:#d9534f}.badge-danger[href]:focus,.badge-danger[href]:hover{background-color:#c9302c}.indicator{display:inline-block;margin-right:15px}.indicator.indicator-primary{color:#428bca}.indicator.indicator-success{color:#5cb85c}.indicator.indicator-info{color:#5bc0de}.indicator.indicator-warning{color:#f0ad4e}.indicator.indicator-danger{color:#d9534f}pre.exception{border:none;background-color:transparent;padding:0;margin:0}pre{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}.nav-tabs.tabs-vertical{position:absolute;left:0;top:0;border-bottom:none;z-index:100}.nav-tabs.tabs-vertical li{float:none;margin-bottom:0;margin-right:-1px}.nav-tabs.tabs-vertical li>a{margin-right:0;border-radius:0;border-bottom:none;border-left:2px solid transparent}.nav-tabs.tabs-vertical li.active>a,.nav-tabs.tabs-vertical li>a:focus,.nav-tabs.tabs-vertical li>a:hover{border-bottom:none;border-left:2px solid #000}.navbar-main .navbar-title,.navbar-main-additional .navbar-title,.navbar-secondary .navbar-title,.navbar-secondary-additional .navbar-title{padding:12px 20px 13px}.navbar-main .navbar-title-job{padding:8px 20px}.navbar-main .navbar-title-job .indicator-primary{padding:8px 0 0}.navbar-main .navbar-title-job .no-padding{padding:0}.navbar-main .navbar-title-job .no-margin{margin:0}.navbar-main .navbar-title-job .job-name{font-size:14px}.navbar-main .navbar-title-job .job-id{color:#999;font-size:11px}.checkpoint-overview a,svg.graph .node h4{color:#000}livechart{width:30%;height:30%;text-align:center}.canvas-wrapper{border:1px solid #ddd;position:relative;margin-bottom:20px;height:100%}.canvas-wrapper .main-canvas{height:100%;overflow:hidden}.canvas-wrapper .main-canvas .zoom-buttons{position:absolute;top:10px;right:10px}.label-group .label{display:inline-block;padding-left:.4em;padding-right:.4em;margin:0;border-right:1px solid #fff;border-radius:0}.label-group .label.label-black{background-color:#000}.navbar-info-button{padding:3px 4px;font-size:12px;font-family:inherit;margin-top:-2px}svg.graph .edge-label,svg.graph text{font-size:14px}.checkpoints-view{padding-top:1em}.subtask-details .blank{height:2em}.checkpoint-overview td span{padding-left:2em}svg.graph{overflow:hidden;height:100%;width:100%!important}svg.graph g.type-TK>rect{fill:#00ffd0}svg.graph text{font-weight:300}svg.graph .node>rect{stroke:#999;stroke-width:5px;fill:#fff;margin:0;padding:0}svg.graph .node[active]>rect{fill:#eee}svg.graph .node.node-mirror>rect{stroke:#a8a8a8}svg.graph .node.node-iteration>rect{stroke:#cd3333}svg.graph .node.node-source>rect{stroke:#4ce199}svg.graph .node.node-sink>rect{stroke:#e6ec8b}svg.graph .node.node-normal>rect{stroke:#3fb6d8}svg.graph .node h5{color:#999}svg.graph .edgeLabel rect{fill:#fff}svg.graph .edgePath path{stroke:#333;stroke-width:2px;fill:#333}svg.graph .label{color:#777;margin:0}svg.graph .node-label{display:block;margin:0;text-decoration:none}.timeline{overflow:hidden}.timeline-canvas{overflow:hidden;padding:10px}.timeline-canvas .bar-container{overflow:hidden}.timeline-canvas.secondary .timeline-insidelabel,.timeline-canvas.secondary .timeline-series{cursor:auto}#content .navbar-secondary-additional.navbar-secondary-additional-2 .add-metrics a,.show-pointer{cursor:pointer}.qtip-timeline-bar{font-size:14px;line-height:1.4}#content .navbar-secondary-additional.navbar-secondary-additional-2{margin:-10px -10px 10px;padding:0;border-bottom:1px solid #e4e4e4}#content .navbar-secondary-additional.navbar-secondary-additional-2 .navbar-info{padding-top:12px;padding-bottom:12px}#content .navbar-secondary-additional.navbar-secondary-additional-2 .add-metrics{margin-right:15px;float:right}#content .navbar-secondary-additional.navbar-secondary-additional-2 .add-metrics .btn{margin-top:5px;margin-bottom:5px}#content .navbar-secondary-additional.navbar-secondary-additional-2 .metric-menu{max-height:300px;max-width:900px;overflow-y:scroll;text-align:right}.metric-row{margin:0;min-height:275px;padding:0;list-style-type:none}.metric-row .metric-col{background-color:transparent;width:33.33%;float:left}.metric-row .metric-col.big{width:100%}.metric-row .metric-col .panel{margin-left:5px;margin-right:5px;min-height:265px;margin-bottom:10px}.metric-row .metric-col .panel .panel-body{background-color:transparent;height:265px;position:relative}.metric-row .metric-col .panel .panel-heading{padding:0 10px;background-color:transparent;height:41px;line-height:41px;position:relative;overflow:hidden;cursor:pointer}.metric-row .metric-col .panel .panel-heading .metric-title{padding:10px 0}.metric-row .metric-col .panel .panel-heading .buttons{position:absolute;top:0;right:0;padding:0 10px;background-color:#fff}.metric-row .metric-col.dndDraggingSource{display:none}.metric-row .dndPlaceholder{position:relative;background-color:#f0f0f0;min-height:305px;display:block;width:33.33%;float:left;margin-bottom:10px;border-radius:5px}.p-info{padding-left:5px;padding-right:5px}@media (min-width:1024px) and (max-width:1279px){#content #fold-button,#sidebar .navbar-static-top .navbar-brand-text{display:none}#sidebar{left:0;width:160px}#content{margin-left:160px}#content .navbar-main,#content .navbar-main-additional{left:160px}.table td.td-long{width:20%}}@media (min-width:1280px){#sidebar{left:0}#content{margin-left:250px}#content #fold-button{display:none}#content .navbar-main,#content .navbar-main-additional{left:250px}.table td.td-long{width:30%}}.legend-box{font-size:10px;width:2em}#total-mem{background-color:#7cb5ec}#heap-mem{background-color:#434348}#non-heap-mem{background-color:#90ed7d}#fetch-plan,#job-submit{width:100px}#content-inner,#details,#node-details{height:100%}#job-panel{overflow-y:auto} \ No newline at end of file +#main,#sidebar,body,html{height:100%}#content,#sidebar{-webkit-transition:.4s;-moz-transition:.4s;-o-transition:.4s;-ms-transition:.4s}.gutter{background-color:transparent;background-repeat:no-repeat;background-position:50%}.gutter-vertical{cursor:row-resize;background-image:url(../images/grips/horizontal.png)}#sidebar{overflow:hidden;position:fixed;left:-250px;top:0;bottom:0;width:250px;background:#151515;transition:.4s;-webkit-box-shadow:inset -10px 0 10px rgba(0,0,0,.2);box-shadow:inset -10px 0 10px rgba(0,0,0,.2)}#sidebar.sidebar-visible{left:0}#sidebar .logo{width:auto;height:22px}#sidebar .logo img{display:inline-block}#sidebar .navbar-static-top{overflow:hidden;height:51px}#sidebar .navbar-static-top .navbar-header{width:100%}#sidebar .navbar-brand.navbar-brand-text{font-size:14px;font-weight:700;color:#fff;padding-left:0}#sidebar .nav>li>a{color:#aaa;margin-bottom:1px}#sidebar .nav>li>a:focus,#sidebar .nav>li>a:hover{background-color:rgba(40,40,40,.5)}#sidebar .nav>li>a.active{background-color:rgba(100,100,100,.5)}#content{background-color:#fff;margin-left:0;padding-top:70px;height:100%;transition:.4s}.table .table,.table.table-inner{background-color:transparent}#content .navbar-main,#content .navbar-main-additional{-webkit-transition:.4s;-moz-transition:.4s;-o-transition:.4s;-ms-transition:.4s;transition:.4s}#content .navbar-main-additional{margin-top:51px;border-bottom:none;padding:0 20px}#content .navbar-main-additional .nav-tabs{margin:0 -20px;padding:0 20px}#content .navbar-secondary-additional{border:none;padding:0 20px;margin-bottom:0}#content .navbar-secondary-additional .nav-tabs{margin:0 -20px}#content.sidebar-visible{margin-left:250px}#content.sidebar-visible .navbar-main,#content.sidebar-visible .navbar-main-additional{left:250px}#content #fold-button{display:inline-block;margin-left:20px}#content #content-inner{padding:0 20px 20px}#content #content-inner.has-navbar-main-additional{padding-top:42px}.table#add-file-table span.btn,.table#job-submit-table td>span.btn{padding:2px 4px;font-size:14px}.page-header{margin:0 0 20px}.nav>li>a,.nav>li>a:focus,.nav>li>a:hover{color:#aaa;background-color:transparent;border-bottom:2px solid transparent}.nav>li.active>a,.nav>li.active>a:focus,.nav>li.active>a:hover{color:#000;border-bottom:2px solid #000}.nav.nav-tabs{margin-bottom:20px}.table th{font-weight:400;color:#999}.table td.td-long{width:20%;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}.table.table-clickable tr{cursor:pointer}.table.table-properties{table-layout:fixed;white-space:nowrap}.table.table-properties td{width:50%;white-space:nowrap;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis}.table.table-body-hover>tbody{border-top:none;border-left:2px solid transparent}.table.table-body-hover>tbody.active{border-left:2px solid #000}.table.table-body-hover>tbody.active td.tab-column li.active,.table.table-body-hover>tbody.active td:not(.tab-column),.table.table-body-hover>tbody:hover td.tab-column li.active,.table.table-body-hover>tbody:hover td:not(.tab-column){background-color:#f0f0f0}.table.table-activable td.tab-column,.table.table-activable th.tab-column{border-top:none;width:47px}.table.table-activable td.tab-column{border-right:1px solid #ddd}.table.table-activable td{position:relative}.table.table-no-border td,.table.table-no-border th{border-top:none!important}.table#job-submit-table{table-layout:fixed;white-space:nowrap}.table#job-submit-table td.td-large{width:40%}.table#job-submit-table td{width:15%}.table#job-submit-table td>input{height:28px;font-size:14px}.table#add-file-table{table-layout:fixed}.table#add-file-table span.btn{position:relative;overflow:hidden;border-radius:2px;margin-top:-3px}.table#add-file-table td#add-file-button{width:100px}.table#add-file-table td#add-file-button input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;opacity:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);outline:0;cursor:inherit;display:block}.timeline-canvas .timeline-insidelabel,.timeline-canvas .timeline-series,svg.graph .node{cursor:pointer}.table#add-file-table td#add-file-name{width:250px;-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.table#add-file-table td#add-file-status{width:100%}.table#add-file-table td#add-file-status span.btn-progress-bar{padding:0!important;width:100%;background-color:#f5f5f5;text-align:left}.table#add-file-table td#add-file-status span.btn-progress{padding:2px;font-size:10px}.table span.error-area{color:red}.table span.row-button{padding:1px 2px;margin:0;border:none!important}.table .small-label{text-transform:uppercase;font-size:13px;color:#999}span.icon-wrapper{width:1.2em;display:inline-block}.panel.panel-dashboard .huge{font-size:28px}.panel.panel-lg{font-size:16px}.panel.panel-lg .badge{font-size:14px}.navbar-secondary{overflow:auto}.navbar-main .navbar-title,.navbar-main .navbar-title-job,.navbar-main .panel-title,.navbar-main-additional .navbar-title,.navbar-main-additional .navbar-title-job,.navbar-main-additional .panel-title,.navbar-secondary .navbar-title,.navbar-secondary .navbar-title-job,.navbar-secondary .panel-title,.navbar-secondary-additional .navbar-title,.navbar-secondary-additional .navbar-title-job,.navbar-secondary-additional .panel-title,.panel.panel-multi .navbar-title,.panel.panel-multi .navbar-title-job,.panel.panel-multi .panel-title{float:left;font-size:18px;padding:12px 20px 13px 10px;color:#333;display:inline-block}.navbar-main .navbar-info,.navbar-main .panel-info,.navbar-main-additional .navbar-info,.navbar-main-additional .panel-info,.navbar-secondary .navbar-info,.navbar-secondary .panel-info,.navbar-secondary-additional .navbar-info,.navbar-secondary-additional .panel-info,.panel.panel-multi .navbar-info,.panel.panel-multi .panel-info{float:left;font-size:14px;padding:15px;color:#999;display:inline-block;border-right:1px solid #e7e7e7;overflow:hidden}.navbar-main .navbar-info .overflow,.navbar-main .panel-info .overflow,.navbar-main-additional .navbar-info .overflow,.navbar-main-additional .panel-info .overflow,.navbar-secondary .navbar-info .overflow,.navbar-secondary .panel-info .overflow,.navbar-secondary-additional .navbar-info .overflow,.navbar-secondary-additional .panel-info .overflow,.panel.panel-multi .navbar-info .overflow,.panel.panel-multi .panel-info .overflow{position:absolute;display:block;-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden;height:22px;line-height:22px;vertical-align:middle}.navbar-main .navbar-info.first,.navbar-main .panel-info.first,.navbar-main-additional .navbar-info.first,.navbar-main-additional .panel-info.first,.navbar-secondary .navbar-info.first,.navbar-secondary .panel-info.first,.navbar-secondary-additional .navbar-info.first,.navbar-secondary-additional .panel-info.first,.panel.panel-multi .navbar-info.first,.panel.panel-multi .panel-info.first{border-left:1px solid #e7e7e7}.navbar-main .navbar-info.last,.navbar-main .panel-info.last,.navbar-main-additional .navbar-info.last,.navbar-main-additional .panel-info.last,.navbar-secondary .navbar-info.last,.navbar-secondary .panel-info.last,.navbar-secondary-additional .navbar-info.last,.navbar-secondary-additional .panel-info.last,.panel.panel-multi .navbar-info.last,.panel.panel-multi .panel-info.last{border-right:none}.panel.panel-multi .panel-heading{padding:0}.panel.panel-multi .panel-heading .panel-info.thin{padding:8px 10px}.panel.panel-multi .panel-body{padding:10px;background-color:#fdfdfd;color:#999;font-size:13px}.panel.panel-multi .panel-body.clean{color:inherit;font-size:inherit}.navbar-main-additional,.navbar-secondary-additional{min-height:40px;background-color:#fdfdfd}.navbar-main-additional .navbar-info,.navbar-secondary-additional .navbar-info{font-size:13px;padding:10px 15px}.nav-top-affix.affix{width:100%;top:50px;margin-left:-20px;padding-left:20px;margin-right:-20px;padding-right:20px;background-color:#fff;z-index:1}.badge-default[href]:focus,.badge-default[href]:hover{background-color:grey}.badge-primary{background-color:#428bca}.badge-primary[href]:focus,.badge-primary[href]:hover{background-color:#3071a9}.badge-success{background-color:#5cb85c}.badge-success[href]:focus,.badge-success[href]:hover{background-color:#449d44}.badge-info{background-color:#5bc0de}.badge-info[href]:focus,.badge-info[href]:hover{background-color:#31b0d5}.badge-warning{background-color:#f0ad4e}.badge-warning[href]:focus,.badge-warning[href]:hover{background-color:#ec971f}.badge-danger{background-color:#d9534f}.badge-danger[href]:focus,.badge-danger[href]:hover{background-color:#c9302c}.indicator{display:inline-block;margin-right:15px}.indicator.indicator-primary{color:#428bca}.indicator.indicator-success{color:#5cb85c}.indicator.indicator-info{color:#5bc0de}.indicator.indicator-warning{color:#f0ad4e}.indicator.indicator-danger{color:#d9534f}pre.exception{border:none;background-color:transparent;padding:0;margin:0}pre{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}.nav-tabs.tabs-vertical{position:absolute;left:0;top:0;border-bottom:none;z-index:100}.nav-tabs.tabs-vertical li{float:none;margin-bottom:0;margin-right:-1px}.nav-tabs.tabs-vertical li>a{margin-right:0;border-radius:0;border-bottom:none;border-left:2px solid transparent}.nav-tabs.tabs-vertical li.active>a,.nav-tabs.tabs-vertical li>a:focus,.nav-tabs.tabs-vertical li>a:hover{border-bottom:none;border-left:2px solid #000}.navbar-main .navbar-title,.navbar-main-additional .navbar-title,.navbar-secondary .navbar-title,.navbar-secondary-additional .navbar-title{padding:12px 20px 13px}.navbar-main .navbar-title-job{padding:8px 20px}.navbar-main .navbar-title-job .indicator-primary{padding:8px 0 0}.navbar-main .navbar-title-job .no-padding{padding:0}.navbar-main .navbar-title-job .no-margin{margin:0}.navbar-main .navbar-title-job .job-name{font-size:14px}.navbar-main .navbar-title-job .job-id{color:#999;font-size:11px}.checkpoint-overview a,svg.graph .node h4{color:#000}livechart{width:30%;height:30%;text-align:center}.canvas-wrapper{border:1px solid #ddd;position:relative;margin-bottom:20px;height:100%}.canvas-wrapper .main-canvas{height:100%;overflow:hidden}.canvas-wrapper .main-canvas .zoom-buttons{position:absolute;top:10px;right:10px}.label-group .label{display:inline-block;padding-left:.4em;padding-right:.4em;margin:0;border-right:1px solid #fff;border-radius:0}.label-group .label.label-black{background-color:#000}.navbar-info-button{padding:3px 4px;font-size:12px;font-family:inherit;margin-top:-2px}svg.graph .edge-label,svg.graph text{font-size:14px}.checkpoints-view{padding-top:1em}.subtask-details .blank{height:2em}.checkpoint-overview td span{padding-left:2em}svg.graph{overflow:hidden;height:100%;width:100%!important}svg.graph g.type-TK>rect{fill:#00ffd0}svg.graph text{font-weight:300}svg.graph .node>rect{stroke:#999;stroke-width:5px;fill:#fff;margin:0;padding:0}svg.graph .node[active]>rect{fill:#eee}svg.graph .node.node-mirror>rect{stroke:#a8a8a8}svg.graph .node.node-iteration>rect{stroke:#cd3333}svg.graph .node.node-source>rect{stroke:#4ce199}svg.graph .node.node-sink>rect{stroke:#e6ec8b}svg.graph .node.node-normal>rect{stroke:#3fb6d8}svg.graph .node h5{color:#999}svg.graph .edgeLabel rect{fill:#fff}svg.graph .edgePath path{stroke:#333;stroke-width:2px;fill:#333}svg.graph .label{color:#777;margin:0}svg.graph .node-label{display:block;margin:0;text-decoration:none}.timeline{overflow:hidden}.timeline-canvas{overflow:hidden;padding:10px}.timeline-canvas .bar-container{overflow:hidden}.timeline-canvas.secondary .timeline-insidelabel,.timeline-canvas.secondary .timeline-series{cursor:auto}#content .navbar-secondary-additional.navbar-secondary-additional-2 .add-metrics a,.show-pointer{cursor:pointer}.qtip-timeline-bar{font-size:14px;line-height:1.4}#content .navbar-secondary-additional.navbar-secondary-additional-2{margin:-10px -10px 10px;padding:0;border-bottom:1px solid #e4e4e4}#content .navbar-secondary-additional.navbar-secondary-additional-2 .navbar-info{padding-top:12px;padding-bottom:12px}#content .navbar-secondary-additional.navbar-secondary-additional-2 .add-metrics{margin-right:15px;float:right}#content .navbar-secondary-additional.navbar-secondary-additional-2 .add-metrics .btn{margin-top:5px;margin-bottom:5px}#content .navbar-secondary-additional.navbar-secondary-additional-2 .metric-menu{max-height:300px;max-width:900px;overflow-y:scroll;text-align:right}.metric-row{margin:0;min-height:275px;padding:0;list-style-type:none}.metric-row .metric-col{background-color:transparent;width:33.33%;float:left}.metric-row .metric-col.big{width:100%}.metric-row .metric-col .panel{margin-left:5px;margin-right:5px;min-height:265px;margin-bottom:10px}.metric-row .metric-col .panel .panel-body{background-color:transparent;height:265px;position:relative}.metric-row .metric-col .panel .panel-body .metric-numeric{text-align:center;margin-top:75px;font-size:40px;font-weight:700}.metric-row .metric-col .panel .panel-heading{padding:0 10px;background-color:transparent;height:41px;line-height:41px;position:relative;overflow:hidden;cursor:pointer}.metric-row .metric-col .panel .panel-heading .metric-title{padding:10px 0}.metric-row .metric-col .panel .panel-heading .buttons{position:absolute;top:0;right:0;padding:0 10px;background-color:#fff}.metric-row .metric-col.dndDraggingSource{display:none}.metric-row .dndPlaceholder{position:relative;background-color:#f0f0f0;min-height:305px;display:block;width:33.33%;float:left;margin-bottom:10px;border-radius:5px}.p-info{padding-left:5px;padding-right:5px}@media (min-width:1024px) and (max-width:1279px){#content #fold-button,#sidebar .navbar-static-top .navbar-brand-text{display:none}#sidebar{left:0;width:160px}#content{margin-left:160px}#content .navbar-main,#content .navbar-main-additional{left:160px}.table td.td-long{width:20%}}@media (min-width:1280px){#sidebar{left:0}#content{margin-left:250px}#content #fold-button{display:none}#content .navbar-main,#content .navbar-main-additional{left:250px}.table td.td-long{width:30%}}.legend-box{font-size:10px;width:2em}#total-mem{background-color:#7cb5ec}#heap-mem{background-color:#434348}#non-heap-mem{background-color:#90ed7d}#fetch-plan,#job-submit{width:100px}#content-inner,#details,#node-details{height:100%}#job-panel{overflow-y:auto} \ No newline at end of file diff --git a/flink-runtime-web/web-dashboard/web/js/hs/index.js b/flink-runtime-web/web-dashboard/web/js/hs/index.js index 148d9dd01f798d..766120610c899f 100644 --- a/flink-runtime-web/web-dashboard/web/js/hs/index.js +++ b/flink-runtime-web/web-dashboard/web/js/hs/index.js @@ -1,2 +1,2 @@ -angular.module("flinkApp",["ui.router","angularMoment","dndLists"]).run(["$rootScope",function(e){return e.sidebarVisible=!1,e.showSidebar=function(){return e.sidebarVisible=!e.sidebarVisible,e.sidebarClass="force-show"}}]).value("flinkConfig",{jobServer:"","refresh-interval":1e4}).value("watermarksConfig",{noWatermark:-0x8000000000000000}).run(["JobsService","MainService","flinkConfig","$interval",function(e,t,r,n){return t.loadConfig().then(function(t){return angular.extend(r,t),e.listJobs(),n(function(){return e.listJobs()},r["refresh-interval"])})}]).config(["$uiViewScrollProvider",function(e){return e.useAnchorScroll()}]).run(["$rootScope","$state",function(e,t){return e.$on("$stateChangeStart",function(e,r,n,o){if(r.redirectTo)return e.preventDefault(),t.go(r.redirectTo,n)})}]).config(["$stateProvider","$urlRouterProvider",function(e,t){return e.state("completed-jobs",{url:"/completed-jobs",views:{main:{templateUrl:"partials/jobs/completed-jobs.html",controller:"CompletedJobsController"}}}).state("single-job",{url:"/jobs/{jobid}","abstract":!0,views:{main:{templateUrl:"partials/jobs/job.html",controller:"SingleJobController"}}}).state("single-job.plan",{url:"",redirectTo:"single-job.plan.subtasks",views:{details:{templateUrl:"partials/jobs/job.plan.html",controller:"JobPlanController"}}}).state("single-job.plan.subtasks",{url:"",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.subtasks.html",controller:"JobPlanSubtasksController"}}}).state("single-job.plan.metrics",{url:"/metrics",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.metrics.html",controller:"JobPlanMetricsController"}}}).state("single-job.plan.watermarks",{url:"/watermarks",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.watermarks.html"}}}).state("single-job.plan.taskmanagers",{url:"/taskmanagers",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.taskmanagers.html",controller:"JobPlanTaskManagersController"}}}).state("single-job.plan.accumulators",{url:"/accumulators",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.accumulators.html",controller:"JobPlanAccumulatorsController"}}}).state("single-job.plan.checkpoints",{url:"/checkpoints",redirectTo:"single-job.plan.checkpoints.overview",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.checkpoints.html",controller:"JobPlanCheckpointsController"}}}).state("single-job.plan.checkpoints.overview",{url:"/overview",views:{"checkpoints-view":{templateUrl:"partials/jobs/job.plan.node.checkpoints.overview.html",controller:"JobPlanCheckpointsController"}}}).state("single-job.plan.checkpoints.summary",{url:"/summary",views:{"checkpoints-view":{templateUrl:"partials/jobs/job.plan.node.checkpoints.summary.html",controller:"JobPlanCheckpointsController"}}}).state("single-job.plan.checkpoints.history",{url:"/history",views:{"checkpoints-view":{templateUrl:"partials/jobs/job.plan.node.checkpoints.history.html",controller:"JobPlanCheckpointsController"}}}).state("single-job.plan.checkpoints.config",{url:"/config",views:{"checkpoints-view":{templateUrl:"partials/jobs/job.plan.node.checkpoints.config.html",controller:"JobPlanCheckpointsController"}}}).state("single-job.plan.checkpoints.details",{url:"/details/{checkpointId}",views:{"checkpoints-view":{templateUrl:"partials/jobs/job.plan.node.checkpoints.details.html",controller:"JobPlanCheckpointDetailsController"}}}).state("single-job.plan.backpressure",{url:"/backpressure",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.backpressure.html",controller:"JobPlanBackPressureController"}}}).state("single-job.timeline",{url:"/timeline",views:{details:{templateUrl:"partials/jobs/job.timeline.html"}}}).state("single-job.timeline.vertex",{url:"/{vertexId}",views:{vertex:{templateUrl:"partials/jobs/job.timeline.vertex.html",controller:"JobTimelineVertexController"}}}).state("single-job.exceptions",{url:"/exceptions",views:{details:{templateUrl:"partials/jobs/job.exceptions.html",controller:"JobExceptionsController"}}}).state("single-job.config",{url:"/config",views:{details:{templateUrl:"partials/jobs/job.config.html"}}}),t.otherwise("/completed-jobs")}]),angular.module("flinkApp").directive("bsLabel",["JobsService",function(e){return{transclude:!0,replace:!0,scope:{getLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getLabelClass=function(){return"label label-"+e.translateLabelState(n.status)}}}}]).directive("bpLabel",["JobsService",function(e){return{transclude:!0,replace:!0,scope:{getBackPressureLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getBackPressureLabelClass=function(){return"label label-"+e.translateBackPressureLabelState(n.status)}}}}]).directive("indicatorPrimary",["JobsService",function(e){return{replace:!0,scope:{getLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getLabelClass=function(){return"fa fa-circle indicator indicator-"+e.translateLabelState(n.status)}}}}]).directive("tableProperty",function(){return{replace:!0,scope:{value:"="},template:"{{value || 'None'}}"}}),angular.module("flinkApp").filter("amDurationFormatExtended",["angularMomentConfig",function(e){var t;return t=function(e,t,r){return"undefined"==typeof e||null===e?"":moment.duration(e,t).format(r,{trim:!1})},t.$stateful=e.statefulFilters,t}]).filter("humanizeDuration",function(){return function(e,t){var r,n,o,i,s,a;return"undefined"==typeof e||null===e?"":(i=e%1e3,a=Math.floor(e/1e3),s=a%60,a=Math.floor(a/60),o=a%60,a=Math.floor(a/60),n=a%24,a=Math.floor(a/24),r=a,0===r?0===n?0===o?0===s?i+"ms":s+"s ":o+"m "+s+"s":t?n+"h "+o+"m":n+"h "+o+"m "+s+"s":t?r+"d "+n+"h":r+"d "+n+"h "+o+"m "+s+"s")}}).filter("limit",function(){return function(e){return e.length>73&&(e=e.substring(0,35)+"..."+e.substring(e.length-35,e.length)),e}}).filter("humanizeText",function(){return function(e){return e?e.replace(/>/g,">").replace(//g,""):""}}).filter("humanizeBytes",function(){return function(e){var t,r;return r=["B","KB","MB","GB","TB","PB","EB"],t=function(e,n){var o;return o=Math.pow(1024,n),e=r;n=0<=r?++e:--e)o.push(n+".currentLowWatermark");return o}(),o.getMetrics(i,t.id,s).then(function(e){var t,n,o,i,s,a,l;o=NaN,l={},i=e.values;for(t in i)a=i[t],s=t.replace(".currentLowWatermark",""),l[s]=a,(isNaN(o)||au.noWatermark?o:NaN,r.resolve({lowWatermark:n,watermarks:l})}),r.promise}}(this),r=l.defer(),s={},n=t.length,angular.forEach(t,function(e){return function(e,t){var o;return o=e.id,i(e).then(function(e){if(s[o]=e,t>=n-1)return r.resolve(s)})}}(this)),r.promise},e.hasWatermark=function(t){return e.watermarks[t]&&!isNaN(e.watermarks[t].lowWatermark)},e.$watch("plan",function(t){if(t)return c(t.nodes).then(function(t){return e.watermarks=t})}),e.$on("reload",function(){if(e.plan)return c(e.plan.nodes).then(function(t){return e.watermarks=t})})}]).controller("JobPlanController",["$scope","$state","$stateParams","$window","JobsService",function(e,t,r,n,o){return e.nodeid=null,e.nodeUnfolded=!1,e.stateList=o.stateList(),e.changeNode=function(t){return t!==e.nodeid?(e.nodeid=t,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null,e.$broadcast("reload"),e.$broadcast("node:change",e.nodeid)):(e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null)},e.deactivateNode=function(){return e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null},e.toggleFold=function(){return e.nodeUnfolded=!e.nodeUnfolded}}]).controller("JobPlanSubtasksController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getSubtasks(e.nodeid).then(function(t){return e.subtasks=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanTaskManagersController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getTaskManagers(e.nodeid).then(function(t){return e.taskmanagers=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanAccumulatorsController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getAccumulators(e.nodeid).then(function(t){return e.accumulators=t.main,e.subtaskAccumulators=t.subtasks})},!e.nodeid||e.vertex&&e.vertex.accumulators||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanCheckpointsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var o;return e.checkpointDetails={},e.checkpointDetails.id=-1,n.getCheckpointConfig().then(function(t){return e.checkpointConfig=t}),o=function(){return n.getCheckpointStats().then(function(t){if(null!==t)return e.checkpointStats=t})},o(),e.$on("reload",function(e){return o()})}]).controller("JobPlanCheckpointDetailsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var o,i;return e.subtaskDetails={},e.checkpointDetails.id=r.checkpointId,o=function(t){return n.getCheckpointDetails(t).then(function(t){return null!==t?e.checkpoint=t:e.unknown_checkpoint=!0})},i=function(t,r){return n.getCheckpointSubtaskDetails(t,r).then(function(t){if(null!==t)return e.subtaskDetails[r]=t})},o(r.checkpointId),e.nodeid&&i(r.checkpointId,e.nodeid),e.$on("reload",function(t){if(o(r.checkpointId),e.nodeid)return i(r.checkpointId,e.nodeid)}),e.$on("$destroy",function(){return e.checkpointDetails.id=-1})}]).controller("JobPlanBackPressureController",["$scope","JobsService",function(e,t){var r;return r=function(){if(e.now=Date.now(),e.nodeid)return t.getOperatorBackPressure(e.nodeid).then(function(t){return e.backPressureOperatorStats[e.nodeid]=t})},r(),e.$on("reload",function(e){return r()})}]).controller("JobTimelineVertexController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var o;return o=function(){return n.getVertex(r.vertexId).then(function(t){return e.vertex=t})},o(),e.$on("reload",function(e){return o()})}]).controller("JobExceptionsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){return n.loadExceptions().then(function(t){return e.exceptions=t})}]).controller("JobPropertiesController",["$scope","JobsService",function(e,t){return e.changeNode=function(r){return r!==e.nodeid?(e.nodeid=r,t.getNode(r).then(function(t){return e.node=t})):(e.nodeid=null,e.node=null)}}]).controller("JobPlanMetricsController",["$scope","JobsService","MetricsService",function(e,t,r){var n;if(e.dragging=!1,e.window=r.getWindow(),e.availableMetrics=null,e.$on("$destroy",function(){return r.unRegisterObserver()}),n=function(){return t.getVertex(e.nodeid).then(function(t){return e.vertex=t}),r.getAvailableMetrics(e.jobid,e.nodeid).then(function(t){return e.availableMetrics=t,e.metrics=r.getMetricsSetup(e.jobid,e.nodeid).names,r.registerObserver(e.jobid,e.nodeid,function(t){return e.$broadcast("metrics:data:update",t.timestamp,t.values)})})},e.dropped=function(t,o,i,s,a){return r.orderMetrics(e.jobid,e.nodeid,i,o),e.$broadcast("metrics:refresh",i),n(),!1},e.dragStart=function(){return e.dragging=!0},e.dragEnd=function(){return e.dragging=!1},e.addMetric=function(t){return r.addMetric(e.jobid,e.nodeid,t.id),n()},e.removeMetric=function(t){return r.removeMetric(e.jobid,e.nodeid,t),n()},e.setMetricSize=function(t,o){return r.setMetricSize(e.jobid,e.nodeid,t,o),n()},e.getValues=function(t){return r.getValues(e.jobid,e.nodeid,t)},e.$on("node:change",function(t,r){if(!e.dragging)return n()}),e.nodeid)return n()}]),angular.module("flinkApp").directive("vertex",["$state",function(e){return{template:"",scope:{data:"="},link:function(e,t,r){var n,o,i;i=t.children()[0],o=t.width(),angular.element(i).attr("width",o),(n=function(e){var t,r,n;return d3.select(i).selectAll("*").remove(),n=[],angular.forEach(e.subtasks,function(e,t){var r;return r=[{label:"Scheduled",color:"#666",borderColor:"#555",starting_time:e.timestamps.SCHEDULED,ending_time:e.timestamps.DEPLOYING,type:"regular"},{label:"Deploying",color:"#aaa",borderColor:"#555",starting_time:e.timestamps.DEPLOYING,ending_time:e.timestamps.RUNNING,type:"regular"}],e.timestamps.FINISHED>0&&r.push({label:"Running",color:"#ddd",borderColor:"#555",starting_time:e.timestamps.RUNNING,ending_time:e.timestamps.FINISHED,type:"regular"}),n.push({label:"("+e.subtask+") "+e.host,times:r})}),t=d3.timeline().stack().tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("single").labelFormat(function(e){return e}).margin({left:100,right:0,top:0,bottom:0}).itemHeight(30).relativeTime(),r=d3.select(i).datum(n).call(t)})(e.data)}}}]).directive("timeline",["$state",function(e){return{template:"",scope:{vertices:"=",jobid:"="},link:function(t,r,n){var o,i,s,a;s=r.children()[0],i=r.width(),angular.element(s).attr("width",i),a=function(e){return e.replace(">",">")},o=function(r){var n,o,i;return d3.select(s).selectAll("*").remove(),i=[],angular.forEach(r,function(e){if(e["start-time"]>-1)return"scheduled"===e.type?i.push({times:[{label:a(e.name),color:"#cccccc",borderColor:"#555555",starting_time:e["start-time"],ending_time:e["end-time"],type:e.type}]}):i.push({times:[{label:a(e.name),color:"#d9f1f7",borderColor:"#62cdea",starting_time:e["start-time"],ending_time:e["end-time"],link:e.id,type:e.type}]})}),n=d3.timeline().stack().click(function(r,n,o){if(r.link)return e.go("single-job.timeline.vertex",{jobid:t.jobid,vertexId:r.link})}).tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("main").margin({left:0,right:0,top:0,bottom:0}).itemHeight(30).showBorderLine().showHourTimeline(),o=d3.select(s).datum(i).call(n)},t.$watch(n.vertices,function(e){if(e)return o(e)})}}}]).directive("split",function(){return{compile:function(e,t){return Split(e.children(),{sizes:[50,50],direction:"vertical"})}}}).directive("jobPlan",["$timeout",function(e){return{template:"
",scope:{plan:"=",watermarks:"=",setNode:"&"},link:function(e,t,r){var n,o,i,s,a,l,u,c,d,f,p,g,m,h,b,v,k,j,S,w,C,$,J,M,y;p=null,C=d3.behavior.zoom(),y=[],h=r.jobid,S=t.children()[0],j=t.children().children()[0],w=t.children()[1],l=d3.select(S),u=d3.select(j),c=d3.select(w),n=t.width(),angular.element(t.children()[0]).width(n),v=0,b=0,e.zoomIn=function(){var e,t,r;if(C.scale()<2.99)return e=C.translate(),t=e[0]*(C.scale()+.1/C.scale()),r=e[1]*(C.scale()+.1/C.scale()),C.scale(C.scale()+.1),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},e.zoomOut=function(){var e,t,r;if(C.scale()>.31)return C.scale(C.scale()-.1),e=C.translate(),t=e[0]*(C.scale()-.1/C.scale()),r=e[1]*(C.scale()-.1/C.scale()),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},i=function(e){var t;return t="",null==e.ship_strategy&&null==e.local_strategy||(t+="
",null!=e.ship_strategy&&(t+=e.ship_strategy),void 0!==e.temp_mode&&(t+=" ("+e.temp_mode+")"),void 0!==e.local_strategy&&(t+=",
"+e.local_strategy),t+="
"),t},m=function(e){return"partialSolution"===e||"nextPartialSolution"===e||"workset"===e||"nextWorkset"===e||"solutionSet"===e||"solutionDelta"===e},g=function(e,t){return"mirror"===t?"node-mirror":m(t)?"node-iteration":"node-normal"},s=function(e,t,r,n){var o,i;return o="
",o+="mirror"===t?"

Mirror of "+e.operator+"

":"

"+e.operator+"

",""===e.description?o+="":(i=e.description,i=M(i),o+="

"+i+"

"),null!=e.step_function?o+=f(e.id,r,n):(m(t)&&(o+="
"+t+" Node
"),""!==e.parallelism&&(o+="
Parallelism: "+e.parallelism+"
"),void 0!==e.lowWatermark&&(o+="
Low Watermark: "+e.lowWatermark+"
"),void 0!==e.operator&&e.operator_strategy&&(o+="
Operation: "+M(e.operator_strategy)+"
")),o+="
"},f=function(e,t,r){var n,o;return o="svg-"+e,n=""},M=function(e){var t;for("<"===e.charAt(0)&&(e=e.replace("<","<"),e=e.replace(">",">")),t="";e.length>30;)t=t+e.substring(0,30)+"
",e=e.substring(30,e.length);return t+=e},a=function(e,t,r,n,o,i){return null==n&&(n=!1),r.id===t.partial_solution?e.setNode(r.id,{label:s(r,"partialSolution",o,i),labelType:"html","class":g(r,"partialSolution")}):r.id===t.next_partial_solution?e.setNode(r.id,{label:s(r,"nextPartialSolution",o,i),labelType:"html","class":g(r,"nextPartialSolution")}):r.id===t.workset?e.setNode(r.id,{label:s(r,"workset",o,i),labelType:"html","class":g(r,"workset")}):r.id===t.next_workset?e.setNode(r.id,{label:s(r,"nextWorkset",o,i),labelType:"html","class":g(r,"nextWorkset")}):r.id===t.solution_set?e.setNode(r.id,{label:s(r,"solutionSet",o,i),labelType:"html","class":g(r,"solutionSet")}):r.id===t.solution_delta?e.setNode(r.id,{label:s(r,"solutionDelta",o,i),labelType:"html","class":g(r,"solutionDelta")}):e.setNode(r.id,{label:s(r,"",o,i),labelType:"html","class":g(r,"")})},o=function(e,t,r,n,o){return e.setEdge(o.id,r.id,{label:i(o),labelType:"html",arrowhead:"normal"})},k=function(e,t){var r,n,i,s,l,u,d,f,p,g,m,h,b,v;for(n=[],null!=t.nodes?v=t.nodes:(v=t.step_function,i=!0),s=0,u=v.length;s-1))return e["end-time"]=e["start-time"]+e.duration})},this.processVertices=function(e){return angular.forEach(e.vertices,function(e,t){return e.type="regular"}),e.vertices.unshift({name:"Scheduled","start-time":e.timestamps.CREATED,"end-time":e.timestamps.CREATED+1,type:"scheduled"})},this.listJobs=function(){var r;return r=o.defer(),e.get(t.jobServer+"joboverview").success(function(e){return function(t,n,o,i){return angular.forEach(t,function(t,r){switch(r){case"running":return c.running=e.setEndTimes(t);case"finished":return c.finished=e.setEndTimes(t);case"cancelled":return c.cancelled=e.setEndTimes(t);case"failed":return c.failed=e.setEndTimes(t)}}),r.resolve(c),d()}}(this)),r.promise},this.getJobs=function(e){return c[e]},this.getAllJobs=function(){return c},this.loadJob=function(r){return s=null,l.job=o.defer(),e.get(t.jobServer+"jobs/"+r).success(function(n){return function(o,i,a,u){return n.setEndTimes(o.vertices),n.processVertices(o),e.get(t.jobServer+"jobs/"+r+"/config").success(function(e){return o=angular.extend(o,e),s=o,l.job.resolve(s)})}}(this)),l.job.promise},this.getNode=function(e){var t,r;return r=function(e,t){var n,o,i,s;for(n=0,o=t.length;n
{{metric.id}}
',replace:!0,scope:{metric:"=",window:"=",removeMetric:"&",setMetricSize:"=",getValues:"&"},link:function(e,t,r){return e.btnClasses=["btn","btn-default","btn-xs"],e.value=null,e.data=[{values:e.getValues()}],e.options={x:function(e,t){return e.x},y:function(e,t){return e.y},xTickFormat:function(e){return d3.time.format("%H:%M:%S")(new Date(e))},yTickFormat:function(e){var t,r,n,o;for(r=!1,n=0,o=1,t=Math.abs(e);!r&&n<50;)Math.pow(10,n)<=t&&t6?e/Math.pow(10,n)+"E"+n:""+e}},e.showChart=function(){return d3.select(t.find("svg")[0]).datum(e.data).transition().duration(250).call(e.chart)},e.chart=nv.models.lineChart().options(e.options).showLegend(!1).margin({top:15,left:60,bottom:30,right:30}),e.chart.yAxis.showMaxMin(!1),e.chart.tooltip.hideDelay(0), -e.chart.tooltip.contentGenerator(function(e){return"

"+d3.time.format("%H:%M:%S")(new Date(e.point.x))+" | "+e.point.y+"

"}),nv.utils.windowResize(e.chart.update),e.setSize=function(t){return e.setMetricSize(e.metric,t)},e.showChart(),e.$on("metrics:data:update",function(t,r,n){return e.value=parseFloat(n[e.metric.id]),e.data[0].values.push({x:r,y:e.value}),e.data[0].values.length>e.window&&e.data[0].values.shift(),e.showChart(),e.chart.clearHighlights(),e.chart.tooltip.hidden(!0)}),t.find(".metric-title").qtip({content:{text:e.metric.id},position:{my:"bottom left",at:"top left"},style:{classes:"qtip-light qtip-timeline-bar"}})}}}),angular.module("flinkApp").service("MetricsService",["$http","$q","flinkConfig","$interval",function(e,t,r,n){return this.metrics={},this.values={},this.watched={},this.observer={jobid:null,nodeid:null,callback:null},this.refresh=n(function(e){return function(){return angular.forEach(e.metrics,function(t,r){return angular.forEach(t,function(t,n){var o;if(o=[],angular.forEach(t,function(e,t){return o.push(e.id)}),o.length>0)return e.getMetrics(r,n,o).then(function(t){if(r===e.observer.jobid&&n===e.observer.nodeid&&e.observer.callback)return e.observer.callback(t)})})})}}(this),r["refresh-interval"]),this.registerObserver=function(e,t,r){return this.observer.jobid=e,this.observer.nodeid=t,this.observer.callback=r},this.unRegisterObserver=function(){return this.observer={jobid:null,nodeid:null,callback:null}},this.setupMetrics=function(e,t){return this.setupLS(),this.watched[e]=[],angular.forEach(t,function(t){return function(r,n){if(r.id)return t.watched[e].push(r.id)}}(this))},this.getWindow=function(){return 100},this.setupLS=function(){return null==sessionStorage.flinkMetrics&&this.saveSetup(),this.metrics=JSON.parse(sessionStorage.flinkMetrics)},this.saveSetup=function(){return sessionStorage.flinkMetrics=JSON.stringify(this.metrics)},this.saveValue=function(e,t,r){if(null==this.values[e]&&(this.values[e]={}),null==this.values[e][t]&&(this.values[e][t]=[]),this.values[e][t].push(r),this.values[e][t].length>this.getWindow())return this.values[e][t].shift()},this.getValues=function(e,t,r){var n;return null==this.values[e]?[]:null==this.values[e][t]?[]:(n=[],angular.forEach(this.values[e][t],function(e){return function(e,t){if(null!=e.values[r])return n.push({x:e.timestamp,y:e.values[r]})}}(this)),n)},this.setupLSFor=function(e,t){if(null==this.metrics[e]&&(this.metrics[e]={}),null==this.metrics[e][t])return this.metrics[e][t]=[]},this.addMetric=function(e,t,r){return this.setupLSFor(e,t),this.metrics[e][t].push({id:r,size:"small"}),this.saveSetup()},this.removeMetric=function(e){return function(t,r,n){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n})),o!==-1&&e.metrics[t][r].splice(o,1),e.saveSetup()}}(this),this.setMetricSize=function(e){return function(t,r,n,o){var i;if(null!=e.metrics[t][r])return i=e.metrics[t][r].indexOf(n.id),i===-1&&(i=_.findIndex(e.metrics[t][r],{id:n.id})),i!==-1&&(e.metrics[t][r][i]={id:n.id,size:o}),e.saveSetup()}}(this),this.orderMetrics=function(e,t,r,n){return this.setupLSFor(e,t),angular.forEach(this.metrics[e][t],function(o){return function(i,s){if(i.id===r.id&&(o.metrics[e][t].splice(s,1),s",link:function(t,r,n){return t.getLabelClass=function(){return"label label-"+e.translateLabelState(n.status)}}}}]).directive("bpLabel",["JobsService",function(e){return{transclude:!0,replace:!0,scope:{getBackPressureLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getBackPressureLabelClass=function(){return"label label-"+e.translateBackPressureLabelState(n.status)}}}}]).directive("indicatorPrimary",["JobsService",function(e){return{replace:!0,scope:{getLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getLabelClass=function(){return"fa fa-circle indicator indicator-"+e.translateLabelState(n.status)}}}}]).directive("tableProperty",function(){return{replace:!0,scope:{value:"="},template:"{{value || 'None'}}"}}),angular.module("flinkApp").filter("amDurationFormatExtended",["angularMomentConfig",function(e){var t;return t=function(e,t,r){return"undefined"==typeof e||null===e?"":moment.duration(e,t).format(r,{trim:!1})},t.$stateful=e.statefulFilters,t}]).filter("humanizeDuration",function(){return function(e,t){var r,n,i,o,s,a;return"undefined"==typeof e||null===e?"":(o=e%1e3,a=Math.floor(e/1e3),s=a%60,a=Math.floor(a/60),i=a%60,a=Math.floor(a/60),n=a%24,a=Math.floor(a/24),r=a,0===r?0===n?0===i?0===s?o+"ms":s+"s ":i+"m "+s+"s":t?n+"h "+i+"m":n+"h "+i+"m "+s+"s":t?r+"d "+n+"h":r+"d "+n+"h "+i+"m "+s+"s")}}).filter("limit",function(){return function(e){return e.length>73&&(e=e.substring(0,35)+"..."+e.substring(e.length-35,e.length)),e}}).filter("humanizeText",function(){return function(e){return e?e.replace(/>/g,">").replace(//g,""):""}}).filter("humanizeBytes",function(){return function(e){var t,r;return r=["B","KB","MB","GB","TB","PB","EB"],t=function(e,n){var i;return i=Math.pow(1024,n),e=r;n=0<=r?++e:--e)i.push(n+".currentLowWatermark");return i}(),i.getMetrics(o,t.id,s).then(function(e){var t,n,i,o,s,a,l;i=NaN,l={},o=e.values;for(t in o)a=o[t],s=t.replace(".currentLowWatermark",""),l[s]=a,(isNaN(i)||au.noWatermark?i:NaN,r.resolve({lowWatermark:n,watermarks:l})}),r.promise}}(this),r=l.defer(),s={},n=t.length,angular.forEach(t,function(e){return function(e,t){var i;return i=e.id,o(e).then(function(e){if(s[i]=e,t>=n-1)return r.resolve(s)})}}(this)),r.promise},e.hasWatermark=function(t){return e.watermarks[t]&&!isNaN(e.watermarks[t].lowWatermark)},e.$watch("plan",function(t){if(t)return c(t.nodes).then(function(t){return e.watermarks=t})}),e.$on("reload",function(){if(e.plan)return c(e.plan.nodes).then(function(t){return e.watermarks=t})})}]).controller("JobPlanController",["$scope","$state","$stateParams","$window","JobsService",function(e,t,r,n,i){return e.nodeid=null,e.nodeUnfolded=!1,e.stateList=i.stateList(),e.changeNode=function(t){return t!==e.nodeid?(e.nodeid=t,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null,e.$broadcast("reload"),e.$broadcast("node:change",e.nodeid)):(e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null)},e.deactivateNode=function(){return e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null},e.toggleFold=function(){return e.nodeUnfolded=!e.nodeUnfolded}}]).controller("JobPlanSubtasksController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getSubtasks(e.nodeid).then(function(t){return e.subtasks=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanTaskManagersController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getTaskManagers(e.nodeid).then(function(t){return e.taskmanagers=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanAccumulatorsController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getAccumulators(e.nodeid).then(function(t){return e.accumulators=t.main,e.subtaskAccumulators=t.subtasks})},!e.nodeid||e.vertex&&e.vertex.accumulators||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanCheckpointsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i;return e.checkpointDetails={},e.checkpointDetails.id=-1,n.getCheckpointConfig().then(function(t){return e.checkpointConfig=t}),i=function(){return n.getCheckpointStats().then(function(t){if(null!==t)return e.checkpointStats=t})},i(),e.$on("reload",function(e){return i()})}]).controller("JobPlanCheckpointDetailsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i,o;return e.subtaskDetails={},e.checkpointDetails.id=r.checkpointId,i=function(t){return n.getCheckpointDetails(t).then(function(t){return null!==t?e.checkpoint=t:e.unknown_checkpoint=!0})},o=function(t,r){return n.getCheckpointSubtaskDetails(t,r).then(function(t){if(null!==t)return e.subtaskDetails[r]=t})},i(r.checkpointId),e.nodeid&&o(r.checkpointId,e.nodeid),e.$on("reload",function(t){if(i(r.checkpointId),e.nodeid)return o(r.checkpointId,e.nodeid)}),e.$on("$destroy",function(){return e.checkpointDetails.id=-1})}]).controller("JobPlanBackPressureController",["$scope","JobsService",function(e,t){var r;return r=function(){if(e.now=Date.now(),e.nodeid)return t.getOperatorBackPressure(e.nodeid).then(function(t){return e.backPressureOperatorStats[e.nodeid]=t})},r(),e.$on("reload",function(e){return r()})}]).controller("JobTimelineVertexController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i;return i=function(){return n.getVertex(r.vertexId).then(function(t){return e.vertex=t})},i(),e.$on("reload",function(e){return i()})}]).controller("JobExceptionsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){return n.loadExceptions().then(function(t){return e.exceptions=t})}]).controller("JobPropertiesController",["$scope","JobsService",function(e,t){return e.changeNode=function(r){return r!==e.nodeid?(e.nodeid=r,t.getNode(r).then(function(t){return e.node=t})):(e.nodeid=null,e.node=null)}}]).controller("JobPlanMetricsController",["$scope","JobsService","MetricsService",function(e,t,r){var n;if(e.dragging=!1,e.window=r.getWindow(),e.availableMetrics=null,e.$on("$destroy",function(){return r.unRegisterObserver()}),n=function(){return t.getVertex(e.nodeid).then(function(t){return e.vertex=t}),r.getAvailableMetrics(e.jobid,e.nodeid).then(function(t){return e.availableMetrics=t,e.metrics=r.getMetricsSetup(e.jobid,e.nodeid).names,r.registerObserver(e.jobid,e.nodeid,function(t){return e.$broadcast("metrics:data:update",t.timestamp,t.values)})})},e.dropped=function(t,i,o,s,a){return r.orderMetrics(e.jobid,e.nodeid,o,i),e.$broadcast("metrics:refresh",o),n(),!1},e.dragStart=function(){return e.dragging=!0},e.dragEnd=function(){return e.dragging=!1},e.addMetric=function(t){return r.addMetric(e.jobid,e.nodeid,t.id),n()},e.removeMetric=function(t){return r.removeMetric(e.jobid,e.nodeid,t),n()},e.setMetricSize=function(t,i){return r.setMetricSize(e.jobid,e.nodeid,t,i),n()},e.setMetricView=function(t,i){return r.setMetricView(e.jobid,e.nodeid,t,i),n()},e.getValues=function(t){return r.getValues(e.jobid,e.nodeid,t)},e.$on("node:change",function(t,r){if(!e.dragging)return n()}),e.nodeid)return n()}]),angular.module("flinkApp").directive("vertex",["$state",function(e){return{template:"",scope:{data:"="},link:function(e,t,r){var n,i,o;o=t.children()[0],i=t.width(),angular.element(o).attr("width",i),(n=function(e){var t,r,n;return d3.select(o).selectAll("*").remove(),n=[],angular.forEach(e.subtasks,function(e,t){var r;return r=[{label:"Scheduled",color:"#666",borderColor:"#555",starting_time:e.timestamps.SCHEDULED,ending_time:e.timestamps.DEPLOYING,type:"regular"},{label:"Deploying",color:"#aaa",borderColor:"#555",starting_time:e.timestamps.DEPLOYING,ending_time:e.timestamps.RUNNING,type:"regular"}],e.timestamps.FINISHED>0&&r.push({label:"Running",color:"#ddd",borderColor:"#555",starting_time:e.timestamps.RUNNING,ending_time:e.timestamps.FINISHED,type:"regular"}),n.push({label:"("+e.subtask+") "+e.host,times:r})}),t=d3.timeline().stack().tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("single").labelFormat(function(e){return e}).margin({left:100,right:0,top:0,bottom:0}).itemHeight(30).relativeTime(),r=d3.select(o).datum(n).call(t)})(e.data)}}}]).directive("timeline",["$state",function(e){return{template:"",scope:{vertices:"=",jobid:"="},link:function(t,r,n){var i,o,s,a;s=r.children()[0],o=r.width(),angular.element(s).attr("width",o),a=function(e){return e.replace(">",">")},i=function(r){var n,i,o;return d3.select(s).selectAll("*").remove(),o=[],angular.forEach(r,function(e){if(e["start-time"]>-1)return"scheduled"===e.type?o.push({times:[{label:a(e.name),color:"#cccccc",borderColor:"#555555",starting_time:e["start-time"],ending_time:e["end-time"],type:e.type}]}):o.push({times:[{label:a(e.name),color:"#d9f1f7",borderColor:"#62cdea",starting_time:e["start-time"],ending_time:e["end-time"],link:e.id,type:e.type}]})}),n=d3.timeline().stack().click(function(r,n,i){if(r.link)return e.go("single-job.timeline.vertex",{jobid:t.jobid,vertexId:r.link})}).tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("main").margin({left:0,right:0,top:0,bottom:0}).itemHeight(30).showBorderLine().showHourTimeline(),i=d3.select(s).datum(o).call(n)},t.$watch(n.vertices,function(e){if(e)return i(e)})}}}]).directive("split",function(){return{compile:function(e,t){return Split(e.children(),{sizes:[50,50],direction:"vertical"})}}}).directive("jobPlan",["$timeout",function(e){return{template:"
",scope:{plan:"=",watermarks:"=",setNode:"&"},link:function(e,t,r){var n,i,o,s,a,l,u,c,d,f,p,m,h,g,b,v,k,j,S,w,C,$,y,J,M;p=null,C=d3.behavior.zoom(),M=[],g=r.jobid,S=t.children()[0],j=t.children().children()[0],w=t.children()[1],l=d3.select(S),u=d3.select(j),c=d3.select(w),n=t.width(),angular.element(t.children()[0]).width(n),v=0,b=0,e.zoomIn=function(){var e,t,r;if(C.scale()<2.99)return e=C.translate(),t=e[0]*(C.scale()+.1/C.scale()),r=e[1]*(C.scale()+.1/C.scale()),C.scale(C.scale()+.1),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},e.zoomOut=function(){var e,t,r;if(C.scale()>.31)return C.scale(C.scale()-.1),e=C.translate(),t=e[0]*(C.scale()-.1/C.scale()),r=e[1]*(C.scale()-.1/C.scale()),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},o=function(e){var t;return t="",null==e.ship_strategy&&null==e.local_strategy||(t+="
",null!=e.ship_strategy&&(t+=e.ship_strategy),void 0!==e.temp_mode&&(t+=" ("+e.temp_mode+")"),void 0!==e.local_strategy&&(t+=",
"+e.local_strategy),t+="
"),t},h=function(e){return"partialSolution"===e||"nextPartialSolution"===e||"workset"===e||"nextWorkset"===e||"solutionSet"===e||"solutionDelta"===e},m=function(e,t){return"mirror"===t?"node-mirror":h(t)?"node-iteration":"node-normal"},s=function(e,t,r,n){var i,o;return i="
",i+="mirror"===t?"

Mirror of "+e.operator+"

":"

"+e.operator+"

",""===e.description?i+="":(o=e.description,o=J(o),i+="

"+o+"

"),null!=e.step_function?i+=f(e.id,r,n):(h(t)&&(i+="
"+t+" Node
"),""!==e.parallelism&&(i+="
Parallelism: "+e.parallelism+"
"),void 0!==e.lowWatermark&&(i+="
Low Watermark: "+e.lowWatermark+"
"),void 0!==e.operator&&e.operator_strategy&&(i+="
Operation: "+J(e.operator_strategy)+"
")),i+="
"},f=function(e,t,r){var n,i;return i="svg-"+e,n=""},J=function(e){var t;for("<"===e.charAt(0)&&(e=e.replace("<","<"),e=e.replace(">",">")),t="";e.length>30;)t=t+e.substring(0,30)+"
",e=e.substring(30,e.length);return t+=e},a=function(e,t,r,n,i,o){return null==n&&(n=!1),r.id===t.partial_solution?e.setNode(r.id,{label:s(r,"partialSolution",i,o),labelType:"html","class":m(r,"partialSolution")}):r.id===t.next_partial_solution?e.setNode(r.id,{label:s(r,"nextPartialSolution",i,o),labelType:"html","class":m(r,"nextPartialSolution")}):r.id===t.workset?e.setNode(r.id,{label:s(r,"workset",i,o),labelType:"html","class":m(r,"workset")}):r.id===t.next_workset?e.setNode(r.id,{label:s(r,"nextWorkset",i,o),labelType:"html","class":m(r,"nextWorkset")}):r.id===t.solution_set?e.setNode(r.id,{label:s(r,"solutionSet",i,o),labelType:"html","class":m(r,"solutionSet")}):r.id===t.solution_delta?e.setNode(r.id,{label:s(r,"solutionDelta",i,o),labelType:"html","class":m(r,"solutionDelta")}):e.setNode(r.id,{label:s(r,"",i,o),labelType:"html","class":m(r,"")})},i=function(e,t,r,n,i){return e.setEdge(i.id,r.id,{label:o(i),labelType:"html",arrowhead:"normal"})},k=function(e,t){var r,n,o,s,l,u,d,f,p,m,h,g,b,v;for(n=[],null!=t.nodes?v=t.nodes:(v=t.step_function,o=!0),s=0,u=v.length;s-1))return e["end-time"]=e["start-time"]+e.duration})},this.processVertices=function(e){return angular.forEach(e.vertices,function(e,t){return e.type="regular"}),e.vertices.unshift({name:"Scheduled","start-time":e.timestamps.CREATED,"end-time":e.timestamps.CREATED+1,type:"scheduled"})},this.listJobs=function(){var r;return r=i.defer(),e.get(t.jobServer+"joboverview").success(function(e){return function(t,n,i,o){return angular.forEach(t,function(t,r){switch(r){case"running":return c.running=e.setEndTimes(t);case"finished":return c.finished=e.setEndTimes(t);case"cancelled":return c.cancelled=e.setEndTimes(t);case"failed":return c.failed=e.setEndTimes(t)}}),r.resolve(c),d()}}(this)),r.promise},this.getJobs=function(e){return c[e]},this.getAllJobs=function(){return c},this.loadJob=function(r){return s=null,l.job=i.defer(),e.get(t.jobServer+"jobs/"+r).success(function(n){return function(i,o,a,u){return n.setEndTimes(i.vertices),n.processVertices(i),e.get(t.jobServer+"jobs/"+r+"/config").success(function(e){return i=angular.extend(i,e),s=i,l.job.resolve(s)})}}(this)),l.job.promise},this.getNode=function(e){var t,r;return r=function(e,t){var n,i,o,s;for(n=0,i=t.length;n
{{metric.id}}
{{value | humanizeChartNumeric:metric}}
',replace:!0,scope:{metric:"=",window:"=",removeMetric:"&",setMetricSize:"=",setMetricView:"=",getValues:"&"},link:function(e,t,r){return e.btnClasses=["btn","btn-default","btn-xs"],e.value=null,e.data=[{values:e.getValues()}],e.options={x:function(e,t){return e.x},y:function(e,t){return e.y},xTickFormat:function(e){return d3.time.format("%H:%M:%S")(new Date(e))},yTickFormat:function(e){var t,r,n,i;for(r=!1,n=0,i=1,t=Math.abs(e);!r&&n<50;)Math.pow(10,n)<=t&&t6?e/Math.pow(10,n)+"E"+n:""+e}},e.showChart=function(){return d3.select(t.find("svg")[0]).datum(e.data).transition().duration(250).call(e.chart)},e.chart=nv.models.lineChart().options(e.options).showLegend(!1).margin({top:15,left:60,bottom:30,right:30}),e.chart.yAxis.showMaxMin(!1),e.chart.tooltip.hideDelay(0),e.chart.tooltip.contentGenerator(function(e){return"

"+d3.time.format("%H:%M:%S")(new Date(e.point.x))+" | "+e.point.y+"

"}),nv.utils.windowResize(e.chart.update),e.setSize=function(t){return e.setMetricSize(e.metric,t)},e.setView=function(t){if(e.setMetricView(e.metric,t),"chart"===t)return e.showChart()},"chart"===e.metric.view&&e.showChart(),e.$on("metrics:data:update",function(t,r,n){return e.value=parseFloat(n[e.metric.id]),e.data[0].values.push({x:r,y:e.value}),e.data[0].values.length>e.window&&e.data[0].values.shift(),"chart"===e.metric.view&&e.showChart(),"chart"===e.metric.view&&e.chart.clearHighlights(),e.chart.tooltip.hidden(!0)}),t.find(".metric-title").qtip({content:{text:e.metric.id},position:{my:"bottom left",at:"top left"},style:{classes:"qtip-light qtip-timeline-bar"}})}}}),angular.module("flinkApp").service("MetricsService",["$http","$q","flinkConfig","$interval",function(e,t,r,n){return this.metrics={},this.values={},this.watched={},this.observer={jobid:null,nodeid:null,callback:null},this.refresh=n(function(e){return function(){return angular.forEach(e.metrics,function(t,r){return angular.forEach(t,function(t,n){var i;if(i=[],angular.forEach(t,function(e,t){return i.push(e.id)}),i.length>0)return e.getMetrics(r,n,i).then(function(t){if(r===e.observer.jobid&&n===e.observer.nodeid&&e.observer.callback)return e.observer.callback(t)})})})}}(this),r["refresh-interval"]),this.registerObserver=function(e,t,r){return this.observer.jobid=e,this.observer.nodeid=t,this.observer.callback=r},this.unRegisterObserver=function(){return this.observer={jobid:null,nodeid:null,callback:null}},this.setupMetrics=function(e,t){return this.setupLS(),this.watched[e]=[],angular.forEach(t,function(t){return function(r,n){if(r.id)return t.watched[e].push(r.id)}}(this))},this.getWindow=function(){return 100},this.setupLS=function(){return null==sessionStorage.flinkMetrics&&this.saveSetup(),this.metrics=JSON.parse(sessionStorage.flinkMetrics)},this.saveSetup=function(){return sessionStorage.flinkMetrics=JSON.stringify(this.metrics)},this.saveValue=function(e,t,r){if(null==this.values[e]&&(this.values[e]={}),null==this.values[e][t]&&(this.values[e][t]=[]),this.values[e][t].push(r),this.values[e][t].length>this.getWindow())return this.values[e][t].shift()},this.getValues=function(e,t,r){var n;return null==this.values[e]?[]:null==this.values[e][t]?[]:(n=[],angular.forEach(this.values[e][t],function(e){return function(e,t){if(null!=e.values[r])return n.push({x:e.timestamp,y:e.values[r]})}}(this)),n)},this.setupLSFor=function(e,t){if(null==this.metrics[e]&&(this.metrics[e]={}),null==this.metrics[e][t])return this.metrics[e][t]=[]},this.addMetric=function(e,t,r){return this.setupLSFor(e,t),this.metrics[e][t].push({id:r,size:"small",view:"chart"}),this.saveSetup()},this.removeMetric=function(e){return function(t,r,n){var i;if(null!=e.metrics[t][r])return i=e.metrics[t][r].indexOf(n),i===-1&&(i=_.findIndex(e.metrics[t][r],{id:n})),i!==-1&&e.metrics[t][r].splice(i,1),e.saveSetup()}}(this),this.setMetricSize=function(e){return function(t,r,n,i){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n.id),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n.id})),o!==-1&&(e.metrics[t][r][o]={id:n.id,size:i,view:n.view}),e.saveSetup()}}(this),this.setMetricView=function(e){return function(t,r,n,i){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n.id),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n.id})),o!==-1&&(e.metrics[t][r][o]={id:n.id,size:n.size,view:i}),e.saveSetup()}}(this),this.orderMetrics=function(e,t,r,n){return this.setupLSFor(e,t),angular.forEach(this.metrics[e][t],function(i){return function(o,s){if(o.id===r.id&&(i.metrics[e][t].splice(s,1),s",link:function(t,r,n){return t.getLabelClass=function(){return"label label-"+e.translateLabelState(n.status)}}}}]).directive("bpLabel",["JobsService",function(e){return{transclude:!0,replace:!0,scope:{getBackPressureLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getBackPressureLabelClass=function(){return"label label-"+e.translateBackPressureLabelState(n.status)}}}}]).directive("indicatorPrimary",["JobsService",function(e){return{replace:!0,scope:{getLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getLabelClass=function(){return"fa fa-circle indicator indicator-"+e.translateLabelState(n.status)}}}}]).directive("tableProperty",function(){return{replace:!0,scope:{value:"="},template:"{{value || 'None'}}"}}),angular.module("flinkApp").filter("amDurationFormatExtended",["angularMomentConfig",function(e){var t;return t=function(e,t,r){return"undefined"==typeof e||null===e?"":moment.duration(e,t).format(r,{trim:!1})},t.$stateful=e.statefulFilters,t}]).filter("humanizeDuration",function(){return function(e,t){var r,n,o,a,i,s;return"undefined"==typeof e||null===e?"":(a=e%1e3,s=Math.floor(e/1e3),i=s%60,s=Math.floor(s/60),o=s%60,s=Math.floor(s/60),n=s%24,s=Math.floor(s/24),r=s,0===r?0===n?0===o?0===i?a+"ms":i+"s ":o+"m "+i+"s":t?n+"h "+o+"m":n+"h "+o+"m "+i+"s":t?r+"d "+n+"h":r+"d "+n+"h "+o+"m "+i+"s")}}).filter("limit",function(){return function(e){return e.length>73&&(e=e.substring(0,35)+"..."+e.substring(e.length-35,e.length)),e}}).filter("humanizeText",function(){return function(e){return e?e.replace(/>/g,">").replace(//g,""):""}}).filter("humanizeBytes",function(){return function(e){var t,r;return r=["B","KB","MB","GB","TB","PB","EB"],t=function(e,n){var o;return o=Math.pow(1024,n),e=r;n=0<=r?++e:--e)o.push(n+".currentLowWatermark");return o}(),o.getMetrics(a,t.id,i).then(function(e){var t,n,o,a,i,s,l;o=NaN,l={},a=e.values;for(t in a)s=a[t],i=t.replace(".currentLowWatermark",""),l[i]=s,(isNaN(o)||su.noWatermark?o:NaN,r.resolve({lowWatermark:n,watermarks:l})}),r.promise}}(this),r=l.defer(),i={},n=t.length,angular.forEach(t,function(e){return function(e,t){var o;return o=e.id,a(e).then(function(e){if(i[o]=e,t>=n-1)return r.resolve(i)})}}(this)),r.promise},e.hasWatermark=function(t){return e.watermarks[t]&&!isNaN(e.watermarks[t].lowWatermark)},e.$watch("plan",function(t){if(t)return c(t.nodes).then(function(t){return e.watermarks=t})}),e.$on("reload",function(){if(e.plan)return c(e.plan.nodes).then(function(t){return e.watermarks=t})})}]).controller("JobPlanController",["$scope","$state","$stateParams","$window","JobsService",function(e,t,r,n,o){return e.nodeid=null,e.nodeUnfolded=!1,e.stateList=o.stateList(),e.changeNode=function(t){return t!==e.nodeid?(e.nodeid=t,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null,e.$broadcast("reload"),e.$broadcast("node:change",e.nodeid)):(e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null)},e.deactivateNode=function(){return e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null},e.toggleFold=function(){return e.nodeUnfolded=!e.nodeUnfolded}}]).controller("JobPlanSubtasksController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getSubtasks(e.nodeid).then(function(t){return e.subtasks=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanTaskManagersController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getTaskManagers(e.nodeid).then(function(t){return e.taskmanagers=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanAccumulatorsController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getAccumulators(e.nodeid).then(function(t){return e.accumulators=t.main,e.subtaskAccumulators=t.subtasks})},!e.nodeid||e.vertex&&e.vertex.accumulators||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanCheckpointsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var o;return e.checkpointDetails={},e.checkpointDetails.id=-1,n.getCheckpointConfig().then(function(t){return e.checkpointConfig=t}),o=function(){return n.getCheckpointStats().then(function(t){if(null!==t)return e.checkpointStats=t})},o(),e.$on("reload",function(e){return o()})}]).controller("JobPlanCheckpointDetailsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var o,a;return e.subtaskDetails={},e.checkpointDetails.id=r.checkpointId,o=function(t){return n.getCheckpointDetails(t).then(function(t){return null!==t?e.checkpoint=t:e.unknown_checkpoint=!0})},a=function(t,r){return n.getCheckpointSubtaskDetails(t,r).then(function(t){if(null!==t)return e.subtaskDetails[r]=t})},o(r.checkpointId),e.nodeid&&a(r.checkpointId,e.nodeid),e.$on("reload",function(t){if(o(r.checkpointId),e.nodeid)return a(r.checkpointId,e.nodeid)}),e.$on("$destroy",function(){return e.checkpointDetails.id=-1})}]).controller("JobPlanBackPressureController",["$scope","JobsService",function(e,t){var r;return r=function(){if(e.now=Date.now(),e.nodeid)return t.getOperatorBackPressure(e.nodeid).then(function(t){return e.backPressureOperatorStats[e.nodeid]=t})},r(),e.$on("reload",function(e){return r()})}]).controller("JobTimelineVertexController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var o;return o=function(){return n.getVertex(r.vertexId).then(function(t){return e.vertex=t})},o(),e.$on("reload",function(e){return o()})}]).controller("JobExceptionsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){return n.loadExceptions().then(function(t){return e.exceptions=t})}]).controller("JobPropertiesController",["$scope","JobsService",function(e,t){return e.changeNode=function(r){return r!==e.nodeid?(e.nodeid=r,t.getNode(r).then(function(t){return e.node=t})):(e.nodeid=null,e.node=null)}}]).controller("JobPlanMetricsController",["$scope","JobsService","MetricsService",function(e,t,r){var n;if(e.dragging=!1,e.window=r.getWindow(),e.availableMetrics=null,e.$on("$destroy",function(){return r.unRegisterObserver()}),n=function(){return t.getVertex(e.nodeid).then(function(t){return e.vertex=t}),r.getAvailableMetrics(e.jobid,e.nodeid).then(function(t){return e.availableMetrics=t,e.metrics=r.getMetricsSetup(e.jobid,e.nodeid).names,r.registerObserver(e.jobid,e.nodeid,function(t){return e.$broadcast("metrics:data:update",t.timestamp,t.values)})})},e.dropped=function(t,o,a,i,s){return r.orderMetrics(e.jobid,e.nodeid,a,o),e.$broadcast("metrics:refresh",a),n(),!1},e.dragStart=function(){return e.dragging=!0},e.dragEnd=function(){return e.dragging=!1},e.addMetric=function(t){return r.addMetric(e.jobid,e.nodeid,t.id),n()},e.removeMetric=function(t){return r.removeMetric(e.jobid,e.nodeid,t),n()},e.setMetricSize=function(t,o){return r.setMetricSize(e.jobid,e.nodeid,t,o),n()},e.getValues=function(t){return r.getValues(e.jobid,e.nodeid,t)},e.$on("node:change",function(t,r){if(!e.dragging)return n()}),e.nodeid)return n()}]),angular.module("flinkApp").directive("vertex",["$state",function(e){return{template:"",scope:{data:"="},link:function(e,t,r){var n,o,a;a=t.children()[0],o=t.width(),angular.element(a).attr("width",o),(n=function(e){var t,r,n;return d3.select(a).selectAll("*").remove(),n=[],angular.forEach(e.subtasks,function(e,t){var r;return r=[{label:"Scheduled",color:"#666",borderColor:"#555",starting_time:e.timestamps.SCHEDULED,ending_time:e.timestamps.DEPLOYING,type:"regular"},{label:"Deploying",color:"#aaa",borderColor:"#555",starting_time:e.timestamps.DEPLOYING,ending_time:e.timestamps.RUNNING,type:"regular"}],e.timestamps.FINISHED>0&&r.push({label:"Running",color:"#ddd",borderColor:"#555",starting_time:e.timestamps.RUNNING,ending_time:e.timestamps.FINISHED,type:"regular"}),n.push({label:"("+e.subtask+") "+e.host,times:r})}),t=d3.timeline().stack().tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("single").labelFormat(function(e){return e}).margin({left:100,right:0,top:0,bottom:0}).itemHeight(30).relativeTime(),r=d3.select(a).datum(n).call(t)})(e.data)}}}]).directive("timeline",["$state",function(e){return{template:"",scope:{vertices:"=",jobid:"="},link:function(t,r,n){var o,a,i,s;i=r.children()[0],a=r.width(),angular.element(i).attr("width",a),s=function(e){return e.replace(">",">")},o=function(r){var n,o,a;return d3.select(i).selectAll("*").remove(),a=[],angular.forEach(r,function(e){if(e["start-time"]>-1)return"scheduled"===e.type?a.push({times:[{label:s(e.name),color:"#cccccc",borderColor:"#555555",starting_time:e["start-time"],ending_time:e["end-time"],type:e.type}]}):a.push({times:[{label:s(e.name),color:"#d9f1f7",borderColor:"#62cdea",starting_time:e["start-time"],ending_time:e["end-time"],link:e.id,type:e.type}]})}),n=d3.timeline().stack().click(function(r,n,o){if(r.link)return e.go("single-job.timeline.vertex",{jobid:t.jobid,vertexId:r.link})}).tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("main").margin({left:0,right:0,top:0,bottom:0}).itemHeight(30).showBorderLine().showHourTimeline(),o=d3.select(i).datum(a).call(n)},t.$watch(n.vertices,function(e){if(e)return o(e)})}}}]).directive("split",function(){return{compile:function(e,t){return Split(e.children(),{sizes:[50,50],direction:"vertical"})}}}).directive("jobPlan",["$timeout",function(e){return{template:"
",scope:{plan:"=",watermarks:"=",setNode:"&"},link:function(e,t,r){var n,o,a,i,s,l,u,c,d,f,p,m,g,b,h,v,k,j,S,w,C,$,J,M,y;p=null,C=d3.behavior.zoom(),y=[],b=r.jobid,S=t.children()[0],j=t.children().children()[0],w=t.children()[1],l=d3.select(S),u=d3.select(j),c=d3.select(w),n=t.width(),angular.element(t.children()[0]).width(n),v=0,h=0,e.zoomIn=function(){var e,t,r;if(C.scale()<2.99)return e=C.translate(),t=e[0]*(C.scale()+.1/C.scale()),r=e[1]*(C.scale()+.1/C.scale()),C.scale(C.scale()+.1),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),h=C.translate()},e.zoomOut=function(){var e,t,r;if(C.scale()>.31)return C.scale(C.scale()-.1),e=C.translate(),t=e[0]*(C.scale()-.1/C.scale()),r=e[1]*(C.scale()-.1/C.scale()),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),h=C.translate()},a=function(e){var t;return t="",null==e.ship_strategy&&null==e.local_strategy||(t+="
",null!=e.ship_strategy&&(t+=e.ship_strategy),void 0!==e.temp_mode&&(t+=" ("+e.temp_mode+")"),void 0!==e.local_strategy&&(t+=",
"+e.local_strategy),t+="
"),t},g=function(e){return"partialSolution"===e||"nextPartialSolution"===e||"workset"===e||"nextWorkset"===e||"solutionSet"===e||"solutionDelta"===e},m=function(e,t){return"mirror"===t?"node-mirror":g(t)?"node-iteration":"node-normal"},i=function(e,t,r,n){var o,a;return o="
",o+="mirror"===t?"

Mirror of "+e.operator+"

":"

"+e.operator+"

",""===e.description?o+="":(a=e.description,a=M(a),o+="

"+a+"

"),null!=e.step_function?o+=f(e.id,r,n):(g(t)&&(o+="
"+t+" Node
"),""!==e.parallelism&&(o+="
Parallelism: "+e.parallelism+"
"),void 0!==e.lowWatermark&&(o+="
Low Watermark: "+e.lowWatermark+"
"),void 0!==e.operator&&e.operator_strategy&&(o+="
Operation: "+M(e.operator_strategy)+"
")),o+="
"},f=function(e,t,r){var n,o;return o="svg-"+e,n=""},M=function(e){var t;for("<"===e.charAt(0)&&(e=e.replace("<","<"),e=e.replace(">",">")),t="";e.length>30;)t=t+e.substring(0,30)+"
",e=e.substring(30,e.length);return t+=e},s=function(e,t,r,n,o,a){return null==n&&(n=!1),r.id===t.partial_solution?e.setNode(r.id,{label:i(r,"partialSolution",o,a),labelType:"html","class":m(r,"partialSolution")}):r.id===t.next_partial_solution?e.setNode(r.id,{label:i(r,"nextPartialSolution",o,a),labelType:"html","class":m(r,"nextPartialSolution")}):r.id===t.workset?e.setNode(r.id,{label:i(r,"workset",o,a),labelType:"html","class":m(r,"workset")}):r.id===t.next_workset?e.setNode(r.id,{label:i(r,"nextWorkset",o,a),labelType:"html","class":m(r,"nextWorkset")}):r.id===t.solution_set?e.setNode(r.id,{label:i(r,"solutionSet",o,a),labelType:"html","class":m(r,"solutionSet")}):r.id===t.solution_delta?e.setNode(r.id,{label:i(r,"solutionDelta",o,a),labelType:"html","class":m(r,"solutionDelta")}):e.setNode(r.id,{label:i(r,"",o,a),labelType:"html","class":m(r,"")})},o=function(e,t,r,n,o){return e.setEdge(o.id,r.id,{label:a(o),labelType:"html",arrowhead:"normal"})},k=function(e,t){var r,n,a,i,l,u,d,f,p,m,g,b,h,v;for(n=[],null!=t.nodes?v=t.nodes:(v=t.step_function,a=!0),i=0,u=v.length;i-1))return e["end-time"]=e["start-time"]+e.duration})},this.processVertices=function(e){return angular.forEach(e.vertices,function(e,t){return e.type="regular"}),e.vertices.unshift({name:"Scheduled","start-time":e.timestamps.CREATED,"end-time":e.timestamps.CREATED+1,type:"scheduled"})},this.listJobs=function(){var r;return r=o.defer(),e.get(t.jobServer+"joboverview").success(function(e){return function(t,n,o,a){return angular.forEach(t,function(t,r){switch(r){case"running":return c.running=e.setEndTimes(t);case"finished":return c.finished=e.setEndTimes(t);case"cancelled":return c.cancelled=e.setEndTimes(t);case"failed":return c.failed=e.setEndTimes(t)}}),r.resolve(c),d()}}(this)),r.promise},this.getJobs=function(e){return c[e]},this.getAllJobs=function(){return c},this.loadJob=function(r){return i=null,l.job=o.defer(),e.get(t.jobServer+"jobs/"+r).success(function(n){return function(o,a,s,u){return n.setEndTimes(o.vertices),n.processVertices(o),e.get(t.jobServer+"jobs/"+r+"/config").success(function(e){return o=angular.extend(o,e),i=o,l.job.resolve(i)})}}(this)),l.job.promise},this.getNode=function(e){var t,r;return r=function(e,t){var n,o,a,i;for(n=0,o=t.length;n
{{metric.id}}
',replace:!0,scope:{metric:"=",window:"=",removeMetric:"&",setMetricSize:"=",getValues:"&"},link:function(e,t,r){return e.btnClasses=["btn","btn-default","btn-xs"],e.value=null,e.data=[{values:e.getValues()}],e.options={x:function(e,t){return e.x},y:function(e,t){return e.y},xTickFormat:function(e){return d3.time.format("%H:%M:%S")(new Date(e))},yTickFormat:function(e){var t,r,n,o;for(r=!1,n=0,o=1,t=Math.abs(e);!r&&n<50;)Math.pow(10,n)<=t&&t6?e/Math.pow(10,n)+"E"+n:""+e}},e.showChart=function(){return d3.select(t.find("svg")[0]).datum(e.data).transition().duration(250).call(e.chart)},e.chart=nv.models.lineChart().options(e.options).showLegend(!1).margin({top:15,left:60,bottom:30,right:30}),e.chart.yAxis.showMaxMin(!1),e.chart.tooltip.hideDelay(0),e.chart.tooltip.contentGenerator(function(e){return"

"+d3.time.format("%H:%M:%S")(new Date(e.point.x))+" | "+e.point.y+"

"}),nv.utils.windowResize(e.chart.update),e.setSize=function(t){return e.setMetricSize(e.metric,t)},e.showChart(),e.$on("metrics:data:update",function(t,r,n){return e.value=parseFloat(n[e.metric.id]),e.data[0].values.push({x:r,y:e.value}),e.data[0].values.length>e.window&&e.data[0].values.shift(),e.showChart(),e.chart.clearHighlights(),e.chart.tooltip.hidden(!0)}),t.find(".metric-title").qtip({content:{text:e.metric.id},position:{my:"bottom left",at:"top left"},style:{classes:"qtip-light qtip-timeline-bar"}})}}}),angular.module("flinkApp").service("MetricsService",["$http","$q","flinkConfig","$interval",function(e,t,r,n){return this.metrics={},this.values={},this.watched={},this.observer={jobid:null,nodeid:null,callback:null},this.refresh=n(function(e){return function(){return angular.forEach(e.metrics,function(t,r){return angular.forEach(t,function(t,n){var o;if(o=[],angular.forEach(t,function(e,t){return o.push(e.id)}),o.length>0)return e.getMetrics(r,n,o).then(function(t){if(r===e.observer.jobid&&n===e.observer.nodeid&&e.observer.callback)return e.observer.callback(t)})})})}}(this),r["refresh-interval"]),this.registerObserver=function(e,t,r){return this.observer.jobid=e,this.observer.nodeid=t,this.observer.callback=r},this.unRegisterObserver=function(){return this.observer={jobid:null,nodeid:null,callback:null}},this.setupMetrics=function(e,t){return this.setupLS(),this.watched[e]=[],angular.forEach(t,function(t){return function(r,n){if(r.id)return t.watched[e].push(r.id)}}(this))},this.getWindow=function(){return 100},this.setupLS=function(){return null==sessionStorage.flinkMetrics&&this.saveSetup(),this.metrics=JSON.parse(sessionStorage.flinkMetrics)},this.saveSetup=function(){return sessionStorage.flinkMetrics=JSON.stringify(this.metrics)},this.saveValue=function(e,t,r){if(null==this.values[e]&&(this.values[e]={}),null==this.values[e][t]&&(this.values[e][t]=[]),this.values[e][t].push(r),this.values[e][t].length>this.getWindow())return this.values[e][t].shift()},this.getValues=function(e,t,r){var n;return null==this.values[e]?[]:null==this.values[e][t]?[]:(n=[],angular.forEach(this.values[e][t],function(e){return function(e,t){if(null!=e.values[r])return n.push({x:e.timestamp,y:e.values[r]})}}(this)),n)},this.setupLSFor=function(e,t){if(null==this.metrics[e]&&(this.metrics[e]={}),null==this.metrics[e][t])return this.metrics[e][t]=[]},this.addMetric=function(e,t,r){return this.setupLSFor(e,t),this.metrics[e][t].push({id:r,size:"small"}),this.saveSetup()},this.removeMetric=function(e){return function(t,r,n){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n})),o!==-1&&e.metrics[t][r].splice(o,1),e.saveSetup()}}(this),this.setMetricSize=function(e){return function(t,r,n,o){var a;if(null!=e.metrics[t][r])return a=e.metrics[t][r].indexOf(n.id),a===-1&&(a=_.findIndex(e.metrics[t][r],{id:n.id})),a!==-1&&(e.metrics[t][r][a]={id:n.id,size:o}),e.saveSetup()}}(this),this.orderMetrics=function(e,t,r,n){return this.setupLSFor(e,t),angular.forEach(this.metrics[e][t],function(o){return function(a,i){if(a.id===r.id&&(o.metrics[e][t].splice(i,1),i",link:function(t,r,n){return t.getLabelClass=function(){return"label label-"+e.translateLabelState(n.status)}}}}]).directive("bpLabel",["JobsService",function(e){return{transclude:!0,replace:!0,scope:{getBackPressureLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getBackPressureLabelClass=function(){return"label label-"+e.translateBackPressureLabelState(n.status)}}}}]).directive("indicatorPrimary",["JobsService",function(e){return{replace:!0,scope:{getLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getLabelClass=function(){return"fa fa-circle indicator indicator-"+e.translateLabelState(n.status)}}}}]).directive("tableProperty",function(){return{replace:!0,scope:{value:"="},template:"{{value || 'None'}}"}}),angular.module("flinkApp").filter("amDurationFormatExtended",["angularMomentConfig",function(e){var t;return t=function(e,t,r){return"undefined"==typeof e||null===e?"":moment.duration(e,t).format(r,{trim:!1})},t.$stateful=e.statefulFilters,t}]).filter("humanizeDuration",function(){return function(e,t){var r,n,i,o,a,s;return"undefined"==typeof e||null===e?"":(o=e%1e3,s=Math.floor(e/1e3),a=s%60,s=Math.floor(s/60),i=s%60,s=Math.floor(s/60),n=s%24,s=Math.floor(s/24),r=s,0===r?0===n?0===i?0===a?o+"ms":a+"s ":i+"m "+a+"s":t?n+"h "+i+"m":n+"h "+i+"m "+a+"s":t?r+"d "+n+"h":r+"d "+n+"h "+i+"m "+a+"s")}}).filter("limit",function(){return function(e){return e.length>73&&(e=e.substring(0,35)+"..."+e.substring(e.length-35,e.length)),e}}).filter("humanizeText",function(){return function(e){return e?e.replace(/>/g,">").replace(//g,""):""}}).filter("humanizeBytes",function(){return function(e){var t,r;return r=["B","KB","MB","GB","TB","PB","EB"],t=function(e,n){var i;return i=Math.pow(1024,n),e=r;n=0<=r?++e:--e)i.push(n+".currentLowWatermark");return i}(),i.getMetrics(o,t.id,a).then(function(e){var t,n,i,o,a,s,l;i=NaN,l={},o=e.values;for(t in o)s=o[t],a=t.replace(".currentLowWatermark",""),l[a]=s,(isNaN(i)||su.noWatermark?i:NaN,r.resolve({lowWatermark:n,watermarks:l})}),r.promise}}(this),r=l.defer(),a={},n=t.length,angular.forEach(t,function(e){return function(e,t){var i;return i=e.id,o(e).then(function(e){if(a[i]=e,t>=n-1)return r.resolve(a)})}}(this)),r.promise},e.hasWatermark=function(t){return e.watermarks[t]&&!isNaN(e.watermarks[t].lowWatermark)},e.$watch("plan",function(t){if(t)return c(t.nodes).then(function(t){return e.watermarks=t})}),e.$on("reload",function(){if(e.plan)return c(e.plan.nodes).then(function(t){return e.watermarks=t})})}]).controller("JobPlanController",["$scope","$state","$stateParams","$window","JobsService",function(e,t,r,n,i){return e.nodeid=null,e.nodeUnfolded=!1,e.stateList=i.stateList(),e.changeNode=function(t){return t!==e.nodeid?(e.nodeid=t,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null,e.$broadcast("reload"),e.$broadcast("node:change",e.nodeid)):(e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null)},e.deactivateNode=function(){return e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null},e.toggleFold=function(){return e.nodeUnfolded=!e.nodeUnfolded}}]).controller("JobPlanSubtasksController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getSubtasks(e.nodeid).then(function(t){return e.subtasks=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanTaskManagersController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getTaskManagers(e.nodeid).then(function(t){return e.taskmanagers=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanAccumulatorsController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getAccumulators(e.nodeid).then(function(t){return e.accumulators=t.main,e.subtaskAccumulators=t.subtasks})},!e.nodeid||e.vertex&&e.vertex.accumulators||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanCheckpointsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i;return e.checkpointDetails={},e.checkpointDetails.id=-1,n.getCheckpointConfig().then(function(t){return e.checkpointConfig=t}),i=function(){return n.getCheckpointStats().then(function(t){if(null!==t)return e.checkpointStats=t})},i(),e.$on("reload",function(e){return i()})}]).controller("JobPlanCheckpointDetailsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i,o;return e.subtaskDetails={},e.checkpointDetails.id=r.checkpointId,i=function(t){return n.getCheckpointDetails(t).then(function(t){return null!==t?e.checkpoint=t:e.unknown_checkpoint=!0})},o=function(t,r){return n.getCheckpointSubtaskDetails(t,r).then(function(t){if(null!==t)return e.subtaskDetails[r]=t})},i(r.checkpointId),e.nodeid&&o(r.checkpointId,e.nodeid),e.$on("reload",function(t){if(i(r.checkpointId),e.nodeid)return o(r.checkpointId,e.nodeid)}),e.$on("$destroy",function(){return e.checkpointDetails.id=-1})}]).controller("JobPlanBackPressureController",["$scope","JobsService",function(e,t){var r;return r=function(){if(e.now=Date.now(),e.nodeid)return t.getOperatorBackPressure(e.nodeid).then(function(t){return e.backPressureOperatorStats[e.nodeid]=t})},r(),e.$on("reload",function(e){return r()})}]).controller("JobTimelineVertexController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i;return i=function(){return n.getVertex(r.vertexId).then(function(t){return e.vertex=t})},i(),e.$on("reload",function(e){return i()})}]).controller("JobExceptionsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){return n.loadExceptions().then(function(t){return e.exceptions=t})}]).controller("JobPropertiesController",["$scope","JobsService",function(e,t){return e.changeNode=function(r){return r!==e.nodeid?(e.nodeid=r,t.getNode(r).then(function(t){return e.node=t})):(e.nodeid=null,e.node=null)}}]).controller("JobPlanMetricsController",["$scope","JobsService","MetricsService",function(e,t,r){var n;if(e.dragging=!1,e.window=r.getWindow(),e.availableMetrics=null,e.$on("$destroy",function(){return r.unRegisterObserver()}),n=function(){return t.getVertex(e.nodeid).then(function(t){return e.vertex=t}),r.getAvailableMetrics(e.jobid,e.nodeid).then(function(t){return e.availableMetrics=t,e.metrics=r.getMetricsSetup(e.jobid,e.nodeid).names,r.registerObserver(e.jobid,e.nodeid,function(t){return e.$broadcast("metrics:data:update",t.timestamp,t.values)})})},e.dropped=function(t,i,o,a,s){return r.orderMetrics(e.jobid,e.nodeid,o,i),e.$broadcast("metrics:refresh",o),n(),!1},e.dragStart=function(){return e.dragging=!0},e.dragEnd=function(){return e.dragging=!1},e.addMetric=function(t){return r.addMetric(e.jobid,e.nodeid,t.id),n()},e.removeMetric=function(t){return r.removeMetric(e.jobid,e.nodeid,t),n()},e.setMetricSize=function(t,i){return r.setMetricSize(e.jobid,e.nodeid,t,i),n()},e.setMetricView=function(t,i){return r.setMetricView(e.jobid,e.nodeid,t,i),n()},e.getValues=function(t){return r.getValues(e.jobid,e.nodeid,t)},e.$on("node:change",function(t,r){if(!e.dragging)return n()}),e.nodeid)return n()}]),angular.module("flinkApp").directive("vertex",["$state",function(e){return{template:"",scope:{data:"="},link:function(e,t,r){var n,i,o;o=t.children()[0],i=t.width(),angular.element(o).attr("width",i),(n=function(e){var t,r,n;return d3.select(o).selectAll("*").remove(),n=[],angular.forEach(e.subtasks,function(e,t){var r;return r=[{label:"Scheduled",color:"#666",borderColor:"#555",starting_time:e.timestamps.SCHEDULED,ending_time:e.timestamps.DEPLOYING,type:"regular"},{label:"Deploying",color:"#aaa",borderColor:"#555",starting_time:e.timestamps.DEPLOYING,ending_time:e.timestamps.RUNNING,type:"regular"}],e.timestamps.FINISHED>0&&r.push({label:"Running",color:"#ddd",borderColor:"#555",starting_time:e.timestamps.RUNNING,ending_time:e.timestamps.FINISHED,type:"regular"}),n.push({label:"("+e.subtask+") "+e.host,times:r})}),t=d3.timeline().stack().tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("single").labelFormat(function(e){return e}).margin({left:100,right:0,top:0,bottom:0}).itemHeight(30).relativeTime(),r=d3.select(o).datum(n).call(t)})(e.data)}}}]).directive("timeline",["$state",function(e){return{template:"",scope:{vertices:"=",jobid:"="},link:function(t,r,n){var i,o,a,s;a=r.children()[0],o=r.width(),angular.element(a).attr("width",o),s=function(e){return e.replace(">",">")},i=function(r){var n,i,o;return d3.select(a).selectAll("*").remove(),o=[],angular.forEach(r,function(e){if(e["start-time"]>-1)return"scheduled"===e.type?o.push({times:[{label:s(e.name),color:"#cccccc",borderColor:"#555555",starting_time:e["start-time"],ending_time:e["end-time"],type:e.type}]}):o.push({times:[{label:s(e.name),color:"#d9f1f7",borderColor:"#62cdea",starting_time:e["start-time"],ending_time:e["end-time"],link:e.id,type:e.type}]})}),n=d3.timeline().stack().click(function(r,n,i){if(r.link)return e.go("single-job.timeline.vertex",{jobid:t.jobid,vertexId:r.link})}).tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("main").margin({left:0,right:0,top:0,bottom:0}).itemHeight(30).showBorderLine().showHourTimeline(),i=d3.select(a).datum(o).call(n)},t.$watch(n.vertices,function(e){if(e)return i(e)})}}}]).directive("split",function(){return{compile:function(e,t){return Split(e.children(),{sizes:[50,50],direction:"vertical"})}}}).directive("jobPlan",["$timeout",function(e){return{template:"
",scope:{plan:"=",watermarks:"=",setNode:"&"},link:function(e,t,r){var n,i,o,a,s,l,u,c,d,f,p,m,g,h,b,v,k,j,S,w,C,$,J,M,y;p=null,C=d3.behavior.zoom(),y=[],h=r.jobid,S=t.children()[0],j=t.children().children()[0],w=t.children()[1],l=d3.select(S),u=d3.select(j),c=d3.select(w),n=t.width(),angular.element(t.children()[0]).width(n),v=0,b=0,e.zoomIn=function(){var e,t,r;if(C.scale()<2.99)return e=C.translate(),t=e[0]*(C.scale()+.1/C.scale()),r=e[1]*(C.scale()+.1/C.scale()),C.scale(C.scale()+.1),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},e.zoomOut=function(){var e,t,r;if(C.scale()>.31)return C.scale(C.scale()-.1),e=C.translate(),t=e[0]*(C.scale()-.1/C.scale()),r=e[1]*(C.scale()-.1/C.scale()),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},o=function(e){var t;return t="",null==e.ship_strategy&&null==e.local_strategy||(t+="
",null!=e.ship_strategy&&(t+=e.ship_strategy),void 0!==e.temp_mode&&(t+=" ("+e.temp_mode+")"),void 0!==e.local_strategy&&(t+=",
"+e.local_strategy),t+="
"),t},g=function(e){return"partialSolution"===e||"nextPartialSolution"===e||"workset"===e||"nextWorkset"===e||"solutionSet"===e||"solutionDelta"===e},m=function(e,t){return"mirror"===t?"node-mirror":g(t)?"node-iteration":"node-normal"},a=function(e,t,r,n){var i,o;return i="
",i+="mirror"===t?"

Mirror of "+e.operator+"

":"

"+e.operator+"

",""===e.description?i+="":(o=e.description,o=M(o),i+="

"+o+"

"),null!=e.step_function?i+=f(e.id,r,n):(g(t)&&(i+="
"+t+" Node
"),""!==e.parallelism&&(i+="
Parallelism: "+e.parallelism+"
"),void 0!==e.lowWatermark&&(i+="
Low Watermark: "+e.lowWatermark+"
"),void 0!==e.operator&&e.operator_strategy&&(i+="
Operation: "+M(e.operator_strategy)+"
")),i+="
"},f=function(e,t,r){var n,i;return i="svg-"+e,n=""},M=function(e){var t;for("<"===e.charAt(0)&&(e=e.replace("<","<"),e=e.replace(">",">")),t="";e.length>30;)t=t+e.substring(0,30)+"
",e=e.substring(30,e.length);return t+=e},s=function(e,t,r,n,i,o){return null==n&&(n=!1),r.id===t.partial_solution?e.setNode(r.id,{label:a(r,"partialSolution",i,o),labelType:"html","class":m(r,"partialSolution")}):r.id===t.next_partial_solution?e.setNode(r.id,{label:a(r,"nextPartialSolution",i,o),labelType:"html","class":m(r,"nextPartialSolution")}):r.id===t.workset?e.setNode(r.id,{label:a(r,"workset",i,o),labelType:"html","class":m(r,"workset")}):r.id===t.next_workset?e.setNode(r.id,{label:a(r,"nextWorkset",i,o),labelType:"html","class":m(r,"nextWorkset")}):r.id===t.solution_set?e.setNode(r.id,{label:a(r,"solutionSet",i,o),labelType:"html","class":m(r,"solutionSet")}):r.id===t.solution_delta?e.setNode(r.id,{label:a(r,"solutionDelta",i,o),labelType:"html","class":m(r,"solutionDelta")}):e.setNode(r.id,{label:a(r,"",i,o),labelType:"html","class":m(r,"")})},i=function(e,t,r,n,i){return e.setEdge(i.id,r.id,{label:o(i),labelType:"html",arrowhead:"normal"})},k=function(e,t){var r,n,o,a,l,u,d,f,p,m,g,h,b,v;for(n=[],null!=t.nodes?v=t.nodes:(v=t.step_function,o=!0),a=0,u=v.length;a-1))return e["end-time"]=e["start-time"]+e.duration})},this.processVertices=function(e){return angular.forEach(e.vertices,function(e,t){return e.type="regular"}),e.vertices.unshift({name:"Scheduled","start-time":e.timestamps.CREATED,"end-time":e.timestamps.CREATED+1,type:"scheduled"})},this.listJobs=function(){var r;return r=i.defer(),e.get(t.jobServer+"joboverview").success(function(e){return function(t,n,i,o){return angular.forEach(t,function(t,r){switch(r){case"running":return c.running=e.setEndTimes(t);case"finished":return c.finished=e.setEndTimes(t);case"cancelled":return c.cancelled=e.setEndTimes(t);case"failed":return c.failed=e.setEndTimes(t)}}),r.resolve(c),d()}}(this)),r.promise},this.getJobs=function(e){return c[e]},this.getAllJobs=function(){return c},this.loadJob=function(r){return a=null,l.job=i.defer(),e.get(t.jobServer+"jobs/"+r).success(function(n){return function(i,o,s,u){return n.setEndTimes(i.vertices),n.processVertices(i),e.get(t.jobServer+"jobs/"+r+"/config").success(function(e){return i=angular.extend(i,e),a=i,l.job.resolve(a)})}}(this)),l.job.promise},this.getNode=function(e){var t,r;return r=function(e,t){var n,i,o,a;for(n=0,i=t.length;n
{{metric.id}}
{{value | humanizeChartNumeric:metric}}
',replace:!0,scope:{metric:"=",window:"=",removeMetric:"&",setMetricSize:"=",setMetricView:"=",getValues:"&"},link:function(e,t,r){return e.btnClasses=["btn","btn-default","btn-xs"],e.value=null,e.data=[{values:e.getValues()}],e.options={x:function(e,t){return e.x},y:function(e,t){return e.y},xTickFormat:function(e){return d3.time.format("%H:%M:%S")(new Date(e))},yTickFormat:function(e){var t,r,n,i;for(r=!1,n=0,i=1,t=Math.abs(e);!r&&n<50;)Math.pow(10,n)<=t&&t6?e/Math.pow(10,n)+"E"+n:""+e}},e.showChart=function(){return d3.select(t.find("svg")[0]).datum(e.data).transition().duration(250).call(e.chart)},e.chart=nv.models.lineChart().options(e.options).showLegend(!1).margin({top:15,left:60,bottom:30,right:30}),e.chart.yAxis.showMaxMin(!1),e.chart.tooltip.hideDelay(0),e.chart.tooltip.contentGenerator(function(e){return"

"+d3.time.format("%H:%M:%S")(new Date(e.point.x))+" | "+e.point.y+"

"}),nv.utils.windowResize(e.chart.update),e.setSize=function(t){return e.setMetricSize(e.metric,t)},e.setView=function(t){if(e.setMetricView(e.metric,t),"chart"===t)return e.showChart()},"chart"===e.metric.view&&e.showChart(),e.$on("metrics:data:update",function(t,r,n){return e.value=parseFloat(n[e.metric.id]),e.data[0].values.push({x:r,y:e.value}),e.data[0].values.length>e.window&&e.data[0].values.shift(),"chart"===e.metric.view&&e.showChart(),"chart"===e.metric.view&&e.chart.clearHighlights(),e.chart.tooltip.hidden(!0)}),t.find(".metric-title").qtip({content:{text:e.metric.id},position:{my:"bottom left",at:"top left"},style:{classes:"qtip-light qtip-timeline-bar"}})}}}),angular.module("flinkApp").service("MetricsService",["$http","$q","flinkConfig","$interval",function(e,t,r,n){return this.metrics={},this.values={},this.watched={},this.observer={jobid:null,nodeid:null,callback:null},this.refresh=n(function(e){return function(){return angular.forEach(e.metrics,function(t,r){return angular.forEach(t,function(t,n){var i;if(i=[],angular.forEach(t,function(e,t){return i.push(e.id)}),i.length>0)return e.getMetrics(r,n,i).then(function(t){if(r===e.observer.jobid&&n===e.observer.nodeid&&e.observer.callback)return e.observer.callback(t)})})})}}(this),r["refresh-interval"]),this.registerObserver=function(e,t,r){return this.observer.jobid=e,this.observer.nodeid=t,this.observer.callback=r},this.unRegisterObserver=function(){return this.observer={jobid:null,nodeid:null,callback:null}},this.setupMetrics=function(e,t){return this.setupLS(),this.watched[e]=[],angular.forEach(t,function(t){return function(r,n){if(r.id)return t.watched[e].push(r.id)}}(this))},this.getWindow=function(){return 100},this.setupLS=function(){return null==sessionStorage.flinkMetrics&&this.saveSetup(),this.metrics=JSON.parse(sessionStorage.flinkMetrics)},this.saveSetup=function(){return sessionStorage.flinkMetrics=JSON.stringify(this.metrics)},this.saveValue=function(e,t,r){if(null==this.values[e]&&(this.values[e]={}),null==this.values[e][t]&&(this.values[e][t]=[]),this.values[e][t].push(r),this.values[e][t].length>this.getWindow())return this.values[e][t].shift()},this.getValues=function(e,t,r){var n;return null==this.values[e]?[]:null==this.values[e][t]?[]:(n=[],angular.forEach(this.values[e][t],function(e){return function(e,t){if(null!=e.values[r])return n.push({x:e.timestamp,y:e.values[r]})}}(this)),n)},this.setupLSFor=function(e,t){if(null==this.metrics[e]&&(this.metrics[e]={}),null==this.metrics[e][t])return this.metrics[e][t]=[]},this.addMetric=function(e,t,r){return this.setupLSFor(e,t),this.metrics[e][t].push({id:r,size:"small",view:"chart"}),this.saveSetup()},this.removeMetric=function(e){return function(t,r,n){var i;if(null!=e.metrics[t][r])return i=e.metrics[t][r].indexOf(n),i===-1&&(i=_.findIndex(e.metrics[t][r],{id:n})),i!==-1&&e.metrics[t][r].splice(i,1),e.saveSetup()}}(this),this.setMetricSize=function(e){return function(t,r,n,i){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n.id),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n.id})),o!==-1&&(e.metrics[t][r][o]={id:n.id,size:i,view:n.view}),e.saveSetup()}}(this),this.setMetricView=function(e){return function(t,r,n,i){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n.id),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n.id})),o!==-1&&(e.metrics[t][r][o]={id:n.id,size:n.size,view:i}),e.saveSetup()}}(this),this.orderMetrics=function(e,t,r,n){return this.setupLSFor(e,t),angular.forEach(this.metrics[e][t],function(i){return function(o,a){if(o.id===r.id&&(i.metrics[e][t].splice(a,1),a$.top&&($.top=b.height(),Z=t.utils.availableHeight(M,G,$)-O),ot.select(".nv-legendWrap").attr("transform","translate("+lt+","+-$.top+")")}else ot.select(".nv-legendWrap").selectAll("*").remove();rt.attr("transform","translate("+$.left+","+$.top+")"),ot.select(".nv-context").style("display",T?"initial":"none"),d.width(X).height(Q).color(w.map(function(t,e){return t.color||E(t,e)}).filter(function(t,e){return!w[e].disabled&&w[e].bar})),c.width(X).height(Q).color(w.map(function(t,e){return t.color||E(t,e)}).filter(function(t,e){return!w[e].disabled&&!w[e].bar}));var ct=ot.select(".nv-context .nv-barsWrap").datum(J.length?J:[{values:[]}]),ft=ot.select(".nv-context .nv-linesWrap").datum(Y(tt)?[{values:[]}]:tt.filter(function(t){return!t.disabled}));ot.select(".nv-context").attr("transform","translate(0,"+(Z+$.bottom+k.top)+")"),ct.transition().call(d),ft.transition().call(c),D&&(p._ticks(t.utils.calcTicksX(X/100,w)).tickSize(-Q,0),ot.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")"),ot.select(".nv-context .nv-x.nv-axis").transition().call(p)),N&&(m.scale(s)._ticks(Q/36).tickSize(-X,0),y.scale(u)._ticks(Q/36).tickSize(J.length?0:-X,0),ot.select(".nv-context .nv-y3.nv-axis").style("opacity",J.length?1:0).attr("transform","translate(0,"+i.range()[0]+")"),ot.select(".nv-context .nv-y2.nv-axis").style("opacity",tt.length?1:0).attr("transform","translate("+i.range()[1]+",0)"),ot.select(".nv-context .nv-y1.nv-axis").transition().call(m),ot.select(".nv-context .nv-y2.nv-axis").transition().call(y)),x.x(i).on("brush",V),j&&x.extent(j);var dt=ot.select(".nv-brushBackground").selectAll("g").data([j||x.extent()]),ht=dt.enter().append("g");ht.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",Q),ht.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",Q);var pt=ot.select(".nv-x.nv-brush").call(x);pt.selectAll("rect").attr("height",Q),pt.selectAll(".resize").append("path").attr("d",I),b.dispatch.on("stateChange",function(t){for(var n in t)F[n]=t[n];L.stateChange(F),e.update()}),L.on("changeState",function(t){"undefined"!=typeof t.disabled&&(w.forEach(function(e,n){e.disabled=t.disabled[n]}),F.disabled=t.disabled),e.update()}),V()}),e}var n,r,i,o,a,s,u,l=t.models.line(),c=t.models.line(),f=t.models.historicalBar(),d=t.models.historicalBar(),h=t.models.axis(),p=t.models.axis(),g=t.models.axis(),v=t.models.axis(),m=t.models.axis(),y=t.models.axis(),b=t.models.legend(),x=d3.svg.brush(),w=t.models.tooltip(),$={top:30,right:30,bottom:30,left:60},k={top:0,right:30,bottom:20,left:60},_=null,M=null,C=function(t){return t.x},S=function(t){return t.y},E=t.utils.defaultColor(),A=!0,T=!0,N=!1,D=!0,O=50,j=null,I=null,L=d3.dispatch("brush","stateChange","changeState"),P=0,F=t.utils.state(),q=null,z=" (left axis)",W=" (right axis)",R=!1;l.clipEdge(!0),c.interactive(!1),c.pointActive(function(t){return!1}),h.orient("bottom").tickPadding(5),g.orient("left"),v.orient("right"),p.orient("bottom").tickPadding(5),m.orient("left"),y.orient("right"),w.headerEnabled(!0).headerFormatter(function(t,e){return h.tickFormat()(t,e)});var B=function(){return R?{main:v,focus:y}:{main:g,focus:m}},V=function(){return R?{main:g,focus:m}:{main:v,focus:y}},H=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},U=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}},Y=function(t){return t.every(function(t){return t.disabled})};return l.dispatch.on("elementMouseover.tooltip",function(t){w.duration(100).valueFormatter(function(t,e){return V().main.tickFormat()(t,e)}).data(t).hidden(!1)}),l.dispatch.on("elementMouseout.tooltip",function(t){w.hidden(!0)}),f.dispatch.on("elementMouseover.tooltip",function(t){t.value=e.x()(t.data),t.series={value:e.y()(t.data),color:t.color},w.duration(0).valueFormatter(function(t,e){return B().main.tickFormat()(t,e)}).data(t).hidden(!1)}),f.dispatch.on("elementMouseout.tooltip",function(t){w.hidden(!0)}),f.dispatch.on("elementMousemove.tooltip",function(t){w()}),e.dispatch=L,e.legend=b,e.lines=l,e.lines2=c,e.bars=f,e.bars2=d,e.xAxis=h,e.x2Axis=p,e.y1Axis=g,e.y2Axis=v,e.y3Axis=m,e.y4Axis=y,e.tooltip=w,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return _},set:function(t){_=t}},height:{get:function(){return M},set:function(t){M=t}},showLegend:{get:function(){return A},set:function(t){A=t}},brushExtent:{get:function(){return j},set:function(t){j=t}},noData:{get:function(){return I},set:function(t){I=t}},focusEnable:{get:function(){return T},set:function(t){T=t}},focusHeight:{get:function(){return O},set:function(t){O=t}},focusShowAxisX:{get:function(){return D},set:function(t){D=t}},focusShowAxisY:{get:function(){return N},set:function(t){N=t}},legendLeftAxisHint:{get:function(){return z},set:function(t){z=t}},legendRightAxisHint:{get:function(){return W},set:function(t){W=t}},margin:{get:function(){return $},set:function(t){$.top=void 0!==t.top?t.top:$.top,$.right=void 0!==t.right?t.right:$.right,$.bottom=void 0!==t.bottom?t.bottom:$.bottom,$.left=void 0!==t.left?t.left:$.left}},focusMargin:{get:function(){return k},set:function(t){k.top=void 0!==t.top?t.top:k.top,k.right=void 0!==t.right?t.right:k.right,k.bottom=void 0!==t.bottom?t.bottom:k.bottom,k.left=void 0!==t.left?t.left:k.left}},duration:{get:function(){return P},set:function(t){P=t}},color:{get:function(){return E},set:function(e){E=t.utils.getColor(e),b.color(E)}},x:{get:function(){return C},set:function(t){C=t,l.x(t),c.x(t),f.x(t),d.x(t)}},y:{get:function(){return S},set:function(t){S=t,l.y(t),c.y(t),f.y(t),d.y(t)}},switchYAxisOrder:{get:function(){return R},set:function(t){if(R!==t){var e=g;g=v,v=e;var n=m;m=y,y=n}R=t,g.orient("left"),v.orient("right"),m.orient("left"),y.orient("right")}}}),t.utils.inheritOptions(e,l),t.utils.initOptions(e),e},t.models.multiBar=function(){"use strict";function e(N){return A.reset(),N.each(function(e){var N=c-l.left-l.right,D=f-l.top-l.bottom;g=d3.select(this),t.utils.initSVG(g);var O=0;if(k&&e.length&&(k=[{values:e[0].values.map(function(t){return{x:t.x,y:0,series:t.series,size:.01}})}]),x){var j=d3.layout.stack().offset(w).values(function(t){return t.values}).y(m)(!e.length&&k?k:e);j.forEach(function(t,n){t.nonStackable?(e[n].nonStackableSeries=O++,j[n]=e[n]):n>0&&j[n-1].nonStackable&&j[n].values.map(function(t,e){t.y0-=j[n-1].values[e].y,t.y1=t.y0+t.y})}),e=j}e.forEach(function(t,e){t.values.forEach(function(n){n.series=e,n.key=t.key})}),x&&e.length>0&&e[0].values.map(function(t,n){var r=0,i=0;e.map(function(t,o){if(!e[o].nonStackable){var a=t.values[n];a.size=Math.abs(a.y),a.y<0?(a.y1=i,i-=a.size):(a.y1=a.size+r,r+=a.size)}})});var I=r&&i?[]:e.map(function(t,e){return t.values.map(function(t,n){return{x:v(t,n),y:m(t,n),y0:t.y0,y1:t.y1,idx:e}})});d.domain(r||d3.merge(I).map(function(t){return t.x})).rangeBands(o||[0,N],C),h.domain(i||d3.extent(d3.merge(I).map(function(t){var n=t.y;return x&&!e[t.idx].nonStackable&&(n=t.y>0?t.y1:t.y1+t.y),n}).concat(y))).range(a||[D,0]),d.domain()[0]===d.domain()[1]&&(d.domain()[0]?d.domain([d.domain()[0]-.01*d.domain()[0],d.domain()[1]+.01*d.domain()[1]]):d.domain([-1,1])),h.domain()[0]===h.domain()[1]&&(h.domain()[0]?h.domain([h.domain()[0]+.01*h.domain()[0],h.domain()[1]-.01*h.domain()[1]]):h.domain([-1,1])),s=s||d,u=u||h;var L=g.selectAll("g.nv-wrap.nv-multibar").data([e]),P=L.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),F=P.append("defs"),q=P.append("g"),z=L.select("g");q.append("g").attr("class","nv-groups"),L.attr("transform","translate("+l.left+","+l.top+")"),F.append("clipPath").attr("id","nv-edge-clip-"+p).append("rect"),L.select("#nv-edge-clip-"+p+" rect").attr("width",N).attr("height",D),z.attr("clip-path",b?"url(#nv-edge-clip-"+p+")":"");var W=L.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t,e){return e});W.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);var R=A.transition(W.exit().selectAll("rect.nv-bar"),"multibarExit",Math.min(100,M)).attr("y",function(t,n,r){var i=u(0)||0;return x&&e[t.series]&&!e[t.series].nonStackable&&(i=u(t.y0)),i}).attr("height",0).remove();R.delay&&R.delay(function(t,e){var n=e*(M/(T+1))-e;return n}),W.attr("class",function(t,e){return"nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}).style("fill",function(t,e){return $(t,e)}).style("stroke",function(t,e){return $(t,e)}),W.style("stroke-opacity",1).style("fill-opacity",S);var B=W.selectAll("rect.nv-bar").data(function(t){return k&&!e.length?k.values:t.values});B.exit().remove();B.enter().append("rect").attr("class",function(t,e){return m(t,e)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,n,r){return x&&!e[r].nonStackable?0:r*d.rangeBand()/e.length}).attr("y",function(t,n,r){return u(x&&!e[r].nonStackable?t.y0:0)||0}).attr("height",0).attr("width",function(t,n,r){return d.rangeBand()/(x&&!e[r].nonStackable?1:e.length)}).attr("transform",function(t,e){return"translate("+d(v(t,e))+",0)"});B.style("fill",function(t,e,n){return $(t,n,e)}).style("stroke",function(t,e,n){return $(t,n,e)}).on("mouseover",function(t,e){d3.select(this).classed("hover",!0),E.elementMouseover({data:t,index:e,color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1),E.elementMouseout({data:t,index:e,color:d3.select(this).style("fill")})}).on("mousemove",function(t,e){E.elementMousemove({data:t,index:e,color:d3.select(this).style("fill")})}).on("click",function(t,e){var n=this;E.elementClick({data:t,index:e,color:d3.select(this).style("fill"),event:d3.event,element:n}),d3.event.stopPropagation()}).on("dblclick",function(t,e){E.elementDblClick({data:t,index:e,color:d3.select(this).style("fill")}),d3.event.stopPropagation()}),B.attr("class",function(t,e){return m(t,e)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(t,e){return"translate("+d(v(t,e))+",0)"}),_&&(n||(n=e.map(function(){return!0})),B.style("fill",function(t,e,r){return d3.rgb(_(t,e)).darker(n.map(function(t,e){return e}).filter(function(t,e){return!n[e]})[r]).toString()}).style("stroke",function(t,e,r){return d3.rgb(_(t,e)).darker(n.map(function(t,e){return e}).filter(function(t,e){return!n[e]})[r]).toString()}));var V=B.watchTransition(A,"multibar",Math.min(250,M)).delay(function(t,n){return n*M/e[0].values.length});x?V.attr("y",function(t,n,r){var i=0;return i=e[r].nonStackable?m(t,n)<0?h(0):h(0)-h(m(t,n))<-1?h(0)-1:h(m(t,n))||0:h(t.y1)}).attr("height",function(t,n,r){return e[r].nonStackable?Math.max(Math.abs(h(m(t,n))-h(0)),0)||0:Math.max(Math.abs(h(t.y+t.y0)-h(t.y0)),0)}).attr("x",function(t,n,r){var i=0;return e[r].nonStackable&&(i=t.series*d.rangeBand()/e.length,e.length!==O&&(i=e[r].nonStackableSeries*d.rangeBand()/(2*O))),i}).attr("width",function(t,n,r){if(e[r].nonStackable){var i=d.rangeBand()/O;return e.length!==O&&(i=d.rangeBand()/(2*O)),i}return d.rangeBand()}):V.attr("x",function(t,n){return t.series*d.rangeBand()/e.length}).attr("width",d.rangeBand()/e.length).attr("y",function(t,e){return m(t,e)<0?h(0):h(0)-h(m(t,e))<1?h(0)-1:h(m(t,e))||0}).attr("height",function(t,e){return Math.max(Math.abs(h(m(t,e))-h(0)),1)||0}),s=d.copy(),u=h.copy(),e[0]&&e[0].values&&(T=e[0].values.length)}),A.renderEnd("multibar immediate"),e}var n,r,i,o,a,s,u,l={top:0,right:0,bottom:0,left:0},c=960,f=500,d=d3.scale.ordinal(),h=d3.scale.linear(),p=Math.floor(1e4*Math.random()),g=null,v=function(t){return t.x},m=function(t){return t.y},y=[0],b=!0,x=!1,w="zero",$=t.utils.defaultColor(),k=!1,_=null,M=500,C=.1,S=.75,E=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),A=t.utils.renderWatch(E,M),T=0;return e.dispatch=E,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return c},set:function(t){c=t}},height:{get:function(){return f},set:function(t){f=t}},x:{get:function(){return v},set:function(t){v=t}},y:{get:function(){return m},set:function(t){m=t}},xScale:{get:function(){return d},set:function(t){d=t}},yScale:{get:function(){return h},set:function(t){h=t}},xDomain:{get:function(){return r},set:function(t){r=t}},yDomain:{get:function(){return i},set:function(t){i=t}},xRange:{get:function(){return o},set:function(t){o=t}},yRange:{get:function(){return a},set:function(t){a=t}},forceY:{get:function(){return y},set:function(t){y=t}},stacked:{get:function(){return x},set:function(t){x=t}},stackOffset:{get:function(){return w},set:function(t){w=t}},clipEdge:{get:function(){return b},set:function(t){b=t}},disabled:{get:function(){return n},set:function(t){n=t}},id:{get:function(){return p},set:function(t){p=t}},hideable:{get:function(){return k},set:function(t){k=t}},groupSpacing:{get:function(){return C},set:function(t){C=t}},fillOpacity:{get:function(){return S},set:function(t){S=t}},margin:{get:function(){return l},set:function(t){l.top=void 0!==t.top?t.top:l.top,l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},duration:{get:function(){return M},set:function(t){M=t,A.reset(M)}},color:{get:function(){return $},set:function(e){$=t.utils.getColor(e)}},barColor:{get:function(){return _},set:function(e){_=e?t.utils.getColor(e):null}}}),t.utils.initOptions(e),e},t.models.multiBarChart=function(){"use strict";function e(S){return D.reset(),D.models(i),y&&D.models(o),b&&D.models(a),S.each(function(S){var D=d3.select(this);t.utils.initSVG(D);var L=t.utils.availableWidth(d,D,f),P=t.utils.availableHeight(h,D,f);if(e.update=function(){0===T?D.call(e):D.transition().duration(T).call(e)},e.container=this,M.setter(I(S),e.update).getter(j(S)).update(),M.disabled=S.map(function(t){return!!t.disabled}),!C){var F;C={};for(F in M)M[F]instanceof Array?C[F]=M[F].slice(0):C[F]=M[F]}if(!(S&&S.length&&S.filter(function(t){return t.values.length}).length))return t.utils.noData(e,D),e;D.selectAll(".nv-noData").remove(),n=i.xScale(),r=i.yScale();var q=D.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([S]),z=q.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),W=q.select("g");if(z.append("g").attr("class","nv-x nv-axis"),z.append("g").attr("class","nv-y nv-axis"),z.append("g").attr("class","nv-barsWrap"),z.append("g").attr("class","nv-legendWrap"),z.append("g").attr("class","nv-controlsWrap"),z.append("g").attr("class","nv-interactive"),m?(u.width(L-A()),W.select(".nv-legendWrap").datum(S).call(u),u.height()>f.top&&(f.top=u.height(),P=t.utils.availableHeight(h,D,f)),W.select(".nv-legendWrap").attr("transform","translate("+A()+","+-f.top+")")):W.select(".nv-legendWrap").selectAll("*").remove(),g){var R=[{key:v.grouped||"Grouped",disabled:i.stacked()},{key:v.stacked||"Stacked",disabled:!i.stacked()}];l.width(A()).color(["#444","#444","#444"]),W.select(".nv-controlsWrap").datum(R).attr("transform","translate(0,"+-f.top+")").call(l)}else W.select(".nv-controlsWrap").selectAll("*").remove();q.attr("transform","translate("+f.left+","+f.top+")"),x&&W.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)"),i.disabled(S.map(function(t){return t.disabled})).width(L).height(P).color(S.map(function(t,e){return t.color||p(t,e)}).filter(function(t,e){return!S[e].disabled}));var B=W.select(".nv-barsWrap").datum(S.filter(function(t){return!t.disabled}));if(B.call(i),y){o.scale(n)._ticks(t.utils.calcTicksX(L/100,S)).tickSize(-P,0),W.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),W.select(".nv-x.nv-axis").call(o);var V=W.select(".nv-x.nv-axis > g").selectAll("g");if(V.selectAll("line, text").style("opacity",1),$){var H=function(t,e){return"translate("+t+","+e+")"},U=5,Y=17;V.selectAll("text").attr("transform",function(t,e,n){return H(0,n%2==0?U:Y)});var G=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;W.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(t,e){return H(0,0===e||G%2!==0?Y:U)})}k&&W.selectAll(".tick text").call(t.utils.wrapTicks,e.xAxis.rangeBand()),w&&V.filter(function(t,e){return e%Math.ceil(S[0].values.length/(L/100))!==0}).selectAll("text, line").style("opacity",0),_&&V.selectAll(".tick text").attr("transform","rotate("+_+" 0,0)").style("text-anchor",_>0?"start":"end"),W.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}b&&(a.scale(r)._ticks(t.utils.calcTicksY(P/36,S)).tickSize(-L,0),W.select(".nv-y.nv-axis").call(a)),N&&(s.width(L).height(P).margin({left:f.left,top:f.top}).svgContainer(D).xScale(n),q.select(".nv-interactive").call(s)),u.dispatch.on("stateChange",function(t){for(var n in t)M[n]=t[n];E.stateChange(M),e.update()}),l.dispatch.on("legendClick",function(t,n){if(t.disabled){switch(R=R.map(function(t){return t.disabled=!0,t}),t.disabled=!1,t.key){case"Grouped":case v.grouped:i.stacked(!1);break;case"Stacked":case v.stacked:i.stacked(!0)}M.stacked=i.stacked(),E.stateChange(M),e.update()}}),E.on("changeState",function(t){"undefined"!=typeof t.disabled&&(S.forEach(function(e,n){e.disabled=t.disabled[n]}),M.disabled=t.disabled),"undefined"!=typeof t.stacked&&(i.stacked(t.stacked),M.stacked=t.stacked,O=t.stacked),e.update()}),N?(s.dispatch.on("elementMousemove",function(t){if(void 0!=t.pointXValue){var r,i,o,a,u=[];S.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(s,l){i=n.domain().indexOf(t.pointXValue);var c=s.values[i];void 0!==c&&(a=c.x,void 0===r&&(r=c),void 0===o&&(o=t.mouseX),u.push({key:s.key,value:e.y()(c,i),color:p(s,s.seriesIndex),data:s.values[i]}))}),s.tooltip.data({value:a,index:i,series:u})(),s.renderGuideLine(o)}}),s.dispatch.on("elementMouseout",function(t){s.tooltip.hidden(!0)})):(i.dispatch.on("elementMouseover.tooltip",function(t){t.value=e.x()(t.data),t.series={key:t.data.key,value:e.y()(t.data),color:t.color},c.data(t).hidden(!1)}),i.dispatch.on("elementMouseout.tooltip",function(t){c.hidden(!0)}),i.dispatch.on("elementMousemove.tooltip",function(t){c()}))}),D.renderEnd("multibarchart immediate"),e}var n,r,i=t.models.multiBar(),o=t.models.axis(),a=t.models.axis(),s=t.interactiveGuideline(),u=t.models.legend(),l=t.models.legend(),c=t.models.tooltip(),f={top:30,right:20,bottom:50,left:60},d=null,h=null,p=t.utils.defaultColor(),g=!0,v={},m=!0,y=!0,b=!0,x=!1,w=!0,$=!1,k=!1,_=0,M=t.utils.state(),C=null,S=null,E=d3.dispatch("stateChange","changeState","renderEnd"),A=function(){return g?180:0},T=250,N=!1;M.stacked=!1,i.stacked(!1),o.orient("bottom").tickPadding(7).showMaxMin(!1).tickFormat(function(t){return t}),a.orient(x?"right":"left").tickFormat(d3.format(",.1f")),c.duration(0).valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return o.tickFormat()(t,e)}),l.updateState(!1);var D=t.utils.renderWatch(E),O=!1,j=function(t){return function(){return{active:t.map(function(t){return!t.disabled}),stacked:O}}},I=function(t){return function(e){void 0!==e.stacked&&(O=e.stacked),void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};return e.dispatch=E,e.multibar=i,e.legend=u,e.controls=l,e.xAxis=o,e.yAxis=a,e.state=M,e.tooltip=c,e.interactiveLayer=s,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return d},set:function(t){d=t}},height:{get:function(){return h},set:function(t){h=t}},showLegend:{get:function(){return m},set:function(t){m=t}},showControls:{get:function(){return g},set:function(t){g=t}},controlLabels:{get:function(){return v},set:function(t){v=t}},showXAxis:{get:function(){return y},set:function(t){y=t}},showYAxis:{get:function(){return b},set:function(t){b=t}},defaultState:{get:function(){return C},set:function(t){C=t}},noData:{get:function(){return S},set:function(t){S=t}},reduceXTicks:{get:function(){return w},set:function(t){w=t}},rotateLabels:{get:function(){return _},set:function(t){_=t}},staggerLabels:{get:function(){return $},set:function(t){$=t}},wrapLabels:{get:function(){return k},set:function(t){k=!!t}},margin:{get:function(){return f},set:function(t){f.top=void 0!==t.top?t.top:f.top,f.right=void 0!==t.right?t.right:f.right,f.bottom=void 0!==t.bottom?t.bottom:f.bottom,f.left=void 0!==t.left?t.left:f.left}},duration:{get:function(){return T},set:function(t){T=t,i.duration(T),o.duration(T),a.duration(T),D.reset(T)}},color:{get:function(){return p},set:function(e){p=t.utils.getColor(e),u.color(p)}},rightAlignYAxis:{get:function(){return x},set:function(t){x=t,a.orient(x?"right":"left")}},useInteractiveGuideline:{get:function(){return N},set:function(t){N=t}},barColor:{get:function(){return i.barColor},set:function(t){i.barColor(t),u.color(function(t,e){return d3.rgb("#ccc").darker(1.5*e).toString()})}}}),t.utils.inheritOptions(e,i),t.utils.initOptions(e),e},t.models.multiBarHorizontal=function(){"use strict";function e(d){return N.reset(),d.each(function(e){var d=c-l.left-l.right,A=f-l.top-l.bottom;h=d3.select(this),t.utils.initSVG(h),$&&(e=d3.layout.stack().offset("zero").values(function(t){return t.values}).y(m)(e)),e.forEach(function(t,e){t.values.forEach(function(n){n.series=e,n.key=t.key})}),$&&e[0].values.map(function(t,n){var r=0,i=0;e.map(function(t){var e=t.values[n];e.size=Math.abs(e.y),e.y<0?(e.y1=i-e.size,i-=e.size):(e.y1=r,r+=e.size)})});var D=r&&i?[]:e.map(function(t){return t.values.map(function(t,e){return{x:v(t,e),y:m(t,e),y0:t.y0,y1:t.y1}})});p.domain(r||d3.merge(D).map(function(t){return t.x})).rangeBands(o||[0,A],C),g.domain(i||d3.extent(d3.merge(D).map(function(t){return $?t.y>0?t.y1+t.y:t.y1:t.y}).concat(b))),k&&!$?g.range(a||[g.domain()[0]<0?M:0,d-(g.domain()[1]>0?M:0)]):g.range(a||[0,d]),s=s||p,u=u||d3.scale.linear().domain(g.domain()).range([g(0),g(0)]);var O=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([e]),j=O.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),I=(j.append("defs"),j.append("g"));O.select("g");I.append("g").attr("class","nv-groups"),O.attr("transform","translate("+l.left+","+l.top+")");var L=O.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t,e){return e});L.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),L.exit().watchTransition(N,"multibarhorizontal: exit groups").style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),L.attr("class",function(t,e){return"nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}).style("fill",function(t,e){return x(t,e)}).style("stroke",function(t,e){return x(t,e)}),L.watchTransition(N,"multibarhorizontal: groups").style("stroke-opacity",1).style("fill-opacity",S);var P=L.selectAll("g.nv-bar").data(function(t){return t.values});P.exit().remove();var F=P.enter().append("g").attr("transform",function(t,n,r){return"translate("+u($?t.y0:0)+","+($?0:r*p.rangeBand()/e.length+p(v(t,n)))+")"});F.append("rect").attr("width",0).attr("height",p.rangeBand()/($?1:e.length)),P.on("mouseover",function(t,e){d3.select(this).classed("hover",!0),T.elementMouseover({data:t,index:e,color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1),T.elementMouseout({data:t,index:e,color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){T.elementMouseout({data:t,index:e,color:d3.select(this).style("fill")})}).on("mousemove",function(t,e){T.elementMousemove({data:t,index:e,color:d3.select(this).style("fill")})}).on("click",function(t,e){var n=this;T.elementClick({data:t,index:e,color:d3.select(this).style("fill"),event:d3.event,element:n}),d3.event.stopPropagation()}).on("dblclick",function(t,e){T.elementDblClick({data:t,index:e,color:d3.select(this).style("fill")}),d3.event.stopPropagation()}),y(e[0],0)&&(F.append("polyline"),P.select("polyline").attr("fill","none").attr("points",function(t,n){var r=y(t,n),i=.8*p.rangeBand()/(2*($?1:e.length));r=r.length?r:[-Math.abs(r),Math.abs(r)],r=r.map(function(t){return g(t)-g(0)});var o=[[r[0],-i],[r[0],i],[r[0],0],[r[1],0],[r[1],-i],[r[1],i]];return o.map(function(t){return t.join(",")}).join(" ")}).attr("transform",function(t,n){var r=p.rangeBand()/(2*($?1:e.length));return"translate("+(m(t,n)<0?0:g(m(t,n))-g(0))+", "+r+")"})),F.append("text"),k&&!$?(P.select("text").attr("text-anchor",function(t,e){return m(t,e)<0?"end":"start"}).attr("y",p.rangeBand()/(2*e.length)).attr("dy",".32em").text(function(t,e){var n=E(m(t,e)),r=y(t,e);return void 0===r?n:r.length?n+"+"+E(Math.abs(r[1]))+"-"+E(Math.abs(r[0])):n+"±"+E(Math.abs(r))}),P.watchTransition(N,"multibarhorizontal: bars").select("text").attr("x",function(t,e){return m(t,e)<0?-4:g(m(t,e))-g(0)+4})):P.selectAll("text").text(""),_&&!$?(F.append("text").classed("nv-bar-label",!0),P.select("text.nv-bar-label").attr("text-anchor",function(t,e){return m(t,e)<0?"start":"end"}).attr("y",p.rangeBand()/(2*e.length)).attr("dy",".32em").text(function(t,e){return v(t,e)}),P.watchTransition(N,"multibarhorizontal: bars").select("text.nv-bar-label").attr("x",function(t,e){return m(t,e)<0?g(0)-g(m(t,e))+4:-4})):P.selectAll("text.nv-bar-label").text(""),P.attr("class",function(t,e){return m(t,e)<0?"nv-bar negative":"nv-bar positive"}),w&&(n||(n=e.map(function(){return!0})),P.style("fill",function(t,e,r){return d3.rgb(w(t,e)).darker(n.map(function(t,e){return e}).filter(function(t,e){return!n[e]})[r]).toString()}).style("stroke",function(t,e,r){return d3.rgb(w(t,e)).darker(n.map(function(t,e){return e}).filter(function(t,e){return!n[e]})[r]).toString()})),$?P.watchTransition(N,"multibarhorizontal: bars").attr("transform",function(t,e){return"translate("+g(t.y1)+","+p(v(t,e))+")"}).select("rect").attr("width",function(t,e){return Math.abs(g(m(t,e)+t.y0)-g(t.y0))||0}).attr("height",p.rangeBand()):P.watchTransition(N,"multibarhorizontal: bars").attr("transform",function(t,n){return"translate("+g(m(t,n)<0?m(t,n):0)+","+(t.series*p.rangeBand()/e.length+p(v(t,n)))+")"}).select("rect").attr("height",p.rangeBand()/e.length).attr("width",function(t,e){return Math.max(Math.abs(g(m(t,e))-g(0)),1)||0}),s=p.copy(),u=g.copy()}),N.renderEnd("multibarHorizontal immediate"),e}var n,r,i,o,a,s,u,l={top:0,right:0,bottom:0,left:0},c=960,f=500,d=Math.floor(1e4*Math.random()),h=null,p=d3.scale.ordinal(),g=d3.scale.linear(),v=function(t){return t.x},m=function(t){return t.y},y=function(t){return t.yErr},b=[0],x=t.utils.defaultColor(),w=null,$=!1,k=!1,_=!1,M=60,C=.1,S=.75,E=d3.format(",.2f"),A=250,T=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),N=t.utils.renderWatch(T,A);return e.dispatch=T,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return c},set:function(t){c=t}},height:{get:function(){return f},set:function(t){f=t}},x:{get:function(){return v},set:function(t){v=t}},y:{get:function(){return m},set:function(t){m=t}},yErr:{get:function(){return y},set:function(t){y=t}},xScale:{get:function(){return p},set:function(t){p=t}},yScale:{get:function(){return g},set:function(t){g=t}},xDomain:{get:function(){return r},set:function(t){r=t}},yDomain:{get:function(){return i},set:function(t){i=t}},xRange:{get:function(){return o},set:function(t){o=t}},yRange:{get:function(){return a},set:function(t){a=t}},forceY:{get:function(){return b},set:function(t){b=t}},stacked:{get:function(){return $},set:function(t){$=t}},showValues:{get:function(){return k},set:function(t){k=t}},disabled:{get:function(){return n},set:function(t){n=t}},id:{get:function(){return d},set:function(t){d=t}},valueFormat:{get:function(){return E},set:function(t){E=t}},valuePadding:{get:function(){return M},set:function(t){M=t}},groupSpacing:{get:function(){return C},set:function(t){C=t}},fillOpacity:{get:function(){return S},set:function(t){S=t}},margin:{get:function(){return l},set:function(t){l.top=void 0!==t.top?t.top:l.top,l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},duration:{get:function(){return A},set:function(t){A=t,N.reset(A)}},color:{get:function(){return x},set:function(e){x=t.utils.getColor(e)}},barColor:{get:function(){return w},set:function(e){w=e?t.utils.getColor(e):null}}}),t.utils.initOptions(e),e},t.models.multiBarHorizontalChart=function(){"use strict";function e(l){return E.reset(),E.models(i),m&&E.models(o),y&&E.models(a),l.each(function(l){var $=d3.select(this);t.utils.initSVG($);var E=t.utils.availableWidth(f,$,c),A=t.utils.availableHeight(d,$,c);if(e.update=function(){$.transition().duration(M).call(e)},e.container=this,b=i.stacked(),x.setter(S(l),e.update).getter(C(l)).update(),x.disabled=l.map(function(t){return!!t.disabled}),!w){var T;w={};for(T in x)x[T]instanceof Array?w[T]=x[T].slice(0):w[T]=x[T]}if(!(l&&l.length&&l.filter(function(t){return t.values.length}).length))return t.utils.noData(e,$),e;$.selectAll(".nv-noData").remove(),n=i.xScale(),r=i.yScale().clamp(!0);var N=$.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([l]),D=N.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),O=N.select("g");if(D.append("g").attr("class","nv-x nv-axis"),D.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"), D.append("g").attr("class","nv-barsWrap"),D.append("g").attr("class","nv-legendWrap"),D.append("g").attr("class","nv-controlsWrap"),v?(s.width(E-_()),O.select(".nv-legendWrap").datum(l).call(s),s.height()>c.top&&(c.top=s.height(),A=t.utils.availableHeight(d,$,c)),O.select(".nv-legendWrap").attr("transform","translate("+_()+","+-c.top+")")):O.select(".nv-legendWrap").selectAll("*").remove(),p){var j=[{key:g.grouped||"Grouped",disabled:i.stacked()},{key:g.stacked||"Stacked",disabled:!i.stacked()}];u.width(_()).color(["#444","#444","#444"]),O.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+-c.top+")").call(u)}else O.select(".nv-controlsWrap").selectAll("*").remove();N.attr("transform","translate("+c.left+","+c.top+")"),i.disabled(l.map(function(t){return t.disabled})).width(E).height(A).color(l.map(function(t,e){return t.color||h(t,e)}).filter(function(t,e){return!l[e].disabled}));var I=O.select(".nv-barsWrap").datum(l.filter(function(t){return!t.disabled}));if(I.transition().call(i),m){o.scale(n)._ticks(t.utils.calcTicksY(A/24,l)).tickSize(-E,0),O.select(".nv-x.nv-axis").call(o);var L=O.select(".nv-x.nv-axis").selectAll("g");L.selectAll("line, text")}y&&(a.scale(r)._ticks(t.utils.calcTicksX(E/100,l)).tickSize(-A,0),O.select(".nv-y.nv-axis").attr("transform","translate(0,"+A+")"),O.select(".nv-y.nv-axis").call(a)),O.select(".nv-zeroLine line").attr("x1",r(0)).attr("x2",r(0)).attr("y1",0).attr("y2",-A),s.dispatch.on("stateChange",function(t){for(var n in t)x[n]=t[n];k.stateChange(x),e.update()}),u.dispatch.on("legendClick",function(t,n){if(t.disabled){switch(j=j.map(function(t){return t.disabled=!0,t}),t.disabled=!1,t.key){case"Grouped":case g.grouped:i.stacked(!1);break;case"Stacked":case g.stacked:i.stacked(!0)}x.stacked=i.stacked(),k.stateChange(x),b=i.stacked(),e.update()}}),k.on("changeState",function(t){"undefined"!=typeof t.disabled&&(l.forEach(function(e,n){e.disabled=t.disabled[n]}),x.disabled=t.disabled),"undefined"!=typeof t.stacked&&(i.stacked(t.stacked),x.stacked=t.stacked,b=t.stacked),e.update()})}),E.renderEnd("multibar horizontal chart immediate"),e}var n,r,i=t.models.multiBarHorizontal(),o=t.models.axis(),a=t.models.axis(),s=t.models.legend().height(30),u=t.models.legend().height(30),l=t.models.tooltip(),c={top:30,right:20,bottom:50,left:60},f=null,d=null,h=t.utils.defaultColor(),p=!0,g={},v=!0,m=!0,y=!0,b=!1,x=t.utils.state(),w=null,$=null,k=d3.dispatch("stateChange","changeState","renderEnd"),_=function(){return p?180:0},M=250;x.stacked=!1,i.stacked(b),o.orient("left").tickPadding(5).showMaxMin(!1).tickFormat(function(t){return t}),a.orient("bottom").tickFormat(d3.format(",.1f")),l.duration(0).valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return o.tickFormat()(t,e)}),u.updateState(!1);var C=function(t){return function(){return{active:t.map(function(t){return!t.disabled}),stacked:b}}},S=function(t){return function(e){void 0!==e.stacked&&(b=e.stacked),void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}},E=t.utils.renderWatch(k,M);return i.dispatch.on("elementMouseover.tooltip",function(t){t.value=e.x()(t.data),t.series={key:t.data.key,value:e.y()(t.data),color:t.color},l.data(t).hidden(!1)}),i.dispatch.on("elementMouseout.tooltip",function(t){l.hidden(!0)}),i.dispatch.on("elementMousemove.tooltip",function(t){l()}),e.dispatch=k,e.multibar=i,e.legend=s,e.controls=u,e.xAxis=o,e.yAxis=a,e.state=x,e.tooltip=l,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return d},set:function(t){d=t}},showLegend:{get:function(){return v},set:function(t){v=t}},showControls:{get:function(){return p},set:function(t){p=t}},controlLabels:{get:function(){return g},set:function(t){g=t}},showXAxis:{get:function(){return m},set:function(t){m=t}},showYAxis:{get:function(){return y},set:function(t){y=t}},defaultState:{get:function(){return w},set:function(t){w=t}},noData:{get:function(){return $},set:function(t){$=t}},margin:{get:function(){return c},set:function(t){c.top=void 0!==t.top?t.top:c.top,c.right=void 0!==t.right?t.right:c.right,c.bottom=void 0!==t.bottom?t.bottom:c.bottom,c.left=void 0!==t.left?t.left:c.left}},duration:{get:function(){return M},set:function(t){M=t,E.reset(M),i.duration(M),o.duration(M),a.duration(M)}},color:{get:function(){return h},set:function(e){h=t.utils.getColor(e),s.color(h)}},barColor:{get:function(){return i.barColor},set:function(t){i.barColor(t),s.color(function(t,e){return d3.rgb("#ccc").darker(1.5*e).toString()})}}}),t.utils.inheritOptions(e,i),t.utils.initOptions(e),e},t.models.multiChart=function(){"use strict";function e(l){return l.each(function(l){function h(t){var e=2===l[t.seriesIndex].yAxis?T:A;t.value=t.point.x,t.series={value:t.point.y,color:t.point.color,key:t.series.key},D.duration(0).headerFormatter(function(t,e){return E.tickFormat()(t,e)}).valueFormatter(function(t,n){return e.tickFormat()(t,n)}).data(t).hidden(!1)}function O(t){var e=2===l[t.seriesIndex].yAxis?T:A;t.value=t.point.x,t.series={value:t.point.y,color:t.point.color,key:t.series.key},D.duration(100).headerFormatter(function(t,e){return E.tickFormat()(t,e)}).valueFormatter(function(t,n){return e.tickFormat()(t,n)}).data(t).hidden(!1)}function I(t){var e=2===l[t.seriesIndex].yAxis?T:A;t.point.x=C.x()(t.point),t.point.y=C.y()(t.point),D.duration(0).headerFormatter(function(t,e){return E.tickFormat()(t,e)}).valueFormatter(function(t,n){return e.tickFormat()(t,n)}).data(t).hidden(!1)}function L(t){var e=2===l[t.data.series].yAxis?T:A;t.value=_.x()(t.data),t.series={value:_.y()(t.data),color:t.color,key:t.data.key},D.duration(0).headerFormatter(function(t,e){return E.tickFormat()(t,e)}).valueFormatter(function(t,n){return e.tickFormat()(t,n)}).data(t).hidden(!1)}function P(){for(var t=0,e=j.length;ti.top&&(i.top=N.height(),W=t.utils.availableHeight(s,q,i)),tt.select(".legendWrap").attr("transform","translate("+rt+","+-i.top+")")}else tt.select(".legendWrap").selectAll("*").remove();x.width(z).height(W).interpolate(d).color(et.filter(function(t,e){return!l[e].disabled&&1==l[e].yAxis&&"line"==l[e].type})),w.width(z).height(W).interpolate(d).color(et.filter(function(t,e){return!l[e].disabled&&2==l[e].yAxis&&"line"==l[e].type})),$.width(z).height(W).color(et.filter(function(t,e){return!l[e].disabled&&1==l[e].yAxis&&"scatter"==l[e].type})),k.width(z).height(W).color(et.filter(function(t,e){return!l[e].disabled&&2==l[e].yAxis&&"scatter"==l[e].type})),_.width(z).height(W).color(et.filter(function(t,e){return!l[e].disabled&&1==l[e].yAxis&&"bar"==l[e].type})),M.width(z).height(W).color(et.filter(function(t,e){return!l[e].disabled&&2==l[e].yAxis&&"bar"==l[e].type})),C.width(z).height(W).interpolate(d).color(et.filter(function(t,e){return!l[e].disabled&&1==l[e].yAxis&&"area"==l[e].type})),S.width(z).height(W).interpolate(d).color(et.filter(function(t,e){return!l[e].disabled&&2==l[e].yAxis&&"area"==l[e].type})),tt.attr("transform","translate("+i.left+","+i.top+")");var it=tt.select(".lines1Wrap").datum(R.filter(function(t){return!t.disabled})),ot=tt.select(".scatters1Wrap").datum(V.filter(function(t){return!t.disabled})),at=tt.select(".bars1Wrap").datum(U.filter(function(t){return!t.disabled})),st=tt.select(".stack1Wrap").datum(G.filter(function(t){return!t.disabled})),ut=tt.select(".lines2Wrap").datum(B.filter(function(t){return!t.disabled})),lt=tt.select(".scatters2Wrap").datum(H.filter(function(t){return!t.disabled})),ct=tt.select(".bars2Wrap").datum(Y.filter(function(t){return!t.disabled})),ft=tt.select(".stack2Wrap").datum(X.filter(function(t){return!t.disabled})),dt=G.length?G.map(function(t){return t.values}).reduce(function(t,e){return t.map(function(t,n){return{x:t.x,y:t.y+e[n].y}})}).concat([{x:0,y:0}]):[],ht=X.length?X.map(function(t){return t.values}).reduce(function(t,e){return t.map(function(t,n){return{x:t.x,y:t.y+e[n].y}})}).concat([{x:0,y:0}]):[];y.domain(n||d3.extent(d3.merge(Z).concat(dt),function(t){return t.y})).range([0,W]),b.domain(r||d3.extent(d3.merge(Q).concat(ht),function(t){return t.y})).range([0,W]),x.yDomain(y.domain()),$.yDomain(y.domain()),_.yDomain(y.domain()),C.yDomain(y.domain()),w.yDomain(b.domain()),k.yDomain(b.domain()),M.yDomain(b.domain()),S.yDomain(b.domain()),G.length&&d3.transition(st).call(C),X.length&&d3.transition(ft).call(S),U.length&&d3.transition(at).call(_),Y.length&&d3.transition(ct).call(M),R.length&&d3.transition(it).call(x),B.length&&d3.transition(ut).call(w),V.length&&d3.transition(ot).call($),H.length&&d3.transition(lt).call(k),E._ticks(t.utils.calcTicksX(z/100,l)).tickSize(-W,0),tt.select(".nv-x.nv-axis").attr("transform","translate(0,"+W+")"),d3.transition(tt.select(".nv-x.nv-axis")).call(E),A._ticks(t.utils.calcTicksY(W/36,l)).tickSize(-z,0),d3.transition(tt.select(".nv-y1.nv-axis")).call(A),T._ticks(t.utils.calcTicksY(W/36,l)).tickSize(-z,0),d3.transition(tt.select(".nv-y2.nv-axis")).call(T),tt.select(".nv-y1.nv-axis").classed("nv-disabled",!Z.length).attr("transform","translate("+m.range()[0]+",0)"),tt.select(".nv-y2.nv-axis").classed("nv-disabled",!Q.length).attr("transform","translate("+m.range()[1]+",0)"),N.dispatch.on("stateChange",function(t){e.update()}),g&&(p.width(z).height(W).margin({left:i.left,top:i.top}).svgContainer(q).xScale(m),K.select(".nv-interactive").call(p)),g?(p.dispatch.on("elementMousemove",function(n){P();var r,i,a,s=[];l.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(u,l){var c=m.domain(),f=u.values.filter(function(t,n){return e.x()(t,n)>=c[0]&&e.x()(t,n)<=c[1]});i=t.interactiveBisect(f,n.pointXValue,e.x());var d=f[i],h=e.y()(d,i);null!==h&&F(l,i,!0),void 0!==d&&(void 0===r&&(r=d),void 0===a&&(a=m(e.x()(d,i))),s.push({key:u.key,value:h,color:o(u,u.seriesIndex),data:d,yAxis:2==u.yAxis?T:A}))});var u=function(t,e){var n=s[e].yAxis;return null==t?"N/A":n.tickFormat()(t)};p.tooltip.headerFormatter(function(t,e){return E.tickFormat()(t,e)}).valueFormatter(p.tooltip.valueFormatter()||u).data({value:e.x()(r,i),index:i,series:s})(),p.renderGuideLine(a)}),p.dispatch.on("elementMouseout",function(t){P()})):(x.dispatch.on("elementMouseover.tooltip",h),w.dispatch.on("elementMouseover.tooltip",h),x.dispatch.on("elementMouseout.tooltip",function(t){D.hidden(!0)}),w.dispatch.on("elementMouseout.tooltip",function(t){D.hidden(!0)}),$.dispatch.on("elementMouseover.tooltip",O),k.dispatch.on("elementMouseover.tooltip",O),$.dispatch.on("elementMouseout.tooltip",function(t){D.hidden(!0)}),k.dispatch.on("elementMouseout.tooltip",function(t){D.hidden(!0)}),C.dispatch.on("elementMouseover.tooltip",I),S.dispatch.on("elementMouseover.tooltip",I),C.dispatch.on("elementMouseout.tooltip",function(t){D.hidden(!0)}),S.dispatch.on("elementMouseout.tooltip",function(t){D.hidden(!0)}),_.dispatch.on("elementMouseover.tooltip",L),M.dispatch.on("elementMouseover.tooltip",L),_.dispatch.on("elementMouseout.tooltip",function(t){D.hidden(!0)}),M.dispatch.on("elementMouseout.tooltip",function(t){D.hidden(!0)}),_.dispatch.on("elementMousemove.tooltip",function(t){D()}),M.dispatch.on("elementMousemove.tooltip",function(t){D()}))}),e}var n,r,i={top:30,right:20,bottom:50,left:60},o=t.utils.defaultColor(),a=null,s=null,u=!0,l=null,c=function(t){return t.x},f=function(t){return t.y},d="linear",h=!0,p=t.interactiveGuideline(),g=!1,v=" (right axis)",m=d3.scale.linear(),y=d3.scale.linear(),b=d3.scale.linear(),x=t.models.line().yScale(y),w=t.models.line().yScale(b),$=t.models.scatter().yScale(y),k=t.models.scatter().yScale(b),_=t.models.multiBar().stacked(!1).yScale(y),M=t.models.multiBar().stacked(!1).yScale(b),C=t.models.stackedArea().yScale(y),S=t.models.stackedArea().yScale(b),E=t.models.axis().scale(m).orient("bottom").tickPadding(5),A=t.models.axis().scale(y).orient("left"),T=t.models.axis().scale(b).orient("right"),N=t.models.legend().height(30),D=t.models.tooltip(),O=d3.dispatch(),j=[x,w,$,k,_,M,C,S];return e.dispatch=O,e.legend=N,e.lines1=x,e.lines2=w,e.scatters1=$,e.scatters2=k,e.bars1=_,e.bars2=M,e.stack1=C,e.stack2=S,e.xAxis=E,e.yAxis1=A,e.yAxis2=T,e.tooltip=D,e.interactiveLayer=p,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return a},set:function(t){a=t}},height:{get:function(){return s},set:function(t){s=t}},showLegend:{get:function(){return u},set:function(t){u=t}},yDomain1:{get:function(){return n},set:function(t){n=t}},yDomain2:{get:function(){return r},set:function(t){r=t}},noData:{get:function(){return l},set:function(t){l=t}},interpolate:{get:function(){return d},set:function(t){d=t}},legendRightAxisHint:{get:function(){return v},set:function(t){v=t}},margin:{get:function(){return i},set:function(t){i.top=void 0!==t.top?t.top:i.top,i.right=void 0!==t.right?t.right:i.right,i.bottom=void 0!==t.bottom?t.bottom:i.bottom,i.left=void 0!==t.left?t.left:i.left}},color:{get:function(){return o},set:function(e){o=t.utils.getColor(e)}},x:{get:function(){return c},set:function(t){c=t,x.x(t),w.x(t),$.x(t),k.x(t),_.x(t),M.x(t),C.x(t),S.x(t)}},y:{get:function(){return f},set:function(t){f=t,x.y(t),w.y(t),$.y(t),k.y(t),C.y(t),S.y(t),_.y(t),M.y(t)}},useVoronoi:{get:function(){return h},set:function(t){h=t,x.useVoronoi(t),w.useVoronoi(t),C.useVoronoi(t),S.useVoronoi(t)}},useInteractiveGuideline:{get:function(){return g},set:function(t){g=t,g&&(x.interactive(!1),x.useVoronoi(!1),w.interactive(!1),w.useVoronoi(!1),C.interactive(!1),C.useVoronoi(!1),S.interactive(!1),S.useVoronoi(!1),$.interactive(!1),k.interactive(!1))}}}),t.utils.initOptions(e),e},t.models.ohlcBar=function(){"use strict";function e(_){return _.each(function(e){c=d3.select(this);var _=t.utils.availableWidth(s,c,a),C=t.utils.availableHeight(u,c,a);t.utils.initSVG(c);var S=_/e[0].values.length*.9;f.domain(n||d3.extent(e[0].values.map(h).concat(b))),w?f.range(i||[.5*_/e[0].values.length,_*(e[0].values.length-.5)/e[0].values.length]):f.range(i||[5+S/2,_-S/2-5]),d.domain(r||[d3.min(e[0].values.map(y).concat(x)),d3.max(e[0].values.map(m).concat(x))]).range(o||[C,0]),f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]-.01*f.domain()[0],f.domain()[1]+.01*f.domain()[1]]):f.domain([-1,1])),d.domain()[0]===d.domain()[1]&&(d.domain()[0]?d.domain([d.domain()[0]+.01*d.domain()[0],d.domain()[1]-.01*d.domain()[1]]):d.domain([-1,1]));var E=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([e[0].values]),A=E.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),T=A.append("defs"),N=A.append("g"),D=E.select("g");N.append("g").attr("class","nv-ticks"),E.attr("transform","translate("+a.left+","+a.top+")"),c.on("click",function(t,e){M.chartClick({data:t,index:e,pos:d3.event,id:l})}),T.append("clipPath").attr("id","nv-chart-clip-path-"+l).append("rect"),E.select("#nv-chart-clip-path-"+l+" rect").attr("width",_).attr("height",C),D.attr("clip-path",$?"url(#nv-chart-clip-path-"+l+")":"");var O=E.select(".nv-ticks").selectAll(".nv-tick").data(function(t){return t});O.exit().remove(),O.enter().append("path").attr("class",function(t,e,n){return(g(t,e)>v(t,e)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+e}).attr("d",function(t,e){return"m0,0l0,"+(d(g(t,e))-d(m(t,e)))+"l"+-S/2+",0l"+S/2+",0l0,"+(d(y(t,e))-d(g(t,e)))+"l0,"+(d(v(t,e))-d(y(t,e)))+"l"+S/2+",0l"+-S/2+",0z"}).attr("transform",function(t,e){return"translate("+f(h(t,e))+","+d(m(t,e))+")"}).attr("fill",function(t,e){return k[0]}).attr("stroke",function(t,e){return k[0]}).attr("x",0).attr("y",function(t,e){return d(Math.max(0,p(t,e)))}).attr("height",function(t,e){return Math.abs(d(p(t,e))-d(0))}),O.attr("class",function(t,e,n){return(g(t,e)>v(t,e)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+e}),d3.transition(O).attr("transform",function(t,e){return"translate("+f(h(t,e))+","+d(m(t,e))+")"}).attr("d",function(t,n){var r=_/e[0].values.length*.9;return"m0,0l0,"+(d(g(t,n))-d(m(t,n)))+"l"+-r/2+",0l"+r/2+",0l0,"+(d(y(t,n))-d(g(t,n)))+"l0,"+(d(v(t,n))-d(y(t,n)))+"l"+r/2+",0l"+-r/2+",0z"})}),e}var n,r,i,o,a={top:0,right:0,bottom:0,left:0},s=null,u=null,l=Math.floor(1e4*Math.random()),c=null,f=d3.scale.linear(),d=d3.scale.linear(),h=function(t){return t.x},p=function(t){return t.y},g=function(t){return t.open},v=function(t){return t.close},m=function(t){return t.high},y=function(t){return t.low},b=[],x=[],w=!1,$=!0,k=t.utils.defaultColor(),_=!1,M=d3.dispatch("stateChange","changeState","renderEnd","chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove");return e.highlightPoint=function(t,n){e.clearHighlights(),c.select(".nv-ohlcBar .nv-tick-0-"+t).classed("hover",n)},e.clearHighlights=function(){c.select(".nv-ohlcBar .nv-tick.hover").classed("hover",!1)},e.dispatch=M,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return s},set:function(t){s=t}},height:{get:function(){return u},set:function(t){u=t}},xScale:{get:function(){return f},set:function(t){f=t}},yScale:{get:function(){return d},set:function(t){d=t}},xDomain:{get:function(){return n},set:function(t){n=t}},yDomain:{get:function(){return r},set:function(t){r=t}},xRange:{get:function(){return i},set:function(t){i=t}},yRange:{get:function(){return o},set:function(t){o=t}},forceX:{get:function(){return b},set:function(t){b=t}},forceY:{get:function(){return x},set:function(t){x=t}},padData:{get:function(){return w},set:function(t){w=t}},clipEdge:{get:function(){return $},set:function(t){$=t}},id:{get:function(){return l},set:function(t){l=t}},interactive:{get:function(){return _},set:function(t){_=t}},x:{get:function(){return h},set:function(t){h=t}},y:{get:function(){return p},set:function(t){p=t}},open:{get:function(){return g()},set:function(t){g=t}},close:{get:function(){return v()},set:function(t){v=t}},high:{get:function(){return m},set:function(t){m=t}},low:{get:function(){return y},set:function(t){y=t}},margin:{get:function(){return a},set:function(t){a.top=void 0!=t.top?t.top:a.top,a.right=void 0!=t.right?t.right:a.right,a.bottom=void 0!=t.bottom?t.bottom:a.bottom,a.left=void 0!=t.left?t.left:a.left}},color:{get:function(){return k},set:function(e){k=t.utils.getColor(e)}}}),t.utils.initOptions(e),e},t.models.parallelCoordinates=function(){"use strict";function e(S){return C.reset(),S.each(function(e){function C(t){return k(p.map(function(e){if(isNaN(t.values[e.key])||isNaN(parseFloat(t.values[e.key]))||z){var n=f[e.key].domain(),r=f[e.key].range(),i=n[0]-(n[1]-n[0])/9;if(w.indexOf(e.key)<0){var o=d3.scale.linear().domain([i,n[1]]).range([l-12,r[1]]);f[e.key].brush.y(o),w.push(e.key)}if(isNaN(t.values[e.key])||isNaN(parseFloat(t.values[e.key])))return[c(e.key),f[e.key](i)]}return void 0!==U&&(w.length>0||z?(U.style("display","inline"),Y.style("display","inline")):(U.style("display","none"),Y.style("display","none"))),[c(e.key),f[e.key](t.values[e.key])]}))}function S(t){y.forEach(function(e){var n=f[e.dimension].brush.y().domain();e.hasOnlyNaN&&(e.extent[1]=(f[e.dimension].domain()[1]-n[0])*(e.extent[1]-e.extent[0])/(q[e.dimension]-e.extent[0])+n[0]),e.hasNaN&&(e.extent[0]=n[0]),t&&f[e.dimension].brush.extent(e.extent)}),i.select(".nv-brushBackground").each(function(t){d3.select(this).call(f[t.key].brush)}).selectAll("rect").attr("x",-8).attr("width",16),N()}function E(){v===!1&&(v=!0,S(!0))}function A(){K=g.filter(function(t){return!f[t].brush.empty()}),J=K.map(function(t){return f[t].brush.extent()}),y=[],K.forEach(function(t,e){y[e]={dimension:t,extent:J[e],hasNaN:!1,hasOnlyNaN:!1}}),b=[],n.style("display",function(t){var e=K.every(function(e,n){return!(!isNaN(t.values[e])&&!isNaN(parseFloat(t.values[e]))||J[n][0]!=f[e].brush.y().domain()[0])||J[n][0]<=t.values[e]&&t.values[e]<=J[n][1]&&!isNaN(parseFloat(t.values[e]))});return e&&b.push(t),e?null:"none"}),N(),M.brush({filters:y,active:b})}function T(){var t=K.length>0;y.forEach(function(t){t.extent[0]===f[t.dimension].brush.y().domain()[0]&&w.indexOf(t.dimension)>=0&&(t.hasNaN=!0),t.extent[1]f[t.key].domain()[0]&&(W[t.key]=[n[0].extent[1]]),n[0].extent[0]>=f[t.key].domain()[0]&&W[t.key].push(n[0].extent[0])),d3.select(this).call(_.scale(f[t.key]).tickFormat(t.format).tickValues(W[t.key]))})}function D(t){x[t.key]=this.parentNode.__origin__=c(t.key),r.attr("visibility","hidden")}function O(t){x[t.key]=Math.min(u,Math.max(0,this.parentNode.__origin__+=d3.event.x)),n.attr("d",C),p.sort(function(t,e){return I(t.key)-I(e.key)}),p.forEach(function(t,e){return t.currentPosition=e}),c.domain(p.map(function(t){return t.key})),i.attr("transform",function(t){return"translate("+I(t.key)+")"})}function j(t,e){delete this.parentNode.__origin__,delete x[t.key],d3.select(this.parentNode).attr("transform","translate("+c(t.key)+")"),n.attr("d",C),r.attr("d",C).attr("visibility",null),M.dimensionsOrder(p)}function I(t){var e=x[t];return null==e?c(t):e}var L=d3.select(this);if(u=t.utils.availableWidth(a,L,o),l=t.utils.availableHeight(s,L,o),t.utils.initSVG(L),void 0===e[0].values){var P=[];e.forEach(function(t){var e={},n=Object.keys(t);n.forEach(function(n){"name"!==n&&(e[n]=t[n])}),P.push({key:t.name,values:e})}),e=P}var F=e.map(function(t){return t.values});0===b.length&&(b=e),g=h.sort(function(t,e){return t.currentPosition-e.currentPosition}).map(function(t){return t.key}),p=h.filter(function(t){return!t.disabled}),c.rangePoints([0,u],1).domain(p.map(function(t){return t.key}));var q={},z=!1,W=[];g.forEach(function(t){var e=d3.extent(F,function(e){return+e[t]}),n=e[0],r=e[1],i=!1;(isNaN(n)||isNaN(r))&&(i=!0,n=0,r=0),n===r&&(n-=1,r+=1);var o=y.filter(function(e){return e.dimension==t});0!==o.length&&(i?(n=f[t].domain()[0],r=f[t].domain()[1]):!o[0].hasOnlyNaN&&v?(n=n>o[0].extent[0]?o[0].extent[0]:n,r=r0||!t.utils.arrayEquals(b,tt))&&M.activeChanged(b)}),e}var n,r,i,o={top:30,right:0,bottom:10,left:0},a=null,s=null,u=null,l=null,c=d3.scale.ordinal(),f={},d="undefined values",h=[],p=[],g=[],v=!0,m=t.utils.defaultColor(),y=[],b=[],x=[],w=[],$=1,k=d3.svg.line(),_=d3.svg.axis(),M=d3.dispatch("brushstart","brush","brushEnd","dimensionsOrder","stateChange","elementClick","elementMouseover","elementMouseout","elementMousemove","renderEnd","activeChanged"),C=t.utils.renderWatch(M);return e.dispatch=M,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return a},set:function(t){a=t}},height:{get:function(){return s},set:function(t){s=t}},dimensionData:{get:function(){return h},set:function(t){h=t}},displayBrush:{get:function(){return v},set:function(t){v=t}},filters:{get:function(){return y},set:function(t){y=t}},active:{get:function(){return b},set:function(t){b=t}},lineTension:{get:function(){return $},set:function(t){$=t}},undefinedValuesLabel:{get:function(){return d},set:function(t){d=t}},dimensions:{get:function(){return h.map(function(t){return t.key})},set:function(e){t.deprecated("dimensions","use dimensionData instead"),0===h.length?e.forEach(function(t){h.push({key:t})}):e.forEach(function(t,e){h[e].key=t})}},dimensionNames:{get:function(){return h.map(function(t){return t.key})},set:function(e){t.deprecated("dimensionNames","use dimensionData instead"),g=[],0===h.length?e.forEach(function(t){h.push({key:t})}):e.forEach(function(t,e){h[e].key=t})}},dimensionFormats:{get:function(){return h.map(function(t){return t.format})},set:function(e){t.deprecated("dimensionFormats","use dimensionData instead"),0===h.length?e.forEach(function(t){h.push({format:t})}):e.forEach(function(t,e){h[e].format=t})}},margin:{get:function(){return o},set:function(t){o.top=void 0!==t.top?t.top:o.top,o.right=void 0!==t.right?t.right:o.right,o.bottom=void 0!==t.bottom?t.bottom:o.bottom,o.left=void 0!==t.left?t.left:o.left}},color:{get:function(){return m},set:function(e){m=t.utils.getColor(e)}}}),t.utils.initOptions(e),e},t.models.parallelCoordinatesChart=function(){"use strict";function e(i){return m.reset(),m.models(n),i.each(function(i){var l=d3.select(this);t.utils.initSVG(l);var p=t.utils.availableWidth(a,l,o),g=t.utils.availableHeight(s,l,o);if(e.update=function(){l.call(e)},e.container=this,c.setter(b(f),e.update).getter(y(f)).update(),c.disabled=f.map(function(t){return!!t.disabled}),f=f.map(function(t){return t.disabled=!!t.disabled,t}),f.forEach(function(t,e){t.originalPosition=isNaN(t.originalPosition)?e:t.originalPosition,t.currentPosition=isNaN(t.currentPosition)?e:t.currentPosition}),!h){var m;h={};for(m in c)c[m]instanceof Array?h[m]=c[m].slice(0):h[m]=c[m]}if(!i||!i.length)return t.utils.noData(e,l),e;l.selectAll(".nv-noData").remove();var x=l.selectAll("g.nv-wrap.nv-parallelCoordinatesChart").data([i]),w=x.enter().append("g").attr("class","nvd3 nv-wrap nv-parallelCoordinatesChart").append("g"),$=x.select("g");w.append("g").attr("class","nv-parallelCoordinatesWrap"),w.append("g").attr("class","nv-legendWrap"),$.select("rect").attr("width",p).attr("height",g>0?g:0),u?(r.width(p).color(function(t){return"rgb(188,190,192)"}),$.select(".nv-legendWrap").datum(f.sort(function(t,e){return t.originalPosition-e.originalPosition})).call(r),r.height()>o.top&&(o.top=r.height(),g=t.utils.availableHeight(s,l,o)),x.select(".nv-legendWrap").attr("transform","translate( 0 ,"+-o.top+")")):$.select(".nv-legendWrap").selectAll("*").remove(),x.attr("transform","translate("+o.left+","+o.top+")"),n.width(p).height(g).dimensionData(f).displayBrush(d);var k=$.select(".nv-parallelCoordinatesWrap ").datum(i);k.transition().call(n),n.dispatch.on("brushEnd",function(t,e){e?(d=!0,v.brushEnd(t)):d=!1}),r.dispatch.on("stateChange",function(t){for(var n in t)c[n]=t[n];v.stateChange(c),e.update()}),n.dispatch.on("dimensionsOrder",function(t){f.sort(function(t,e){return t.currentPosition-e.currentPosition});var e=!1;f.forEach(function(t,n){t.currentPosition=n,t.currentPosition!==t.originalPosition&&(e=!0)}),v.dimensionsOrder(f,e)}),v.on("changeState",function(t){"undefined"!=typeof t.disabled&&(f.forEach(function(e,n){e.disabled=t.disabled[n]}),c.disabled=t.disabled),e.update()})}),m.renderEnd("parraleleCoordinateChart immediate"),e}var n=t.models.parallelCoordinates(),r=t.models.legend(),i=t.models.tooltip(),o=(t.models.tooltip(),{top:0,right:0,bottom:0,left:0}),a=null,s=null,u=!0,l=t.utils.defaultColor(),c=t.utils.state(),f=[],d=!0,h=null,p=null,g="undefined",v=d3.dispatch("dimensionsOrder","brushEnd","stateChange","changeState","renderEnd"),m=t.utils.renderWatch(v),y=function(t){ return function(){return{active:t.map(function(t){return!t.disabled})}}},b=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};return i.contentGenerator(function(t){var e='";return 0!==t.series.length&&(e+='',t.series.forEach(function(t){e=e+'"}),e+=""),e+="
'+t.key+"
'+t.key+''+t.value+"
"}),n.dispatch.on("elementMouseover.tooltip",function(t){var e={key:t.label,color:t.color,series:[]};t.values&&(Object.keys(t.values).forEach(function(n){var r=t.dimensions.filter(function(t){return t.key===n})[0];if(r){var i;i=isNaN(t.values[n])||isNaN(parseFloat(t.values[n]))?g:r.format(t.values[n]),e.series.push({idx:r.currentPosition,key:n,value:i,color:r.color})}}),e.series.sort(function(t,e){return t.idx-e.idx})),i.data(e).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){i.hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(){i()}),e.dispatch=v,e.parallelCoordinates=n,e.legend=r,e.tooltip=i,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return a},set:function(t){a=t}},height:{get:function(){return s},set:function(t){s=t}},showLegend:{get:function(){return u},set:function(t){u=t}},defaultState:{get:function(){return h},set:function(t){h=t}},dimensionData:{get:function(){return f},set:function(t){f=t}},displayBrush:{get:function(){return d},set:function(t){d=t}},noData:{get:function(){return p},set:function(t){p=t}},nanValue:{get:function(){return g},set:function(t){g=t}},margin:{get:function(){return o},set:function(t){o.top=void 0!==t.top?t.top:o.top,o.right=void 0!==t.right?t.right:o.right,o.bottom=void 0!==t.bottom?t.bottom:o.bottom,o.left=void 0!==t.left?t.left:o.left}},color:{get:function(){return l},set:function(e){l=t.utils.getColor(e),r.color(l),n.color(l)}}}),t.utils.inheritOptions(e,n),t.utils.initOptions(e),e},t.models.pie=function(){"use strict";function e(N){return T.reset(),N.each(function(e){function N(t,e){t.endAngle=isNaN(t.endAngle)?0:t.endAngle,t.startAngle=isNaN(t.startAngle)?0:t.startAngle,g||(t.innerRadius=0);var n=d3.interpolate(this._current,t);return this._current=n(0),function(t){return E[e](n(t))}}var D=r-n.left-n.right,O=i-n.top-n.bottom,j=Math.min(D,O)/2,I=[],L=[];if(u=d3.select(this),0===C.length)for(var P=j-j/5,F=_*j,q=0;q=p){var o=et(r);K[o]&&(r[1]-=J),K[et(r)]=!0}return"translate("+r+")"}),X.select(".nv-label text").style("text-anchor",function(t,e){return b?(t.startAngle+t.endAngle)/2o.top&&(o.top=r.height(),p=t.utils.availableHeight(s,u,o)),m.select(".nv-legendWrap").attr("transform","translate(0,"+-o.top+")");else if("right"===c){var $=t.models.legend().width();f/2<$&&($=f/2),r.height(p).key(n.x()),r.width($),f-=r.width(),m.select(".nv-legendWrap").datum(i).call(r).attr("transform","translate("+f+",0)")}}else w.select(".nv-legendWrap").selectAll("*").remove();m.attr("transform","translate("+o.left+","+o.top+")"),n.width(f).height(p);var k=w.select(".nv-pieWrap").datum([i]);d3.transition(k).call(n),r.dispatch.on("stateChange",function(t){for(var n in t)d[n]=t[n];v.stateChange(d),e.update()}),v.on("changeState",function(t){"undefined"!=typeof t.disabled&&(i.forEach(function(e,n){e.disabled=t.disabled[n]}),d.disabled=t.disabled),e.update()})}),m.renderEnd("pieChart immediate"),e}var n=t.models.pie(),r=t.models.legend(),i=t.models.tooltip(),o={top:30,right:20,bottom:20,left:20},a=null,s=null,u=!1,l=!0,c="top",f=t.utils.defaultColor(),d=t.utils.state(),h=null,p=null,g=250,v=d3.dispatch("stateChange","changeState","renderEnd");i.duration(0).headerEnabled(!1).valueFormatter(function(t,e){return n.valueFormat()(t,e)});var m=t.utils.renderWatch(v),y=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},b=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};return n.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:e.x()(t.data),value:e.y()(t.data),color:t.color,percent:t.percent},u||(delete t.percent,delete t.series.percent),i.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){i.hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){i()}),e.legend=r,e.dispatch=v,e.pie=n,e.tooltip=i,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return a},set:function(t){a=t}},height:{get:function(){return s},set:function(t){s=t}},noData:{get:function(){return p},set:function(t){p=t}},showTooltipPercent:{get:function(){return u},set:function(t){u=t}},showLegend:{get:function(){return l},set:function(t){l=t}},legendPosition:{get:function(){return c},set:function(t){c=t}},defaultState:{get:function(){return h},set:function(t){h=t}},color:{get:function(){return f},set:function(t){f=t,r.color(f),n.color(f)}},duration:{get:function(){return g},set:function(t){g=t,m.reset(g),n.duration(g)}},margin:{get:function(){return o},set:function(t){o.top=void 0!==t.top?t.top:o.top,o.right=void 0!==t.right?t.right:o.right,o.bottom=void 0!==t.bottom?t.bottom:o.bottom,o.left=void 0!==t.left?t.left:o.left}}}),t.utils.inheritOptions(e,n),t.utils.initOptions(e),e},t.models.scatter=function(){"use strict";function e(t){var e,n;return e=u=u||{},n=t[0].series,e=e[n]=e[n]||{},n=t[1],e=e[n]=e[n]||{}}function n(t){var n,r,i=t[0],o=e(t),a=!1;for(n=1;n0?G:0),rt.attr("clip-path",A?"url(#nv-edge-clip-"+h+")":""),H=!0;var it=J.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t){return t.key});it.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),it.exit().remove(),it.attr("class",function(t,e){return(t.classed||"")+" nv-group nv-series-"+e}).classed("nv-noninteractive",!M).classed("hover",function(t){return t.hover}),it.watchTransition(U,"scatter: groups").style("fill",function(t,e){return d(t,e)}).style("stroke",function(t,e){return d(t,e)}).style("stroke-opacity",1).style("fill-opacity",.5);var ot=it.selectAll("path.nv-point").data(function(t){return t.values.map(function(t,e){return[t,e]}).filter(function(t,e){return C(t[0],e)})});if(ot.enter().append("path").attr("class",function(t){return"nv-point nv-point-"+t[1]}).style("fill",function(t){return t.color}).style("stroke",function(t){return t.color}).attr("transform",function(e){return"translate("+t.utils.NaNtoZero(i(y(e[0],e[1])))+","+t.utils.NaNtoZero(o(b(e[0],e[1])))+")"}).attr("d",t.utils.symbol().type(function(t){return w(t[0])}).size(function(t){return m(x(t[0],t[1]))})),ot.exit().remove(),it.exit().selectAll("path.nv-point").watchTransition(U,"scatter exit").attr("transform",function(e){return"translate("+t.utils.NaNtoZero(g(y(e[0],e[1])))+","+t.utils.NaNtoZero(v(b(e[0],e[1])))+")"}).remove(),ot.filter(function(t){return K||n(t,"x","y")}).watchTransition(U,"scatter points").attr("transform",function(e){return"translate("+t.utils.NaNtoZero(g(y(e[0],e[1])))+","+t.utils.NaNtoZero(v(b(e[0],e[1])))+")"}),ot.filter(function(t){return K||n(t,"shape","size")}).watchTransition(U,"scatter points").attr("d",t.utils.symbol().type(function(t){return w(t[0])}).size(function(t){return m(x(t[0],t[1]))})),V){var at=it.selectAll(".nv-label").data(function(t){return t.values.map(function(t,e){return[t,e]}).filter(function(t,e){return C(t[0],e)})});at.enter().append("text").style("fill",function(t,e){return t.color}).style("stroke-opacity",0).style("fill-opacity",1).attr("transform",function(e){var n=t.utils.NaNtoZero(i(y(e[0],e[1])))+Math.sqrt(m(x(e[0],e[1]))/Math.PI)+2;return"translate("+n+","+t.utils.NaNtoZero(o(b(e[0],e[1])))+")"}).text(function(t,e){return t[0].label}),at.exit().remove(),it.exit().selectAll("path.nv-label").watchTransition(U,"scatter exit").attr("transform",function(e){var n=t.utils.NaNtoZero(g(y(e[0],e[1])))+Math.sqrt(m(x(e[0],e[1]))/Math.PI)+2;return"translate("+n+","+t.utils.NaNtoZero(v(b(e[0],e[1])))+")"}).remove(),at.each(function(t){d3.select(this).classed("nv-label",!0).classed("nv-label-"+t[1],!1).classed("hover",!1)}),at.watchTransition(U,"scatter labels").attr("transform",function(e){var n=t.utils.NaNtoZero(g(y(e[0],e[1])))+Math.sqrt(m(x(e[0],e[1]))/Math.PI)+2;return"translate("+n+","+t.utils.NaNtoZero(v(b(e[0],e[1])))+")"})}B?(clearTimeout(s),s=setTimeout(u,B)):u(),i=g.copy(),o=v.copy(),a=m.copy()}),U.renderEnd("scatter immediate"),r}var i,o,a,s,u,l={top:0,right:0,bottom:0,left:0},c=null,f=null,d=t.utils.defaultColor(),h=Math.floor(1e5*Math.random()),p=null,g=d3.scale.linear(),v=d3.scale.linear(),m=d3.scale.linear(),y=function(t){return t.x},b=function(t){return t.y},x=function(t){return t.size||1},w=function(t){return t.shape||"circle"},$=[],k=[],_=[],M=!0,C=function(t){return!t.notActive},S=!1,E=.1,A=!1,T=!0,N=!1,D=function(){return 25},O=null,j=null,I=null,L=null,P=null,F=null,q=!1,z=d3.dispatch("elementClick","elementDblClick","elementMouseover","elementMouseout","renderEnd"),W=!0,R=250,B=300,V=!1,H=!1,U=t.utils.renderWatch(z,R),Y=[16,256];return r.dispatch=z,r.options=t.utils.optionsFunc.bind(r),r._calls=new function(){this.clearHighlights=function(){return t.dom.write(function(){p.selectAll(".nv-point.hover").classed("hover",!1)}),null},this.highlightPoint=function(e,n,r){t.dom.write(function(){p.select(".nv-groups").selectAll(".nv-series-"+e).selectAll(".nv-point-"+n).classed("hover",r)})}},z.on("elementMouseover.point",function(t){M&&r._calls.highlightPoint(t.seriesIndex,t.pointIndex,!0)}),z.on("elementMouseout.point",function(t){M&&r._calls.highlightPoint(t.seriesIndex,t.pointIndex,!1)}),r._options=Object.create({},{width:{get:function(){return c},set:function(t){c=t}},height:{get:function(){return f},set:function(t){f=t}},xScale:{get:function(){return g},set:function(t){g=t}},yScale:{get:function(){return v},set:function(t){v=t}},pointScale:{get:function(){return m},set:function(t){m=t}},xDomain:{get:function(){return O},set:function(t){O=t}},yDomain:{get:function(){return j},set:function(t){j=t}},pointDomain:{get:function(){return P},set:function(t){P=t}},xRange:{get:function(){return I},set:function(t){I=t}},yRange:{get:function(){return L},set:function(t){L=t}},pointRange:{get:function(){return F},set:function(t){F=t}},forceX:{get:function(){return $},set:function(t){$=t}},forceY:{get:function(){return k},set:function(t){k=t}},forcePoint:{get:function(){return _},set:function(t){_=t}},interactive:{get:function(){return M},set:function(t){M=t}},pointActive:{get:function(){return C},set:function(t){C=t}},padDataOuter:{get:function(){return E},set:function(t){E=t}},padData:{get:function(){return S},set:function(t){S=t}},clipEdge:{get:function(){return A},set:function(t){A=t}},clipVoronoi:{get:function(){return T},set:function(t){T=t}},clipRadius:{get:function(){return D},set:function(t){D=t}},showVoronoi:{get:function(){return N},set:function(t){N=t}},id:{get:function(){return h},set:function(t){h=t}},interactiveUpdateDelay:{get:function(){return B},set:function(t){B=t}},showLabels:{get:function(){return V},set:function(t){V=t}},x:{get:function(){return y},set:function(t){y=d3.functor(t)}},y:{get:function(){return b},set:function(t){b=d3.functor(t)}},pointSize:{get:function(){return x},set:function(t){x=d3.functor(t)}},pointShape:{get:function(){return w},set:function(t){w=d3.functor(t)}},margin:{get:function(){return l},set:function(t){l.top=void 0!==t.top?t.top:l.top,l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},duration:{get:function(){return R},set:function(t){R=t,U.reset(R)}},color:{get:function(){return d},set:function(e){d=t.utils.getColor(e)}},useVoronoi:{get:function(){return W},set:function(t){W=t,W===!1&&(T=!1)}}}),t.utils.initOptions(r),r},t.models.scatterChart=function(){"use strict";function e(M){return T.reset(),T.models(n),b&&T.models(r),x&&T.models(i),v&&T.models(a),m&&T.models(s),M.each(function(M){d=d3.select(this),t.utils.initSVG(d);var O=t.utils.availableWidth(c,d,l),j=t.utils.availableHeight(f,d,l);if(e.update=function(){0===C?d.call(e):d.transition().duration(C).call(e)},e.container=this,$.setter(D(M),e.update).getter(N(M)).update(),$.disabled=M.map(function(t){return!!t.disabled}),!k){var I;k={};for(I in $)$[I]instanceof Array?k[I]=$[I].slice(0):k[I]=$[I]}if(!(M&&M.length&&M.filter(function(t){return t.values.length}).length))return t.utils.noData(e,d),T.renderEnd("scatter immediate"),e;d.selectAll(".nv-noData").remove(),p=n.xScale(),g=n.yScale();var L=d.selectAll("g.nv-wrap.nv-scatterChart").data([M]),P=L.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+n.id()),F=P.append("g"),q=L.select("g");if(F.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none"),F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y nv-axis"),F.append("g").attr("class","nv-scatterWrap"),F.append("g").attr("class","nv-regressionLinesWrap"),F.append("g").attr("class","nv-distWrap"),F.append("g").attr("class","nv-legendWrap"),w&&q.select(".nv-y.nv-axis").attr("transform","translate("+O+",0)"),y){var z=O;o.width(z),L.select(".nv-legendWrap").datum(M).call(o),o.height()>l.top&&(l.top=o.height(),j=t.utils.availableHeight(f,d,l)),L.select(".nv-legendWrap").attr("transform","translate(0,"+-l.top+")")}else q.select(".nv-legendWrap").selectAll("*").remove();L.attr("transform","translate("+l.left+","+l.top+")"),n.width(O).height(j).color(M.map(function(t,e){return t.color=t.color||h(t,e),t.color}).filter(function(t,e){return!M[e].disabled})).showLabels(S),L.select(".nv-scatterWrap").datum(M.filter(function(t){return!t.disabled})).call(n),L.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+n.id()+")");var W=L.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(t){return t});W.enter().append("g").attr("class","nv-regLines");var R=W.selectAll(".nv-regLine").data(function(t){return[t]});R.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0),R.filter(function(t){return t.intercept&&t.slope}).watchTransition(T,"scatterPlusLineChart: regline").attr("x1",p.range()[0]).attr("x2",p.range()[1]).attr("y1",function(t,e){return g(p.domain()[0]*t.slope+t.intercept)}).attr("y2",function(t,e){return g(p.domain()[1]*t.slope+t.intercept)}).style("stroke",function(t,e,n){return h(t,n)}).style("stroke-opacity",function(t,e){return t.disabled||"undefined"==typeof t.slope||"undefined"==typeof t.intercept?0:1}),b&&(r.scale(p)._ticks(t.utils.calcTicksX(O/100,M)).tickSize(-j,0),q.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")").call(r)),x&&(i.scale(g)._ticks(t.utils.calcTicksY(j/36,M)).tickSize(-O,0),q.select(".nv-y.nv-axis").call(i)),v&&(a.getData(n.x()).scale(p).width(O).color(M.map(function(t,e){return t.color||h(t,e)}).filter(function(t,e){return!M[e].disabled})),F.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),q.select(".nv-distributionX").attr("transform","translate(0,"+g.range()[0]+")").datum(M.filter(function(t){return!t.disabled})).call(a)),m&&(s.getData(n.y()).scale(g).width(j).color(M.map(function(t,e){return t.color||h(t,e)}).filter(function(t,e){return!M[e].disabled})),F.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),q.select(".nv-distributionY").attr("transform","translate("+(w?O:-s.size())+",0)").datum(M.filter(function(t){return!t.disabled})).call(s)),o.dispatch.on("stateChange",function(t){for(var n in t)$[n]=t[n];_.stateChange($),e.update()}),_.on("changeState",function(t){"undefined"!=typeof t.disabled&&(M.forEach(function(e,n){e.disabled=t.disabled[n]}),$.disabled=t.disabled),e.update()}),n.dispatch.on("elementMouseout.tooltip",function(t){u.hidden(!0),d.select(".nv-chart-"+n.id()+" .nv-series-"+t.seriesIndex+" .nv-distx-"+t.pointIndex).attr("y1",0),d.select(".nv-chart-"+n.id()+" .nv-series-"+t.seriesIndex+" .nv-disty-"+t.pointIndex).attr("x2",s.size())}),n.dispatch.on("elementMouseover.tooltip",function(t){d.select(".nv-series-"+t.seriesIndex+" .nv-distx-"+t.pointIndex).attr("y1",t.relativePos[1]-j),d.select(".nv-series-"+t.seriesIndex+" .nv-disty-"+t.pointIndex).attr("x2",t.relativePos[0]+a.size()),u.data(t).hidden(!1)}),E=p.copy(),A=g.copy()}),T.renderEnd("scatter with line immediate"),e}var n=t.models.scatter(),r=t.models.axis(),i=t.models.axis(),o=t.models.legend(),a=t.models.distribution(),s=t.models.distribution(),u=t.models.tooltip(),l={top:30,right:20,bottom:50,left:75},c=null,f=null,d=null,h=t.utils.defaultColor(),p=n.xScale(),g=n.yScale(),v=!1,m=!1,y=!0,b=!0,x=!0,w=!1,$=t.utils.state(),k=null,_=d3.dispatch("stateChange","changeState","renderEnd"),M=null,C=250,S=!1;n.xScale(p).yScale(g),r.orient("bottom").tickPadding(10),i.orient(w?"right":"left").tickPadding(10),a.axis("x"),s.axis("y"),u.headerFormatter(function(t,e){return r.tickFormat()(t,e)}).valueFormatter(function(t,e){return i.tickFormat()(t,e)});var E,A,T=t.utils.renderWatch(_,C),N=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},D=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};return e.dispatch=_,e.scatter=n,e.legend=o,e.xAxis=r,e.yAxis=i,e.distX=a,e.distY=s,e.tooltip=u,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return c},set:function(t){c=t}},height:{get:function(){return f},set:function(t){f=t}},container:{get:function(){return d},set:function(t){d=t}},showDistX:{get:function(){return v},set:function(t){v=t}},showDistY:{get:function(){return m},set:function(t){m=t}},showLegend:{get:function(){return y},set:function(t){y=t}},showXAxis:{get:function(){return b},set:function(t){b=t}},showYAxis:{get:function(){return x},set:function(t){x=t}},defaultState:{get:function(){return k},set:function(t){k=t}},noData:{get:function(){return M},set:function(t){M=t}},duration:{get:function(){return C},set:function(t){C=t}},showLabels:{get:function(){return S},set:function(t){S=t}},margin:{get:function(){return l},set:function(t){l.top=void 0!==t.top?t.top:l.top,l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},rightAlignYAxis:{get:function(){return w},set:function(t){w=t,i.orient(t?"right":"left")}},color:{get:function(){return h},set:function(e){h=t.utils.getColor(e),o.color(h),a.color(h),s.color(h)}}}),t.utils.inheritOptions(e,n),t.utils.initOptions(e),e},t.models.sparkline=function(){"use strict";function e(c){return b.reset(),c.each(function(e){var c=s-a.left-a.right,y=u-a.top-a.bottom;l=d3.select(this),t.utils.initSVG(l),f.domain(n||d3.extent(e,h)).range(i||[0,c]),d.domain(r||d3.extent(e,p)).range(o||[y,0]); -var b=l.selectAll("g.nv-wrap.nv-sparkline").data([e]),x=b.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");x.append("g"),b.select("g");b.attr("transform","translate("+a.left+","+a.top+")");var w=b.selectAll("path").data(function(t){return[t]});w.enter().append("path"),w.exit().remove(),w.style("stroke",function(t,e){return t.color||g(t,e)}).attr("d",d3.svg.line().x(function(t,e){return f(h(t,e))}).y(function(t,e){return d(p(t,e))}));var $=b.selectAll("circle.nv-point").data(function(t){function e(e){if(e!=-1){var n=t[e];return n.pointIndex=e,n}return null}var n=t.map(function(t,e){return p(t,e)}),r=e(n.lastIndexOf(d.domain()[1])),i=e(n.indexOf(d.domain()[0])),o=e(n.length-1);return[v?i:null,v?r:null,m?o:null].filter(function(t){return null!=t})});$.enter().append("circle"),$.exit().remove(),$.attr("cx",function(t,e){return f(h(t,t.pointIndex))}).attr("cy",function(t,e){return d(p(t,t.pointIndex))}).attr("r",2).attr("class",function(t,e){return h(t,t.pointIndex)==f.domain()[1]?"nv-point nv-currentValue":p(t,t.pointIndex)==d.domain()[0]?"nv-point nv-noWatermark":"nv-point nv-maxValue"})}),b.renderEnd("sparkline immediate"),e}var n,r,i,o,a={top:2,right:0,bottom:2,left:0},s=400,u=32,l=null,c=!0,f=d3.scale.linear(),d=d3.scale.linear(),h=function(t){return t.x},p=function(t){return t.y},g=t.utils.getColor(["#000"]),v=!0,m=!0,y=d3.dispatch("renderEnd"),b=t.utils.renderWatch(y);return e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return s},set:function(t){s=t}},height:{get:function(){return u},set:function(t){u=t}},xDomain:{get:function(){return n},set:function(t){n=t}},yDomain:{get:function(){return r},set:function(t){r=t}},xRange:{get:function(){return i},set:function(t){i=t}},yRange:{get:function(){return o},set:function(t){o=t}},xScale:{get:function(){return f},set:function(t){f=t}},yScale:{get:function(){return d},set:function(t){d=t}},animate:{get:function(){return c},set:function(t){c=t}},showMinMaxPoints:{get:function(){return v},set:function(t){v=t}},showCurrentPoint:{get:function(){return m},set:function(t){m=t}},x:{get:function(){return h},set:function(t){h=d3.functor(t)}},y:{get:function(){return p},set:function(t){p=d3.functor(t)}},margin:{get:function(){return a},set:function(t){a.top=void 0!==t.top?t.top:a.top,a.right=void 0!==t.right?t.right:a.right,a.bottom=void 0!==t.bottom?t.bottom:a.bottom,a.left=void 0!==t.left?t.left:a.left}},color:{get:function(){return g},set:function(e){g=t.utils.getColor(e)}}}),e.dispatch=y,t.utils.initOptions(e),e},t.models.sparklinePlus=function(){"use strict";function e(g){return m.reset(),m.models(i),g.each(function(g){function v(){if(!l){var t=M.selectAll(".nv-hoverValue").data(u),e=t.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);t.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove(),t.attr("transform",function(t){return"translate("+n(i.x()(g[t],t))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1),u.length&&(e.append("line").attr("x1",0).attr("y1",-o.top).attr("x2",0).attr("y2",x),e.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-o.top).attr("text-anchor","end").attr("dy",".9em"),M.select(".nv-hoverValue .nv-xValue").text(c(i.x()(g[u[0]],u[0]))),e.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-o.top).attr("text-anchor","start").attr("dy",".9em"),M.select(".nv-hoverValue .nv-yValue").text(f(i.y()(g[u[0]],u[0]))))}}function m(){function t(t,e){for(var n=Math.abs(i.x()(t[0],0)-e),r=0,o=0;o=t[0]&&i.x()(e,n)<=t[1]}),disableTooltip:e.disableTooltip}}));e.transition().duration(D).call(i),S(),I()}var W=d3.select(this);t.utils.initSVG(W);var R=t.utils.availableWidth(h,W,d),B=t.utils.availableHeight(p,W,d)-(w?f.height():0);if(e.update=function(){W.transition().duration(D).call(e)},e.container=this,M.setter(F(c),e.update).getter(P(c)).update(),M.disabled=c.map(function(t){return!!t.disabled}),!C){var V;C={};for(V in M)M[V]instanceof Array?C[V]=M[V].slice(0):C[V]=M[V]}if(!(c&&c.length&&c.filter(function(t){return t.values.length}).length))return t.utils.noData(e,W),e;W.selectAll(".nv-noData").remove(),n=i.xScale(),r=i.yScale();var H=W.selectAll("g.nv-wrap.nv-stackedAreaChart").data([c]),U=H.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),Y=H.select("g");U.append("g").attr("class","nv-legendWrap"),U.append("g").attr("class","nv-controlsWrap");var G=U.append("g").attr("class","nv-focus");G.append("g").attr("class","nv-background").append("rect"),G.append("g").attr("class","nv-x nv-axis"),G.append("g").attr("class","nv-y nv-axis"),G.append("g").attr("class","nv-stackedWrap"),G.append("g").attr("class","nv-interactive");U.append("g").attr("class","nv-focusWrap");if(m){var X=v?R-A:R;s.width(X),Y.select(".nv-legendWrap").datum(c).call(s),s.height()>d.top&&(d.top=s.height(),B=t.utils.availableHeight(p,W,d)-(w?f.height():0)),Y.select(".nv-legendWrap").attr("transform","translate("+(R-X)+","+-d.top+")")}else Y.select(".nv-legendWrap").selectAll("*").remove();if(v){var Z=[{key:N.stacked||"Stacked",metaKey:"Stacked",disabled:"stack"!=i.style(),style:"stack"},{key:N.stream||"Stream",metaKey:"Stream",disabled:"stream"!=i.style(),style:"stream"},{key:N.expanded||"Expanded",metaKey:"Expanded",disabled:"expand"!=i.style(),style:"expand"},{key:N.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:"stack_percent"!=i.style(),style:"stack_percent"}];A=T.length/3*260,Z=Z.filter(function(t){return T.indexOf(t.metaKey)!==-1}),u.width(A).color(["#444","#444","#444"]),Y.select(".nv-controlsWrap").datum(Z).call(u),Math.max(u.height(),s.height())>d.top&&(d.top=Math.max(u.height(),s.height()),B=t.utils.availableHeight(p,W,d)),Y.select(".nv-controlsWrap").attr("transform","translate(0,"+-d.top+")")}else Y.select(".nv-controlsWrap").selectAll("*").remove();H.attr("transform","translate("+d.left+","+d.top+")"),x&&Y.select(".nv-y.nv-axis").attr("transform","translate("+R+",0)"),$&&(l.width(R).height(B).margin({left:d.left,top:d.top}).svgContainer(W).xScale(n),H.select(".nv-interactive").call(l)),Y.select(".nv-focus .nv-background rect").attr("width",R).attr("height",B),i.width(R).height(B).color(c.map(function(t,e){return t.color||g(t,e)}).filter(function(t,e){return!c[e].disabled}));var Q=Y.select(".nv-focus .nv-stackedWrap").datum(c.filter(function(t){return!t.disabled}));if(y&&o.scale(n)._ticks(t.utils.calcTicksX(R/100,c)).tickSize(-B,0),b){var K;K="wiggle"===i.offset()?0:t.utils.calcTicksY(B/36,c),a.scale(r)._ticks(K).tickSize(-R,0)}if(w){f.width(R),Y.select(".nv-focusWrap").attr("transform","translate(0,"+(B+d.bottom+f.margin().top)+")").datum(c.filter(function(t){return!t.disabled})).call(f);var J=f.brush.empty()?f.xDomain():f.brush.extent();null!==J&&z(J)}else Q.transition().call(i),S(),I();i.dispatch.on("areaClick.toggle",function(t){1===c.filter(function(t){return!t.disabled}).length?c.forEach(function(t){t.disabled=!1}):c.forEach(function(e,n){e.disabled=n!=t.seriesIndex}),M.disabled=c.map(function(t){return!!t.disabled}),E.stateChange(M),e.update()}),s.dispatch.on("stateChange",function(t){for(var n in t)M[n]=t[n];E.stateChange(M),e.update()}),u.dispatch.on("legendClick",function(t,n){t.disabled&&(Z=Z.map(function(t){return t.disabled=!0,t}),t.disabled=!1,i.style(t.style),M.style=i.style(),E.stateChange(M),e.update())}),l.dispatch.on("elementMousemove",function(n){i.clearHighlights();var r,o,a,s=[],u=0,f=!0;if(c.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(l,c){o=t.interactiveBisect(l.values,n.pointXValue,e.x());var d=l.values[o],h=e.y()(d,o);if(null!=h&&i.highlightPoint(c,o,!0),"undefined"!=typeof d){"undefined"==typeof r&&(r=d),"undefined"==typeof a&&(a=e.xScale()(e.x()(d,o)));var p="expand"==i.style()?d.display.y:e.y()(d,o);s.push({key:l.key,value:p,color:g(l,l.seriesIndex),point:d}),k&&"expand"!=i.style()&&null!=p&&(u+=p,f=!1)}}),s.reverse(),s.length>2){var d=e.yScale().invert(n.mouseY),h=null;s.forEach(function(t,e){d=Math.abs(d);var n=Math.abs(t.point.display.y0),r=Math.abs(t.point.display.y);if(d>=n&&d<=r+n)return void(h=e)}),null!=h&&(s[h].highlight=!0)}k&&"expand"!=i.style()&&s.length>=2&&!f&&s.push({key:_,value:u,total:!0});var p=e.x()(r,o),v=l.tooltip.valueFormatter();"expand"===i.style()||"stack_percent"===i.style()?(j||(j=v),v=d3.format(".1%")):j&&(v=j,j=null),l.tooltip.valueFormatter(v).data({value:p,series:s})(),l.renderGuideLine(a)}),l.dispatch.on("elementMouseout",function(t){i.clearHighlights()}),f.dispatch.on("onBrush",function(t){z(t)}),E.on("changeState",function(t){"undefined"!=typeof t.disabled&&c.length===t.disabled.length&&(c.forEach(function(e,n){e.disabled=t.disabled[n]}),M.disabled=t.disabled),"undefined"!=typeof t.style&&(i.style(t.style),L=t.style),e.update()})}),I.renderEnd("stacked Area chart immediate"),e}var n,r,i=t.models.stackedArea(),o=t.models.axis(),a=t.models.axis(),s=t.models.legend(),u=t.models.legend(),l=t.interactiveGuideline(),c=t.models.tooltip(),f=t.models.focus(t.models.stackedArea()),d={top:30,right:25,bottom:50,left:60},h=null,p=null,g=t.utils.defaultColor(),v=!0,m=!0,y=!0,b=!0,x=!1,w=!1,$=!1,k=!0,_="TOTAL",M=t.utils.state(),C=null,S=null,E=d3.dispatch("stateChange","changeState","renderEnd"),A=250,T=["Stacked","Stream","Expanded"],N={},D=250;M.style=i.style(),o.orient("bottom").tickPadding(7),a.orient(x?"right":"left"),c.headerFormatter(function(t,e){return o.tickFormat()(t,e)}).valueFormatter(function(t,e){return a.tickFormat()(t,e)}),l.tooltip.headerFormatter(function(t,e){return o.tickFormat()(t,e)}).valueFormatter(function(t,e){return null==t?"N/A":a.tickFormat()(t,e)});var O=null,j=null;u.updateState(!1);var I=t.utils.renderWatch(E),L=i.style(),P=function(t){return function(){return{active:t.map(function(t){return!t.disabled}),style:i.style()}}},F=function(t){return function(e){void 0!==e.style&&(L=e.style),void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}},q=d3.format("%");return i.dispatch.on("elementMouseover.tooltip",function(t){t.point.x=i.x()(t.point),t.point.y=i.y()(t.point),c.data(t).hidden(!1)}),i.dispatch.on("elementMouseout.tooltip",function(t){c.hidden(!0)}),e.dispatch=E,e.stacked=i,e.legend=s,e.controls=u,e.xAxis=o,e.x2Axis=f.xAxis,e.yAxis=a,e.y2Axis=f.yAxis,e.interactiveLayer=l,e.tooltip=c,e.focus=f,e.dispatch=E,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return h},set:function(t){h=t}},height:{get:function(){return p},set:function(t){p=t}},showLegend:{get:function(){return m},set:function(t){m=t}},showXAxis:{get:function(){return y},set:function(t){y=t}},showYAxis:{get:function(){return b},set:function(t){b=t}},defaultState:{get:function(){return C},set:function(t){C=t}},noData:{get:function(){return S},set:function(t){S=t}},showControls:{get:function(){return v},set:function(t){v=t}},controlLabels:{get:function(){return N},set:function(t){N=t}},controlOptions:{get:function(){return T},set:function(t){T=t}},showTotalInTooltip:{get:function(){return k},set:function(t){k=t}},totalLabel:{get:function(){return _},set:function(t){_=t}},focusEnable:{get:function(){return w},set:function(t){w=t}},focusHeight:{get:function(){return f.height()},set:function(t){f.height(t)}},brushExtent:{get:function(){return f.brushExtent()},set:function(t){f.brushExtent(t)}},margin:{get:function(){return d},set:function(t){d.top=void 0!==t.top?t.top:d.top,d.right=void 0!==t.right?t.right:d.right,d.bottom=void 0!==t.bottom?t.bottom:d.bottom,d.left=void 0!==t.left?t.left:d.left}},focusMargin:{get:function(){return f.margin},set:function(t){f.margin.top=void 0!==t.top?t.top:f.margin.top,f.margin.right=void 0!==t.right?t.right:f.margin.right,f.margin.bottom=void 0!==t.bottom?t.bottom:f.margin.bottom,f.margin.left=void 0!==t.left?t.left:f.margin.left}},duration:{get:function(){return D},set:function(t){D=t,I.reset(D),i.duration(D),o.duration(D),a.duration(D)}},color:{get:function(){return g},set:function(e){g=t.utils.getColor(e),s.color(g),i.color(g),f.color(g)}},x:{get:function(){return i.x()},set:function(t){i.x(t),f.x(t)}},y:{get:function(){return i.y()},set:function(t){i.y(t),f.y(t)}},rightAlignYAxis:{get:function(){return x},set:function(t){x=t,a.orient(x?"right":"left")}},useInteractiveGuideline:{get:function(){return $},set:function(t){$=!!t,e.interactive(!t),e.useVoronoi(!t),i.scatter.interactive(!t)}}}),t.utils.inheritOptions(e,i),t.utils.initOptions(e),e},t.models.stackedAreaWithFocusChart=function(){return t.models.stackedAreaChart().margin({bottom:30}).focusEnable(!0)},t.models.sunburst=function(){"use strict";function e(t){var e=n(t);return e>90?180:0}function n(t){var e=Math.max(0,Math.min(2*Math.PI,N(t.x))),n=Math.max(0,Math.min(2*Math.PI,N(t.x+t.dx))),r=(e+n)/2*(180/Math.PI)-90;return r}function r(t){var e=Math.max(0,Math.min(2*Math.PI,N(t.x))),n=Math.max(0,Math.min(2*Math.PI,N(t.x+t.dx)));return(n-e)/(2*Math.PI)}function i(t){var e=Math.max(0,Math.min(2*Math.PI,N(t.x))),n=Math.max(0,Math.min(2*Math.PI,N(t.x+t.dx))),r=n-e;return r>M}function o(t,e){var n=d3.interpolate(N.domain(),[f.x,f.x+f.dx]),r=d3.interpolate(D.domain(),[f.y,1]),i=d3.interpolate(D.range(),[f.y?20:0,p]);return 0===e?function(){return I(t)}:function(e){return N.domain(n(e)),D.domain(r(e)).range(i(e)),I(t)}}function a(t){var e=d3.interpolate({x:t.x0,dx:t.dx0,y:t.y0,dy:t.dy0},t);return function(n){var r=e(n);return t.x0=r.x,t.dx0=r.dx,t.y0=r.y,t.dy0=r.dy,I(r)}}function s(t){var e=S(t);j[e]||(j[e]={});var n=j[e];n.dx=t.dx,n.x=t.x,n.dy=t.dy,n.y=t.y}function u(t){t.forEach(function(t){var e=S(t),n=j[e];n?(t.dx0=n.dx,t.x0=n.x,t.dy0=n.dy,t.y0=n.y):(t.dx0=t.dx,t.x0=t.x,t.dy0=t.dy,t.y0=t.y),s(t)})}function l(t){var r=w.selectAll("text"),a=w.selectAll("path");r.transition().attr("opacity",0),f=t,a.transition().duration(A).attrTween("d",o).each("end",function(r){if(r.x>=t.x&&r.x=t.depth){var o=d3.select(this.parentNode),a=o.select("text");a.transition().duration(A).text(function(t){return _(t)}).attr("opacity",function(t){return i(t)?1:0}).attr("transform",function(){var i=this.getBBox().width;if(0===r.depth)return"translate("+i/2*-1+",0)";if(r.depth===t.depth)return"translate("+(D(r.y)+5)+",0)";var o=n(r),a=e(r);return 0===a?"rotate("+o+")translate("+(D(r.y)+5)+",0)":"rotate("+o+")translate("+(D(r.y)+i+5)+",0)rotate("+a+")"})}})}function c(o){return L.reset(),o.each(function(o){w=d3.select(this),d=t.utils.availableWidth(v,w,g),h=t.utils.availableHeight(m,w,g),p=Math.min(d,h)/2,D.range([0,p]);var s=w.select("g.nvd3.nv-wrap.nv-sunburst");s[0][0]?s.attr("transform","translate("+(d/2+g.left+g.right)+","+(h/2+g.top+g.bottom)+")"):s=w.append("g").attr("class","nvd3 nv-wrap nv-sunburst nv-chart-"+x).attr("transform","translate("+(d/2+g.left+g.right)+","+(h/2+g.top+g.bottom)+")"),w.on("click",function(t,e){T.chartClick({data:t,index:e,pos:d3.event,id:x})}),O.value(b[y]||b.count);var c=O.nodes(o[0]).reverse();u(c);var f=s.selectAll(".arc-container").data(c,S),M=f.enter().append("g").attr("class","arc-container");M.append("path").attr("d",I).style("fill",function(t){return t.color?t.color:$(E?(t.children?t:t.parent).name:t.name)}).style("stroke","#FFF").on("click",l).on("mouseover",function(t,e){d3.select(this).classed("hover",!0).style("opacity",.8),T.elementMouseover({data:t,color:d3.select(this).style("fill"),percent:r(t)})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1).style("opacity",1),T.elementMouseout({data:t})}).on("mousemove",function(t,e){T.elementMousemove({data:t})}),f.each(function(t){d3.select(this).select("path").transition().duration(A).attrTween("d",a)}),k&&(f.selectAll("text").remove(),f.append("text").text(function(t){return _(t)}).transition().duration(A).attr("opacity",function(t){return i(t)?1:0}).attr("transform",function(t){var r=this.getBBox().width;if(0===t.depth)return"rotate(0)translate("+r/2*-1+",0)";var i=n(t),o=e(t);return 0===o?"rotate("+i+")translate("+(D(t.y)+5)+",0)":"rotate("+i+")translate("+(D(t.y)+r+5)+",0)rotate("+o+")"})),l(c[c.length-1]),f.exit().transition().duration(A).attr("opacity",0).each("end",function(t){var e=S(t);j[e]=void 0}).remove()}),L.renderEnd("sunburst immediate"),c}var f,d,h,p,g={top:0,right:0,bottom:0,left:0},v=600,m=600,y="count",b={count:function(t){return 1},value:function(t){return t.value||t.size},size:function(t){return t.value||t.size}},x=Math.floor(1e4*Math.random()),w=null,$=t.utils.defaultColor(),k=!1,_=function(t){return"count"===y?t.name+" #"+t.value:t.name+" "+(t.value||t.size)},M=.02,C=function(t,e){return t.name>e.name},S=function(t,e){return t.name},E=!0,A=500,T=d3.dispatch("chartClick","elementClick","elementDblClick","elementMousemove","elementMouseover","elementMouseout","renderEnd"),N=d3.scale.linear().range([0,2*Math.PI]),D=d3.scale.sqrt(),O=d3.layout.partition().sort(C),j={},I=d3.svg.arc().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,N(t.x)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,N(t.x+t.dx)))}).innerRadius(function(t){return Math.max(0,D(t.y))}).outerRadius(function(t){return Math.max(0,D(t.y+t.dy))}),L=t.utils.renderWatch(T);return c.dispatch=T,c.options=t.utils.optionsFunc.bind(c),c._options=Object.create({},{width:{get:function(){return v},set:function(t){v=t}},height:{get:function(){return m},set:function(t){m=t}},mode:{get:function(){return y},set:function(t){y=t}},id:{get:function(){return x},set:function(t){x=t}},duration:{get:function(){return A},set:function(t){A=t}},groupColorByParent:{get:function(){return E},set:function(t){E=!!t}},showLabels:{get:function(){return k},set:function(t){k=!!t}},labelFormat:{get:function(){return _},set:function(t){_=t}},labelThreshold:{get:function(){return M},set:function(t){M=t}},sort:{get:function(){return C},set:function(t){C=t}},key:{get:function(){return S},set:function(t){S=t}},margin:{get:function(){return g},set:function(t){g.top=void 0!=t.top?t.top:g.top,g.right=void 0!=t.right?t.right:g.right,g.bottom=void 0!=t.bottom?t.bottom:g.bottom,g.left=void 0!=t.left?t.left:g.left}},color:{get:function(){return $},set:function(e){$=t.utils.getColor(e)}}}),t.utils.initOptions(c),c},t.models.sunburstChart=function(){"use strict";function e(r){return h.reset(),h.models(n),r.each(function(r){var s=d3.select(this);t.utils.initSVG(s);var u=t.utils.availableWidth(o,s,i),l=t.utils.availableHeight(a,s,i);return e.update=function(){0===f?s.call(e):s.transition().duration(f).call(e)},e.container=s,r&&r.length?(s.selectAll(".nv-noData").remove(),n.width(u).height(l).margin(i),void s.call(n)):(t.utils.noData(e,s),e)}),h.renderEnd("sunburstChart immediate"),e}var n=t.models.sunburst(),r=t.models.tooltip(),i={top:30,right:20,bottom:20,left:20},o=null,a=null,s=t.utils.defaultColor(),u=!1,l=(Math.round(1e5*Math.random()),null),c=null,f=250,d=d3.dispatch("stateChange","changeState","renderEnd"),h=t.utils.renderWatch(d);return r.duration(0).headerEnabled(!1).valueFormatter(function(t){return t}),n.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:t.data.name,value:t.data.value||t.data.size,color:t.color,percent:t.percent},u||(delete t.percent,delete t.series.percent),r.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){r.hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){r()}),e.dispatch=d,e.sunburst=n,e.tooltip=r,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{noData:{get:function(){return c},set:function(t){c=t}},defaultState:{get:function(){return l},set:function(t){l=t}},showTooltipPercent:{get:function(){return u},set:function(t){u=t}},color:{get:function(){return s},set:function(t){s=t,n.color(s)}},duration:{get:function(){return f},set:function(t){f=t,h.reset(f),n.duration(f)}},margin:{get:function(){return i},set:function(t){i.top=void 0!==t.top?t.top:i.top,i.right=void 0!==t.right?t.right:i.right,i.bottom=void 0!==t.bottom?t.bottom:i.bottom,i.left=void 0!==t.left?t.left:i.left,n.margin(i)}}}),t.utils.inheritOptions(e,n),t.utils.initOptions(e),e},t.version="1.8.4"}(),function(){var t=this,e="addEventListener",n="removeEventListener",r="getBoundingClientRect",i=t.attachEvent&&!t[e],o=t.document,a=function(){for(var t,e=["","-webkit-","-moz-","-o-"],n=0;n=this.size-this.bMin-l.snapOffset&&(e=this.size-this.bMin),k.call(this,e),l.onDrag&&l.onDrag())},$=function(){var e=t.getComputedStyle(this.parent),n=this.parent[d]-parseFloat(e[v])-parseFloat(e[m]);this.size=this.a[r]()[c]+this.b[r]()[c]+this.aGutterSize+this.bGutterSize,this.percentage=Math.min(this.size/n*100,100),this.start=this.a[r]()[p]},k=function(t){this.a.style[c]=a+"("+t/this.size*this.percentage+"% - "+this.aGutterSize+"px)",this.b.style[c]=a+"("+(this.percentage-t/this.size*this.percentage)+"% - "+this.bGutterSize+"px)"},_=function(){var t=this,e=t.a,n=t.b;e[r]()[c]=0;e--)$.call(t[e]),M.call(t[e])},S=function(){return!1},E=s(u[0]).parentNode;if(!l.sizes){var A=100/u.length;for(l.sizes=[],f=0;f0&&(D={a:s(u[f-1]),b:O,aMin:l.minSize[f-1],bMin:l.minSize[f],dragging:!1,parent:E,isFirst:j,isLast:I,direction:l.direction},D.aGutterSize=l.gutterSize,D.bGutterSize=l.gutterSize,j&&(D.aGutterSize=l.gutterSize/2),I&&(D.bGutterSize=l.gutterSize/2)),i)N="string"==typeof l.sizes[f]||l.sizes[f]instanceof String?l.sizes[f]:l.sizes[f]+"%";else{if(f>0){var P=o.createElement("div");P.className=g,P.style[c]=l.gutterSize+"px",P[e]("mousedown",b.bind(D)),P[e]("touchstart",b.bind(D)),E.insertBefore(P,O),D.gutter=P}0!==f&&f!=u.length-1||(L=l.gutterSize/2),N="string"==typeof l.sizes[f]||l.sizes[f]instanceof String?l.sizes[f]:a+"("+l.sizes[f]+"% - "+L+"px)"}O.style[c]=N,f>0&&y.push(D)}C(y)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=u),exports.Split=u):t.Split=u}.call(window),function(){"use strict";function t(t,e){return t.module("angularMoment",[]).constant("angularMomentConfig",{preprocess:null,timezone:"",format:null,statefulFilters:!0}).constant("moment",e).constant("amTimeAgoConfig",{withoutSuffix:!1,serverTime:null,titleFormat:null,fullDateThreshold:null,fullDateFormat:null}).directive("amTimeAgo",["$window","moment","amMoment","amTimeAgoConfig","angularMomentConfig",function(e,n,r,i,o){return function(a,s,u){function l(){var t;if(g)t=g;else if(i.serverTime){var e=(new Date).getTime(),r=e-$+i.serverTime;t=n(r)}else t=n();return t}function c(){v&&(e.clearTimeout(v),v=null)}function f(t){var n=l().diff(t,"day"),r=x&&n>=x;if(r?s.text(t.format(w)):s.text(t.from(l(),y)),b&&!s.attr("title")&&s.attr("title",t.local().format(b)),!r){var i=Math.abs(l().diff(t,"minute")),o=3600;i<1?o=1:i<60?o=30:i<180&&(o=300),v=e.setTimeout(function(){f(t)},1e3*o)}}function d(t){M&&s.attr("datetime",t)}function h(){if(c(),p){var t=r.preprocessDate(p,k,m);f(t),d(t.toISOString())}}var p,g,v=null,m=o.format,y=i.withoutSuffix,b=i.titleFormat,x=i.fullDateThreshold,w=i.fullDateFormat,$=(new Date).getTime(),k=o.preprocess,_=u.amTimeAgo,M="TIME"===s[0].nodeName.toUpperCase();a.$watch(_,function(t){return"undefined"==typeof t||null===t||""===t?(c(),void(p&&(s.text(""),d(""),p=null))):(p=t,void h())}),t.isDefined(u.amFrom)&&a.$watch(u.amFrom,function(t){g="undefined"==typeof t||null===t||""===t?null:n(t),h()}),t.isDefined(u.amWithoutSuffix)&&a.$watch(u.amWithoutSuffix,function(t){"boolean"==typeof t?(y=t,h()):y=i.withoutSuffix}),u.$observe("amFormat",function(t){"undefined"!=typeof t&&(m=t,h())}),u.$observe("amPreprocess",function(t){k=t,h()}),u.$observe("amFullDateThreshold",function(t){x=t,h()}),u.$observe("amFullDateFormat",function(t){w=t,h()}),a.$on("$destroy",function(){c()}),a.$on("amMoment:localeChanged",function(){h()})}}]).service("amMoment",["moment","$rootScope","$log","angularMomentConfig",function(e,n,r,i){this.preprocessors={utc:e.utc,unix:e.unix},this.changeLocale=function(r,i){var o=e.locale(r,i);return t.isDefined(r)&&n.$broadcast("amMoment:localeChanged"),o},this.changeTimezone=function(t){i.timezone=t,n.$broadcast("amMoment:timezoneChanged")},this.preprocessDate=function(n,o,a){return t.isUndefined(o)&&(o=i.preprocess),this.preprocessors[o]?this.preprocessors[o](n,a):(o&&r.warn("angular-moment: Ignoring unsupported value for preprocess: "+o),!isNaN(parseFloat(n))&&isFinite(n)?e(parseInt(n,10)):e(n,a))},this.applyTimezone=function(t,e){return(e=e||i.timezone)?(e.match(/^Z|[+-]\d\d:?\d\d$/i)?t=t.utcOffset(e):t.tz?t=t.tz(e):r.warn("angular-moment: named timezone specified but moment.tz() is undefined. Did you forget to include moment-timezone.js?"),t):t}}]).filter("amCalendar",["moment","amMoment","angularMomentConfig",function(t,e,n){function r(n,r,i){if("undefined"==typeof n||null===n)return"";n=e.preprocessDate(n,r);var o=t(n);return o.isValid()?e.applyTimezone(o,i).calendar():""}return r.$stateful=n.statefulFilters,r}]).filter("amDifference",["moment","amMoment","angularMomentConfig",function(t,e,n){function r(n,r,i,o,a,s){if("undefined"==typeof n||null===n)return"";n=e.preprocessDate(n,a);var u=t(n);if(!u.isValid())return"";var l;if("undefined"==typeof r||null===r)l=t();else if(r=e.preprocessDate(r,s),l=t(r),!l.isValid())return"";return e.applyTimezone(u).diff(e.applyTimezone(l),i,o)}return r.$stateful=n.statefulFilters,r}]).filter("amDateFormat",["moment","amMoment","angularMomentConfig",function(t,e,n){function r(r,i,o,a,s){var u=s||n.format;if("undefined"==typeof r||null===r)return"";r=e.preprocessDate(r,o,u);var l=t(r);return l.isValid()?e.applyTimezone(l,a).format(i):""}return r.$stateful=n.statefulFilters,r}]).filter("amDurationFormat",["moment","angularMomentConfig",function(t,e){function n(e,n,r){return"undefined"==typeof e||null===e?"":t.duration(e,n).humanize(r)}return n.$stateful=e.statefulFilters,n}]).filter("amTimeAgo",["moment","amMoment","angularMomentConfig",function(t,e,n){function r(n,r,i,o){var a,s;return"undefined"==typeof n||null===n?"":(n=e.preprocessDate(n,r),a=t(n),a.isValid()?(s=t(o),"undefined"!=typeof o&&s.isValid()?e.applyTimezone(a).from(s,i):e.applyTimezone(a).fromNow(i)):"")}return r.$stateful=n.statefulFilters,r}]).filter("amSubtract",["moment","angularMomentConfig",function(t,e){function n(e,n,r){return"undefined"==typeof e||null===e?"":t(e).subtract(parseInt(n,10),r)}return n.$stateful=e.statefulFilters,n}]).filter("amAdd",["moment","angularMomentConfig",function(t,e){function n(e,n,r){return"undefined"==typeof e||null===e?"":t(e).add(parseInt(n,10),r)}return n.$stateful=e.statefulFilters,n}])}"function"==typeof define&&define.amd?define(["angular","moment"],t):"undefined"!=typeof module&&module&&module.exports?(t(angular,require("moment")),module.exports="angularMoment"):t(angular,("undefined"!=typeof global?global:window).moment)}(),function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a0&&(i=u.removeMin(),o=s[i],o.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return s}var o=t("../lodash"),a=t("../data/priority-queue");e.exports=r;var s=o.constant(1)},{"../data/priority-queue":16,"../lodash":20}],7:[function(t,e,n){function r(t){return i.filter(o(t),function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})}var i=t("../lodash"),o=t("./tarjan");e.exports=r},{"../lodash":20,"./tarjan":14}],8:[function(t,e,n){function r(t,e,n){return i(t,e||a,n||function(e){return t.outEdges(e)})}function i(t,e,n){var r={},i=t.nodes();return i.forEach(function(t){r[t]={},r[t][t]={distance:0},i.forEach(function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})}),n(t).forEach(function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}})}),i.forEach(function(t){var e=r[t];i.forEach(function(n){var o=r[n];i.forEach(function(n){var r=o[t],i=e[n],a=o[n],s=r.distance+i.distance;s0;){if(r=l.removeMin(),i.has(u,r))s.setEdge(r,u[r]);else{if(c)throw new Error("Input graph is not connected: "+t);c=!0}t.nodeEdges(r).forEach(n)}return s}var i=t("../lodash"),o=t("../graph"),a=t("../data/priority-queue");e.exports=r},{"../data/priority-queue":16,"../graph":17,"../lodash":20}],14:[function(t,e,n){function r(t){function e(s){var u=o[s]={onStack:!0,lowlink:n,index:n++};if(r.push(s),t.successors(s).forEach(function(t){i.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(e(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))}),u.lowlink===u.index){var l,c=[];do l=r.pop(),o[l].onStack=!1,c.push(l);while(s!==l);a.push(c)}}var n=0,r=[],o={},a=[];return t.nodes().forEach(function(t){i.has(o,t)||e(t)}),a}var i=t("../lodash");e.exports=r},{"../lodash":20}],15:[function(t,e,n){function r(t){function e(s){if(o.has(r,s))throw new i;o.has(n,s)||(r[s]=!0,n[s]=!0,o.each(t.predecessors(s),e),delete r[s],a.push(s))}var n={},r={},a=[];if(o.each(t.sinks(),e),o.size(n)!==t.nodeCount())throw new i;return a}function i(){}var o=t("../lodash");e.exports=r,r.CycleException=i},{"../lodash":20}],16:[function(t,e,n){function r(){this._arr=[],this._keyIndices={}}var i=t("../lodash");e.exports=r,r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(t){return t.key})},r.prototype.has=function(t){return i.has(this._keyIndices,t)},r.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},r.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(t,e){var n=this._keyIndices;if(t=String(t),!i.has(n,t)){var r=this._arr,o=r.length;return n[t]=o,r.push({key:t,priority:e}),this._decrease(o),!0}return!1},r.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},r.prototype.decrease=function(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)},r.prototype._heapify=function(t){var e=this._arr,n=2*t,r=n+1,i=t;n>1,!(n[e].priorityo){var a=i;i=o,o=a}return i+d+o+d+(l.isUndefined(r)?c:r)}function s(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return r&&(s.name=r),s}function u(t,e){return a(t,e.v,e.w,e.name)}var l=t("./lodash");e.exports=r;var c="\0",f="\0",d="";r.prototype._nodeCount=0,r.prototype._edgeCount=0,r.prototype.isDirected=function(){return this._isDirected},r.prototype.isMultigraph=function(){return this._isMultigraph},r.prototype.isCompound=function(){return this._isCompound},r.prototype.setGraph=function(t){return this._label=t,this},r.prototype.graph=function(){return this._label},r.prototype.setDefaultNodeLabel=function(t){return l.isFunction(t)||(t=l.constant(t)),this._defaultNodeLabelFn=t,this},r.prototype.nodeCount=function(){return this._nodeCount},r.prototype.nodes=function(){return l.keys(this._nodes)},r.prototype.sources=function(){return l.filter(this.nodes(),function(t){return l.isEmpty(this._in[t])},this)},r.prototype.sinks=function(){return l.filter(this.nodes(),function(t){return l.isEmpty(this._out[t])},this)},r.prototype.setNodes=function(t,e){var n=arguments;return l.each(t,function(t){n.length>1?this.setNode(t,e):this.setNode(t)},this),this},r.prototype.setNode=function(t,e){return l.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=f,this._children[t]={},this._children[f][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},r.prototype.node=function(t){return this._nodes[t]},r.prototype.hasNode=function(t){return l.has(this._nodes,t)},r.prototype.removeNode=function(t){var e=this;if(l.has(this._nodes,t)){var n=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],l.each(this.children(t),function(t){this.setParent(t)},this),delete this._children[t]),l.each(l.keys(this._in[t]),n),delete this._in[t],delete this._preds[t],l.each(l.keys(this._out[t]),n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},r.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(l.isUndefined(e))e=f;else{e+="";for(var n=e;!l.isUndefined(n);n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},r.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},r.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==f)return e}},r.prototype.children=function(t){if(l.isUndefined(t)&&(t=f),this._isCompound){var e=this._children[t];if(e)return l.keys(e)}else{if(t===f)return this.nodes();if(this.hasNode(t))return[]}},r.prototype.predecessors=function(t){var e=this._preds[t];if(e)return l.keys(e)},r.prototype.successors=function(t){var e=this._sucs[t];if(e)return l.keys(e)},r.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return l.union(e,this.successors(t))},r.prototype.filterNodes=function(t){function e(t){var o=r.parent(t);return void 0===o||n.hasNode(o)?(i[t]=o,o):o in i?i[o]:e(o)}var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),l.each(this._nodes,function(e,r){t(r)&&n.setNode(r,e)},this),l.each(this._edgeObjs,function(t){n.hasNode(t.v)&&n.hasNode(t.w)&&n.setEdge(t,this.edge(t))},this);var r=this,i={};return this._isCompound&&l.each(n.nodes(),function(t){n.setParent(t,e(t))}),n},r.prototype.setDefaultEdgeLabel=function(t){return l.isFunction(t)||(t=l.constant(t)),this._defaultEdgeLabelFn=t,this},r.prototype.edgeCount=function(){return this._edgeCount},r.prototype.edges=function(){return l.values(this._edgeObjs)},r.prototype.setPath=function(t,e){var n=this,r=arguments;return l.reduce(t,function(t,i){return r.length>1?n.setEdge(t,i,e):n.setEdge(t,i),i}),this},r.prototype.setEdge=function(){var t,e,n,r,o=!1,u=arguments[0];"object"==typeof u&&null!==u&&"v"in u?(t=u.v,e=u.w,n=u.name,2===arguments.length&&(r=arguments[1],o=!0)):(t=u,e=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],o=!0)),t=""+t,e=""+e,l.isUndefined(n)||(n=""+n);var c=a(this._isDirected,t,e,n);if(l.has(this._edgeLabels,c))return o&&(this._edgeLabels[c]=r),this;if(!l.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[c]=o?r:this._defaultEdgeLabelFn(t,e,n);var f=s(this._isDirected,t,e,n);return t=f.v,e=f.w,Object.freeze(f),this._edgeObjs[c]=f,i(this._preds[e],t),i(this._sucs[t],e),this._in[e][c]=f,this._out[t][c]=f,this._edgeCount++,this},r.prototype.edge=function(t,e,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):a(this._isDirected,t,e,n);return this._edgeLabels[r]},r.prototype.hasEdge=function(t,e,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):a(this._isDirected,t,e,n);return l.has(this._edgeLabels,r)},r.prototype.removeEdge=function(t,e,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):a(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],o(this._preds[e],t),o(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this},r.prototype.inEdges=function(t,e){var n=this._in[t];if(n){var r=l.values(n);return e?l.filter(r,function(t){return t.v===e}):r}},r.prototype.outEdges=function(t,e){var n=this._out[t];if(n){var r=l.values(n);return e?l.filter(r,function(t){return t.w===e}):r}},r.prototype.nodeEdges=function(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))}},{"./lodash":20}],18:[function(t,e,n){e.exports={Graph:t("./graph"),version:t("./version")}},{"./graph":17,"./version":21}],19:[function(t,e,n){function r(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:o(t)};return s.isUndefined(t.graph())||(e.value=s.clone(t.graph())),e}function i(t){return s.map(t.nodes(),function(e){var n=t.node(e),r=t.parent(e),i={v:e};return s.isUndefined(n)||(i.value=n),s.isUndefined(r)||(i.parent=r),i})}function o(t){return s.map(t.edges(),function(e){var n=t.edge(e),r={v:e.v,w:e.w};return s.isUndefined(e.name)||(r.name=e.name),s.isUndefined(n)||(r.value=n),r})}function a(t){var e=new u(t.options).setGraph(t.value);return s.each(t.nodes,function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),s.each(t.edges,function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}var s=t("./lodash"),u=t("./graph");e.exports={write:r,read:a}},{"./graph":17,"./lodash":20}],20:[function(t,e,n){var r;if("function"==typeof t)try{r=t("lodash")}catch(i){}r||(r=window._),e.exports=r},{lodash:void 0}],21:[function(t,e,n){e.exports="1.0.7"},{}]},{},[1]),function(t,e){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(n){return e(t,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}(window,function(t,e){"use strict";function n(t,e){for(var n in e)t[n]=e[n];return t}function r(t){var e=[];if(Array.isArray(t))e=t;else if("number"==typeof t.length)for(var n=0;n0;--u)if(r=e[u].dequeue()){i=i.concat(o(t,e,n,r,!0));break}}return i}function o(t,e,n,r,i){var o=i?[]:void 0;return u.each(t.inEdges(r.v),function(r){var a=t.edge(r),u=t.node(r.v);i&&o.push({v:r.v,w:r.w}),u.out-=a,s(e,n,u)}),u.each(t.outEdges(r.v),function(r){var i=t.edge(r),o=r.w,a=t.node(o);a["in"]-=i,s(e,n,a)}),t.removeNode(r.v),o}function a(t,e){var n=new l,r=0,i=0;u.each(t.nodes(),function(t){n.setNode(t,{v:t,"in":0,out:0})}),u.each(t.edges(),function(t){var o=n.edge(t.v,t.w)||0,a=e(t),s=o+a;n.setEdge(t.v,t.w,s),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w)["in"]+=a)});var o=u.range(i+r+3).map(function(){return new c}),a=r+1;return u.each(n.nodes(),function(t){s(o,a,n.node(t))}),{graph:n,buckets:o,zeroIdx:a}}function s(t,e,n){n.out?n["in"]?t[n.out-n["in"]+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}var u=t("./lodash"),l=t("./graphlib").Graph,c=t("./data/list");e.exports=r;var f=u.constant(1)},{"./data/list":5,"./graphlib":7,"./lodash":10}],9:[function(t,e,n){"use strict";function r(t,e){var n=e&&e.debugTiming?O.time:O.notime;n("layout",function(){var e=n(" buildLayoutGraph",function(){return a(t)});n(" runLayout",function(){i(e,n)}),n(" updateInputGraph",function(){o(t,e)})})}function i(t,e){e(" makeSpaceForEdgeLabels",function(){s(t)}),e(" removeSelfEdges",function(){v(t)}),e(" acyclic",function(){$.run(t)}),e(" nestingGraph.run",function(){E.run(t)}),e(" rank",function(){_(O.asNonCompoundGraph(t))}),e(" injectEdgeLabelProxies",function(){u(t)}),e(" removeEmptyRanks",function(){S(t)}),e(" nestingGraph.cleanup",function(){E.cleanup(t)}),e(" normalizeRanks",function(){M(t)}),e(" assignRankMinMax",function(){l(t)}),e(" removeEdgeLabelProxies",function(){c(t)}),e(" normalize.run",function(){k.run(t)}),e(" parentDummyChains",function(){C(t)}),e(" addBorderSegments",function(){A(t)}),e(" order",function(){N(t)}),e(" insertSelfEdges",function(){ -m(t)}),e(" adjustCoordinateSystem",function(){T.adjust(t)}),e(" position",function(){D(t)}),e(" positionSelfEdges",function(){y(t)}),e(" removeBorderNodes",function(){g(t)}),e(" normalize.undo",function(){k.undo(t)}),e(" fixupEdgeLabelCoords",function(){h(t)}),e(" undoCoordinateSystem",function(){T.undo(t)}),e(" translateGraph",function(){f(t)}),e(" assignNodeIntersects",function(){d(t)}),e(" reversePoints",function(){p(t)}),e(" acyclic.undo",function(){$.undo(t)})}function o(t,e){w.each(t.nodes(),function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height))}),w.each(t.edges(),function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,w.has(i,"x")&&(r.x=i.x,r.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}function a(t){var e=new j({multigraph:!0,compound:!0}),n=x(t.graph());return e.setGraph(w.merge({},L,b(n,I),w.pick(n,P))),w.each(t.nodes(),function(n){var r=x(t.node(n));e.setNode(n,w.defaults(b(r,F),q)),e.setParent(n,t.parent(n))}),w.each(t.edges(),function(n){var r=x(t.edge(n));e.setEdge(n,w.merge({},W,b(r,z),w.pick(r,R)))}),e}function s(t){var e=t.graph();e.ranksep/=2,w.each(t.edges(),function(n){var r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function u(t){w.each(t.edges(),function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i=t.node(e.w),o={rank:(i.rank-r.rank)/2+r.rank,e:e};O.addDummyNode(t,"edge-proxy",o,"_ep")}})}function l(t){var e=0;w.each(t.nodes(),function(n){var r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=w.max(e,r.maxRank))}),t.graph().maxRank=e}function c(t){w.each(t.nodes(),function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}function f(t){function e(t){var e=t.x,a=t.y,s=t.width,u=t.height;n=Math.min(n,e-s/2),r=Math.max(r,e+s/2),i=Math.min(i,a-u/2),o=Math.max(o,a+u/2)}var n=Number.POSITIVE_INFINITY,r=0,i=Number.POSITIVE_INFINITY,o=0,a=t.graph(),s=a.marginx||0,u=a.marginy||0;w.each(t.nodes(),function(n){e(t.node(n))}),w.each(t.edges(),function(n){var r=t.edge(n);w.has(r,"x")&&e(r)}),n-=s,i-=u,w.each(t.nodes(),function(e){var r=t.node(e);r.x-=n,r.y-=i}),w.each(t.edges(),function(e){var r=t.edge(e);w.each(r.points,function(t){t.x-=n,t.y-=i}),w.has(r,"x")&&(r.x-=n),w.has(r,"y")&&(r.y-=i)}),a.width=r-n+s,a.height=o-i+u}function d(t){w.each(t.edges(),function(e){var n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(O.intersectRect(o,n)),i.points.push(O.intersectRect(a,r))})}function h(t){w.each(t.edges(),function(e){var n=t.edge(e);if(w.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}function p(t){w.each(t.edges(),function(e){var n=t.edge(e);n.reversed&&n.points.reverse()})}function g(t){w.each(t.nodes(),function(e){if(t.children(e).length){var n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),o=t.node(w.last(n.borderLeft)),a=t.node(w.last(n.borderRight));n.width=Math.abs(a.x-o.x),n.height=Math.abs(i.y-r.y),n.x=o.x+n.width/2,n.y=r.y+n.height/2}}),w.each(t.nodes(),function(e){"border"===t.node(e).dummy&&t.removeNode(e)})}function v(t){w.each(t.edges(),function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}function m(t){var e=O.buildLayerMatrix(t);w.each(e,function(e){var n=0;w.each(e,function(e,r){var i=t.node(e);i.order=r+n,w.each(i.selfEdges,function(e){O.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")}),delete i.selfEdges})})}function y(t){w.each(t.nodes(),function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{x:i+a,y:o},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}})}function b(t,e){return w.mapValues(w.pick(t,e),Number)}function x(t){var e={};return w.each(t,function(t,n){e[n.toLowerCase()]=t}),e}var w=t("./lodash"),$=t("./acyclic"),k=t("./normalize"),_=t("./rank"),M=t("./util").normalizeRanks,C=t("./parent-dummy-chains"),S=t("./util").removeEmptyRanks,E=t("./nesting-graph"),A=t("./add-border-segments"),T=t("./coordinate-system"),N=t("./order"),D=t("./position"),O=t("./util"),j=t("./graphlib").Graph;e.exports=r;var I=["nodesep","edgesep","ranksep","marginx","marginy"],L={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},P=["acyclicer","ranker","rankdir","align"],F=["width","height"],q={width:0,height:0},z=["minlen","weight","width","height","labeloffset"],W={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},R=["labelpos"]},{"./acyclic":2,"./add-border-segments":3,"./coordinate-system":4,"./graphlib":7,"./lodash":10,"./nesting-graph":11,"./normalize":12,"./order":17,"./parent-dummy-chains":22,"./position":24,"./rank":26,"./util":29}],10:[function(t,e,n){var r;if("function"==typeof t)try{r=t("lodash")}catch(i){}r||(r=window._),e.exports=r},{lodash:void 0}],11:[function(t,e,n){function r(t){var e=l.addDummyNode(t,"root",{},"_root"),n=o(t),r=u.max(n)-1,s=2*r+1;t.graph().nestingRoot=e,u.each(t.edges(),function(e){t.edge(e).minlen*=s});var c=a(t)+1;u.each(t.children(),function(o){i(t,e,s,c,r,n,o)}),t.graph().nodeRankFactor=s}function i(t,e,n,r,o,a,s){var c=t.children(s);if(!c.length)return void(s!==e&&t.setEdge(e,s,{weight:0,minlen:n}));var f=l.addBorderNode(t,"_bt"),d=l.addBorderNode(t,"_bb"),h=t.node(s);t.setParent(f,s),h.borderTop=f,t.setParent(d,s),h.borderBottom=d,u.each(c,function(u){i(t,e,n,r,o,a,u);var l=t.node(u),c=l.borderTop?l.borderTop:u,h=l.borderBottom?l.borderBottom:u,p=l.borderTop?r:2*r,g=c!==h?1:o-a[s]+1;t.setEdge(f,c,{weight:p,minlen:g,nestingEdge:!0}),t.setEdge(h,d,{weight:p,minlen:g,nestingEdge:!0})}),t.parent(s)||t.setEdge(e,f,{weight:0,minlen:o+a[s]})}function o(t){function e(r,i){var o=t.children(r);o&&o.length&&u.each(o,function(t){e(t,i+1)}),n[r]=i}var n={};return u.each(t.children(),function(t){e(t,1)}),n}function a(t){return u.reduce(t.edges(),function(e,n){return e+t.edge(n).weight},0)}function s(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,u.each(t.edges(),function(e){var n=t.edge(e);n.nestingEdge&&t.removeEdge(e)})}var u=t("./lodash"),l=t("./util");e.exports={run:r,cleanup:s}},{"./lodash":10,"./util":29}],12:[function(t,e,n){"use strict";function r(t){t.graph().dummyChains=[],a.each(t.edges(),function(e){i(t,e)})}function i(t,e){var n=e.v,r=t.node(n).rank,i=e.w,o=t.node(i).rank,a=e.name,u=t.edge(e),l=u.labelRank;if(o!==r+1){t.removeEdge(e);var c,f,d;for(d=0,++r;r0;)e%2&&(n+=u[e+1]),e=e-1>>1,u[e]+=t.weight;l+=t.weight*n})),l}var o=t("../lodash");e.exports=r},{"../lodash":10}],17:[function(t,e,n){"use strict";function r(t){var e=p.maxRank(t),n=i(t,s.range(1,e+1),"inEdges"),r=i(t,s.range(e-1,-1,-1),"outEdges"),c=u(t);a(t,c);for(var f,d=Number.POSITIVE_INFINITY,h=0,g=0;g<4;++h,++g){o(h%2?n:r,h%4>=2),c=p.buildLayerMatrix(t);var v=l(t,c);v=t.barycenter)&&o(t,e)}}function n(e){return function(n){n["in"].push(e),0===--n.indegree&&t.push(n)}}for(var r=[];t.length;){var i=t.pop();r.push(i),a.each(i["in"].reverse(),e(i)),a.each(i.out,n(i))}return a.chain(r).filter(function(t){return!t.merged}).map(function(t){return a.pick(t,["vs","i","barycenter","weight"])}).value()}function o(t,e){var n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}var a=t("../lodash");e.exports=r},{"../lodash":10}],20:[function(t,e,n){function r(t,e,n,c){var f=t.children(e),d=t.node(e),h=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,g={};h&&(f=a.filter(f,function(t){return t!==h&&t!==p}));var v=s(t,f);a.each(v,function(e){if(t.children(e.v).length){var i=r(t,e.v,n,c);g[e.v]=i,a.has(i,"barycenter")&&o(e,i)}});var m=u(v,n);i(m,g);var y=l(m,c);if(h&&(y.vs=a.flatten([h,y.vs,p],!0),t.predecessors(h).length)){var b=t.node(t.predecessors(h)[0]),x=t.node(t.predecessors(p)[0]);a.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+b.order+x.order)/(y.weight+2),y.weight+=2}return y}function i(t,e){a.each(t,function(t){t.vs=a.flatten(t.vs.map(function(t){return e[t]?e[t].vs:t}),!0)})}function o(t,e){a.isUndefined(t.barycenter)?(t.barycenter=e.barycenter,t.weight=e.weight):(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight)}var a=t("../lodash"),s=t("./barycenter"),u=t("./resolve-conflicts"),l=t("./sort");e.exports=r},{"../lodash":10,"./barycenter":14,"./resolve-conflicts":19,"./sort":21}],21:[function(t,e,n){function r(t,e){var n=s.partition(t,function(t){return a.has(t,"barycenter")}),r=n.lhs,u=a.sortBy(n.rhs,function(t){return-t.i}),l=[],c=0,f=0,d=0;r.sort(o(!!e)),d=i(l,u,d),a.each(r,function(t){d+=t.vs.length,l.push(t.vs),c+=t.barycenter*t.weight,f+=t.weight,d=i(l,u,d)});var h={vs:a.flatten(l,!0)};return f&&(h.barycenter=c/f,h.weight=f),h}function i(t,e,n){for(var r;e.length&&(r=a.last(e)).i<=n;)e.pop(),t.push(r.vs),n++;return n}function o(t){return function(e,n){return e.barycentern.barycenter?1:t?n.i-e.i:e.i-n.i}}var a=t("../lodash"),s=t("../util");e.exports=r},{"../lodash":10,"../util":29}],22:[function(t,e,n){function r(t){var e=o(t);a.each(t.graph().dummyChains,function(n){for(var r=t.node(n),o=r.edgeObj,a=i(t,e,o.v,o.w),s=a.path,u=a.lca,l=0,c=s[l],f=!0;n!==o.w;){if(r=t.node(n),f){for(;(c=s[l])!==u&&t.node(c).maxRanku||l>e[i].lim));for(o=i,i=r;(i=t.parent(i))!==o;)s.push(i);return{path:a.concat(s.reverse()),lca:o}}function o(t){function e(i){var o=r;a.each(t.children(i),e),n[i]={low:o,lim:r++}}var n={},r=0;return a.each(t.children(),e),n}var a=t("./lodash");e.exports=r},{"./lodash":10}],23:[function(t,e,n){"use strict";function r(t,e){function n(e,n){var i=0,s=0,u=e.length,l=m.last(n);return m.each(n,function(e,c){var f=o(t,e),d=f?t.node(f).order:u;(f||e===l)&&(m.each(n.slice(s,c+1),function(e){m.each(t.predecessors(e),function(n){var o=t.node(n),s=o.order;!(ss)&&a(i,e,u)})})}function r(e,r){var i,o=-1,a=0;return m.each(r,function(s,u){if("border"===t.node(s).dummy){var l=t.predecessors(s);l.length&&(i=t.node(l[0]).order,n(r,a,u,o,i),a=u,o=i)}n(r,a,r.length,i,e.length)}),r}var i={};return m.reduce(e,r),i}function o(t,e){if(t.node(e).dummy)return m.find(t.predecessors(e),function(e){return t.node(e).dummy})}function a(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function s(t,e,n){if(e>n){var r=e;e=n,n=r}return m.has(t[e],n)}function u(t,e,n,r){var i={},o={},a={};return m.each(e,function(t){m.each(t,function(t,e){i[t]=t,o[t]=t,a[t]=e})}),m.each(e,function(t){var e=-1;m.each(t,function(t){var u=r(t);if(u.length){u=m.sortBy(u,function(t){return a[t]});for(var l=(u.length-1)/2,c=Math.floor(l),f=Math.ceil(l);c<=f;++c){var d=u[c];o[t]===t&&ea.lim&&(s=a,u=!0);var l=g.filter(e.edges(),function(e){return u===p(t,t.node(e.v),s)&&u!==p(t,t.node(e.w),s)});return g.min(l,function(t){return m(e,t)})}function f(t,e,n,r){var o=n.v,a=n.w;t.removeEdge(o,a),t.setEdge(r.v,r.w,{}),s(t),i(t,e),d(t,e)}function d(t,e){var n=g.find(t.nodes(),function(t){return!e.node(t).parent}),r=b(t,n);r=r.slice(1),g.each(r,function(n){var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)})}function h(t,e,n){return t.hasEdge(e,n)}function p(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}var g=t("../lodash"),v=t("./feasible-tree"),m=t("./util").slack,y=t("./util").longestPath,b=t("../graphlib").alg.preorder,x=t("../graphlib").alg.postorder,w=t("../util").simplify;e.exports=r,r.initLowLimValues=s,r.initCutValues=i,r.calcCutValue=a,r.leaveEdge=l,r.enterEdge=c,r.exchangeEdges=f},{"../graphlib":7,"../lodash":10,"../util":29,"./feasible-tree":25,"./util":28}],28:[function(t,e,n){"use strict";function r(t){function e(r){var i=t.node(r);if(o.has(n,r))return i.rank;n[r]=!0;var a=o.min(o.map(t.outEdges(r),function(n){return e(n.w)-t.edge(n).minlen}));return a===Number.POSITIVE_INFINITY&&(a=0),i.rank=a}var n={};o.each(t.sources(),e)}function i(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}var o=t("../lodash");e.exports={longestPath:r,slack:i}},{"../lodash":10}],29:[function(t,e,n){"use strict";function r(t,e,n,r){var i;do i=m.uniqueId(r);while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i}function i(t){var e=(new y).setGraph(t.graph());return m.each(t.nodes(),function(n){e.setNode(n,t.node(n))}),m.each(t.edges(),function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),e}function o(t){var e=new y({multigraph:t.isMultigraph()}).setGraph(t.graph());return m.each(t.nodes(),function(n){t.children(n).length||e.setNode(n,t.node(n))}),m.each(t.edges(),function(n){e.setEdge(n,t.edge(n))}),e}function a(t){var e=m.map(t.nodes(),function(e){var n={};return m.each(t.outEdges(e),function(e){n[e.w]=(n[e.w]||0)+t.edge(e).weight}),n});return m.zipObject(t.nodes(),e)}function s(t){var e=m.map(t.nodes(),function(e){var n={};return m.each(t.inEdges(e),function(e){n[e.v]=(n[e.v]||0)+t.edge(e).weight}),n});return m.zipObject(t.nodes(),e)}function u(t,e){var n=t.x,r=t.y,i=e.x-n,o=e.y-r,a=t.width/2,s=t.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var u,l;return Math.abs(o)*a>Math.abs(i)*s?(o<0&&(s=-s),u=s*i/o,l=s):(i<0&&(a=-a),u=a,l=a*o/i),{x:n+u,y:r+l}}function l(t){var e=m.map(m.range(h(t)+1),function(){return[]});return m.each(t.nodes(),function(n){var r=t.node(n),i=r.rank;m.isUndefined(i)||(e[i][r.order]=n)}),e}function c(t){var e=m.min(m.map(t.nodes(),function(e){return t.node(e).rank}));m.each(t.nodes(),function(n){var r=t.node(n);m.has(r,"rank")&&(r.rank-=e)})}function f(t){var e=m.min(m.map(t.nodes(),function(e){return t.node(e).rank})),n=[];m.each(t.nodes(),function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=t.graph().nodeRankFactor;m.each(n,function(e,n){m.isUndefined(e)&&n%i!==0?--r:r&&m.each(e,function(e){t.node(e).rank+=r})})}function d(t,e,n,i){var o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=i),r(t,"border",o,e)}function h(t){return m.max(m.map(t.nodes(),function(e){var n=t.node(e).rank;if(!m.isUndefined(n))return n}))}function p(t,e){var n={lhs:[],rhs:[]};return m.each(t,function(t){e(t)?n.lhs.push(t):n.rhs.push(t)}),n}function g(t,e){var n=m.now();try{return e()}finally{console.log(t+" time: "+(m.now()-n)+"ms")}}function v(t,e){return e()}var m=t("./lodash"),y=t("./graphlib").Graph;e.exports={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:a,predecessorWeights:s,intersectRect:u,buildLayerMatrix:l,normalizeRanks:c,removeEmptyRanks:f,addBorderNode:d,maxRank:h,partition:p,time:g,notime:v}},{"./graphlib":7,"./lodash":10}],30:[function(t,e,n){e.exports="0.7.4"},{}]},{},[1])(1)}),function(t,e,n){!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):jQuery&&!jQuery.fn.qtip&&t(jQuery)}(function(r){"use strict";function i(t,e,n,i){this.id=n,this.target=t,this.tooltip=N,this.elements={target:t},this._id=V+"-"+n,this.timers={img:{}},this.options=e,this.plugins={},this.cache={event:{},target:r(),disabled:T,attr:i,onTooltip:T,lastClass:""},this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=T}function o(t){return t===N||"object"!==r.type(t)}function a(t){return!(r.isFunction(t)||t&&t.attr||t.length||"object"===r.type(t)&&(t.jquery||t.then))}function s(t){var e,n,i,s;return o(t)?T:(o(t.metadata)&&(t.metadata={type:t.metadata}),"content"in t&&(e=t.content,o(e)||e.jquery||e.done?e=t.content={text:n=a(e)?T:e}:n=e.text,"ajax"in e&&(i=e.ajax,s=i&&i.once!==T,delete e.ajax,e.text=function(t,e){var o=n||r(this).attr(e.options.content.attr)||"Loading...",a=r.ajax(r.extend({},i,{context:e})).then(i.success,N,i.error).then(function(t){return t&&s&&e.set("content.text",t),t},function(t,n,r){e.destroyed||0===t.status||e.set("content.text",n+": "+r)});return s?o:(e.set("content.text",o),a)}),"title"in e&&(r.isPlainObject(e.title)&&(e.button=e.title.button,e.title=e.title.text),a(e.title||T)&&(e.title=T))),"position"in t&&o(t.position)&&(t.position={my:t.position,at:t.position}),"show"in t&&o(t.show)&&(t.show=t.show.jquery?{target:t.show}:t.show===A?{ready:A}:{event:t.show}),"hide"in t&&o(t.hide)&&(t.hide=t.hide.jquery?{target:t.hide}:{event:t.hide}),"style"in t&&o(t.style)&&(t.style={classes:t.style}),r.each(B,function(){this.sanitize&&this.sanitize(t)}),t)}function u(t,e){for(var n,r=0,i=t,o=e.split(".");i=i[o[r++]];)r0?setTimeout(r.proxy(t,this),e):void t.call(this)}function d(t){this.tooltip.hasClass(tt)||(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this.timers.show=f.call(this,function(){this.toggle(A,t)},this.options.show.delay))}function h(t){if(!this.tooltip.hasClass(tt)&&!this.destroyed){var e=r(t.relatedTarget),n=e.closest(G)[0]===this.tooltip[0],i=e[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==e[0]&&"mouse"===this.options.position.target&&n||this.options.hide.fixed&&/mouse(out|leave|move)/.test(t.type)&&(n||i))try{t.preventDefault(),t.stopImmediatePropagation()}catch(o){}else this.timers.hide=f.call(this,function(){this.toggle(T,t)},this.options.hide.delay,this)}}function p(t){!this.tooltip.hasClass(tt)&&this.options.hide.inactive&&(clearTimeout(this.timers.inactive),this.timers.inactive=f.call(this,function(){this.hide(t)},this.options.hide.inactive))}function g(t){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(t)}function v(t,n,i){r(e.body).delegate(t,(n.split?n:n.join("."+V+" "))+"."+V,function(){var t=_.api[r.attr(this,U)];t&&!t.disabled&&i.apply(t,arguments)})}function m(t,n,o){var a,u,l,c,f,d=r(e.body),h=t[0]===e?d:t,p=t.metadata?t.metadata(o.metadata):N,g="html5"===o.metadata.type&&p?p[o.metadata.name]:N,v=t.data(o.metadata.name||"qtipopts");try{v="string"==typeof v?r.parseJSON(v):v}catch(m){}if(c=r.extend(A,{},_.defaults,o,"object"==typeof v?s(v):N,s(g||p)),u=c.position,c.id=n,"boolean"==typeof c.content.text){if(l=t.attr(c.content.attr),c.content.attr===T||!l)return T;c.content.text=l}if(u.container.length||(u.container=d),u.target===T&&(u.target=h),c.show.target===T&&(c.show.target=h),c.show.solo===A&&(c.show.solo=u.container.closest("body")),c.hide.target===T&&(c.hide.target=h),c.position.viewport===A&&(c.position.viewport=u.container),u.container=u.container.eq(0),u.at=new C(u.at,A),u.my=new C(u.my),t.data(V))if(c.overwrite)t.qtip("destroy",!0);else if(c.overwrite===T)return T;return t.attr(H,n),c.suppress&&(f=t.attr("title"))&&t.removeAttr("title").attr(nt,f).attr("title",""),a=new i(t,c,n,(!!l)),t.data(V,a),a}function y(t){return t.charAt(0).toUpperCase()+t.slice(1)}function b(t,e){var r,i,o=e.charAt(0).toUpperCase()+e.slice(1),a=(e+" "+mt.join(o+" ")+o).split(" "),s=0;if(vt[e])return t.css(vt[e]);for(;r=a[s++];)if((i=t.css(r))!==n)return vt[e]=r,i}function x(t,e){return Math.ceil(parseFloat(b(t,e)))}function w(t,e){this._ns="tip",this.options=e,this.offset=e.offset,this.size=[e.width,e.height],this.init(this.qtip=t)}function $(t,e){this.options=e,this._ns="-modal",this.init(this.qtip=t)}function k(t,e){this._ns="ie6",this.init(this.qtip=t)}var _,M,C,S,E,A=!0,T=!1,N=null,D="x",O="y",j="width",I="height",L="top",P="left",F="bottom",q="right",z="center",W="flipinvert",R="shift",B={},V="qtip",H="data-hasqtip",U="data-qtip-id",Y=["ui-widget","ui-tooltip"],G="."+V,X="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),Z=V+"-fixed",Q=V+"-default",K=V+"-focus",J=V+"-hover",tt=V+"-disabled",et="_replacedByqTip",nt="oldtitle",rt={ie:function(){for(var t=4,n=e.createElement("div");(n.innerHTML="")&&n.getElementsByTagName("i")[0];t+=1);return t>4?t:NaN}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||T};M=i.prototype,M._when=function(t){return r.when.apply(r,t)},M.render=function(t){if(this.rendered||this.destroyed)return this;var e,n=this,i=this.options,o=this.cache,a=this.elements,s=i.content.text,u=i.content.title,l=i.content.button,c=i.position,f=("."+this._id+" ",[]);return r.attr(this.target[0],"aria-describedby",this._id),o.posClass=this._createPosClass((this.position={my:c.my,at:c.at}).my),this.tooltip=a.tooltip=e=r("
",{id:this._id,"class":[V,Q,i.style.classes,o.posClass].join(" "),width:i.style.width||"",height:i.style.height||"",tracking:"mouse"===c.target&&c.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":T,"aria-describedby":this._id+"-content","aria-hidden":A}).toggleClass(tt,this.disabled).attr(U,this.id).data(V,this).appendTo(c.container).append(a.content=r("
",{"class":V+"-content",id:this._id+"-content","aria-atomic":A})),this.rendered=-1,this.positioning=A,u&&(this._createTitle(),r.isFunction(u)||f.push(this._updateTitle(u,T))),l&&this._createButton(),r.isFunction(s)||f.push(this._updateContent(s,T)),this.rendered=A,this._setWidget(),r.each(B,function(t){var e;"render"===this.initialize&&(e=this(n))&&(n.plugins[t]=e)}),this._unassignEvents(),this._assignEvents(),this._when(f).then(function(){n._trigger("render"),n.positioning=T,n.hiddenDuringWait||!i.show.ready&&!t||n.toggle(A,o.event,T),n.hiddenDuringWait=T}),_.api[this.id]=this,this},M.destroy=function(t){function e(){if(!this.destroyed){this.destroyed=A;var t,e=this.target,n=e.attr(nt);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove(),r.each(this.plugins,function(t){ -this.destroy&&this.destroy()});for(t in this.timers)clearTimeout(this.timers[t]);e.removeData(V).removeAttr(U).removeAttr(H).removeAttr("aria-describedby"),this.options.suppress&&n&&e.attr("title",n).removeAttr(nt),this._unassignEvents(),this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=N,delete _.api[this.id]}}return this.destroyed?this.target:(t===A&&"hide"!==this.triggering||!this.rendered?e.call(this):(this.tooltip.one("tooltiphidden",r.proxy(e,this)),!this.triggering&&this.hide()),this.target)},S=M.checks={builtin:{"^id$":function(t,e,n,i){var o=n===A?_.nextid:n,a=V+"-"+o;o!==T&&o.length>0&&!r("#"+a).length?(this._id=a,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):t[e]=i},"^prerender":function(t,e,n){n&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(t,e,n){this._updateContent(n)},"^content.attr$":function(t,e,n,r){this.options.content.text===this.target.attr(r)&&this._updateContent(this.target.attr(n))},"^content.title$":function(t,e,n){return n?(n&&!this.elements.title&&this._createTitle(),void this._updateTitle(n)):this._removeTitle()},"^content.button$":function(t,e,n){this._updateButton(n)},"^content.title.(text|button)$":function(t,e,n){this.set("content."+e,n)},"^position.(my|at)$":function(t,e,n){"string"==typeof n&&(this.position[e]=t[e]=new C(n,"at"===e))},"^position.container$":function(t,e,n){this.rendered&&this.tooltip.appendTo(n)},"^show.ready$":function(t,e,n){n&&(!this.rendered&&this.render(A)||this.toggle(A))},"^style.classes$":function(t,e,n,r){this.rendered&&this.tooltip.removeClass(r).addClass(n)},"^style.(width|height)":function(t,e,n){this.rendered&&this.tooltip.css(e,n)},"^style.widget|content.title":function(){this.rendered&&this._setWidget()},"^style.def":function(t,e,n){this.rendered&&this.tooltip.toggleClass(Q,!!n)},"^events.(render|show|move|hide|focus|blur)$":function(t,e,n){this.rendered&&this.tooltip[(r.isFunction(n)?"":"un")+"bind"]("tooltip"+e,n)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){if(this.rendered){var t=this.options.position;this.tooltip.attr("tracking","mouse"===t.target&&t.adjust.mouse),this._unassignEvents(),this._assignEvents()}}}},M.get=function(t){if(this.destroyed)return this;var e=u(this.options,t.toLowerCase()),n=e[0][e[1]];return n.precedance?n.string():n};var it=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,ot=/^prerender|show\.ready/i;M.set=function(t,e){if(this.destroyed)return this;var n,i=this.rendered,o=T,a=this.options;this.checks;return"string"==typeof t?(n=t,t={},t[n]=e):t=r.extend({},t),r.each(t,function(e,n){if(i&&ot.test(e))return void delete t[e];var s,l=u(a,e.toLowerCase());s=l[0][l[1]],l[0][l[1]]=n&&n.nodeType?r(n):n,o=it.test(e)||o,t[e]=[l[0],l[1],n,s]}),s(a),this.positioning=A,r.each(t,r.proxy(l,this)),this.positioning=T,this.rendered&&this.tooltip[0].offsetWidth>0&&o&&this.reposition("mouse"===a.position.target?N:this.cache.event),this},M._update=function(t,e,n){var i=this,o=this.cache;return this.rendered&&t?(r.isFunction(t)&&(t=t.call(this.elements.target,o.event,this)||""),r.isFunction(t.then)?(o.waiting=A,t.then(function(t){return o.waiting=T,i._update(t,e)},N,function(t){return i._update(t,e)})):t===T||!t&&""!==t?T:(t.jquery&&t.length>0?e.empty().append(t.css({display:"block",visibility:"visible"})):e.html(t),this._waitForContent(e).then(function(t){i.rendered&&i.tooltip[0].offsetWidth>0&&i.reposition(o.event,!t.length)}))):T},M._waitForContent=function(t){var e=this.cache;return e.waiting=A,(r.fn.imagesLoaded?t.imagesLoaded():r.Deferred().resolve([])).done(function(){e.waiting=T}).promise()},M._updateContent=function(t,e){this._update(t,this.elements.content,e)},M._updateTitle=function(t,e){this._update(t,this.elements.title,e)===T&&this._removeTitle(T)},M._createTitle=function(){var t=this.elements,e=this._id+"-title";t.titlebar&&this._removeTitle(),t.titlebar=r("
",{"class":V+"-titlebar "+(this.options.style.widget?c("header"):"")}).append(t.title=r("
",{id:e,"class":V+"-title","aria-atomic":A})).insertBefore(t.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(t){r(this).toggleClass("ui-state-active ui-state-focus","down"===t.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(t){r(this).toggleClass("ui-state-hover","mouseover"===t.type)}),this.options.content.button&&this._createButton()},M._removeTitle=function(t){var e=this.elements;e.title&&(e.titlebar.remove(),e.titlebar=e.title=e.button=N,t!==T&&this.reposition())},M._createPosClass=function(t){return V+"-pos-"+(t||this.options.position.my).abbrev()},M.reposition=function(n,i){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=A;var o,a,s,u,l=this.cache,c=this.tooltip,f=this.options.position,d=f.target,h=f.my,p=f.at,g=f.viewport,v=f.container,m=f.adjust,y=m.method.split(" "),b=c.outerWidth(T),x=c.outerHeight(T),w=0,$=0,k=c.css("position"),_={left:0,top:0},M=c[0].offsetWidth>0,C=n&&"scroll"===n.type,S=r(t),E=v[0].ownerDocument,N=this.mouse;if(r.isArray(d)&&2===d.length)p={x:P,y:L},_={left:d[0],top:d[1]};else if("mouse"===d)p={x:P,y:L},(!m.mouse||this.options.hide.distance)&&l.origin&&l.origin.pageX?n=l.origin:!n||n&&("resize"===n.type||"scroll"===n.type)?n=l.event:N&&N.pageX&&(n=N),"static"!==k&&(_=v.offset()),E.body.offsetWidth!==(t.innerWidth||E.documentElement.clientWidth)&&(a=r(e.body).offset()),_={left:n.pageX-_.left+(a&&a.left||0),top:n.pageY-_.top+(a&&a.top||0)},m.mouse&&C&&N&&(_.left-=(N.scrollX||0)-S.scrollLeft(),_.top-=(N.scrollY||0)-S.scrollTop());else{if("event"===d?n&&n.target&&"scroll"!==n.type&&"resize"!==n.type?l.target=r(n.target):n.target||(l.target=this.elements.target):"event"!==d&&(l.target=r(d.jquery?d:this.elements.target)),d=l.target,d=r(d).eq(0),0===d.length)return this;d[0]===e||d[0]===t?(w=rt.iOS?t.innerWidth:d.width(),$=rt.iOS?t.innerHeight:d.height(),d[0]===t&&(_={top:(g||d).scrollTop(),left:(g||d).scrollLeft()})):B.imagemap&&d.is("area")?o=B.imagemap(this,d,p,B.viewport?y:T):B.svg&&d&&d[0].ownerSVGElement?o=B.svg(this,d,p,B.viewport?y:T):(w=d.outerWidth(T),$=d.outerHeight(T),_=d.offset()),o&&(w=o.width,$=o.height,a=o.offset,_=o.position),_=this.reposition.offset(d,_,v),(rt.iOS>3.1&&rt.iOS<4.1||rt.iOS>=4.3&&rt.iOS<4.33||!rt.iOS&&"fixed"===k)&&(_.left-=S.scrollLeft(),_.top-=S.scrollTop()),(!o||o&&o.adjustable!==T)&&(_.left+=p.x===q?w:p.x===z?w/2:0,_.top+=p.y===F?$:p.y===z?$/2:0)}return _.left+=m.x+(h.x===q?-b:h.x===z?-b/2:0),_.top+=m.y+(h.y===F?-x:h.y===z?-x/2:0),B.viewport?(s=_.adjusted=B.viewport(this,_,f,w,$,b,x),a&&s.left&&(_.left+=a.left),a&&s.top&&(_.top+=a.top),s.my&&(this.position.my=s.my)):_.adjusted={left:0,top:0},l.posClass!==(u=this._createPosClass(this.position.my))&&c.removeClass(l.posClass).addClass(l.posClass=u),this._trigger("move",[_,g.elem||g],n)?(delete _.adjusted,i===T||!M||isNaN(_.left)||isNaN(_.top)||"mouse"===d||!r.isFunction(f.effect)?c.css(_):r.isFunction(f.effect)&&(f.effect.call(c,this,r.extend({},_)),c.queue(function(t){r(this).css({opacity:"",height:""}),rt.ie&&this.style.removeAttribute("filter"),t()})),this.positioning=T,this):this},M.reposition.offset=function(t,n,i){function o(t,e){n.left+=e*t.scrollLeft(),n.top+=e*t.scrollTop()}if(!i[0])return n;var a,s,u,l,c=r(t[0].ownerDocument),f=!!rt.ie&&"CSS1Compat"!==e.compatMode,d=i[0];do"static"!==(s=r.css(d,"position"))&&("fixed"===s?(u=d.getBoundingClientRect(),o(c,-1)):(u=r(d).position(),u.left+=parseFloat(r.css(d,"borderLeftWidth"))||0,u.top+=parseFloat(r.css(d,"borderTopWidth"))||0),n.left-=u.left+(parseFloat(r.css(d,"marginLeft"))||0),n.top-=u.top+(parseFloat(r.css(d,"marginTop"))||0),a||"hidden"===(l=r.css(d,"overflow"))||"visible"===l||(a=r(d)));while(d=d.offsetParent);return a&&(a[0]!==c[0]||f)&&o(a,1),n};var at=(C=M.reposition.Corner=function(t,e){t=(""+t).replace(/([A-Z])/," $1").replace(/middle/gi,z).toLowerCase(),this.x=(t.match(/left|right/i)||t.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(t.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.forceY=!!e;var n=t.charAt(0);this.precedance="t"===n||"b"===n?O:D}).prototype;at.invert=function(t,e){this[t]=this[t]===P?q:this[t]===q?P:e||this[t]},at.string=function(t){var e=this.x,n=this.y,r=e!==n?"center"===e||"center"!==n&&(this.precedance===O||this.forceY)?[n,e]:[e,n]:[e];return t!==!1?r.join(" "):r},at.abbrev=function(){var t=this.string(!1);return t[0].charAt(0)+(t[1]&&t[1].charAt(0)||"")},at.clone=function(){return new C(this.string(),this.forceY)},M.toggle=function(t,n){var i=this.cache,o=this.options,a=this.tooltip;if(n){if(/over|enter/.test(n.type)&&i.event&&/out|leave/.test(i.event.type)&&o.show.target.add(n.target).length===o.show.target.length&&a.has(n.relatedTarget).length)return this;i.event=r.event.fix(n)}if(this.waiting&&!t&&(this.hiddenDuringWait=A),!this.rendered)return t?this.render(1):this;if(this.destroyed||this.disabled)return this;var s,u,l,c=t?"show":"hide",f=this.options[c],d=(this.options[t?"hide":"show"],this.options.position),h=this.options.content,p=this.tooltip.css("width"),g=this.tooltip.is(":visible"),v=t||1===f.target.length,m=!n||f.target.length<2||i.target[0]===n.target;return(typeof t).search("boolean|number")&&(t=!g),s=!a.is(":animated")&&g===t&&m,u=s?N:!!this._trigger(c,[90]),this.destroyed?this:(u!==T&&t&&this.focus(n),!u||s?this:(r.attr(a[0],"aria-hidden",!t),t?(this.mouse&&(i.origin=r.event.fix(this.mouse)),r.isFunction(h.text)&&this._updateContent(h.text,T),r.isFunction(h.title)&&this._updateTitle(h.title,T),!E&&"mouse"===d.target&&d.adjust.mouse&&(r(e).bind("mousemove."+V,this._storeMouse),E=A),p||a.css("width",a.outerWidth(T)),this.reposition(n,arguments[2]),p||a.css("width",""),f.solo&&("string"==typeof f.solo?r(f.solo):r(G,f.solo)).not(a).not(f.target).qtip("hide",r.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete i.origin,E&&!r(G+'[tracking="true"]:visible',f.solo).not(a).length&&(r(e).unbind("mousemove."+V),E=T),this.blur(n)),l=r.proxy(function(){t?(rt.ie&&a[0].style.removeAttribute("filter"),a.css("overflow",""),"string"==typeof f.autofocus&&r(this.options.show.autofocus,a).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):a.css({display:"",visibility:"",opacity:"",left:"",top:""}),this._trigger(t?"visible":"hidden")},this),f.effect===T||v===T?(a[c](),l()):r.isFunction(f.effect)?(a.stop(1,1),f.effect.call(a,this),a.queue("fx",function(t){l(),t()})):a.fadeTo(90,t?1:0,l),t&&f.target.trigger("qtip-"+this.id+"-inactive"),this))},M.show=function(t){return this.toggle(A,t)},M.hide=function(t){return this.toggle(T,t)},M.focus=function(t){if(!this.rendered||this.destroyed)return this;var e=r(G),n=this.tooltip,i=parseInt(n[0].style.zIndex,10),o=_.zindex+e.length;return n.hasClass(K)||this._trigger("focus",[o],t)&&(i!==o&&(e.each(function(){this.style.zIndex>i&&(this.style.zIndex=this.style.zIndex-1)}),e.filter("."+K).qtip("blur",t)),n.addClass(K)[0].style.zIndex=o),this},M.blur=function(t){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass(K),this._trigger("blur",[this.tooltip.css("zIndex")],t),this)},M.disable=function(t){return this.destroyed?this:("toggle"===t?t=!(this.rendered?this.tooltip.hasClass(tt):this.disabled):"boolean"!=typeof t&&(t=A),this.rendered&&this.tooltip.toggleClass(tt,t).attr("aria-disabled",t),this.disabled=!!t,this)},M.enable=function(){return this.disable(T)},M._createButton=function(){var t=this,e=this.elements,n=e.tooltip,i=this.options.content.button,o="string"==typeof i,a=o?i:"Close tooltip";e.button&&e.button.remove(),i.jquery?e.button=i:e.button=r("",{"class":"qtip-close "+(this.options.style.widget?"":V+"-icon"),title:a,"aria-label":a}).prepend(r("",{"class":"ui-icon ui-icon-close",html:"×"})),e.button.appendTo(e.titlebar||n).attr("role","button").click(function(e){return n.hasClass(tt)||t.hide(e),T})},M._updateButton=function(t){if(!this.rendered)return T;var e=this.elements.button;t?this._createButton():e.remove()},M._setWidget=function(){var t=this.options.style.widget,e=this.elements,n=e.tooltip,r=n.hasClass(tt);n.removeClass(tt),tt=t?"ui-state-disabled":"qtip-disabled",n.toggleClass(tt,r),n.toggleClass("ui-helper-reset "+c(),t).toggleClass(Q,this.options.style.def&&!t),e.content&&e.content.toggleClass(c("content"),t),e.titlebar&&e.titlebar.toggleClass(c("header"),t),e.button&&e.button.toggleClass(V+"-icon",!t)},M._storeMouse=function(t){return(this.mouse=r.event.fix(t)).type="mousemove",this},M._bind=function(t,e,n,i,o){if(t&&n&&e.length){var a="."+this._id+(i?"-"+i:"");return r(t).bind((e.split?e:e.join(a+" "))+a,r.proxy(n,o||this)),this}},M._unbind=function(t,e){return t&&r(t).unbind("."+this._id+(e?"-"+e:"")),this},M._trigger=function(t,e,n){var i=r.Event("tooltip"+t);return i.originalEvent=n&&r.extend({},n)||this.cache.event||N,this.triggering=t,this.tooltip.trigger(i,[this].concat(e||[])),this.triggering=T,!i.isDefaultPrevented()},M._bindEvents=function(t,e,n,i,o,a){var s=n.filter(i).add(i.filter(n)),u=[];s.length&&(r.each(e,function(e,n){var i=r.inArray(n,t);i>-1&&u.push(t.splice(i,1)[0])}),u.length&&(this._bind(s,u,function(t){var e=!!this.rendered&&this.tooltip[0].offsetWidth>0;(e?a:o).call(this,t)}),n=n.not(s),i=i.not(s))),this._bind(n,t,o),this._bind(i,e,a)},M._assignInitialEvents=function(t){function e(t){return this.disabled||this.destroyed?T:(this.cache.event=t&&r.event.fix(t),this.cache.target=t&&r(t.target),clearTimeout(this.timers.show),void(this.timers.show=f.call(this,function(){this.render("object"==typeof t||n.show.ready)},n.prerender?0:n.show.delay)))}var n=this.options,i=n.show.target,o=n.hide.target,a=n.show.event?r.trim(""+n.show.event).split(" "):[],s=n.hide.event?r.trim(""+n.hide.event).split(" "):[];this._bind(this.elements.target,["remove","removeqtip"],function(t){this.destroy(!0)},"destroy"),/mouse(over|enter)/i.test(n.show.event)&&!/mouse(out|leave)/i.test(n.hide.event)&&s.push("mouseleave"),this._bind(i,"mousemove",function(t){this._storeMouse(t),this.cache.onTarget=A}),this._bindEvents(a,s,i,o,e,function(){return this.timers?void clearTimeout(this.timers.show):T}),(n.show.ready||n.prerender)&&e.call(this,t)},M._assignEvents=function(){var n=this,i=this.options,o=i.position,a=this.tooltip,s=i.show.target,u=i.hide.target,l=o.container,c=o.viewport,f=r(e),v=(r(e.body),r(t)),m=i.show.event?r.trim(""+i.show.event).split(" "):[],y=i.hide.event?r.trim(""+i.hide.event).split(" "):[];r.each(i.events,function(t,e){n._bind(a,"toggle"===t?["tooltipshow","tooltiphide"]:["tooltip"+t],e,null,a)}),/mouse(out|leave)/i.test(i.hide.event)&&"window"===i.hide.leave&&this._bind(f,["mouseout","blur"],function(t){/select|option/.test(t.target.nodeName)||t.relatedTarget||this.hide(t)}),i.hide.fixed?u=u.add(a.addClass(Z)):/mouse(over|enter)/i.test(i.show.event)&&this._bind(u,"mouseleave",function(){clearTimeout(this.timers.show)}),(""+i.hide.event).indexOf("unfocus")>-1&&this._bind(l.closest("html"),["mousedown","touchstart"],function(t){var e=r(t.target),n=this.rendered&&!this.tooltip.hasClass(tt)&&this.tooltip[0].offsetWidth>0,i=e.parents(G).filter(this.tooltip[0]).length>0;e[0]===this.target[0]||e[0]===this.tooltip[0]||i||this.target.has(e[0]).length||!n||this.hide(t)}),"number"==typeof i.hide.inactive&&(this._bind(s,"qtip-"+this.id+"-inactive",p,"inactive"),this._bind(u.add(a),_.inactiveEvents,p)),this._bindEvents(m,y,s,u,d,h),this._bind(s.add(a),"mousemove",function(t){if("number"==typeof i.hide.distance){var e=this.cache.origin||{},n=this.options.hide.distance,r=Math.abs;(r(t.pageX-e.pageX)>=n||r(t.pageY-e.pageY)>=n)&&this.hide(t)}this._storeMouse(t)}),"mouse"===o.target&&o.adjust.mouse&&(i.hide.event&&this._bind(s,["mouseenter","mouseleave"],function(t){return this.cache?void(this.cache.onTarget="mouseenter"===t.type):T}),this._bind(f,"mousemove",function(t){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass(tt)&&this.tooltip[0].offsetWidth>0&&this.reposition(t)})),(o.adjust.resize||c.length)&&this._bind(r.event.special.resize?c:v,"resize",g),o.adjust.scroll&&this._bind(v.add(o.container),"scroll",g)},M._unassignEvents=function(){var n=this.options,i=n.show.target,o=n.hide.target,a=r.grep([this.elements.target[0],this.rendered&&this.tooltip[0],n.position.container[0],n.position.viewport[0],n.position.container.closest("html")[0],t,e],function(t){return"object"==typeof t});i&&i.toArray&&(a=a.concat(i.toArray())),o&&o.toArray&&(a=a.concat(o.toArray())),this._unbind(a)._unbind(a,"destroy")._unbind(a,"inactive")},r(function(){v(G,["mouseenter","mouseleave"],function(t){var e="mouseenter"===t.type,n=r(t.currentTarget),i=r(t.relatedTarget||t.target),o=this.options;e?(this.focus(t),n.hasClass(Z)&&!n.hasClass(tt)&&clearTimeout(this.timers.hide)):"mouse"===o.position.target&&o.position.adjust.mouse&&o.hide.event&&o.show.target&&!i.closest(o.show.target[0]).length&&this.hide(t),n.toggleClass(J,e)}),v("["+U+"]",X,p)}),_=r.fn.qtip=function(t,e,i){var o=(""+t).toLowerCase(),a=N,u=r.makeArray(arguments).slice(1),l=u[u.length-1],c=this[0]?r.data(this[0],V):N;return!arguments.length&&c||"api"===o?c:"string"==typeof t?(this.each(function(){var t=r.data(this,V);if(!t)return A;if(l&&l.timeStamp&&(t.cache.event=l),!e||"option"!==o&&"options"!==o)t[o]&&t[o].apply(t,u);else{if(i===n&&!r.isPlainObject(e))return a=t.get(e),T;t.set(e,i)}}),a!==N?a:this):"object"!=typeof t&&arguments.length?void 0:(c=s(r.extend(A,{},t)),this.each(function(t){var e,n;return n=r.isArray(c.id)?c.id[t]:c.id,n=!n||n===T||n.length<1||_.api[n]?_.nextid++:n,e=m(r(this),n,c),e===T?A:(_.api[n]=e,r.each(B,function(){"initialize"===this.initialize&&this(e)}),void e._assignInitialEvents(l))}))},r.qtip=i,_.api={},r.each({attr:function(t,e){if(this.length){var n=this[0],i="title",o=r.data(n,"qtip");if(t===i&&o&&"object"==typeof o&&o.options.suppress)return arguments.length<2?r.attr(n,nt):(o&&o.options.content.attr===i&&o.cache.attr&&o.set("content.text",e),this.attr(nt,e))}return r.fn["attr"+et].apply(this,arguments)},clone:function(t){var e=(r([]),r.fn["clone"+et].apply(this,arguments));return t||e.filter("["+nt+"]").attr("title",function(){return r.attr(this,nt)}).removeAttr(nt),e}},function(t,e){if(!e||r.fn[t+et])return A;var n=r.fn[t+et]=r.fn[t];r.fn[t]=function(){return e.apply(this,arguments)||n.apply(this,arguments)}}),r.ui||(r["cleanData"+et]=r.cleanData,r.cleanData=function(t){for(var e,n=0;(e=r(t[n])).length;n++)if(e.attr(H))try{e.triggerHandler("removeqtip")}catch(i){}r["cleanData"+et].apply(this,arguments)}),_.version="2.2.1",_.nextid=0,_.inactiveEvents=X,_.zindex=15e3,_.defaults={prerender:T,id:T,overwrite:A,suppress:A,content:{text:A,attr:"title",title:T,button:T},position:{my:"top left",at:"bottom right",target:T,container:T,viewport:T,adjust:{x:0,y:0,mouse:A,scroll:A,resize:A,method:"flipinvert flipinvert"},effect:function(t,e,n){r(this).animate(e,{duration:200,queue:T})}},show:{target:T,event:"mouseenter",effect:A,delay:90,solo:T,ready:T,autofocus:T},hide:{target:T,event:"mouseleave",effect:A,delay:0,fixed:T,inactive:T,leave:"window",distance:T},style:{classes:"",widget:T,width:T,height:T,def:A},events:{render:N,move:N,show:N,hide:N,toggle:N,visible:N,hidden:N,focus:N,blur:N}};var st,ut="margin",lt="border",ct="color",ft="background-color",dt="transparent",ht=" !important",pt=!!e.createElement("canvas").getContext,gt=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,vt={},mt=["Webkit","O","Moz","ms"];if(pt)var yt=t.devicePixelRatio||1,bt=function(){var t=e.createElement("canvas").getContext("2d");return t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||1}(),xt=yt/bt;else var wt=function(t,e,n){return"'};r.extend(w.prototype,{init:function(t){var e,n;n=this.element=t.elements.tip=r("
",{"class":V+"-tip"}).prependTo(t.tooltip),pt?(e=r("").appendTo(this.element)[0].getContext("2d"),e.lineJoin="miter",e.miterLimit=1e5,e.save()):(e=wt("shape",'coordorigin="0,0"',"position:absolute;"),this.element.html(e+e),t._bind(r("*",n).add(n),["click","mousedown"],function(t){t.stopPropagation()},this._ns)),t._bind(t.tooltip,"tooltipmove",this.reposition,this._ns,this),this.create()},_swapDimensions:function(){this.size[0]=this.options.height,this.size[1]=this.options.width},_resetDimensions:function(){this.size[0]=this.options.width,this.size[1]=this.options.height},_useTitle:function(t){var e=this.qtip.elements.titlebar;return e&&(t.y===L||t.y===z&&this.element.position().top+this.size[1]/2+this.options.offset-1),left:l[0]-l[2]*Number(o===D),top:l[1]-l[2]*Number(o===O),width:c[0]+f,height:c[1]+f}).each(function(t){var e=r(this);e[e.prop?"prop":"attr"]({coordsize:c[0]+f+" "+(c[1]+f),path:s,fillcolor:i[0],filled:!!t,stroked:!t}).toggle(!(!f&&!t)),!t&&e.html(wt("stroke",'weight="'+2*f+'px" color="'+i[1]+'" miterlimit="1000" joinstyle="miter"'))})),t.opera&&setTimeout(function(){d.tip.css({display:"inline-block",visibility:"visible"})},1),n!==T&&this.calculate(e,c)},calculate:function(t,e){if(!this.enabled)return T;var n,i,o=this,a=this.qtip.elements,s=this.element,u=this.options.offset,l=(a.tooltip.hasClass("ui-widget"),{});return t=t||this.corner,n=t.precedance,e=e||this._calculateSize(t),i=[t.x,t.y],n===D&&i.reverse(),r.each(i,function(r,i){var s,c,f;i===z?(s=n===O?P:L,l[s]="50%",l[ut+"-"+s]=-Math.round(e[n===O?0:1]/2)+u):(s=o._parseWidth(t,i,a.tooltip),c=o._parseWidth(t,i,a.content),f=o._parseRadius(t),l[i]=Math.max(-o.border,r?c:u+(f>s?f:-s)))}),l[t[n]]-=e[n===D?0:1],s.css({margin:"",top:"",bottom:"",left:"",right:""}).css(l),l},reposition:function(t,e,r,i){function o(t,e,n,r,i){t===R&&c.precedance===e&&f[r]&&c[n]!==z?c.precedance=c.precedance===D?O:D:t!==R&&f[r]&&(c[e]=c[e]===z?f[r]>0?r:i:c[e]===r?i:r)}function a(t,e,i){c[t]===z?v[ut+"-"+e]=g[t]=s[ut+"-"+e]-f[e]:(u=s[i]!==n?[f[e],-s[e]]:[-f[e],s[e]],(g[t]=Math.max(u[0],u[1]))>u[0]&&(r[e]-=f[e],g[e]=T),v[s[i]!==n?i:e]=g[t])}if(this.enabled){var s,u,l=e.cache,c=this.corner.clone(),f=r.adjusted,d=e.options.position.adjust.method.split(" "),h=d[0],p=d[1]||d[0],g={left:T,top:T,x:0,y:0},v={};this.corner.fixed!==A&&(o(h,D,O,P,q),o(p,O,D,L,F),c.string()===l.corner.string()&&l.cornerTop===f.top&&l.cornerLeft===f.left||this.update(c,T)),s=this.calculate(c),s.right!==n&&(s.left=-s.right),s.bottom!==n&&(s.top=-s.bottom),s.user=this.offset,(g.left=h===R&&!!f.left)&&a(D,P,q),(g.top=p===R&&!!f.top)&&a(O,L,F),this.element.css(v).toggle(!(g.x&&g.y||c.x===z&&g.y||c.y===z&&g.x)),r.left-=s.left.charAt?s.user:h!==R||g.top||!g.left&&!g.top?s.left+this.border:0,r.top-=s.top.charAt?s.user:p!==R||g.left||!g.left&&!g.top?s.top+this.border:0,l.cornerLeft=f.left,l.cornerTop=f.top,l.corner=c.clone()}},destroy:function(){this.qtip._unbind(this.qtip.tooltip,this._ns),this.qtip.elements.tip&&this.qtip.elements.tip.find("*").remove().end().remove()}}),st=B.tip=function(t){return new w(t,t.options.style.tip)},st.initialize="render",st.sanitize=function(t){if(t.style&&"tip"in t.style){var e=t.style.tip;"object"!=typeof e&&(e=t.style.tip={corner:e}),/string|boolean/i.test(typeof e.corner)||(e.corner=A)}},S.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){this.create(),this.qtip.reposition()},"^style.tip.(height|width)$":function(t){this.size=[t.width,t.height],this.update(),this.qtip.reposition()},"^content.title|style.(classes|widget)$":function(){this.update()}},r.extend(A,_.defaults,{style:{tip:{corner:A,mimic:T,width:6,height:6,border:A,offset:0}}});var $t,kt,_t="qtip-modal",Mt="."+_t;kt=function(){function t(t){if(r.expr[":"].focusable)return r.expr[":"].focusable;var e,n,i,o=!isNaN(r.attr(t,"tabindex")),a=t.nodeName&&t.nodeName.toLowerCase();return"area"===a?(e=t.parentNode,n=e.name,!(!t.href||!n||"map"!==e.nodeName.toLowerCase())&&(i=r("img[usemap=#"+n+"]")[0],!!i&&i.is(":visible"))):/input|select|textarea|button|object/.test(a)?!t.disabled:"a"===a?t.href||o:o}function n(t){c.length<1&&t.length?t.not("body").blur():c.first().focus()}function i(t){if(u.is(":visible")){var e,i=r(t.target),s=o.tooltip,l=i.closest(G);e=l.length<1?T:parseInt(l[0].style.zIndex,10)>parseInt(s[0].style.zIndex,10),e||i.closest(G)[0]===s[0]||n(i),a=t.target===c[c.length-1]}}var o,a,s,u,l=this,c={};r.extend(l,{init:function(){return u=l.elem=r("
",{id:"qtip-overlay",html:"
",mousedown:function(){return T}}).hide(),r(e.body).bind("focusin"+Mt,i),r(e).bind("keydown"+Mt,function(t){o&&o.options.show.modal.escape&&27===t.keyCode&&o.hide(t)}),u.bind("click"+Mt,function(t){o&&o.options.show.modal.blur&&o.hide(t)}),l},update:function(e){o=e,c=e.options.show.modal.stealfocus!==T?e.tooltip.find("*").filter(function(){return t(this)}):[]},toggle:function(t,i,a){var c=(r(e.body),t.tooltip),f=t.options.show.modal,d=f.effect,h=i?"show":"hide",p=u.is(":visible"),g=r(Mt).filter(":visible:not(:animated)").not(c);return l.update(t),i&&f.stealfocus!==T&&n(r(":focus")),u.toggleClass("blurs",f.blur),i&&u.appendTo(e.body),u.is(":animated")&&p===i&&s!==T||!i&&g.length?l:(u.stop(A,T),r.isFunction(d)?d.call(u,i):d===T?u[h]():u.fadeTo(parseInt(a,10)||90,i?1:0,function(){i||u.hide()}),i||u.queue(function(t){u.css({left:"",top:""}),r(Mt).length||u.detach(),t()}),s=i,o.destroyed&&(o=N),l)}}),l.init()},kt=new kt,r.extend($.prototype,{init:function(t){var e=t.tooltip;return this.options.on?(t.elements.overlay=kt.elem,e.addClass(_t).css("z-index",_.modal_zindex+r(Mt).length),t._bind(e,["tooltipshow","tooltiphide"],function(t,n,i){var o=t.originalEvent;if(t.target===e[0])if(o&&"tooltiphide"===t.type&&/mouse(leave|enter)/.test(o.type)&&r(o.relatedTarget).closest(kt.elem[0]).length)try{t.preventDefault()}catch(a){}else(!o||o&&"tooltipsolo"!==o.type)&&this.toggle(t,"tooltipshow"===t.type,i)},this._ns,this),t._bind(e,"tooltipfocus",function(t,n){if(!t.isDefaultPrevented()&&t.target===e[0]){var i=r(Mt),o=_.modal_zindex+i.length,a=parseInt(e[0].style.zIndex,10);kt.elem[0].style.zIndex=o-1,i.each(function(){this.style.zIndex>a&&(this.style.zIndex-=1)}),i.filter("."+K).qtip("blur",t.originalEvent),e.addClass(K)[0].style.zIndex=o,kt.update(n);try{t.preventDefault()}catch(s){}}},this._ns,this),void t._bind(e,"tooltiphide",function(t){t.target===e[0]&&r(Mt).filter(":visible").not(e).last().qtip("focus",t)},this._ns,this)):this},toggle:function(t,e,n){return t&&t.isDefaultPrevented()?this:void kt.toggle(this.qtip,!!e,n)},destroy:function(){this.qtip.tooltip.removeClass(_t),this.qtip._unbind(this.qtip.tooltip,this._ns),kt.toggle(this.qtip,T),delete this.qtip.elements.overlay}}),$t=B.modal=function(t){return new $(t,t.options.show.modal)},$t.sanitize=function(t){t.show&&("object"!=typeof t.show.modal?t.show.modal={on:!!t.show.modal}:"undefined"==typeof t.show.modal.on&&(t.show.modal.on=A))},_.modal_zindex=_.zindex-200,$t.initialize="render",S.modal={"^show.modal.(on|blur)$":function(){this.destroy(),this.init(),this.qtip.elems.overlay.toggle(this.qtip.tooltip[0].offsetWidth>0)}},r.extend(A,_.defaults,{show:{modal:{on:T,effect:A,blur:A,stealfocus:A,escape:A}}}),B.viewport=function(n,r,i,o,a,s,u){function l(t,e,n,i,o,a,s,u,l){var c=r[o],y=x[t],b=w[t],$=n===R,k=y===o?l:y===a?-l:-l/2,_=b===o?u:b===a?-u:-u/2,M=v[o]+m[o]-(h?0:d[o]),C=M-c,S=c+l-(s===j?p:g)-M,E=k-(x.precedance===t||y===x[e]?_:0)-(b===z?u/2:0);return $?(E=(y===o?1:-1)*k,r[o]+=C>0?C:S>0?-S:0,r[o]=Math.max(-d[o]+m[o],c-E,Math.min(Math.max(-d[o]+m[o]+(s===j?p:g),c+E),r[o],"center"===y?c-k:1e9))):(i*=n===W?2:0,C>0&&(y!==o||S>0)?(r[o]-=E+i,f.invert(t,o)):S>0&&(y!==a||C>0)&&(r[o]-=(y===z?-E:E)+i,f.invert(t,a)),r[o]S&&(r[o]=c,f=x.clone())),r[o]-c}var c,f,d,h,p,g,v,m,y=i.target,b=n.elements.tooltip,x=i.my,w=i.at,$=i.adjust,k=$.method.split(" "),_=k[0],M=k[1]||k[0],C=i.viewport,S=i.container,E=(n.cache,{left:0,top:0});return C.jquery&&y[0]!==t&&y[0]!==e.body&&"none"!==$.method?(d=S.offset()||E,h="static"===S.css("position"),c="fixed"===b.css("position"),p=C[0]===t?C.width():C.outerWidth(T),g=C[0]===t?C.height():C.outerHeight(T),v={left:c?0:C.scrollLeft(),top:c?0:C.scrollTop()},m=C.offset()||E,"shift"===_&&"shift"===M||(f=x.clone()),E={left:"none"!==_?l(D,O,_,$.x,P,q,j,o,s):0,top:"none"!==M?l(O,D,M,$.y,L,F,I,a,u):0,my:f}):E},B.polys={polygon:function(t,e){var n,r,i,o={width:0,height:0,position:{top:1e10,right:0,bottom:0,left:1e10},adjustable:T},a=0,s=[],u=1,l=1,c=0,f=0; -for(a=t.length;a--;)n=[parseInt(t[--a],10),parseInt(t[a+1],10)],n[0]>o.position.right&&(o.position.right=n[0]),n[0]o.position.bottom&&(o.position.bottom=n[1]),n[1]0&&i>0&&u>0&&l>0;)for(r=Math.floor(r/2),i=Math.floor(i/2),e.x===P?u=r:e.x===q?u=o.width-r:u+=Math.floor(r/2),e.y===L?l=i:e.y===F?l=o.height-i:l+=Math.floor(i/2),a=s.length;a--&&!(s.length<2);)c=s[a][0]-o.position.left,f=s[a][1]-o.position.top,(e.x===P&&c>=u||e.x===q&&c<=u||e.x===z&&(co.width-u)||e.y===L&&f>=l||e.y===F&&f<=l||e.y===z&&(fo.height-l))&&s.splice(a,1);o.position={left:s[0][0],top:s[0][1]}}return o},rect:function(t,e,n,r){return{width:Math.abs(n-t),height:Math.abs(r-e),position:{left:Math.min(t,n),top:Math.min(e,r)}}},_angles:{tc:1.5,tr:7/4,tl:5/4,bc:.5,br:.25,bl:.75,rc:2,lc:1,c:0},ellipse:function(t,e,n,r,i){var o=B.polys._angles[i.abbrev()],a=0===o?0:n*Math.cos(o*Math.PI),s=r*Math.sin(o*Math.PI);return{width:2*n-Math.abs(a),height:2*r-Math.abs(s),position:{left:t+a,top:e+s},adjustable:T}},circle:function(t,e,n,r){return B.polys.ellipse(t,e,n,n,r)}},B.svg=function(t,n,i){for(var o,a,s,u,l,c,f,d,h,p=(r(e),n[0]),g=r(p.ownerSVGElement),v=p.ownerDocument,m=(parseInt(n.css("stroke-width"),10)||0)/2;!p.getBBox;)p=p.parentNode;if(!p.getBBox||!p.parentNode)return T;switch(p.nodeName){case"ellipse":case"circle":d=B.polys.ellipse(p.cx.baseVal.value,p.cy.baseVal.value,(p.rx||p.r).baseVal.value+m,(p.ry||p.r).baseVal.value+m,i);break;case"line":case"polygon":case"polyline":for(f=p.points||[{x:p.x1.baseVal.value,y:p.y1.baseVal.value},{x:p.x2.baseVal.value,y:p.y2.baseVal.value}],d=[],c=-1,u=f.numberOfItems||f.length;++c';r.extend(k.prototype,{_scroll:function(){var e=this.qtip.elements.overlay;e&&(e[0].style.top=r(t).scrollTop()+"px")},init:function(n){var i=n.tooltip;r("select, object").length<1&&(this.bgiframe=n.elements.bgiframe=r(St).appendTo(i),n._bind(i,"tooltipmove",this.adjustBGIFrame,this._ns,this)),this.redrawContainer=r("
",{id:V+"-rcontainer"}).appendTo(e.body),n.elements.overlay&&n.elements.overlay.addClass("qtipmodal-ie6fix")&&(n._bind(t,["scroll","resize"],this._scroll,this._ns,this),n._bind(i,["tooltipshow"],this._scroll,this._ns,this)),this.redraw()},adjustBGIFrame:function(){var t,e,n=this.qtip.tooltip,r={height:n.outerHeight(T),width:n.outerWidth(T)},i=this.qtip.plugins.tip,o=this.qtip.elements.tip;e=parseInt(n.css("borderLeftWidth"),10)||0,e={left:-e,top:-e},i&&o&&(t="x"===i.corner.precedance?[j,P]:[I,L],e[t[1]]-=o[t[0]]()),this.bgiframe.css(e).css(r)},redraw:function(){if(this.qtip.rendered<1||this.drawing)return this;var t,e,n,r,i=this.qtip.tooltip,o=this.qtip.options.style,a=this.qtip.options.position.container;return this.qtip.drawing=1,o.height&&i.css(I,o.height),o.width?i.css(j,o.width):(i.css(j,"").appendTo(this.redrawContainer),e=i.width(),e%2<1&&(e+=1),n=i.css("maxWidth")||"",r=i.css("minWidth")||"",t=(n+r).indexOf("%")>-1?a.width()/100:0,n=(n.indexOf("%")>-1?t:1)*parseInt(n,10)||e,r=(r.indexOf("%")>-1?t:1)*parseInt(r,10)||0,e=n+r?Math.min(Math.max(e,r),n):e,i.css(j,Math.round(e)).appendTo(a)),this.drawing=0,this},destroy:function(){this.bgiframe&&this.bgiframe.remove(),this.qtip._unbind([t,this.qtip.tooltip],this._ns)}}),Ct=B.ie6=function(t){return 6===rt.ie?new k(t):T},Ct.initialize="render",S.ie6={"^content|style$":function(){this.redraw()}}})}(window,document),function(t,e,n){!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):jQuery&&!jQuery.fn.qtip&&t(jQuery)}(function(r){"use strict";function i(t,e,n,i){this.id=n,this.target=t,this.tooltip=M,this.elements={target:t},this._id=j+"-"+n,this.timers={img:{}},this.options=e,this.plugins={},this.cache={event:{},target:r(),disabled:_,attr:i,onTooltip:_,lastClass:""},this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=_}function o(t){return t===M||"object"!==r.type(t)}function a(t){return!(r.isFunction(t)||t&&t.attr||t.length||"object"===r.type(t)&&(t.jquery||t.then))}function s(t){var e,n,i,s;return o(t)?_:(o(t.metadata)&&(t.metadata={type:t.metadata}),"content"in t&&(e=t.content,o(e)||e.jquery||e.done?e=t.content={text:n=a(e)?_:e}:n=e.text,"ajax"in e&&(i=e.ajax,s=i&&i.once!==_,delete e.ajax,e.text=function(t,e){var o=n||r(this).attr(e.options.content.attr)||"Loading...",a=r.ajax(r.extend({},i,{context:e})).then(i.success,M,i.error).then(function(t){return t&&s&&e.set("content.text",t),t},function(t,n,r){e.destroyed||0===t.status||e.set("content.text",n+": "+r)});return s?o:(e.set("content.text",o),a)}),"title"in e&&(r.isPlainObject(e.title)&&(e.button=e.title.button,e.title=e.title.text),a(e.title||_)&&(e.title=_))),"position"in t&&o(t.position)&&(t.position={my:t.position,at:t.position}),"show"in t&&o(t.show)&&(t.show=t.show.jquery?{target:t.show}:t.show===k?{ready:k}:{event:t.show}),"hide"in t&&o(t.hide)&&(t.hide=t.hide.jquery?{target:t.hide}:{event:t.hide}),"style"in t&&o(t.style)&&(t.style={classes:t.style}),r.each(O,function(){this.sanitize&&this.sanitize(t)}),t)}function u(t,e){for(var n,r=0,i=t,o=e.split(".");i=i[o[r++]];)r0?setTimeout(r.proxy(t,this),e):void t.call(this)}function d(t){this.tooltip.hasClass(V)||(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this.timers.show=f.call(this,function(){this.toggle(k,t)},this.options.show.delay))}function h(t){if(!this.tooltip.hasClass(V)&&!this.destroyed){var e=r(t.relatedTarget),n=e.closest(F)[0]===this.tooltip[0],i=e[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==e[0]&&"mouse"===this.options.position.target&&n||this.options.hide.fixed&&/mouse(out|leave|move)/.test(t.type)&&(n||i))try{t.preventDefault(),t.stopImmediatePropagation()}catch(o){}else this.timers.hide=f.call(this,function(){this.toggle(_,t)},this.options.hide.delay,this)}}function p(t){!this.tooltip.hasClass(V)&&this.options.hide.inactive&&(clearTimeout(this.timers.inactive),this.timers.inactive=f.call(this,function(){this.hide(t)},this.options.hide.inactive))}function g(t){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(t)}function v(t,n,i){r(e.body).delegate(t,(n.split?n:n.join("."+j+" "))+"."+j,function(){var t=y.api[r.attr(this,L)];t&&!t.disabled&&i.apply(t,arguments)})}function m(t,n,o){var a,u,l,c,f,d=r(e.body),h=t[0]===e?d:t,p=t.metadata?t.metadata(o.metadata):M,g="html5"===o.metadata.type&&p?p[o.metadata.name]:M,v=t.data(o.metadata.name||"qtipopts");try{v="string"==typeof v?r.parseJSON(v):v}catch(m){}if(c=r.extend(k,{},y.defaults,o,"object"==typeof v?s(v):M,s(g||p)),u=c.position,c.id=n,"boolean"==typeof c.content.text){if(l=t.attr(c.content.attr),c.content.attr===_||!l)return _;c.content.text=l}if(u.container.length||(u.container=d),u.target===_&&(u.target=h),c.show.target===_&&(c.show.target=h),c.show.solo===k&&(c.show.solo=u.container.closest("body")),c.hide.target===_&&(c.hide.target=h),c.position.viewport===k&&(c.position.viewport=u.container),u.container=u.container.eq(0),u.at=new x(u.at,k),u.my=new x(u.my),t.data(j))if(c.overwrite)t.qtip("destroy",!0);else if(c.overwrite===_)return _;return t.attr(I,n),c.suppress&&(f=t.attr("title"))&&t.removeAttr("title").attr(U,f).attr("title",""),a=new i(t,c,n,(!!l)),t.data(j,a),a}var y,b,x,w,$,k=!0,_=!1,M=null,C="x",S="y",E="top",A="left",T="bottom",N="right",D="center",O={},j="qtip",I="data-hasqtip",L="data-qtip-id",P=["ui-widget","ui-tooltip"],F="."+j,q="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),z=j+"-fixed",W=j+"-default",R=j+"-focus",B=j+"-hover",V=j+"-disabled",H="_replacedByqTip",U="oldtitle",Y={ie:function(){for(var t=4,n=e.createElement("div");(n.innerHTML="")&&n.getElementsByTagName("i")[0];t+=1);return t>4?t:NaN}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||_};b=i.prototype,b._when=function(t){return r.when.apply(r,t)},b.render=function(t){if(this.rendered||this.destroyed)return this;var e,n=this,i=this.options,o=this.cache,a=this.elements,s=i.content.text,u=i.content.title,l=i.content.button,c=i.position,f=("."+this._id+" ",[]);return r.attr(this.target[0],"aria-describedby",this._id),o.posClass=this._createPosClass((this.position={my:c.my,at:c.at}).my),this.tooltip=a.tooltip=e=r("
",{id:this._id,"class":[j,W,i.style.classes,o.posClass].join(" "),width:i.style.width||"",height:i.style.height||"",tracking:"mouse"===c.target&&c.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":_,"aria-describedby":this._id+"-content","aria-hidden":k}).toggleClass(V,this.disabled).attr(L,this.id).data(j,this).appendTo(c.container).append(a.content=r("
",{"class":j+"-content",id:this._id+"-content","aria-atomic":k})),this.rendered=-1,this.positioning=k,u&&(this._createTitle(),r.isFunction(u)||f.push(this._updateTitle(u,_))),l&&this._createButton(),r.isFunction(s)||f.push(this._updateContent(s,_)),this.rendered=k,this._setWidget(),r.each(O,function(t){var e;"render"===this.initialize&&(e=this(n))&&(n.plugins[t]=e)}),this._unassignEvents(),this._assignEvents(),this._when(f).then(function(){n._trigger("render"),n.positioning=_,n.hiddenDuringWait||!i.show.ready&&!t||n.toggle(k,o.event,_),n.hiddenDuringWait=_}),y.api[this.id]=this,this},b.destroy=function(t){function e(){if(!this.destroyed){this.destroyed=k;var t,e=this.target,n=e.attr(U);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove(),r.each(this.plugins,function(t){this.destroy&&this.destroy()});for(t in this.timers)clearTimeout(this.timers[t]);e.removeData(j).removeAttr(L).removeAttr(I).removeAttr("aria-describedby"),this.options.suppress&&n&&e.attr("title",n).removeAttr(U),this._unassignEvents(),this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=M,delete y.api[this.id]}}return this.destroyed?this.target:(t===k&&"hide"!==this.triggering||!this.rendered?e.call(this):(this.tooltip.one("tooltiphidden",r.proxy(e,this)),!this.triggering&&this.hide()),this.target)},w=b.checks={builtin:{"^id$":function(t,e,n,i){var o=n===k?y.nextid:n,a=j+"-"+o;o!==_&&o.length>0&&!r("#"+a).length?(this._id=a,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):t[e]=i},"^prerender":function(t,e,n){n&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(t,e,n){this._updateContent(n)},"^content.attr$":function(t,e,n,r){this.options.content.text===this.target.attr(r)&&this._updateContent(this.target.attr(n))},"^content.title$":function(t,e,n){return n?(n&&!this.elements.title&&this._createTitle(),void this._updateTitle(n)):this._removeTitle()},"^content.button$":function(t,e,n){this._updateButton(n)},"^content.title.(text|button)$":function(t,e,n){this.set("content."+e,n)},"^position.(my|at)$":function(t,e,n){"string"==typeof n&&(this.position[e]=t[e]=new x(n,"at"===e))},"^position.container$":function(t,e,n){this.rendered&&this.tooltip.appendTo(n)},"^show.ready$":function(t,e,n){n&&(!this.rendered&&this.render(k)||this.toggle(k))},"^style.classes$":function(t,e,n,r){this.rendered&&this.tooltip.removeClass(r).addClass(n)},"^style.(width|height)":function(t,e,n){this.rendered&&this.tooltip.css(e,n)},"^style.widget|content.title":function(){this.rendered&&this._setWidget()},"^style.def":function(t,e,n){this.rendered&&this.tooltip.toggleClass(W,!!n)},"^events.(render|show|move|hide|focus|blur)$":function(t,e,n){this.rendered&&this.tooltip[(r.isFunction(n)?"":"un")+"bind"]("tooltip"+e,n)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){if(this.rendered){var t=this.options.position;this.tooltip.attr("tracking","mouse"===t.target&&t.adjust.mouse),this._unassignEvents(),this._assignEvents()}}}},b.get=function(t){if(this.destroyed)return this;var e=u(this.options,t.toLowerCase()),n=e[0][e[1]];return n.precedance?n.string():n};var G=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,X=/^prerender|show\.ready/i;b.set=function(t,e){if(this.destroyed)return this;var n,i=this.rendered,o=_,a=this.options;this.checks;return"string"==typeof t?(n=t,t={},t[n]=e):t=r.extend({},t),r.each(t,function(e,n){if(i&&X.test(e))return void delete t[e];var s,l=u(a,e.toLowerCase());s=l[0][l[1]],l[0][l[1]]=n&&n.nodeType?r(n):n,o=G.test(e)||o,t[e]=[l[0],l[1],n,s]}),s(a),this.positioning=k,r.each(t,r.proxy(l,this)),this.positioning=_,this.rendered&&this.tooltip[0].offsetWidth>0&&o&&this.reposition("mouse"===a.position.target?M:this.cache.event),this},b._update=function(t,e,n){var i=this,o=this.cache;return this.rendered&&t?(r.isFunction(t)&&(t=t.call(this.elements.target,o.event,this)||""),r.isFunction(t.then)?(o.waiting=k,t.then(function(t){return o.waiting=_,i._update(t,e)},M,function(t){return i._update(t,e)})):t===_||!t&&""!==t?_:(t.jquery&&t.length>0?e.empty().append(t.css({display:"block",visibility:"visible"})):e.html(t),this._waitForContent(e).then(function(t){i.rendered&&i.tooltip[0].offsetWidth>0&&i.reposition(o.event,!t.length)}))):_},b._waitForContent=function(t){var e=this.cache;return e.waiting=k,(r.fn.imagesLoaded?t.imagesLoaded():r.Deferred().resolve([])).done(function(){e.waiting=_}).promise()},b._updateContent=function(t,e){this._update(t,this.elements.content,e)},b._updateTitle=function(t,e){this._update(t,this.elements.title,e)===_&&this._removeTitle(_)},b._createTitle=function(){var t=this.elements,e=this._id+"-title";t.titlebar&&this._removeTitle(),t.titlebar=r("
",{"class":j+"-titlebar "+(this.options.style.widget?c("header"):"")}).append(t.title=r("
",{id:e,"class":j+"-title","aria-atomic":k})).insertBefore(t.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(t){r(this).toggleClass("ui-state-active ui-state-focus","down"===t.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(t){r(this).toggleClass("ui-state-hover","mouseover"===t.type)}),this.options.content.button&&this._createButton()},b._removeTitle=function(t){var e=this.elements;e.title&&(e.titlebar.remove(),e.titlebar=e.title=e.button=M,t!==_&&this.reposition())},b._createPosClass=function(t){return j+"-pos-"+(t||this.options.position.my).abbrev()},b.reposition=function(n,i){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=k;var o,a,s,u,l=this.cache,c=this.tooltip,f=this.options.position,d=f.target,h=f.my,p=f.at,g=f.viewport,v=f.container,m=f.adjust,y=m.method.split(" "),b=c.outerWidth(_),x=c.outerHeight(_),w=0,$=0,M=c.css("position"),C={left:0,top:0},S=c[0].offsetWidth>0,j=n&&"scroll"===n.type,I=r(t),L=v[0].ownerDocument,P=this.mouse;if(r.isArray(d)&&2===d.length)p={x:A,y:E},C={left:d[0],top:d[1]};else if("mouse"===d)p={x:A,y:E},(!m.mouse||this.options.hide.distance)&&l.origin&&l.origin.pageX?n=l.origin:!n||n&&("resize"===n.type||"scroll"===n.type)?n=l.event:P&&P.pageX&&(n=P),"static"!==M&&(C=v.offset()),L.body.offsetWidth!==(t.innerWidth||L.documentElement.clientWidth)&&(a=r(e.body).offset()),C={left:n.pageX-C.left+(a&&a.left||0),top:n.pageY-C.top+(a&&a.top||0)},m.mouse&&j&&P&&(C.left-=(P.scrollX||0)-I.scrollLeft(),C.top-=(P.scrollY||0)-I.scrollTop());else{if("event"===d?n&&n.target&&"scroll"!==n.type&&"resize"!==n.type?l.target=r(n.target):n.target||(l.target=this.elements.target):"event"!==d&&(l.target=r(d.jquery?d:this.elements.target)),d=l.target,d=r(d).eq(0),0===d.length)return this;d[0]===e||d[0]===t?(w=Y.iOS?t.innerWidth:d.width(),$=Y.iOS?t.innerHeight:d.height(),d[0]===t&&(C={top:(g||d).scrollTop(),left:(g||d).scrollLeft()})):O.imagemap&&d.is("area")?o=O.imagemap(this,d,p,O.viewport?y:_):O.svg&&d&&d[0].ownerSVGElement?o=O.svg(this,d,p,O.viewport?y:_):(w=d.outerWidth(_),$=d.outerHeight(_),C=d.offset()),o&&(w=o.width,$=o.height,a=o.offset,C=o.position),C=this.reposition.offset(d,C,v),(Y.iOS>3.1&&Y.iOS<4.1||Y.iOS>=4.3&&Y.iOS<4.33||!Y.iOS&&"fixed"===M)&&(C.left-=I.scrollLeft(),C.top-=I.scrollTop()),(!o||o&&o.adjustable!==_)&&(C.left+=p.x===N?w:p.x===D?w/2:0,C.top+=p.y===T?$:p.y===D?$/2:0)}return C.left+=m.x+(h.x===N?-b:h.x===D?-b/2:0),C.top+=m.y+(h.y===T?-x:h.y===D?-x/2:0),O.viewport?(s=C.adjusted=O.viewport(this,C,f,w,$,b,x),a&&s.left&&(C.left+=a.left),a&&s.top&&(C.top+=a.top),s.my&&(this.position.my=s.my)):C.adjusted={left:0,top:0},l.posClass!==(u=this._createPosClass(this.position.my))&&c.removeClass(l.posClass).addClass(l.posClass=u),this._trigger("move",[C,g.elem||g],n)?(delete C.adjusted,i===_||!S||isNaN(C.left)||isNaN(C.top)||"mouse"===d||!r.isFunction(f.effect)?c.css(C):r.isFunction(f.effect)&&(f.effect.call(c,this,r.extend({},C)),c.queue(function(t){r(this).css({opacity:"",height:""}),Y.ie&&this.style.removeAttribute("filter"),t()})),this.positioning=_,this):this},b.reposition.offset=function(t,n,i){function o(t,e){n.left+=e*t.scrollLeft(),n.top+=e*t.scrollTop()}if(!i[0])return n;var a,s,u,l,c=r(t[0].ownerDocument),f=!!Y.ie&&"CSS1Compat"!==e.compatMode,d=i[0];do"static"!==(s=r.css(d,"position"))&&("fixed"===s?(u=d.getBoundingClientRect(),o(c,-1)):(u=r(d).position(),u.left+=parseFloat(r.css(d,"borderLeftWidth"))||0,u.top+=parseFloat(r.css(d,"borderTopWidth"))||0),n.left-=u.left+(parseFloat(r.css(d,"marginLeft"))||0),n.top-=u.top+(parseFloat(r.css(d,"marginTop"))||0),a||"hidden"===(l=r.css(d,"overflow"))||"visible"===l||(a=r(d)));while(d=d.offsetParent);return a&&(a[0]!==c[0]||f)&&o(a,1),n};var Z=(x=b.reposition.Corner=function(t,e){t=(""+t).replace(/([A-Z])/," $1").replace(/middle/gi,D).toLowerCase(),this.x=(t.match(/left|right/i)||t.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(t.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.forceY=!!e;var n=t.charAt(0);this.precedance="t"===n||"b"===n?S:C}).prototype;Z.invert=function(t,e){this[t]=this[t]===A?N:this[t]===N?A:e||this[t]},Z.string=function(t){var e=this.x,n=this.y,r=e!==n?"center"===e||"center"!==n&&(this.precedance===S||this.forceY)?[n,e]:[e,n]:[e];return t!==!1?r.join(" "):r},Z.abbrev=function(){var t=this.string(!1);return t[0].charAt(0)+(t[1]&&t[1].charAt(0)||"")},Z.clone=function(){return new x(this.string(),this.forceY)},b.toggle=function(t,n){var i=this.cache,o=this.options,a=this.tooltip;if(n){if(/over|enter/.test(n.type)&&i.event&&/out|leave/.test(i.event.type)&&o.show.target.add(n.target).length===o.show.target.length&&a.has(n.relatedTarget).length)return this;i.event=r.event.fix(n)}if(this.waiting&&!t&&(this.hiddenDuringWait=k),!this.rendered)return t?this.render(1):this;if(this.destroyed||this.disabled)return this;var s,u,l,c=t?"show":"hide",f=this.options[c],d=(this.options[t?"hide":"show"],this.options.position),h=this.options.content,p=this.tooltip.css("width"),g=this.tooltip.is(":visible"),v=t||1===f.target.length,m=!n||f.target.length<2||i.target[0]===n.target;return(typeof t).search("boolean|number")&&(t=!g),s=!a.is(":animated")&&g===t&&m,u=s?M:!!this._trigger(c,[90]),this.destroyed?this:(u!==_&&t&&this.focus(n),!u||s?this:(r.attr(a[0],"aria-hidden",!t),t?(this.mouse&&(i.origin=r.event.fix(this.mouse)),r.isFunction(h.text)&&this._updateContent(h.text,_),r.isFunction(h.title)&&this._updateTitle(h.title,_),!$&&"mouse"===d.target&&d.adjust.mouse&&(r(e).bind("mousemove."+j,this._storeMouse),$=k),p||a.css("width",a.outerWidth(_)),this.reposition(n,arguments[2]),p||a.css("width",""),f.solo&&("string"==typeof f.solo?r(f.solo):r(F,f.solo)).not(a).not(f.target).qtip("hide",r.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete i.origin,$&&!r(F+'[tracking="true"]:visible',f.solo).not(a).length&&(r(e).unbind("mousemove."+j),$=_),this.blur(n)),l=r.proxy(function(){t?(Y.ie&&a[0].style.removeAttribute("filter"),a.css("overflow",""),"string"==typeof f.autofocus&&r(this.options.show.autofocus,a).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):a.css({display:"",visibility:"",opacity:"",left:"",top:""}),this._trigger(t?"visible":"hidden")},this),f.effect===_||v===_?(a[c](),l()):r.isFunction(f.effect)?(a.stop(1,1),f.effect.call(a,this),a.queue("fx",function(t){l(),t()})):a.fadeTo(90,t?1:0,l),t&&f.target.trigger("qtip-"+this.id+"-inactive"),this))},b.show=function(t){return this.toggle(k,t)},b.hide=function(t){return this.toggle(_,t)},b.focus=function(t){if(!this.rendered||this.destroyed)return this;var e=r(F),n=this.tooltip,i=parseInt(n[0].style.zIndex,10),o=y.zindex+e.length;return n.hasClass(R)||this._trigger("focus",[o],t)&&(i!==o&&(e.each(function(){this.style.zIndex>i&&(this.style.zIndex=this.style.zIndex-1)}),e.filter("."+R).qtip("blur",t)),n.addClass(R)[0].style.zIndex=o),this},b.blur=function(t){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass(R),this._trigger("blur",[this.tooltip.css("zIndex")],t),this)},b.disable=function(t){return this.destroyed?this:("toggle"===t?t=!(this.rendered?this.tooltip.hasClass(V):this.disabled):"boolean"!=typeof t&&(t=k),this.rendered&&this.tooltip.toggleClass(V,t).attr("aria-disabled",t),this.disabled=!!t,this)},b.enable=function(){return this.disable(_)},b._createButton=function(){var t=this,e=this.elements,n=e.tooltip,i=this.options.content.button,o="string"==typeof i,a=o?i:"Close tooltip";e.button&&e.button.remove(),i.jquery?e.button=i:e.button=r("",{"class":"qtip-close "+(this.options.style.widget?"":j+"-icon"),title:a,"aria-label":a}).prepend(r("",{"class":"ui-icon ui-icon-close",html:"×"})),e.button.appendTo(e.titlebar||n).attr("role","button").click(function(e){return n.hasClass(V)||t.hide(e),_})},b._updateButton=function(t){if(!this.rendered)return _;var e=this.elements.button;t?this._createButton():e.remove()},b._setWidget=function(){var t=this.options.style.widget,e=this.elements,n=e.tooltip,r=n.hasClass(V);n.removeClass(V),V=t?"ui-state-disabled":"qtip-disabled",n.toggleClass(V,r),n.toggleClass("ui-helper-reset "+c(),t).toggleClass(W,this.options.style.def&&!t),e.content&&e.content.toggleClass(c("content"),t),e.titlebar&&e.titlebar.toggleClass(c("header"),t),e.button&&e.button.toggleClass(j+"-icon",!t)},b._storeMouse=function(t){return(this.mouse=r.event.fix(t)).type="mousemove",this},b._bind=function(t,e,n,i,o){if(t&&n&&e.length){var a="."+this._id+(i?"-"+i:"");return r(t).bind((e.split?e:e.join(a+" "))+a,r.proxy(n,o||this)),this}},b._unbind=function(t,e){return t&&r(t).unbind("."+this._id+(e?"-"+e:"")),this},b._trigger=function(t,e,n){var i=r.Event("tooltip"+t);return i.originalEvent=n&&r.extend({},n)||this.cache.event||M,this.triggering=t,this.tooltip.trigger(i,[this].concat(e||[])),this.triggering=_,!i.isDefaultPrevented()},b._bindEvents=function(t,e,n,i,o,a){var s=n.filter(i).add(i.filter(n)),u=[];s.length&&(r.each(e,function(e,n){var i=r.inArray(n,t);i>-1&&u.push(t.splice(i,1)[0])}),u.length&&(this._bind(s,u,function(t){var e=!!this.rendered&&this.tooltip[0].offsetWidth>0;(e?a:o).call(this,t)}),n=n.not(s),i=i.not(s))),this._bind(n,t,o),this._bind(i,e,a)},b._assignInitialEvents=function(t){function e(t){return this.disabled||this.destroyed?_:(this.cache.event=t&&r.event.fix(t),this.cache.target=t&&r(t.target),clearTimeout(this.timers.show),void(this.timers.show=f.call(this,function(){this.render("object"==typeof t||n.show.ready)},n.prerender?0:n.show.delay)))}var n=this.options,i=n.show.target,o=n.hide.target,a=n.show.event?r.trim(""+n.show.event).split(" "):[],s=n.hide.event?r.trim(""+n.hide.event).split(" "):[];this._bind(this.elements.target,["remove","removeqtip"],function(t){this.destroy(!0)},"destroy"),/mouse(over|enter)/i.test(n.show.event)&&!/mouse(out|leave)/i.test(n.hide.event)&&s.push("mouseleave"),this._bind(i,"mousemove",function(t){this._storeMouse(t),this.cache.onTarget=k}),this._bindEvents(a,s,i,o,e,function(){return this.timers?void clearTimeout(this.timers.show):_}),(n.show.ready||n.prerender)&&e.call(this,t)},b._assignEvents=function(){var n=this,i=this.options,o=i.position,a=this.tooltip,s=i.show.target,u=i.hide.target,l=o.container,c=o.viewport,f=r(e),v=(r(e.body),r(t)),m=i.show.event?r.trim(""+i.show.event).split(" "):[],b=i.hide.event?r.trim(""+i.hide.event).split(" "):[];r.each(i.events,function(t,e){n._bind(a,"toggle"===t?["tooltipshow","tooltiphide"]:["tooltip"+t],e,null,a)}),/mouse(out|leave)/i.test(i.hide.event)&&"window"===i.hide.leave&&this._bind(f,["mouseout","blur"],function(t){/select|option/.test(t.target.nodeName)||t.relatedTarget||this.hide(t)}),i.hide.fixed?u=u.add(a.addClass(z)):/mouse(over|enter)/i.test(i.show.event)&&this._bind(u,"mouseleave",function(){clearTimeout(this.timers.show)}),(""+i.hide.event).indexOf("unfocus")>-1&&this._bind(l.closest("html"),["mousedown","touchstart"],function(t){var e=r(t.target),n=this.rendered&&!this.tooltip.hasClass(V)&&this.tooltip[0].offsetWidth>0,i=e.parents(F).filter(this.tooltip[0]).length>0;e[0]===this.target[0]||e[0]===this.tooltip[0]||i||this.target.has(e[0]).length||!n||this.hide(t)}),"number"==typeof i.hide.inactive&&(this._bind(s,"qtip-"+this.id+"-inactive",p,"inactive"),this._bind(u.add(a),y.inactiveEvents,p)),this._bindEvents(m,b,s,u,d,h),this._bind(s.add(a),"mousemove",function(t){if("number"==typeof i.hide.distance){var e=this.cache.origin||{},n=this.options.hide.distance,r=Math.abs;(r(t.pageX-e.pageX)>=n||r(t.pageY-e.pageY)>=n)&&this.hide(t)}this._storeMouse(t)}),"mouse"===o.target&&o.adjust.mouse&&(i.hide.event&&this._bind(s,["mouseenter","mouseleave"],function(t){return this.cache?void(this.cache.onTarget="mouseenter"===t.type):_}),this._bind(f,"mousemove",function(t){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass(V)&&this.tooltip[0].offsetWidth>0&&this.reposition(t)})),(o.adjust.resize||c.length)&&this._bind(r.event.special.resize?c:v,"resize",g),o.adjust.scroll&&this._bind(v.add(o.container),"scroll",g)},b._unassignEvents=function(){var n=this.options,i=n.show.target,o=n.hide.target,a=r.grep([this.elements.target[0],this.rendered&&this.tooltip[0],n.position.container[0],n.position.viewport[0],n.position.container.closest("html")[0],t,e],function(t){return"object"==typeof t});i&&i.toArray&&(a=a.concat(i.toArray())),o&&o.toArray&&(a=a.concat(o.toArray())),this._unbind(a)._unbind(a,"destroy")._unbind(a,"inactive")},r(function(){v(F,["mouseenter","mouseleave"],function(t){var e="mouseenter"===t.type,n=r(t.currentTarget),i=r(t.relatedTarget||t.target),o=this.options;e?(this.focus(t),n.hasClass(z)&&!n.hasClass(V)&&clearTimeout(this.timers.hide)):"mouse"===o.position.target&&o.position.adjust.mouse&&o.hide.event&&o.show.target&&!i.closest(o.show.target[0]).length&&this.hide(t),n.toggleClass(B,e)}),v("["+L+"]",q,p)}),y=r.fn.qtip=function(t,e,i){var o=(""+t).toLowerCase(),a=M,u=r.makeArray(arguments).slice(1),l=u[u.length-1],c=this[0]?r.data(this[0],j):M;return!arguments.length&&c||"api"===o?c:"string"==typeof t?(this.each(function(){var t=r.data(this,j);if(!t)return k;if(l&&l.timeStamp&&(t.cache.event=l),!e||"option"!==o&&"options"!==o)t[o]&&t[o].apply(t,u);else{if(i===n&&!r.isPlainObject(e))return a=t.get(e),_;t.set(e,i)}}),a!==M?a:this):"object"!=typeof t&&arguments.length?void 0:(c=s(r.extend(k,{},t)),this.each(function(t){var e,n;return n=r.isArray(c.id)?c.id[t]:c.id,n=!n||n===_||n.length<1||y.api[n]?y.nextid++:n,e=m(r(this),n,c),e===_?k:(y.api[n]=e,r.each(O,function(){"initialize"===this.initialize&&this(e)}),void e._assignInitialEvents(l))}))},r.qtip=i,y.api={},r.each({attr:function(t,e){if(this.length){var n=this[0],i="title",o=r.data(n,"qtip");if(t===i&&o&&"object"==typeof o&&o.options.suppress)return arguments.length<2?r.attr(n,U):(o&&o.options.content.attr===i&&o.cache.attr&&o.set("content.text",e),this.attr(U,e))}return r.fn["attr"+H].apply(this,arguments)},clone:function(t){var e=(r([]),r.fn["clone"+H].apply(this,arguments));return t||e.filter("["+U+"]").attr("title",function(){return r.attr(this,U)}).removeAttr(U),e}},function(t,e){if(!e||r.fn[t+H])return k;var n=r.fn[t+H]=r.fn[t];r.fn[t]=function(){return e.apply(this,arguments)||n.apply(this,arguments)}}),r.ui||(r["cleanData"+H]=r.cleanData,r.cleanData=function(t){for(var e,n=0;(e=r(t[n])).length;n++)if(e.attr(I))try{e.triggerHandler("removeqtip")}catch(i){}r["cleanData"+H].apply(this,arguments)}),y.version="2.2.1",y.nextid=0,y.inactiveEvents=q,y.zindex=15e3,y.defaults={prerender:_,id:_,overwrite:k,suppress:k,content:{text:k,attr:"title",title:_,button:_},position:{my:"top left",at:"bottom right",target:_,container:_,viewport:_,adjust:{x:0,y:0,mouse:k,scroll:k,resize:k,method:"flipinvert flipinvert"},effect:function(t,e,n){r(this).animate(e,{duration:200,queue:_})}},show:{target:_,event:"mouseenter",effect:k,delay:90,solo:_,ready:_,autofocus:_},hide:{target:_,event:"mouseleave",effect:k,delay:0,fixed:_,inactive:_,leave:"window",distance:_},style:{classes:"",widget:_,width:_,height:_,def:k},events:{render:M,move:M,show:M,hide:M,toggle:M,visible:M,hidden:M,focus:M,blur:M}}})}(window,document),function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.dagreD3=t()}}(function(){return function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a=t[0]&&i.x()(e,n)<=t[1]}),disableTooltip:e.disableTooltip}}));e.transition().duration(D).call(i),S(),I()}var W=d3.select(this);t.utils.initSVG(W);var R=t.utils.availableWidth(h,W,d),B=t.utils.availableHeight(p,W,d)-(w?f.height():0);if(e.update=function(){W.transition().duration(D).call(e)},e.container=this,M.setter(F(c),e.update).getter(P(c)).update(),M.disabled=c.map(function(t){return!!t.disabled}),!C){var V;C={};for(V in M)M[V]instanceof Array?C[V]=M[V].slice(0):C[V]=M[V]}if(!(c&&c.length&&c.filter(function(t){return t.values.length}).length))return t.utils.noData(e,W),e;W.selectAll(".nv-noData").remove(),n=i.xScale(),r=i.yScale();var H=W.selectAll("g.nv-wrap.nv-stackedAreaChart").data([c]),U=H.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),Y=H.select("g");U.append("g").attr("class","nv-legendWrap"),U.append("g").attr("class","nv-controlsWrap");var G=U.append("g").attr("class","nv-focus");G.append("g").attr("class","nv-background").append("rect"),G.append("g").attr("class","nv-x nv-axis"),G.append("g").attr("class","nv-y nv-axis"),G.append("g").attr("class","nv-stackedWrap"),G.append("g").attr("class","nv-interactive");U.append("g").attr("class","nv-focusWrap");if(m){var X=v?R-A:R;s.width(X),Y.select(".nv-legendWrap").datum(c).call(s),s.height()>d.top&&(d.top=s.height(),B=t.utils.availableHeight(p,W,d)-(w?f.height():0)),Y.select(".nv-legendWrap").attr("transform","translate("+(R-X)+","+-d.top+")")}else Y.select(".nv-legendWrap").selectAll("*").remove();if(v){var Z=[{key:N.stacked||"Stacked",metaKey:"Stacked",disabled:"stack"!=i.style(),style:"stack"},{key:N.stream||"Stream",metaKey:"Stream",disabled:"stream"!=i.style(),style:"stream"},{key:N.expanded||"Expanded",metaKey:"Expanded",disabled:"expand"!=i.style(),style:"expand"},{key:N.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:"stack_percent"!=i.style(),style:"stack_percent"}];A=T.length/3*260,Z=Z.filter(function(t){return T.indexOf(t.metaKey)!==-1}),u.width(A).color(["#444","#444","#444"]),Y.select(".nv-controlsWrap").datum(Z).call(u),Math.max(u.height(),s.height())>d.top&&(d.top=Math.max(u.height(),s.height()),B=t.utils.availableHeight(p,W,d)),Y.select(".nv-controlsWrap").attr("transform","translate(0,"+-d.top+")")}else Y.select(".nv-controlsWrap").selectAll("*").remove();H.attr("transform","translate("+d.left+","+d.top+")"),x&&Y.select(".nv-y.nv-axis").attr("transform","translate("+R+",0)"),$&&(l.width(R).height(B).margin({left:d.left,top:d.top}).svgContainer(W).xScale(n),H.select(".nv-interactive").call(l)),Y.select(".nv-focus .nv-background rect").attr("width",R).attr("height",B),i.width(R).height(B).color(c.map(function(t,e){return t.color||g(t,e)}).filter(function(t,e){return!c[e].disabled}));var Q=Y.select(".nv-focus .nv-stackedWrap").datum(c.filter(function(t){return!t.disabled}));if(y&&o.scale(n)._ticks(t.utils.calcTicksX(R/100,c)).tickSize(-B,0),b){var K;K="wiggle"===i.offset()?0:t.utils.calcTicksY(B/36,c),a.scale(r)._ticks(K).tickSize(-R,0)}if(w){f.width(R),Y.select(".nv-focusWrap").attr("transform","translate(0,"+(B+d.bottom+f.margin().top)+")").datum(c.filter(function(t){return!t.disabled})).call(f);var J=f.brush.empty()?f.xDomain():f.brush.extent();null!==J&&z(J)}else Q.transition().call(i),S(),I();i.dispatch.on("areaClick.toggle",function(t){1===c.filter(function(t){return!t.disabled}).length?c.forEach(function(t){t.disabled=!1}):c.forEach(function(e,n){e.disabled=n!=t.seriesIndex}),M.disabled=c.map(function(t){return!!t.disabled}),E.stateChange(M),e.update()}),s.dispatch.on("stateChange",function(t){for(var n in t)M[n]=t[n];E.stateChange(M),e.update()}),u.dispatch.on("legendClick",function(t,n){t.disabled&&(Z=Z.map(function(t){return t.disabled=!0,t}),t.disabled=!1,i.style(t.style),M.style=i.style(),E.stateChange(M),e.update())}),l.dispatch.on("elementMousemove",function(n){i.clearHighlights();var r,o,a,s=[],u=0,f=!0;if(c.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(l,c){o=t.interactiveBisect(l.values,n.pointXValue,e.x());var d=l.values[o],h=e.y()(d,o);if(null!=h&&i.highlightPoint(c,o,!0),"undefined"!=typeof d){"undefined"==typeof r&&(r=d),"undefined"==typeof a&&(a=e.xScale()(e.x()(d,o)));var p="expand"==i.style()?d.display.y:e.y()(d,o);s.push({key:l.key,value:p,color:g(l,l.seriesIndex),point:d}),k&&"expand"!=i.style()&&null!=p&&(u+=p,f=!1)}}),s.reverse(),s.length>2){var d=e.yScale().invert(n.mouseY),h=null;s.forEach(function(t,e){d=Math.abs(d);var n=Math.abs(t.point.display.y0),r=Math.abs(t.point.display.y);if(d>=n&&d<=r+n)return void(h=e)}),null!=h&&(s[h].highlight=!0)}k&&"expand"!=i.style()&&s.length>=2&&!f&&s.push({key:_,value:u,total:!0});var p=e.x()(r,o),v=l.tooltip.valueFormatter();"expand"===i.style()||"stack_percent"===i.style()?(j||(j=v),v=d3.format(".1%")):j&&(v=j,j=null),l.tooltip.valueFormatter(v).data({value:p,series:s})(),l.renderGuideLine(a)}),l.dispatch.on("elementMouseout",function(t){i.clearHighlights()}),f.dispatch.on("onBrush",function(t){z(t)}),E.on("changeState",function(t){"undefined"!=typeof t.disabled&&c.length===t.disabled.length&&(c.forEach(function(e,n){e.disabled=t.disabled[n]}),M.disabled=t.disabled),"undefined"!=typeof t.style&&(i.style(t.style),L=t.style),e.update()})}),I.renderEnd("stacked Area chart immediate"),e}var n,r,i=t.models.stackedArea(),o=t.models.axis(),a=t.models.axis(),s=t.models.legend(),u=t.models.legend(),l=t.interactiveGuideline(),c=t.models.tooltip(),f=t.models.focus(t.models.stackedArea()),d={top:30,right:25,bottom:50,left:60},h=null,p=null,g=t.utils.defaultColor(),v=!0,m=!0,y=!0,b=!0,x=!1,w=!1,$=!1,k=!0,_="TOTAL",M=t.utils.state(),C=null,S=null,E=d3.dispatch("stateChange","changeState","renderEnd"),A=250,T=["Stacked","Stream","Expanded"],N={},D=250;M.style=i.style(),o.orient("bottom").tickPadding(7),a.orient(x?"right":"left"),c.headerFormatter(function(t,e){return o.tickFormat()(t,e)}).valueFormatter(function(t,e){return a.tickFormat()(t,e)}),l.tooltip.headerFormatter(function(t,e){return o.tickFormat()(t,e)}).valueFormatter(function(t,e){return null==t?"N/A":a.tickFormat()(t,e)});var O=null,j=null;u.updateState(!1);var I=t.utils.renderWatch(E),L=i.style(),P=function(t){return function(){return{active:t.map(function(t){return!t.disabled}),style:i.style()}}},F=function(t){return function(e){void 0!==e.style&&(L=e.style),void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}},q=d3.format("%");return i.dispatch.on("elementMouseover.tooltip",function(t){t.point.x=i.x()(t.point),t.point.y=i.y()(t.point),c.data(t).hidden(!1)}),i.dispatch.on("elementMouseout.tooltip",function(t){c.hidden(!0)}),e.dispatch=E,e.stacked=i,e.legend=s,e.controls=u,e.xAxis=o,e.x2Axis=f.xAxis,e.yAxis=a,e.y2Axis=f.yAxis,e.interactiveLayer=l,e.tooltip=c,e.focus=f,e.dispatch=E,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{width:{get:function(){return h},set:function(t){h=t}},height:{get:function(){return p},set:function(t){p=t}},showLegend:{get:function(){return m},set:function(t){m=t}},showXAxis:{get:function(){return y},set:function(t){y=t}},showYAxis:{get:function(){return b},set:function(t){b=t}},defaultState:{get:function(){return C},set:function(t){C=t}},noData:{get:function(){return S},set:function(t){S=t}},showControls:{get:function(){return v},set:function(t){v=t}},controlLabels:{get:function(){return N},set:function(t){N=t}},controlOptions:{get:function(){return T},set:function(t){T=t}},showTotalInTooltip:{get:function(){return k},set:function(t){k=t}},totalLabel:{get:function(){return _},set:function(t){_=t}},focusEnable:{get:function(){return w},set:function(t){w=t}},focusHeight:{get:function(){return f.height()},set:function(t){f.height(t)}},brushExtent:{get:function(){return f.brushExtent()},set:function(t){f.brushExtent(t)}},margin:{get:function(){return d},set:function(t){d.top=void 0!==t.top?t.top:d.top,d.right=void 0!==t.right?t.right:d.right,d.bottom=void 0!==t.bottom?t.bottom:d.bottom,d.left=void 0!==t.left?t.left:d.left}},focusMargin:{get:function(){return f.margin},set:function(t){f.margin.top=void 0!==t.top?t.top:f.margin.top,f.margin.right=void 0!==t.right?t.right:f.margin.right,f.margin.bottom=void 0!==t.bottom?t.bottom:f.margin.bottom,f.margin.left=void 0!==t.left?t.left:f.margin.left}},duration:{get:function(){return D},set:function(t){D=t,I.reset(D),i.duration(D),o.duration(D),a.duration(D)}},color:{get:function(){return g},set:function(e){g=t.utils.getColor(e),s.color(g),i.color(g),f.color(g)}},x:{get:function(){return i.x()},set:function(t){i.x(t),f.x(t)}},y:{get:function(){return i.y()},set:function(t){i.y(t),f.y(t)}},rightAlignYAxis:{get:function(){return x},set:function(t){x=t,a.orient(x?"right":"left")}},useInteractiveGuideline:{get:function(){return $},set:function(t){$=!!t,e.interactive(!t),e.useVoronoi(!t),i.scatter.interactive(!t)}}}),t.utils.inheritOptions(e,i),t.utils.initOptions(e),e},t.models.stackedAreaWithFocusChart=function(){return t.models.stackedAreaChart().margin({bottom:30}).focusEnable(!0)},t.models.sunburst=function(){"use strict";function e(t){var e=n(t);return e>90?180:0}function n(t){var e=Math.max(0,Math.min(2*Math.PI,N(t.x))),n=Math.max(0,Math.min(2*Math.PI,N(t.x+t.dx))),r=(e+n)/2*(180/Math.PI)-90;return r}function r(t){var e=Math.max(0,Math.min(2*Math.PI,N(t.x))),n=Math.max(0,Math.min(2*Math.PI,N(t.x+t.dx)));return(n-e)/(2*Math.PI)}function i(t){var e=Math.max(0,Math.min(2*Math.PI,N(t.x))),n=Math.max(0,Math.min(2*Math.PI,N(t.x+t.dx))),r=n-e;return r>M}function o(t,e){var n=d3.interpolate(N.domain(),[f.x,f.x+f.dx]),r=d3.interpolate(D.domain(),[f.y,1]),i=d3.interpolate(D.range(),[f.y?20:0,p]);return 0===e?function(){return I(t)}:function(e){return N.domain(n(e)),D.domain(r(e)).range(i(e)),I(t)}}function a(t){var e=d3.interpolate({x:t.x0,dx:t.dx0,y:t.y0,dy:t.dy0},t);return function(n){var r=e(n);return t.x0=r.x,t.dx0=r.dx,t.y0=r.y,t.dy0=r.dy,I(r)}}function s(t){var e=S(t);j[e]||(j[e]={});var n=j[e];n.dx=t.dx,n.x=t.x,n.dy=t.dy,n.y=t.y}function u(t){t.forEach(function(t){var e=S(t),n=j[e];n?(t.dx0=n.dx,t.x0=n.x,t.dy0=n.dy,t.y0=n.y):(t.dx0=t.dx,t.x0=t.x,t.dy0=t.dy,t.y0=t.y),s(t)})}function l(t){var r=w.selectAll("text"),a=w.selectAll("path");r.transition().attr("opacity",0),f=t,a.transition().duration(A).attrTween("d",o).each("end",function(r){if(r.x>=t.x&&r.x=t.depth){var o=d3.select(this.parentNode),a=o.select("text");a.transition().duration(A).text(function(t){return _(t)}).attr("opacity",function(t){return i(t)?1:0}).attr("transform",function(){var i=this.getBBox().width;if(0===r.depth)return"translate("+i/2*-1+",0)";if(r.depth===t.depth)return"translate("+(D(r.y)+5)+",0)";var o=n(r),a=e(r);return 0===a?"rotate("+o+")translate("+(D(r.y)+5)+",0)":"rotate("+o+")translate("+(D(r.y)+i+5)+",0)rotate("+a+")"})}})}function c(o){return L.reset(),o.each(function(o){w=d3.select(this),d=t.utils.availableWidth(v,w,g),h=t.utils.availableHeight(m,w,g),p=Math.min(d,h)/2,D.range([0,p]);var s=w.select("g.nvd3.nv-wrap.nv-sunburst");s[0][0]?s.attr("transform","translate("+(d/2+g.left+g.right)+","+(h/2+g.top+g.bottom)+")"):s=w.append("g").attr("class","nvd3 nv-wrap nv-sunburst nv-chart-"+x).attr("transform","translate("+(d/2+g.left+g.right)+","+(h/2+g.top+g.bottom)+")"),w.on("click",function(t,e){T.chartClick({data:t,index:e,pos:d3.event,id:x})}),O.value(b[y]||b.count);var c=O.nodes(o[0]).reverse();u(c);var f=s.selectAll(".arc-container").data(c,S),M=f.enter().append("g").attr("class","arc-container");M.append("path").attr("d",I).style("fill",function(t){return t.color?t.color:$(E?(t.children?t:t.parent).name:t.name)}).style("stroke","#FFF").on("click",l).on("mouseover",function(t,e){d3.select(this).classed("hover",!0).style("opacity",.8),T.elementMouseover({data:t,color:d3.select(this).style("fill"),percent:r(t)})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1).style("opacity",1),T.elementMouseout({data:t})}).on("mousemove",function(t,e){T.elementMousemove({data:t})}),f.each(function(t){d3.select(this).select("path").transition().duration(A).attrTween("d",a)}),k&&(f.selectAll("text").remove(),f.append("text").text(function(t){return _(t)}).transition().duration(A).attr("opacity",function(t){return i(t)?1:0}).attr("transform",function(t){var r=this.getBBox().width;if(0===t.depth)return"rotate(0)translate("+r/2*-1+",0)";var i=n(t),o=e(t);return 0===o?"rotate("+i+")translate("+(D(t.y)+5)+",0)":"rotate("+i+")translate("+(D(t.y)+r+5)+",0)rotate("+o+")"})),l(c[c.length-1]),f.exit().transition().duration(A).attr("opacity",0).each("end",function(t){var e=S(t);j[e]=void 0}).remove()}),L.renderEnd("sunburst immediate"),c}var f,d,h,p,g={top:0,right:0,bottom:0,left:0},v=600,m=600,y="count",b={count:function(t){return 1},value:function(t){return t.value||t.size},size:function(t){return t.value||t.size}},x=Math.floor(1e4*Math.random()),w=null,$=t.utils.defaultColor(),k=!1,_=function(t){return"count"===y?t.name+" #"+t.value:t.name+" "+(t.value||t.size)},M=.02,C=function(t,e){return t.name>e.name},S=function(t,e){return t.name},E=!0,A=500,T=d3.dispatch("chartClick","elementClick","elementDblClick","elementMousemove","elementMouseover","elementMouseout","renderEnd"),N=d3.scale.linear().range([0,2*Math.PI]),D=d3.scale.sqrt(),O=d3.layout.partition().sort(C),j={},I=d3.svg.arc().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,N(t.x)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,N(t.x+t.dx)))}).innerRadius(function(t){return Math.max(0,D(t.y))}).outerRadius(function(t){return Math.max(0,D(t.y+t.dy))}),L=t.utils.renderWatch(T);return c.dispatch=T,c.options=t.utils.optionsFunc.bind(c),c._options=Object.create({},{width:{get:function(){return v},set:function(t){v=t}},height:{get:function(){return m},set:function(t){m=t}},mode:{get:function(){return y},set:function(t){y=t}},id:{get:function(){return x},set:function(t){x=t}},duration:{get:function(){return A},set:function(t){A=t}},groupColorByParent:{get:function(){return E},set:function(t){E=!!t}},showLabels:{get:function(){return k},set:function(t){k=!!t}},labelFormat:{get:function(){return _},set:function(t){_=t}},labelThreshold:{get:function(){return M},set:function(t){M=t}},sort:{get:function(){return C},set:function(t){C=t}},key:{get:function(){return S},set:function(t){S=t}},margin:{get:function(){return g},set:function(t){g.top=void 0!=t.top?t.top:g.top,g.right=void 0!=t.right?t.right:g.right,g.bottom=void 0!=t.bottom?t.bottom:g.bottom,g.left=void 0!=t.left?t.left:g.left}},color:{get:function(){return $},set:function(e){$=t.utils.getColor(e)}}}),t.utils.initOptions(c),c},t.models.sunburstChart=function(){"use strict";function e(r){return h.reset(),h.models(n),r.each(function(r){var s=d3.select(this);t.utils.initSVG(s);var u=t.utils.availableWidth(o,s,i),l=t.utils.availableHeight(a,s,i);return e.update=function(){0===f?s.call(e):s.transition().duration(f).call(e)},e.container=s,r&&r.length?(s.selectAll(".nv-noData").remove(),n.width(u).height(l).margin(i),void s.call(n)):(t.utils.noData(e,s),e)}),h.renderEnd("sunburstChart immediate"),e}var n=t.models.sunburst(),r=t.models.tooltip(),i={top:30,right:20,bottom:20,left:20},o=null,a=null,s=t.utils.defaultColor(),u=!1,l=(Math.round(1e5*Math.random()),null),c=null,f=250,d=d3.dispatch("stateChange","changeState","renderEnd"),h=t.utils.renderWatch(d);return r.duration(0).headerEnabled(!1).valueFormatter(function(t){return t}),n.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:t.data.name,value:t.data.value||t.data.size,color:t.color,percent:t.percent},u||(delete t.percent,delete t.series.percent),r.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){r.hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){r()}),e.dispatch=d,e.sunburst=n,e.tooltip=r,e.options=t.utils.optionsFunc.bind(e),e._options=Object.create({},{noData:{get:function(){return c},set:function(t){c=t}},defaultState:{get:function(){return l},set:function(t){l=t}},showTooltipPercent:{get:function(){return u},set:function(t){u=t}},color:{get:function(){return s},set:function(t){s=t,n.color(s)}},duration:{get:function(){return f},set:function(t){f=t,h.reset(f),n.duration(f)}},margin:{get:function(){return i},set:function(t){i.top=void 0!==t.top?t.top:i.top,i.right=void 0!==t.right?t.right:i.right,i.bottom=void 0!==t.bottom?t.bottom:i.bottom,i.left=void 0!==t.left?t.left:i.left,n.margin(i)}}}),t.utils.inheritOptions(e,n),t.utils.initOptions(e),e},t.version="1.8.4"}(),function(){var t=this,e="addEventListener",n="removeEventListener",r="getBoundingClientRect",i=t.attachEvent&&!t[e],o=t.document,a=function(){for(var t,e=["","-webkit-","-moz-","-o-"],n=0;n=this.size-this.bMin-l.snapOffset&&(e=this.size-this.bMin),k.call(this,e),l.onDrag&&l.onDrag())},$=function(){var e=t.getComputedStyle(this.parent),n=this.parent[d]-parseFloat(e[v])-parseFloat(e[m]);this.size=this.a[r]()[c]+this.b[r]()[c]+this.aGutterSize+this.bGutterSize,this.percentage=Math.min(this.size/n*100,100),this.start=this.a[r]()[p]},k=function(t){this.a.style[c]=a+"("+t/this.size*this.percentage+"% - "+this.aGutterSize+"px)",this.b.style[c]=a+"("+(this.percentage-t/this.size*this.percentage)+"% - "+this.bGutterSize+"px)"},_=function(){var t=this,e=t.a,n=t.b;e[r]()[c]=0;e--)$.call(t[e]),M.call(t[e])},S=function(){return!1},E=s(u[0]).parentNode;if(!l.sizes){var A=100/u.length;for(l.sizes=[],f=0;f0&&(D={a:s(u[f-1]),b:O,aMin:l.minSize[f-1],bMin:l.minSize[f],dragging:!1,parent:E,isFirst:j,isLast:I,direction:l.direction},D.aGutterSize=l.gutterSize,D.bGutterSize=l.gutterSize,j&&(D.aGutterSize=l.gutterSize/2),I&&(D.bGutterSize=l.gutterSize/2)),i)N="string"==typeof l.sizes[f]||l.sizes[f]instanceof String?l.sizes[f]:l.sizes[f]+"%";else{if(f>0){var P=o.createElement("div");P.className=g,P.style[c]=l.gutterSize+"px",P[e]("mousedown",b.bind(D)),P[e]("touchstart",b.bind(D)),E.insertBefore(P,O),D.gutter=P}0!==f&&f!=u.length-1||(L=l.gutterSize/2),N="string"==typeof l.sizes[f]||l.sizes[f]instanceof String?l.sizes[f]:a+"("+l.sizes[f]+"% - "+L+"px)"}O.style[c]=N,f>0&&y.push(D)}C(y)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=u),exports.Split=u):t.Split=u}.call(window),function(){"use strict";function t(t,e){return t.module("angularMoment",[]).constant("angularMomentConfig",{preprocess:null,timezone:"",format:null,statefulFilters:!0}).constant("moment",e).constant("amTimeAgoConfig",{withoutSuffix:!1,serverTime:null,titleFormat:null,fullDateThreshold:null,fullDateFormat:null}).directive("amTimeAgo",["$window","moment","amMoment","amTimeAgoConfig","angularMomentConfig",function(e,n,r,i,o){return function(a,s,u){function l(){var t;if(g)t=g;else if(i.serverTime){var e=(new Date).getTime(),r=e-$+i.serverTime;t=n(r)}else t=n();return t}function c(){v&&(e.clearTimeout(v),v=null)}function f(t){var n=l().diff(t,"day"),r=x&&n>=x;if(r?s.text(t.format(w)):s.text(t.from(l(),y)),b&&!s.attr("title")&&s.attr("title",t.local().format(b)),!r){var i=Math.abs(l().diff(t,"minute")),o=3600;i<1?o=1:i<60?o=30:i<180&&(o=300),v=e.setTimeout(function(){f(t)},1e3*o)}}function d(t){M&&s.attr("datetime",t)}function h(){if(c(),p){var t=r.preprocessDate(p,k,m);f(t),d(t.toISOString())}}var p,g,v=null,m=o.format,y=i.withoutSuffix,b=i.titleFormat,x=i.fullDateThreshold,w=i.fullDateFormat,$=(new Date).getTime(),k=o.preprocess,_=u.amTimeAgo,M="TIME"===s[0].nodeName.toUpperCase();a.$watch(_,function(t){return"undefined"==typeof t||null===t||""===t?(c(),void(p&&(s.text(""),d(""),p=null))):(p=t,void h())}),t.isDefined(u.amFrom)&&a.$watch(u.amFrom,function(t){g="undefined"==typeof t||null===t||""===t?null:n(t),h()}),t.isDefined(u.amWithoutSuffix)&&a.$watch(u.amWithoutSuffix,function(t){"boolean"==typeof t?(y=t,h()):y=i.withoutSuffix}),u.$observe("amFormat",function(t){"undefined"!=typeof t&&(m=t,h())}),u.$observe("amPreprocess",function(t){k=t,h()}),u.$observe("amFullDateThreshold",function(t){x=t,h()}),u.$observe("amFullDateFormat",function(t){w=t,h()}),a.$on("$destroy",function(){c()}),a.$on("amMoment:localeChanged",function(){h()})}}]).service("amMoment",["moment","$rootScope","$log","angularMomentConfig",function(e,n,r,i){this.preprocessors={utc:e.utc,unix:e.unix},this.changeLocale=function(r,i){var o=e.locale(r,i);return t.isDefined(r)&&n.$broadcast("amMoment:localeChanged"),o},this.changeTimezone=function(t){i.timezone=t,n.$broadcast("amMoment:timezoneChanged")},this.preprocessDate=function(n,o,a){return t.isUndefined(o)&&(o=i.preprocess),this.preprocessors[o]?this.preprocessors[o](n,a):(o&&r.warn("angular-moment: Ignoring unsupported value for preprocess: "+o),!isNaN(parseFloat(n))&&isFinite(n)?e(parseInt(n,10)):e(n,a))},this.applyTimezone=function(t,e){return(e=e||i.timezone)?(e.match(/^Z|[+-]\d\d:?\d\d$/i)?t=t.utcOffset(e):t.tz?t=t.tz(e):r.warn("angular-moment: named timezone specified but moment.tz() is undefined. Did you forget to include moment-timezone.js?"),t):t}}]).filter("amCalendar",["moment","amMoment","angularMomentConfig",function(t,e,n){function r(n,r,i){if("undefined"==typeof n||null===n)return"";n=e.preprocessDate(n,r);var o=t(n);return o.isValid()?e.applyTimezone(o,i).calendar():""}return r.$stateful=n.statefulFilters,r}]).filter("amDifference",["moment","amMoment","angularMomentConfig",function(t,e,n){function r(n,r,i,o,a,s){if("undefined"==typeof n||null===n)return"";n=e.preprocessDate(n,a);var u=t(n);if(!u.isValid())return"";var l;if("undefined"==typeof r||null===r)l=t();else if(r=e.preprocessDate(r,s),l=t(r),!l.isValid())return"";return e.applyTimezone(u).diff(e.applyTimezone(l),i,o)}return r.$stateful=n.statefulFilters,r}]).filter("amDateFormat",["moment","amMoment","angularMomentConfig",function(t,e,n){function r(r,i,o,a,s){var u=s||n.format;if("undefined"==typeof r||null===r)return"";r=e.preprocessDate(r,o,u);var l=t(r);return l.isValid()?e.applyTimezone(l,a).format(i):""}return r.$stateful=n.statefulFilters,r}]).filter("amDurationFormat",["moment","angularMomentConfig",function(t,e){function n(e,n,r){return"undefined"==typeof e||null===e?"":t.duration(e,n).humanize(r)}return n.$stateful=e.statefulFilters,n}]).filter("amTimeAgo",["moment","amMoment","angularMomentConfig",function(t,e,n){function r(n,r,i,o){var a,s;return"undefined"==typeof n||null===n?"":(n=e.preprocessDate(n,r),a=t(n),a.isValid()?(s=t(o),"undefined"!=typeof o&&s.isValid()?e.applyTimezone(a).from(s,i):e.applyTimezone(a).fromNow(i)):"")}return r.$stateful=n.statefulFilters,r}]).filter("amSubtract",["moment","angularMomentConfig",function(t,e){function n(e,n,r){return"undefined"==typeof e||null===e?"":t(e).subtract(parseInt(n,10),r)}return n.$stateful=e.statefulFilters,n}]).filter("amAdd",["moment","angularMomentConfig",function(t,e){function n(e,n,r){return"undefined"==typeof e||null===e?"":t(e).add(parseInt(n,10),r)}return n.$stateful=e.statefulFilters,n}])}"function"==typeof define&&define.amd?define(["angular","moment"],t):"undefined"!=typeof module&&module&&module.exports?(t(angular,require("moment")),module.exports="angularMoment"):t(angular,("undefined"!=typeof global?global:window).moment)}(),function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a0&&(i=u.removeMin(),o=s[i],o.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return s}var o=t("../lodash"),a=t("../data/priority-queue");e.exports=r;var s=o.constant(1)},{"../data/priority-queue":16,"../lodash":20}],7:[function(t,e,n){function r(t){return i.filter(o(t),function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})}var i=t("../lodash"),o=t("./tarjan");e.exports=r},{"../lodash":20,"./tarjan":14}],8:[function(t,e,n){function r(t,e,n){return i(t,e||a,n||function(e){return t.outEdges(e)})}function i(t,e,n){var r={},i=t.nodes();return i.forEach(function(t){r[t]={},r[t][t]={distance:0},i.forEach(function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})}),n(t).forEach(function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}})}),i.forEach(function(t){var e=r[t];i.forEach(function(n){var o=r[n];i.forEach(function(n){var r=o[t],i=e[n],a=o[n],s=r.distance+i.distance;s0;){if(r=l.removeMin(),i.has(u,r))s.setEdge(r,u[r]);else{if(c)throw new Error("Input graph is not connected: "+t);c=!0}t.nodeEdges(r).forEach(n)}return s}var i=t("../lodash"),o=t("../graph"),a=t("../data/priority-queue");e.exports=r},{"../data/priority-queue":16,"../graph":17,"../lodash":20}],14:[function(t,e,n){function r(t){function e(s){var u=o[s]={onStack:!0,lowlink:n,index:n++};if(r.push(s),t.successors(s).forEach(function(t){i.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(e(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))}),u.lowlink===u.index){var l,c=[];do l=r.pop(),o[l].onStack=!1,c.push(l);while(s!==l);a.push(c)}}var n=0,r=[],o={},a=[];return t.nodes().forEach(function(t){i.has(o,t)||e(t)}),a}var i=t("../lodash");e.exports=r},{"../lodash":20}],15:[function(t,e,n){function r(t){function e(s){if(o.has(r,s))throw new i;o.has(n,s)||(r[s]=!0,n[s]=!0,o.each(t.predecessors(s),e),delete r[s],a.push(s))}var n={},r={},a=[];if(o.each(t.sinks(),e),o.size(n)!==t.nodeCount())throw new i;return a}function i(){}var o=t("../lodash");e.exports=r,r.CycleException=i},{"../lodash":20}],16:[function(t,e,n){function r(){this._arr=[],this._keyIndices={}}var i=t("../lodash");e.exports=r,r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(t){return t.key})},r.prototype.has=function(t){return i.has(this._keyIndices,t)},r.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},r.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(t,e){var n=this._keyIndices;if(t=String(t),!i.has(n,t)){var r=this._arr,o=r.length;return n[t]=o,r.push({key:t,priority:e}),this._decrease(o),!0}return!1},r.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},r.prototype.decrease=function(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)},r.prototype._heapify=function(t){var e=this._arr,n=2*t,r=n+1,i=t;n>1,!(n[e].priorityo){var a=i;i=o,o=a}return i+d+o+d+(l.isUndefined(r)?c:r)}function s(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return r&&(s.name=r),s}function u(t,e){return a(t,e.v,e.w,e.name)}var l=t("./lodash");e.exports=r;var c="\0",f="\0",d="";r.prototype._nodeCount=0,r.prototype._edgeCount=0,r.prototype.isDirected=function(){return this._isDirected},r.prototype.isMultigraph=function(){return this._isMultigraph},r.prototype.isCompound=function(){return this._isCompound},r.prototype.setGraph=function(t){return this._label=t,this},r.prototype.graph=function(){return this._label},r.prototype.setDefaultNodeLabel=function(t){return l.isFunction(t)||(t=l.constant(t)),this._defaultNodeLabelFn=t,this},r.prototype.nodeCount=function(){return this._nodeCount},r.prototype.nodes=function(){return l.keys(this._nodes)},r.prototype.sources=function(){return l.filter(this.nodes(),function(t){return l.isEmpty(this._in[t])},this)},r.prototype.sinks=function(){return l.filter(this.nodes(),function(t){return l.isEmpty(this._out[t])},this)},r.prototype.setNodes=function(t,e){var n=arguments;return l.each(t,function(t){n.length>1?this.setNode(t,e):this.setNode(t)},this),this},r.prototype.setNode=function(t,e){return l.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=f,this._children[t]={},this._children[f][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},r.prototype.node=function(t){return this._nodes[t]},r.prototype.hasNode=function(t){return l.has(this._nodes,t)},r.prototype.removeNode=function(t){var e=this;if(l.has(this._nodes,t)){var n=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],l.each(this.children(t),function(t){this.setParent(t)},this),delete this._children[t]),l.each(l.keys(this._in[t]),n),delete this._in[t],delete this._preds[t],l.each(l.keys(this._out[t]),n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},r.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(l.isUndefined(e))e=f;else{e+="";for(var n=e;!l.isUndefined(n);n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},r.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},r.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==f)return e}},r.prototype.children=function(t){if(l.isUndefined(t)&&(t=f),this._isCompound){var e=this._children[t];if(e)return l.keys(e)}else{if(t===f)return this.nodes();if(this.hasNode(t))return[]}},r.prototype.predecessors=function(t){var e=this._preds[t];if(e)return l.keys(e)},r.prototype.successors=function(t){var e=this._sucs[t];if(e)return l.keys(e)},r.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return l.union(e,this.successors(t))},r.prototype.filterNodes=function(t){function e(t){var o=r.parent(t);return void 0===o||n.hasNode(o)?(i[t]=o,o):o in i?i[o]:e(o)}var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),l.each(this._nodes,function(e,r){t(r)&&n.setNode(r,e)},this),l.each(this._edgeObjs,function(t){n.hasNode(t.v)&&n.hasNode(t.w)&&n.setEdge(t,this.edge(t))},this);var r=this,i={};return this._isCompound&&l.each(n.nodes(),function(t){n.setParent(t,e(t))}),n},r.prototype.setDefaultEdgeLabel=function(t){return l.isFunction(t)||(t=l.constant(t)),this._defaultEdgeLabelFn=t,this},r.prototype.edgeCount=function(){return this._edgeCount},r.prototype.edges=function(){return l.values(this._edgeObjs)},r.prototype.setPath=function(t,e){var n=this,r=arguments;return l.reduce(t,function(t,i){return r.length>1?n.setEdge(t,i,e):n.setEdge(t,i),i}),this},r.prototype.setEdge=function(){var t,e,n,r,o=!1,u=arguments[0];"object"==typeof u&&null!==u&&"v"in u?(t=u.v,e=u.w,n=u.name,2===arguments.length&&(r=arguments[1],o=!0)):(t=u,e=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],o=!0)),t=""+t,e=""+e,l.isUndefined(n)||(n=""+n);var c=a(this._isDirected,t,e,n);if(l.has(this._edgeLabels,c))return o&&(this._edgeLabels[c]=r),this;if(!l.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[c]=o?r:this._defaultEdgeLabelFn(t,e,n);var f=s(this._isDirected,t,e,n);return t=f.v,e=f.w,Object.freeze(f),this._edgeObjs[c]=f,i(this._preds[e],t),i(this._sucs[t],e),this._in[e][c]=f,this._out[t][c]=f,this._edgeCount++,this},r.prototype.edge=function(t,e,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):a(this._isDirected,t,e,n);return this._edgeLabels[r]},r.prototype.hasEdge=function(t,e,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):a(this._isDirected,t,e,n);return l.has(this._edgeLabels,r)},r.prototype.removeEdge=function(t,e,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):a(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],o(this._preds[e],t),o(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this},r.prototype.inEdges=function(t,e){var n=this._in[t];if(n){var r=l.values(n);return e?l.filter(r,function(t){return t.v===e}):r}},r.prototype.outEdges=function(t,e){var n=this._out[t];if(n){var r=l.values(n);return e?l.filter(r,function(t){return t.w===e}):r}},r.prototype.nodeEdges=function(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))}},{"./lodash":20}],18:[function(t,e,n){e.exports={Graph:t("./graph"),version:t("./version")}},{"./graph":17,"./version":21}],19:[function(t,e,n){function r(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:o(t)};return s.isUndefined(t.graph())||(e.value=s.clone(t.graph())),e}function i(t){return s.map(t.nodes(),function(e){var n=t.node(e),r=t.parent(e),i={v:e};return s.isUndefined(n)||(i.value=n),s.isUndefined(r)||(i.parent=r),i})}function o(t){return s.map(t.edges(),function(e){var n=t.edge(e),r={v:e.v,w:e.w};return s.isUndefined(e.name)||(r.name=e.name),s.isUndefined(n)||(r.value=n),r})}function a(t){var e=new u(t.options).setGraph(t.value);return s.each(t.nodes,function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),s.each(t.edges,function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}var s=t("./lodash"),u=t("./graph");e.exports={write:r,read:a}},{"./graph":17,"./lodash":20}],20:[function(t,e,n){var r;if("function"==typeof t)try{r=t("lodash")}catch(i){}r||(r=window._),e.exports=r},{lodash:void 0}],21:[function(t,e,n){e.exports="1.0.7"},{}]},{},[1]),function(t,e){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(n){return e(t,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}("undefined"!=typeof window?window:this,function(t,e){"use strict";function n(t,e){for(var n in e)t[n]=e[n];return t}function r(t){var e=[];if(Array.isArray(t))e=t;else if("number"==typeof t.length)for(var n=0;n0;--u)if(r=e[u].dequeue()){i=i.concat(o(t,e,n,r,!0));break}}return i}function o(t,e,n,r,i){var o=i?[]:void 0;return u.each(t.inEdges(r.v),function(r){var a=t.edge(r),u=t.node(r.v);i&&o.push({v:r.v,w:r.w}),u.out-=a,s(e,n,u)}),u.each(t.outEdges(r.v),function(r){var i=t.edge(r),o=r.w,a=t.node(o);a["in"]-=i,s(e,n,a)}),t.removeNode(r.v),o}function a(t,e){var n=new l,r=0,i=0;u.each(t.nodes(),function(t){n.setNode(t,{v:t,"in":0,out:0})}),u.each(t.edges(),function(t){var o=n.edge(t.v,t.w)||0,a=e(t),s=o+a;n.setEdge(t.v,t.w,s),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w)["in"]+=a)});var o=u.range(i+r+3).map(function(){return new c}),a=r+1;return u.each(n.nodes(),function(t){s(o,a,n.node(t))}),{graph:n,buckets:o,zeroIdx:a}}function s(t,e,n){n.out?n["in"]?t[n.out-n["in"]+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}var u=t("./lodash"),l=t("./graphlib").Graph,c=t("./data/list");e.exports=r;var f=u.constant(1)},{"./data/list":5,"./graphlib":7,"./lodash":10}],9:[function(t,e,n){"use strict";function r(t,e){var n=e&&e.debugTiming?O.time:O.notime;n("layout",function(){var e=n(" buildLayoutGraph",function(){return a(t)});n(" runLayout",function(){i(e,n)}),n(" updateInputGraph",function(){o(t,e)})})}function i(t,e){e(" makeSpaceForEdgeLabels",function(){s(t)}),e(" removeSelfEdges",function(){v(t)}),e(" acyclic",function(){$.run(t)}),e(" nestingGraph.run",function(){E.run(t)}),e(" rank",function(){_(O.asNonCompoundGraph(t))}),e(" injectEdgeLabelProxies",function(){u(t)}),e(" removeEmptyRanks",function(){S(t)}),e(" nestingGraph.cleanup",function(){E.cleanup(t)}),e(" normalizeRanks",function(){M(t)}),e(" assignRankMinMax",function(){l(t)}),e(" removeEdgeLabelProxies",function(){c(t)}),e(" normalize.run",function(){k.run(t)}),e(" parentDummyChains",function(){C(t)}),e(" addBorderSegments",function(){A(t)}),e(" order",function(){N(t)}),e(" insertSelfEdges",function(){m(t)}),e(" adjustCoordinateSystem",function(){ +T.adjust(t)}),e(" position",function(){D(t)}),e(" positionSelfEdges",function(){y(t)}),e(" removeBorderNodes",function(){g(t)}),e(" normalize.undo",function(){k.undo(t)}),e(" fixupEdgeLabelCoords",function(){h(t)}),e(" undoCoordinateSystem",function(){T.undo(t)}),e(" translateGraph",function(){f(t)}),e(" assignNodeIntersects",function(){d(t)}),e(" reversePoints",function(){p(t)}),e(" acyclic.undo",function(){$.undo(t)})}function o(t,e){w.each(t.nodes(),function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height))}),w.each(t.edges(),function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,w.has(i,"x")&&(r.x=i.x,r.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}function a(t){var e=new j({multigraph:!0,compound:!0}),n=x(t.graph());return e.setGraph(w.merge({},L,b(n,I),w.pick(n,P))),w.each(t.nodes(),function(n){var r=x(t.node(n));e.setNode(n,w.defaults(b(r,F),q)),e.setParent(n,t.parent(n))}),w.each(t.edges(),function(n){var r=x(t.edge(n));e.setEdge(n,w.merge({},W,b(r,z),w.pick(r,R)))}),e}function s(t){var e=t.graph();e.ranksep/=2,w.each(t.edges(),function(n){var r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function u(t){w.each(t.edges(),function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i=t.node(e.w),o={rank:(i.rank-r.rank)/2+r.rank,e:e};O.addDummyNode(t,"edge-proxy",o,"_ep")}})}function l(t){var e=0;w.each(t.nodes(),function(n){var r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=w.max(e,r.maxRank))}),t.graph().maxRank=e}function c(t){w.each(t.nodes(),function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}function f(t){function e(t){var e=t.x,a=t.y,s=t.width,u=t.height;n=Math.min(n,e-s/2),r=Math.max(r,e+s/2),i=Math.min(i,a-u/2),o=Math.max(o,a+u/2)}var n=Number.POSITIVE_INFINITY,r=0,i=Number.POSITIVE_INFINITY,o=0,a=t.graph(),s=a.marginx||0,u=a.marginy||0;w.each(t.nodes(),function(n){e(t.node(n))}),w.each(t.edges(),function(n){var r=t.edge(n);w.has(r,"x")&&e(r)}),n-=s,i-=u,w.each(t.nodes(),function(e){var r=t.node(e);r.x-=n,r.y-=i}),w.each(t.edges(),function(e){var r=t.edge(e);w.each(r.points,function(t){t.x-=n,t.y-=i}),w.has(r,"x")&&(r.x-=n),w.has(r,"y")&&(r.y-=i)}),a.width=r-n+s,a.height=o-i+u}function d(t){w.each(t.edges(),function(e){var n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(O.intersectRect(o,n)),i.points.push(O.intersectRect(a,r))})}function h(t){w.each(t.edges(),function(e){var n=t.edge(e);if(w.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}function p(t){w.each(t.edges(),function(e){var n=t.edge(e);n.reversed&&n.points.reverse()})}function g(t){w.each(t.nodes(),function(e){if(t.children(e).length){var n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),o=t.node(w.last(n.borderLeft)),a=t.node(w.last(n.borderRight));n.width=Math.abs(a.x-o.x),n.height=Math.abs(i.y-r.y),n.x=o.x+n.width/2,n.y=r.y+n.height/2}}),w.each(t.nodes(),function(e){"border"===t.node(e).dummy&&t.removeNode(e)})}function v(t){w.each(t.edges(),function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}function m(t){var e=O.buildLayerMatrix(t);w.each(e,function(e){var n=0;w.each(e,function(e,r){var i=t.node(e);i.order=r+n,w.each(i.selfEdges,function(e){O.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")}),delete i.selfEdges})})}function y(t){w.each(t.nodes(),function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{x:i+a,y:o},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}})}function b(t,e){return w.mapValues(w.pick(t,e),Number)}function x(t){var e={};return w.each(t,function(t,n){e[n.toLowerCase()]=t}),e}var w=t("./lodash"),$=t("./acyclic"),k=t("./normalize"),_=t("./rank"),M=t("./util").normalizeRanks,C=t("./parent-dummy-chains"),S=t("./util").removeEmptyRanks,E=t("./nesting-graph"),A=t("./add-border-segments"),T=t("./coordinate-system"),N=t("./order"),D=t("./position"),O=t("./util"),j=t("./graphlib").Graph;e.exports=r;var I=["nodesep","edgesep","ranksep","marginx","marginy"],L={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},P=["acyclicer","ranker","rankdir","align"],F=["width","height"],q={width:0,height:0},z=["minlen","weight","width","height","labeloffset"],W={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},R=["labelpos"]},{"./acyclic":2,"./add-border-segments":3,"./coordinate-system":4,"./graphlib":7,"./lodash":10,"./nesting-graph":11,"./normalize":12,"./order":17,"./parent-dummy-chains":22,"./position":24,"./rank":26,"./util":29}],10:[function(t,e,n){var r;if("function"==typeof t)try{r=t("lodash")}catch(i){}r||(r=window._),e.exports=r},{lodash:void 0}],11:[function(t,e,n){function r(t){var e=l.addDummyNode(t,"root",{},"_root"),n=o(t),r=u.max(n)-1,s=2*r+1;t.graph().nestingRoot=e,u.each(t.edges(),function(e){t.edge(e).minlen*=s});var c=a(t)+1;u.each(t.children(),function(o){i(t,e,s,c,r,n,o)}),t.graph().nodeRankFactor=s}function i(t,e,n,r,o,a,s){var c=t.children(s);if(!c.length)return void(s!==e&&t.setEdge(e,s,{weight:0,minlen:n}));var f=l.addBorderNode(t,"_bt"),d=l.addBorderNode(t,"_bb"),h=t.node(s);t.setParent(f,s),h.borderTop=f,t.setParent(d,s),h.borderBottom=d,u.each(c,function(u){i(t,e,n,r,o,a,u);var l=t.node(u),c=l.borderTop?l.borderTop:u,h=l.borderBottom?l.borderBottom:u,p=l.borderTop?r:2*r,g=c!==h?1:o-a[s]+1;t.setEdge(f,c,{weight:p,minlen:g,nestingEdge:!0}),t.setEdge(h,d,{weight:p,minlen:g,nestingEdge:!0})}),t.parent(s)||t.setEdge(e,f,{weight:0,minlen:o+a[s]})}function o(t){function e(r,i){var o=t.children(r);o&&o.length&&u.each(o,function(t){e(t,i+1)}),n[r]=i}var n={};return u.each(t.children(),function(t){e(t,1)}),n}function a(t){return u.reduce(t.edges(),function(e,n){return e+t.edge(n).weight},0)}function s(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,u.each(t.edges(),function(e){var n=t.edge(e);n.nestingEdge&&t.removeEdge(e)})}var u=t("./lodash"),l=t("./util");e.exports={run:r,cleanup:s}},{"./lodash":10,"./util":29}],12:[function(t,e,n){"use strict";function r(t){t.graph().dummyChains=[],a.each(t.edges(),function(e){i(t,e)})}function i(t,e){var n=e.v,r=t.node(n).rank,i=e.w,o=t.node(i).rank,a=e.name,u=t.edge(e),l=u.labelRank;if(o!==r+1){t.removeEdge(e);var c,f,d;for(d=0,++r;r0;)e%2&&(n+=u[e+1]),e=e-1>>1,u[e]+=t.weight;l+=t.weight*n})),l}var o=t("../lodash");e.exports=r},{"../lodash":10}],17:[function(t,e,n){"use strict";function r(t){var e=p.maxRank(t),n=i(t,s.range(1,e+1),"inEdges"),r=i(t,s.range(e-1,-1,-1),"outEdges"),c=u(t);a(t,c);for(var f,d=Number.POSITIVE_INFINITY,h=0,g=0;g<4;++h,++g){o(h%2?n:r,h%4>=2),c=p.buildLayerMatrix(t);var v=l(t,c);v=t.barycenter)&&o(t,e)}}function n(e){return function(n){n["in"].push(e),0===--n.indegree&&t.push(n)}}for(var r=[];t.length;){var i=t.pop();r.push(i),a.each(i["in"].reverse(),e(i)),a.each(i.out,n(i))}return a.chain(r).filter(function(t){return!t.merged}).map(function(t){return a.pick(t,["vs","i","barycenter","weight"])}).value()}function o(t,e){var n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}var a=t("../lodash");e.exports=r},{"../lodash":10}],20:[function(t,e,n){function r(t,e,n,c){var f=t.children(e),d=t.node(e),h=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,g={};h&&(f=a.filter(f,function(t){return t!==h&&t!==p}));var v=s(t,f);a.each(v,function(e){if(t.children(e.v).length){var i=r(t,e.v,n,c);g[e.v]=i,a.has(i,"barycenter")&&o(e,i)}});var m=u(v,n);i(m,g);var y=l(m,c);if(h&&(y.vs=a.flatten([h,y.vs,p],!0),t.predecessors(h).length)){var b=t.node(t.predecessors(h)[0]),x=t.node(t.predecessors(p)[0]);a.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+b.order+x.order)/(y.weight+2),y.weight+=2}return y}function i(t,e){a.each(t,function(t){t.vs=a.flatten(t.vs.map(function(t){return e[t]?e[t].vs:t}),!0)})}function o(t,e){a.isUndefined(t.barycenter)?(t.barycenter=e.barycenter,t.weight=e.weight):(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight)}var a=t("../lodash"),s=t("./barycenter"),u=t("./resolve-conflicts"),l=t("./sort");e.exports=r},{"../lodash":10,"./barycenter":14,"./resolve-conflicts":19,"./sort":21}],21:[function(t,e,n){function r(t,e){var n=s.partition(t,function(t){return a.has(t,"barycenter")}),r=n.lhs,u=a.sortBy(n.rhs,function(t){return-t.i}),l=[],c=0,f=0,d=0;r.sort(o(!!e)),d=i(l,u,d),a.each(r,function(t){d+=t.vs.length,l.push(t.vs),c+=t.barycenter*t.weight,f+=t.weight,d=i(l,u,d)});var h={vs:a.flatten(l,!0)};return f&&(h.barycenter=c/f,h.weight=f),h}function i(t,e,n){for(var r;e.length&&(r=a.last(e)).i<=n;)e.pop(),t.push(r.vs),n++;return n}function o(t){return function(e,n){return e.barycentern.barycenter?1:t?n.i-e.i:e.i-n.i}}var a=t("../lodash"),s=t("../util");e.exports=r},{"../lodash":10,"../util":29}],22:[function(t,e,n){function r(t){var e=o(t);a.each(t.graph().dummyChains,function(n){for(var r=t.node(n),o=r.edgeObj,a=i(t,e,o.v,o.w),s=a.path,u=a.lca,l=0,c=s[l],f=!0;n!==o.w;){if(r=t.node(n),f){for(;(c=s[l])!==u&&t.node(c).maxRanku||l>e[i].lim));for(o=i,i=r;(i=t.parent(i))!==o;)s.push(i);return{path:a.concat(s.reverse()),lca:o}}function o(t){function e(i){var o=r;a.each(t.children(i),e),n[i]={low:o,lim:r++}}var n={},r=0;return a.each(t.children(),e),n}var a=t("./lodash");e.exports=r},{"./lodash":10}],23:[function(t,e,n){"use strict";function r(t,e){function n(e,n){var i=0,s=0,u=e.length,l=m.last(n);return m.each(n,function(e,c){var f=o(t,e),d=f?t.node(f).order:u;(f||e===l)&&(m.each(n.slice(s,c+1),function(e){m.each(t.predecessors(e),function(n){var o=t.node(n),s=o.order;!(ss)&&a(i,e,u)})})}function r(e,r){var i,o=-1,a=0;return m.each(r,function(s,u){if("border"===t.node(s).dummy){var l=t.predecessors(s);l.length&&(i=t.node(l[0]).order,n(r,a,u,o,i),a=u,o=i)}n(r,a,r.length,i,e.length)}),r}var i={};return m.reduce(e,r),i}function o(t,e){if(t.node(e).dummy)return m.find(t.predecessors(e),function(e){return t.node(e).dummy})}function a(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function s(t,e,n){if(e>n){var r=e;e=n,n=r}return m.has(t[e],n)}function u(t,e,n,r){var i={},o={},a={};return m.each(e,function(t){m.each(t,function(t,e){i[t]=t,o[t]=t,a[t]=e})}),m.each(e,function(t){var e=-1;m.each(t,function(t){var u=r(t);if(u.length){u=m.sortBy(u,function(t){return a[t]});for(var l=(u.length-1)/2,c=Math.floor(l),f=Math.ceil(l);c<=f;++c){var d=u[c];o[t]===t&&ea.lim&&(s=a,u=!0);var l=g.filter(e.edges(),function(e){return u===p(t,t.node(e.v),s)&&u!==p(t,t.node(e.w),s)});return g.min(l,function(t){return m(e,t)})}function f(t,e,n,r){var o=n.v,a=n.w;t.removeEdge(o,a),t.setEdge(r.v,r.w,{}),s(t),i(t,e),d(t,e)}function d(t,e){var n=g.find(t.nodes(),function(t){return!e.node(t).parent}),r=b(t,n);r=r.slice(1),g.each(r,function(n){var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)})}function h(t,e,n){return t.hasEdge(e,n)}function p(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}var g=t("../lodash"),v=t("./feasible-tree"),m=t("./util").slack,y=t("./util").longestPath,b=t("../graphlib").alg.preorder,x=t("../graphlib").alg.postorder,w=t("../util").simplify;e.exports=r,r.initLowLimValues=s,r.initCutValues=i,r.calcCutValue=a,r.leaveEdge=l,r.enterEdge=c,r.exchangeEdges=f},{"../graphlib":7,"../lodash":10,"../util":29,"./feasible-tree":25,"./util":28}],28:[function(t,e,n){"use strict";function r(t){function e(r){var i=t.node(r);if(o.has(n,r))return i.rank;n[r]=!0;var a=o.min(o.map(t.outEdges(r),function(n){return e(n.w)-t.edge(n).minlen}));return a===Number.POSITIVE_INFINITY&&(a=0),i.rank=a}var n={};o.each(t.sources(),e)}function i(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}var o=t("../lodash");e.exports={longestPath:r,slack:i}},{"../lodash":10}],29:[function(t,e,n){"use strict";function r(t,e,n,r){var i;do i=m.uniqueId(r);while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i}function i(t){var e=(new y).setGraph(t.graph());return m.each(t.nodes(),function(n){e.setNode(n,t.node(n))}),m.each(t.edges(),function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),e}function o(t){var e=new y({multigraph:t.isMultigraph()}).setGraph(t.graph());return m.each(t.nodes(),function(n){t.children(n).length||e.setNode(n,t.node(n))}),m.each(t.edges(),function(n){e.setEdge(n,t.edge(n))}),e}function a(t){var e=m.map(t.nodes(),function(e){var n={};return m.each(t.outEdges(e),function(e){n[e.w]=(n[e.w]||0)+t.edge(e).weight}),n});return m.zipObject(t.nodes(),e)}function s(t){var e=m.map(t.nodes(),function(e){var n={};return m.each(t.inEdges(e),function(e){n[e.v]=(n[e.v]||0)+t.edge(e).weight}),n});return m.zipObject(t.nodes(),e)}function u(t,e){var n=t.x,r=t.y,i=e.x-n,o=e.y-r,a=t.width/2,s=t.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var u,l;return Math.abs(o)*a>Math.abs(i)*s?(o<0&&(s=-s),u=s*i/o,l=s):(i<0&&(a=-a),u=a,l=a*o/i),{x:n+u,y:r+l}}function l(t){var e=m.map(m.range(h(t)+1),function(){return[]});return m.each(t.nodes(),function(n){var r=t.node(n),i=r.rank;m.isUndefined(i)||(e[i][r.order]=n)}),e}function c(t){var e=m.min(m.map(t.nodes(),function(e){return t.node(e).rank}));m.each(t.nodes(),function(n){var r=t.node(n);m.has(r,"rank")&&(r.rank-=e)})}function f(t){var e=m.min(m.map(t.nodes(),function(e){return t.node(e).rank})),n=[];m.each(t.nodes(),function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=t.graph().nodeRankFactor;m.each(n,function(e,n){m.isUndefined(e)&&n%i!==0?--r:r&&m.each(e,function(e){t.node(e).rank+=r})})}function d(t,e,n,i){var o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=i),r(t,"border",o,e)}function h(t){return m.max(m.map(t.nodes(),function(e){var n=t.node(e).rank;if(!m.isUndefined(n))return n}))}function p(t,e){var n={lhs:[],rhs:[]};return m.each(t,function(t){e(t)?n.lhs.push(t):n.rhs.push(t)}),n}function g(t,e){var n=m.now();try{return e()}finally{console.log(t+" time: "+(m.now()-n)+"ms")}}function v(t,e){return e()}var m=t("./lodash"),y=t("./graphlib").Graph;e.exports={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:a,predecessorWeights:s,intersectRect:u,buildLayerMatrix:l,normalizeRanks:c,removeEmptyRanks:f,addBorderNode:d,maxRank:h,partition:p,time:g,notime:v}},{"./graphlib":7,"./lodash":10}],30:[function(t,e,n){e.exports="0.7.4"},{}]},{},[1])(1)}),function(t,e,n){!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):jQuery&&!jQuery.fn.qtip&&t(jQuery)}(function(r){"use strict";function i(t,e,n,i){this.id=n,this.target=t,this.tooltip=N,this.elements={target:t},this._id=V+"-"+n,this.timers={img:{}},this.options=e,this.plugins={},this.cache={event:{},target:r(),disabled:T,attr:i,onTooltip:T,lastClass:""},this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=T}function o(t){return t===N||"object"!==r.type(t)}function a(t){return!(r.isFunction(t)||t&&t.attr||t.length||"object"===r.type(t)&&(t.jquery||t.then))}function s(t){var e,n,i,s;return o(t)?T:(o(t.metadata)&&(t.metadata={type:t.metadata}),"content"in t&&(e=t.content,o(e)||e.jquery||e.done?e=t.content={text:n=a(e)?T:e}:n=e.text,"ajax"in e&&(i=e.ajax,s=i&&i.once!==T,delete e.ajax,e.text=function(t,e){var o=n||r(this).attr(e.options.content.attr)||"Loading...",a=r.ajax(r.extend({},i,{context:e})).then(i.success,N,i.error).then(function(t){return t&&s&&e.set("content.text",t),t},function(t,n,r){e.destroyed||0===t.status||e.set("content.text",n+": "+r)});return s?o:(e.set("content.text",o),a)}),"title"in e&&(r.isPlainObject(e.title)&&(e.button=e.title.button,e.title=e.title.text),a(e.title||T)&&(e.title=T))),"position"in t&&o(t.position)&&(t.position={my:t.position,at:t.position}),"show"in t&&o(t.show)&&(t.show=t.show.jquery?{target:t.show}:t.show===A?{ready:A}:{event:t.show}),"hide"in t&&o(t.hide)&&(t.hide=t.hide.jquery?{target:t.hide}:{event:t.hide}),"style"in t&&o(t.style)&&(t.style={classes:t.style}),r.each(B,function(){this.sanitize&&this.sanitize(t)}),t)}function u(t,e){for(var n,r=0,i=t,o=e.split(".");i=i[o[r++]];)r0?setTimeout(r.proxy(t,this),e):void t.call(this)}function d(t){this.tooltip.hasClass(tt)||(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this.timers.show=f.call(this,function(){this.toggle(A,t)},this.options.show.delay))}function h(t){if(!this.tooltip.hasClass(tt)&&!this.destroyed){var e=r(t.relatedTarget),n=e.closest(G)[0]===this.tooltip[0],i=e[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==e[0]&&"mouse"===this.options.position.target&&n||this.options.hide.fixed&&/mouse(out|leave|move)/.test(t.type)&&(n||i))try{t.preventDefault(),t.stopImmediatePropagation()}catch(o){}else this.timers.hide=f.call(this,function(){this.toggle(T,t)},this.options.hide.delay,this)}}function p(t){!this.tooltip.hasClass(tt)&&this.options.hide.inactive&&(clearTimeout(this.timers.inactive),this.timers.inactive=f.call(this,function(){this.hide(t)},this.options.hide.inactive))}function g(t){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(t)}function v(t,n,i){r(e.body).delegate(t,(n.split?n:n.join("."+V+" "))+"."+V,function(){var t=_.api[r.attr(this,U)];t&&!t.disabled&&i.apply(t,arguments)})}function m(t,n,o){var a,u,l,c,f,d=r(e.body),h=t[0]===e?d:t,p=t.metadata?t.metadata(o.metadata):N,g="html5"===o.metadata.type&&p?p[o.metadata.name]:N,v=t.data(o.metadata.name||"qtipopts");try{v="string"==typeof v?r.parseJSON(v):v}catch(m){}if(c=r.extend(A,{},_.defaults,o,"object"==typeof v?s(v):N,s(g||p)),u=c.position,c.id=n,"boolean"==typeof c.content.text){if(l=t.attr(c.content.attr),c.content.attr===T||!l)return T;c.content.text=l}if(u.container.length||(u.container=d),u.target===T&&(u.target=h),c.show.target===T&&(c.show.target=h),c.show.solo===A&&(c.show.solo=u.container.closest("body")),c.hide.target===T&&(c.hide.target=h),c.position.viewport===A&&(c.position.viewport=u.container),u.container=u.container.eq(0),u.at=new C(u.at,A),u.my=new C(u.my),t.data(V))if(c.overwrite)t.qtip("destroy",!0);else if(c.overwrite===T)return T;return t.attr(H,n),c.suppress&&(f=t.attr("title"))&&t.removeAttr("title").attr(nt,f).attr("title",""),a=new i(t,c,n,(!!l)),t.data(V,a),a}function y(t){return t.charAt(0).toUpperCase()+t.slice(1)}function b(t,e){var r,i,o=e.charAt(0).toUpperCase()+e.slice(1),a=(e+" "+mt.join(o+" ")+o).split(" "),s=0;if(vt[e])return t.css(vt[e]);for(;r=a[s++];)if((i=t.css(r))!==n)return vt[e]=r,i}function x(t,e){return Math.ceil(parseFloat(b(t,e)))}function w(t,e){this._ns="tip",this.options=e,this.offset=e.offset,this.size=[e.width,e.height],this.init(this.qtip=t)}function $(t,e){this.options=e,this._ns="-modal",this.init(this.qtip=t)}function k(t,e){this._ns="ie6",this.init(this.qtip=t)}var _,M,C,S,E,A=!0,T=!1,N=null,D="x",O="y",j="width",I="height",L="top",P="left",F="bottom",q="right",z="center",W="flipinvert",R="shift",B={},V="qtip",H="data-hasqtip",U="data-qtip-id",Y=["ui-widget","ui-tooltip"],G="."+V,X="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),Z=V+"-fixed",Q=V+"-default",K=V+"-focus",J=V+"-hover",tt=V+"-disabled",et="_replacedByqTip",nt="oldtitle",rt={ie:function(){for(var t=4,n=e.createElement("div");(n.innerHTML="")&&n.getElementsByTagName("i")[0];t+=1);return t>4?t:NaN}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||T};M=i.prototype,M._when=function(t){return r.when.apply(r,t)},M.render=function(t){if(this.rendered||this.destroyed)return this;var e,n=this,i=this.options,o=this.cache,a=this.elements,s=i.content.text,u=i.content.title,l=i.content.button,c=i.position,f=("."+this._id+" ",[]);return r.attr(this.target[0],"aria-describedby",this._id),o.posClass=this._createPosClass((this.position={my:c.my,at:c.at}).my),this.tooltip=a.tooltip=e=r("
",{id:this._id,"class":[V,Q,i.style.classes,o.posClass].join(" "),width:i.style.width||"",height:i.style.height||"",tracking:"mouse"===c.target&&c.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":T,"aria-describedby":this._id+"-content","aria-hidden":A}).toggleClass(tt,this.disabled).attr(U,this.id).data(V,this).appendTo(c.container).append(a.content=r("
",{"class":V+"-content",id:this._id+"-content","aria-atomic":A})),this.rendered=-1,this.positioning=A,u&&(this._createTitle(),r.isFunction(u)||f.push(this._updateTitle(u,T))),l&&this._createButton(),r.isFunction(s)||f.push(this._updateContent(s,T)),this.rendered=A,this._setWidget(),r.each(B,function(t){var e;"render"===this.initialize&&(e=this(n))&&(n.plugins[t]=e)}),this._unassignEvents(),this._assignEvents(),this._when(f).then(function(){n._trigger("render"),n.positioning=T,n.hiddenDuringWait||!i.show.ready&&!t||n.toggle(A,o.event,T),n.hiddenDuringWait=T}),_.api[this.id]=this,this},M.destroy=function(t){function e(){if(!this.destroyed){this.destroyed=A;var t,e=this.target,n=e.attr(nt);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove(),r.each(this.plugins,function(t){this.destroy&&this.destroy(); +});for(t in this.timers)clearTimeout(this.timers[t]);e.removeData(V).removeAttr(U).removeAttr(H).removeAttr("aria-describedby"),this.options.suppress&&n&&e.attr("title",n).removeAttr(nt),this._unassignEvents(),this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=N,delete _.api[this.id]}}return this.destroyed?this.target:(t===A&&"hide"!==this.triggering||!this.rendered?e.call(this):(this.tooltip.one("tooltiphidden",r.proxy(e,this)),!this.triggering&&this.hide()),this.target)},S=M.checks={builtin:{"^id$":function(t,e,n,i){var o=n===A?_.nextid:n,a=V+"-"+o;o!==T&&o.length>0&&!r("#"+a).length?(this._id=a,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):t[e]=i},"^prerender":function(t,e,n){n&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(t,e,n){this._updateContent(n)},"^content.attr$":function(t,e,n,r){this.options.content.text===this.target.attr(r)&&this._updateContent(this.target.attr(n))},"^content.title$":function(t,e,n){return n?(n&&!this.elements.title&&this._createTitle(),void this._updateTitle(n)):this._removeTitle()},"^content.button$":function(t,e,n){this._updateButton(n)},"^content.title.(text|button)$":function(t,e,n){this.set("content."+e,n)},"^position.(my|at)$":function(t,e,n){"string"==typeof n&&(this.position[e]=t[e]=new C(n,"at"===e))},"^position.container$":function(t,e,n){this.rendered&&this.tooltip.appendTo(n)},"^show.ready$":function(t,e,n){n&&(!this.rendered&&this.render(A)||this.toggle(A))},"^style.classes$":function(t,e,n,r){this.rendered&&this.tooltip.removeClass(r).addClass(n)},"^style.(width|height)":function(t,e,n){this.rendered&&this.tooltip.css(e,n)},"^style.widget|content.title":function(){this.rendered&&this._setWidget()},"^style.def":function(t,e,n){this.rendered&&this.tooltip.toggleClass(Q,!!n)},"^events.(render|show|move|hide|focus|blur)$":function(t,e,n){this.rendered&&this.tooltip[(r.isFunction(n)?"":"un")+"bind"]("tooltip"+e,n)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){if(this.rendered){var t=this.options.position;this.tooltip.attr("tracking","mouse"===t.target&&t.adjust.mouse),this._unassignEvents(),this._assignEvents()}}}},M.get=function(t){if(this.destroyed)return this;var e=u(this.options,t.toLowerCase()),n=e[0][e[1]];return n.precedance?n.string():n};var it=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,ot=/^prerender|show\.ready/i;M.set=function(t,e){if(this.destroyed)return this;var n,i=this.rendered,o=T,a=this.options;this.checks;return"string"==typeof t?(n=t,t={},t[n]=e):t=r.extend({},t),r.each(t,function(e,n){if(i&&ot.test(e))return void delete t[e];var s,l=u(a,e.toLowerCase());s=l[0][l[1]],l[0][l[1]]=n&&n.nodeType?r(n):n,o=it.test(e)||o,t[e]=[l[0],l[1],n,s]}),s(a),this.positioning=A,r.each(t,r.proxy(l,this)),this.positioning=T,this.rendered&&this.tooltip[0].offsetWidth>0&&o&&this.reposition("mouse"===a.position.target?N:this.cache.event),this},M._update=function(t,e,n){var i=this,o=this.cache;return this.rendered&&t?(r.isFunction(t)&&(t=t.call(this.elements.target,o.event,this)||""),r.isFunction(t.then)?(o.waiting=A,t.then(function(t){return o.waiting=T,i._update(t,e)},N,function(t){return i._update(t,e)})):t===T||!t&&""!==t?T:(t.jquery&&t.length>0?e.empty().append(t.css({display:"block",visibility:"visible"})):e.html(t),this._waitForContent(e).then(function(t){i.rendered&&i.tooltip[0].offsetWidth>0&&i.reposition(o.event,!t.length)}))):T},M._waitForContent=function(t){var e=this.cache;return e.waiting=A,(r.fn.imagesLoaded?t.imagesLoaded():r.Deferred().resolve([])).done(function(){e.waiting=T}).promise()},M._updateContent=function(t,e){this._update(t,this.elements.content,e)},M._updateTitle=function(t,e){this._update(t,this.elements.title,e)===T&&this._removeTitle(T)},M._createTitle=function(){var t=this.elements,e=this._id+"-title";t.titlebar&&this._removeTitle(),t.titlebar=r("
",{"class":V+"-titlebar "+(this.options.style.widget?c("header"):"")}).append(t.title=r("
",{id:e,"class":V+"-title","aria-atomic":A})).insertBefore(t.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(t){r(this).toggleClass("ui-state-active ui-state-focus","down"===t.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(t){r(this).toggleClass("ui-state-hover","mouseover"===t.type)}),this.options.content.button&&this._createButton()},M._removeTitle=function(t){var e=this.elements;e.title&&(e.titlebar.remove(),e.titlebar=e.title=e.button=N,t!==T&&this.reposition())},M._createPosClass=function(t){return V+"-pos-"+(t||this.options.position.my).abbrev()},M.reposition=function(n,i){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=A;var o,a,s,u,l=this.cache,c=this.tooltip,f=this.options.position,d=f.target,h=f.my,p=f.at,g=f.viewport,v=f.container,m=f.adjust,y=m.method.split(" "),b=c.outerWidth(T),x=c.outerHeight(T),w=0,$=0,k=c.css("position"),_={left:0,top:0},M=c[0].offsetWidth>0,C=n&&"scroll"===n.type,S=r(t),E=v[0].ownerDocument,N=this.mouse;if(r.isArray(d)&&2===d.length)p={x:P,y:L},_={left:d[0],top:d[1]};else if("mouse"===d)p={x:P,y:L},(!m.mouse||this.options.hide.distance)&&l.origin&&l.origin.pageX?n=l.origin:!n||n&&("resize"===n.type||"scroll"===n.type)?n=l.event:N&&N.pageX&&(n=N),"static"!==k&&(_=v.offset()),E.body.offsetWidth!==(t.innerWidth||E.documentElement.clientWidth)&&(a=r(e.body).offset()),_={left:n.pageX-_.left+(a&&a.left||0),top:n.pageY-_.top+(a&&a.top||0)},m.mouse&&C&&N&&(_.left-=(N.scrollX||0)-S.scrollLeft(),_.top-=(N.scrollY||0)-S.scrollTop());else{if("event"===d?n&&n.target&&"scroll"!==n.type&&"resize"!==n.type?l.target=r(n.target):n.target||(l.target=this.elements.target):"event"!==d&&(l.target=r(d.jquery?d:this.elements.target)),d=l.target,d=r(d).eq(0),0===d.length)return this;d[0]===e||d[0]===t?(w=rt.iOS?t.innerWidth:d.width(),$=rt.iOS?t.innerHeight:d.height(),d[0]===t&&(_={top:(g||d).scrollTop(),left:(g||d).scrollLeft()})):B.imagemap&&d.is("area")?o=B.imagemap(this,d,p,B.viewport?y:T):B.svg&&d&&d[0].ownerSVGElement?o=B.svg(this,d,p,B.viewport?y:T):(w=d.outerWidth(T),$=d.outerHeight(T),_=d.offset()),o&&(w=o.width,$=o.height,a=o.offset,_=o.position),_=this.reposition.offset(d,_,v),(rt.iOS>3.1&&rt.iOS<4.1||rt.iOS>=4.3&&rt.iOS<4.33||!rt.iOS&&"fixed"===k)&&(_.left-=S.scrollLeft(),_.top-=S.scrollTop()),(!o||o&&o.adjustable!==T)&&(_.left+=p.x===q?w:p.x===z?w/2:0,_.top+=p.y===F?$:p.y===z?$/2:0)}return _.left+=m.x+(h.x===q?-b:h.x===z?-b/2:0),_.top+=m.y+(h.y===F?-x:h.y===z?-x/2:0),B.viewport?(s=_.adjusted=B.viewport(this,_,f,w,$,b,x),a&&s.left&&(_.left+=a.left),a&&s.top&&(_.top+=a.top),s.my&&(this.position.my=s.my)):_.adjusted={left:0,top:0},l.posClass!==(u=this._createPosClass(this.position.my))&&c.removeClass(l.posClass).addClass(l.posClass=u),this._trigger("move",[_,g.elem||g],n)?(delete _.adjusted,i===T||!M||isNaN(_.left)||isNaN(_.top)||"mouse"===d||!r.isFunction(f.effect)?c.css(_):r.isFunction(f.effect)&&(f.effect.call(c,this,r.extend({},_)),c.queue(function(t){r(this).css({opacity:"",height:""}),rt.ie&&this.style.removeAttribute("filter"),t()})),this.positioning=T,this):this},M.reposition.offset=function(t,n,i){function o(t,e){n.left+=e*t.scrollLeft(),n.top+=e*t.scrollTop()}if(!i[0])return n;var a,s,u,l,c=r(t[0].ownerDocument),f=!!rt.ie&&"CSS1Compat"!==e.compatMode,d=i[0];do"static"!==(s=r.css(d,"position"))&&("fixed"===s?(u=d.getBoundingClientRect(),o(c,-1)):(u=r(d).position(),u.left+=parseFloat(r.css(d,"borderLeftWidth"))||0,u.top+=parseFloat(r.css(d,"borderTopWidth"))||0),n.left-=u.left+(parseFloat(r.css(d,"marginLeft"))||0),n.top-=u.top+(parseFloat(r.css(d,"marginTop"))||0),a||"hidden"===(l=r.css(d,"overflow"))||"visible"===l||(a=r(d)));while(d=d.offsetParent);return a&&(a[0]!==c[0]||f)&&o(a,1),n};var at=(C=M.reposition.Corner=function(t,e){t=(""+t).replace(/([A-Z])/," $1").replace(/middle/gi,z).toLowerCase(),this.x=(t.match(/left|right/i)||t.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(t.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.forceY=!!e;var n=t.charAt(0);this.precedance="t"===n||"b"===n?O:D}).prototype;at.invert=function(t,e){this[t]=this[t]===P?q:this[t]===q?P:e||this[t]},at.string=function(t){var e=this.x,n=this.y,r=e!==n?"center"===e||"center"!==n&&(this.precedance===O||this.forceY)?[n,e]:[e,n]:[e];return t!==!1?r.join(" "):r},at.abbrev=function(){var t=this.string(!1);return t[0].charAt(0)+(t[1]&&t[1].charAt(0)||"")},at.clone=function(){return new C(this.string(),this.forceY)},M.toggle=function(t,n){var i=this.cache,o=this.options,a=this.tooltip;if(n){if(/over|enter/.test(n.type)&&i.event&&/out|leave/.test(i.event.type)&&o.show.target.add(n.target).length===o.show.target.length&&a.has(n.relatedTarget).length)return this;i.event=r.event.fix(n)}if(this.waiting&&!t&&(this.hiddenDuringWait=A),!this.rendered)return t?this.render(1):this;if(this.destroyed||this.disabled)return this;var s,u,l,c=t?"show":"hide",f=this.options[c],d=(this.options[t?"hide":"show"],this.options.position),h=this.options.content,p=this.tooltip.css("width"),g=this.tooltip.is(":visible"),v=t||1===f.target.length,m=!n||f.target.length<2||i.target[0]===n.target;return(typeof t).search("boolean|number")&&(t=!g),s=!a.is(":animated")&&g===t&&m,u=s?N:!!this._trigger(c,[90]),this.destroyed?this:(u!==T&&t&&this.focus(n),!u||s?this:(r.attr(a[0],"aria-hidden",!t),t?(this.mouse&&(i.origin=r.event.fix(this.mouse)),r.isFunction(h.text)&&this._updateContent(h.text,T),r.isFunction(h.title)&&this._updateTitle(h.title,T),!E&&"mouse"===d.target&&d.adjust.mouse&&(r(e).bind("mousemove."+V,this._storeMouse),E=A),p||a.css("width",a.outerWidth(T)),this.reposition(n,arguments[2]),p||a.css("width",""),f.solo&&("string"==typeof f.solo?r(f.solo):r(G,f.solo)).not(a).not(f.target).qtip("hide",r.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete i.origin,E&&!r(G+'[tracking="true"]:visible',f.solo).not(a).length&&(r(e).unbind("mousemove."+V),E=T),this.blur(n)),l=r.proxy(function(){t?(rt.ie&&a[0].style.removeAttribute("filter"),a.css("overflow",""),"string"==typeof f.autofocus&&r(this.options.show.autofocus,a).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):a.css({display:"",visibility:"",opacity:"",left:"",top:""}),this._trigger(t?"visible":"hidden")},this),f.effect===T||v===T?(a[c](),l()):r.isFunction(f.effect)?(a.stop(1,1),f.effect.call(a,this),a.queue("fx",function(t){l(),t()})):a.fadeTo(90,t?1:0,l),t&&f.target.trigger("qtip-"+this.id+"-inactive"),this))},M.show=function(t){return this.toggle(A,t)},M.hide=function(t){return this.toggle(T,t)},M.focus=function(t){if(!this.rendered||this.destroyed)return this;var e=r(G),n=this.tooltip,i=parseInt(n[0].style.zIndex,10),o=_.zindex+e.length;return n.hasClass(K)||this._trigger("focus",[o],t)&&(i!==o&&(e.each(function(){this.style.zIndex>i&&(this.style.zIndex=this.style.zIndex-1)}),e.filter("."+K).qtip("blur",t)),n.addClass(K)[0].style.zIndex=o),this},M.blur=function(t){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass(K),this._trigger("blur",[this.tooltip.css("zIndex")],t),this)},M.disable=function(t){return this.destroyed?this:("toggle"===t?t=!(this.rendered?this.tooltip.hasClass(tt):this.disabled):"boolean"!=typeof t&&(t=A),this.rendered&&this.tooltip.toggleClass(tt,t).attr("aria-disabled",t),this.disabled=!!t,this)},M.enable=function(){return this.disable(T)},M._createButton=function(){var t=this,e=this.elements,n=e.tooltip,i=this.options.content.button,o="string"==typeof i,a=o?i:"Close tooltip";e.button&&e.button.remove(),i.jquery?e.button=i:e.button=r("",{"class":"qtip-close "+(this.options.style.widget?"":V+"-icon"),title:a,"aria-label":a}).prepend(r("",{"class":"ui-icon ui-icon-close",html:"×"})),e.button.appendTo(e.titlebar||n).attr("role","button").click(function(e){return n.hasClass(tt)||t.hide(e),T})},M._updateButton=function(t){if(!this.rendered)return T;var e=this.elements.button;t?this._createButton():e.remove()},M._setWidget=function(){var t=this.options.style.widget,e=this.elements,n=e.tooltip,r=n.hasClass(tt);n.removeClass(tt),tt=t?"ui-state-disabled":"qtip-disabled",n.toggleClass(tt,r),n.toggleClass("ui-helper-reset "+c(),t).toggleClass(Q,this.options.style.def&&!t),e.content&&e.content.toggleClass(c("content"),t),e.titlebar&&e.titlebar.toggleClass(c("header"),t),e.button&&e.button.toggleClass(V+"-icon",!t)},M._storeMouse=function(t){return(this.mouse=r.event.fix(t)).type="mousemove",this},M._bind=function(t,e,n,i,o){if(t&&n&&e.length){var a="."+this._id+(i?"-"+i:"");return r(t).bind((e.split?e:e.join(a+" "))+a,r.proxy(n,o||this)),this}},M._unbind=function(t,e){return t&&r(t).unbind("."+this._id+(e?"-"+e:"")),this},M._trigger=function(t,e,n){var i=r.Event("tooltip"+t);return i.originalEvent=n&&r.extend({},n)||this.cache.event||N,this.triggering=t,this.tooltip.trigger(i,[this].concat(e||[])),this.triggering=T,!i.isDefaultPrevented()},M._bindEvents=function(t,e,n,i,o,a){var s=n.filter(i).add(i.filter(n)),u=[];s.length&&(r.each(e,function(e,n){var i=r.inArray(n,t);i>-1&&u.push(t.splice(i,1)[0])}),u.length&&(this._bind(s,u,function(t){var e=!!this.rendered&&this.tooltip[0].offsetWidth>0;(e?a:o).call(this,t)}),n=n.not(s),i=i.not(s))),this._bind(n,t,o),this._bind(i,e,a)},M._assignInitialEvents=function(t){function e(t){return this.disabled||this.destroyed?T:(this.cache.event=t&&r.event.fix(t),this.cache.target=t&&r(t.target),clearTimeout(this.timers.show),void(this.timers.show=f.call(this,function(){this.render("object"==typeof t||n.show.ready)},n.prerender?0:n.show.delay)))}var n=this.options,i=n.show.target,o=n.hide.target,a=n.show.event?r.trim(""+n.show.event).split(" "):[],s=n.hide.event?r.trim(""+n.hide.event).split(" "):[];this._bind(this.elements.target,["remove","removeqtip"],function(t){this.destroy(!0)},"destroy"),/mouse(over|enter)/i.test(n.show.event)&&!/mouse(out|leave)/i.test(n.hide.event)&&s.push("mouseleave"),this._bind(i,"mousemove",function(t){this._storeMouse(t),this.cache.onTarget=A}),this._bindEvents(a,s,i,o,e,function(){return this.timers?void clearTimeout(this.timers.show):T}),(n.show.ready||n.prerender)&&e.call(this,t)},M._assignEvents=function(){var n=this,i=this.options,o=i.position,a=this.tooltip,s=i.show.target,u=i.hide.target,l=o.container,c=o.viewport,f=r(e),v=(r(e.body),r(t)),m=i.show.event?r.trim(""+i.show.event).split(" "):[],y=i.hide.event?r.trim(""+i.hide.event).split(" "):[];r.each(i.events,function(t,e){n._bind(a,"toggle"===t?["tooltipshow","tooltiphide"]:["tooltip"+t],e,null,a)}),/mouse(out|leave)/i.test(i.hide.event)&&"window"===i.hide.leave&&this._bind(f,["mouseout","blur"],function(t){/select|option/.test(t.target.nodeName)||t.relatedTarget||this.hide(t)}),i.hide.fixed?u=u.add(a.addClass(Z)):/mouse(over|enter)/i.test(i.show.event)&&this._bind(u,"mouseleave",function(){clearTimeout(this.timers.show)}),(""+i.hide.event).indexOf("unfocus")>-1&&this._bind(l.closest("html"),["mousedown","touchstart"],function(t){var e=r(t.target),n=this.rendered&&!this.tooltip.hasClass(tt)&&this.tooltip[0].offsetWidth>0,i=e.parents(G).filter(this.tooltip[0]).length>0;e[0]===this.target[0]||e[0]===this.tooltip[0]||i||this.target.has(e[0]).length||!n||this.hide(t)}),"number"==typeof i.hide.inactive&&(this._bind(s,"qtip-"+this.id+"-inactive",p,"inactive"),this._bind(u.add(a),_.inactiveEvents,p)),this._bindEvents(m,y,s,u,d,h),this._bind(s.add(a),"mousemove",function(t){if("number"==typeof i.hide.distance){var e=this.cache.origin||{},n=this.options.hide.distance,r=Math.abs;(r(t.pageX-e.pageX)>=n||r(t.pageY-e.pageY)>=n)&&this.hide(t)}this._storeMouse(t)}),"mouse"===o.target&&o.adjust.mouse&&(i.hide.event&&this._bind(s,["mouseenter","mouseleave"],function(t){return this.cache?void(this.cache.onTarget="mouseenter"===t.type):T}),this._bind(f,"mousemove",function(t){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass(tt)&&this.tooltip[0].offsetWidth>0&&this.reposition(t)})),(o.adjust.resize||c.length)&&this._bind(r.event.special.resize?c:v,"resize",g),o.adjust.scroll&&this._bind(v.add(o.container),"scroll",g)},M._unassignEvents=function(){var n=this.options,i=n.show.target,o=n.hide.target,a=r.grep([this.elements.target[0],this.rendered&&this.tooltip[0],n.position.container[0],n.position.viewport[0],n.position.container.closest("html")[0],t,e],function(t){return"object"==typeof t});i&&i.toArray&&(a=a.concat(i.toArray())),o&&o.toArray&&(a=a.concat(o.toArray())),this._unbind(a)._unbind(a,"destroy")._unbind(a,"inactive")},r(function(){v(G,["mouseenter","mouseleave"],function(t){var e="mouseenter"===t.type,n=r(t.currentTarget),i=r(t.relatedTarget||t.target),o=this.options;e?(this.focus(t),n.hasClass(Z)&&!n.hasClass(tt)&&clearTimeout(this.timers.hide)):"mouse"===o.position.target&&o.position.adjust.mouse&&o.hide.event&&o.show.target&&!i.closest(o.show.target[0]).length&&this.hide(t),n.toggleClass(J,e)}),v("["+U+"]",X,p)}),_=r.fn.qtip=function(t,e,i){var o=(""+t).toLowerCase(),a=N,u=r.makeArray(arguments).slice(1),l=u[u.length-1],c=this[0]?r.data(this[0],V):N;return!arguments.length&&c||"api"===o?c:"string"==typeof t?(this.each(function(){var t=r.data(this,V);if(!t)return A;if(l&&l.timeStamp&&(t.cache.event=l),!e||"option"!==o&&"options"!==o)t[o]&&t[o].apply(t,u);else{if(i===n&&!r.isPlainObject(e))return a=t.get(e),T;t.set(e,i)}}),a!==N?a:this):"object"!=typeof t&&arguments.length?void 0:(c=s(r.extend(A,{},t)),this.each(function(t){var e,n;return n=r.isArray(c.id)?c.id[t]:c.id,n=!n||n===T||n.length<1||_.api[n]?_.nextid++:n,e=m(r(this),n,c),e===T?A:(_.api[n]=e,r.each(B,function(){"initialize"===this.initialize&&this(e)}),void e._assignInitialEvents(l))}))},r.qtip=i,_.api={},r.each({attr:function(t,e){if(this.length){var n=this[0],i="title",o=r.data(n,"qtip");if(t===i&&o&&"object"==typeof o&&o.options.suppress)return arguments.length<2?r.attr(n,nt):(o&&o.options.content.attr===i&&o.cache.attr&&o.set("content.text",e),this.attr(nt,e))}return r.fn["attr"+et].apply(this,arguments)},clone:function(t){var e=(r([]),r.fn["clone"+et].apply(this,arguments));return t||e.filter("["+nt+"]").attr("title",function(){return r.attr(this,nt)}).removeAttr(nt),e}},function(t,e){if(!e||r.fn[t+et])return A;var n=r.fn[t+et]=r.fn[t];r.fn[t]=function(){return e.apply(this,arguments)||n.apply(this,arguments)}}),r.ui||(r["cleanData"+et]=r.cleanData,r.cleanData=function(t){for(var e,n=0;(e=r(t[n])).length;n++)if(e.attr(H))try{e.triggerHandler("removeqtip")}catch(i){}r["cleanData"+et].apply(this,arguments)}),_.version="2.2.1",_.nextid=0,_.inactiveEvents=X,_.zindex=15e3,_.defaults={prerender:T,id:T,overwrite:A,suppress:A,content:{text:A,attr:"title",title:T,button:T},position:{my:"top left",at:"bottom right",target:T,container:T,viewport:T,adjust:{x:0,y:0,mouse:A,scroll:A,resize:A,method:"flipinvert flipinvert"},effect:function(t,e,n){r(this).animate(e,{duration:200,queue:T})}},show:{target:T,event:"mouseenter",effect:A,delay:90,solo:T,ready:T,autofocus:T},hide:{target:T,event:"mouseleave",effect:A,delay:0,fixed:T,inactive:T,leave:"window",distance:T},style:{classes:"",widget:T,width:T,height:T,def:A},events:{render:N,move:N,show:N,hide:N,toggle:N,visible:N,hidden:N,focus:N,blur:N}};var st,ut="margin",lt="border",ct="color",ft="background-color",dt="transparent",ht=" !important",pt=!!e.createElement("canvas").getContext,gt=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,vt={},mt=["Webkit","O","Moz","ms"];if(pt)var yt=t.devicePixelRatio||1,bt=function(){var t=e.createElement("canvas").getContext("2d");return t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||1}(),xt=yt/bt;else var wt=function(t,e,n){return"'};r.extend(w.prototype,{init:function(t){var e,n;n=this.element=t.elements.tip=r("
",{"class":V+"-tip"}).prependTo(t.tooltip),pt?(e=r("").appendTo(this.element)[0].getContext("2d"),e.lineJoin="miter",e.miterLimit=1e5,e.save()):(e=wt("shape",'coordorigin="0,0"',"position:absolute;"),this.element.html(e+e),t._bind(r("*",n).add(n),["click","mousedown"],function(t){t.stopPropagation()},this._ns)),t._bind(t.tooltip,"tooltipmove",this.reposition,this._ns,this),this.create()},_swapDimensions:function(){this.size[0]=this.options.height,this.size[1]=this.options.width},_resetDimensions:function(){this.size[0]=this.options.width,this.size[1]=this.options.height},_useTitle:function(t){var e=this.qtip.elements.titlebar;return e&&(t.y===L||t.y===z&&this.element.position().top+this.size[1]/2+this.options.offset-1),left:l[0]-l[2]*Number(o===D),top:l[1]-l[2]*Number(o===O),width:c[0]+f,height:c[1]+f}).each(function(t){var e=r(this);e[e.prop?"prop":"attr"]({coordsize:c[0]+f+" "+(c[1]+f),path:s,fillcolor:i[0],filled:!!t,stroked:!t}).toggle(!(!f&&!t)),!t&&e.html(wt("stroke",'weight="'+2*f+'px" color="'+i[1]+'" miterlimit="1000" joinstyle="miter"'))})),t.opera&&setTimeout(function(){d.tip.css({display:"inline-block",visibility:"visible"})},1),n!==T&&this.calculate(e,c)},calculate:function(t,e){if(!this.enabled)return T;var n,i,o=this,a=this.qtip.elements,s=this.element,u=this.options.offset,l=(a.tooltip.hasClass("ui-widget"),{});return t=t||this.corner,n=t.precedance,e=e||this._calculateSize(t),i=[t.x,t.y],n===D&&i.reverse(),r.each(i,function(r,i){var s,c,f;i===z?(s=n===O?P:L,l[s]="50%",l[ut+"-"+s]=-Math.round(e[n===O?0:1]/2)+u):(s=o._parseWidth(t,i,a.tooltip),c=o._parseWidth(t,i,a.content),f=o._parseRadius(t),l[i]=Math.max(-o.border,r?c:u+(f>s?f:-s)))}),l[t[n]]-=e[n===D?0:1],s.css({margin:"",top:"",bottom:"",left:"",right:""}).css(l),l},reposition:function(t,e,r,i){function o(t,e,n,r,i){t===R&&c.precedance===e&&f[r]&&c[n]!==z?c.precedance=c.precedance===D?O:D:t!==R&&f[r]&&(c[e]=c[e]===z?f[r]>0?r:i:c[e]===r?i:r)}function a(t,e,i){c[t]===z?v[ut+"-"+e]=g[t]=s[ut+"-"+e]-f[e]:(u=s[i]!==n?[f[e],-s[e]]:[-f[e],s[e]],(g[t]=Math.max(u[0],u[1]))>u[0]&&(r[e]-=f[e],g[e]=T),v[s[i]!==n?i:e]=g[t])}if(this.enabled){var s,u,l=e.cache,c=this.corner.clone(),f=r.adjusted,d=e.options.position.adjust.method.split(" "),h=d[0],p=d[1]||d[0],g={left:T,top:T,x:0,y:0},v={};this.corner.fixed!==A&&(o(h,D,O,P,q),o(p,O,D,L,F),c.string()===l.corner.string()&&l.cornerTop===f.top&&l.cornerLeft===f.left||this.update(c,T)),s=this.calculate(c),s.right!==n&&(s.left=-s.right),s.bottom!==n&&(s.top=-s.bottom),s.user=this.offset,(g.left=h===R&&!!f.left)&&a(D,P,q),(g.top=p===R&&!!f.top)&&a(O,L,F),this.element.css(v).toggle(!(g.x&&g.y||c.x===z&&g.y||c.y===z&&g.x)),r.left-=s.left.charAt?s.user:h!==R||g.top||!g.left&&!g.top?s.left+this.border:0,r.top-=s.top.charAt?s.user:p!==R||g.left||!g.left&&!g.top?s.top+this.border:0,l.cornerLeft=f.left,l.cornerTop=f.top,l.corner=c.clone()}},destroy:function(){this.qtip._unbind(this.qtip.tooltip,this._ns),this.qtip.elements.tip&&this.qtip.elements.tip.find("*").remove().end().remove()}}),st=B.tip=function(t){return new w(t,t.options.style.tip)},st.initialize="render",st.sanitize=function(t){if(t.style&&"tip"in t.style){var e=t.style.tip;"object"!=typeof e&&(e=t.style.tip={corner:e}),/string|boolean/i.test(typeof e.corner)||(e.corner=A)}},S.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){this.create(),this.qtip.reposition()},"^style.tip.(height|width)$":function(t){this.size=[t.width,t.height],this.update(),this.qtip.reposition()},"^content.title|style.(classes|widget)$":function(){this.update()}},r.extend(A,_.defaults,{style:{tip:{corner:A,mimic:T,width:6,height:6,border:A,offset:0}}});var $t,kt,_t="qtip-modal",Mt="."+_t;kt=function(){function t(t){if(r.expr[":"].focusable)return r.expr[":"].focusable;var e,n,i,o=!isNaN(r.attr(t,"tabindex")),a=t.nodeName&&t.nodeName.toLowerCase();return"area"===a?(e=t.parentNode,n=e.name,!(!t.href||!n||"map"!==e.nodeName.toLowerCase())&&(i=r("img[usemap=#"+n+"]")[0],!!i&&i.is(":visible"))):/input|select|textarea|button|object/.test(a)?!t.disabled:"a"===a?t.href||o:o}function n(t){c.length<1&&t.length?t.not("body").blur():c.first().focus()}function i(t){if(u.is(":visible")){var e,i=r(t.target),s=o.tooltip,l=i.closest(G);e=l.length<1?T:parseInt(l[0].style.zIndex,10)>parseInt(s[0].style.zIndex,10),e||i.closest(G)[0]===s[0]||n(i),a=t.target===c[c.length-1]}}var o,a,s,u,l=this,c={};r.extend(l,{init:function(){return u=l.elem=r("
",{id:"qtip-overlay",html:"
",mousedown:function(){return T}}).hide(),r(e.body).bind("focusin"+Mt,i),r(e).bind("keydown"+Mt,function(t){o&&o.options.show.modal.escape&&27===t.keyCode&&o.hide(t)}),u.bind("click"+Mt,function(t){o&&o.options.show.modal.blur&&o.hide(t)}),l},update:function(e){o=e,c=e.options.show.modal.stealfocus!==T?e.tooltip.find("*").filter(function(){return t(this)}):[]},toggle:function(t,i,a){var c=(r(e.body),t.tooltip),f=t.options.show.modal,d=f.effect,h=i?"show":"hide",p=u.is(":visible"),g=r(Mt).filter(":visible:not(:animated)").not(c);return l.update(t),i&&f.stealfocus!==T&&n(r(":focus")),u.toggleClass("blurs",f.blur),i&&u.appendTo(e.body),u.is(":animated")&&p===i&&s!==T||!i&&g.length?l:(u.stop(A,T),r.isFunction(d)?d.call(u,i):d===T?u[h]():u.fadeTo(parseInt(a,10)||90,i?1:0,function(){i||u.hide()}),i||u.queue(function(t){u.css({left:"",top:""}),r(Mt).length||u.detach(),t()}),s=i,o.destroyed&&(o=N),l)}}),l.init()},kt=new kt,r.extend($.prototype,{init:function(t){var e=t.tooltip;return this.options.on?(t.elements.overlay=kt.elem,e.addClass(_t).css("z-index",_.modal_zindex+r(Mt).length),t._bind(e,["tooltipshow","tooltiphide"],function(t,n,i){var o=t.originalEvent;if(t.target===e[0])if(o&&"tooltiphide"===t.type&&/mouse(leave|enter)/.test(o.type)&&r(o.relatedTarget).closest(kt.elem[0]).length)try{t.preventDefault()}catch(a){}else(!o||o&&"tooltipsolo"!==o.type)&&this.toggle(t,"tooltipshow"===t.type,i)},this._ns,this),t._bind(e,"tooltipfocus",function(t,n){if(!t.isDefaultPrevented()&&t.target===e[0]){var i=r(Mt),o=_.modal_zindex+i.length,a=parseInt(e[0].style.zIndex,10);kt.elem[0].style.zIndex=o-1,i.each(function(){this.style.zIndex>a&&(this.style.zIndex-=1)}),i.filter("."+K).qtip("blur",t.originalEvent),e.addClass(K)[0].style.zIndex=o,kt.update(n);try{t.preventDefault()}catch(s){}}},this._ns,this),void t._bind(e,"tooltiphide",function(t){t.target===e[0]&&r(Mt).filter(":visible").not(e).last().qtip("focus",t)},this._ns,this)):this},toggle:function(t,e,n){return t&&t.isDefaultPrevented()?this:void kt.toggle(this.qtip,!!e,n)},destroy:function(){this.qtip.tooltip.removeClass(_t),this.qtip._unbind(this.qtip.tooltip,this._ns),kt.toggle(this.qtip,T),delete this.qtip.elements.overlay}}),$t=B.modal=function(t){return new $(t,t.options.show.modal)},$t.sanitize=function(t){t.show&&("object"!=typeof t.show.modal?t.show.modal={on:!!t.show.modal}:"undefined"==typeof t.show.modal.on&&(t.show.modal.on=A))},_.modal_zindex=_.zindex-200,$t.initialize="render",S.modal={"^show.modal.(on|blur)$":function(){this.destroy(),this.init(),this.qtip.elems.overlay.toggle(this.qtip.tooltip[0].offsetWidth>0)}},r.extend(A,_.defaults,{show:{modal:{on:T,effect:A,blur:A,stealfocus:A,escape:A}}}),B.viewport=function(n,r,i,o,a,s,u){function l(t,e,n,i,o,a,s,u,l){var c=r[o],y=x[t],b=w[t],$=n===R,k=y===o?l:y===a?-l:-l/2,_=b===o?u:b===a?-u:-u/2,M=v[o]+m[o]-(h?0:d[o]),C=M-c,S=c+l-(s===j?p:g)-M,E=k-(x.precedance===t||y===x[e]?_:0)-(b===z?u/2:0);return $?(E=(y===o?1:-1)*k,r[o]+=C>0?C:S>0?-S:0,r[o]=Math.max(-d[o]+m[o],c-E,Math.min(Math.max(-d[o]+m[o]+(s===j?p:g),c+E),r[o],"center"===y?c-k:1e9))):(i*=n===W?2:0,C>0&&(y!==o||S>0)?(r[o]-=E+i,f.invert(t,o)):S>0&&(y!==a||C>0)&&(r[o]-=(y===z?-E:E)+i,f.invert(t,a)),r[o]S&&(r[o]=c,f=x.clone())),r[o]-c}var c,f,d,h,p,g,v,m,y=i.target,b=n.elements.tooltip,x=i.my,w=i.at,$=i.adjust,k=$.method.split(" "),_=k[0],M=k[1]||k[0],C=i.viewport,S=i.container,E=(n.cache,{left:0,top:0});return C.jquery&&y[0]!==t&&y[0]!==e.body&&"none"!==$.method?(d=S.offset()||E,h="static"===S.css("position"),c="fixed"===b.css("position"),p=C[0]===t?C.width():C.outerWidth(T),g=C[0]===t?C.height():C.outerHeight(T),v={left:c?0:C.scrollLeft(),top:c?0:C.scrollTop()},m=C.offset()||E,"shift"===_&&"shift"===M||(f=x.clone()),E={left:"none"!==_?l(D,O,_,$.x,P,q,j,o,s):0,top:"none"!==M?l(O,D,M,$.y,L,F,I,a,u):0,my:f}):E},B.polys={polygon:function(t,e){var n,r,i,o={width:0,height:0,position:{top:1e10,right:0,bottom:0,left:1e10},adjustable:T},a=0,s=[],u=1,l=1,c=0,f=0;for(a=t.length;a--;)n=[parseInt(t[--a],10),parseInt(t[a+1],10)], +n[0]>o.position.right&&(o.position.right=n[0]),n[0]o.position.bottom&&(o.position.bottom=n[1]),n[1]0&&i>0&&u>0&&l>0;)for(r=Math.floor(r/2),i=Math.floor(i/2),e.x===P?u=r:e.x===q?u=o.width-r:u+=Math.floor(r/2),e.y===L?l=i:e.y===F?l=o.height-i:l+=Math.floor(i/2),a=s.length;a--&&!(s.length<2);)c=s[a][0]-o.position.left,f=s[a][1]-o.position.top,(e.x===P&&c>=u||e.x===q&&c<=u||e.x===z&&(co.width-u)||e.y===L&&f>=l||e.y===F&&f<=l||e.y===z&&(fo.height-l))&&s.splice(a,1);o.position={left:s[0][0],top:s[0][1]}}return o},rect:function(t,e,n,r){return{width:Math.abs(n-t),height:Math.abs(r-e),position:{left:Math.min(t,n),top:Math.min(e,r)}}},_angles:{tc:1.5,tr:7/4,tl:5/4,bc:.5,br:.25,bl:.75,rc:2,lc:1,c:0},ellipse:function(t,e,n,r,i){var o=B.polys._angles[i.abbrev()],a=0===o?0:n*Math.cos(o*Math.PI),s=r*Math.sin(o*Math.PI);return{width:2*n-Math.abs(a),height:2*r-Math.abs(s),position:{left:t+a,top:e+s},adjustable:T}},circle:function(t,e,n,r){return B.polys.ellipse(t,e,n,n,r)}},B.svg=function(t,n,i){for(var o,a,s,u,l,c,f,d,h,p=(r(e),n[0]),g=r(p.ownerSVGElement),v=p.ownerDocument,m=(parseInt(n.css("stroke-width"),10)||0)/2;!p.getBBox;)p=p.parentNode;if(!p.getBBox||!p.parentNode)return T;switch(p.nodeName){case"ellipse":case"circle":d=B.polys.ellipse(p.cx.baseVal.value,p.cy.baseVal.value,(p.rx||p.r).baseVal.value+m,(p.ry||p.r).baseVal.value+m,i);break;case"line":case"polygon":case"polyline":for(f=p.points||[{x:p.x1.baseVal.value,y:p.y1.baseVal.value},{x:p.x2.baseVal.value,y:p.y2.baseVal.value}],d=[],c=-1,u=f.numberOfItems||f.length;++c';r.extend(k.prototype,{_scroll:function(){var e=this.qtip.elements.overlay;e&&(e[0].style.top=r(t).scrollTop()+"px")},init:function(n){var i=n.tooltip;r("select, object").length<1&&(this.bgiframe=n.elements.bgiframe=r(St).appendTo(i),n._bind(i,"tooltipmove",this.adjustBGIFrame,this._ns,this)),this.redrawContainer=r("
",{id:V+"-rcontainer"}).appendTo(e.body),n.elements.overlay&&n.elements.overlay.addClass("qtipmodal-ie6fix")&&(n._bind(t,["scroll","resize"],this._scroll,this._ns,this),n._bind(i,["tooltipshow"],this._scroll,this._ns,this)),this.redraw()},adjustBGIFrame:function(){var t,e,n=this.qtip.tooltip,r={height:n.outerHeight(T),width:n.outerWidth(T)},i=this.qtip.plugins.tip,o=this.qtip.elements.tip;e=parseInt(n.css("borderLeftWidth"),10)||0,e={left:-e,top:-e},i&&o&&(t="x"===i.corner.precedance?[j,P]:[I,L],e[t[1]]-=o[t[0]]()),this.bgiframe.css(e).css(r)},redraw:function(){if(this.qtip.rendered<1||this.drawing)return this;var t,e,n,r,i=this.qtip.tooltip,o=this.qtip.options.style,a=this.qtip.options.position.container;return this.qtip.drawing=1,o.height&&i.css(I,o.height),o.width?i.css(j,o.width):(i.css(j,"").appendTo(this.redrawContainer),e=i.width(),e%2<1&&(e+=1),n=i.css("maxWidth")||"",r=i.css("minWidth")||"",t=(n+r).indexOf("%")>-1?a.width()/100:0,n=(n.indexOf("%")>-1?t:1)*parseInt(n,10)||e,r=(r.indexOf("%")>-1?t:1)*parseInt(r,10)||0,e=n+r?Math.min(Math.max(e,r),n):e,i.css(j,Math.round(e)).appendTo(a)),this.drawing=0,this},destroy:function(){this.bgiframe&&this.bgiframe.remove(),this.qtip._unbind([t,this.qtip.tooltip],this._ns)}}),Ct=B.ie6=function(t){return 6===rt.ie?new k(t):T},Ct.initialize="render",S.ie6={"^content|style$":function(){this.redraw()}}})}(window,document),function(t,e,n){!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):jQuery&&!jQuery.fn.qtip&&t(jQuery)}(function(r){"use strict";function i(t,e,n,i){this.id=n,this.target=t,this.tooltip=M,this.elements={target:t},this._id=j+"-"+n,this.timers={img:{}},this.options=e,this.plugins={},this.cache={event:{},target:r(),disabled:_,attr:i,onTooltip:_,lastClass:""},this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=_}function o(t){return t===M||"object"!==r.type(t)}function a(t){return!(r.isFunction(t)||t&&t.attr||t.length||"object"===r.type(t)&&(t.jquery||t.then))}function s(t){var e,n,i,s;return o(t)?_:(o(t.metadata)&&(t.metadata={type:t.metadata}),"content"in t&&(e=t.content,o(e)||e.jquery||e.done?e=t.content={text:n=a(e)?_:e}:n=e.text,"ajax"in e&&(i=e.ajax,s=i&&i.once!==_,delete e.ajax,e.text=function(t,e){var o=n||r(this).attr(e.options.content.attr)||"Loading...",a=r.ajax(r.extend({},i,{context:e})).then(i.success,M,i.error).then(function(t){return t&&s&&e.set("content.text",t),t},function(t,n,r){e.destroyed||0===t.status||e.set("content.text",n+": "+r)});return s?o:(e.set("content.text",o),a)}),"title"in e&&(r.isPlainObject(e.title)&&(e.button=e.title.button,e.title=e.title.text),a(e.title||_)&&(e.title=_))),"position"in t&&o(t.position)&&(t.position={my:t.position,at:t.position}),"show"in t&&o(t.show)&&(t.show=t.show.jquery?{target:t.show}:t.show===k?{ready:k}:{event:t.show}),"hide"in t&&o(t.hide)&&(t.hide=t.hide.jquery?{target:t.hide}:{event:t.hide}),"style"in t&&o(t.style)&&(t.style={classes:t.style}),r.each(O,function(){this.sanitize&&this.sanitize(t)}),t)}function u(t,e){for(var n,r=0,i=t,o=e.split(".");i=i[o[r++]];)r0?setTimeout(r.proxy(t,this),e):void t.call(this)}function d(t){this.tooltip.hasClass(V)||(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this.timers.show=f.call(this,function(){this.toggle(k,t)},this.options.show.delay))}function h(t){if(!this.tooltip.hasClass(V)&&!this.destroyed){var e=r(t.relatedTarget),n=e.closest(F)[0]===this.tooltip[0],i=e[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==e[0]&&"mouse"===this.options.position.target&&n||this.options.hide.fixed&&/mouse(out|leave|move)/.test(t.type)&&(n||i))try{t.preventDefault(),t.stopImmediatePropagation()}catch(o){}else this.timers.hide=f.call(this,function(){this.toggle(_,t)},this.options.hide.delay,this)}}function p(t){!this.tooltip.hasClass(V)&&this.options.hide.inactive&&(clearTimeout(this.timers.inactive),this.timers.inactive=f.call(this,function(){this.hide(t)},this.options.hide.inactive))}function g(t){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(t)}function v(t,n,i){r(e.body).delegate(t,(n.split?n:n.join("."+j+" "))+"."+j,function(){var t=y.api[r.attr(this,L)];t&&!t.disabled&&i.apply(t,arguments)})}function m(t,n,o){var a,u,l,c,f,d=r(e.body),h=t[0]===e?d:t,p=t.metadata?t.metadata(o.metadata):M,g="html5"===o.metadata.type&&p?p[o.metadata.name]:M,v=t.data(o.metadata.name||"qtipopts");try{v="string"==typeof v?r.parseJSON(v):v}catch(m){}if(c=r.extend(k,{},y.defaults,o,"object"==typeof v?s(v):M,s(g||p)),u=c.position,c.id=n,"boolean"==typeof c.content.text){if(l=t.attr(c.content.attr),c.content.attr===_||!l)return _;c.content.text=l}if(u.container.length||(u.container=d),u.target===_&&(u.target=h),c.show.target===_&&(c.show.target=h),c.show.solo===k&&(c.show.solo=u.container.closest("body")),c.hide.target===_&&(c.hide.target=h),c.position.viewport===k&&(c.position.viewport=u.container),u.container=u.container.eq(0),u.at=new x(u.at,k),u.my=new x(u.my),t.data(j))if(c.overwrite)t.qtip("destroy",!0);else if(c.overwrite===_)return _;return t.attr(I,n),c.suppress&&(f=t.attr("title"))&&t.removeAttr("title").attr(U,f).attr("title",""),a=new i(t,c,n,(!!l)),t.data(j,a),a}var y,b,x,w,$,k=!0,_=!1,M=null,C="x",S="y",E="top",A="left",T="bottom",N="right",D="center",O={},j="qtip",I="data-hasqtip",L="data-qtip-id",P=["ui-widget","ui-tooltip"],F="."+j,q="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),z=j+"-fixed",W=j+"-default",R=j+"-focus",B=j+"-hover",V=j+"-disabled",H="_replacedByqTip",U="oldtitle",Y={ie:function(){for(var t=4,n=e.createElement("div");(n.innerHTML="")&&n.getElementsByTagName("i")[0];t+=1);return t>4?t:NaN}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||_};b=i.prototype,b._when=function(t){return r.when.apply(r,t)},b.render=function(t){if(this.rendered||this.destroyed)return this;var e,n=this,i=this.options,o=this.cache,a=this.elements,s=i.content.text,u=i.content.title,l=i.content.button,c=i.position,f=("."+this._id+" ",[]);return r.attr(this.target[0],"aria-describedby",this._id),o.posClass=this._createPosClass((this.position={my:c.my,at:c.at}).my),this.tooltip=a.tooltip=e=r("
",{id:this._id,"class":[j,W,i.style.classes,o.posClass].join(" "),width:i.style.width||"",height:i.style.height||"",tracking:"mouse"===c.target&&c.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":_,"aria-describedby":this._id+"-content","aria-hidden":k}).toggleClass(V,this.disabled).attr(L,this.id).data(j,this).appendTo(c.container).append(a.content=r("
",{"class":j+"-content",id:this._id+"-content","aria-atomic":k})),this.rendered=-1,this.positioning=k,u&&(this._createTitle(),r.isFunction(u)||f.push(this._updateTitle(u,_))),l&&this._createButton(),r.isFunction(s)||f.push(this._updateContent(s,_)),this.rendered=k,this._setWidget(),r.each(O,function(t){var e;"render"===this.initialize&&(e=this(n))&&(n.plugins[t]=e)}),this._unassignEvents(),this._assignEvents(),this._when(f).then(function(){n._trigger("render"),n.positioning=_,n.hiddenDuringWait||!i.show.ready&&!t||n.toggle(k,o.event,_),n.hiddenDuringWait=_}),y.api[this.id]=this,this},b.destroy=function(t){function e(){if(!this.destroyed){this.destroyed=k;var t,e=this.target,n=e.attr(U);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove(),r.each(this.plugins,function(t){this.destroy&&this.destroy()});for(t in this.timers)clearTimeout(this.timers[t]);e.removeData(j).removeAttr(L).removeAttr(I).removeAttr("aria-describedby"),this.options.suppress&&n&&e.attr("title",n).removeAttr(U),this._unassignEvents(),this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=M,delete y.api[this.id]}}return this.destroyed?this.target:(t===k&&"hide"!==this.triggering||!this.rendered?e.call(this):(this.tooltip.one("tooltiphidden",r.proxy(e,this)),!this.triggering&&this.hide()),this.target)},w=b.checks={builtin:{"^id$":function(t,e,n,i){var o=n===k?y.nextid:n,a=j+"-"+o;o!==_&&o.length>0&&!r("#"+a).length?(this._id=a,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):t[e]=i},"^prerender":function(t,e,n){n&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(t,e,n){this._updateContent(n)},"^content.attr$":function(t,e,n,r){this.options.content.text===this.target.attr(r)&&this._updateContent(this.target.attr(n))},"^content.title$":function(t,e,n){return n?(n&&!this.elements.title&&this._createTitle(),void this._updateTitle(n)):this._removeTitle()},"^content.button$":function(t,e,n){this._updateButton(n)},"^content.title.(text|button)$":function(t,e,n){this.set("content."+e,n)},"^position.(my|at)$":function(t,e,n){"string"==typeof n&&(this.position[e]=t[e]=new x(n,"at"===e))},"^position.container$":function(t,e,n){this.rendered&&this.tooltip.appendTo(n)},"^show.ready$":function(t,e,n){n&&(!this.rendered&&this.render(k)||this.toggle(k))},"^style.classes$":function(t,e,n,r){this.rendered&&this.tooltip.removeClass(r).addClass(n)},"^style.(width|height)":function(t,e,n){this.rendered&&this.tooltip.css(e,n)},"^style.widget|content.title":function(){this.rendered&&this._setWidget()},"^style.def":function(t,e,n){this.rendered&&this.tooltip.toggleClass(W,!!n)},"^events.(render|show|move|hide|focus|blur)$":function(t,e,n){this.rendered&&this.tooltip[(r.isFunction(n)?"":"un")+"bind"]("tooltip"+e,n)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){if(this.rendered){var t=this.options.position;this.tooltip.attr("tracking","mouse"===t.target&&t.adjust.mouse),this._unassignEvents(),this._assignEvents()}}}},b.get=function(t){if(this.destroyed)return this;var e=u(this.options,t.toLowerCase()),n=e[0][e[1]];return n.precedance?n.string():n};var G=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,X=/^prerender|show\.ready/i;b.set=function(t,e){if(this.destroyed)return this;var n,i=this.rendered,o=_,a=this.options;this.checks;return"string"==typeof t?(n=t,t={},t[n]=e):t=r.extend({},t),r.each(t,function(e,n){if(i&&X.test(e))return void delete t[e];var s,l=u(a,e.toLowerCase());s=l[0][l[1]],l[0][l[1]]=n&&n.nodeType?r(n):n,o=G.test(e)||o,t[e]=[l[0],l[1],n,s]}),s(a),this.positioning=k,r.each(t,r.proxy(l,this)),this.positioning=_,this.rendered&&this.tooltip[0].offsetWidth>0&&o&&this.reposition("mouse"===a.position.target?M:this.cache.event),this},b._update=function(t,e,n){var i=this,o=this.cache;return this.rendered&&t?(r.isFunction(t)&&(t=t.call(this.elements.target,o.event,this)||""),r.isFunction(t.then)?(o.waiting=k,t.then(function(t){return o.waiting=_,i._update(t,e)},M,function(t){return i._update(t,e)})):t===_||!t&&""!==t?_:(t.jquery&&t.length>0?e.empty().append(t.css({display:"block",visibility:"visible"})):e.html(t),this._waitForContent(e).then(function(t){i.rendered&&i.tooltip[0].offsetWidth>0&&i.reposition(o.event,!t.length)}))):_},b._waitForContent=function(t){var e=this.cache;return e.waiting=k,(r.fn.imagesLoaded?t.imagesLoaded():r.Deferred().resolve([])).done(function(){e.waiting=_}).promise()},b._updateContent=function(t,e){this._update(t,this.elements.content,e)},b._updateTitle=function(t,e){this._update(t,this.elements.title,e)===_&&this._removeTitle(_)},b._createTitle=function(){var t=this.elements,e=this._id+"-title";t.titlebar&&this._removeTitle(),t.titlebar=r("
",{"class":j+"-titlebar "+(this.options.style.widget?c("header"):"")}).append(t.title=r("
",{id:e,"class":j+"-title","aria-atomic":k})).insertBefore(t.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(t){r(this).toggleClass("ui-state-active ui-state-focus","down"===t.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(t){r(this).toggleClass("ui-state-hover","mouseover"===t.type)}),this.options.content.button&&this._createButton()},b._removeTitle=function(t){var e=this.elements;e.title&&(e.titlebar.remove(),e.titlebar=e.title=e.button=M,t!==_&&this.reposition())},b._createPosClass=function(t){return j+"-pos-"+(t||this.options.position.my).abbrev()},b.reposition=function(n,i){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=k;var o,a,s,u,l=this.cache,c=this.tooltip,f=this.options.position,d=f.target,h=f.my,p=f.at,g=f.viewport,v=f.container,m=f.adjust,y=m.method.split(" "),b=c.outerWidth(_),x=c.outerHeight(_),w=0,$=0,M=c.css("position"),C={left:0,top:0},S=c[0].offsetWidth>0,j=n&&"scroll"===n.type,I=r(t),L=v[0].ownerDocument,P=this.mouse;if(r.isArray(d)&&2===d.length)p={x:A,y:E},C={left:d[0],top:d[1]};else if("mouse"===d)p={x:A,y:E},(!m.mouse||this.options.hide.distance)&&l.origin&&l.origin.pageX?n=l.origin:!n||n&&("resize"===n.type||"scroll"===n.type)?n=l.event:P&&P.pageX&&(n=P),"static"!==M&&(C=v.offset()),L.body.offsetWidth!==(t.innerWidth||L.documentElement.clientWidth)&&(a=r(e.body).offset()),C={left:n.pageX-C.left+(a&&a.left||0),top:n.pageY-C.top+(a&&a.top||0)},m.mouse&&j&&P&&(C.left-=(P.scrollX||0)-I.scrollLeft(),C.top-=(P.scrollY||0)-I.scrollTop());else{if("event"===d?n&&n.target&&"scroll"!==n.type&&"resize"!==n.type?l.target=r(n.target):n.target||(l.target=this.elements.target):"event"!==d&&(l.target=r(d.jquery?d:this.elements.target)),d=l.target,d=r(d).eq(0),0===d.length)return this;d[0]===e||d[0]===t?(w=Y.iOS?t.innerWidth:d.width(),$=Y.iOS?t.innerHeight:d.height(),d[0]===t&&(C={top:(g||d).scrollTop(),left:(g||d).scrollLeft()})):O.imagemap&&d.is("area")?o=O.imagemap(this,d,p,O.viewport?y:_):O.svg&&d&&d[0].ownerSVGElement?o=O.svg(this,d,p,O.viewport?y:_):(w=d.outerWidth(_),$=d.outerHeight(_),C=d.offset()),o&&(w=o.width,$=o.height,a=o.offset,C=o.position),C=this.reposition.offset(d,C,v),(Y.iOS>3.1&&Y.iOS<4.1||Y.iOS>=4.3&&Y.iOS<4.33||!Y.iOS&&"fixed"===M)&&(C.left-=I.scrollLeft(),C.top-=I.scrollTop()),(!o||o&&o.adjustable!==_)&&(C.left+=p.x===N?w:p.x===D?w/2:0,C.top+=p.y===T?$:p.y===D?$/2:0)}return C.left+=m.x+(h.x===N?-b:h.x===D?-b/2:0),C.top+=m.y+(h.y===T?-x:h.y===D?-x/2:0),O.viewport?(s=C.adjusted=O.viewport(this,C,f,w,$,b,x),a&&s.left&&(C.left+=a.left),a&&s.top&&(C.top+=a.top),s.my&&(this.position.my=s.my)):C.adjusted={left:0,top:0},l.posClass!==(u=this._createPosClass(this.position.my))&&c.removeClass(l.posClass).addClass(l.posClass=u),this._trigger("move",[C,g.elem||g],n)?(delete C.adjusted,i===_||!S||isNaN(C.left)||isNaN(C.top)||"mouse"===d||!r.isFunction(f.effect)?c.css(C):r.isFunction(f.effect)&&(f.effect.call(c,this,r.extend({},C)),c.queue(function(t){r(this).css({opacity:"",height:""}),Y.ie&&this.style.removeAttribute("filter"),t()})),this.positioning=_,this):this},b.reposition.offset=function(t,n,i){function o(t,e){n.left+=e*t.scrollLeft(),n.top+=e*t.scrollTop()}if(!i[0])return n;var a,s,u,l,c=r(t[0].ownerDocument),f=!!Y.ie&&"CSS1Compat"!==e.compatMode,d=i[0];do"static"!==(s=r.css(d,"position"))&&("fixed"===s?(u=d.getBoundingClientRect(),o(c,-1)):(u=r(d).position(),u.left+=parseFloat(r.css(d,"borderLeftWidth"))||0,u.top+=parseFloat(r.css(d,"borderTopWidth"))||0),n.left-=u.left+(parseFloat(r.css(d,"marginLeft"))||0),n.top-=u.top+(parseFloat(r.css(d,"marginTop"))||0),a||"hidden"===(l=r.css(d,"overflow"))||"visible"===l||(a=r(d)));while(d=d.offsetParent);return a&&(a[0]!==c[0]||f)&&o(a,1),n};var Z=(x=b.reposition.Corner=function(t,e){t=(""+t).replace(/([A-Z])/," $1").replace(/middle/gi,D).toLowerCase(),this.x=(t.match(/left|right/i)||t.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(t.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.forceY=!!e;var n=t.charAt(0);this.precedance="t"===n||"b"===n?S:C}).prototype;Z.invert=function(t,e){this[t]=this[t]===A?N:this[t]===N?A:e||this[t]},Z.string=function(t){var e=this.x,n=this.y,r=e!==n?"center"===e||"center"!==n&&(this.precedance===S||this.forceY)?[n,e]:[e,n]:[e];return t!==!1?r.join(" "):r},Z.abbrev=function(){var t=this.string(!1);return t[0].charAt(0)+(t[1]&&t[1].charAt(0)||"")},Z.clone=function(){return new x(this.string(),this.forceY)},b.toggle=function(t,n){var i=this.cache,o=this.options,a=this.tooltip;if(n){if(/over|enter/.test(n.type)&&i.event&&/out|leave/.test(i.event.type)&&o.show.target.add(n.target).length===o.show.target.length&&a.has(n.relatedTarget).length)return this;i.event=r.event.fix(n)}if(this.waiting&&!t&&(this.hiddenDuringWait=k),!this.rendered)return t?this.render(1):this;if(this.destroyed||this.disabled)return this;var s,u,l,c=t?"show":"hide",f=this.options[c],d=(this.options[t?"hide":"show"],this.options.position),h=this.options.content,p=this.tooltip.css("width"),g=this.tooltip.is(":visible"),v=t||1===f.target.length,m=!n||f.target.length<2||i.target[0]===n.target;return(typeof t).search("boolean|number")&&(t=!g),s=!a.is(":animated")&&g===t&&m,u=s?M:!!this._trigger(c,[90]),this.destroyed?this:(u!==_&&t&&this.focus(n),!u||s?this:(r.attr(a[0],"aria-hidden",!t),t?(this.mouse&&(i.origin=r.event.fix(this.mouse)),r.isFunction(h.text)&&this._updateContent(h.text,_),r.isFunction(h.title)&&this._updateTitle(h.title,_),!$&&"mouse"===d.target&&d.adjust.mouse&&(r(e).bind("mousemove."+j,this._storeMouse),$=k),p||a.css("width",a.outerWidth(_)),this.reposition(n,arguments[2]),p||a.css("width",""),f.solo&&("string"==typeof f.solo?r(f.solo):r(F,f.solo)).not(a).not(f.target).qtip("hide",r.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete i.origin,$&&!r(F+'[tracking="true"]:visible',f.solo).not(a).length&&(r(e).unbind("mousemove."+j),$=_),this.blur(n)),l=r.proxy(function(){t?(Y.ie&&a[0].style.removeAttribute("filter"),a.css("overflow",""),"string"==typeof f.autofocus&&r(this.options.show.autofocus,a).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):a.css({display:"",visibility:"",opacity:"",left:"",top:""}),this._trigger(t?"visible":"hidden")},this),f.effect===_||v===_?(a[c](),l()):r.isFunction(f.effect)?(a.stop(1,1),f.effect.call(a,this),a.queue("fx",function(t){l(),t()})):a.fadeTo(90,t?1:0,l),t&&f.target.trigger("qtip-"+this.id+"-inactive"),this))},b.show=function(t){return this.toggle(k,t)},b.hide=function(t){return this.toggle(_,t)},b.focus=function(t){if(!this.rendered||this.destroyed)return this;var e=r(F),n=this.tooltip,i=parseInt(n[0].style.zIndex,10),o=y.zindex+e.length;return n.hasClass(R)||this._trigger("focus",[o],t)&&(i!==o&&(e.each(function(){this.style.zIndex>i&&(this.style.zIndex=this.style.zIndex-1)}),e.filter("."+R).qtip("blur",t)),n.addClass(R)[0].style.zIndex=o),this},b.blur=function(t){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass(R),this._trigger("blur",[this.tooltip.css("zIndex")],t),this)},b.disable=function(t){return this.destroyed?this:("toggle"===t?t=!(this.rendered?this.tooltip.hasClass(V):this.disabled):"boolean"!=typeof t&&(t=k),this.rendered&&this.tooltip.toggleClass(V,t).attr("aria-disabled",t),this.disabled=!!t,this)},b.enable=function(){return this.disable(_)},b._createButton=function(){var t=this,e=this.elements,n=e.tooltip,i=this.options.content.button,o="string"==typeof i,a=o?i:"Close tooltip";e.button&&e.button.remove(),i.jquery?e.button=i:e.button=r("",{"class":"qtip-close "+(this.options.style.widget?"":j+"-icon"),title:a,"aria-label":a}).prepend(r("",{"class":"ui-icon ui-icon-close",html:"×"})),e.button.appendTo(e.titlebar||n).attr("role","button").click(function(e){return n.hasClass(V)||t.hide(e),_})},b._updateButton=function(t){if(!this.rendered)return _;var e=this.elements.button;t?this._createButton():e.remove()},b._setWidget=function(){var t=this.options.style.widget,e=this.elements,n=e.tooltip,r=n.hasClass(V);n.removeClass(V),V=t?"ui-state-disabled":"qtip-disabled",n.toggleClass(V,r),n.toggleClass("ui-helper-reset "+c(),t).toggleClass(W,this.options.style.def&&!t),e.content&&e.content.toggleClass(c("content"),t),e.titlebar&&e.titlebar.toggleClass(c("header"),t),e.button&&e.button.toggleClass(j+"-icon",!t)},b._storeMouse=function(t){return(this.mouse=r.event.fix(t)).type="mousemove",this},b._bind=function(t,e,n,i,o){if(t&&n&&e.length){var a="."+this._id+(i?"-"+i:"");return r(t).bind((e.split?e:e.join(a+" "))+a,r.proxy(n,o||this)),this}},b._unbind=function(t,e){return t&&r(t).unbind("."+this._id+(e?"-"+e:"")),this},b._trigger=function(t,e,n){var i=r.Event("tooltip"+t);return i.originalEvent=n&&r.extend({},n)||this.cache.event||M,this.triggering=t,this.tooltip.trigger(i,[this].concat(e||[])),this.triggering=_,!i.isDefaultPrevented()},b._bindEvents=function(t,e,n,i,o,a){var s=n.filter(i).add(i.filter(n)),u=[];s.length&&(r.each(e,function(e,n){var i=r.inArray(n,t);i>-1&&u.push(t.splice(i,1)[0])}),u.length&&(this._bind(s,u,function(t){var e=!!this.rendered&&this.tooltip[0].offsetWidth>0;(e?a:o).call(this,t)}),n=n.not(s),i=i.not(s))),this._bind(n,t,o),this._bind(i,e,a)},b._assignInitialEvents=function(t){function e(t){return this.disabled||this.destroyed?_:(this.cache.event=t&&r.event.fix(t),this.cache.target=t&&r(t.target),clearTimeout(this.timers.show),void(this.timers.show=f.call(this,function(){this.render("object"==typeof t||n.show.ready)},n.prerender?0:n.show.delay)))}var n=this.options,i=n.show.target,o=n.hide.target,a=n.show.event?r.trim(""+n.show.event).split(" "):[],s=n.hide.event?r.trim(""+n.hide.event).split(" "):[];this._bind(this.elements.target,["remove","removeqtip"],function(t){this.destroy(!0)},"destroy"),/mouse(over|enter)/i.test(n.show.event)&&!/mouse(out|leave)/i.test(n.hide.event)&&s.push("mouseleave"),this._bind(i,"mousemove",function(t){this._storeMouse(t),this.cache.onTarget=k}),this._bindEvents(a,s,i,o,e,function(){return this.timers?void clearTimeout(this.timers.show):_}),(n.show.ready||n.prerender)&&e.call(this,t)},b._assignEvents=function(){var n=this,i=this.options,o=i.position,a=this.tooltip,s=i.show.target,u=i.hide.target,l=o.container,c=o.viewport,f=r(e),v=(r(e.body),r(t)),m=i.show.event?r.trim(""+i.show.event).split(" "):[],b=i.hide.event?r.trim(""+i.hide.event).split(" "):[];r.each(i.events,function(t,e){n._bind(a,"toggle"===t?["tooltipshow","tooltiphide"]:["tooltip"+t],e,null,a)}),/mouse(out|leave)/i.test(i.hide.event)&&"window"===i.hide.leave&&this._bind(f,["mouseout","blur"],function(t){/select|option/.test(t.target.nodeName)||t.relatedTarget||this.hide(t)}),i.hide.fixed?u=u.add(a.addClass(z)):/mouse(over|enter)/i.test(i.show.event)&&this._bind(u,"mouseleave",function(){clearTimeout(this.timers.show)}),(""+i.hide.event).indexOf("unfocus")>-1&&this._bind(l.closest("html"),["mousedown","touchstart"],function(t){var e=r(t.target),n=this.rendered&&!this.tooltip.hasClass(V)&&this.tooltip[0].offsetWidth>0,i=e.parents(F).filter(this.tooltip[0]).length>0;e[0]===this.target[0]||e[0]===this.tooltip[0]||i||this.target.has(e[0]).length||!n||this.hide(t)}),"number"==typeof i.hide.inactive&&(this._bind(s,"qtip-"+this.id+"-inactive",p,"inactive"),this._bind(u.add(a),y.inactiveEvents,p)),this._bindEvents(m,b,s,u,d,h),this._bind(s.add(a),"mousemove",function(t){if("number"==typeof i.hide.distance){var e=this.cache.origin||{},n=this.options.hide.distance,r=Math.abs;(r(t.pageX-e.pageX)>=n||r(t.pageY-e.pageY)>=n)&&this.hide(t)}this._storeMouse(t)}),"mouse"===o.target&&o.adjust.mouse&&(i.hide.event&&this._bind(s,["mouseenter","mouseleave"],function(t){return this.cache?void(this.cache.onTarget="mouseenter"===t.type):_}),this._bind(f,"mousemove",function(t){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass(V)&&this.tooltip[0].offsetWidth>0&&this.reposition(t)})),(o.adjust.resize||c.length)&&this._bind(r.event.special.resize?c:v,"resize",g),o.adjust.scroll&&this._bind(v.add(o.container),"scroll",g)},b._unassignEvents=function(){var n=this.options,i=n.show.target,o=n.hide.target,a=r.grep([this.elements.target[0],this.rendered&&this.tooltip[0],n.position.container[0],n.position.viewport[0],n.position.container.closest("html")[0],t,e],function(t){return"object"==typeof t});i&&i.toArray&&(a=a.concat(i.toArray())),o&&o.toArray&&(a=a.concat(o.toArray())),this._unbind(a)._unbind(a,"destroy")._unbind(a,"inactive")},r(function(){v(F,["mouseenter","mouseleave"],function(t){var e="mouseenter"===t.type,n=r(t.currentTarget),i=r(t.relatedTarget||t.target),o=this.options;e?(this.focus(t),n.hasClass(z)&&!n.hasClass(V)&&clearTimeout(this.timers.hide)):"mouse"===o.position.target&&o.position.adjust.mouse&&o.hide.event&&o.show.target&&!i.closest(o.show.target[0]).length&&this.hide(t),n.toggleClass(B,e)}),v("["+L+"]",q,p)}),y=r.fn.qtip=function(t,e,i){var o=(""+t).toLowerCase(),a=M,u=r.makeArray(arguments).slice(1),l=u[u.length-1],c=this[0]?r.data(this[0],j):M;return!arguments.length&&c||"api"===o?c:"string"==typeof t?(this.each(function(){var t=r.data(this,j);if(!t)return k;if(l&&l.timeStamp&&(t.cache.event=l),!e||"option"!==o&&"options"!==o)t[o]&&t[o].apply(t,u);else{if(i===n&&!r.isPlainObject(e))return a=t.get(e),_;t.set(e,i)}}),a!==M?a:this):"object"!=typeof t&&arguments.length?void 0:(c=s(r.extend(k,{},t)),this.each(function(t){var e,n;return n=r.isArray(c.id)?c.id[t]:c.id,n=!n||n===_||n.length<1||y.api[n]?y.nextid++:n,e=m(r(this),n,c),e===_?k:(y.api[n]=e,r.each(O,function(){"initialize"===this.initialize&&this(e)}),void e._assignInitialEvents(l))}))},r.qtip=i,y.api={},r.each({attr:function(t,e){if(this.length){var n=this[0],i="title",o=r.data(n,"qtip");if(t===i&&o&&"object"==typeof o&&o.options.suppress)return arguments.length<2?r.attr(n,U):(o&&o.options.content.attr===i&&o.cache.attr&&o.set("content.text",e),this.attr(U,e))}return r.fn["attr"+H].apply(this,arguments)},clone:function(t){var e=(r([]),r.fn["clone"+H].apply(this,arguments));return t||e.filter("["+U+"]").attr("title",function(){return r.attr(this,U)}).removeAttr(U),e}},function(t,e){if(!e||r.fn[t+H])return k;var n=r.fn[t+H]=r.fn[t];r.fn[t]=function(){return e.apply(this,arguments)||n.apply(this,arguments)}}),r.ui||(r["cleanData"+H]=r.cleanData,r.cleanData=function(t){for(var e,n=0;(e=r(t[n])).length;n++)if(e.attr(I))try{e.triggerHandler("removeqtip")}catch(i){}r["cleanData"+H].apply(this,arguments)}),y.version="2.2.1",y.nextid=0,y.inactiveEvents=q,y.zindex=15e3,y.defaults={prerender:_,id:_,overwrite:k,suppress:k,content:{text:k,attr:"title",title:_,button:_},position:{my:"top left",at:"bottom right",target:_,container:_,viewport:_,adjust:{x:0,y:0,mouse:k,scroll:k,resize:k,method:"flipinvert flipinvert"},effect:function(t,e,n){r(this).animate(e,{duration:200,queue:_})}},show:{target:_,event:"mouseenter",effect:k,delay:90,solo:_,ready:_,autofocus:_},hide:{target:_,event:"mouseleave",effect:k,delay:0,fixed:_,inactive:_,leave:"window",distance:_},style:{classes:"",widget:_,width:_,height:_,def:k},events:{render:M,move:M,show:M,hide:M,toggle:M,visible:M,hidden:M,focus:M,blur:M}}})}(window,document),function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.dagreD3=t()}}(function(){return function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a0}e.exports=r},{}],14:[function(t,e,n){function r(t,e){return t.intersect(e)}e.exports=r},{}],15:[function(t,e,n){function r(t,e,n){var r=t.x,o=t.y,a=[],s=Number.POSITIVE_INFINITY,u=Number.POSITIVE_INFINITY;e.forEach(function(t){s=Math.min(s,t.x),u=Math.min(u,t.y)});for(var l=r-t.width/2-s,c=o-t.height/2-u,f=0;f1&&a.sort(function(t,e){var r=t.x-n.x,i=t.y-n.y,o=Math.sqrt(r*r+i*i),a=e.x-n.x,s=e.y-n.y,u=Math.sqrt(a*a+s*s);return oMath.abs(a)*l?(s<0&&(l=-l),n=0===s?0:l*a/s,r=l):(a<0&&(u=-u),n=u,r=0===a?0:u*s/a),{x:i+n,y:o+r}}e.exports=r},{}],17:[function(t,e,n){function r(t,e){var n=t.append("foreignObject").attr("width","100000"),r=n.append("xhtml:div");r.attr("xmlns","http://www.w3.org/1999/xhtml");var o=e.label;switch(typeof o){case"function":r.insert(o);break;case"object":r.insert(function(){return o});break;default:r.html(o)}i.applyStyle(r,e.labelStyle),r.style("display","inline-block"),r.style("white-space","nowrap");var a=r[0][0].getBoundingClientRect();return n.attr("width",a.width).attr("height",a.height),n}var i=t("../util");e.exports=r},{"../util":27}],18:[function(t,e,n){function r(t,e,n){var r=e.label,s=t.append("g");"svg"===e.labelType?a(s,e):"string"!=typeof r||"html"===e.labelType?o(s,e):i(s,e);var u,l=s.node().getBBox();switch(n){case"top":u=-e.height/2;break;case"bottom":u=e.height/2-l.height;break;default:u=-l.height/2}return s.attr("transform","translate("+-l.width/2+","+u+")"),s}var i=t("./add-text-label"),o=t("./add-html-label"),a=t("./add-svg-label");e.exports=r},{"./add-html-label":17,"./add-svg-label":19,"./add-text-label":20}],19:[function(t,e,n){function r(t,e){var n=t;return n.node().appendChild(e.label),i.applyStyle(n,e.labelStyle),n}var i=t("../util");e.exports=r},{"../util":27}],20:[function(t,e,n){function r(t,e){for(var n=t.append("text"),r=i(e.label).split("\n"),a=0;a5?n-5:n}function P(){if(c||z.attr("height"))c?z.attr("height",c):c=z.attr("height");else{if(!_)throw"height of the timeline is not set";c=K.height+K.top-q.top,d3.select(t[0][0]).attr("height",c)}}function F(){if(l||q.width){if(!l||!q.width)try{l=z.attr("width")}catch(t){console.log(t)}}else try{if(l=z.attr("width"),!l)throw"width of the timeline is not set. As of Firefox 27, timeline().with(x) needs to be explicitly set in order to render"}catch(t){console.log(t)}}var q=t[0][0].getBoundingClientRect(),z=d3.select(t[0][0]),W={},R=1,B=0,V=0;F();var H=(t.append("svg:clipPath").attr("id",D+"-gclip").append("svg:rect").attr("clipPathUnits","objectBoundingBox").attr("x",b.left).attr("y",b.top).attr("width",l-b.left-b.right).attr("height",1e3),t.append("g").attr("clip-path","url(#"+D+"-gclip)"));k&&H.each(function(t,e){t.forEach(function(t,e){t.times.forEach(function(t,n){0===e&&0===n?(originTime=t.starting_time,t.starting_time=0,t.ending_time=t.ending_time-originTime):(t.starting_time=t.starting_time-originTime,t.ending_time=t.ending_time-originTime)})})}),(x||0===y||0===m)&&(H.each(function(t,e){t.forEach(function(t,e){x&&Object.keys(W).indexOf(e)==-1&&(W[e]=R,R++),t.times.forEach(function(t,e){0===m&&(t.starting_timeV&&(V=t.ending_time)})})}),0===y&&(y=V),0===m&&(m=B));var U=d3.time.scale().domain([m,y]).range([b.left,l-b.right]),Y=d3.svg.axis().scale(U).orient(u).tickFormat(h.format).ticks(h.numTicks||h.tickTime,h.tickInterval).tickSize(h.tickSize);if(T)var G=d3.svg.axis().scale(U).orient(u).tickFormat(d3.time.format("%X")).ticks(h.numTicks||h.tickTime,h.tickInterval).tickSize(0);if(C){var X=b.top+(_+M)*R;H.append("g").attr("class","axis").attr("transform","translate(0,"+X+")").call(Y),T&&H.append("g").attr("class","axis-hour").attr("transform","translate(0,"+(X+20)+")").call(G)}S&&H.append("g").attr("class","axis axis-tick").attr("transform","translate(0,"+(b.top+(_+M)*R)+")").attr(E.stroke,E.spacing).call(Y.tickFormat("").tickSize(-(b.top+(_+M)*(R-1)+3),0,0)),H.each(function(a,u){a.forEach(function(a,c){function h(t,e){return x?b.top+(_+M)*W[c]:b.top}function m(t,e){return x?b.top+(_+M)*W[c]+.65*_:b.top+.65*_}function y(t,e){return x?b.top+(_+M)*W[c]+_-3:b.top+_-3}var w=a.times,k="undefined"!=typeof a.label,C=function(t){return null==s?t:s(t)};if("undefined"!=typeof a.id&&console.warn("d3Timeline Warning: Ids per dataset is deprecated in favor of a 'class' key. Ids are now per data element."),d){var S=(_+M)*W[c];H.selectAll("svg").data(w).enter().insert("rect").attr("class","row-green-bar").attr("x",0+b.left).attr("width",l-b.right-b.left).attr("y",S).attr("height",_).attr("fill",d)}var E=H.selectAll("svg").data(w).enter().append("g").attr("class",function(t,e){return"bar-container bar-type-"+t.type}).attr("width",I);"scheduled"!=w[0].type&&E.append("svg:clipPath").attr("id",D+"-timeline-textclip-"+u+"-"+c).attr("class","timeline-clip").append("svg:rect").attr("clipPathUnits","objectBoundingBox").attr("x",O).attr("y",h).attr("width",L).attr("height",_);var T=E.append(function(t,e){return document.createElementNS(d3.ns.prefix.svg,"display"in t?t.display:v)}).attr("x",O).attr("y",h).attr("rx",5).attr("ry",5).attr("width",I).attr("cy",function(t,e){return h(t,e)+_/2}).attr("cx",O).attr("r",_/2).attr("height",_).style("stroke",function(t,e){return t.borderColor}).style("stroke-width",1).style("fill",function(t,e){var n;return t.color?t.color:g?(n=t[g],p(n?n:a[g])):p(c)}).on("mousemove",function(t,e){n(t,c,a)}).on("mouseover",function(t,e){r(t,e,a)}).on("mouseout",function(t,e){i(t,e,a)}).on("click",function(t,e){o(t,c,a)}).attr("class",function(t,e){return a["class"]?"timeline-series timelineSeries_"+a["class"]:"timeline-series timelineSeries_"+c}).attr("id",function(t,e){return a.id&&!t.id?"timelineItem_"+a.id:t.id?t.id:"timelineItem_"+c+"_"+e}),P=E.append("text").attr("class","timeline-insidelabel").attr("x",j).attr("y",m).attr("height",_).attr("clip-path","url(#"+D+"-timeline-textclip-"+u+"-"+c+")").text(function(t){return t.label}).on("click",function(t,e){o(t,c,a)});if("scheduled"==w[0].type&&T.attr("width",P.node().getComputedTextLength()+10),H.selectAll("svg .bar-container").each(function(t,e){$(this).qtip({content:{text:t.label},position:{my:"bottom left",at:"top left"},style:{classes:"qtip-light qtip-timeline-bar"}})}),f){var F=_+M/2+b.top+(_+M)*W[c];t.append("svg:line").attr("class","row-seperator").attr("x1",0+b.left).attr("x2",l-b.right).attr("y1",F).attr("y2",F).attr("stroke-width",1).attr("stroke",f)}A&&"scheduled"==w[0].type&&H.selectAll("svg").data(w).enter().append("svg:line").attr("class","line-start").attr("x1",e).attr("y1",y).attr("x2",e).attr("y2",b.top+(_+M)*R).style("stroke",function(t,e){return t.color}).style("stroke-width",N.width),k&&t.append("text").attr("class","timeline-label").attr("transform","translate(0,"+(.75*_+b.top+(_+M)*W[c])+")").text(k?C(a.label):a.id).on("click",function(t,e){o(t,c,a)}),"undefined"!=typeof a.icon&&t.append("image").attr("class","timeline-label").attr("transform","translate(0,"+(b.top+(_+M)*W[c])+")").attr("xlink:href",a.icon).attr("width",b.left).attr("height",_)})});var Z=function(){$(".qtip.qtip-timeline-bar").qtip("hide"),H.selectAll(".bar-type-scheduled .timeline-series").attr("x",O),H.selectAll(".bar-type-regular .timeline-series").attr("x",O).attr("width",I),H.selectAll(".timeline-insidelabel").attr("x",j),H.selectAll(".bar-type-scheduled .timeline-clip").select("rect").attr("x",O),H.selectAll(".bar-type-regular .timeline-clip").select("rect").attr("x",O).attr("width",L),H.selectAll("g.axis").call(Y),T&&H.selectAll("g.axis-hour").call(G),A&&(H.selectAll("line.line-start").attr("x1",e).attr("x2",e),H.selectAll("line.line-end").attr("x1",a).attr("x2",a))},Q=d3.behavior.zoom().x(U).on("zoom",Z);t.call(Q),w&&H.selectAll(".tick text").attr("transform",function(t){return"rotate("+w+")translate("+(this.getBBox().width/2+10)+","+this.getBBox().height/2+")"});var K=H[0][0].getBoundingClientRect();P(),bbox=H[0][0].getBBox(),t.attr("height",bbox.height+40)}var e=["circle","rect"],n=function(){},r=function(){},i=function(){},o=function(){},a=function(){},s=function(){},u="bottom",l=null,c=null,f=null,d=null,h={format:d3.time.format("%I %p"),tickTime:d3.time.hours,tickInterval:1,tickSize:6},p=d3.scale.category20(),g=null,v="rect",m=0,y=0,b={left:30,right:30,top:30,bottom:30},x=!1,w=!1,k=!1,_=20,M=5,C=!0,S=!1,E={stroke:"stroke-dasharray",spacing:"4 10"},A=!1,T=!1,N={marginTop:25,marginBottom:0,width:1,color:p},D="timeline";return t.margin=function(e){return arguments.length?(b=e,t):b},t.orient=function(e){return arguments.length?(u=e,t):u},t.itemHeight=function(e){return arguments.length?(_=e,t):_},t.itemMargin=function(e){return arguments.length?(M=e,t):M},t.height=function(e){return arguments.length?(c=e,t):c},t.width=function(e){return arguments.length?(l=e,t):l},t.display=function(n){return arguments.length&&e.indexOf(n)!=-1?(v=n,t):v},t.labelFormat=function(e){return arguments.length?(s=e,t):null},t.tickFormat=function(e){return arguments.length?(h=e,t):h},t.prefix=function(e){return arguments.length?(D=e,t):D},t.hover=function(e){return arguments.length?(n=e,t):n},t.mouseover=function(e){return arguments.length?(r=e,t):e},t.mouseout=function(e){return arguments.length?(i=e,t):e},t.click=function(e){return arguments.length?(o=e,t):o},t.scroll=function(e){return arguments.length?(a=e,t):a},t.colors=function(e){return arguments.length?(p=e,t):p},t.beginning=function(e){return arguments.length?(m=e,t):m},t.ending=function(e){return arguments.length?(y=e,t):y},t.rotateTicks=function(e){return w=e,t},t.stack=function(){return x=!x,t},t.relativeTime=function(){return k=!k,t},t.showBorderLine=function(){return A=!A,t},t.showHourTimeline=function(){return T=!T,t},t.showBorderFormat=function(e){return arguments.length?(N=e,t):N},t.colorProperty=function(e){return arguments.length?(g=e,t):g},t.rowSeperators=function(e){return arguments.length?(f=e,t):f},t.background=function(e){return arguments.length?(d=e,t):d},t.showTimeAxis=function(){return C=!C,t},t.showTimeAxisTick=function(){return S=!S,t},t.showTimeAxisTickFormat=function(e){return arguments.length?(E=e,t):E},t}}(); \ No newline at end of file diff --git a/flink-runtime-web/web-dashboard/web/partials/jobs/job.plan.node-list.metrics.html b/flink-runtime-web/web-dashboard/web/partials/jobs/job.plan.node-list.metrics.html index 26a1e65de37599..daaf7c4269120a 100644 --- a/flink-runtime-web/web-dashboard/web/partials/jobs/job.plan.node-list.metrics.html +++ b/flink-runtime-web/web-dashboard/web/partials/jobs/job.plan.node-list.metrics.html @@ -39,7 +39,7 @@
  • - +
\ No newline at end of file From 140c4eea17fa40c496179318f378960342362da7 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 20 Feb 2017 10:28:14 +0100 Subject: [PATCH 020/360] [FLINK-5831] [webui] order, search and filter metrics This closes #3369 --- .../jobs/job.plan.node-list.metrics.jade | 7 ++++++- .../app/scripts/common/filters.coffee | 6 ++++++ .../app/scripts/modules/jobs/jobs.ctrl.coffee | 12 +++++++++++- .../web-dashboard/app/styles/metric.styl | 18 ++++++++++++++++-- .../web-dashboard/web/css/index.css | 2 +- .../web-dashboard/web/js/hs/index.js | 4 ++-- .../web-dashboard/web/js/index.js | 4 ++-- .../jobs/job.plan.node-list.metrics.html | 6 +++++- 8 files changed, 49 insertions(+), 10 deletions(-) diff --git a/flink-runtime-web/web-dashboard/app/partials/jobs/job.plan.node-list.metrics.jade b/flink-runtime-web/web-dashboard/app/partials/jobs/job.plan.node-list.metrics.jade index f3ec8dc0217331..a1d22e37019946 100644 --- a/flink-runtime-web/web-dashboard/app/partials/jobs/job.plan.node-list.metrics.jade +++ b/flink-runtime-web/web-dashboard/app/partials/jobs/job.plan.node-list.metrics.jade @@ -28,7 +28,12 @@ nav.navbar.navbar-default.navbar-secondary-additional.navbar-secondary-additiona |   span.caret ul.dropdown-menu.dropdown-menu-right.metric-menu - li(ng-repeat="metric in availableMetrics track by $index") + section(class="search") + label(for="search-input") + i(class="fa fa-search" aria-hidden="true") + span(class="sr-only") Search icons + input(type="text" ng-model="metricsFilterQuery" class="metrics-filter" placeholder="Search available metrics...") + li(ng-repeat="metric in availableMetrics | searchMetrics:metricsFilterQuery track by $index") a(ng-click="addMetric(metric)") {{ metric.id | limit }} .dropdown.add-metrics(ng-if="!availableMetrics.length") diff --git a/flink-runtime-web/web-dashboard/app/scripts/common/filters.coffee b/flink-runtime-web/web-dashboard/app/scripts/common/filters.coffee index e2b83391e89751..211139f4006400 100644 --- a/flink-runtime-web/web-dashboard/app/scripts/common/filters.coffee +++ b/flink-runtime-web/web-dashboard/app/scripts/common/filters.coffee @@ -132,3 +132,9 @@ angular.module('flinkApp') return_val = value return return_val ] + +.filter "searchMetrics", -> + (availableMetrics, query)-> + queryRegex = new RegExp(query, "gi") + return (metric for metric in availableMetrics when metric.id.match(queryRegex)) + diff --git a/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.ctrl.coffee b/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.ctrl.coffee index d4315ea2499b4b..ebe8e98c4c91ab 100644 --- a/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.ctrl.coffee +++ b/flink-runtime-web/web-dashboard/app/scripts/modules/jobs/jobs.ctrl.coffee @@ -353,13 +353,23 @@ angular.module('flinkApp') $scope.vertex = data MetricsService.getAvailableMetrics($scope.jobid, $scope.nodeid).then (data) -> - $scope.availableMetrics = data + $scope.availableMetrics = data.sort(alphabeticalSortById) $scope.metrics = MetricsService.getMetricsSetup($scope.jobid, $scope.nodeid).names MetricsService.registerObserver($scope.jobid, $scope.nodeid, (data) -> $scope.$broadcast "metrics:data:update", data.timestamp, data.values ) + alphabeticalSortById = (a, b) -> + A = a.id.toLowerCase() + B = b.id.toLowerCase() + if A < B + return -1 + else if A > B + return 1 + else + return 0 + $scope.dropped = (event, index, item, external, type) -> MetricsService.orderMetrics($scope.jobid, $scope.nodeid, item, index) diff --git a/flink-runtime-web/web-dashboard/app/styles/metric.styl b/flink-runtime-web/web-dashboard/app/styles/metric.styl index 94c494838a9bfd..ec0afaf047045b 100644 --- a/flink-runtime-web/web-dashboard/app/styles/metric.styl +++ b/flink-runtime-web/web-dashboard/app/styles/metric.styl @@ -38,9 +38,23 @@ .metric-menu max-height: 300px - max-width: 900px + width: 300px overflow-y: scroll - text-align: right + text-align: left + + .search + label + position: absolute; + top: 15px + left: 22px + input.metrics-filter + height: 30px + padding: 5px 5px 5px 25px + margin: 5px 5px 5px 15px + width: 90% + border-radius: 5px + border: 1px solid #999 + box-shadow: none $metric-row-height = 180px + 85px diff --git a/flink-runtime-web/web-dashboard/web/css/index.css b/flink-runtime-web/web-dashboard/web/css/index.css index db615b1fb00813..64297368deb15f 100644 --- a/flink-runtime-web/web-dashboard/web/css/index.css +++ b/flink-runtime-web/web-dashboard/web/css/index.css @@ -1 +1 @@ -#main,#sidebar,body,html{height:100%}#content,#sidebar{-webkit-transition:.4s;-moz-transition:.4s;-o-transition:.4s;-ms-transition:.4s}.gutter{background-color:transparent;background-repeat:no-repeat;background-position:50%}.gutter-vertical{cursor:row-resize;background-image:url(../images/grips/horizontal.png)}#sidebar{overflow:hidden;position:fixed;left:-250px;top:0;bottom:0;width:250px;background:#151515;transition:.4s;-webkit-box-shadow:inset -10px 0 10px rgba(0,0,0,.2);box-shadow:inset -10px 0 10px rgba(0,0,0,.2)}#sidebar.sidebar-visible{left:0}#sidebar .logo{width:auto;height:22px}#sidebar .logo img{display:inline-block}#sidebar .navbar-static-top{overflow:hidden;height:51px}#sidebar .navbar-static-top .navbar-header{width:100%}#sidebar .navbar-brand.navbar-brand-text{font-size:14px;font-weight:700;color:#fff;padding-left:0}#sidebar .nav>li>a{color:#aaa;margin-bottom:1px}#sidebar .nav>li>a:focus,#sidebar .nav>li>a:hover{background-color:rgba(40,40,40,.5)}#sidebar .nav>li>a.active{background-color:rgba(100,100,100,.5)}#content{background-color:#fff;margin-left:0;padding-top:70px;height:100%;transition:.4s}.table .table,.table.table-inner{background-color:transparent}#content .navbar-main,#content .navbar-main-additional{-webkit-transition:.4s;-moz-transition:.4s;-o-transition:.4s;-ms-transition:.4s;transition:.4s}#content .navbar-main-additional{margin-top:51px;border-bottom:none;padding:0 20px}#content .navbar-main-additional .nav-tabs{margin:0 -20px;padding:0 20px}#content .navbar-secondary-additional{border:none;padding:0 20px;margin-bottom:0}#content .navbar-secondary-additional .nav-tabs{margin:0 -20px}#content.sidebar-visible{margin-left:250px}#content.sidebar-visible .navbar-main,#content.sidebar-visible .navbar-main-additional{left:250px}#content #fold-button{display:inline-block;margin-left:20px}#content #content-inner{padding:0 20px 20px}#content #content-inner.has-navbar-main-additional{padding-top:42px}.table#add-file-table span.btn,.table#job-submit-table td>span.btn{padding:2px 4px;font-size:14px}.page-header{margin:0 0 20px}.nav>li>a,.nav>li>a:focus,.nav>li>a:hover{color:#aaa;background-color:transparent;border-bottom:2px solid transparent}.nav>li.active>a,.nav>li.active>a:focus,.nav>li.active>a:hover{color:#000;border-bottom:2px solid #000}.nav.nav-tabs{margin-bottom:20px}.table th{font-weight:400;color:#999}.table td.td-long{width:20%;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}.table.table-clickable tr{cursor:pointer}.table.table-properties{table-layout:fixed;white-space:nowrap}.table.table-properties td{width:50%;white-space:nowrap;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis}.table.table-body-hover>tbody{border-top:none;border-left:2px solid transparent}.table.table-body-hover>tbody.active{border-left:2px solid #000}.table.table-body-hover>tbody.active td.tab-column li.active,.table.table-body-hover>tbody.active td:not(.tab-column),.table.table-body-hover>tbody:hover td.tab-column li.active,.table.table-body-hover>tbody:hover td:not(.tab-column){background-color:#f0f0f0}.table.table-activable td.tab-column,.table.table-activable th.tab-column{border-top:none;width:47px}.table.table-activable td.tab-column{border-right:1px solid #ddd}.table.table-activable td{position:relative}.table.table-no-border td,.table.table-no-border th{border-top:none!important}.table#job-submit-table{table-layout:fixed;white-space:nowrap}.table#job-submit-table td.td-large{width:40%}.table#job-submit-table td{width:15%}.table#job-submit-table td>input{height:28px;font-size:14px}.table#add-file-table{table-layout:fixed}.table#add-file-table span.btn{position:relative;overflow:hidden;border-radius:2px;margin-top:-3px}.table#add-file-table td#add-file-button{width:100px}.table#add-file-table td#add-file-button input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;opacity:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);outline:0;cursor:inherit;display:block}.timeline-canvas .timeline-insidelabel,.timeline-canvas .timeline-series,svg.graph .node{cursor:pointer}.table#add-file-table td#add-file-name{width:250px;-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.table#add-file-table td#add-file-status{width:100%}.table#add-file-table td#add-file-status span.btn-progress-bar{padding:0!important;width:100%;background-color:#f5f5f5;text-align:left}.table#add-file-table td#add-file-status span.btn-progress{padding:2px;font-size:10px}.table span.error-area{color:red}.table span.row-button{padding:1px 2px;margin:0;border:none!important}.table .small-label{text-transform:uppercase;font-size:13px;color:#999}span.icon-wrapper{width:1.2em;display:inline-block}.panel.panel-dashboard .huge{font-size:28px}.panel.panel-lg{font-size:16px}.panel.panel-lg .badge{font-size:14px}.navbar-secondary{overflow:auto}.navbar-main .navbar-title,.navbar-main .navbar-title-job,.navbar-main .panel-title,.navbar-main-additional .navbar-title,.navbar-main-additional .navbar-title-job,.navbar-main-additional .panel-title,.navbar-secondary .navbar-title,.navbar-secondary .navbar-title-job,.navbar-secondary .panel-title,.navbar-secondary-additional .navbar-title,.navbar-secondary-additional .navbar-title-job,.navbar-secondary-additional .panel-title,.panel.panel-multi .navbar-title,.panel.panel-multi .navbar-title-job,.panel.panel-multi .panel-title{float:left;font-size:18px;padding:12px 20px 13px 10px;color:#333;display:inline-block}.navbar-main .navbar-info,.navbar-main .panel-info,.navbar-main-additional .navbar-info,.navbar-main-additional .panel-info,.navbar-secondary .navbar-info,.navbar-secondary .panel-info,.navbar-secondary-additional .navbar-info,.navbar-secondary-additional .panel-info,.panel.panel-multi .navbar-info,.panel.panel-multi .panel-info{float:left;font-size:14px;padding:15px;color:#999;display:inline-block;border-right:1px solid #e7e7e7;overflow:hidden}.navbar-main .navbar-info .overflow,.navbar-main .panel-info .overflow,.navbar-main-additional .navbar-info .overflow,.navbar-main-additional .panel-info .overflow,.navbar-secondary .navbar-info .overflow,.navbar-secondary .panel-info .overflow,.navbar-secondary-additional .navbar-info .overflow,.navbar-secondary-additional .panel-info .overflow,.panel.panel-multi .navbar-info .overflow,.panel.panel-multi .panel-info .overflow{position:absolute;display:block;-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden;height:22px;line-height:22px;vertical-align:middle}.navbar-main .navbar-info.first,.navbar-main .panel-info.first,.navbar-main-additional .navbar-info.first,.navbar-main-additional .panel-info.first,.navbar-secondary .navbar-info.first,.navbar-secondary .panel-info.first,.navbar-secondary-additional .navbar-info.first,.navbar-secondary-additional .panel-info.first,.panel.panel-multi .navbar-info.first,.panel.panel-multi .panel-info.first{border-left:1px solid #e7e7e7}.navbar-main .navbar-info.last,.navbar-main .panel-info.last,.navbar-main-additional .navbar-info.last,.navbar-main-additional .panel-info.last,.navbar-secondary .navbar-info.last,.navbar-secondary .panel-info.last,.navbar-secondary-additional .navbar-info.last,.navbar-secondary-additional .panel-info.last,.panel.panel-multi .navbar-info.last,.panel.panel-multi .panel-info.last{border-right:none}.panel.panel-multi .panel-heading{padding:0}.panel.panel-multi .panel-heading .panel-info.thin{padding:8px 10px}.panel.panel-multi .panel-body{padding:10px;background-color:#fdfdfd;color:#999;font-size:13px}.panel.panel-multi .panel-body.clean{color:inherit;font-size:inherit}.navbar-main-additional,.navbar-secondary-additional{min-height:40px;background-color:#fdfdfd}.navbar-main-additional .navbar-info,.navbar-secondary-additional .navbar-info{font-size:13px;padding:10px 15px}.nav-top-affix.affix{width:100%;top:50px;margin-left:-20px;padding-left:20px;margin-right:-20px;padding-right:20px;background-color:#fff;z-index:1}.badge-default[href]:focus,.badge-default[href]:hover{background-color:grey}.badge-primary{background-color:#428bca}.badge-primary[href]:focus,.badge-primary[href]:hover{background-color:#3071a9}.badge-success{background-color:#5cb85c}.badge-success[href]:focus,.badge-success[href]:hover{background-color:#449d44}.badge-info{background-color:#5bc0de}.badge-info[href]:focus,.badge-info[href]:hover{background-color:#31b0d5}.badge-warning{background-color:#f0ad4e}.badge-warning[href]:focus,.badge-warning[href]:hover{background-color:#ec971f}.badge-danger{background-color:#d9534f}.badge-danger[href]:focus,.badge-danger[href]:hover{background-color:#c9302c}.indicator{display:inline-block;margin-right:15px}.indicator.indicator-primary{color:#428bca}.indicator.indicator-success{color:#5cb85c}.indicator.indicator-info{color:#5bc0de}.indicator.indicator-warning{color:#f0ad4e}.indicator.indicator-danger{color:#d9534f}pre.exception{border:none;background-color:transparent;padding:0;margin:0}pre{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}.nav-tabs.tabs-vertical{position:absolute;left:0;top:0;border-bottom:none;z-index:100}.nav-tabs.tabs-vertical li{float:none;margin-bottom:0;margin-right:-1px}.nav-tabs.tabs-vertical li>a{margin-right:0;border-radius:0;border-bottom:none;border-left:2px solid transparent}.nav-tabs.tabs-vertical li.active>a,.nav-tabs.tabs-vertical li>a:focus,.nav-tabs.tabs-vertical li>a:hover{border-bottom:none;border-left:2px solid #000}.navbar-main .navbar-title,.navbar-main-additional .navbar-title,.navbar-secondary .navbar-title,.navbar-secondary-additional .navbar-title{padding:12px 20px 13px}.navbar-main .navbar-title-job{padding:8px 20px}.navbar-main .navbar-title-job .indicator-primary{padding:8px 0 0}.navbar-main .navbar-title-job .no-padding{padding:0}.navbar-main .navbar-title-job .no-margin{margin:0}.navbar-main .navbar-title-job .job-name{font-size:14px}.navbar-main .navbar-title-job .job-id{color:#999;font-size:11px}.checkpoint-overview a,svg.graph .node h4{color:#000}livechart{width:30%;height:30%;text-align:center}.canvas-wrapper{border:1px solid #ddd;position:relative;margin-bottom:20px;height:100%}.canvas-wrapper .main-canvas{height:100%;overflow:hidden}.canvas-wrapper .main-canvas .zoom-buttons{position:absolute;top:10px;right:10px}.label-group .label{display:inline-block;padding-left:.4em;padding-right:.4em;margin:0;border-right:1px solid #fff;border-radius:0}.label-group .label.label-black{background-color:#000}.navbar-info-button{padding:3px 4px;font-size:12px;font-family:inherit;margin-top:-2px}svg.graph .edge-label,svg.graph text{font-size:14px}.checkpoints-view{padding-top:1em}.subtask-details .blank{height:2em}.checkpoint-overview td span{padding-left:2em}svg.graph{overflow:hidden;height:100%;width:100%!important}svg.graph g.type-TK>rect{fill:#00ffd0}svg.graph text{font-weight:300}svg.graph .node>rect{stroke:#999;stroke-width:5px;fill:#fff;margin:0;padding:0}svg.graph .node[active]>rect{fill:#eee}svg.graph .node.node-mirror>rect{stroke:#a8a8a8}svg.graph .node.node-iteration>rect{stroke:#cd3333}svg.graph .node.node-source>rect{stroke:#4ce199}svg.graph .node.node-sink>rect{stroke:#e6ec8b}svg.graph .node.node-normal>rect{stroke:#3fb6d8}svg.graph .node h5{color:#999}svg.graph .edgeLabel rect{fill:#fff}svg.graph .edgePath path{stroke:#333;stroke-width:2px;fill:#333}svg.graph .label{color:#777;margin:0}svg.graph .node-label{display:block;margin:0;text-decoration:none}.timeline{overflow:hidden}.timeline-canvas{overflow:hidden;padding:10px}.timeline-canvas .bar-container{overflow:hidden}.timeline-canvas.secondary .timeline-insidelabel,.timeline-canvas.secondary .timeline-series{cursor:auto}#content .navbar-secondary-additional.navbar-secondary-additional-2 .add-metrics a,.show-pointer{cursor:pointer}.qtip-timeline-bar{font-size:14px;line-height:1.4}#content .navbar-secondary-additional.navbar-secondary-additional-2{margin:-10px -10px 10px;padding:0;border-bottom:1px solid #e4e4e4}#content .navbar-secondary-additional.navbar-secondary-additional-2 .navbar-info{padding-top:12px;padding-bottom:12px}#content .navbar-secondary-additional.navbar-secondary-additional-2 .add-metrics{margin-right:15px;float:right}#content .navbar-secondary-additional.navbar-secondary-additional-2 .add-metrics .btn{margin-top:5px;margin-bottom:5px}#content .navbar-secondary-additional.navbar-secondary-additional-2 .metric-menu{max-height:300px;max-width:900px;overflow-y:scroll;text-align:right}.metric-row{margin:0;min-height:275px;padding:0;list-style-type:none}.metric-row .metric-col{background-color:transparent;width:33.33%;float:left}.metric-row .metric-col.big{width:100%}.metric-row .metric-col .panel{margin-left:5px;margin-right:5px;min-height:265px;margin-bottom:10px}.metric-row .metric-col .panel .panel-body{background-color:transparent;height:265px;position:relative}.metric-row .metric-col .panel .panel-body .metric-numeric{text-align:center;margin-top:75px;font-size:40px;font-weight:700}.metric-row .metric-col .panel .panel-heading{padding:0 10px;background-color:transparent;height:41px;line-height:41px;position:relative;overflow:hidden;cursor:pointer}.metric-row .metric-col .panel .panel-heading .metric-title{padding:10px 0}.metric-row .metric-col .panel .panel-heading .buttons{position:absolute;top:0;right:0;padding:0 10px;background-color:#fff}.metric-row .metric-col.dndDraggingSource{display:none}.metric-row .dndPlaceholder{position:relative;background-color:#f0f0f0;min-height:305px;display:block;width:33.33%;float:left;margin-bottom:10px;border-radius:5px}.p-info{padding-left:5px;padding-right:5px}@media (min-width:1024px) and (max-width:1279px){#content #fold-button,#sidebar .navbar-static-top .navbar-brand-text{display:none}#sidebar{left:0;width:160px}#content{margin-left:160px}#content .navbar-main,#content .navbar-main-additional{left:160px}.table td.td-long{width:20%}}@media (min-width:1280px){#sidebar{left:0}#content{margin-left:250px}#content #fold-button{display:none}#content .navbar-main,#content .navbar-main-additional{left:250px}.table td.td-long{width:30%}}.legend-box{font-size:10px;width:2em}#total-mem{background-color:#7cb5ec}#heap-mem{background-color:#434348}#non-heap-mem{background-color:#90ed7d}#fetch-plan,#job-submit{width:100px}#content-inner,#details,#node-details{height:100%}#job-panel{overflow-y:auto} \ No newline at end of file +#main,#sidebar,body,html{height:100%}#content,#sidebar{-webkit-transition:.4s;-moz-transition:.4s;-o-transition:.4s;-ms-transition:.4s}.gutter{background-color:transparent;background-repeat:no-repeat;background-position:50%}.gutter-vertical{cursor:row-resize;background-image:url(../images/grips/horizontal.png)}#sidebar{overflow:hidden;position:fixed;left:-250px;top:0;bottom:0;width:250px;background:#151515;transition:.4s;-webkit-box-shadow:inset -10px 0 10px rgba(0,0,0,.2);box-shadow:inset -10px 0 10px rgba(0,0,0,.2)}#sidebar.sidebar-visible{left:0}#sidebar .logo{width:auto;height:22px}#sidebar .logo img{display:inline-block}#sidebar .navbar-static-top{overflow:hidden;height:51px}#sidebar .navbar-static-top .navbar-header{width:100%}#sidebar .navbar-brand.navbar-brand-text{font-size:14px;font-weight:700;color:#fff;padding-left:0}#sidebar .nav>li>a{color:#aaa;margin-bottom:1px}#sidebar .nav>li>a:focus,#sidebar .nav>li>a:hover{background-color:rgba(40,40,40,.5)}#sidebar .nav>li>a.active{background-color:rgba(100,100,100,.5)}#content{background-color:#fff;margin-left:0;padding-top:70px;height:100%;transition:.4s}.table .table,.table.table-inner{background-color:transparent}#content .navbar-main,#content .navbar-main-additional{-webkit-transition:.4s;-moz-transition:.4s;-o-transition:.4s;-ms-transition:.4s;transition:.4s}#content .navbar-main-additional{margin-top:51px;border-bottom:none;padding:0 20px}#content .navbar-main-additional .nav-tabs{margin:0 -20px;padding:0 20px}#content .navbar-secondary-additional{border:none;padding:0 20px;margin-bottom:0}#content .navbar-secondary-additional .nav-tabs{margin:0 -20px}#content.sidebar-visible{margin-left:250px}#content.sidebar-visible .navbar-main,#content.sidebar-visible .navbar-main-additional{left:250px}#content #fold-button{display:inline-block;margin-left:20px}#content #content-inner{padding:0 20px 20px}#content #content-inner.has-navbar-main-additional{padding-top:42px}.table#add-file-table span.btn,.table#job-submit-table td>span.btn{padding:2px 4px;font-size:14px}.page-header{margin:0 0 20px}.nav>li>a,.nav>li>a:focus,.nav>li>a:hover{color:#aaa;background-color:transparent;border-bottom:2px solid transparent}.nav>li.active>a,.nav>li.active>a:focus,.nav>li.active>a:hover{color:#000;border-bottom:2px solid #000}.nav.nav-tabs{margin-bottom:20px}.table th{font-weight:400;color:#999}.table td.td-long{width:20%;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}.table.table-clickable tr{cursor:pointer}.table.table-properties{table-layout:fixed;white-space:nowrap}.table.table-properties td{width:50%;white-space:nowrap;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis}.table.table-body-hover>tbody{border-top:none;border-left:2px solid transparent}.table.table-body-hover>tbody.active{border-left:2px solid #000}.table.table-body-hover>tbody.active td.tab-column li.active,.table.table-body-hover>tbody.active td:not(.tab-column),.table.table-body-hover>tbody:hover td.tab-column li.active,.table.table-body-hover>tbody:hover td:not(.tab-column){background-color:#f0f0f0}.table.table-activable td.tab-column,.table.table-activable th.tab-column{border-top:none;width:47px}.table.table-activable td.tab-column{border-right:1px solid #ddd}.table.table-activable td{position:relative}.table.table-no-border td,.table.table-no-border th{border-top:none!important}.table#job-submit-table{table-layout:fixed;white-space:nowrap}.table#job-submit-table td.td-large{width:40%}.table#job-submit-table td{width:15%}.table#job-submit-table td>input{height:28px;font-size:14px}.table#add-file-table{table-layout:fixed}.table#add-file-table span.btn{position:relative;overflow:hidden;border-radius:2px;margin-top:-3px}.table#add-file-table td#add-file-button{width:100px}.table#add-file-table td#add-file-button input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;opacity:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);outline:0;cursor:inherit;display:block}.timeline-canvas .timeline-insidelabel,.timeline-canvas .timeline-series,svg.graph .node{cursor:pointer}.table#add-file-table td#add-file-name{width:250px;-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.table#add-file-table td#add-file-status{width:100%}.table#add-file-table td#add-file-status span.btn-progress-bar{padding:0!important;width:100%;background-color:#f5f5f5;text-align:left}.table#add-file-table td#add-file-status span.btn-progress{padding:2px;font-size:10px}.table span.error-area{color:red}.table span.row-button{padding:1px 2px;margin:0;border:none!important}.table .small-label{text-transform:uppercase;font-size:13px;color:#999}span.icon-wrapper{width:1.2em;display:inline-block}.panel.panel-dashboard .huge{font-size:28px}.panel.panel-lg{font-size:16px}.panel.panel-lg .badge{font-size:14px}.navbar-secondary{overflow:auto}.navbar-main .navbar-title,.navbar-main .navbar-title-job,.navbar-main .panel-title,.navbar-main-additional .navbar-title,.navbar-main-additional .navbar-title-job,.navbar-main-additional .panel-title,.navbar-secondary .navbar-title,.navbar-secondary .navbar-title-job,.navbar-secondary .panel-title,.navbar-secondary-additional .navbar-title,.navbar-secondary-additional .navbar-title-job,.navbar-secondary-additional .panel-title,.panel.panel-multi .navbar-title,.panel.panel-multi .navbar-title-job,.panel.panel-multi .panel-title{float:left;font-size:18px;padding:12px 20px 13px 10px;color:#333;display:inline-block}.navbar-main .navbar-info,.navbar-main .panel-info,.navbar-main-additional .navbar-info,.navbar-main-additional .panel-info,.navbar-secondary .navbar-info,.navbar-secondary .panel-info,.navbar-secondary-additional .navbar-info,.navbar-secondary-additional .panel-info,.panel.panel-multi .navbar-info,.panel.panel-multi .panel-info{float:left;font-size:14px;padding:15px;color:#999;display:inline-block;border-right:1px solid #e7e7e7;overflow:hidden}.navbar-main .navbar-info .overflow,.navbar-main .panel-info .overflow,.navbar-main-additional .navbar-info .overflow,.navbar-main-additional .panel-info .overflow,.navbar-secondary .navbar-info .overflow,.navbar-secondary .panel-info .overflow,.navbar-secondary-additional .navbar-info .overflow,.navbar-secondary-additional .panel-info .overflow,.panel.panel-multi .navbar-info .overflow,.panel.panel-multi .panel-info .overflow{position:absolute;display:block;-o-text-overflow:ellipsis;text-overflow:ellipsis;overflow:hidden;height:22px;line-height:22px;vertical-align:middle}.navbar-main .navbar-info.first,.navbar-main .panel-info.first,.navbar-main-additional .navbar-info.first,.navbar-main-additional .panel-info.first,.navbar-secondary .navbar-info.first,.navbar-secondary .panel-info.first,.navbar-secondary-additional .navbar-info.first,.navbar-secondary-additional .panel-info.first,.panel.panel-multi .navbar-info.first,.panel.panel-multi .panel-info.first{border-left:1px solid #e7e7e7}.navbar-main .navbar-info.last,.navbar-main .panel-info.last,.navbar-main-additional .navbar-info.last,.navbar-main-additional .panel-info.last,.navbar-secondary .navbar-info.last,.navbar-secondary .panel-info.last,.navbar-secondary-additional .navbar-info.last,.navbar-secondary-additional .panel-info.last,.panel.panel-multi .navbar-info.last,.panel.panel-multi .panel-info.last{border-right:none}.panel.panel-multi .panel-heading{padding:0}.panel.panel-multi .panel-heading .panel-info.thin{padding:8px 10px}.panel.panel-multi .panel-body{padding:10px;background-color:#fdfdfd;color:#999;font-size:13px}.panel.panel-multi .panel-body.clean{color:inherit;font-size:inherit}.navbar-main-additional,.navbar-secondary-additional{min-height:40px;background-color:#fdfdfd}.navbar-main-additional .navbar-info,.navbar-secondary-additional .navbar-info{font-size:13px;padding:10px 15px}.nav-top-affix.affix{width:100%;top:50px;margin-left:-20px;padding-left:20px;margin-right:-20px;padding-right:20px;background-color:#fff;z-index:1}.badge-default[href]:focus,.badge-default[href]:hover{background-color:grey}.badge-primary{background-color:#428bca}.badge-primary[href]:focus,.badge-primary[href]:hover{background-color:#3071a9}.badge-success{background-color:#5cb85c}.badge-success[href]:focus,.badge-success[href]:hover{background-color:#449d44}.badge-info{background-color:#5bc0de}.badge-info[href]:focus,.badge-info[href]:hover{background-color:#31b0d5}.badge-warning{background-color:#f0ad4e}.badge-warning[href]:focus,.badge-warning[href]:hover{background-color:#ec971f}.badge-danger{background-color:#d9534f}.badge-danger[href]:focus,.badge-danger[href]:hover{background-color:#c9302c}.indicator{display:inline-block;margin-right:15px}.indicator.indicator-primary{color:#428bca}.indicator.indicator-success{color:#5cb85c}.indicator.indicator-info{color:#5bc0de}.indicator.indicator-warning{color:#f0ad4e}.indicator.indicator-danger{color:#d9534f}pre.exception{border:none;background-color:transparent;padding:0;margin:0}pre{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}.nav-tabs.tabs-vertical{position:absolute;left:0;top:0;border-bottom:none;z-index:100}.nav-tabs.tabs-vertical li{float:none;margin-bottom:0;margin-right:-1px}.nav-tabs.tabs-vertical li>a{margin-right:0;border-radius:0;border-bottom:none;border-left:2px solid transparent}.nav-tabs.tabs-vertical li.active>a,.nav-tabs.tabs-vertical li>a:focus,.nav-tabs.tabs-vertical li>a:hover{border-bottom:none;border-left:2px solid #000}.navbar-main .navbar-title,.navbar-main-additional .navbar-title,.navbar-secondary .navbar-title,.navbar-secondary-additional .navbar-title{padding:12px 20px 13px}.navbar-main .navbar-title-job{padding:8px 20px}.navbar-main .navbar-title-job .indicator-primary{padding:8px 0 0}.navbar-main .navbar-title-job .no-padding{padding:0}.navbar-main .navbar-title-job .no-margin{margin:0}.navbar-main .navbar-title-job .job-name{font-size:14px}.navbar-main .navbar-title-job .job-id{color:#999;font-size:11px}.checkpoint-overview a,svg.graph .node h4{color:#000}livechart{width:30%;height:30%;text-align:center}.canvas-wrapper{border:1px solid #ddd;position:relative;margin-bottom:20px;height:100%}.canvas-wrapper .main-canvas{height:100%;overflow:hidden}.canvas-wrapper .main-canvas .zoom-buttons{position:absolute;top:10px;right:10px}.label-group .label{display:inline-block;padding-left:.4em;padding-right:.4em;margin:0;border-right:1px solid #fff;border-radius:0}.label-group .label.label-black{background-color:#000}.navbar-info-button{padding:3px 4px;font-size:12px;font-family:inherit;margin-top:-2px}svg.graph .edge-label,svg.graph text{font-size:14px}.checkpoints-view{padding-top:1em}.subtask-details .blank{height:2em}.checkpoint-overview td span{padding-left:2em}svg.graph{overflow:hidden;height:100%;width:100%!important}svg.graph g.type-TK>rect{fill:#00ffd0}svg.graph text{font-weight:300}svg.graph .node>rect{stroke:#999;stroke-width:5px;fill:#fff;margin:0;padding:0}svg.graph .node[active]>rect{fill:#eee}svg.graph .node.node-mirror>rect{stroke:#a8a8a8}svg.graph .node.node-iteration>rect{stroke:#cd3333}svg.graph .node.node-source>rect{stroke:#4ce199}svg.graph .node.node-sink>rect{stroke:#e6ec8b}svg.graph .node.node-normal>rect{stroke:#3fb6d8}svg.graph .node h5{color:#999}svg.graph .edgeLabel rect{fill:#fff}svg.graph .edgePath path{stroke:#333;stroke-width:2px;fill:#333}svg.graph .label{color:#777;margin:0}svg.graph .node-label{display:block;margin:0;text-decoration:none}.timeline{overflow:hidden}.timeline-canvas{overflow:hidden;padding:10px}.timeline-canvas .bar-container{overflow:hidden}.timeline-canvas.secondary .timeline-insidelabel,.timeline-canvas.secondary .timeline-series{cursor:auto}#content .navbar-secondary-additional.navbar-secondary-additional-2 .add-metrics a,.show-pointer{cursor:pointer}.qtip-timeline-bar{font-size:14px;line-height:1.4}#content .navbar-secondary-additional.navbar-secondary-additional-2{margin:-10px -10px 10px;padding:0;border-bottom:1px solid #e4e4e4}#content .navbar-secondary-additional.navbar-secondary-additional-2 .navbar-info{padding-top:12px;padding-bottom:12px}#content .navbar-secondary-additional.navbar-secondary-additional-2 .add-metrics{margin-right:15px;float:right}#content .navbar-secondary-additional.navbar-secondary-additional-2 .add-metrics .btn{margin-top:5px;margin-bottom:5px}#content .navbar-secondary-additional.navbar-secondary-additional-2 .metric-menu{max-height:300px;width:300px;overflow-y:scroll;text-align:left}#content .search label{position:absolute;top:15px;left:22px}#content .search input.metrics-filter{height:30px;padding:5px 5px 5px 25px;margin:5px 5px 5px 15px;width:90%;border-radius:5px;border:1px solid #999;-webkit-box-shadow:none;box-shadow:none}.metric-row{margin:0;min-height:275px;padding:0;list-style-type:none}.metric-row .metric-col{background-color:transparent;width:33.33%;float:left}.metric-row .metric-col.big{width:100%}.metric-row .metric-col .panel{margin-left:5px;margin-right:5px;min-height:265px;margin-bottom:10px}.metric-row .metric-col .panel .panel-body{background-color:transparent;height:265px;position:relative}.metric-row .metric-col .panel .panel-body .metric-numeric{text-align:center;margin-top:75px;font-size:40px;font-weight:700}.metric-row .metric-col .panel .panel-heading{padding:0 10px;background-color:transparent;height:41px;line-height:41px;position:relative;overflow:hidden;cursor:pointer}.metric-row .metric-col .panel .panel-heading .metric-title{padding:10px 0}.metric-row .metric-col .panel .panel-heading .buttons{position:absolute;top:0;right:0;padding:0 10px;background-color:#fff}.metric-row .metric-col.dndDraggingSource{display:none}.metric-row .dndPlaceholder{position:relative;background-color:#f0f0f0;min-height:305px;display:block;width:33.33%;float:left;margin-bottom:10px;border-radius:5px}.p-info{padding-left:5px;padding-right:5px}@media (min-width:1024px) and (max-width:1279px){#content #fold-button,#sidebar .navbar-static-top .navbar-brand-text{display:none}#sidebar{left:0;width:160px}#content{margin-left:160px}#content .navbar-main,#content .navbar-main-additional{left:160px}.table td.td-long{width:20%}}@media (min-width:1280px){#sidebar{left:0}#content{margin-left:250px}#content #fold-button{display:none}#content .navbar-main,#content .navbar-main-additional{left:250px}.table td.td-long{width:30%}}.legend-box{font-size:10px;width:2em}#total-mem{background-color:#7cb5ec}#heap-mem{background-color:#434348}#non-heap-mem{background-color:#90ed7d}#fetch-plan,#job-submit{width:100px}#content-inner,#details,#node-details{height:100%}#job-panel{overflow-y:auto} \ No newline at end of file diff --git a/flink-runtime-web/web-dashboard/web/js/hs/index.js b/flink-runtime-web/web-dashboard/web/js/hs/index.js index 766120610c899f..6354dd0a20939b 100644 --- a/flink-runtime-web/web-dashboard/web/js/hs/index.js +++ b/flink-runtime-web/web-dashboard/web/js/hs/index.js @@ -1,2 +1,2 @@ -angular.module("flinkApp",["ui.router","angularMoment","dndLists"]).run(["$rootScope",function(e){return e.sidebarVisible=!1,e.showSidebar=function(){return e.sidebarVisible=!e.sidebarVisible,e.sidebarClass="force-show"}}]).value("flinkConfig",{jobServer:"","refresh-interval":1e4}).value("watermarksConfig",{noWatermark:-0x8000000000000000}).run(["JobsService","MainService","flinkConfig","$interval",function(e,t,r,n){return t.loadConfig().then(function(t){return angular.extend(r,t),e.listJobs(),n(function(){return e.listJobs()},r["refresh-interval"])})}]).config(["$uiViewScrollProvider",function(e){return e.useAnchorScroll()}]).run(["$rootScope","$state",function(e,t){return e.$on("$stateChangeStart",function(e,r,n,i){if(r.redirectTo)return e.preventDefault(),t.go(r.redirectTo,n)})}]).config(["$stateProvider","$urlRouterProvider",function(e,t){return e.state("completed-jobs",{url:"/completed-jobs",views:{main:{templateUrl:"partials/jobs/completed-jobs.html",controller:"CompletedJobsController"}}}).state("single-job",{url:"/jobs/{jobid}","abstract":!0,views:{main:{templateUrl:"partials/jobs/job.html",controller:"SingleJobController"}}}).state("single-job.plan",{url:"",redirectTo:"single-job.plan.subtasks",views:{details:{templateUrl:"partials/jobs/job.plan.html",controller:"JobPlanController"}}}).state("single-job.plan.subtasks",{url:"",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.subtasks.html",controller:"JobPlanSubtasksController"}}}).state("single-job.plan.metrics",{url:"/metrics",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.metrics.html",controller:"JobPlanMetricsController"}}}).state("single-job.plan.watermarks",{url:"/watermarks",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.watermarks.html"}}}).state("single-job.plan.taskmanagers",{url:"/taskmanagers",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.taskmanagers.html",controller:"JobPlanTaskManagersController"}}}).state("single-job.plan.accumulators",{url:"/accumulators",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.accumulators.html",controller:"JobPlanAccumulatorsController"}}}).state("single-job.plan.checkpoints",{url:"/checkpoints",redirectTo:"single-job.plan.checkpoints.overview",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.checkpoints.html",controller:"JobPlanCheckpointsController"}}}).state("single-job.plan.checkpoints.overview",{url:"/overview",views:{"checkpoints-view":{templateUrl:"partials/jobs/job.plan.node.checkpoints.overview.html",controller:"JobPlanCheckpointsController"}}}).state("single-job.plan.checkpoints.summary",{url:"/summary",views:{"checkpoints-view":{templateUrl:"partials/jobs/job.plan.node.checkpoints.summary.html",controller:"JobPlanCheckpointsController"}}}).state("single-job.plan.checkpoints.history",{url:"/history",views:{"checkpoints-view":{templateUrl:"partials/jobs/job.plan.node.checkpoints.history.html",controller:"JobPlanCheckpointsController"}}}).state("single-job.plan.checkpoints.config",{url:"/config",views:{"checkpoints-view":{templateUrl:"partials/jobs/job.plan.node.checkpoints.config.html",controller:"JobPlanCheckpointsController"}}}).state("single-job.plan.checkpoints.details",{url:"/details/{checkpointId}",views:{"checkpoints-view":{templateUrl:"partials/jobs/job.plan.node.checkpoints.details.html",controller:"JobPlanCheckpointDetailsController"}}}).state("single-job.plan.backpressure",{url:"/backpressure",views:{"node-details":{templateUrl:"partials/jobs/job.plan.node-list.backpressure.html",controller:"JobPlanBackPressureController"}}}).state("single-job.timeline",{url:"/timeline",views:{details:{templateUrl:"partials/jobs/job.timeline.html"}}}).state("single-job.timeline.vertex",{url:"/{vertexId}",views:{vertex:{templateUrl:"partials/jobs/job.timeline.vertex.html",controller:"JobTimelineVertexController"}}}).state("single-job.exceptions",{url:"/exceptions",views:{details:{templateUrl:"partials/jobs/job.exceptions.html",controller:"JobExceptionsController"}}}).state("single-job.config",{url:"/config",views:{details:{templateUrl:"partials/jobs/job.config.html"}}}),t.otherwise("/completed-jobs")}]),angular.module("flinkApp").directive("bsLabel",["JobsService",function(e){return{transclude:!0,replace:!0,scope:{getLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getLabelClass=function(){return"label label-"+e.translateLabelState(n.status)}}}}]).directive("bpLabel",["JobsService",function(e){return{transclude:!0,replace:!0,scope:{getBackPressureLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getBackPressureLabelClass=function(){return"label label-"+e.translateBackPressureLabelState(n.status)}}}}]).directive("indicatorPrimary",["JobsService",function(e){return{replace:!0,scope:{getLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getLabelClass=function(){return"fa fa-circle indicator indicator-"+e.translateLabelState(n.status)}}}}]).directive("tableProperty",function(){return{replace:!0,scope:{value:"="},template:"{{value || 'None'}}"}}),angular.module("flinkApp").filter("amDurationFormatExtended",["angularMomentConfig",function(e){var t;return t=function(e,t,r){return"undefined"==typeof e||null===e?"":moment.duration(e,t).format(r,{trim:!1})},t.$stateful=e.statefulFilters,t}]).filter("humanizeDuration",function(){return function(e,t){var r,n,i,o,s,a;return"undefined"==typeof e||null===e?"":(o=e%1e3,a=Math.floor(e/1e3),s=a%60,a=Math.floor(a/60),i=a%60,a=Math.floor(a/60),n=a%24,a=Math.floor(a/24),r=a,0===r?0===n?0===i?0===s?o+"ms":s+"s ":i+"m "+s+"s":t?n+"h "+i+"m":n+"h "+i+"m "+s+"s":t?r+"d "+n+"h":r+"d "+n+"h "+i+"m "+s+"s")}}).filter("limit",function(){return function(e){return e.length>73&&(e=e.substring(0,35)+"..."+e.substring(e.length-35,e.length)),e}}).filter("humanizeText",function(){return function(e){return e?e.replace(/>/g,">").replace(//g,""):""}}).filter("humanizeBytes",function(){return function(e){var t,r;return r=["B","KB","MB","GB","TB","PB","EB"],t=function(e,n){var i;return i=Math.pow(1024,n),e=r;n=0<=r?++e:--e)i.push(n+".currentLowWatermark");return i}(),i.getMetrics(o,t.id,s).then(function(e){var t,n,i,o,s,a,l;i=NaN,l={},o=e.values;for(t in o)a=o[t],s=t.replace(".currentLowWatermark",""),l[s]=a,(isNaN(i)||au.noWatermark?i:NaN,r.resolve({lowWatermark:n,watermarks:l})}),r.promise}}(this),r=l.defer(),s={},n=t.length,angular.forEach(t,function(e){return function(e,t){var i;return i=e.id,o(e).then(function(e){if(s[i]=e,t>=n-1)return r.resolve(s)})}}(this)),r.promise},e.hasWatermark=function(t){return e.watermarks[t]&&!isNaN(e.watermarks[t].lowWatermark)},e.$watch("plan",function(t){if(t)return c(t.nodes).then(function(t){return e.watermarks=t})}),e.$on("reload",function(){if(e.plan)return c(e.plan.nodes).then(function(t){return e.watermarks=t})})}]).controller("JobPlanController",["$scope","$state","$stateParams","$window","JobsService",function(e,t,r,n,i){return e.nodeid=null,e.nodeUnfolded=!1,e.stateList=i.stateList(),e.changeNode=function(t){return t!==e.nodeid?(e.nodeid=t,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null,e.$broadcast("reload"),e.$broadcast("node:change",e.nodeid)):(e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null)},e.deactivateNode=function(){return e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null},e.toggleFold=function(){return e.nodeUnfolded=!e.nodeUnfolded}}]).controller("JobPlanSubtasksController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getSubtasks(e.nodeid).then(function(t){return e.subtasks=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanTaskManagersController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getTaskManagers(e.nodeid).then(function(t){return e.taskmanagers=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanAccumulatorsController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getAccumulators(e.nodeid).then(function(t){return e.accumulators=t.main,e.subtaskAccumulators=t.subtasks})},!e.nodeid||e.vertex&&e.vertex.accumulators||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanCheckpointsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i;return e.checkpointDetails={},e.checkpointDetails.id=-1,n.getCheckpointConfig().then(function(t){return e.checkpointConfig=t}),i=function(){return n.getCheckpointStats().then(function(t){if(null!==t)return e.checkpointStats=t})},i(),e.$on("reload",function(e){return i()})}]).controller("JobPlanCheckpointDetailsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i,o;return e.subtaskDetails={},e.checkpointDetails.id=r.checkpointId,i=function(t){return n.getCheckpointDetails(t).then(function(t){return null!==t?e.checkpoint=t:e.unknown_checkpoint=!0})},o=function(t,r){return n.getCheckpointSubtaskDetails(t,r).then(function(t){if(null!==t)return e.subtaskDetails[r]=t})},i(r.checkpointId),e.nodeid&&o(r.checkpointId,e.nodeid),e.$on("reload",function(t){if(i(r.checkpointId),e.nodeid)return o(r.checkpointId,e.nodeid)}),e.$on("$destroy",function(){return e.checkpointDetails.id=-1})}]).controller("JobPlanBackPressureController",["$scope","JobsService",function(e,t){var r;return r=function(){if(e.now=Date.now(),e.nodeid)return t.getOperatorBackPressure(e.nodeid).then(function(t){return e.backPressureOperatorStats[e.nodeid]=t})},r(),e.$on("reload",function(e){return r()})}]).controller("JobTimelineVertexController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i;return i=function(){return n.getVertex(r.vertexId).then(function(t){return e.vertex=t})},i(),e.$on("reload",function(e){return i()})}]).controller("JobExceptionsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){return n.loadExceptions().then(function(t){return e.exceptions=t})}]).controller("JobPropertiesController",["$scope","JobsService",function(e,t){return e.changeNode=function(r){return r!==e.nodeid?(e.nodeid=r,t.getNode(r).then(function(t){return e.node=t})):(e.nodeid=null,e.node=null)}}]).controller("JobPlanMetricsController",["$scope","JobsService","MetricsService",function(e,t,r){var n;if(e.dragging=!1,e.window=r.getWindow(),e.availableMetrics=null,e.$on("$destroy",function(){return r.unRegisterObserver()}),n=function(){return t.getVertex(e.nodeid).then(function(t){return e.vertex=t}),r.getAvailableMetrics(e.jobid,e.nodeid).then(function(t){return e.availableMetrics=t,e.metrics=r.getMetricsSetup(e.jobid,e.nodeid).names,r.registerObserver(e.jobid,e.nodeid,function(t){return e.$broadcast("metrics:data:update",t.timestamp,t.values)})})},e.dropped=function(t,i,o,s,a){return r.orderMetrics(e.jobid,e.nodeid,o,i),e.$broadcast("metrics:refresh",o),n(),!1},e.dragStart=function(){return e.dragging=!0},e.dragEnd=function(){return e.dragging=!1},e.addMetric=function(t){return r.addMetric(e.jobid,e.nodeid,t.id),n()},e.removeMetric=function(t){return r.removeMetric(e.jobid,e.nodeid,t),n()},e.setMetricSize=function(t,i){return r.setMetricSize(e.jobid,e.nodeid,t,i),n()},e.setMetricView=function(t,i){return r.setMetricView(e.jobid,e.nodeid,t,i),n()},e.getValues=function(t){return r.getValues(e.jobid,e.nodeid,t)},e.$on("node:change",function(t,r){if(!e.dragging)return n()}),e.nodeid)return n()}]),angular.module("flinkApp").directive("vertex",["$state",function(e){return{template:"",scope:{data:"="},link:function(e,t,r){var n,i,o;o=t.children()[0],i=t.width(),angular.element(o).attr("width",i),(n=function(e){var t,r,n;return d3.select(o).selectAll("*").remove(),n=[],angular.forEach(e.subtasks,function(e,t){var r;return r=[{label:"Scheduled",color:"#666",borderColor:"#555",starting_time:e.timestamps.SCHEDULED,ending_time:e.timestamps.DEPLOYING,type:"regular"},{label:"Deploying",color:"#aaa",borderColor:"#555",starting_time:e.timestamps.DEPLOYING,ending_time:e.timestamps.RUNNING,type:"regular"}],e.timestamps.FINISHED>0&&r.push({label:"Running",color:"#ddd",borderColor:"#555",starting_time:e.timestamps.RUNNING,ending_time:e.timestamps.FINISHED,type:"regular"}),n.push({label:"("+e.subtask+") "+e.host,times:r})}),t=d3.timeline().stack().tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("single").labelFormat(function(e){return e}).margin({left:100,right:0,top:0,bottom:0}).itemHeight(30).relativeTime(),r=d3.select(o).datum(n).call(t)})(e.data)}}}]).directive("timeline",["$state",function(e){return{template:"",scope:{vertices:"=",jobid:"="},link:function(t,r,n){var i,o,s,a;s=r.children()[0],o=r.width(),angular.element(s).attr("width",o),a=function(e){return e.replace(">",">")},i=function(r){var n,i,o;return d3.select(s).selectAll("*").remove(),o=[],angular.forEach(r,function(e){if(e["start-time"]>-1)return"scheduled"===e.type?o.push({times:[{label:a(e.name),color:"#cccccc",borderColor:"#555555",starting_time:e["start-time"],ending_time:e["end-time"],type:e.type}]}):o.push({times:[{label:a(e.name),color:"#d9f1f7",borderColor:"#62cdea",starting_time:e["start-time"],ending_time:e["end-time"],link:e.id,type:e.type}]})}),n=d3.timeline().stack().click(function(r,n,i){if(r.link)return e.go("single-job.timeline.vertex",{jobid:t.jobid,vertexId:r.link})}).tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("main").margin({left:0,right:0,top:0,bottom:0}).itemHeight(30).showBorderLine().showHourTimeline(),i=d3.select(s).datum(o).call(n)},t.$watch(n.vertices,function(e){if(e)return i(e)})}}}]).directive("split",function(){return{compile:function(e,t){return Split(e.children(),{sizes:[50,50],direction:"vertical"})}}}).directive("jobPlan",["$timeout",function(e){return{template:" ",scope:{plan:"=",watermarks:"=",setNode:"&"},link:function(e,t,r){var n,i,o,s,a,l,u,c,d,f,p,m,h,g,b,v,k,j,S,w,C,$,y,J,M;p=null,C=d3.behavior.zoom(),M=[],g=r.jobid,S=t.children()[0],j=t.children().children()[0],w=t.children()[1],l=d3.select(S),u=d3.select(j),c=d3.select(w),n=t.width(),angular.element(t.children()[0]).width(n),v=0,b=0,e.zoomIn=function(){var e,t,r;if(C.scale()<2.99)return e=C.translate(),t=e[0]*(C.scale()+.1/C.scale()),r=e[1]*(C.scale()+.1/C.scale()),C.scale(C.scale()+.1),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},e.zoomOut=function(){var e,t,r;if(C.scale()>.31)return C.scale(C.scale()-.1),e=C.translate(),t=e[0]*(C.scale()-.1/C.scale()),r=e[1]*(C.scale()-.1/C.scale()),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},o=function(e){var t;return t="",null==e.ship_strategy&&null==e.local_strategy||(t+="
",null!=e.ship_strategy&&(t+=e.ship_strategy),void 0!==e.temp_mode&&(t+=" ("+e.temp_mode+")"),void 0!==e.local_strategy&&(t+=",
"+e.local_strategy),t+="
"),t},h=function(e){return"partialSolution"===e||"nextPartialSolution"===e||"workset"===e||"nextWorkset"===e||"solutionSet"===e||"solutionDelta"===e},m=function(e,t){return"mirror"===t?"node-mirror":h(t)?"node-iteration":"node-normal"},s=function(e,t,r,n){var i,o;return i="
",i+="mirror"===t?"

Mirror of "+e.operator+"

":"

"+e.operator+"

",""===e.description?i+="":(o=e.description,o=J(o),i+="

"+o+"

"),null!=e.step_function?i+=f(e.id,r,n):(h(t)&&(i+="
"+t+" Node
"),""!==e.parallelism&&(i+="
Parallelism: "+e.parallelism+"
"),void 0!==e.lowWatermark&&(i+="
Low Watermark: "+e.lowWatermark+"
"),void 0!==e.operator&&e.operator_strategy&&(i+="
Operation: "+J(e.operator_strategy)+"
")),i+="
"},f=function(e,t,r){var n,i;return i="svg-"+e,n=""},J=function(e){var t;for("<"===e.charAt(0)&&(e=e.replace("<","<"),e=e.replace(">",">")),t="";e.length>30;)t=t+e.substring(0,30)+"
",e=e.substring(30,e.length);return t+=e},a=function(e,t,r,n,i,o){return null==n&&(n=!1),r.id===t.partial_solution?e.setNode(r.id,{label:s(r,"partialSolution",i,o),labelType:"html","class":m(r,"partialSolution")}):r.id===t.next_partial_solution?e.setNode(r.id,{label:s(r,"nextPartialSolution",i,o),labelType:"html","class":m(r,"nextPartialSolution")}):r.id===t.workset?e.setNode(r.id,{label:s(r,"workset",i,o),labelType:"html","class":m(r,"workset")}):r.id===t.next_workset?e.setNode(r.id,{label:s(r,"nextWorkset",i,o),labelType:"html","class":m(r,"nextWorkset")}):r.id===t.solution_set?e.setNode(r.id,{label:s(r,"solutionSet",i,o),labelType:"html","class":m(r,"solutionSet")}):r.id===t.solution_delta?e.setNode(r.id,{label:s(r,"solutionDelta",i,o),labelType:"html","class":m(r,"solutionDelta")}):e.setNode(r.id,{label:s(r,"",i,o),labelType:"html","class":m(r,"")})},i=function(e,t,r,n,i){return e.setEdge(i.id,r.id,{label:o(i),labelType:"html",arrowhead:"normal"})},k=function(e,t){var r,n,o,s,l,u,d,f,p,m,h,g,b,v;for(n=[],null!=t.nodes?v=t.nodes:(v=t.step_function,o=!0),s=0,u=v.length;s-1))return e["end-time"]=e["start-time"]+e.duration})},this.processVertices=function(e){return angular.forEach(e.vertices,function(e,t){return e.type="regular"}),e.vertices.unshift({name:"Scheduled","start-time":e.timestamps.CREATED,"end-time":e.timestamps.CREATED+1,type:"scheduled"})},this.listJobs=function(){var r;return r=i.defer(),e.get(t.jobServer+"joboverview").success(function(e){return function(t,n,i,o){return angular.forEach(t,function(t,r){switch(r){case"running":return c.running=e.setEndTimes(t);case"finished":return c.finished=e.setEndTimes(t);case"cancelled":return c.cancelled=e.setEndTimes(t);case"failed":return c.failed=e.setEndTimes(t)}}),r.resolve(c),d()}}(this)),r.promise},this.getJobs=function(e){return c[e]},this.getAllJobs=function(){return c},this.loadJob=function(r){return s=null,l.job=i.defer(),e.get(t.jobServer+"jobs/"+r).success(function(n){return function(i,o,a,u){return n.setEndTimes(i.vertices),n.processVertices(i),e.get(t.jobServer+"jobs/"+r+"/config").success(function(e){return i=angular.extend(i,e),s=i,l.job.resolve(s)})}}(this)),l.job.promise},this.getNode=function(e){var t,r;return r=function(e,t){var n,i,o,s;for(n=0,i=t.length;n
{{metric.id}}
{{value | humanizeChartNumeric:metric}}
',replace:!0,scope:{metric:"=",window:"=",removeMetric:"&",setMetricSize:"=",setMetricView:"=",getValues:"&"},link:function(e,t,r){return e.btnClasses=["btn","btn-default","btn-xs"],e.value=null,e.data=[{values:e.getValues()}],e.options={x:function(e,t){return e.x},y:function(e,t){return e.y},xTickFormat:function(e){return d3.time.format("%H:%M:%S")(new Date(e))},yTickFormat:function(e){var t,r,n,i;for(r=!1,n=0,i=1,t=Math.abs(e);!r&&n<50;)Math.pow(10,n)<=t&&t6?e/Math.pow(10,n)+"E"+n:""+e}},e.showChart=function(){return d3.select(t.find("svg")[0]).datum(e.data).transition().duration(250).call(e.chart)},e.chart=nv.models.lineChart().options(e.options).showLegend(!1).margin({top:15,left:60,bottom:30,right:30}),e.chart.yAxis.showMaxMin(!1),e.chart.tooltip.hideDelay(0),e.chart.tooltip.contentGenerator(function(e){return"

"+d3.time.format("%H:%M:%S")(new Date(e.point.x))+" | "+e.point.y+"

"}),nv.utils.windowResize(e.chart.update),e.setSize=function(t){return e.setMetricSize(e.metric,t)},e.setView=function(t){if(e.setMetricView(e.metric,t),"chart"===t)return e.showChart()},"chart"===e.metric.view&&e.showChart(),e.$on("metrics:data:update",function(t,r,n){return e.value=parseFloat(n[e.metric.id]),e.data[0].values.push({x:r,y:e.value}),e.data[0].values.length>e.window&&e.data[0].values.shift(),"chart"===e.metric.view&&e.showChart(),"chart"===e.metric.view&&e.chart.clearHighlights(),e.chart.tooltip.hidden(!0)}),t.find(".metric-title").qtip({content:{text:e.metric.id},position:{my:"bottom left",at:"top left"},style:{classes:"qtip-light qtip-timeline-bar"}})}}}),angular.module("flinkApp").service("MetricsService",["$http","$q","flinkConfig","$interval",function(e,t,r,n){return this.metrics={},this.values={},this.watched={},this.observer={jobid:null,nodeid:null,callback:null},this.refresh=n(function(e){return function(){return angular.forEach(e.metrics,function(t,r){return angular.forEach(t,function(t,n){var i;if(i=[],angular.forEach(t,function(e,t){return i.push(e.id)}),i.length>0)return e.getMetrics(r,n,i).then(function(t){if(r===e.observer.jobid&&n===e.observer.nodeid&&e.observer.callback)return e.observer.callback(t)})})})}}(this),r["refresh-interval"]),this.registerObserver=function(e,t,r){return this.observer.jobid=e,this.observer.nodeid=t,this.observer.callback=r},this.unRegisterObserver=function(){return this.observer={jobid:null,nodeid:null,callback:null}},this.setupMetrics=function(e,t){return this.setupLS(),this.watched[e]=[],angular.forEach(t,function(t){return function(r,n){if(r.id)return t.watched[e].push(r.id)}}(this))},this.getWindow=function(){return 100},this.setupLS=function(){return null==sessionStorage.flinkMetrics&&this.saveSetup(),this.metrics=JSON.parse(sessionStorage.flinkMetrics)},this.saveSetup=function(){return sessionStorage.flinkMetrics=JSON.stringify(this.metrics)},this.saveValue=function(e,t,r){if(null==this.values[e]&&(this.values[e]={}),null==this.values[e][t]&&(this.values[e][t]=[]),this.values[e][t].push(r),this.values[e][t].length>this.getWindow())return this.values[e][t].shift()},this.getValues=function(e,t,r){var n;return null==this.values[e]?[]:null==this.values[e][t]?[]:(n=[],angular.forEach(this.values[e][t],function(e){return function(e,t){if(null!=e.values[r])return n.push({x:e.timestamp,y:e.values[r]})}}(this)),n)},this.setupLSFor=function(e,t){if(null==this.metrics[e]&&(this.metrics[e]={}),null==this.metrics[e][t])return this.metrics[e][t]=[]},this.addMetric=function(e,t,r){return this.setupLSFor(e,t),this.metrics[e][t].push({id:r,size:"small",view:"chart"}),this.saveSetup()},this.removeMetric=function(e){return function(t,r,n){var i;if(null!=e.metrics[t][r])return i=e.metrics[t][r].indexOf(n),i===-1&&(i=_.findIndex(e.metrics[t][r],{id:n})),i!==-1&&e.metrics[t][r].splice(i,1),e.saveSetup()}}(this),this.setMetricSize=function(e){return function(t,r,n,i){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n.id),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n.id})),o!==-1&&(e.metrics[t][r][o]={id:n.id,size:i,view:n.view}),e.saveSetup()}}(this),this.setMetricView=function(e){return function(t,r,n,i){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n.id),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n.id})),o!==-1&&(e.metrics[t][r][o]={id:n.id,size:n.size,view:i}),e.saveSetup()}}(this),this.orderMetrics=function(e,t,r,n){return this.setupLSFor(e,t),angular.forEach(this.metrics[e][t],function(i){return function(o,s){if(o.id===r.id&&(i.metrics[e][t].splice(s,1),s",link:function(t,r,n){return t.getLabelClass=function(){return"label label-"+e.translateLabelState(n.status)}}}}]).directive("bpLabel",["JobsService",function(e){return{transclude:!0,replace:!0,scope:{getBackPressureLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getBackPressureLabelClass=function(){return"label label-"+e.translateBackPressureLabelState(n.status)}}}}]).directive("indicatorPrimary",["JobsService",function(e){return{replace:!0,scope:{getLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getLabelClass=function(){return"fa fa-circle indicator indicator-"+e.translateLabelState(n.status)}}}}]).directive("tableProperty",function(){return{replace:!0,scope:{value:"="},template:"{{value || 'None'}}"}}),angular.module("flinkApp").filter("amDurationFormatExtended",["angularMomentConfig",function(e){var t;return t=function(e,t,r){return"undefined"==typeof e||null===e?"":moment.duration(e,t).format(r,{trim:!1})},t.$stateful=e.statefulFilters,t}]).filter("humanizeDuration",function(){return function(e,t){var r,n,i,o,s,a;return"undefined"==typeof e||null===e?"":(o=e%1e3,a=Math.floor(e/1e3),s=a%60,a=Math.floor(a/60),i=a%60,a=Math.floor(a/60),n=a%24,a=Math.floor(a/24),r=a,0===r?0===n?0===i?0===s?o+"ms":s+"s ":i+"m "+s+"s":t?n+"h "+i+"m":n+"h "+i+"m "+s+"s":t?r+"d "+n+"h":r+"d "+n+"h "+i+"m "+s+"s")}}).filter("limit",function(){return function(e){return e.length>73&&(e=e.substring(0,35)+"..."+e.substring(e.length-35,e.length)),e}}).filter("humanizeText",function(){return function(e){return e?e.replace(/>/g,">").replace(//g,""):""}}).filter("humanizeBytes",function(){return function(e){var t,r;return r=["B","KB","MB","GB","TB","PB","EB"],t=function(e,n){var i;return i=Math.pow(1024,n),e=r;n=0<=r?++e:--e)i.push(n+".currentLowWatermark");return i}(),i.getMetrics(o,t.id,s).then(function(e){var t,n,i,o,s,a,l;i=NaN,l={},o=e.values;for(t in o)a=o[t],s=t.replace(".currentLowWatermark",""),l[s]=a,(isNaN(i)||au.noWatermark?i:NaN,r.resolve({lowWatermark:n,watermarks:l})}),r.promise}}(this),r=l.defer(),s={},n=t.length,angular.forEach(t,function(e){return function(e,t){var i;return i=e.id,o(e).then(function(e){if(s[i]=e,t>=n-1)return r.resolve(s)})}}(this)),r.promise},e.hasWatermark=function(t){return e.watermarks[t]&&!isNaN(e.watermarks[t].lowWatermark)},e.$watch("plan",function(t){if(t)return c(t.nodes).then(function(t){return e.watermarks=t})}),e.$on("reload",function(){if(e.plan)return c(e.plan.nodes).then(function(t){return e.watermarks=t})})}]).controller("JobPlanController",["$scope","$state","$stateParams","$window","JobsService",function(e,t,r,n,i){return e.nodeid=null,e.nodeUnfolded=!1,e.stateList=i.stateList(),e.changeNode=function(t){return t!==e.nodeid?(e.nodeid=t,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null,e.$broadcast("reload"),e.$broadcast("node:change",e.nodeid)):(e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null)},e.deactivateNode=function(){return e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null},e.toggleFold=function(){return e.nodeUnfolded=!e.nodeUnfolded}}]).controller("JobPlanSubtasksController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getSubtasks(e.nodeid).then(function(t){return e.subtasks=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanTaskManagersController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getTaskManagers(e.nodeid).then(function(t){return e.taskmanagers=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanAccumulatorsController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getAccumulators(e.nodeid).then(function(t){return e.accumulators=t.main,e.subtaskAccumulators=t.subtasks})},!e.nodeid||e.vertex&&e.vertex.accumulators||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanCheckpointsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i;return e.checkpointDetails={},e.checkpointDetails.id=-1,n.getCheckpointConfig().then(function(t){return e.checkpointConfig=t}),i=function(){return n.getCheckpointStats().then(function(t){if(null!==t)return e.checkpointStats=t})},i(),e.$on("reload",function(e){return i()})}]).controller("JobPlanCheckpointDetailsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i,o;return e.subtaskDetails={},e.checkpointDetails.id=r.checkpointId,i=function(t){return n.getCheckpointDetails(t).then(function(t){return null!==t?e.checkpoint=t:e.unknown_checkpoint=!0})},o=function(t,r){return n.getCheckpointSubtaskDetails(t,r).then(function(t){if(null!==t)return e.subtaskDetails[r]=t})},i(r.checkpointId),e.nodeid&&o(r.checkpointId,e.nodeid),e.$on("reload",function(t){if(i(r.checkpointId),e.nodeid)return o(r.checkpointId,e.nodeid)}),e.$on("$destroy",function(){return e.checkpointDetails.id=-1})}]).controller("JobPlanBackPressureController",["$scope","JobsService",function(e,t){var r;return r=function(){if(e.now=Date.now(),e.nodeid)return t.getOperatorBackPressure(e.nodeid).then(function(t){return e.backPressureOperatorStats[e.nodeid]=t})},r(),e.$on("reload",function(e){return r()})}]).controller("JobTimelineVertexController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i;return i=function(){return n.getVertex(r.vertexId).then(function(t){return e.vertex=t})},i(),e.$on("reload",function(e){return i()})}]).controller("JobExceptionsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){return n.loadExceptions().then(function(t){return e.exceptions=t})}]).controller("JobPropertiesController",["$scope","JobsService",function(e,t){return e.changeNode=function(r){return r!==e.nodeid?(e.nodeid=r,t.getNode(r).then(function(t){return e.node=t})):(e.nodeid=null,e.node=null)}}]).controller("JobPlanMetricsController",["$scope","JobsService","MetricsService",function(e,t,r){var n,i;if(e.dragging=!1,e.window=r.getWindow(),e.availableMetrics=null,e.$on("$destroy",function(){return r.unRegisterObserver()}),i=function(){return t.getVertex(e.nodeid).then(function(t){return e.vertex=t}),r.getAvailableMetrics(e.jobid,e.nodeid).then(function(t){return e.availableMetrics=t.sort(n),e.metrics=r.getMetricsSetup(e.jobid,e.nodeid).names,r.registerObserver(e.jobid,e.nodeid,function(t){return e.$broadcast("metrics:data:update",t.timestamp,t.values)})})},n=function(e,t){var r,n;return r=e.id.toLowerCase(),n=t.id.toLowerCase(),rn?1:0},e.dropped=function(t,n,o,s,a){return r.orderMetrics(e.jobid,e.nodeid,o,n),e.$broadcast("metrics:refresh",o),i(),!1},e.dragStart=function(){return e.dragging=!0},e.dragEnd=function(){return e.dragging=!1},e.addMetric=function(t){return r.addMetric(e.jobid,e.nodeid,t.id),i()},e.removeMetric=function(t){return r.removeMetric(e.jobid,e.nodeid,t),i()},e.setMetricSize=function(t,n){return r.setMetricSize(e.jobid,e.nodeid,t,n),i()},e.setMetricView=function(t,n){return r.setMetricView(e.jobid,e.nodeid,t,n),i()},e.getValues=function(t){return r.getValues(e.jobid,e.nodeid,t)},e.$on("node:change",function(t,r){if(!e.dragging)return i()}),e.nodeid)return i()}]),angular.module("flinkApp").directive("vertex",["$state",function(e){return{template:"",scope:{data:"="},link:function(e,t,r){var n,i,o;o=t.children()[0],i=t.width(),angular.element(o).attr("width",i),(n=function(e){var t,r,n;return d3.select(o).selectAll("*").remove(),n=[],angular.forEach(e.subtasks,function(e,t){var r;return r=[{label:"Scheduled",color:"#666",borderColor:"#555",starting_time:e.timestamps.SCHEDULED,ending_time:e.timestamps.DEPLOYING,type:"regular"},{label:"Deploying",color:"#aaa",borderColor:"#555",starting_time:e.timestamps.DEPLOYING,ending_time:e.timestamps.RUNNING,type:"regular"}],e.timestamps.FINISHED>0&&r.push({label:"Running",color:"#ddd",borderColor:"#555",starting_time:e.timestamps.RUNNING,ending_time:e.timestamps.FINISHED,type:"regular"}),n.push({label:"("+e.subtask+") "+e.host,times:r})}),t=d3.timeline().stack().tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("single").labelFormat(function(e){return e}).margin({left:100,right:0,top:0,bottom:0}).itemHeight(30).relativeTime(),r=d3.select(o).datum(n).call(t)})(e.data)}}}]).directive("timeline",["$state",function(e){return{template:"",scope:{vertices:"=",jobid:"="},link:function(t,r,n){var i,o,s,a;s=r.children()[0],o=r.width(),angular.element(s).attr("width",o),a=function(e){return e.replace(">",">")},i=function(r){var n,i,o;return d3.select(s).selectAll("*").remove(),o=[],angular.forEach(r,function(e){if(e["start-time"]>-1)return"scheduled"===e.type?o.push({times:[{label:a(e.name),color:"#cccccc",borderColor:"#555555",starting_time:e["start-time"],ending_time:e["end-time"],type:e.type}]}):o.push({times:[{label:a(e.name),color:"#d9f1f7",borderColor:"#62cdea",starting_time:e["start-time"],ending_time:e["end-time"],link:e.id,type:e.type}]})}),n=d3.timeline().stack().click(function(r,n,i){if(r.link)return e.go("single-job.timeline.vertex",{jobid:t.jobid,vertexId:r.link})}).tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("main").margin({left:0,right:0,top:0,bottom:0}).itemHeight(30).showBorderLine().showHourTimeline(),i=d3.select(s).datum(o).call(n)},t.$watch(n.vertices,function(e){if(e)return i(e)})}}}]).directive("split",function(){return{compile:function(e,t){return Split(e.children(),{sizes:[50,50],direction:"vertical"})}}}).directive("jobPlan",["$timeout",function(e){return{template:"
",scope:{plan:"=",watermarks:"=",setNode:"&"},link:function(e,t,r){var n,i,o,s,a,l,u,c,d,f,p,m,h,g,b,v,k,j,S,w,C,$,y,J,M;p=null,C=d3.behavior.zoom(),M=[],g=r.jobid,S=t.children()[0],j=t.children().children()[0],w=t.children()[1],l=d3.select(S),u=d3.select(j),c=d3.select(w),n=t.width(),angular.element(t.children()[0]).width(n),v=0,b=0,e.zoomIn=function(){var e,t,r;if(C.scale()<2.99)return e=C.translate(),t=e[0]*(C.scale()+.1/C.scale()),r=e[1]*(C.scale()+.1/C.scale()),C.scale(C.scale()+.1),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},e.zoomOut=function(){var e,t,r;if(C.scale()>.31)return C.scale(C.scale()-.1),e=C.translate(),t=e[0]*(C.scale()-.1/C.scale()),r=e[1]*(C.scale()-.1/C.scale()),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},o=function(e){var t;return t="",null==e.ship_strategy&&null==e.local_strategy||(t+="
",null!=e.ship_strategy&&(t+=e.ship_strategy),void 0!==e.temp_mode&&(t+=" ("+e.temp_mode+")"),void 0!==e.local_strategy&&(t+=",
"+e.local_strategy),t+="
"),t},h=function(e){return"partialSolution"===e||"nextPartialSolution"===e||"workset"===e||"nextWorkset"===e||"solutionSet"===e||"solutionDelta"===e},m=function(e,t){return"mirror"===t?"node-mirror":h(t)?"node-iteration":"node-normal"},s=function(e,t,r,n){var i,o;return i="
",i+="mirror"===t?"

Mirror of "+e.operator+"

":"

"+e.operator+"

",""===e.description?i+="":(o=e.description,o=J(o),i+="

"+o+"

"),null!=e.step_function?i+=f(e.id,r,n):(h(t)&&(i+="
"+t+" Node
"),""!==e.parallelism&&(i+="
Parallelism: "+e.parallelism+"
"),void 0!==e.lowWatermark&&(i+="
Low Watermark: "+e.lowWatermark+"
"),void 0!==e.operator&&e.operator_strategy&&(i+="
Operation: "+J(e.operator_strategy)+"
")),i+="
"},f=function(e,t,r){var n,i;return i="svg-"+e,n=""},J=function(e){var t;for("<"===e.charAt(0)&&(e=e.replace("<","<"),e=e.replace(">",">")),t="";e.length>30;)t=t+e.substring(0,30)+"
",e=e.substring(30,e.length);return t+=e},a=function(e,t,r,n,i,o){return null==n&&(n=!1),r.id===t.partial_solution?e.setNode(r.id,{label:s(r,"partialSolution",i,o),labelType:"html","class":m(r,"partialSolution")}):r.id===t.next_partial_solution?e.setNode(r.id,{label:s(r,"nextPartialSolution",i,o),labelType:"html","class":m(r,"nextPartialSolution")}):r.id===t.workset?e.setNode(r.id,{label:s(r,"workset",i,o),labelType:"html","class":m(r,"workset")}):r.id===t.next_workset?e.setNode(r.id,{label:s(r,"nextWorkset",i,o),labelType:"html","class":m(r,"nextWorkset")}):r.id===t.solution_set?e.setNode(r.id,{label:s(r,"solutionSet",i,o),labelType:"html","class":m(r,"solutionSet")}):r.id===t.solution_delta?e.setNode(r.id,{label:s(r,"solutionDelta",i,o),labelType:"html","class":m(r,"solutionDelta")}):e.setNode(r.id,{label:s(r,"",i,o),labelType:"html","class":m(r,"")})},i=function(e,t,r,n,i){return e.setEdge(i.id,r.id,{label:o(i),labelType:"html",arrowhead:"normal"})},k=function(e,t){var r,n,o,s,l,u,d,f,p,m,h,g,b,v;for(n=[],null!=t.nodes?v=t.nodes:(v=t.step_function,o=!0),s=0,u=v.length;s-1))return e["end-time"]=e["start-time"]+e.duration})},this.processVertices=function(e){return angular.forEach(e.vertices,function(e,t){return e.type="regular"}),e.vertices.unshift({name:"Scheduled","start-time":e.timestamps.CREATED,"end-time":e.timestamps.CREATED+1,type:"scheduled"})},this.listJobs=function(){var r;return r=i.defer(),e.get(t.jobServer+"joboverview").success(function(e){return function(t,n,i,o){return angular.forEach(t,function(t,r){switch(r){case"running":return c.running=e.setEndTimes(t);case"finished":return c.finished=e.setEndTimes(t);case"cancelled":return c.cancelled=e.setEndTimes(t);case"failed":return c.failed=e.setEndTimes(t)}}),r.resolve(c),d()}}(this)),r.promise},this.getJobs=function(e){return c[e]},this.getAllJobs=function(){return c},this.loadJob=function(r){return s=null,l.job=i.defer(),e.get(t.jobServer+"jobs/"+r).success(function(n){return function(i,o,a,u){return n.setEndTimes(i.vertices),n.processVertices(i),e.get(t.jobServer+"jobs/"+r+"/config").success(function(e){return i=angular.extend(i,e),s=i,l.job.resolve(s)})}}(this)),l.job.promise},this.getNode=function(e){var t,r;return r=function(e,t){var n,i,o,s;for(n=0,i=t.length;n
{{metric.id}}
{{value | humanizeChartNumeric:metric}}
',replace:!0,scope:{metric:"=",window:"=",removeMetric:"&",setMetricSize:"=",setMetricView:"=",getValues:"&"},link:function(e,t,r){return e.btnClasses=["btn","btn-default","btn-xs"], +e.value=null,e.data=[{values:e.getValues()}],e.options={x:function(e,t){return e.x},y:function(e,t){return e.y},xTickFormat:function(e){return d3.time.format("%H:%M:%S")(new Date(e))},yTickFormat:function(e){var t,r,n,i;for(r=!1,n=0,i=1,t=Math.abs(e);!r&&n<50;)Math.pow(10,n)<=t&&t6?e/Math.pow(10,n)+"E"+n:""+e}},e.showChart=function(){return d3.select(t.find("svg")[0]).datum(e.data).transition().duration(250).call(e.chart)},e.chart=nv.models.lineChart().options(e.options).showLegend(!1).margin({top:15,left:60,bottom:30,right:30}),e.chart.yAxis.showMaxMin(!1),e.chart.tooltip.hideDelay(0),e.chart.tooltip.contentGenerator(function(e){return"

"+d3.time.format("%H:%M:%S")(new Date(e.point.x))+" | "+e.point.y+"

"}),nv.utils.windowResize(e.chart.update),e.setSize=function(t){return e.setMetricSize(e.metric,t)},e.setView=function(t){if(e.setMetricView(e.metric,t),"chart"===t)return e.showChart()},"chart"===e.metric.view&&e.showChart(),e.$on("metrics:data:update",function(t,r,n){return e.value=parseFloat(n[e.metric.id]),e.data[0].values.push({x:r,y:e.value}),e.data[0].values.length>e.window&&e.data[0].values.shift(),"chart"===e.metric.view&&e.showChart(),"chart"===e.metric.view&&e.chart.clearHighlights(),e.chart.tooltip.hidden(!0)}),t.find(".metric-title").qtip({content:{text:e.metric.id},position:{my:"bottom left",at:"top left"},style:{classes:"qtip-light qtip-timeline-bar"}})}}}),angular.module("flinkApp").service("MetricsService",["$http","$q","flinkConfig","$interval",function(e,t,r,n){return this.metrics={},this.values={},this.watched={},this.observer={jobid:null,nodeid:null,callback:null},this.refresh=n(function(e){return function(){return angular.forEach(e.metrics,function(t,r){return angular.forEach(t,function(t,n){var i;if(i=[],angular.forEach(t,function(e,t){return i.push(e.id)}),i.length>0)return e.getMetrics(r,n,i).then(function(t){if(r===e.observer.jobid&&n===e.observer.nodeid&&e.observer.callback)return e.observer.callback(t)})})})}}(this),r["refresh-interval"]),this.registerObserver=function(e,t,r){return this.observer.jobid=e,this.observer.nodeid=t,this.observer.callback=r},this.unRegisterObserver=function(){return this.observer={jobid:null,nodeid:null,callback:null}},this.setupMetrics=function(e,t){return this.setupLS(),this.watched[e]=[],angular.forEach(t,function(t){return function(r,n){if(r.id)return t.watched[e].push(r.id)}}(this))},this.getWindow=function(){return 100},this.setupLS=function(){return null==sessionStorage.flinkMetrics&&this.saveSetup(),this.metrics=JSON.parse(sessionStorage.flinkMetrics)},this.saveSetup=function(){return sessionStorage.flinkMetrics=JSON.stringify(this.metrics)},this.saveValue=function(e,t,r){if(null==this.values[e]&&(this.values[e]={}),null==this.values[e][t]&&(this.values[e][t]=[]),this.values[e][t].push(r),this.values[e][t].length>this.getWindow())return this.values[e][t].shift()},this.getValues=function(e,t,r){var n;return null==this.values[e]?[]:null==this.values[e][t]?[]:(n=[],angular.forEach(this.values[e][t],function(e){return function(e,t){if(null!=e.values[r])return n.push({x:e.timestamp,y:e.values[r]})}}(this)),n)},this.setupLSFor=function(e,t){if(null==this.metrics[e]&&(this.metrics[e]={}),null==this.metrics[e][t])return this.metrics[e][t]=[]},this.addMetric=function(e,t,r){return this.setupLSFor(e,t),this.metrics[e][t].push({id:r,size:"small",view:"chart"}),this.saveSetup()},this.removeMetric=function(e){return function(t,r,n){var i;if(null!=e.metrics[t][r])return i=e.metrics[t][r].indexOf(n),i===-1&&(i=_.findIndex(e.metrics[t][r],{id:n})),i!==-1&&e.metrics[t][r].splice(i,1),e.saveSetup()}}(this),this.setMetricSize=function(e){return function(t,r,n,i){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n.id),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n.id})),o!==-1&&(e.metrics[t][r][o]={id:n.id,size:i,view:n.view}),e.saveSetup()}}(this),this.setMetricView=function(e){return function(t,r,n,i){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n.id),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n.id})),o!==-1&&(e.metrics[t][r][o]={id:n.id,size:n.size,view:i}),e.saveSetup()}}(this),this.orderMetrics=function(e,t,r,n){return this.setupLSFor(e,t),angular.forEach(this.metrics[e][t],function(i){return function(o,s){if(o.id===r.id&&(i.metrics[e][t].splice(s,1),s",link:function(t,r,n){return t.getLabelClass=function(){return"label label-"+e.translateLabelState(n.status)}}}}]).directive("bpLabel",["JobsService",function(e){return{transclude:!0,replace:!0,scope:{getBackPressureLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getBackPressureLabelClass=function(){return"label label-"+e.translateBackPressureLabelState(n.status)}}}}]).directive("indicatorPrimary",["JobsService",function(e){return{replace:!0,scope:{getLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getLabelClass=function(){return"fa fa-circle indicator indicator-"+e.translateLabelState(n.status)}}}}]).directive("tableProperty",function(){return{replace:!0,scope:{value:"="},template:"{{value || 'None'}}"}}),angular.module("flinkApp").filter("amDurationFormatExtended",["angularMomentConfig",function(e){var t;return t=function(e,t,r){return"undefined"==typeof e||null===e?"":moment.duration(e,t).format(r,{trim:!1})},t.$stateful=e.statefulFilters,t}]).filter("humanizeDuration",function(){return function(e,t){var r,n,i,o,a,s;return"undefined"==typeof e||null===e?"":(o=e%1e3,s=Math.floor(e/1e3),a=s%60,s=Math.floor(s/60),i=s%60,s=Math.floor(s/60),n=s%24,s=Math.floor(s/24),r=s,0===r?0===n?0===i?0===a?o+"ms":a+"s ":i+"m "+a+"s":t?n+"h "+i+"m":n+"h "+i+"m "+a+"s":t?r+"d "+n+"h":r+"d "+n+"h "+i+"m "+a+"s")}}).filter("limit",function(){return function(e){return e.length>73&&(e=e.substring(0,35)+"..."+e.substring(e.length-35,e.length)),e}}).filter("humanizeText",function(){return function(e){return e?e.replace(/>/g,">").replace(//g,""):""}}).filter("humanizeBytes",function(){return function(e){var t,r;return r=["B","KB","MB","GB","TB","PB","EB"],t=function(e,n){var i;return i=Math.pow(1024,n),e=r;n=0<=r?++e:--e)i.push(n+".currentLowWatermark");return i}(),i.getMetrics(o,t.id,a).then(function(e){var t,n,i,o,a,s,l;i=NaN,l={},o=e.values;for(t in o)s=o[t],a=t.replace(".currentLowWatermark",""),l[a]=s,(isNaN(i)||su.noWatermark?i:NaN,r.resolve({lowWatermark:n,watermarks:l})}),r.promise}}(this),r=l.defer(),a={},n=t.length,angular.forEach(t,function(e){return function(e,t){var i;return i=e.id,o(e).then(function(e){if(a[i]=e,t>=n-1)return r.resolve(a)})}}(this)),r.promise},e.hasWatermark=function(t){return e.watermarks[t]&&!isNaN(e.watermarks[t].lowWatermark)},e.$watch("plan",function(t){if(t)return c(t.nodes).then(function(t){return e.watermarks=t})}),e.$on("reload",function(){if(e.plan)return c(e.plan.nodes).then(function(t){return e.watermarks=t})})}]).controller("JobPlanController",["$scope","$state","$stateParams","$window","JobsService",function(e,t,r,n,i){return e.nodeid=null,e.nodeUnfolded=!1,e.stateList=i.stateList(),e.changeNode=function(t){return t!==e.nodeid?(e.nodeid=t,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null,e.$broadcast("reload"),e.$broadcast("node:change",e.nodeid)):(e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null)},e.deactivateNode=function(){return e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null},e.toggleFold=function(){return e.nodeUnfolded=!e.nodeUnfolded}}]).controller("JobPlanSubtasksController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getSubtasks(e.nodeid).then(function(t){return e.subtasks=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanTaskManagersController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getTaskManagers(e.nodeid).then(function(t){return e.taskmanagers=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanAccumulatorsController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getAccumulators(e.nodeid).then(function(t){return e.accumulators=t.main,e.subtaskAccumulators=t.subtasks})},!e.nodeid||e.vertex&&e.vertex.accumulators||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanCheckpointsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i;return e.checkpointDetails={},e.checkpointDetails.id=-1,n.getCheckpointConfig().then(function(t){return e.checkpointConfig=t}),i=function(){return n.getCheckpointStats().then(function(t){if(null!==t)return e.checkpointStats=t})},i(),e.$on("reload",function(e){return i()})}]).controller("JobPlanCheckpointDetailsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i,o;return e.subtaskDetails={},e.checkpointDetails.id=r.checkpointId,i=function(t){return n.getCheckpointDetails(t).then(function(t){return null!==t?e.checkpoint=t:e.unknown_checkpoint=!0})},o=function(t,r){return n.getCheckpointSubtaskDetails(t,r).then(function(t){if(null!==t)return e.subtaskDetails[r]=t})},i(r.checkpointId),e.nodeid&&o(r.checkpointId,e.nodeid),e.$on("reload",function(t){if(i(r.checkpointId),e.nodeid)return o(r.checkpointId,e.nodeid)}),e.$on("$destroy",function(){return e.checkpointDetails.id=-1})}]).controller("JobPlanBackPressureController",["$scope","JobsService",function(e,t){var r;return r=function(){if(e.now=Date.now(),e.nodeid)return t.getOperatorBackPressure(e.nodeid).then(function(t){return e.backPressureOperatorStats[e.nodeid]=t})},r(),e.$on("reload",function(e){return r()})}]).controller("JobTimelineVertexController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i;return i=function(){return n.getVertex(r.vertexId).then(function(t){return e.vertex=t})},i(),e.$on("reload",function(e){return i()})}]).controller("JobExceptionsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){return n.loadExceptions().then(function(t){return e.exceptions=t})}]).controller("JobPropertiesController",["$scope","JobsService",function(e,t){return e.changeNode=function(r){return r!==e.nodeid?(e.nodeid=r,t.getNode(r).then(function(t){return e.node=t})):(e.nodeid=null,e.node=null)}}]).controller("JobPlanMetricsController",["$scope","JobsService","MetricsService",function(e,t,r){var n;if(e.dragging=!1,e.window=r.getWindow(),e.availableMetrics=null,e.$on("$destroy",function(){return r.unRegisterObserver()}),n=function(){return t.getVertex(e.nodeid).then(function(t){return e.vertex=t}),r.getAvailableMetrics(e.jobid,e.nodeid).then(function(t){return e.availableMetrics=t,e.metrics=r.getMetricsSetup(e.jobid,e.nodeid).names,r.registerObserver(e.jobid,e.nodeid,function(t){return e.$broadcast("metrics:data:update",t.timestamp,t.values)})})},e.dropped=function(t,i,o,a,s){return r.orderMetrics(e.jobid,e.nodeid,o,i),e.$broadcast("metrics:refresh",o),n(),!1},e.dragStart=function(){return e.dragging=!0},e.dragEnd=function(){return e.dragging=!1},e.addMetric=function(t){return r.addMetric(e.jobid,e.nodeid,t.id),n()},e.removeMetric=function(t){return r.removeMetric(e.jobid,e.nodeid,t),n()},e.setMetricSize=function(t,i){return r.setMetricSize(e.jobid,e.nodeid,t,i),n()},e.setMetricView=function(t,i){return r.setMetricView(e.jobid,e.nodeid,t,i),n()},e.getValues=function(t){return r.getValues(e.jobid,e.nodeid,t)},e.$on("node:change",function(t,r){if(!e.dragging)return n()}),e.nodeid)return n()}]),angular.module("flinkApp").directive("vertex",["$state",function(e){return{template:"",scope:{data:"="},link:function(e,t,r){var n,i,o;o=t.children()[0],i=t.width(),angular.element(o).attr("width",i),(n=function(e){var t,r,n;return d3.select(o).selectAll("*").remove(),n=[],angular.forEach(e.subtasks,function(e,t){var r;return r=[{label:"Scheduled",color:"#666",borderColor:"#555",starting_time:e.timestamps.SCHEDULED,ending_time:e.timestamps.DEPLOYING,type:"regular"},{label:"Deploying",color:"#aaa",borderColor:"#555",starting_time:e.timestamps.DEPLOYING,ending_time:e.timestamps.RUNNING,type:"regular"}],e.timestamps.FINISHED>0&&r.push({label:"Running",color:"#ddd",borderColor:"#555",starting_time:e.timestamps.RUNNING,ending_time:e.timestamps.FINISHED,type:"regular"}),n.push({label:"("+e.subtask+") "+e.host,times:r})}),t=d3.timeline().stack().tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("single").labelFormat(function(e){return e}).margin({left:100,right:0,top:0,bottom:0}).itemHeight(30).relativeTime(),r=d3.select(o).datum(n).call(t)})(e.data)}}}]).directive("timeline",["$state",function(e){return{template:"",scope:{vertices:"=",jobid:"="},link:function(t,r,n){var i,o,a,s;a=r.children()[0],o=r.width(),angular.element(a).attr("width",o),s=function(e){return e.replace(">",">")},i=function(r){var n,i,o;return d3.select(a).selectAll("*").remove(),o=[],angular.forEach(r,function(e){if(e["start-time"]>-1)return"scheduled"===e.type?o.push({times:[{label:s(e.name),color:"#cccccc",borderColor:"#555555",starting_time:e["start-time"],ending_time:e["end-time"],type:e.type}]}):o.push({times:[{label:s(e.name),color:"#d9f1f7",borderColor:"#62cdea",starting_time:e["start-time"],ending_time:e["end-time"],link:e.id,type:e.type}]})}),n=d3.timeline().stack().click(function(r,n,i){if(r.link)return e.go("single-job.timeline.vertex",{jobid:t.jobid,vertexId:r.link})}).tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("main").margin({left:0,right:0,top:0,bottom:0}).itemHeight(30).showBorderLine().showHourTimeline(),i=d3.select(a).datum(o).call(n)},t.$watch(n.vertices,function(e){if(e)return i(e)})}}}]).directive("split",function(){return{compile:function(e,t){return Split(e.children(),{sizes:[50,50],direction:"vertical"})}}}).directive("jobPlan",["$timeout",function(e){return{template:"
",scope:{plan:"=",watermarks:"=",setNode:"&"},link:function(e,t,r){var n,i,o,a,s,l,u,c,d,f,p,m,g,h,b,v,k,j,S,w,C,$,J,M,y;p=null,C=d3.behavior.zoom(),y=[],h=r.jobid,S=t.children()[0],j=t.children().children()[0],w=t.children()[1],l=d3.select(S),u=d3.select(j),c=d3.select(w),n=t.width(),angular.element(t.children()[0]).width(n),v=0,b=0,e.zoomIn=function(){var e,t,r;if(C.scale()<2.99)return e=C.translate(),t=e[0]*(C.scale()+.1/C.scale()),r=e[1]*(C.scale()+.1/C.scale()),C.scale(C.scale()+.1),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},e.zoomOut=function(){var e,t,r;if(C.scale()>.31)return C.scale(C.scale()-.1),e=C.translate(),t=e[0]*(C.scale()-.1/C.scale()),r=e[1]*(C.scale()-.1/C.scale()),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},o=function(e){var t;return t="",null==e.ship_strategy&&null==e.local_strategy||(t+="
",null!=e.ship_strategy&&(t+=e.ship_strategy),void 0!==e.temp_mode&&(t+=" ("+e.temp_mode+")"),void 0!==e.local_strategy&&(t+=",
"+e.local_strategy),t+="
"),t},g=function(e){return"partialSolution"===e||"nextPartialSolution"===e||"workset"===e||"nextWorkset"===e||"solutionSet"===e||"solutionDelta"===e},m=function(e,t){return"mirror"===t?"node-mirror":g(t)?"node-iteration":"node-normal"},a=function(e,t,r,n){var i,o;return i="
",i+="mirror"===t?"

Mirror of "+e.operator+"

":"

"+e.operator+"

",""===e.description?i+="":(o=e.description,o=M(o),i+="

"+o+"

"),null!=e.step_function?i+=f(e.id,r,n):(g(t)&&(i+="
"+t+" Node
"),""!==e.parallelism&&(i+="
Parallelism: "+e.parallelism+"
"),void 0!==e.lowWatermark&&(i+="
Low Watermark: "+e.lowWatermark+"
"),void 0!==e.operator&&e.operator_strategy&&(i+="
Operation: "+M(e.operator_strategy)+"
")),i+="
"},f=function(e,t,r){var n,i;return i="svg-"+e,n=""},M=function(e){var t;for("<"===e.charAt(0)&&(e=e.replace("<","<"),e=e.replace(">",">")),t="";e.length>30;)t=t+e.substring(0,30)+"
",e=e.substring(30,e.length);return t+=e},s=function(e,t,r,n,i,o){return null==n&&(n=!1),r.id===t.partial_solution?e.setNode(r.id,{label:a(r,"partialSolution",i,o),labelType:"html","class":m(r,"partialSolution")}):r.id===t.next_partial_solution?e.setNode(r.id,{label:a(r,"nextPartialSolution",i,o),labelType:"html","class":m(r,"nextPartialSolution")}):r.id===t.workset?e.setNode(r.id,{label:a(r,"workset",i,o),labelType:"html","class":m(r,"workset")}):r.id===t.next_workset?e.setNode(r.id,{label:a(r,"nextWorkset",i,o),labelType:"html","class":m(r,"nextWorkset")}):r.id===t.solution_set?e.setNode(r.id,{label:a(r,"solutionSet",i,o),labelType:"html","class":m(r,"solutionSet")}):r.id===t.solution_delta?e.setNode(r.id,{label:a(r,"solutionDelta",i,o),labelType:"html","class":m(r,"solutionDelta")}):e.setNode(r.id,{label:a(r,"",i,o),labelType:"html","class":m(r,"")})},i=function(e,t,r,n,i){return e.setEdge(i.id,r.id,{label:o(i),labelType:"html",arrowhead:"normal"})},k=function(e,t){var r,n,o,a,l,u,d,f,p,m,g,h,b,v;for(n=[],null!=t.nodes?v=t.nodes:(v=t.step_function,o=!0),a=0,u=v.length;a-1))return e["end-time"]=e["start-time"]+e.duration})},this.processVertices=function(e){return angular.forEach(e.vertices,function(e,t){return e.type="regular"}),e.vertices.unshift({name:"Scheduled","start-time":e.timestamps.CREATED,"end-time":e.timestamps.CREATED+1,type:"scheduled"})},this.listJobs=function(){var r;return r=i.defer(),e.get(t.jobServer+"joboverview").success(function(e){return function(t,n,i,o){return angular.forEach(t,function(t,r){switch(r){case"running":return c.running=e.setEndTimes(t);case"finished":return c.finished=e.setEndTimes(t);case"cancelled":return c.cancelled=e.setEndTimes(t);case"failed":return c.failed=e.setEndTimes(t)}}),r.resolve(c),d()}}(this)),r.promise},this.getJobs=function(e){return c[e]},this.getAllJobs=function(){return c},this.loadJob=function(r){return a=null,l.job=i.defer(),e.get(t.jobServer+"jobs/"+r).success(function(n){return function(i,o,s,u){return n.setEndTimes(i.vertices),n.processVertices(i),e.get(t.jobServer+"jobs/"+r+"/config").success(function(e){return i=angular.extend(i,e),a=i,l.job.resolve(a)})}}(this)),l.job.promise},this.getNode=function(e){var t,r;return r=function(e,t){var n,i,o,a;for(n=0,i=t.length;n
{{metric.id}}
{{value | humanizeChartNumeric:metric}}
',replace:!0,scope:{metric:"=",window:"=",removeMetric:"&",setMetricSize:"=",setMetricView:"=",getValues:"&"},link:function(e,t,r){return e.btnClasses=["btn","btn-default","btn-xs"],e.value=null,e.data=[{values:e.getValues()}],e.options={x:function(e,t){return e.x},y:function(e,t){return e.y},xTickFormat:function(e){return d3.time.format("%H:%M:%S")(new Date(e))},yTickFormat:function(e){var t,r,n,i;for(r=!1,n=0,i=1,t=Math.abs(e);!r&&n<50;)Math.pow(10,n)<=t&&t6?e/Math.pow(10,n)+"E"+n:""+e}},e.showChart=function(){return d3.select(t.find("svg")[0]).datum(e.data).transition().duration(250).call(e.chart)},e.chart=nv.models.lineChart().options(e.options).showLegend(!1).margin({top:15,left:60,bottom:30,right:30}),e.chart.yAxis.showMaxMin(!1),e.chart.tooltip.hideDelay(0),e.chart.tooltip.contentGenerator(function(e){return"

"+d3.time.format("%H:%M:%S")(new Date(e.point.x))+" | "+e.point.y+"

"}),nv.utils.windowResize(e.chart.update),e.setSize=function(t){return e.setMetricSize(e.metric,t)},e.setView=function(t){if(e.setMetricView(e.metric,t),"chart"===t)return e.showChart()},"chart"===e.metric.view&&e.showChart(),e.$on("metrics:data:update",function(t,r,n){return e.value=parseFloat(n[e.metric.id]),e.data[0].values.push({x:r,y:e.value}),e.data[0].values.length>e.window&&e.data[0].values.shift(),"chart"===e.metric.view&&e.showChart(),"chart"===e.metric.view&&e.chart.clearHighlights(),e.chart.tooltip.hidden(!0)}),t.find(".metric-title").qtip({content:{text:e.metric.id},position:{my:"bottom left",at:"top left"},style:{classes:"qtip-light qtip-timeline-bar"}})}}}),angular.module("flinkApp").service("MetricsService",["$http","$q","flinkConfig","$interval",function(e,t,r,n){return this.metrics={},this.values={},this.watched={},this.observer={jobid:null,nodeid:null,callback:null},this.refresh=n(function(e){return function(){return angular.forEach(e.metrics,function(t,r){return angular.forEach(t,function(t,n){var i;if(i=[],angular.forEach(t,function(e,t){return i.push(e.id)}),i.length>0)return e.getMetrics(r,n,i).then(function(t){if(r===e.observer.jobid&&n===e.observer.nodeid&&e.observer.callback)return e.observer.callback(t)})})})}}(this),r["refresh-interval"]),this.registerObserver=function(e,t,r){return this.observer.jobid=e,this.observer.nodeid=t,this.observer.callback=r},this.unRegisterObserver=function(){return this.observer={jobid:null,nodeid:null,callback:null}},this.setupMetrics=function(e,t){return this.setupLS(),this.watched[e]=[],angular.forEach(t,function(t){return function(r,n){if(r.id)return t.watched[e].push(r.id)}}(this))},this.getWindow=function(){return 100},this.setupLS=function(){return null==sessionStorage.flinkMetrics&&this.saveSetup(),this.metrics=JSON.parse(sessionStorage.flinkMetrics)},this.saveSetup=function(){return sessionStorage.flinkMetrics=JSON.stringify(this.metrics)},this.saveValue=function(e,t,r){if(null==this.values[e]&&(this.values[e]={}),null==this.values[e][t]&&(this.values[e][t]=[]),this.values[e][t].push(r),this.values[e][t].length>this.getWindow())return this.values[e][t].shift()},this.getValues=function(e,t,r){var n;return null==this.values[e]?[]:null==this.values[e][t]?[]:(n=[],angular.forEach(this.values[e][t],function(e){return function(e,t){if(null!=e.values[r])return n.push({x:e.timestamp,y:e.values[r]})}}(this)),n)},this.setupLSFor=function(e,t){if(null==this.metrics[e]&&(this.metrics[e]={}),null==this.metrics[e][t])return this.metrics[e][t]=[]},this.addMetric=function(e,t,r){return this.setupLSFor(e,t),this.metrics[e][t].push({id:r,size:"small",view:"chart"}),this.saveSetup()},this.removeMetric=function(e){return function(t,r,n){var i;if(null!=e.metrics[t][r])return i=e.metrics[t][r].indexOf(n),i===-1&&(i=_.findIndex(e.metrics[t][r],{id:n})),i!==-1&&e.metrics[t][r].splice(i,1),e.saveSetup()}}(this),this.setMetricSize=function(e){return function(t,r,n,i){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n.id),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n.id})),o!==-1&&(e.metrics[t][r][o]={id:n.id,size:i,view:n.view}),e.saveSetup()}}(this),this.setMetricView=function(e){return function(t,r,n,i){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n.id),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n.id})),o!==-1&&(e.metrics[t][r][o]={id:n.id,size:n.size,view:i}),e.saveSetup()}}(this),this.orderMetrics=function(e,t,r,n){return this.setupLSFor(e,t),angular.forEach(this.metrics[e][t],function(i){return function(o,a){if(o.id===r.id&&(i.metrics[e][t].splice(a,1),a",link:function(t,r,n){return t.getLabelClass=function(){return"label label-"+e.translateLabelState(n.status)}}}}]).directive("bpLabel",["JobsService",function(e){return{transclude:!0,replace:!0,scope:{getBackPressureLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getBackPressureLabelClass=function(){return"label label-"+e.translateBackPressureLabelState(n.status)}}}}]).directive("indicatorPrimary",["JobsService",function(e){return{replace:!0,scope:{getLabelClass:"&",status:"@"},template:"",link:function(t,r,n){return t.getLabelClass=function(){return"fa fa-circle indicator indicator-"+e.translateLabelState(n.status)}}}}]).directive("tableProperty",function(){return{replace:!0,scope:{value:"="},template:"{{value || 'None'}}"}}),angular.module("flinkApp").filter("amDurationFormatExtended",["angularMomentConfig",function(e){var t;return t=function(e,t,r){return"undefined"==typeof e||null===e?"":moment.duration(e,t).format(r,{trim:!1})},t.$stateful=e.statefulFilters,t}]).filter("humanizeDuration",function(){return function(e,t){var r,n,i,o,a,s;return"undefined"==typeof e||null===e?"":(o=e%1e3,s=Math.floor(e/1e3),a=s%60,s=Math.floor(s/60),i=s%60,s=Math.floor(s/60),n=s%24,s=Math.floor(s/24),r=s,0===r?0===n?0===i?0===a?o+"ms":a+"s ":i+"m "+a+"s":t?n+"h "+i+"m":n+"h "+i+"m "+a+"s":t?r+"d "+n+"h":r+"d "+n+"h "+i+"m "+a+"s")}}).filter("limit",function(){return function(e){return e.length>73&&(e=e.substring(0,35)+"..."+e.substring(e.length-35,e.length)),e}}).filter("humanizeText",function(){return function(e){return e?e.replace(/>/g,">").replace(//g,""):""}}).filter("humanizeBytes",function(){return function(e){var t,r;return r=["B","KB","MB","GB","TB","PB","EB"],t=function(e,n){var i;return i=Math.pow(1024,n),e=r;n=0<=r?++e:--e)i.push(n+".currentLowWatermark");return i}(),i.getMetrics(o,t.id,a).then(function(e){var t,n,i,o,a,s,l;i=NaN,l={},o=e.values;for(t in o)s=o[t],a=t.replace(".currentLowWatermark",""),l[a]=s,(isNaN(i)||su.noWatermark?i:NaN,r.resolve({lowWatermark:n,watermarks:l})}),r.promise}}(this),r=l.defer(),a={},n=t.length,angular.forEach(t,function(e){return function(e,t){var i;return i=e.id,o(e).then(function(e){if(a[i]=e,t>=n-1)return r.resolve(a)})}}(this)),r.promise},e.hasWatermark=function(t){return e.watermarks[t]&&!isNaN(e.watermarks[t].lowWatermark)},e.$watch("plan",function(t){if(t)return c(t.nodes).then(function(t){return e.watermarks=t})}),e.$on("reload",function(){if(e.plan)return c(e.plan.nodes).then(function(t){return e.watermarks=t})})}]).controller("JobPlanController",["$scope","$state","$stateParams","$window","JobsService",function(e,t,r,n,i){return e.nodeid=null,e.nodeUnfolded=!1,e.stateList=i.stateList(),e.changeNode=function(t){return t!==e.nodeid?(e.nodeid=t,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null,e.$broadcast("reload"),e.$broadcast("node:change",e.nodeid)):(e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null)},e.deactivateNode=function(){return e.nodeid=null,e.nodeUnfolded=!1,e.vertex=null,e.subtasks=null,e.accumulators=null,e.operatorCheckpointStats=null},e.toggleFold=function(){return e.nodeUnfolded=!e.nodeUnfolded}}]).controller("JobPlanSubtasksController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getSubtasks(e.nodeid).then(function(t){return e.subtasks=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanTaskManagersController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getTaskManagers(e.nodeid).then(function(t){return e.taskmanagers=t})},!e.nodeid||e.vertex&&e.vertex.st||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanAccumulatorsController",["$scope","JobsService",function(e,t){var r;return r=function(){return t.getAccumulators(e.nodeid).then(function(t){return e.accumulators=t.main,e.subtaskAccumulators=t.subtasks})},!e.nodeid||e.vertex&&e.vertex.accumulators||r(),e.$on("reload",function(t){if(e.nodeid)return r()})}]).controller("JobPlanCheckpointsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i;return e.checkpointDetails={},e.checkpointDetails.id=-1,n.getCheckpointConfig().then(function(t){return e.checkpointConfig=t}),i=function(){return n.getCheckpointStats().then(function(t){if(null!==t)return e.checkpointStats=t})},i(),e.$on("reload",function(e){return i()})}]).controller("JobPlanCheckpointDetailsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i,o;return e.subtaskDetails={},e.checkpointDetails.id=r.checkpointId,i=function(t){return n.getCheckpointDetails(t).then(function(t){return null!==t?e.checkpoint=t:e.unknown_checkpoint=!0})},o=function(t,r){return n.getCheckpointSubtaskDetails(t,r).then(function(t){if(null!==t)return e.subtaskDetails[r]=t})},i(r.checkpointId),e.nodeid&&o(r.checkpointId,e.nodeid),e.$on("reload",function(t){if(i(r.checkpointId),e.nodeid)return o(r.checkpointId,e.nodeid)}),e.$on("$destroy",function(){return e.checkpointDetails.id=-1})}]).controller("JobPlanBackPressureController",["$scope","JobsService",function(e,t){var r;return r=function(){if(e.now=Date.now(),e.nodeid)return t.getOperatorBackPressure(e.nodeid).then(function(t){return e.backPressureOperatorStats[e.nodeid]=t})},r(),e.$on("reload",function(e){return r()})}]).controller("JobTimelineVertexController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){var i;return i=function(){return n.getVertex(r.vertexId).then(function(t){return e.vertex=t})},i(),e.$on("reload",function(e){return i()})}]).controller("JobExceptionsController",["$scope","$state","$stateParams","JobsService",function(e,t,r,n){return n.loadExceptions().then(function(t){return e.exceptions=t})}]).controller("JobPropertiesController",["$scope","JobsService",function(e,t){return e.changeNode=function(r){return r!==e.nodeid?(e.nodeid=r,t.getNode(r).then(function(t){return e.node=t})):(e.nodeid=null,e.node=null)}}]).controller("JobPlanMetricsController",["$scope","JobsService","MetricsService",function(e,t,r){var n,i;if(e.dragging=!1,e.window=r.getWindow(),e.availableMetrics=null,e.$on("$destroy",function(){return r.unRegisterObserver()}),i=function(){return t.getVertex(e.nodeid).then(function(t){return e.vertex=t}),r.getAvailableMetrics(e.jobid,e.nodeid).then(function(t){return e.availableMetrics=t.sort(n),e.metrics=r.getMetricsSetup(e.jobid,e.nodeid).names,r.registerObserver(e.jobid,e.nodeid,function(t){return e.$broadcast("metrics:data:update",t.timestamp,t.values)})})},n=function(e,t){var r,n;return r=e.id.toLowerCase(),n=t.id.toLowerCase(),rn?1:0},e.dropped=function(t,n,o,a,s){return r.orderMetrics(e.jobid,e.nodeid,o,n),e.$broadcast("metrics:refresh",o),i(),!1},e.dragStart=function(){return e.dragging=!0},e.dragEnd=function(){return e.dragging=!1},e.addMetric=function(t){return r.addMetric(e.jobid,e.nodeid,t.id),i()},e.removeMetric=function(t){return r.removeMetric(e.jobid,e.nodeid,t),i()},e.setMetricSize=function(t,n){return r.setMetricSize(e.jobid,e.nodeid,t,n),i()},e.setMetricView=function(t,n){return r.setMetricView(e.jobid,e.nodeid,t,n),i()},e.getValues=function(t){return r.getValues(e.jobid,e.nodeid,t)},e.$on("node:change",function(t,r){if(!e.dragging)return i()}),e.nodeid)return i()}]),angular.module("flinkApp").directive("vertex",["$state",function(e){return{template:"",scope:{data:"="},link:function(e,t,r){var n,i,o;o=t.children()[0],i=t.width(),angular.element(o).attr("width",i),(n=function(e){var t,r,n;return d3.select(o).selectAll("*").remove(),n=[],angular.forEach(e.subtasks,function(e,t){var r;return r=[{label:"Scheduled",color:"#666",borderColor:"#555",starting_time:e.timestamps.SCHEDULED,ending_time:e.timestamps.DEPLOYING,type:"regular"},{label:"Deploying",color:"#aaa",borderColor:"#555",starting_time:e.timestamps.DEPLOYING,ending_time:e.timestamps.RUNNING,type:"regular"}],e.timestamps.FINISHED>0&&r.push({label:"Running",color:"#ddd",borderColor:"#555",starting_time:e.timestamps.RUNNING,ending_time:e.timestamps.FINISHED,type:"regular"}),n.push({label:"("+e.subtask+") "+e.host,times:r})}),t=d3.timeline().stack().tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("single").labelFormat(function(e){return e}).margin({left:100,right:0,top:0,bottom:0}).itemHeight(30).relativeTime(),r=d3.select(o).datum(n).call(t)})(e.data)}}}]).directive("timeline",["$state",function(e){return{template:"",scope:{vertices:"=",jobid:"="},link:function(t,r,n){var i,o,a,s;a=r.children()[0],o=r.width(),angular.element(a).attr("width",o),s=function(e){return e.replace(">",">")},i=function(r){var n,i,o;return d3.select(a).selectAll("*").remove(),o=[],angular.forEach(r,function(e){if(e["start-time"]>-1)return"scheduled"===e.type?o.push({times:[{label:s(e.name),color:"#cccccc",borderColor:"#555555",starting_time:e["start-time"],ending_time:e["end-time"],type:e.type}]}):o.push({times:[{label:s(e.name),color:"#d9f1f7",borderColor:"#62cdea",starting_time:e["start-time"],ending_time:e["end-time"],link:e.id,type:e.type}]})}),n=d3.timeline().stack().click(function(r,n,i){if(r.link)return e.go("single-job.timeline.vertex",{jobid:t.jobid,vertexId:r.link})}).tickFormat({format:d3.time.format("%L"),tickSize:1}).prefix("main").margin({left:0,right:0,top:0,bottom:0}).itemHeight(30).showBorderLine().showHourTimeline(),i=d3.select(a).datum(o).call(n)},t.$watch(n.vertices,function(e){if(e)return i(e)})}}}]).directive("split",function(){return{compile:function(e,t){return Split(e.children(),{sizes:[50,50],direction:"vertical"})}}}).directive("jobPlan",["$timeout",function(e){return{template:"
",scope:{plan:"=",watermarks:"=",setNode:"&"},link:function(e,t,r){var n,i,o,a,s,l,u,c,d,f,p,m,g,h,b,v,k,j,S,w,C,$,J,M,y;p=null,C=d3.behavior.zoom(),y=[],h=r.jobid,S=t.children()[0],j=t.children().children()[0],w=t.children()[1],l=d3.select(S),u=d3.select(j),c=d3.select(w),n=t.width(),angular.element(t.children()[0]).width(n),v=0,b=0,e.zoomIn=function(){var e,t,r;if(C.scale()<2.99)return e=C.translate(),t=e[0]*(C.scale()+.1/C.scale()),r=e[1]*(C.scale()+.1/C.scale()),C.scale(C.scale()+.1),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},e.zoomOut=function(){var e,t,r;if(C.scale()>.31)return C.scale(C.scale()-.1),e=C.translate(),t=e[0]*(C.scale()-.1/C.scale()),r=e[1]*(C.scale()-.1/C.scale()),C.translate([t,r]),u.attr("transform","translate("+t+","+r+") scale("+C.scale()+")"),v=C.scale(),b=C.translate()},o=function(e){var t;return t="",null==e.ship_strategy&&null==e.local_strategy||(t+="
",null!=e.ship_strategy&&(t+=e.ship_strategy),void 0!==e.temp_mode&&(t+=" ("+e.temp_mode+")"),void 0!==e.local_strategy&&(t+=",
"+e.local_strategy),t+="
"),t},g=function(e){return"partialSolution"===e||"nextPartialSolution"===e||"workset"===e||"nextWorkset"===e||"solutionSet"===e||"solutionDelta"===e},m=function(e,t){return"mirror"===t?"node-mirror":g(t)?"node-iteration":"node-normal"},a=function(e,t,r,n){var i,o;return i="
",i+="mirror"===t?"

Mirror of "+e.operator+"

":"

"+e.operator+"

",""===e.description?i+="":(o=e.description,o=M(o),i+="

"+o+"

"),null!=e.step_function?i+=f(e.id,r,n):(g(t)&&(i+="
"+t+" Node
"),""!==e.parallelism&&(i+="
Parallelism: "+e.parallelism+"
"),void 0!==e.lowWatermark&&(i+="
Low Watermark: "+e.lowWatermark+"
"),void 0!==e.operator&&e.operator_strategy&&(i+="
Operation: "+M(e.operator_strategy)+"
")),i+="
"},f=function(e,t,r){var n,i;return i="svg-"+e,n=""},M=function(e){var t;for("<"===e.charAt(0)&&(e=e.replace("<","<"),e=e.replace(">",">")),t="";e.length>30;)t=t+e.substring(0,30)+"
",e=e.substring(30,e.length);return t+=e},s=function(e,t,r,n,i,o){return null==n&&(n=!1),r.id===t.partial_solution?e.setNode(r.id,{label:a(r,"partialSolution",i,o),labelType:"html","class":m(r,"partialSolution")}):r.id===t.next_partial_solution?e.setNode(r.id,{label:a(r,"nextPartialSolution",i,o),labelType:"html","class":m(r,"nextPartialSolution")}):r.id===t.workset?e.setNode(r.id,{label:a(r,"workset",i,o),labelType:"html","class":m(r,"workset")}):r.id===t.next_workset?e.setNode(r.id,{label:a(r,"nextWorkset",i,o),labelType:"html","class":m(r,"nextWorkset")}):r.id===t.solution_set?e.setNode(r.id,{label:a(r,"solutionSet",i,o),labelType:"html","class":m(r,"solutionSet")}):r.id===t.solution_delta?e.setNode(r.id,{label:a(r,"solutionDelta",i,o),labelType:"html","class":m(r,"solutionDelta")}):e.setNode(r.id,{label:a(r,"",i,o),labelType:"html","class":m(r,"")})},i=function(e,t,r,n,i){return e.setEdge(i.id,r.id,{label:o(i),labelType:"html",arrowhead:"normal"})},k=function(e,t){var r,n,o,a,l,u,d,f,p,m,g,h,b,v;for(n=[],null!=t.nodes?v=t.nodes:(v=t.step_function,o=!0),a=0,u=v.length;a-1))return e["end-time"]=e["start-time"]+e.duration})},this.processVertices=function(e){return angular.forEach(e.vertices,function(e,t){return e.type="regular"}),e.vertices.unshift({name:"Scheduled","start-time":e.timestamps.CREATED,"end-time":e.timestamps.CREATED+1,type:"scheduled"})},this.listJobs=function(){var r;return r=i.defer(),e.get(t.jobServer+"joboverview").success(function(e){return function(t,n,i,o){return angular.forEach(t,function(t,r){switch(r){case"running":return c.running=e.setEndTimes(t);case"finished":return c.finished=e.setEndTimes(t);case"cancelled":return c.cancelled=e.setEndTimes(t);case"failed":return c.failed=e.setEndTimes(t)}}),r.resolve(c),d()}}(this)),r.promise},this.getJobs=function(e){return c[e]},this.getAllJobs=function(){return c},this.loadJob=function(r){return a=null,l.job=i.defer(),e.get(t.jobServer+"jobs/"+r).success(function(n){return function(i,o,s,u){return n.setEndTimes(i.vertices),n.processVertices(i),e.get(t.jobServer+"jobs/"+r+"/config").success(function(e){return i=angular.extend(i,e),a=i,l.job.resolve(a)})}}(this)),l.job.promise},this.getNode=function(e){var t,r;return r=function(e,t){var n,i,o,a;for(n=0,i=t.length;n
{{metric.id}}
{{value | humanizeChartNumeric:metric}}
',replace:!0,scope:{metric:"=",window:"=",removeMetric:"&",setMetricSize:"=",setMetricView:"=",getValues:"&"},link:function(e,t,r){return e.btnClasses=["btn","btn-default","btn-xs"],e.value=null,e.data=[{values:e.getValues()}],e.options={x:function(e,t){return e.x},y:function(e,t){return e.y},xTickFormat:function(e){return d3.time.format("%H:%M:%S")(new Date(e))},yTickFormat:function(e){var t,r,n,i;for(r=!1,n=0,i=1,t=Math.abs(e);!r&&n<50;)Math.pow(10,n)<=t&&t6?e/Math.pow(10,n)+"E"+n:""+e}},e.showChart=function(){return d3.select(t.find("svg")[0]).datum(e.data).transition().duration(250).call(e.chart)},e.chart=nv.models.lineChart().options(e.options).showLegend(!1).margin({top:15,left:60,bottom:30,right:30}),e.chart.yAxis.showMaxMin(!1),e.chart.tooltip.hideDelay(0),e.chart.tooltip.contentGenerator(function(e){return"

"+d3.time.format("%H:%M:%S")(new Date(e.point.x))+" | "+e.point.y+"

"}),nv.utils.windowResize(e.chart.update),e.setSize=function(t){return e.setMetricSize(e.metric,t)},e.setView=function(t){if(e.setMetricView(e.metric,t),"chart"===t)return e.showChart()},"chart"===e.metric.view&&e.showChart(),e.$on("metrics:data:update",function(t,r,n){return e.value=parseFloat(n[e.metric.id]),e.data[0].values.push({x:r,y:e.value}),e.data[0].values.length>e.window&&e.data[0].values.shift(),"chart"===e.metric.view&&e.showChart(),"chart"===e.metric.view&&e.chart.clearHighlights(),e.chart.tooltip.hidden(!0)}),t.find(".metric-title").qtip({content:{text:e.metric.id},position:{my:"bottom left",at:"top left"},style:{classes:"qtip-light qtip-timeline-bar"}})}}}),angular.module("flinkApp").service("MetricsService",["$http","$q","flinkConfig","$interval",function(e,t,r,n){return this.metrics={},this.values={},this.watched={},this.observer={jobid:null,nodeid:null,callback:null},this.refresh=n(function(e){return function(){return angular.forEach(e.metrics,function(t,r){return angular.forEach(t,function(t,n){var i;if(i=[],angular.forEach(t,function(e,t){return i.push(e.id)}),i.length>0)return e.getMetrics(r,n,i).then(function(t){if(r===e.observer.jobid&&n===e.observer.nodeid&&e.observer.callback)return e.observer.callback(t)})})})}}(this),r["refresh-interval"]),this.registerObserver=function(e,t,r){return this.observer.jobid=e,this.observer.nodeid=t,this.observer.callback=r},this.unRegisterObserver=function(){return this.observer={jobid:null,nodeid:null,callback:null}},this.setupMetrics=function(e,t){return this.setupLS(),this.watched[e]=[],angular.forEach(t,function(t){return function(r,n){if(r.id)return t.watched[e].push(r.id)}}(this))},this.getWindow=function(){return 100},this.setupLS=function(){return null==sessionStorage.flinkMetrics&&this.saveSetup(),this.metrics=JSON.parse(sessionStorage.flinkMetrics)},this.saveSetup=function(){return sessionStorage.flinkMetrics=JSON.stringify(this.metrics)},this.saveValue=function(e,t,r){if(null==this.values[e]&&(this.values[e]={}),null==this.values[e][t]&&(this.values[e][t]=[]),this.values[e][t].push(r),this.values[e][t].length>this.getWindow())return this.values[e][t].shift()},this.getValues=function(e,t,r){var n;return null==this.values[e]?[]:null==this.values[e][t]?[]:(n=[],angular.forEach(this.values[e][t],function(e){return function(e,t){if(null!=e.values[r])return n.push({x:e.timestamp,y:e.values[r]})}}(this)),n)},this.setupLSFor=function(e,t){if(null==this.metrics[e]&&(this.metrics[e]={}),null==this.metrics[e][t])return this.metrics[e][t]=[]},this.addMetric=function(e,t,r){return this.setupLSFor(e,t),this.metrics[e][t].push({id:r,size:"small",view:"chart"}),this.saveSetup()},this.removeMetric=function(e){return function(t,r,n){var i;if(null!=e.metrics[t][r])return i=e.metrics[t][r].indexOf(n),i===-1&&(i=_.findIndex(e.metrics[t][r],{id:n})),i!==-1&&e.metrics[t][r].splice(i,1),e.saveSetup()}}(this),this.setMetricSize=function(e){return function(t,r,n,i){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n.id),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n.id})),o!==-1&&(e.metrics[t][r][o]={id:n.id,size:i,view:n.view}),e.saveSetup()}}(this),this.setMetricView=function(e){return function(t,r,n,i){var o;if(null!=e.metrics[t][r])return o=e.metrics[t][r].indexOf(n.id),o===-1&&(o=_.findIndex(e.metrics[t][r],{id:n.id})),o!==-1&&(e.metrics[t][r][o]={id:n.id,size:n.size,view:i}),e.saveSetup()}}(this),this.orderMetrics=function(e,t,r,n){return this.setupLSFor(e,t),angular.forEach(this.metrics[e][t],function(i){return function(o,a){if(o.id===r.id&&(i.metrics[e][t].splice(a,1),a