Compare commits

..
Author SHA1 Message Date
Bill Oley 2a8da60673 New nsq-relay module 2025-03-14 09:25:17 -04:00
Bill Oley de8e29a190 Fix Tag.hashCode() to use HashCodeBuilder instead of a hash of toString 2025-03-05 09:16:06 -05:00
Bill Oley 21e74a50f3 Combine the use of multiple RegexFilters to a single TagFilter that also uses a cache to speed up comparisons 2025-03-05 09:16:06 -05:00
Bill Oley 9ca070f106 Update grafana datasource plugin to grafana version 11.5.x 2025-03-05 09:15:57 -05:00
Bill Oley 4d08db3fbc Set version to 2.1.6-SNAPSHOT 2024-04-15 10:54:17 -04:00
Bill Oley 16d73a1845 Release version 2.1.5 2024-04-15 10:54:17 -04:00
Bill Oley 42b06cf60c Prevent maven plugins from using log4j:log4j 2024-04-15 10:54:11 -04:00
Bill Oley e772728159 Correctly handle load, dwquery, hadoop, accumulo2, metrics in CollectDPluginParent 2024-04-10 16:25:45 -04:00
Bill Oley ebce93684a Save FileSystem instead of constantly re-creating, ensure CsvReader closed 2024-04-10 16:25:44 -04:00
Bill Oley ff7a75c7c4 Fix extraction of native libraries in scripts, make indentation consistent 2024-04-10 16:25:38 -04:00
Bill Oley ad61f2cc85 Set version to 2.1.5-SNAPSHOT 2024-03-29 16:52:06 -04:00
Bill Oley e8beb77cb9 Release version 2.1.4 2024-03-29 16:50:04 -04:00
Bill Oley d6839fbc6c Set client to null on exception, don't try to return it to pool 2024-03-29 16:46:21 -04:00
Bill Oley d53079a996 Allow users to specify an interval to calculate rates over, default downsample interval if set or 1 second otherwise 2024-03-29 13:23:03 -04:00
Bill Oley 2e7489afef Modifications to CollectDPluginParent to support dwquery metrics and to correctly identify rack for a host 2024-03-29 12:24:12 -04:00
Bill Oley ee71a2c74f Improve scripts to extract native libraries only when they are not present 2024-03-29 12:23:23 -04:00
194 changed files with 32067 additions and 159417 deletions

No files matched your search

+1
View File
@@ -8,4 +8,5 @@ logs/
server/pki/
client/src/main/python/setup.py
grafana/timely-app/yarn-error.log
grafana/timely-app/data/
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>timely</groupId>
<artifactId>timely</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>timely-analytics</artifactId>
<!--
+17 -21
View File
@@ -1,17 +1,17 @@
#!/bin/bash
if [[ $(uname) == "Darwin" ]]; then
THIS_SCRIPT=$(python -c 'import os,sys; print os.path.realpath(sys.argv[1])' "$0")
THIS_SCRIPT=$(python -c 'import os,sys; print os.path.realpath(sys.argv[1])' "$0")
else
THIS_SCRIPT=$(readlink -f "$0")
HW=`uname -m`
OS_PATH=linux-${HW}
THIS_SCRIPT=$(readlink -f "$0")
HW=`uname -m`
OS_PATH=linux-${HW}
fi
if [ -z "$1" ]; then
export INSTANCE="1"
export INSTANCE="1"
else
export INSTANCE="$1"
export INSTANCE="$1"
fi
PID=$(jps -m | grep -E 'timely-balancer-.*-exec.jar' | grep "instance=${INSTANCE}" | awk '{print $1}')
@@ -19,7 +19,6 @@ PID=$(jps -m | grep -E 'timely-balancer-.*-exec.jar' | grep "instance=${INSTANCE
if [ "$PID" == "" ]; then
THIS_DIR="${THIS_SCRIPT%/*}"
BASE_DIR=$(cd "$THIS_DIR"/.. && pwd)
TMP_DIR="${BASE_DIR}/tmp"
LIB_DIR="${BASE_DIR}/lib"
BIN_DIR="${BASE_DIR}/bin"
export CONF_DIR="${BASE_DIR}/conf"
@@ -32,18 +31,12 @@ if [ "$PID" == "" ]; then
# use either a value from timely-balancer-env.sh or the default
export LOG_DIR="${TIMELY_LOG_DIR:-${BASE_DIR}/logs}"
if [[ -e ${TMP_DIR} ]]; then
rm -rf "${TMP_DIR}"
if [[ ! -e ${NATIVE_DIR} ]]; then
mkdir -p "${NATIVE_DIR}"
fi
mkdir "${TMP_DIR}"
if [[ -e ${NATIVE_DIR} ]]; then
rm -rf "${NATIVE_DIR}"
fi
mkdir -p "${NATIVE_DIR}"
if [[ ! -e ${LOG_DIR} ]]; then
mkdir "${LOG_DIR}"
mkdir "${LOG_DIR}"
fi
JVM_ARGS="-Xmx2G -Xms2G -XX:NewSize=1G -XX:MaxNewSize=1G"
@@ -53,12 +46,15 @@ if [ "$PID" == "" ]; then
JVM_ARGS="${JVM_ARGS} -Djava.net.preferIPv4Stack=true"
JVM_ARGS="${JVM_ARGS} -XX:+UseNUMA"
# for linux varieties of OS, extract native libraries if not already present
if [[ -n "$OS_PATH" ]]; then
pushd "${BASE_DIR}/bin" || exit
"${JAVA_HOME}"/bin/jar xf "${LIB_DIR}"/netty-tcnative-boringssl-static-*.Final-"${OS_PATH}".jar ${NATIVE_DIR}/libnetty_tcnative_linux_"${HW}".so
"${JAVA_HOME}"/bin/jar xf "${LIB_DIR}"/netty-transport-native-epoll-*-"${OS_PATH}".jar ${NATIVE_DIR}/libnetty_transport_native_epoll_"${HW}".so
popd || exit
JVM_ARGS="${JVM_ARGS} -Djava.library.path=${NATIVE_DIR}"
if [[ ! -d ${NATIVE_DIR} || -z "$(ls -A ${NATIVE_DIR})" ]]; then
pushd "${BASE_DIR}/bin" || exit
"${JAVA_HOME}"/bin/jar xf "${LIB_DIR}"/netty-tcnative-boringssl-static-*.Final-"${OS_PATH}".jar META-INF/native/libnetty_tcnative_linux_"${HW}".so
"${JAVA_HOME}"/bin/jar xf "${LIB_DIR}"/netty-transport-native-epoll-*-"${OS_PATH}".jar META-INF/native/libnetty_transport_native_epoll_"${HW}".so
popd || exit
fi
JVM_ARGS="${JVM_ARGS} -Djava.library.path=${NATIVE_DIR}"
fi
echo "${JAVA_HOME}/bin/java ${JVM_ARGS} -jar ${BIN_DIR}/timely-balancer-*-exec.jar --instance=${INSTANCE}"
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>timely</groupId>
<artifactId>timely</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>timely-balancer</artifactId>
<description>Timely Balancer</description>
@@ -91,17 +91,21 @@ public class MetricResolver {
final protected BalancerProperties balancerProperties;
final protected CacheProperties cacheProperties;
final protected HealthChecker healthChecker;
final protected Path assignmentFile;
final protected FileSystem fs;
private enum BalanceType {
HIGH_LOW, HIGH_AVG, AVG_LOW
}
public MetricResolver(CuratorFramework curatorFramework, BalancerProperties balancerProperties, CacheProperties cacheProperties,
HealthChecker healthChecker) {
HealthChecker healthChecker) throws Exception {
this.curatorFramework = curatorFramework;
this.balancerProperties = balancerProperties;
this.cacheProperties = cacheProperties;
this.healthChecker = healthChecker;
this.assignmentFile = new Path(balancerProperties.getAssignmentFile());
this.fs = getFileSystem(this.assignmentFile);
}
public void start() {
@@ -916,10 +920,8 @@ public class MetricResolver {
protected void createAssignmentFile() {
try {
log.info("Creating assignment file: " + balancerProperties.getAssignmentFile());
Path assignmentFile = new Path(balancerProperties.getAssignmentFile());
FileSystem fs = getFileSystem(assignmentFile);
fs.create(assignmentFile);
log.info("Creating assignment file: " + this.assignmentFile);
this.fs.create(this.assignmentFile);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
@@ -927,9 +929,7 @@ public class MetricResolver {
protected long getLastWrittenToHdfsTimestamp() {
try {
Path assignmentFile = new Path(balancerProperties.getAssignmentFile());
FileSystem fs = getFileSystem(assignmentFile);
FileStatus fileStatus = fs.getFileStatus(assignmentFile);
FileStatus fileStatus = this.fs.getFileStatus(this.assignmentFile);
return fileStatus.getModificationTime();
} catch (FileNotFoundException e) {
createAssignmentFile();
@@ -960,16 +960,15 @@ public class MetricResolver {
// proceed with reading from HDFS
Map<String,TimelyBalancedHost> assignedMetricToHostMap = new TreeMap<>();
CsvReader reader = null;
try {
boolean acquired = false;
while (!acquired) {
acquired = assignmentsIPRWLock.readLock().acquire(60, TimeUnit.SECONDS);
}
balancerLock.writeLock().lock();
Path assignmentFile = new Path(balancerProperties.getAssignmentFile());
FileSystem fs = getFileSystem(assignmentFile);
FSDataInputStream iStream = fs.open(assignmentFile);
CsvReader reader = new CsvReader(iStream, ',', Charset.forName("UTF-8"));
FSDataInputStream iStream = this.fs.open(this.assignmentFile);
reader = new CsvReader(iStream, ',', Charset.forName("UTF-8"));
reader.setUseTextQualifier(false);
// skip the headers
@@ -1031,6 +1030,9 @@ public class MetricResolver {
} catch (Exception e) {
log.error(e.getMessage(), e);
} finally {
if (reader != null) {
reader.close();
}
balancerLock.writeLock().unlock();
try {
assignmentsIPRWLock.readLock().release();
@@ -1052,12 +1054,10 @@ public class MetricResolver {
nonCachedMetricsLocalLock.readLock().lock();
try {
if (!metricToHostMap.isEmpty()) {
Path assignmentFile = new Path(balancerProperties.getAssignmentFile());
FileSystem fs = getFileSystem(assignmentFile);
if (!fs.exists(assignmentFile.getParent())) {
fs.mkdirs(assignmentFile.getParent());
if (!this.fs.exists(this.assignmentFile.getParent())) {
this.fs.mkdirs(this.assignmentFile.getParent());
}
FSDataOutputStream oStream = fs.create(assignmentFile, true);
FSDataOutputStream oStream = this.fs.create(this.assignmentFile, true);
writer = new CsvWriter(oStream, ',', Charset.forName("UTF-8"));
writer.setUseTextQualifier(false);
writer.write("metric");
@@ -1080,7 +1080,7 @@ public class MetricResolver {
if (!assignmentsLastUpdatedInHdfs.get().succeeded()) {
assignmentsLastUpdatedInHdfs.forceSet(now);
}
log.debug("Wrote {} assignments to hdfs lastHdfsUpdate = lastLocalUpdate ({})", metricToHostMap.size(),
log.info("Wrote {} assignments to hdfs lastHdfsUpdate = lastLocalUpdate ({})", metricToHostMap.size(),
new Date(assignmentsLastUpdatedLocal.get()));
// remove metric from metricMap (ArrivalRate) if not being cached
metricMap.entrySet().removeIf(e -> !metricToHostMap.containsKey(e.getKey()));
@@ -50,7 +50,7 @@ public class BalancerConfiguration {
@Bean
@ConditionalOnMissingBean
public MetricResolver metricResolver(CuratorFramework curatorFramework, BalancerProperties balancerProperties, CacheProperties cacheProperties,
HealthChecker healthChecker) {
HealthChecker healthChecker) throws Exception {
MetricResolver metricResolver = new MetricResolver(curatorFramework, balancerProperties, cacheProperties, healthChecker);
metricResolver.start();
return metricResolver;
@@ -48,7 +48,7 @@ public class TestBalancerConfiguration {
@Bean
public TestMetricResolver metricResolver(CuratorFramework curatorFramework, BalancerProperties balancerProperties, CacheProperties cacheProperties,
HealthChecker healthChecker) {
HealthChecker healthChecker) throws Exception {
TestMetricResolver metricResolver = new TestMetricResolver(curatorFramework, balancerProperties, cacheProperties, healthChecker);
metricResolver.start();
return metricResolver;
@@ -20,7 +20,7 @@ public class TestMetricResolver extends MetricResolver {
private static final Logger log = LoggerFactory.getLogger(TestMetricResolver.class);
public TestMetricResolver(CuratorFramework curatorFramework, BalancerProperties balancerProperties, CacheProperties cacheProperties,
HealthChecker healthChecker) {
HealthChecker healthChecker) throws Exception {
super(curatorFramework, balancerProperties, cacheProperties, healthChecker);
}
+2 -2
View File
@@ -4,13 +4,13 @@
<parent>
<groupId>timely</groupId>
<artifactId>timely</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>timely-client</artifactId>
<properties>
<!-- PEP 440 compliant version gets substituted into src/main/python/template/setup.py -->
<!-- use .dev0 instead of -SNAPSHOT -->
<python.client.version>2.1.4.dev0</python.client.version>
<python.client.version>2.1.6.dev0</python.client.version>
</properties>
<dependencies>
<dependency>
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>timely</groupId>
<artifactId>timely</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>collectd-nsq-plugin</artifactId>
<dependencies>
@@ -79,6 +79,7 @@ public class WriteNSQPlugin extends CollectDPluginParent implements CollectdConf
} catch (IOException e1) {}
try {
clientPool.invalidateObject(client);
client = null;
} catch (Exception e2) {}
}
} finally {
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>timely</groupId>
<artifactId>timely</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>collectd-plugin-parent</artifactId>
<dependencies>
@@ -3,6 +3,7 @@ package timely.collectd.plugin;
import java.io.OutputStream;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.TreeMap;
import java.util.regex.Matcher;
@@ -25,6 +26,9 @@ public abstract class CollectDPluginParent {
private static final String GAUGE = "GAUGE";
private static final String DERIVE = "DERIVE";
private static final String ABSOLUTE = "ABSOLUTE";
private static final Collection<String> HADOOP_CONTEXTS = Arrays.asList("NameNode", "DataNode", "JobManager", "NodeManager", "JobHistoryServer",
"ResourceManager", "MRAppMaster");
private static final Pattern HADOOP_PATTERN_4_GROUPS = Pattern.compile("([\\w-_]+)\\.([\\w-_]+)\\.([\\w-_]+)\\.([\\w-_]+)");
private static final Pattern STATSD_PATTERN_3_GROUPS = Pattern.compile("([\\w-_]+)\\.([\\w-_]+)\\.([\\w-_]+)");
private static final Pattern STATSD_PATTERN_4_GROUPS = Pattern.compile("([\\w-_]+)\\.([\\w-_]+)\\.([\\w-_]+)\\.([\\w-_]+)");
private static final Pattern STATSD_PATTERN_6_GROUPS = Pattern.compile("([\\w-_]+)\\.([\\w-_]+)\\.([\\w-_]+)\\.([\\w-_]+)\\.([\\w-_#]+)\\.([\\w-_]+)");
@@ -64,6 +68,8 @@ public abstract class CollectDPluginParent {
protected void addTag(Map<String,String> m, String k, String v) {
if (k != null && !k.isBlank() && v != null && !v.isBlank()) {
k = k.replaceAll("=", ":");
v = v.replaceAll("=", ":");
m.put(k.trim(), v.trim());
}
}
@@ -71,8 +77,8 @@ public abstract class CollectDPluginParent {
protected void addTag(Map<String,String> m, String kv) {
if (kv != null && !kv.isBlank()) {
String[] parts = kv.split("=");
if (parts.length == 2 && !parts[0].isBlank() && !parts[1].isBlank()) {
m.put(parts[0].trim(), parts[1].trim());
if (parts.length == 2) {
addTag(m, parts[0], parts[1]);
}
}
}
@@ -99,9 +105,10 @@ public abstract class CollectDPluginParent {
} else {
addTag(tagMap, "host", host);
}
int nIdx = host.indexOf('n');
String[] hostSplit = host.split("\\.");
int nIdx = hostSplit[0].lastIndexOf('n');
if (-1 != nIdx) {
addTag(tagMap, "rack", host.substring(0, nIdx));
addTag(tagMap, "rack", hostSplit[0].substring(0, nIdx));
}
tagMap.putAll(addlTags);
@@ -112,34 +119,53 @@ public abstract class CollectDPluginParent {
switch (plugin) {
case STATSD_PREFIX:
Matcher hadoop_4_groups = HADOOP_PATTERN_4_GROUPS.matcher(typeInstance);
Matcher statsd_3_groups = STATSD_PATTERN_3_GROUPS.matcher(typeInstance);
Matcher statsd_4_groups = STATSD_PATTERN_4_GROUPS.matcher(typeInstance);
Matcher statsd_6_groups = STATSD_PATTERN_6_GROUPS.matcher(typeInstance);
String instance = null;
if (!typeInstance.startsWith("nsq")) {
String[] parts = typeInstance.split("\\.");
if (parts.length % 2 == 1 && parts.length >= 3) {
switch(parts[0]) {
case "dwingest":
if (parts.length >= 4) {
metric.append(STATSD_PREFIX).append(PERIOD).append(parts[1]).append(PERIOD).append(parts[3]);
instance = parts[0];
}
break;
case "dwquery":
if (parts.length >= 4) {
metric.append(STATSD_PREFIX).append(PERIOD).append(parts[1]).append(PERIOD).append(parts[3]);
addTag(tagMap, "queryId", parts[0]);
}
break;
default:
// EtsyStatsD format -- metric.(tagName.tagValue)*
metric.append(STATSD_PREFIX).append(PERIOD).append(parts[0]);
for (int x = 1; x < parts.length; x += 2) {
addTag(tagMap, parts[x], parts[x + 1]);
if (parts.length >= 4 && (HADOOP_CONTEXTS.contains(parts[0]) || hadoop_4_groups.matches())) {
// Here we are processing the statsd metrics coming from the Hadoop Metrics2 StatsDSink without the host name.
// The format of metric is: serviceName.contextName.recordName.metricName
// The serviceName is used as the instance.
instance = parts[0];
String contextName = parts[1];
int firstPeriod = typeInstance.indexOf(".");
int lastPeriod = typeInstance.lastIndexOf(".");
String metricName = typeInstance.substring(lastPeriod + 1);
String recordName = typeInstance.substring(firstPeriod + 1, lastPeriod);
// the recordName may contain useful tags such as op=<operation> and user<user>
// in addition to a possibly duplicative recordName
String[] recordNameSplits = recordName.split("\\.");
metric.append(STATSD_PREFIX).append(PERIOD).append(contextName).append(PERIOD);
for (String split : recordNameSplits) {
// avoid duplication with either the contextName or instance
if (!split.equalsIgnoreCase(contextName) && !split.equalsIgnoreCase(instance)) {
if (split.startsWith("NNTopUserOpCounts") && split.contains("windowMs=")) {
metric.append("NNTopUserOpCounts").append(PERIOD);
addTag(tagMap, split.substring(split.indexOf("windowMs=")));
} else if (split.contains("=")) {
addTag(tagMap, split);
} else {
addTag(tagMap, "record", split);
}
}
}
metric.append(metricName);
} else if (parts.length >= 2 && parts[1].equals("dwquery")) {
// These come from Datawave's QueryIterator metrics - the first split part is the queryId
// Use statsd plus the rest of the typeInstance after the first period as the metric name
int x = typeInstance.indexOf(".");
metric.append(STATSD_PREFIX).append(PERIOD).append(typeInstance.substring(x + 1));
addTag(tagMap, "queryId", parts[0]);
} else if (parts.length % 2 == 1) {
// EtsyStatsD format -- metric.(tagName.tagValue)*
metric.append(STATSD_PREFIX).append(PERIOD).append(parts[0]);
for (int x = 1; x < parts.length; x += 2) {
addTag(tagMap, parts[x], parts[x + 1]);
}
} else if (statsd_4_groups.matches()) {
// Here we are processing the statsd metrics coming from the Hadoop Metrics2 StatsDSink without the host name.
// The format of metric is: serviceName.contextName.recordName.metricName. The recordName is typically duplicative
@@ -229,6 +255,12 @@ public abstract class CollectDPluginParent {
metric.append("sys.").append(plugin).append(PERIOD).append(type);
addTag(tagMap, INSTANCE, typeInstance.replaceAll(" ", "_"));
break;
case "load":
metric.append("sys.load.").append(plugin).append(PERIOD).append(type);
// plugin returns 1 min, 5 min, 15 min averages, but Timely can
// downsample on its own so we only use the first (1 min) value
vl.setValues(Arrays.asList(vl.getValues().get(0)));
break;
case "GenericJMX":
metric.append("sys.").append(plugin).append(PERIOD).append(type).append(PERIOD).append(typeInstance);
String[] pluginInstanceSplit = pluginInstance.split("-");
@@ -238,6 +270,7 @@ public abstract class CollectDPluginParent {
if (pluginInstanceSplit.length > 1) {
addTag(tagMap, NAME, pluginInstanceSplit[1].replaceAll(" ", "_"));
}
break;
default:
if (notEmpty(type) && notEmpty(typeInstance) && notEmpty(plugin) && notEmpty(pluginInstance)) {
metric.append("sys.").append(plugin).append(PERIOD).append(type).append(PERIOD).append(typeInstance);
@@ -264,9 +297,15 @@ public abstract class CollectDPluginParent {
}
Double value = vl.getValues().get(i).doubleValue();
String tagString = tagMap.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining(" "));
String datapoint = MessageFormat.format(PUT, metricName, timestamp.toString(), value.toString(), tagString);
logDebug(String.format("Writing: %s", datapoint));
write(datapoint + "\n", out);
if (metricName.isBlank() || timestamp == null || value == null) {
logDebug(String.format("Not writing unhandled metric: plugin:%s pluginInstance:%s type:%s typeInstance:%s", plugin, pluginInstance, type,
typeInstance));
} else {
String datapoint = MessageFormat.format(PUT, metricName, timestamp.toString(), value.toString(), tagString);
logDebug(String.format("Writing: %s", datapoint));
write(datapoint + "\n", out);
}
}
}
@@ -317,5 +356,4 @@ public abstract class CollectDPluginParent {
private boolean notEmpty(String arg) {
return (null != arg) && !(arg.equals(""));
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>timely</groupId>
<artifactId>timely</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>collectd-timely-plugin</artifactId>
<dependencies>
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>timely</groupId>
<artifactId>timely</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>timely-common</artifactId>
<dependencies>
@@ -32,7 +32,7 @@ public class QueryRequest extends AuthenticatedRequest implements HttpGetRequest
private boolean counter = false;
private long counterMax = 0;
private long resetValue = 0;
private Optional<String> interval = Optional.empty();
private String interval = null;
public RateOption() {}
@@ -85,11 +85,11 @@ public class QueryRequest extends AuthenticatedRequest implements HttpGetRequest
this.resetValue = resetValue;
}
public Optional<String> getInterval() {
public String getInterval() {
return interval;
}
public void setInterval(Optional<String> interval) {
public void setInterval(String interval) {
this.interval = interval;
}
@@ -221,7 +221,7 @@ public class QueryRequest extends AuthenticatedRequest implements HttpGetRequest
private String aggregator;
private String metric;
private boolean rate = false;
private RateOption rateOptions = null;
private RateOption rateOptions = new RateOption();
private Optional<String> downsample = Optional.empty();
private Map<String,String> tags = new LinkedHashMap<>();
private Collection<Filter> filters = new ArrayList<>();
@@ -547,7 +547,7 @@ public class QueryRequest extends AuthenticatedRequest implements HttpGetRequest
options.setCounter(rateOptions[x].endsWith("counter"));
break;
case 1:
options.setInterval(Optional.of(rateOptions[x]));
options.setInterval(rateOptions[x]);
break;
case 2:
options.setCounterMax(Long.parseLong(rateOptions[x]));
@@ -24,6 +24,7 @@ public class TimelyProperties {
private int instance = 1;
private int portIncrement = 100;
private String defaultVisibility = null;
private int tagFilterCacheSize = 10000;
public boolean isTest() {
return test;
@@ -91,4 +92,12 @@ public class TimelyProperties {
this.metricsReportIgnoredTags = metricsReportIgnoredTags;
return this;
}
public void setTagFilterCacheSize(int tagFilterCacheSize) {
this.tagFilterCacheSize = tagFilterCacheSize;
}
public int getTagFilterCacheSize() {
return tagFilterCacheSize;
}
}
+2 -1
View File
@@ -7,6 +7,7 @@ import java.util.stream.Stream;
import org.apache.commons.lang3.builder.CompareToBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
@@ -90,7 +91,7 @@ public class Tag implements Comparable<Tag>, Serializable {
@Override
public int hashCode() {
return this.toString().hashCode();
return new HashCodeBuilder().append(this.key).append(this.value).toHashCode();
}
@Override
+3 -3
View File
@@ -7,9 +7,9 @@
</formats>
<fileSets>
<fileSet>
<directory>timely-app/dist</directory>
<outputDirectory>timely-app</outputDirectory>
<directory>timely-datasource/dist</directory>
<outputDirectory>timely-datasource</outputDirectory>
</fileSet>
</fileSets>
<includeBaseDirectory>false</includeBaseDirectory>
</assembly>
</assembly>
+2 -2
View File
@@ -4,9 +4,9 @@
<parent>
<groupId>timely</groupId>
<artifactId>timely</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.6-SNAPSHOT</version>
</parent>
<artifactId>timely-app</artifactId>
<artifactId>timely-datasource</artifactId>
<packaging>pom</packaging>
<build>
<plugins>
-2
View File
@@ -1,2 +0,0 @@
node_modules/
-3
View File
@@ -1,3 +0,0 @@
module.exports = {
...require('@grafana/toolkit/src/config/prettier.plugin.config.json'),
};
-18
View File
@@ -1,18 +0,0 @@
//+build mage
package main
import (
"fmt"
// mage:import
_ "github.com/grafana/grafana-plugin-sdk-go/build"
)
// CheckCheck builds production back-end components.
func CheckCheck() {
fmt.Println("hello! TODO.... (the other commands are imported)")
}
// Default configures the default target.
var Default = CheckCheck
-6
View File
@@ -1,6 +0,0 @@
# Timely Data Source Plugin
Timely is a time series database application that provides secure access to time
series data. Timely is written in Java, uses
[Apache Accumulo](https://accumuloProperties.apache.org/) for backend storage, and has
a configurable length memory cache.
-26
View File
@@ -1,26 +0,0 @@
# Test against the latest version of this Node.js version
environment:
nodejs_version: '10'
# Local NPM Modules
cache:
- node_modules
# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install modules
- npm install -g yarn --quiet
- yarn install --pure-lockfile
# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# Run the build
build_script:
- yarn dev # This will also run prettier!
- yarn build # make sure both scripts work
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="jest tests" tests="1" failures="0" time="1.179">
<testsuite name="placeholder test" errors="0" failures="0" skipped="0" timestamp="2021-10-22T20:15:17" time="0.552" tests="1">
<testcase classname="placeholder test should return true" name="placeholder test should return true" time="0.003">
</testcase>
</testsuite>
</testsuites>
-6
View File
@@ -1,6 +0,0 @@
# Timely Data Source Plugin
Timely is a time series database application that provides secure access to time
series data. Timely is written in Java, uses
[Apache Accumulo](https://accumulo.apache.org/) for backend storage, and has
a configurable length memory cache.
-2
View File
@@ -1,2 +0,0 @@
define((function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=71)}({71:function(e,t,n){}})}));
//# sourceMappingURL=dark.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["webpack:///webpack/bootstrap"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s"],"mappings":"sCACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,IAIjBlC,EAAoBA,EAAoBmC,EAAI,I","file":"dark.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 71);\n"],"sourceRoot":""}
-2
View File
@@ -1,2 +0,0 @@
define((function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=70)}({70:function(e,t,n){}})}));
//# sourceMappingURL=light.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["webpack:///webpack/bootstrap"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s"],"mappings":"sCACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,IAIjBlC,EAAoBA,EAAoBmC,EAAI,I","file":"light.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 70);\n"],"sourceRoot":""}
-3
View File
@@ -1,3 +0,0 @@
/*! For license information please see module.js.LICENSE.txt */
define(["react","@grafana/ui","react-dom","lodash","@grafana/runtime","@grafana/data"],(function(e,t,n,r,o,i){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=72)}([function(t,n){t.exports=e},function(e,t,n){e.exports=n(48)()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var s in r)n.call(r,s)&&r[s]&&e.push(s);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,n){e.exports=t},function(e,t,n){var r=n(50);e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0},,function(e,t){e.exports=n},function(e,t){e.exports=r},function(e,t){e.exports=o},function(e,t,n){"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;0!=o--;){var a=i[o];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o,i,a,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,o,i,a,s],c=0;(l=new Error(t.replace(/%s/g,(function(){return u[c++]})))).name="Invariant Violation"}throw l.framesToPop=1,l}}},function(e,t,n){"use strict";var r=n(26),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,l=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),u=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===i.call(o)&&r())&&(l?s(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},c=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);o&&(i=a.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s<i.length;s+=1)u(e,i[s],t[i[s]],n[i[s]])};c.supportsDescriptors=!!l,e.exports=c},function(e,t,n){"use strict";var r=function(){};e.exports=r},function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return r}))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeoLine truncated
//# sourceMappingURL=module.js.map
-87
View File
@@ -1,87 +0,0 @@
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/**
* A better abstraction over CSS.
*
* @copyright Oleg Isonen (Slobodskoi) / Isonen 2014-present
* @website https://github.com/cssinjs/jss
* @license MIT
*/
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**!
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.16.1
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**!
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.16.1-lts
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///../node_modules/prop-types/index.js","webpack:///../node_modules/@babel/runtime/helpers/assertThisInitialized.js","webpack:///../node_modules/@babel/runtime/helpers/defineProperty.js","webpack:///../node_modules/@babel/runtime/helpers/extends.js","webpack:///../node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js","webpack:///../node_modules/classnames/index.js","webpack:///external \"@grafana/ui\"","webpack:///../node_modules/@babel/runtime/helpers/inheritsLoose.js","webpack:///external \"react-dom\"","webpack:///external \"lodash\"","webpack:///external \"@grafana/runtime\"","webpack:///../node_modules/fast-deep-equal/index.js","webpack:///../node_modules/invariant/browser.js","webpack:///../node_modules/define-properties/index.js","webpack:///../node_modules/warning/warning.js","webpack:///../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","webpack:///../node_modules/webpack/buildin/global.js","webpack:///../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","webpack:///../node_modules/function-bind/index.js","webpack:///../node_modules/call-bind/index.js","webpack:///../node_modules/popper.js/dist/esm/popper.js","webpack:///../node_modules/@hypnosphi/create-react-context/lib/index.js","webpack:///../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","webpack:///../node_modules/object-keys/index.js","webpack:///../node_modules/object-keys/isArguments.js","webpack:///../node_modules/call-bind/callBound.js","webpack:///../node_modules/get-intrinsic/index.js","webpack:///../node_modules/has-symbols/shams.js","webpack:///../node_modules/object-is/implementation.js","webpack:///../node_modules/object-is/polyfill.js","webpack:///../node_modules/regexp.prototype.flags/implementation.js","webpack:///../node_modules/regexp.prototype.flags/polyfill.js","webpack:///../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js","webpack:///../node_modules/css-loader/dist/runtime/api.js","webpack:///external \"@grafana/data\"","webpack:///../node_modules/dayjs/dayjs.min.js","webpack:///../node_modules/lodash.debounce/index.js","webpack:///../node_modules/deep-equal/index.js","webpack:///../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","webpack:///../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack:///../node_modules/@babel/runtime/helpers/esm/iterableToArray.js","webpack:///../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","webpack:///../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","webpack:///../node_modules/@material-ui/core/node_modules/popper.js/dist/esm/popper.js","webpack:///../node_modules/prop-types/factoryWithThrowingShims.js","webpack:///../node_modules/prop-types/lib/ReactPropTypesSecret.js","webpack:///../node_modules/@babel/runtime/helpers/setPrototypeOf.js","webpack:///../node_modules/object-keys/implementation.js","webpack:///../node_modules/is-arguments/index.js","webpack:///../node_modules/has-symbols/index.js","webpack:///../node_modules/function-bind/implementation.js","webpack:///../node_modules/has/src/index.js","webpack:///../node_modules/object-is/index.js","webpack:///../node_modules/object-is/shim.js","webpack:///../node_modules/is-regex/index.js","webpack:///../node_modules/regexp.prototype.flags/index.js","webpack:///../node_modules/regexp.prototype.flags/shim.js","webpack:///../node_modules/is-date-object/index.js","webpack:///../node_modules/@hypnosphi/create-react-context/lib/implementation.js","webpack:///../node_modules/gud/index.js","webpack:///../node_modules/react-is/index.js","webpack:///../node_modules/react-is/cjs/react-is.production.min.js","webpack:///./static/css/timely-bootstrap.css?617f","webpack:///./static/css/timely-bootstrap.css","webpack:///./static/css/timely.css?f98e","webpack:///./static/css/timely.css","webpack:///../node_modules/tslib/tslib.es6.js","webpack:///../node_modules/rxjs/dist/esm5/internal/util/isFunction.js","webpack:///../node_modules/rxjs/dist/esm5/internal/util/lift.js","webpack:///../node_modules/rxjs/node_modules/tslib/tslib.es6.js","webpack:///../node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js","webpack:///../node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js","webpack:///../node_modules/rxjs/dist/esm5/internal/util/arrRemove.js","webpack:///../node_modules/rxjs/dist/esm5/internal/Subscription.js","webpack:///../node_modules/rxjs/dist/esm5/internal/config.js","webpack:///../node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js","webpack:///../node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js","webpack:///../node_modules/rxjs/dist/esm5/internal/util/noop.js","webpack:///../node_modules/rxjs/dist/esm5/internal/NotificationFactories.js","webpack:///../node_modules/rxjs/dist/esm5/internal/util/errorContext.js","webpack:///../node_modules/rxjs/dist/esm5/inteLine truncated
-40
View File
@@ -1,40 +0,0 @@
{
"type": "datasource",
"name": "Timely",
"id": "nsa-timely-datasource",
"category": "tsdb",
"metrics": true,
"backend": true,
"alerting": true,
"executable": "timely_datasource_backend",
"info": {
"description": "Open source time series database backed by Accumulo",
"author": {
"name": "National Security Agency"
},
"keywords": ["Simple"],
"logos": {
"small": "static/img/timely_square_small.png",
"large": "static/img/timely_square_large.png"
},
"links": [
{
"name": "Website",
"url": "https://code.nsa.gov/timely"
},
{
"name": "License",
"url": "https://github.com/NationalSecurityAgency/timely/blob/master/LICENSE"
}
],
"screenshots": [],
"version": "2.1.4-SNAPSHOT",
"updated": "2024-03-13"
},
"dependencies": {
"classnames": "2.2.6",
"slate-plain-serializer": "0.7.10",
"grafanaVersion": "6.5.x",
"plugins": []
}
}
@@ -1,54 +0,0 @@
$box-shadow-dimensions: 0 0 0 0.2rem;
$placeholder-color: #6c757d;
.rbt {
&-input-multi {
// Bootstrap 4 focus style
&.focus {
background-color: #fff;
border-color: #80bdff;
box-shadow: $box-shadow-dimensions rgba(0, 123, 255, 0.25);
color: #495057;
outline: 0;
}
&.is-invalid.focus {
border-color: #dc3545;
box-shadow: $box-shadow-dimensions rgba(220, 53, 69, 0.25);
}
&.is-valid.focus {
border-color: #28a745;
box-shadow: $box-shadow-dimensions rgba(40, 167, 69, 0.25);
}
input {
// Firefox
&::-moz-placeholder {
color: $placeholder-color;
opacity: 1;
}
// Internet Explorer 10+
&:-ms-input-placeholder {
color: $placeholder-color;
}
// Safari and Chrome
&::-webkit-input-placeholder {
color: $placeholder-color;
}
}
// Override height in main CSS file :/
& .rbt-input-main,
&.form-control-lg .rbt-input-main,
&.form-control-sm .rbt-input-main {
height: auto;
}
}
&-token {
margin: 1px 3px 2px 0;
}
}
-201
View File
@@ -1,201 +0,0 @@
.rbt .rbt-input-main::-ms-clear {
display: none !important;
}
/**
* Menu
*/
.rbt-menu {
margin-bottom: 2px !important;
}
.rbt-menu > .dropdown-item {
overflow: hidden !important;
text-overflow: ellipsis !important;
}
.rbt-menu > .dropdown-item:focus {
outline: none !important;
}
.rbt-menu-pagination-option {
text-align: center !important;
}
/**
* Multi-select Input
*/
.rbt-input-multi {
cursor: text !important;
overflow: hidden !important;
position: relative !important;
}
.rbt-input-multi.focus {
border-color: #80bdff !important;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
color: #495057 !important;
outline: 0 !important;
}
.rbt-input-multi.form-control {
height: auto !important;
}
.rbt-input-multi.form-control[disabled] {
background-color: #e9ecef !important;
opacity: 1 !important;
}
.rbt-input-multi.is-invalid.focus {
border-color: #dc3545 !important;
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}
.rbt-input-multi.is-valid.focus {
border-color: #28a745 !important;
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}
.rbt-input-multi input::-moz-placeholder {
color: #6c757d !important;
opacity: 1 !important;
}
.rbt-input-multi input:-ms-input-placeholder {
color: #6c757d !important;
}
.rbt-input-multi input::-webkit-input-placeholder {
color: #6c757d !important;
}
.rbt-input-multi .rbt-input-wrapper {
align-items: flex-start !important;
display: flex !important;
flex-wrap: wrap !important;
margin-bottom: -4px !important;
margin-top: -1px !important;
overflow: hidden !important;
}
.rbt-input-multi .rbt-input-main {
margin: 1px 0 4px !important;
}
/**
* Close Button
*/
.rbt-close {
z-index: 1 !important;
}
.rbt-close-lg {
font-size: 24px !important;
}
/**
* Token
*/
.rbt-token {
background-color: #e7f4ff !important;
border: 0 !important;
border-radius: 0.25rem !important;
color: #007bff !important;
display: inline-block !important;
line-height: 1em !important;
margin: 1px 3px 2px 0 !important;
padding: 4px 7px !important;
position: relative !important;
}
.rbt-token-disabled {
background-color: rgba(0, 0, 0, 0.1) !important;
color: #495057 !important;
pointer-events: none !important;
}
.rbt-token-removeable {
cursor: pointer !important;
padding-right: 21px !important;
}
.rbt-token-active {
background-color: #007bff !important;
color: #fff !important;
outline: none !important;
text-decoration: none !important;
}
.rbt-token .rbt-token-remove-button {
bottom: 0 !important;
color: inherit !important;
font-size: inherit !important;
font-weight: normal !important;
opacity: 1 !important;
outline: none !important;
padding: 3px 7px !important;
position: absolute !important;
right: 0 !important;
text-shadow: none !important;
top: -2px !important;
}
/**
* Loader + CloseButton container
*/
.rbt-aux {
align-items: center !important;
display: flex !important;
bottom: 0 !important;
justify-content: center !important;
pointer-events: none !important;
/* Don't block clicks on the input */
position: absolute !important;
right: 0 !important;
top: 0 !important;
width: 34px !important;
}
.rbt-aux-lg {
width: 46px !important;
}
.rbt-aux .rbt-close {
margin-top: -4px !important;
pointer-events: auto !important;
/* Override pointer-events: none; above */
}
.has-aux .rbt-input {
padding-right: 34px !important;
}
.rbt-highlight-text {
background-color: inherit !important;
color: inherit !important;
font-weight: bold !important;
padding: 0 !important;
}
/**
* Input Groups
*/
.input-group > .rbt {
flex: 1 !important;
}
.input-group > .rbt .rbt-input-hint,
.input-group > .rbt .rbt-aux {
z-index: 5 !important;
}
.input-group > .rbt:not(:first-child) .form-control {
border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;
}
.input-group > .rbt:not(:last-child) .form-control {
border-top-right-radius: 0 !important;
border-bottom-right-radius: 0 !important;
}
-240
View File
@@ -1,240 +0,0 @@
$animation: loader-animation 600ms infinite linear;
$inset: inset 0 1px 1px rgba(0, 0, 0, 0.075);
$placeholder-color: #999;
.rbt {
&-menu {
margin-bottom: 2px; // Spacing for dropup
& > li a {
overflow: hidden;
text-overflow: ellipsis;
&:focus {
outline: none;
}
}
&-pagination-option {
text-align: center;
}
}
// Hide IE's native "clear" button
& .rbt-input-main::-ms-clear {
display: none;
}
&-input-multi {
cursor: text;
overflow: hidden;
position: relative;
height: auto;
// Apply Bootstrap focus styles
&.focus {
box-shadow: $inset, 0 0 8px rgba(102, 175, 233, 0.6);
border-color: #66afe9;
outline: 0;
}
// BS4 uses the :disabled pseudo-class, which doesn't work with non-inputs.
&.form-control[disabled] {
background-color: #e9ecef;
opacity: 1;
}
// Apply Bootstrap placeholder styles
input {
// Firefox
&::-moz-placeholder {
color: $placeholder-color;
opacity: 1;
}
// Internet Explorer 10+
&:-ms-input-placeholder {
color: $placeholder-color;
}
// Safari and Chrome
&::-webkit-input-placeholder {
color: $placeholder-color;
}
}
.rbt-input-wrapper {
align-items: flex-start;
display: flex;
flex-wrap: wrap;
margin-bottom: -4px;
margin-top: -1px;
overflow: hidden;
}
.rbt-input-main {
// Set input height for cross-browser consistency
height: 20px;
margin: 1px 0 4px;
}
&.input,
&.form-control {
&-lg {
.rbt-input-main {
height: 24px;
}
}
&-sm {
.rbt-input-main {
height: 18px;
}
}
}
}
&-close {
z-index: 1;
&-lg {
font-size: 24px;
}
}
&-token {
background-color: #e7f4ff;
border: 0;
border-radius: 2px;
color: #1f8dd6;
display: inline-block;
line-height: 1em;
margin: 0 3px 3px 0;
padding: 4px 7px;
position: relative;
&-disabled {
background-color: #ddd;
color: #888;
pointer-events: none;
}
&-removeable {
cursor: pointer;
padding-right: 21px;
}
&-active {
background-color: #1f8dd6;
color: #fff;
outline: none;
text-decoration: none;
}
& &-remove-button {
bottom: 0;
color: inherit;
font-size: inherit;
font-weight: normal;
opacity: 1;
outline: none;
padding: 3px 7px;
position: absolute;
right: 0;
text-shadow: none;
top: -2px;
}
}
&-loader {
-moz-animation: $animation;
-webkit-animation: $animation;
animation: $animation;
border: 1px solid #d5d5d5;
border-radius: 50%;
border-top-color: #1f8dd6;
display: block;
height: 16px;
width: 16px;
&-lg {
height: 20px;
width: 20px;
}
}
&-aux {
align-items: center;
display: flex;
bottom: 0;
justify-content: center;
pointer-events: none; /* Don't block clicks on the input */
position: absolute;
right: 0;
top: 0;
width: 34px;
&-lg {
width: 46px;
}
& .rbt-close {
margin-top: -4px;
pointer-events: auto; /* Override pointer-events: none; above */
}
}
.has-aux &-input {
padding-right: 34px;
}
&-highlight-text {
background-color: inherit;
color: inherit;
font-weight: bold;
padding: 0;
}
}
/* Input Groups */
.input-group > .rbt {
flex: 1;
// Form-controls within input-groups have a higher z-index.
& .rbt-input-hint,
& .rbt-aux {
z-index: 5;
}
&:not(:first-child) .form-control {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
&:not(:last-child) .form-control {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
/* Validation States */
.has-error .rbt-input-multi.focus {
border-color: #843534;
box-shadow: $inset, 0 0 6px #ce8483;
}
.has-warning .rbt-input-multi.focus {
border-color: #66512c;
box-shadow: $inset, 0 0 6px #c0a16b;
}
.has-success .rbt-input-multi.focus {
border-color: #2b542c;
box-shadow: $inset, 0 0 6px #67b168;
}
@keyframes loader-animation {
to {
transform: rotate(1turn);
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
-1
View File
@@ -1 +0,0 @@
div.timely .dropdown-item,div.timely .dropdown-item-text,div.timely input.form-control{color:#c7d0d9;background-color:#0b0c0e}.dropdown-item:active,.dropdown-item:focus,div.timely .dropdown-item.active,div.timely .dropdown-item:hover{background-color:#4f5255}.dropdown-item:disabled,div.timely .dropdown-header,div.timely .dropdown-item.disabled{color:#0b0c0e}div.timely .dropdown-menu{background-color:#0b0c0e;box-shadow:0 2px 2px 2px #31343b}div.timely input.form-control:focus{color:#c7d0d9;outline:0;box-shadow:0 0 0 2px #141619,0 0 0 4px #1f60c4;outline-offset:2px;transition:all .2s cubic-bezier(.19,1,.22,1) 0s}div.timely mark.rbt-highlight-text{background:linear-gradient(90deg,#56585c,#4c5057);color:#ff0}
-1
View File
@@ -1 +0,0 @@
div.timely input.form-control{color:#464c54;background-color:#fff}div.timely .dropdown-item,div.timely .dropdown-item-text{color:#464c54}.dropdown-item:active,.dropdown-item:focus,div.timely .dropdown-item.active,div.timely .dropdown-item:hover{color:#464c54;background-color:#e3e6e9}.dropdown-item:disabled,div.timely .dropdown-item.disabled{color:#abadaf}div.timely .dropdown-header{color:#464c54}div.timely .dropdown-menu{box-shadow:0 4px 2px 0 #cbcbcb}div.timely input.form-control:focus{color:#464c54;outline:0;box-shadow:0 0 0 2px #fff,0 0 0 4px #5794f2;outline-offset:2px;transition:all .2s cubic-bezier(.19,1,.22,1) 0s}div.timely mark.rbt-highlight-text{background:linear-gradient(90deg,#bfc0c1,#abadaf);color:#ff0}
-96
View File
@@ -1,96 +0,0 @@
module github.com/NationalSecurityAgency/timely-datasource
go 1.21
toolchain go1.22.1
require (
github.com/grafana/grafana-plugin-sdk-go v0.218.0
github.com/hashicorp/go-hclog v1.6.2
)
require (
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/apache/arrow/go/v15 v15.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cheekybits/genny v1.0.0 // indirect
github.com/chromedp/cdproto v0.0.0-20220208224320-6efb837e6bc2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/elazarl/goproxy v0.0.0-20230731152917-f99041a5c027 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/getkin/kin-openapi v0.120.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/flatbuffers v23.5.26+incompatible // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/magefile/mage v1.15.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattetti/filebuffer v1.0.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.46.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8 // indirect
github.com/unknwon/com v1.0.1 // indirect
github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3 // indirect
github.com/urfave/cli v1.22.14 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.49.0 // indirect
go.opentelemetry.io/contrib/propagators/jaeger v1.22.0 // indirect
go.opentelemetry.io/contrib/samplers/jaegerremote v0.18.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/fsnotify/fsnotify.v1 v1.4.7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
-8
View File
@@ -1,8 +0,0 @@
// This file is needed because it is used by vscode and other tools that
// call `jest` directly. However, unless you are doing anything special
// do not edit this file
const standard = require('@grafana/toolkit/src/config/jest.plugin.config');
// This process will use the same config that `yarn test` is using
module.exports = standard.jestConfig();
-42
View File
@@ -1,42 +0,0 @@
{
"name": "timely-datasource",
"version": "2.1.4-SNAPSHOT",
"description": "Timely",
"backend": true,
"alerting": true,
"executable": "timely_datasource_backend",
"scripts": {
"build": "grafana-toolkit plugin:build",
"test": "grafana-toolkit plugin:test",
"dev": "grafana-toolkit plugin:dev",
"watch": "grafana-toolkit plugin:dev --watch"
},
"author": "Grafana Labs",
"license": "Apache-2.0",
"devDependencies": {
"@grafana/toolkit": "^8.4.5"
},
"engines": {
"node": ">=12 <17"
},
"dependencies": {
"@grafana/data": "^8.4.5",
"@grafana/runtime": "^8.4.5",
"@grafana/slate-react": "0.22.10-grafana",
"@grafana/ui": "^8.4.5",
"@material-ui/core": "^4.12.3",
"@types/classnames": "2.3.1",
"@types/lodash": "4.14.176",
"@types/react-bootstrap-typeahead": "5.1.8",
"@types/slate-plain-serializer": "0.7.1",
"@types/slate-react": "0.50.1",
"classnames": "2.3.1",
"dayjs": "1.10.7",
"react-bootstrap-typeahead": "5.1.1",
"rxjs": "7.3.0",
"slate-plain-serializer": "0.7.13",
"tmpl": "1.0.5",
"tslib": "^2.3.1",
"ws": "5.2.3"
}
}
-102
View File
@@ -1,102 +0,0 @@
package main
type TimelyQueryForm struct {
Metric string `json:"metric"`
Alias string `json:"alias"`
Aggregator string `json:"aggregator"`
DisableDownsampling bool `json:"disableDownsampling"`
DownsampleAggregator string `json:"downsampleAggregator"`
DownsampleFillPolicy string `json:"downsampleFillPolicy"`
DownsampleInterval string `json:"downsampleInterval"`
Tags map[string]string `json:"tags"`
Filters []Filter `json:"filters"`
ShouldComputeRate bool `json:"shouldComputeRate"`
RateInterval string `json:"rateInterval"`
IsCounter bool `json:"isCounter"`
CounterMax string `json:"counterMax"`
CounterResetValue string `json:"counterResetValue"`
Tsuids []string `json:"tsuids"`
QueryType string `json:"queryType"`
RefId string `json:"refId"`
Datasource string `json:"datasource"`
DatasourceId int64 `json:"datasourceId"`
IntervalMs int64 `json:"intervalMs"`
MaxDataPoints int64 `json:"maxDataPoints"`
OrgId int64 `json:"ordId"`
}
type TimelyQueryServer struct {
Metric string `json:"metric"`
Aggregator string `json:"aggregator"`
DisableDownsampling bool `json:"disableDownsampling"`
DownsampleAggregator string `json:"downsampleAggregator"`
DownsampleFillPolicy string `json:"downsampleFillPolicy"`
DownsampleInterval string `json:"downsampleInterval"`
Tags map[string]string `json:"tags"`
Filters []Filter `json:"filters"`
ShouldComputeRate bool `json:"shouldComputeRate"`
RateInterval string `json:"rateInterval"`
IsCounter bool `json:"isCounter"`
CounterMax string `json:"counterMax"`
CounterResetValue string `json:"counterResetValue"`
Tsuids []string `json:"tsuids"`
QueryType string `json:"queryType"`
RefId string `json:"refId"`
}
type Filter struct {
Type string `json:"type"`
TagK string `json:"tagk"`
Filter string `json:"filter"`
GroupBy bool `json:"groupBy"`
}
type RateOptions struct {
Interval int32 `json:"interval"`
Counter bool `json:"counter"`
CounterMax int32 `json:"counterMax"`
ResetValue int32 `json:"resetValue"`
}
type TimelyQuery struct {
Metric string `json:"metric"`
Aggregator string `json:"aggregator"`
Rate bool `json:"rate"`
RateOptions RateOptions `json:"rateOptions"`
Downsample string `json:"downsample"`
Tags map[string]string `json:"tags"`
Filters []Filter `json:"filters"`
Tsuids []string `json:"tsuids"`
}
type TimelyRequest struct {
MsResolution bool `json:"msResolution"`
GlobalAnnotations bool `json:"globalAnnotations"`
Start int64 `json:"start"`
End int64 `json:"end"`
Queries []TimelyQuery `json:"queries"`
}
type TimelyResponse struct {
Metric string `json:"metric"`
Tags map[string]string `json:"tags"`
AggregatedTags []string `json:"aggregatedTags"`
DataPoints map[int64]float64 `json:"dps"`
}
type TimelyDataSourceOptions struct {
TimelyHost string `json:"timelyHost"`
HttpsPort string `json:"httpsPort"`
OauthPassThru bool `json:"oauthPassThru"`
UseClientCertWhenOAuthMissing bool `json:"useClientCertWhenOAuthMissing"`
ClientCertificatePath string `json:"clientCertificatePath"`
ClientKeyPath string `json:"clientKeyPath"`
CertificateAuthorityPath string `json:"certificateAuthorityPath"`
AllowInsecureSsl bool `json:"allowInsecureSsl"`
}
type TimelyErrorResponse struct {
ResponseCode int32 `json:responseCode`
Message string `json:message`
DetailMessage string `json:detailMessage`
}
-183
View File
@@ -1,183 +0,0 @@
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
import { LegacyForms } from '@grafana/ui';
import { TimelyDataSourceOptions } from './types';
import * as React from 'react';
const { FormField, Switch } = LegacyForms;
interface Props extends DataSourcePluginOptionsEditorProps<TimelyDataSourceOptions> {}
interface State {}
export class ConfigEditor extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
}
onTimelyHostChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const { onOptionsChange, options } = this.props;
const jsonData = {
...options.jsonData,
timelyHost: event.target.value,
};
onOptionsChange({ ...options, jsonData });
};
onHttpsPortChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const { onOptionsChange, options } = this.props;
const jsonData = {
...options.jsonData,
httpsPort: event.target.value,
};
onOptionsChange({ ...options, jsonData });
};
onUseOAuthChange = (event: React.SyntheticEvent<HTMLInputElement>) => {
const { onOptionsChange, options } = this.props;
const jsonData = {
...options.jsonData,
oauthPassThru: event.currentTarget.checked,
};
onOptionsChange({ ...options, jsonData });
};
onUseClientCertWhenOAuthMissingChange = (event: React.SyntheticEvent<HTMLInputElement>) => {
const { onOptionsChange, options } = this.props;
const jsonData = {
...options.jsonData,
useClientCertWhenOAuthMissing: event.currentTarget.checked,
};
onOptionsChange({ ...options, jsonData });
};
onClientCertificatePathChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const { onOptionsChange, options } = this.props;
const jsonData = {
...options.jsonData,
clientCertificatePath: event.target.value,
};
onOptionsChange({ ...options, jsonData });
};
onClientKeyPathChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const { onOptionsChange, options } = this.props;
const jsonData = {
...options.jsonData,
clientKeyPath: event.target.value,
};
onOptionsChange({ ...options, jsonData });
};
onCertificateAuthorityPathChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const { onOptionsChange, options } = this.props;
const jsonData = {
...options.jsonData,
certificateAuthorityPath: event.target.value,
};
onOptionsChange({ ...options, jsonData });
};
onAllowInsecureSslChange = (event: React.SyntheticEvent<HTMLInputElement>) => {
const { onOptionsChange, options } = this.props;
const jsonData = {
...options.jsonData,
allowInsecureSsl: event.currentTarget.checked,
};
onOptionsChange({ ...options, jsonData });
};
render() {
const { options } = this.props;
const { jsonData } = options;
return (
<div className="gf-form-group">
<div className="gf-form">
<FormField
label={'Hostname or IP'}
labelWidth={10}
inputWidth={20}
disabled={false}
onChange={this.onTimelyHostChange}
tooltip={'Hostname or IP of Timely Server'}
value={jsonData.timelyHost || ''}
placeholder={'localhost'}
/>
</div>
<div className="gf-form">
<FormField
label={'Https port'}
labelWidth={10}
inputWidth={20}
onChange={this.onHttpsPortChange}
value={jsonData.httpsPort || ''}
placeholder={'4243'}
/>
</div>
<div className="gf-form">
<Switch
label={'Use OAuth token'}
labelClass="width-10"
tooltipPlacement={'top'}
tooltip={'Send OAuth token if available'}
checked={jsonData.oauthPassThru || false}
onChange={this.onUseOAuthChange}
/>
</div>
<div className="gf-form">
<Switch
label={'Client cert for users'}
labelClass="width-10"
tooltipPlacement={'top'}
tooltip={'If user is missing OAuth token, use client cert instead'}
checked={jsonData.useClientCertWhenOAuthMissing || false}
onChange={this.onUseClientCertWhenOAuthMissingChange}
/>
</div>
<div className="gf-form">
<FormField
label={'Client cert path'}
labelWidth={10}
inputWidth={30}
disabled={false}
onChange={this.onClientCertificatePathChange}
tooltip={'Full path to client certificate'}
value={jsonData.clientCertificatePath || ''}
/>
</div>
<div className="gf-form">
<FormField
label={'Client key path'}
labelWidth={10}
inputWidth={30}
disabled={false}
onChange={this.onClientKeyPathChange}
tooltip={'Full path to client key'}
value={jsonData.clientKeyPath || ''}
/>
</div>
<div className="gf-form">
<FormField
label={'CA path'}
labelWidth={10}
inputWidth={30}
disabled={false}
onChange={this.onCertificateAuthorityPathChange}
tooltip={'Full path to certificate authority'}
value={jsonData.certificateAuthorityPath || ''}
/>
</div>
<div className="gf-form">
<Switch
label={'Allow insecure ssl'}
labelClass="width-10"
tooltipPlacement={'top'}
tooltip={'Allow ssl connection with unverified or self-signed certificates'}
checked={jsonData.allowInsecureSsl || false}
onChange={this.onAllowInsecureSslChange}
/>
</div>
</div>
);
}
}
-440
View File
@@ -1,440 +0,0 @@
import _ from 'lodash';
import { QueryEditorProps } from '@grafana/data';
import { Input, Select, LegacyForms } from '@grafana/ui';
import React, { Component } from 'react';
import { TimelyDataSource } from './TimelyDataSource';
import { TimelyDataSourceOptions, TimelyErrors, TimelyQueryForm } from './types';
import { SelectableValue } from '@grafana/data/types/select';
import dayjs from 'dayjs';
import { TagEditor } from './TagEditor';
import { AsyncTypeahead, TypeaheadModel } from 'react-bootstrap-typeahead';
const { Switch } = LegacyForms;
export type Props = QueryEditorProps<TimelyDataSource, TimelyQueryForm, TimelyDataSourceOptions>;
interface State {
aggregatorTypes: string[];
errors: TimelyErrors;
query: TimelyQueryForm;
queryOptionsLoading: boolean;
queryOptions: TypeaheadModel[];
}
export class QueryEditor extends Component<Props, State> {
metricArray: string[] = [];
constructor(props: Props) {
super(props);
const defaultQuery: Partial<TimelyQueryForm> = {
metric: '',
alias: '',
aggregator: 'none',
refId: 'A',
queryType: 'metricQuery',
disableDownsampling: false,
downsampleFillPolicy: 'none',
downsampleInterval: '1m',
downsampleAggregator: 'avg',
shouldComputeRate: false,
rateInterval: '1m',
isCounter: false,
tags: {},
};
this.state = {
aggregatorTypes: ['none', 'avg', 'dev', 'max', 'min', 'sum', 'count'],
errors: {
downsample: undefined,
},
query: Object.assign({}, defaultQuery, props.query),
queryOptionsLoading: false,
queryOptions: [],
};
this.getAggregators();
this.getMetrics();
}
shouldComponentUpdate(nextProps: Readonly<Props>, nextState: Readonly<State>, nextContext: any): boolean {
return true;
}
onMetricTextChange = (value: string) => {
this.setState((state, props) => {
var query = Object.assign(state.query, { metric: value });
this.updateQuery(query);
return { query: query };
});
};
onAliasChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
this.setState((state, props) => {
var query = Object.assign(state.query, { alias: value });
this.updateQuery(query);
return { query: query };
});
};
onAggregatorChange = (option: SelectableValue<string>) => {
if (option.value) {
const value = option.value;
this.setState((state, props) => {
var query = Object.assign(state.query, { aggregator: value });
this.updateQuery(query);
return { query: query };
});
}
};
onDownsampleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
this.setState((state, props) => {
var query = Object.assign(state.query, { downsampleInterval: value });
this.updateQuery(query);
return { query: query };
});
};
onDownsampleAggregatorChange = (option: SelectableValue<string>) => {
if (option.value) {
const value = option.value;
this.setState((state, props) => {
var query = Object.assign(state.query, { downsampleAggregator: value });
this.updateQuery(query);
return { query: query };
});
}
};
onDisableDownsamplingChange = (option: React.FormEvent<HTMLInputElement>) => {
const checked = option.currentTarget.checked;
this.setState((state, props) => {
var query = Object.assign(state.query, { disableDownsampling: checked });
this.updateQuery(query);
return { query: query };
});
};
onRateChange = (option: React.FormEvent<HTMLInputElement>) => {
const checked = option.currentTarget.checked;
this.setState((state, props) => {
var query = Object.assign(state.query, { shouldComputeRate: checked });
this.updateQuery(query);
return { query: query };
});
};
onRateIntervalChange = (option: React.FormEvent<HTMLInputElement>) => {
const value = e.target.value;
this.setState((state, props) => {
var query = Object.assign(state.query, { rateInterval: value });
this.updateQuery(query);
return { query: query };
});
};
onCounterChange = (option: React.FormEvent<HTMLInputElement>) => {
const checked = option.currentTarget.checked;
this.setState((state, props) => {
var query = Object.assign(state.query, { isCounter: checked });
this.updateQuery(query);
return { query: query };
});
};
onCounterMaxChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
this.setState((state, props) => {
var query = Object.assign(state.query, { counterMax: value });
this.updateQuery(query);
return { query: query };
});
};
onCounterResetValueChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
this.setState((state, props) => {
var query = Object.assign(state.query, { counterResetValue: value });
this.updateQuery(query);
return { query: query };
});
};
updateQuery = (query: TimelyQueryForm) => {
this.props.onChange(query);
this.props.onRunQuery();
};
updateQueryFromState = () => {
const query = this.state.query;
this.props.onChange(query);
this.props.onRunQuery();
};
validate = () => {
const { disableDownsampling, downsampleInterval } = this.state.query;
if (!disableDownsampling) {
try {
let valid = false;
if (downsampleInterval) {
valid = dayjs('', '').isValid();
}
if (!valid) {
this.setState((state, props) => {
this.setState(
{
errors: {
downsample: "You must supply a downsample interval (e.g. '1m' or '1h').",
},
},
this.updateQueryFromState
);
});
}
} catch (err) {
this.setState(
{
errors: {
downsample: "You must supply a downsample interval (e.g. '1m' or '1h').",
},
},
this.updateQueryFromState
);
}
}
};
getAggregators = () => {
this.props.datasource.getResource('/api/aggregators').then((result: any) => {
if (result && _.isArray(result)) {
this.setState({ aggregatorTypes: result }, this.updateQueryFromState);
}
});
};
getMetrics = () => {
this.props.datasource.getResource('/api/suggest', { type: 'metrics', max: '-1' }).then((result: any) => {
if (result && _.isArray(result)) {
const metrics: string[] = result;
this.metricArray = metrics
.map((value) => {
return value;
})
.concat();
}
});
};
updateTags = (tags: { [key: string]: string }) => {
this.setState((state, props) => {
var query = Object.assign(state.query, { tags: tags });
this.updateQuery(query);
return { query: query };
});
};
handleSearch = (query: string) => {
const results = this.metricArray
.filter((metric) => query === '' || metric.toLowerCase().includes(query.toLowerCase()))
.map((value) => {
return value;
});
this.setState({ queryOptions: results });
};
getInputValue = (id: string): string | null => {
var fullId = 'div#' + id + ' div div input.rbt-input-main';
var inputElement = document.querySelector(fullId);
if (inputElement !== null) {
return (inputElement as HTMLInputElement).value;
}
return null;
};
render() {
var queryEditorId = Math.random().toString(36).substr(2, 9);
const { metric, aggregator, alias } = this.state.query;
const { downsampleInterval, downsampleAggregator, disableDownsampling } = this.state.query;
const { tags } = this.state.query;
const { shouldComputeRate, rateInterval, isCounter, counterResetValue, counterMax } = this.state.query;
const aggregatorOptions: Array<{}> = _.map(this.state.aggregatorTypes, (value: string) => ({
label: value,
value: value,
}));
const { queryOptionsLoading, queryOptions } = this.state;
var multiplier = 7.5;
var metricWidth = 300;
if (metric !== undefined && metric!.length * multiplier > metricWidth) {
metricWidth = Math.ceil(metric!.length * multiplier);
}
var aliasWidth = 175;
if (alias !== undefined && alias!.length * multiplier > aliasWidth) {
aliasWidth = Math.ceil(alias!.length * multiplier);
}
var dynamicStyle =
'div.timely-query input.form-control, div#timelyQuery-' +
queryEditorId +
' { ' +
'width:' +
metricWidth +
'px!important ' +
'}';
dynamicStyle += '#timelyAlias-' + queryEditorId + ' { ' + 'width:' + aliasWidth + 'px!important ' + '}';
return (
<div className="timely-edior-row">
<div className="gf-form-inline">
<style>{dynamicStyle}</style>
<div className="gf-form timely">
<label className="gf-form-label width-10">Metric</label>
<div id={'timelyQuery-' + queryEditorId} className="timely timely-query">
<AsyncTypeahead
id={'timelyQuery-' + queryEditorId + '-Typeahead'}
inputProps={{ spellCheck: false }}
defaultInputValue={metric}
isLoading={queryOptionsLoading}
onSearch={(query) => {
this.setState({ queryOptionsLoading: true });
this.handleSearch(query);
this.setState({ queryOptionsLoading: false });
}}
onChange={(e) => {
var inputValue = this.getInputValue('timelyQuery-' + queryEditorId);
if (inputValue !== null) {
this.onMetricTextChange(inputValue);
}
}}
onBlur={(e) => {
var inputValue = this.getInputValue('timelyQuery-' + queryEditorId);
if (inputValue !== null) {
this.onMetricTextChange(inputValue);
}
}}
onFocus={(e) => {
var inputValue = this.getInputValue('timelyQuery-' + queryEditorId);
if (queryOptions.length === 0 || inputValue === null || inputValue.length === 0) {
this.handleSearch('');
}
}}
options={queryOptions}
selectHintOnEnter={true}
align={'left'}
allowNew={true}
newSelectionPrefix={''}
paginate={true}
paginationText={'more'}
minLength={0}
maxResults={100}
caseSensitive={false}
placeholder={'metric'}
/>
</div>
</div>
<div className="gf-form timely">
<label className="gf-form-label width-5">Alias</label>
<Input
id={'timelyAlias-' + queryEditorId}
className="min-width-10 flex-grow-1"
spellCheck={false}
value={alias || ''}
onChange={this.onAliasChange}
placeholder={'series alias'}
/>
</div>
</div>
<TagEditor tags={tags} parent={this} />
<div className="gf-form-inline">
<div className="gf-form timely">
<label className="gf-form-label width-10">Downsample</label>
<Input
className={'min-width-5 flex-grow-1'}
spellCheck={false}
value={downsampleInterval || ''}
onChange={this.onDownsampleChange}
placeholder={'downsample interval'}
/>
</div>
<div className="gf-form timely">
<label className="gf-form-label width-10">Downsample Aggregator</label>
<Select
className={'min-width-5 flex-grow-1'}
isSearchable={false}
options={aggregatorOptions}
value={downsampleAggregator}
placeholder={'aggregator'}
onChange={this.onDownsampleAggregatorChange}
menuPlacement={'bottom'}
/>
</div>
<div className="gf-form timely">
<Switch
label={'Disable downsampling'}
labelClass="width-10"
checked={disableDownsampling || false}
onChange={this.onDisableDownsamplingChange}
/>
</div>
</div>
<div className="gf-form-inline">
<div className="gf-form timely">
<label className="gf-form-label width-10">All Results Aggregator</label>
<Select
className={'min-width-5 flex-grow-1'}
isSearchable={false}
options={aggregatorOptions}
value={aggregator}
placeholder={'aggregator'}
onChange={this.onAggregatorChange}
menuPlacement={'bottom'}
/>
</div>
<div className="gf-form timely">
<Switch
label={'Rate'}
labelClass="width-5"
checked={shouldComputeRate || false}
onChange={this.onRateChange}
/>
<div hidden={!shouldComputeRate}>
<Input
className={'min-width-6 flex-grow-1'}
spellCheck={false}
value={rateInterval || ''}
onChange={this.onRateIntervalChange}
placeholder={'rate interval'}
/>
<Switch
label={'Counter'}
labelClass="width-10"
checked={isCounter || false}
onChange={this.onCounterChange}
/>
</div>
<div className="gf-form timely" hidden={!shouldComputeRate || !isCounter}>
<label className="gf-form-label width-10">Max Value</label>
<Input
className={'min-width-6 flex-grow-1'}
spellCheck={false}
value={counterMax || ''}
onChange={this.onCounterMaxChange}
placeholder={'max value'}
/>
<label className="gf-form-label width-10">Reset Value</label>
<Input
className={'min-width-6 flex-grow-1'}
spellCheck={false}
value={counterResetValue || ''}
onChange={this.onCounterResetValueChange}
placeholder={'reset value'}
/>
</div>
</div>
</div>
</div>
);
}
}
-519
View File
@@ -1,519 +0,0 @@
import React, { Component } from 'react';
import { QueryEditor } from './QueryEditor';
import { withStyles } from '@material-ui/core/styles';
import { Tooltip } from '@material-ui/core';
import { Icon } from '@grafana/ui';
import _ from 'lodash';
import { AsyncTypeahead, TypeaheadModel } from 'react-bootstrap-typeahead';
export interface Props {
tags: { [key: string]: string };
parent: QueryEditor;
}
interface State {
tags: Tag[];
tagKeyOptionsLoading: boolean;
tagKeyOptions: TypeaheadModel[];
tagValueOptionsLoading: boolean;
tagValueOptions: TypeaheadModel[];
}
interface Tag {
key: string;
value: string;
editing: boolean;
errors: string[] | undefined;
}
const HtmlTooltip = withStyles((theme) => ({
tooltip: {
backgroundColor: '#f5f5f9',
color: 'rgba(0, 0, 0, 0.87)',
maxWidth: 220,
fontSize: theme.typography.pxToRem(12),
border: '1px solid #dadde9',
},
}))(Tooltip);
export class TagEditor extends Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
tags: Object.entries(props.tags)
.map(([key, value]) => ({
key: key,
value: value,
editing: false,
errors: undefined,
}))
.concat(),
tagKeyOptionsLoading: false,
tagKeyOptions: [],
tagValueOptionsLoading: false,
tagValueOptions: [],
};
}
shouldComponentUpdate(nextProps: Readonly<Props>, nextState: Readonly<State>, nextContext: any): boolean {
return true;
}
validateTags = (tags: Tag[], tagNumber: number): boolean => {
var count = new Map<string, number>();
var anyErrors = false;
tags.forEach((tag) => {
var n = count.get(tag.key);
if (n === undefined) {
count.set(tag.key, 1);
} else {
count.set(tag.key, n! + 1);
}
});
var tagsToValidate: Tag[];
if (tagNumber === undefined) {
tagsToValidate = tags;
} else {
tagsToValidate = tags.filter((t, i) => i === tagNumber);
}
tagsToValidate.forEach((tag, i) => {
tag.errors = [];
if (tag.key.length > 0 && count.get(tag.key)! > 1) {
tag.errors.push("duplicate tag key '" + tag.key + "'");
anyErrors = true;
}
if (tag.key.length === 0) {
tag.errors.push('tag key can not be empty');
anyErrors = true;
}
if (tag.value.length === 0) {
tag.errors.push('tag value can not be empty');
anyErrors = true;
}
if (tag.errors.length === 0) {
tag.errors = undefined;
}
});
return anyErrors;
};
addTag = () => {
this.setState((state, props) => {
const stateTags = state.tags;
var tags = [
...stateTags,
{
key: '',
value: '',
editing: true,
errors: ['tag key can not be empty', 'tag value can not be empty'],
},
];
return { tags: tags };
});
};
removeTag = (tagNumber: number) => {
this.setState((state, props) => {
const tags = state.tags;
tags.splice(tagNumber, 1);
this.updateTags(tags);
return { tags: tags };
});
};
beginEdit = (tagNumber: number) => {
this.setState((state, props) => {
const tags = state.tags;
var tag = tags.filter((t, i) => i === tagNumber).pop();
if (tag !== undefined) {
tag.editing = true;
}
return { tags: tags };
});
};
endEdit = (tagNumber: number) => {
this.setState((state, props) => {
const tags = state.tags;
var tag = tags.filter((t, i) => i === tagNumber).pop();
if (tag !== undefined && this.validateTags(tags, tagNumber) === false) {
tag.editing = false;
this.updateTags(tags);
}
return { tags: tags };
});
};
updateTagKey = (tagNumber: number, newKey: string) => {
this.setState((state, props) => {
var tags = state.tags;
var tag = tags.filter((t, i) => i === tagNumber).pop();
if (tag !== undefined) {
tag.key = newKey;
}
this.validateTags(tags, tagNumber);
return { tags: tags };
});
};
updateTagValue = (tagNumber: number, newValue: string) => {
this.setState((state, props) => {
var tags = state.tags;
var tag = tags.filter((t, i) => i === tagNumber).pop();
if (tag !== undefined) {
tag.value = newValue;
}
this.validateTags(tags, tagNumber);
return { tags: tags };
});
};
updateTags = (tags: Tag[]) => {
var entries = Object.fromEntries([...tags.values()].map((tag) => [tag.key, tag.value]).concat());
this.props.parent.updateTags(entries);
};
handleTagKeySearch = (query: string, metric: string | undefined) => {
if (metric !== undefined) {
this.props.parent.props.datasource
.postResource('/api/suggest', {
type: 'tagk',
m: metric,
max: '1000',
})
.then((result: any) => {
if (result && _.isArray(result)) {
const tagKeyArray: string[] = result;
var tags = this.state.tags;
// find all tag keys that are being used in non-edited tags
var existingTags = tags
.filter((t) => t.editing === false)
.map((t) => {
return t.key;
})
.concat();
// exclude keys that are bing used
var filteredResults = tagKeyArray.filter((t) => {
return existingTags.find((existing) => t === existing) === undefined;
});
// exclude keys that don't match the search (if there is one)
filteredResults = filteredResults
.filter((tagKey) => query === '' || tagKey.toLowerCase().includes(query.toLowerCase()))
.map((value) => {
return value;
});
this.setState({ tagKeyOptions: filteredResults });
}
});
}
};
handleTagValueSearch = (query: string, metric: string | undefined, tagKey: string | undefined) => {
if (metric !== undefined && tagKey !== undefined) {
this.props.parent.props.datasource
.postResource('/api/suggest', {
type: 'tagv',
m: metric,
t: tagKey,
max: '1000',
})
.then((result: any) => {
if (result && _.isArray(result)) {
const tagValueArray: string[] = ['.*', ...result];
const filteredResults = tagValueArray
.filter((tagValue) => query === '' || tagValue.toLowerCase().includes(query.toLowerCase()))
.map((value) => {
return value;
});
this.setState({ tagValueOptions: filteredResults });
}
});
}
};
getInputValue = (id: string): string | null => {
var fullId = 'div#' + id + ' div div input.rbt-input-main';
var inputElement = document.querySelector(fullId);
if (inputElement !== null) {
return (inputElement as HTMLInputElement).value;
}
return null;
};
render() {
const { tagKeyOptionsLoading, tagKeyOptions, tagValueOptionsLoading, tagValueOptions } = this.state;
var { tags } = this.state;
var tagEditorId = Math.random().toString(36).substr(2, 9);
var lastSearchMetric: string;
const { metric } = this.props.parent.state.query;
var allowAddNewTag = tags.filter((t) => t.editing === true).length === 0;
return (
<div className="gf-form-inline">
<div className="gf-form timely">
<label className="gf-form-label width-10">Tags</label>
{[...tags.values()].map((tag, tagNum) => (
<div key={tagNum.toString()} id={'timelytag-' + tagNum.toString()}>
<div hidden={tag.editing}>
<label className="gf-form-label">
{tag.key}&nbsp;=&nbsp;{tag.value}
<div className="timely tag edit">
<HtmlTooltip title={'edit tag'} placement={'bottom'}>
<Icon
name="edit"
tabIndex={0}
onClick={(e) => {
this.beginEdit(tagNum);
}}
onKeyPress={(e) => {
if (e.key === 'Enter') {
this.beginEdit(tagNum);
}
}}
/>
</HtmlTooltip>
</div>
<div className="timely tag delete">
<HtmlTooltip title={'delete tag'} placement={'bottom'}>
<Icon
name="trash-alt"
tabIndex={0}
onClick={(e) => {
this.removeTag(tagNum);
}}
onKeyPress={(e) => {
if (e.key === 'Enter') {
this.removeTag(tagNum);
}
}}
/>
</HtmlTooltip>
</div>
</label>
</div>
<div className="gf-form" hidden={!tag.editing}>
<div
id={'timelyTagKey-' + tagEditorId + '-' + tagNum.toString()}
className="timely timely-tag-key"
onMouseLeave={(e) => {
var inputValue = this.getInputValue('timelyTagKey-' + tagEditorId + '-' + tagNum.toString());
if (inputValue !== null) {
this.updateTagKey(tagNum, inputValue);
}
}}
>
<AsyncTypeahead
id={'timelyTagKey-' + tagEditorId + '-Typeahead'}
selected={[tag.key]}
isLoading={tagKeyOptionsLoading}
inputProps={{ spellCheck: false }}
onSearch={(query) => {
this.setState({ tagKeyOptionsLoading: true });
lastSearchMetric = metric!;
this.handleTagKeySearch(query, metric);
this.setState({ tagKeyOptionsLoading: false });
}}
onChange={(e) => {
var inputValue = this.getInputValue('timelyTagKey-' + tagEditorId + '-' + tagNum.toString());
if (inputValue !== null) {
this.updateTagKey(tagNum, inputValue);
}
}}
onBlur={(e) => {
var inputValue = this.getInputValue('timelyTagKey-' + tagEditorId + '-' + tagNum.toString());
if (inputValue !== null) {
this.updateTagKey(tagNum, inputValue);
}
}}
onFocus={(e) => {
var inputValue = this.getInputValue('timelyTagKey-' + tagEditorId + '-' + tagNum.toString());
if (
tagKeyOptions.length === 0 ||
inputValue === null ||
inputValue.length === 0 ||
metric !== lastSearchMetric
) {
this.setState({ tagKeyOptionsLoading: true });
lastSearchMetric = metric!;
this.handleTagKeySearch('', metric);
this.setState({ tagKeyOptionsLoading: false });
}
}}
onKeyDown={(e) => {
var inputValue = this.getInputValue('timelyTagKey-' + tagEditorId + '-' + tagNum.toString());
if (
tagKeyOptions.length === 0 ||
inputValue === null ||
inputValue.length === 0 ||
metric !== lastSearchMetric
) {
this.setState({ tagKeyOptionsLoading: true });
lastSearchMetric = metric!;
this.handleTagKeySearch('', metric);
this.setState({ tagKeyOptionsLoading: false });
}
}}
autoFocus={tag.key.length === 0}
options={tagKeyOptions}
selectHintOnEnter={false}
align={'left'}
allowNew={true}
newSelectionPrefix={''}
paginate={true}
paginationText={'more'}
minLength={0}
maxResults={100}
caseSensitive={false}
placeholder={'key'}
/>
</div>
<div
id={'timelyTagValue-' + tagEditorId + '-' + tagNum.toString()}
className="timely timely-tag-value"
onMouseLeave={(e) => {
var inputValue = this.getInputValue('timelyTagValue-' + tagEditorId + '-' + tagNum.toString());
if (inputValue !== null) {
this.updateTagValue(tagNum, inputValue);
}
}}
>
<AsyncTypeahead
id={'timelyTagValue-' + tagEditorId + '-Typeahead'}
selected={[tag.value]}
isLoading={tagValueOptionsLoading}
inputProps={{ spellCheck: false }}
onSearch={(query) => {
this.setState({ tagValueOptionsLoading: true });
this.handleTagValueSearch(query, metric, tag.key);
this.setState({ tagValueOptionsLoading: false });
}}
onChange={(e) => {
var inputValue = this.getInputValue('timelyTagValue-' + tagEditorId + '-' + tagNum.toString());
if (inputValue !== null) {
this.updateTagValue(tagNum, inputValue);
}
}}
onBlur={(e) => {
var inputValue = this.getInputValue('timelyTagValue-' + tagEditorId + '-' + tagNum.toString());
if (inputValue !== null) {
this.updateTagValue(tagNum, inputValue);
}
}}
onFocus={(e) => {
var inputValue = this.getInputValue('timelyTagValue-' + tagEditorId + '-' + tagNum.toString());
if (tagValueOptions.length === 0 || inputValue === null || inputValue.length === 0) {
this.setState({ tagValueOptionsLoading: true });
this.handleTagValueSearch('', metric, tag.key);
this.setState({ tagValueOptionsLoading: false });
}
}}
onKeyDown={(e) => {
var inputValue = this.getInputValue('timelyTagValue-' + tagEditorId + '-' + tagNum.toString());
if (tagValueOptions.length === 0 || inputValue === null || inputValue.length === 0) {
this.setState({ tagValueOptionsLoading: true });
this.handleTagValueSearch('', metric, tag.key);
this.setState({ tagValueOptionsLoading: false });
}
}}
options={tagValueOptions}
selectHintOnEnter={false}
align={'left'}
allowNew={true}
newSelectionPrefix={''}
paginate={true}
paginationText={'more'}
minLength={0}
maxResults={100}
caseSensitive={false}
placeholder={'value'}
/>
</div>
<label className="gf-form-label max-width-5 flex-shrink-1">
{tag.errors !== undefined && (
<div className="timely tag error">
<HtmlTooltip
title={
<React.Fragment>
<ul>
{tag.errors.map((error) => {
return <li key={error}>{error}</li>;
})}
</ul>
</React.Fragment>
}
placement={'bottom'}
>
<Icon name="exclamation-triangle" />
</HtmlTooltip>
</div>
)}
{tag.errors === undefined && (
<div className="timely tag save">
<HtmlTooltip title={'save tag'} placement={'bottom'}>
<Icon
name="save"
tabIndex={0}
onClick={(e) => {
this.endEdit(tagNum);
}}
onKeyPress={(e) => {
if (e.key === 'Enter') {
this.endEdit(tagNum);
}
}}
/>
</HtmlTooltip>
</div>
)}
<div className="timely tag delete">
<HtmlTooltip title={'delete tag'} placement={'bottom'}>
<Icon
name="trash-alt"
tabIndex={0}
onClick={(e) => {
this.removeTag(tagNum);
}}
onKeyPress={(e) => {
if (e.key === 'Enter') {
this.removeTag(tagNum);
}
}}
/>
</HtmlTooltip>
</div>
</label>
</div>
</div>
))}
<div className="gf-form" hidden={!allowAddNewTag}>
<label className="gf-form-label">
<div className="timely tag addtag">
<HtmlTooltip title={'add tag'} placement={'bottom'}>
<Icon
name="plus"
tabIndex={0}
onClick={(e) => {
this.addTag();
}}
onKeyPress={(e) => {
if (e.key === 'Enter') {
this.addTag();
}
}}
/>
</HtmlTooltip>
</div>
</label>
</div>
</div>
</div>
);
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
-5
View File
@@ -1,5 +0,0 @@
describe('placeholder test', () => {
it('should return true', () => {
expect(true).toBeTruthy();
});
});
@@ -1,54 +0,0 @@
$box-shadow-dimensions: 0 0 0 0.2rem;
$placeholder-color: #6c757d;
.rbt {
&-input-multi {
// Bootstrap 4 focus style
&.focus {
background-color: #fff;
border-color: #80bdff;
box-shadow: $box-shadow-dimensions rgba(0, 123, 255, 0.25);
color: #495057;
outline: 0;
}
&.is-invalid.focus {
border-color: #dc3545;
box-shadow: $box-shadow-dimensions rgba(220, 53, 69, 0.25);
}
&.is-valid.focus {
border-color: #28a745;
box-shadow: $box-shadow-dimensions rgba(40, 167, 69, 0.25);
}
input {
// Firefox
&::-moz-placeholder {
color: $placeholder-color;
opacity: 1;
}
// Internet Explorer 10+
&:-ms-input-placeholder {
color: $placeholder-color;
}
// Safari and Chrome
&::-webkit-input-placeholder {
color: $placeholder-color;
}
}
// Override height in main CSS file :/
& .rbt-input-main,
&.form-control-lg .rbt-input-main,
&.form-control-sm .rbt-input-main {
height: auto;
}
}
&-token {
margin: 1px 3px 2px 0;
}
}
@@ -1,201 +0,0 @@
.rbt .rbt-input-main::-ms-clear {
display: none !important;
}
/**
* Menu
*/
.rbt-menu {
margin-bottom: 2px !important;
}
.rbt-menu > .dropdown-item {
overflow: hidden !important;
text-overflow: ellipsis !important;
}
.rbt-menu > .dropdown-item:focus {
outline: none !important;
}
.rbt-menu-pagination-option {
text-align: center !important;
}
/**
* Multi-select Input
*/
.rbt-input-multi {
cursor: text !important;
overflow: hidden !important;
position: relative !important;
}
.rbt-input-multi.focus {
border-color: #80bdff !important;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
color: #495057 !important;
outline: 0 !important;
}
.rbt-input-multi.form-control {
height: auto !important;
}
.rbt-input-multi.form-control[disabled] {
background-color: #e9ecef !important;
opacity: 1 !important;
}
.rbt-input-multi.is-invalid.focus {
border-color: #dc3545 !important;
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}
.rbt-input-multi.is-valid.focus {
border-color: #28a745 !important;
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}
.rbt-input-multi input::-moz-placeholder {
color: #6c757d !important;
opacity: 1 !important;
}
.rbt-input-multi input:-ms-input-placeholder {
color: #6c757d !important;
}
.rbt-input-multi input::-webkit-input-placeholder {
color: #6c757d !important;
}
.rbt-input-multi .rbt-input-wrapper {
align-items: flex-start !important;
display: flex !important;
flex-wrap: wrap !important;
margin-bottom: -4px !important;
margin-top: -1px !important;
overflow: hidden !important;
}
.rbt-input-multi .rbt-input-main {
margin: 1px 0 4px !important;
}
/**
* Close Button
*/
.rbt-close {
z-index: 1 !important;
}
.rbt-close-lg {
font-size: 24px !important;
}
/**
* Token
*/
.rbt-token {
background-color: #e7f4ff !important;
border: 0 !important;
border-radius: 0.25rem !important;
color: #007bff !important;
display: inline-block !important;
line-height: 1em !important;
margin: 1px 3px 2px 0 !important;
padding: 4px 7px !important;
position: relative !important;
}
.rbt-token-disabled {
background-color: rgba(0, 0, 0, 0.1) !important;
color: #495057 !important;
pointer-events: none !important;
}
.rbt-token-removeable {
cursor: pointer !important;
padding-right: 21px !important;
}
.rbt-token-active {
background-color: #007bff !important;
color: #fff !important;
outline: none !important;
text-decoration: none !important;
}
.rbt-token .rbt-token-remove-button {
bottom: 0 !important;
color: inherit !important;
font-size: inherit !important;
font-weight: normal !important;
opacity: 1 !important;
outline: none !important;
padding: 3px 7px !important;
position: absolute !important;
right: 0 !important;
text-shadow: none !important;
top: -2px !important;
}
/**
* Loader + CloseButton container
*/
.rbt-aux {
align-items: center !important;
display: flex !important;
bottom: 0 !important;
justify-content: center !important;
pointer-events: none !important;
/* Don't block clicks on the input */
position: absolute !important;
right: 0 !important;
top: 0 !important;
width: 34px !important;
}
.rbt-aux-lg {
width: 46px !important;
}
.rbt-aux .rbt-close {
margin-top: -4px !important;
pointer-events: auto !important;
/* Override pointer-events: none; above */
}
.has-aux .rbt-input {
padding-right: 34px !important;
}
.rbt-highlight-text {
background-color: inherit !important;
color: inherit !important;
font-weight: bold !important;
padding: 0 !important;
}
/**
* Input Groups
*/
.input-group > .rbt {
flex: 1 !important;
}
.input-group > .rbt .rbt-input-hint,
.input-group > .rbt .rbt-aux {
z-index: 5 !important;
}
.input-group > .rbt:not(:first-child) .form-control {
border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;
}
.input-group > .rbt:not(:last-child) .form-control {
border-top-right-radius: 0 !important;
border-bottom-right-radius: 0 !important;
}
@@ -1,240 +0,0 @@
$animation: loader-animation 600ms infinite linear;
$inset: inset 0 1px 1px rgba(0, 0, 0, 0.075);
$placeholder-color: #999;
.rbt {
&-menu {
margin-bottom: 2px; // Spacing for dropup
& > li a {
overflow: hidden;
text-overflow: ellipsis;
&:focus {
outline: none;
}
}
&-pagination-option {
text-align: center;
}
}
// Hide IE's native "clear" button
& .rbt-input-main::-ms-clear {
display: none;
}
&-input-multi {
cursor: text;
overflow: hidden;
position: relative;
height: auto;
// Apply Bootstrap focus styles
&.focus {
box-shadow: $inset, 0 0 8px rgba(102, 175, 233, 0.6);
border-color: #66afe9;
outline: 0;
}
// BS4 uses the :disabled pseudo-class, which doesn't work with non-inputs.
&.form-control[disabled] {
background-color: #e9ecef;
opacity: 1;
}
// Apply Bootstrap placeholder styles
input {
// Firefox
&::-moz-placeholder {
color: $placeholder-color;
opacity: 1;
}
// Internet Explorer 10+
&:-ms-input-placeholder {
color: $placeholder-color;
}
// Safari and Chrome
&::-webkit-input-placeholder {
color: $placeholder-color;
}
}
.rbt-input-wrapper {
align-items: flex-start;
display: flex;
flex-wrap: wrap;
margin-bottom: -4px;
margin-top: -1px;
overflow: hidden;
}
.rbt-input-main {
// Set input height for cross-browser consistency
height: 20px;
margin: 1px 0 4px;
}
&.input,
&.form-control {
&-lg {
.rbt-input-main {
height: 24px;
}
}
&-sm {
.rbt-input-main {
height: 18px;
}
}
}
}
&-close {
z-index: 1;
&-lg {
font-size: 24px;
}
}
&-token {
background-color: #e7f4ff;
border: 0;
border-radius: 2px;
color: #1f8dd6;
display: inline-block;
line-height: 1em;
margin: 0 3px 3px 0;
padding: 4px 7px;
position: relative;
&-disabled {
background-color: #ddd;
color: #888;
pointer-events: none;
}
&-removeable {
cursor: pointer;
padding-right: 21px;
}
&-active {
background-color: #1f8dd6;
color: #fff;
outline: none;
text-decoration: none;
}
& &-remove-button {
bottom: 0;
color: inherit;
font-size: inherit;
font-weight: normal;
opacity: 1;
outline: none;
padding: 3px 7px;
position: absolute;
right: 0;
text-shadow: none;
top: -2px;
}
}
&-loader {
-moz-animation: $animation;
-webkit-animation: $animation;
animation: $animation;
border: 1px solid #d5d5d5;
border-radius: 50%;
border-top-color: #1f8dd6;
display: block;
height: 16px;
width: 16px;
&-lg {
height: 20px;
width: 20px;
}
}
&-aux {
align-items: center;
display: flex;
bottom: 0;
justify-content: center;
pointer-events: none; /* Don't block clicks on the input */
position: absolute;
right: 0;
top: 0;
width: 34px;
&-lg {
width: 46px;
}
& .rbt-close {
margin-top: -4px;
pointer-events: auto; /* Override pointer-events: none; above */
}
}
.has-aux &-input {
padding-right: 34px;
}
&-highlight-text {
background-color: inherit;
color: inherit;
font-weight: bold;
padding: 0;
}
}
/* Input Groups */
.input-group > .rbt {
flex: 1;
// Form-controls within input-groups have a higher z-index.
& .rbt-input-hint,
& .rbt-aux {
z-index: 5;
}
&:not(:first-child) .form-control {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
&:not(:last-child) .form-control {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
/* Validation States */
.has-error .rbt-input-multi.focus {
border-color: #843534;
box-shadow: $inset, 0 0 6px #ce8483;
}
.has-warning .rbt-input-multi.focus {
border-color: #66512c;
box-shadow: $inset, 0 0 6px #c0a16b;
}
.has-success .rbt-input-multi.focus {
border-color: #2b542c;
box-shadow: $inset, 0 0 6px #67b168;
}
@keyframes loader-animation {
to {
transform: rotate(1turn);
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
-15
View File
@@ -1,15 +0,0 @@
{
"extends": "@grafana/toolkit/src/config/tsconfig.plugin.json",
"include": ["src", "types"],
"paths": {
"@grafana/slate-react": ["./node_modules/@types/slate-react"]
},
"compilerOptions": {
"esModuleInterop": true,
"rootDir": "./src",
"baseUrl": "./src",
"typeRoots": ["./node_modules/@types"],
"jsx": "react",
"allowJs": true
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,3 @@
{
"version": "5.12.4"
}
@@ -0,0 +1,31 @@
/*
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
*
* In order to extend the configuration follow the steps in
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-eslint-config
*/
{
"extends": ["@grafana/eslint-config"],
"root": true,
"rules": {
"react/prop-types": "off"
},
"overrides": [
{
"plugins": ["deprecation"],
"files": ["src/**/*.{ts,tsx}"],
"rules": {
"deprecation/deprecation": "warn"
},
"parserOptions": {
"project": "./tsconfig.json"
}
},
{
"files": ["./tests/**/*"],
"rules": {
"react-hooks/rules-of-hooks": "off"
}
}
]
}
@@ -0,0 +1,16 @@
/*
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
*
* In order to extend the configuration follow the steps in .config/README.md
*/
module.exports = {
endOfLine: 'auto',
printWidth: 120,
trailingComma: 'es5',
semi: true,
jsxSingleQuote: false,
singleQuote: true,
useTabs: false,
tabWidth: 2,
};
@@ -0,0 +1,77 @@
ARG grafana_version=latest
ARG grafana_image=grafana-enterprise
FROM grafana/${grafana_image}:${grafana_version}
ARG anonymous_auth_enabled=true
ARG development=false
ARG TARGETARCH
ARG GO_VERSION=1.21.6
ARG GO_ARCH=${TARGETARCH:-amd64}
ENV DEV "${development}"
# Make it as simple as possible to access the grafana instance for development purposes
# Do NOT enable these settings in a public facing / production grafana instance
ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin"
ENV GF_AUTH_ANONYMOUS_ENABLED "${anonymous_auth_enabled}"
ENV GF_AUTH_BASIC_ENABLED "false"
# Set development mode so plugins can be loaded without the need to sign
ENV GF_DEFAULT_APP_MODE "development"
LABEL maintainer="Grafana Labs <[email protected]>"
ENV GF_PATHS_HOME="/usr/share/grafana"
WORKDIR $GF_PATHS_HOME
USER root
# Installing supervisor and inotify-tools
RUN if [ "${development}" = "true" ]; then \
if grep -i -q alpine /etc/issue; then \
apk add supervisor inotify-tools git; \
elif grep -i -q ubuntu /etc/issue; then \
DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y supervisor inotify-tools git && \
rm -rf /var/lib/apt/lists/*; \
else \
echo 'ERROR: Unsupported base image' && /bin/false; \
fi \
fi
COPY supervisord/supervisord.conf /etc/supervisor.d/supervisord.ini
COPY supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Installing Go
RUN if [ "${development}" = "true" ]; then \
curl -O -L https://golang.org/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \
rm -rf /usr/local/go && \
tar -C /usr/local -xzf go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bashrc && \
rm -f go${GO_VERSION}.linux-${GO_ARCH}.tar.gz; \
fi
# Installing delve for debugging
RUN if [ "${development}" = "true" ]; then \
/usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest; \
fi
# Installing mage for plugin (re)building
RUN if [ "${development}" = "true" ]; then \
git clone https://github.com/magefile/mage; \
cd mage; \
export PATH=$PATH:/usr/local/go/bin; \
go run bootstrap.go; \
fi
# Inject livereload script into grafana index.html
RUN sed -i 's|</body>|<script src="http://localhost:35729/livereload.js"></script></body>|g' /usr/share/grafana/public/views/index.html
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
+164
View File
@@ -0,0 +1,164 @@
# Default build configuration by Grafana
**This is an auto-generated directory and is not intended to be changed! ⚠️**
The `.config/` directory holds basic configuration for the different tools
that are used to develop, test and build the project. In order to make it updates easier we ask you to
not edit files in this folder to extend configuration.
## How to extend the basic configs?
Bear in mind that you are doing it at your own risk, and that extending any of the basic configuration can lead
to issues around working with the project.
### Extending the ESLint config
Edit the `.eslintrc` file in the project root in order to extend the ESLint configuration.
**Example:**
```json
{
"extends": "./.config/.eslintrc",
"rules": {
"react/prop-types": "off"
}
}
```
---
### Extending the Prettier config
Edit the `.prettierrc.js` file in the project root in order to extend the Prettier configuration.
**Example:**
```javascript
module.exports = {
// Prettier configuration provided by Grafana scaffolding
...require('./.config/.prettierrc.js'),
semi: false,
};
```
---
### Extending the Jest config
There are two configuration in the project root that belong to Jest: `jest-setup.js` and `jest.config.js`.
**`jest-setup.js`:** A file that is run before each test file in the suite is executed. We are using it to
set up the Jest DOM for the testing library and to apply some polyfills. ([link to Jest docs](https://jestjs.io/docs/configuration#setupfilesafterenv-array))
**`jest.config.js`:** The main Jest configuration file that extends the Grafana recommended setup. ([link to Jest docs](https://jestjs.io/docs/configuration))
#### ESM errors with Jest
A common issue with the current jest config involves importing an npm package that only offers an ESM build. These packages cause jest to error with `SyntaxError: Cannot use import statement outside a module`. To work around this, we provide a list of known packages to pass to the `[transformIgnorePatterns](https://jestjs.io/docs/configuration#transformignorepatterns-arraystring)` jest configuration property. If need be, this can be extended in the following way:
```javascript
process.env.TZ = 'UTC';
const { grafanaESModules, nodeModulesToTransform } = require('./config/jest/utils');
module.exports = {
// Jest configuration provided by Grafana
...require('./.config/jest.config'),
// Inform jest to only transform specific node_module packages.
transformIgnorePatterns: [nodeModulesToTransform([...grafanaESModules, 'packageName'])],
};
```
---
### Extending the TypeScript config
Edit the `tsconfig.json` file in the project root in order to extend the TypeScript configuration.
**Example:**
```json
{
"extends": "./.config/tsconfig.json",
"compilerOptions": {
"preserveConstEnums": true
}
}
```
---
### Extending the Webpack config
Follow these steps to extend the basic Webpack configuration that lives under `.config/`:
#### 1. Create a new Webpack configuration file
Create a new config file that is going to extend the basic one provided by Grafana.
It can live in the project root, e.g. `webpack.config.ts`.
#### 2. Merge the basic config provided by Grafana and your custom setup
We are going to use [`webpack-merge`](https://github.com/survivejs/webpack-merge) for this.
```typescript
// webpack.config.ts
import type { Configuration } from 'webpack';
import { merge } from 'webpack-merge';
import grafanaConfig from './.config/webpack/webpack.config';
const config = async (env): Promise<Configuration> => {
const baseConfig = await grafanaConfig(env);
return merge(baseConfig, {
// Add custom config here...
output: {
asyncChunks: true,
},
});
};
export default config;
```
#### 3. Update the `package.json` to use the new Webpack config
We need to update the `scripts` in the `package.json` to use the extended Webpack configuration.
**Update for `build`:**
```diff
-"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
+"build": "webpack -c ./webpack.config.ts --env production",
```
**Update for `dev`:**
```diff
-"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
+"dev": "webpack -w -c ./webpack.config.ts --env development",
```
### Configure grafana image to use when running docker
By default, `grafana-enterprise` will be used as the docker image for all docker related commands. If you want to override this behavior, simply alter the `docker-compose.yaml` by adding the following build arg `grafana_image`.
**Example:**
```yaml
version: '3.7'
services:
grafana:
container_name: 'myorg-basic-app'
build:
context: ./.config
args:
grafana_version: ${GRAFANA_VERSION:-9.1.2}
grafana_image: ${GRAFANA_IMAGE:-grafana}
```
In this example, we assign the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This will allow you to set the value while running the docker compose commands, which might be convenient in some scenarios.
---
@@ -0,0 +1,18 @@
#!/bin/sh
if [ "${DEV}" = "false" ]; then
echo "Starting test mode"
exec /run.sh
fi
echo "Starting development mode"
if grep -i -q alpine /etc/issue; then
exec /usr/bin/supervisord -c /etc/supervisord.conf
elif grep -i -q ubuntu /etc/issue; then
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo 'ERROR: Unsupported base image'
exit 1
fi
@@ -0,0 +1,28 @@
/*
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
*
* In order to extend the configuration follow the steps in
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-jest-config
*/
import '@testing-library/jest-dom';
import { TextEncoder, TextDecoder } from 'util';
Object.assign(global, { TextDecoder, TextEncoder });
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
Object.defineProperty(global, 'matchMedia', {
writable: true,
value: (query) => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(), // deprecated
removeListener: jest.fn(), // deprecated
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
}),
});
HTMLCanvasElement.prototype.getContext = () => {};
@@ -0,0 +1,43 @@
/*
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
*
* In order to extend the configuration follow the steps in
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-jest-config
*/
const path = require('path');
const { grafanaESModules, nodeModulesToTransform } = require('./jest/utils');
module.exports = {
moduleNameMapper: {
'\\.(css|scss|sass)$': 'identity-obj-proxy',
'react-inlinesvg': path.resolve(__dirname, 'jest', 'mocks', 'react-inlinesvg.tsx'),
},
modulePaths: ['<rootDir>/src'],
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'],
testEnvironment: 'jest-environment-jsdom',
testMatch: [
'<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}',
'<rootDir>/src/**/*.{spec,test,jest}.{js,jsx,ts,tsx}',
'<rootDir>/src/**/*.{spec,test,jest}.{js,jsx,ts,tsx}',
],
transform: {
'^.+\\.(t|j)sx?$': [
'@swc/jest',
{
sourceMaps: 'inline',
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
decorators: false,
dynamicImport: true,
},
},
},
],
},
// Jest will throw `Cannot use import statement outside module` if it tries to load an
// ES module without it being transformed first. ./config/README.md#esm-errors-with-jest
transformIgnorePatterns: [nodeModulesToTransform(grafanaESModules)],
};
@@ -0,0 +1,25 @@
// Due to the grafana/ui Icon component making fetch requests to
// `/public/img/icon/<icon_name>.svg` we need to mock react-inlinesvg to prevent
// the failed fetch requests from displaying errors in console.
import React from 'react';
type Callback = (...args: any[]) => void;
export interface StorageItem {
content: string;
queue: Callback[];
status: string;
}
export const cacheStore: { [key: string]: StorageItem } = Object.create(null);
const SVG_FILE_NAME_REGEX = /(.+)\/(.+)\.svg$/;
const InlineSVG = ({ src }: { src: string }) => {
// testId will be the file name without extension (e.g. `public/img/icons/angle-double-down.svg` -> `angle-double-down`)
const testId = src.replace(SVG_FILE_NAME_REGEX, '$2');
return <svg xmlns="http://www.w3.org/2000/svg" data-testid={testId} viewBox="0 0 24 24" />;
};
export default InlineSVG;
@@ -0,0 +1,31 @@
/*
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
*
* In order to extend the configuration follow the steps in .config/README.md
*/
/*
* This utility function is useful in combination with jest `transformIgnorePatterns` config
* to transform specific packages (e.g.ES modules) in a projects node_modules folder.
*/
const nodeModulesToTransform = (moduleNames) => `node_modules\/(?!.*(${moduleNames.join('|')})\/.*)`;
// Array of known nested grafana package dependencies that only bundle an ESM version
const grafanaESModules = [
'.pnpm', // Support using pnpm symlinked packages
'@grafana/schema',
'd3',
'd3-color',
'd3-force',
'd3-interpolate',
'd3-scale-chromatic',
'ol',
'react-colorful',
'rxjs',
'uuid',
];
module.exports = {
nodeModulesToTransform,
grafanaESModules,
};
@@ -0,0 +1,47 @@
[supervisord]
nodaemon=true
user=root
[program:grafana]
user=root
directory=/var/lib/grafana
command=bash -c 'while [ ! -f /root/timely-datasource/dist/timely_datasource* ]; do sleep 1; done; /run.sh'
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
killasgroup=true
stopasgroup=true
autostart=true
[program:delve]
user=root
command=/bin/bash -c 'pid=""; while [ -z "$pid" ]; do pid=$(pgrep -f timely_datasource); done; /root/go/bin/dlv attach --api-version=2 --headless --continue --accept-multiclient --listen=:2345 $pid'
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
killasgroup=false
stopasgroup=false
autostart=true
autorestart=true
[program:build-watcher]
user=root
command=/bin/bash -c 'while inotifywait -e modify,create,delete -r /var/lib/grafana/plugins/timely-datasource; do echo "Change detected, restarting delve...";supervisorctl restart delve; done'
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
killasgroup=true
stopasgroup=true
autostart=true
[program:mage-watcher]
user=root
environment=PATH="/usr/local/go/bin:/root/go/bin:%(ENV_PATH)s"
directory=/root/timely-datasource
command=/bin/bash -c 'git config --global --add safe.directory /root/timely-datasource && mage -v watch'
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
killasgroup=true
stopasgroup=true
autostart=true
@@ -0,0 +1,26 @@
/*
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
*
* In order to extend the configuration follow the steps in
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-typescript-config
*/
{
"compilerOptions": {
"alwaysStrict": true,
"declaration": false,
"rootDir": "../src",
"baseUrl": "../src",
"typeRoots": ["../node_modules/@types"],
"resolveJsonModule": true
},
"ts-node": {
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"esModuleInterop": true
},
"transpileOnly": true
},
"include": ["../src", "./types"],
"extends": "@grafana/tsconfig"
}
+37
View File
@@ -0,0 +1,37 @@
// Image declarations
declare module '*.gif' {
const src: string;
export default src;
}
declare module '*.jpg' {
const src: string;
export default src;
}
declare module '*.jpeg' {
const src: string;
export default src;
}
declare module '*.png' {
const src: string;
export default src;
}
declare module '*.webp' {
const src: string;
export default src;
}
declare module '*.svg' {
const content: string;
export default content;
}
// Font declarations
declare module '*.woff';
declare module '*.woff2';
declare module '*.eot';
declare module '*.ttf';
declare module '*.otf';
@@ -0,0 +1,33 @@
import * as webpack from 'webpack';
const PLUGIN_NAME = 'BuildModeWebpack';
export class BuildModeWebpackPlugin {
apply(compiler: webpack.Compiler) {
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
compilation.hooks.processAssets.tap(
{
name: PLUGIN_NAME,
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
async () => {
const assets = compilation.getAssets();
for (const asset of assets) {
if (asset.name.endsWith('plugin.json')) {
const pluginJsonString = asset.source.source().toString();
const pluginJsonWithBuildMode = JSON.stringify(
{
...JSON.parse(pluginJsonString),
buildMode: compilation.options.mode,
},
null,
4
);
compilation.updateAsset(asset.name, new webpack.sources.RawSource(pluginJsonWithBuildMode));
}
}
}
);
});
}
}
@@ -0,0 +1,2 @@
export const SOURCE_DIR = 'src';
export const DIST_DIR = 'dist';
@@ -0,0 +1,63 @@
import fs from 'fs';
import process from 'process';
import os from 'os';
import path from 'path';
import { glob } from 'glob';
import { SOURCE_DIR } from './constants';
export function isWSL() {
if (process.platform !== 'linux') {
return false;
}
if (os.release().toLowerCase().includes('microsoft')) {
return true;
}
try {
return fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft');
} catch {
return false;
}
}
export function getPackageJson() {
return require(path.resolve(process.cwd(), 'package.json'));
}
export function getPluginJson() {
return require(path.resolve(process.cwd(), `${SOURCE_DIR}/plugin.json`));
}
export function getCPConfigVersion() {
const cprcJson = path.resolve(__dirname, '../', '.cprc.json');
return fs.existsSync(cprcJson) ? require(cprcJson).version : { version: 'unknown' };
}
export function hasReadme() {
return fs.existsSync(path.resolve(process.cwd(), SOURCE_DIR, 'README.md'));
}
// Support bundling nested plugins by finding all plugin.json files in src directory
// then checking for a sibling module.[jt]sx? file.
export async function getEntries(): Promise<Record<string, string>> {
const pluginsJson = await glob('**/src/**/plugin.json', { absolute: true });
const plugins = await Promise.all(
pluginsJson.map((pluginJson) => {
const folder = path.dirname(pluginJson);
return glob(`${folder}/module.{ts,tsx,js,jsx}`, { absolute: true });
})
);
return plugins.reduce((result, modules) => {
return modules.reduce((result, module) => {
const pluginPath = path.dirname(module);
const pluginName = path.relative(process.cwd(), pluginPath).replace(/src\/?/i, '');
const entryName = pluginName === '' ? 'module' : `${pluginName}/module`;
result[entryName] = module;
return result;
}, result);
}, {});
}
@@ -0,0 +1,277 @@
/*
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
*
* In order to extend the configuration follow the steps in
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-webpack-config
*/
import CopyWebpackPlugin from 'copy-webpack-plugin';
import ESLintPlugin from 'eslint-webpack-plugin';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import path from 'path';
import ReplaceInFileWebpackPlugin from 'replace-in-file-webpack-plugin';
import TerserPlugin from 'terser-webpack-plugin';
import { SubresourceIntegrityPlugin } from 'webpack-subresource-integrity';
import { type Configuration, BannerPlugin } from 'webpack';
import LiveReloadPlugin from 'webpack-livereload-plugin';
import VirtualModulesPlugin from 'webpack-virtual-modules';
import { BuildModeWebpackPlugin } from './BuildModeWebpackPlugin';
import { DIST_DIR, SOURCE_DIR } from './constants';
import { getCPConfigVersion, getEntries, getPackageJson, getPluginJson, hasReadme, isWSL } from './utils';
const pluginJson = getPluginJson();
const cpVersion = getCPConfigVersion();
const virtualPublicPath = new VirtualModulesPlugin({
'node_modules/grafana-public-path.js': `
import amdMetaModule from 'amd-module';
__webpack_public_path__ =
amdMetaModule && amdMetaModule.uri
? amdMetaModule.uri.slice(0, amdMetaModule.uri.lastIndexOf('/') + 1)
: 'public/plugins/${pluginJson.id}/';
`,
});
const config = async (env): Promise<Configuration> => {
const baseConfig: Configuration = {
cache: {
type: 'filesystem',
buildDependencies: {
config: [__filename],
},
},
context: path.join(process.cwd(), SOURCE_DIR),
devtool: env.production ? 'source-map' : 'eval-source-map',
entry: await getEntries(),
externals: [
// Required for dynamic publicPath resolution
{ 'amd-module': 'module' },
'lodash',
'jquery',
'moment',
'slate',
'emotion',
'@emotion/react',
'@emotion/css',
'prismjs',
'slate-plain-serializer',
'@grafana/slate-react',
'react',
'react-dom',
'react-redux',
'redux',
'rxjs',
'react-router',
'react-router-dom',
'd3',
'angular',
'@grafana/ui',
'@grafana/runtime',
'@grafana/data',
// Mark legacy SDK imports as external if their name starts with the "grafana/" prefix
({ request }, callback) => {
const prefix = 'grafana/';
const hasPrefix = (request) => request.indexOf(prefix) === 0;
const stripPrefix = (request) => request.substr(prefix.length);
if (hasPrefix(request)) {
return callback(undefined, stripPrefix(request));
}
callback();
},
],
// Support WebAssembly according to latest spec - makes WebAssembly module async
experiments: {
asyncWebAssembly: true,
},
mode: env.production ? 'production' : 'development',
module: {
rules: [
// This must come first in the rules array otherwise it breaks sourcemaps.
{
test: /src\/(?:.*\/)?module\.tsx?$/,
use: [
{
loader: 'imports-loader',
options: {
imports: `side-effects grafana-public-path`,
},
},
],
},
{
exclude: /(node_modules)/,
test: /\.[tj]sx?$/,
use: {
loader: 'swc-loader',
options: {
jsc: {
baseUrl: path.resolve(process.cwd(), SOURCE_DIR),
target: 'es2015',
loose: false,
parser: {
syntax: 'typescript',
tsx: true,
decorators: false,
dynamicImport: true,
},
},
},
},
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.s[ac]ss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
{
test: /\.(png|jpe?g|gif|svg)$/,
type: 'asset/resource',
generator: {
filename: Boolean(env.production) ? '[hash][ext]' : '[file]',
},
},
{
test: /\.(woff|woff2|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
type: 'asset/resource',
generator: {
filename: Boolean(env.production) ? '[hash][ext]' : '[file]',
},
},
],
},
optimization: {
minimize: Boolean(env.production),
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: (_, { type, value }) => type === 'comment2' && value.trim().startsWith('[create-plugin]'),
},
compress: {
drop_console: ['log', 'info'],
},
},
}),
],
},
output: {
clean: {
keep: new RegExp(`(.*?_(amd64|arm(64)?)(.exe)?|go_plugin_build_manifest)`),
},
filename: '[name].js',
chunkFilename: env.production ? '[name].js?_cache=[contenthash]' : '[name].js',
library: {
type: 'amd',
},
path: path.resolve(process.cwd(), DIST_DIR),
publicPath: `public/plugins/${pluginJson.id}/`,
uniqueName: pluginJson.id,
crossOriginLoading: 'anonymous',
},
plugins: [
new BuildModeWebpackPlugin(),
virtualPublicPath,
// Insert create plugin version information into the bundle
new BannerPlugin({
banner: '/* [create-plugin] version: ' + cpVersion + ' */',
raw: true,
entryOnly: true,
}),
new CopyWebpackPlugin({
patterns: [
// If src/README.md exists use it; otherwise the root README
// To `compiler.options.output`
{ from: hasReadme() ? 'README.md' : '../README.md', to: '.', force: true },
{ from: 'plugin.json', to: '.' },
{ from: '../LICENSE', to: '.' },
{ from: '../CHANGELOG.md', to: '.', force: true },
{ from: '**/*.json', to: '.' },
{ from: '**/*.svg', to: '.', noErrorOnMissing: true },
{ from: '**/*.png', to: '.', noErrorOnMissing: true },
{ from: '**/*.html', to: '.', noErrorOnMissing: true },
{ from: 'img/**/*', to: '.', noErrorOnMissing: true },
{ from: 'libs/**/*', to: '.', noErrorOnMissing: true },
{ from: 'static/**/*', to: '.', noErrorOnMissing: true },
{ from: 'styles/*.css', to: '.', noErrorOnMissing: true },
{ from: '**/query_help.md', to: '.', noErrorOnMissing: true },
],
}),
// Replace certain template-variables in the README and plugin.json
new ReplaceInFileWebpackPlugin([
{
dir: DIST_DIR,
files: ['plugin.json', 'README.md'],
rules: [
{
search: /\%VERSION\%/g,
replace: getPackageJson().version,
},
{
search: /\%TODAY\%/g,
replace: new Date().toISOString().substring(0, 10),
},
{
search: /\%PLUGIN_ID\%/g,
replace: pluginJson.id,
},
],
},
]),
new SubresourceIntegrityPlugin({
hashFuncNames: ['sha256'],
}),
...(env.development
? [
new LiveReloadPlugin(),
new ForkTsCheckerWebpackPlugin({
async: Boolean(env.development),
issue: {
include: [{ file: '**/*.{ts,tsx}' }],
},
typescript: { configFile: path.join(process.cwd(), 'tsconfig.json') },
}),
new ESLintPlugin({
extensions: ['.ts', '.tsx'],
lintDirtyModulesOnly: Boolean(env.development), // don't lint on start, only lint changed files
}),
]
: []),
],
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
// handle resolving "rootDir" paths
modules: [path.resolve(process.cwd(), 'src'), 'node_modules'],
unsafeCache: true,
},
};
if (isWSL()) {
baseConfig.watchOptions = {
poll: 3000,
ignored: /node_modules/,
};
}
return baseConfig;
};
export default config;
+6
View File
@@ -0,0 +1,6 @@
{
"features": {
"bundleGrafanaUI": false,
"useReactRouterV6": false
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "./.config/.eslintrc"
}
@@ -0,0 +1,21 @@
name: Bundle Stats
on:
pull_request:
branches:
- main
permissions:
contents: write
pull-requests: write
actions: read
jobs:
compare:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: grafana/plugin-actions/bundle-size@main
+219
View File
@@ -0,0 +1,219 @@
name: CI
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
permissions: read-all
jobs:
build:
name: Build, lint and unit tests
runs-on: ubuntu-latest
outputs:
plugin-id: ${{ steps.metadata.outputs.plugin-id }}
plugin-version: ${{ steps.metadata.outputs.plugin-version }}
has-e2e: ${{ steps.check-for-e2e.outputs.has-e2e }}
has-backend: ${{ steps.check-for-backend.outputs.has-backend }}
env:
GRAFANA_ACCESS_POLICY_TOKEN: ${{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check types
run: npm run typecheck
- name: Lint
run: npm run lint
- name: Unit tests
run: npm run test:ci
- name: Build frontend
run: |
if [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/main" ]; then
npm run build -- --profile --json stats.json
else
npm run build
fi
- name: Check for backend
id: check-for-backend
run: |
if [ -f "Magefile.go" ]
then
echo "has-backend=true" >> $GITHUB_OUTPUT
fi
- name: Setup Go environment
if: steps.check-for-backend.outputs.has-backend == 'true'
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Test backend
if: steps.check-for-backend.outputs.has-backend == 'true'
uses: magefile/mage-action@v3
with:
version: latest
args: coverage
- name: Build backend
if: steps.check-for-backend.outputs.has-backend == 'true'
uses: magefile/mage-action@v3
with:
version: latest
args: buildAll
- name: Check for E2E
id: check-for-e2e
run: |
if [ -f "playwright.config.ts" ]
then
echo "has-e2e=true" >> $GITHUB_OUTPUT
fi
- name: Sign plugin
run: npm run sign
if: ${{ env.GRAFANA_ACCESS_POLICY_TOKEN != '' }}
- name: Get plugin metadata
id: metadata
run: |
sudo apt-get install jq
export GRAFANA_PLUGIN_ID=$(cat dist/plugin.json | jq -r .id)
export GRAFANA_PLUGIN_VERSION=$(cat dist/plugin.json | jq -r .info.version)
export GRAFANA_PLUGIN_ARTIFACT=${GRAFANA_PLUGIN_ID}-${GRAFANA_PLUGIN_VERSION}.zip
echo "plugin-id=${GRAFANA_PLUGIN_ID}" >> $GITHUB_OUTPUT
echo "plugin-version=${GRAFANA_PLUGIN_VERSION}" >> $GITHUB_OUTPUT
echo "archive=${GRAFANA_PLUGIN_ARTIFACT}" >> $GITHUB_OUTPUT
- name: Package plugin
id: package-plugin
run: |
mv dist ${{ steps.metadata.outputs.plugin-id }}
zip ${{ steps.metadata.outputs.archive }} ${{ steps.metadata.outputs.plugin-id }} -r
- name: Check plugin.json
run: |
docker run --pull=always \
-v $PWD/${{ steps.metadata.outputs.archive }}:/archive.zip \
grafana/plugin-validator-cli -analyzer=metadatavalid /archive.zip
- name: Archive Build
uses: actions/upload-artifact@v4
with:
name: ${{ steps.metadata.outputs.plugin-id }}-${{ steps.metadata.outputs.plugin-version }}
path: ${{ steps.metadata.outputs.plugin-id }}
retention-days: 5
- name: Upload stats.json artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: main-branch-stats
path: stats.json
overwrite: true
resolve-versions:
name: Resolve e2e images
runs-on: ubuntu-latest
timeout-minutes: 3
needs: build
if: ${{ needs.build.outputs.has-e2e == 'true' }}
outputs:
matrix: ${{ steps.resolve-versions.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Resolve Grafana E2E versions
id: resolve-versions
uses: grafana/plugin-actions/e2e-version@main
playwright-tests:
needs: [resolve-versions, build]
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
GRAFANA_IMAGE: ${{fromJson(needs.resolve-versions.outputs.matrix)}}
name: e2e test ${{ matrix.GRAFANA_IMAGE.name }}@${{ matrix.GRAFANA_IMAGE.VERSION }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download plugin
uses: actions/download-artifact@v4
with:
path: dist
name: ${{ needs.build.outputs.plugin-id }}-${{ needs.build.outputs.plugin-version }}
- name: Execute permissions on binary
if: needs.build.outputs.has-backend == 'true'
run: |
chmod +x ./dist/gpx_*
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dev dependencies
run: npm ci
- name: Start Grafana
run: |
docker compose pull
ANONYMOUS_AUTH_ENABLED=false DEVELOPMENT=false GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker compose up -d
- name: Wait for grafana server
uses: grafana/plugin-actions/wait-for-grafana@main
with:
url: http://localhost:3000/login
- name: Install Playwright Browsers
run: npm exec playwright install chromium --with-deps
- name: Run Playwright tests
id: run-tests
run: npm run e2e
- name: Docker logs
if: ${{ always() && steps.run-tests.outcome == 'failure' }}
run: |
docker logs grafana-timely-datasource >& grafana-server.log
- name: Stop grafana docker
run: docker compose down
- name: Upload server log
uses: actions/upload-artifact@v4
if: ${{ always() && steps.run-tests.outcome == 'failure' }}
with:
name: ${{ matrix.GRAFANA_IMAGE.NAME }}-v${{ matrix.GRAFANA_IMAGE.VERSION }}-${{github.run_id}}-server-log
path: grafana-server.log
retention-days: 5
# Uncomment this step to upload the Playwright report to Github artifacts.
# If your repository is public, the report will be public on the Internet so beware not to expose sensitive information.
# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# if: ${{ always() && steps.run-tests.outcome == 'failure' }}
# with:
# name: playwright-report-${{ matrix.GRAFANA_IMAGE.NAME }}-v${{ matrix.GRAFANA_IMAGE.VERSION }}-${{github.run_id}}
# path: playwright-report/
# retention-days: 5
@@ -0,0 +1,26 @@
name: Create Plugin Update
on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *' # run once a month on the 1st day
# To use the default github token with the following elevated permissions make sure to check:
# **Allow GitHub Actions to create and approve pull requests** in https://github.com/ORG_NAME/REPO_NAME/settings/actions.
# Alternatively create a fine-grained personal access token for your repository with
# `contents: read and write` and `pull requests: read and write` and pass it to the action.
permissions:
contents: write
pull-requests: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: grafana/plugin-actions/create-plugin-update@main
# Uncomment to use a fine-grained personal access token instead of default github token
# (For more info on how to generate the token see https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
# with:
# Make sure to save the token in your repository secrets
# token: $
@@ -0,0 +1,19 @@
name: Latest Grafana API compatibility check
on: [pull_request]
jobs:
compatibilitycheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build plugin
run: npm run build
- name: Compatibility check
run: npx --yes @grafana/levitate@latest is-compatible --path $(find ./src -type f \( -name "module.ts" -o -name "module.tsx" \)) --target @grafana/data,@grafana/ui,@grafana/runtime
+26
View File
@@ -0,0 +1,26 @@
# This GitHub Action automates the process of building Grafana plugins.
# (For more information, see https://github.com/grafana/plugin-actions/blob/main/build-plugin/README.md)
name: Release
on:
push:
tags:
- 'v*' # Run workflow on version tags, e.g. v1.0.0.
permissions: read-all
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: grafana/plugin-actions/build-plugin@main
# Uncomment to enable plugin signing
# (For more info on how to generate the access policy token see https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin#generate-an-access-policy-token)
#with:
# Make sure to save the token in your repository secrets
#policy_token: $
# Usage of GRAFANA_API_KEY is deprecated, prefer `policy_token` option above
#grafana_token: $
+41
View File
@@ -0,0 +1,41 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
node_modules/
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Compiled binary addons (https://nodejs.org/api/addons.html)
artifacts/
work/
ci/
# e2e test directories
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
/playwright/.auth/
# Editor
.idea
.eslintcache
# Data
data
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
// Prettier configuration provided by Grafana scaffolding
...require('./.config/.prettierrc.js'),
};
+133
View File
@@ -0,0 +1,133 @@
# Grafana data source plugin template
This template is a starting point for building a Data Source Plugin for Grafana.
## What are Grafana data source plugins?
Grafana supports a wide range of data sources, including Prometheus, MySQL, and even Datadog. There’s a good chance you can already visualize metrics from the systems you have set up. In some cases, though, you already have an in-house metrics solution that you’d like to add to your Grafana dashboards. Grafana Data Source Plugins enables integrating such solutions with Grafana.
## Getting started
### Backend
1. Update [Grafana plugin SDK for Go](https://grafana.com/developers/plugin-tools/key-concepts/backend-plugins/grafana-plugin-sdk-for-go) dependency to the latest minor version:
```bash
go get -u github.com/grafana/grafana-plugin-sdk-go
go mod tidy
```
2. Build backend plugin binaries for Linux, Windows and Darwin:
```bash
mage -v
```
3. List all available Mage targets for additional commands:
```bash
mage -l
```
### Frontend
1. Install dependencies
```bash
npm install
```
2. Build plugin in development mode and run in watch mode
```bash
npm run dev
```
3. Build plugin in production mode
```bash
npm run build
```
4. Run the tests (using Jest)
```bash
# Runs the tests and watches for changes, requires git init first
npm run test
# Exits after running all the tests
npm run test:ci
```
5. Spin up a Grafana instance and run the plugin inside it (using Docker)
```bash
npm run server
```
6. Run the E2E tests (using Cypress)
```bash
# Spins up a Grafana instance first that we tests against
npm run server
# Starts the tests
npm run e2e
```
7. Run the linter
```bash
npm run lint
# or
npm run lint:fix
```
# Distributing your plugin
When distributing a Grafana plugin either within the community or privately the plugin must be signed so the Grafana application can verify its authenticity. This can be done with the `@grafana/sign-plugin` package.
_Note: It's not necessary to sign a plugin during development. The docker development environment that is scaffolded with `@grafana/create-plugin` caters for running the plugin without a signature._
## Initial steps
Before signing a plugin please read the Grafana [plugin publishing and signing criteria](https://grafana.com/legal/plugins/#plugin-publishing-and-signing-criteria) documentation carefully.
`@grafana/create-plugin` has added the necessary commands and workflows to make signing and distributing a plugin via the grafana plugins catalog as straightforward as possible.
Before signing a plugin for the first time please consult the Grafana [plugin signature levels](https://grafana.com/legal/plugins/#what-are-the-different-classifications-of-plugins) documentation to understand the differences between the types of signature level.
1. Create a [Grafana Cloud account](https://grafana.com/signup).
2. Make sure that the first part of the plugin ID matches the slug of your Grafana Cloud account.
- _You can find the plugin ID in the `plugin.json` file inside your plugin directory. For example, if your account slug is `acmecorp`, you need to prefix the plugin ID with `acmecorp-`._
3. Create a Grafana Cloud API key with the `PluginPublisher` role.
4. Keep a record of this API key as it will be required for signing a plugin
## Signing a plugin
### Using Github actions release workflow
If the plugin is using the github actions supplied with `@grafana/create-plugin` signing a plugin is included out of the box. The [release workflow](./.github/workflows/release.yml) can prepare everything to make submitting your plugin to Grafana as easy as possible. Before being able to sign the plugin however a secret needs adding to the Github repository.
1. Please navigate to "settings > secrets > actions" within your repo to create secrets.
2. Click "New repository secret"
3. Name the secret "GRAFANA_API_KEY"
4. Paste your Grafana Cloud API key in the Secret field
5. Click "Add secret"
#### Push a version tag
To trigger the workflow we need to push a version tag to github. This can be achieved with the following steps:
1. Run `npm version <major|minor|patch>`
2. Run `git push origin main --follow-tags`
## Learn more
Below you can find source code for existing app plugins and other related documentation.
- [Basic data source plugin example](https://github.com/grafana/grafana-plugin-examples/tree/master/examples/datasource-basic#readme)
- [`plugin.json` documentation](https://grafana.com/developers/plugin-tools/reference/plugin-json)
- [How to sign a plugin?](https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin)
+6
View File
@@ -0,0 +1,6 @@
# Changelog
## 2.2.0
Update data source to work with newer versions of Grafana (version 10 and beyond)
Implement data source tags to allow easier maintainance and provisioning of dashboards
@@ -198,4 +198,4 @@
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.
limitations under the License.
+21
View File
@@ -0,0 +1,21 @@
//go:build mage
// +build mage
package main
import (
// mage:import
build "github.com/grafana/grafana-plugin-sdk-go/build"
)
var callback = func(cfg build.Config) (build.Config, error) {
cfg.OutputBinaryPath = "dist"
cfg.PluginJSONPath = "src"
cfg.RootPackagePath = "."
return cfg, nil
}
var Unused = build.SetBeforeBuildCallback(callback)
// Default configures the default target.
var Default = build.BuildAll
+33
View File
@@ -0,0 +1,33 @@
# Timely data source
Use this data source to fetch data from the Timely time-series database.
### Configuring the data source
Timely data source is configured with
1. Hostname or IP to Timely, Timely Balancer, or load balancer
2. Https port
3. Whether to forward the OAuth login token to Timely
4. Whether to use the server PKI is the OAuth is missing for a user
5. PKI configuration
6. Whether to allow insecure SSL (e.g. self-signed certificates for testing)
7. Data source tags where the configured tag keys / tag values are added to queries that contain the corresponding data source tag key
### Constructing a query
1. Autocomplete values (using substring matching) for the metric and tag keys/values are fetched via the suggest API from the Timely metadata table
2. Select or type a metric name
3. Tag keys will populate based on the selected metric
4. Tag values will populate based on the selected metric and selected tag key
5. Data source tags - a method of adding a tag to the query if the data source is configured with a tag value for the requested tag key
5. Alias is a way of setting the series name. Variable values can be used:
1. \${metric} will substitute the name of the metric
2. \${tag_TAGKEY} will substitute the corresponding tag value for each series
6. Downsample - downsample period to collect all values with unique tag key / tag value for all requested tags
7. Downsample Aggregator - the operation to use on each set of collected values
8. Disable downsampling - return all values; do not downsample
9. All Results Aggregator - Combine all results per downsample period into a single value using the selected operation
10. Compute Rate - for continuously increasing metrics, compute the metric change across the downsample period and divide by the rate interval
11. Rate Interval - rate interval for computing rate - defaults to the downsample period
12. Counter - for continuously increasing metrics that reset at a maximum value
@@ -1,4 +1,4 @@
package main
package backend
import (
"bytes"
@@ -6,25 +6,34 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"os"
"github.com/hashicorp/go-hclog"
"io"
"io/ioutil"
"net/http"
"sort"
"strconv"
"strings"
"sync"
"time"
"encoding/json"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/backend/datasource"
"github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/hashicorp/go-hclog"
"encoding/json"
"io/ioutil"
"net/httpProperties"
"net/url"
)
// Make sure Datasource implements required interfaces. This is important to do
// since otherwise we will only get a not implemented error response from plugin in
// runtime. In this example datasource instance implements backend.QueryDataHandler,
// backend.CheckHealthHandler interfaces. Plugin should not implement all these
// interfaces - only those which are required for a particular task.
var (
_ backend.QueryDataHandler = (*TimelyDatasource)(nil)
_ backend.CheckHealthHandler = (*TimelyDatasource)(nil)
_ instancemgmt.InstanceDisposer = (*TimelyDatasource)(nil)
)
var (
logger = hclog.New(&hclog.LoggerOptions{
// Use debug as level since anything less severe is suppressed.
@@ -43,52 +52,17 @@ type TimelyDatasource struct {
ClientCertificatePath string
ClientKeyPath string
CertificateAuthorityPath string
Mutex *sync.Mutex
Mutex sync.Mutex
}
type TimelyDatasourceInstanceSettings struct {
}
func newDataSourceInstance(setting backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) {
return &TimelyDatasourceInstanceSettings{}, nil
}
func (s *TimelyDatasourceInstanceSettings) Dispose() {
// Called before creating a new instance to allow plugin authors
// to cleanup.
}
func getServeOpts() datasource.ServeOpts {
// creates a instance manager for your plugin. The function passed
// into `NewInstanceManger` is called when the instance is created
// for the first time or when a datasource configuration changed.
im := datasource.NewInstanceManager(newDataSourceInstance)
ds := &TimelyDatasource{
im: im,
CertPool: nil,
Certificate: nil,
ClientCertificatePath: "",
ClientKeyPath: "",
CertificateAuthorityPath: "",
Mutex: &sync.Mutex{},
}
return datasource.ServeOpts{
CheckHealthHandler: ds,
CallResourceHandler: ds,
QueryDataHandler: ds,
}
}
//func (ds *TimelyDatasource) getSettings(pluginContext backend.PluginContext) (*TimelyDatasourceInstanceSettings, error) {
// iface, err := ds.im.Get(pluginContext)
// if err != nil {
// return nil, err
// }
//
// return iface.(*TimelyDatasourceInstanceSettings), nil
//type TimelyDatasourceInstanceSettings struct {
//}
// NewDatasource creates a new datasource instance.
func NewDatasource(_ context.Context, _ backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) {
return &TimelyDatasource{}, nil
}
// CheckHealth handles health checks sent from Grafana to the plugin.
// The main use case for these health checks is the test button on the
// datasource configuration page which allows users to verify that
@@ -112,7 +86,7 @@ func (td *TimelyDatasource) CallResource(ctx context.Context, request *backend.C
}
var response backend.CallResourceResponse
pluginContext := request.PluginContext
var httpResponse *httpProperties.Response
var httpResponse *http.Response
var timelyDataSourceOptions TimelyDataSourceOptions
err := json.Unmarshal(pluginContext.DataSourceInstanceSettings.JSONData, &timelyDataSourceOptions)
if err != nil {
@@ -125,11 +99,11 @@ func (td *TimelyDatasource) CallResource(ctx context.Context, request *backend.C
logger.Error("Error getting httpClient", "error", err)
return err
}
if strings.HasPrefix(request.Path, "/api/aggregators") ||
strings.HasPrefix(request.Path, "/api/suggest") ||
strings.HasPrefix(request.Path, "/api/search/lookup") {
var timelyUrl *url.URL
if request.Method == "GET" {
var x = strings.Index(request.URL, request.Path)
finalParams := ""
@@ -140,26 +114,36 @@ func (td *TimelyDatasource) CallResource(ctx context.Context, request *backend.C
finalParams = params
}
}
url, err := url.Parse("https://" + timelyDataSourceOptions.TimelyHost + ":" + timelyDataSourceOptions.HttpsPort + request.Path + finalParams)
timelyUrl, err = url.Parse("https://" + timelyDataSourceOptions.TimelyHost + ":" + strconv.Itoa(int(timelyDataSourceOptions.HttpsPort)) + request.Path + finalParams)
if err != nil {
return err
}
httpResponse, err = httpClient.Get(url.String())
httpResponse, err = httpClient.Get(timelyUrl.String())
} else if request.Method == "POST" {
url, err := url.Parse("https://" + timelyDataSourceOptions.TimelyHost + ":" + timelyDataSourceOptions.HttpsPort + request.Path)
timelyUrl, err = url.Parse("https://" + timelyDataSourceOptions.TimelyHost + ":" + strconv.Itoa(int(timelyDataSourceOptions.HttpsPort)) + request.Path)
if err != nil {
return err
}
httpResponse, err = httpClient.Post(url.String(), "application/json", bytes.NewReader(request.Body))
httpResponse, err = httpClient.Post(timelyUrl.String(), "application/json", bytes.NewReader(request.Body))
}
if err != nil {
logger.Error("Error calling for resource", "Path", request.Path, "error", err)
logger.Error("Error fetching resource", "url", timelyUrl.String(), "error", err)
return err
}
bytes, err := ioutil.ReadAll(httpResponse.Body)
if httpResponse == nil {
logger.Error("Error fetching resource, httpResponse null", "url", timelyUrl.String())
return fmt.Errorf("Error fetching resource url:%s, httpResponse null", timelyUrl.String())
}
if httpResponse.StatusCode != 200 {
logger.Error("Error fetching resource", "url", timelyUrl.String(), "responseCode", httpResponse.StatusCode)
return fmt.Errorf("Error fetching resource url:%s responseCode:%d", timelyUrl.String(), httpResponse.StatusCode)
}
bytes, err := io.ReadAll(httpResponse.Body)
if err != nil {
logger.Error("Error reading resource", "Path", request.Path, "error", err)
logger.Error("Error reading resource", "url", timelyUrl, "error", err)
return err
}
response.Status = 200
@@ -177,6 +161,7 @@ func (td *TimelyDatasource) CallResource(ctx context.Context, request *backend.C
// The QueryDataResponse contains a map of RefID to the response for each query, and each response
// contains Frames ([]*Frame).
func (td *TimelyDatasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
logger.Info("QueryData called with:", "Request", req)
// create response struct
response := backend.NewQueryDataResponse()
@@ -225,6 +210,7 @@ func (td *TimelyDatasource) Query(queryDataRequest *backend.QueryDataRequest, da
Tags: timelyQueryServer.Tags,
Filters: timelyQueryServer.Filters,
ShouldComputeRate: timelyQueryServer.ShouldComputeRate,
RateInterval: timelyQueryServer.RateInterval,
IsCounter: timelyQueryServer.IsCounter,
CounterMax: timelyQueryServer.CounterMax,
CounterResetValue: timelyQueryServer.CounterResetValue,
@@ -243,11 +229,6 @@ func (td *TimelyDatasource) Query(queryDataRequest *backend.QueryDataRequest, da
return nil, err
}
timelyQuery := td.convertTimelyQuery(&timelyQueryForm)
timelyRequest.Queries = append(timelyRequest.Queries, *timelyQuery)
logger.Debug("Query", "timelyRequest", timelyRequest)
var timelyDatasourceOptions TimelyDataSourceOptions
err = json.Unmarshal(queryDataRequest.PluginContext.DataSourceInstanceSettings.JSONData, &timelyDatasourceOptions)
@@ -256,7 +237,12 @@ func (td *TimelyDatasource) Query(queryDataRequest *backend.QueryDataRequest, da
return nil, err
}
var httpRequest *httpProperties.Request
timelyQuery := td.convertTimelyQuery(&timelyQueryForm, timelyDatasourceOptions)
timelyRequest.Queries = append(timelyRequest.Queries, *timelyQuery)
logger.Debug("Query", "timelyRequest", timelyRequest)
var httpRequest *http.Request
httpRequest, err = td.createRequest(timelyDatasourceOptions, timelyRequest)
if err != nil {
logger.Error("Error creating httpRequest", "error", err)
@@ -283,8 +269,15 @@ func (td *TimelyDatasource) Query(queryDataRequest *backend.QueryDataRequest, da
return td.parseResponse(res)
}
func (td *TimelyDatasource) createRequest(tdo TimelyDataSourceOptions, timelyRequest TimelyRequest) (*httpProperties.Request, error) {
u, err := url.Parse("https://" + tdo.TimelyHost + ":" + tdo.HttpsPort + "/api/query")
// Dispose here tells plugin SDK that plugin wants to clean up resources when a new instance
// created. As soon as datasource settings change detected by SDK old datasource instance will
// be disposed and a new one will be created using NewSampleDatasource factory function.
func (d *TimelyDatasource) Dispose() {
// Clean up datasource instance resources.
}
func (td *TimelyDatasource) createRequest(tdo TimelyDataSourceOptions, timelyRequest TimelyRequest) (*http.Request, error) {
u, err := url.Parse("https://" + tdo.TimelyHost + ":" + strconv.Itoa(int(tdo.HttpsPort)) + "/api/query")
if err != nil {
logger.Error("Failed creating query url", "error", err)
return nil, fmt.Errorf("Failed creating query url. error: %v", err)
@@ -294,7 +287,7 @@ func (td *TimelyDatasource) createRequest(tdo TimelyDataSourceOptions, timelyReq
logger.Error("Failed marshaling timelyRequest", "error", err)
return nil, fmt.Errorf("Failed to create request. error: %v", err)
}
req, err := httpProperties.NewRequest(httpProperties.MethodPost, u.String(), bytes.NewReader(postData))
req, err := http.NewRequest(http.MethodPost, u.String(), bytes.NewReader(postData))
if err != nil {
logger.Error("Failed to create request", "error", err)
return nil, fmt.Errorf("Failed to create request. error: %v", err)
@@ -310,9 +303,9 @@ func (td *TimelyDatasource) createRequest(tdo TimelyDataSourceOptions, timelyReq
return req, err
}
func (td *TimelyDatasource) parseResponse(res *httpProperties.Response) (*backend.DataResponse, error) {
func (td *TimelyDatasource) parseResponse(res *http.Response) (*backend.DataResponse, error) {
body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
defer res.Body.Close()
if err != nil {
return nil, err
@@ -369,7 +362,7 @@ func (td *TimelyDatasource) parseResponse(res *httpProperties.Response) (*backen
return &response, nil
}
func (td *TimelyDatasource) convertTimelyQuery(timelyQueryForm *TimelyQueryForm) *TimelyQuery {
func (td *TimelyDatasource) convertTimelyQuery(timelyQueryForm *TimelyQueryForm, datasourceOptions TimelyDataSourceOptions) *TimelyQuery {
if timelyQueryForm == nil {
return nil
@@ -385,6 +378,13 @@ func (td *TimelyDatasource) convertTimelyQuery(timelyQueryForm *TimelyQueryForm)
Tsuids: timelyQueryForm.Tsuids,
}
for i := 0; i < len(timelyQueryForm.DatasourceTags); i++ {
tagKey := timelyQueryForm.DatasourceTags[i]
if _, ok := datasourceOptions.DatasourceTags[tagKey]; ok {
timelyQuery.Tags[tagKey] = datasourceOptions.DatasourceTags[tagKey]
}
}
// future work - replace scopedVariables in metric, tags, filters, aggregator
timelyQuery.Aggregator = "avg"
@@ -395,16 +395,10 @@ func (td *TimelyDatasource) convertTimelyQuery(timelyQueryForm *TimelyQueryForm)
if timelyQueryForm.ShouldComputeRate {
timelyQuery.Rate = true
timelyQuery.RateOptions.Interval = timelyQueryForm.RateInterval
timelyQuery.RateOptions.Counter = timelyQueryForm.IsCounter
}
if len(timelyQueryForm.RateInterval) > 0 {
rateInterval, error := strconv.ParseInt(timelyQueryForm.RateInterval, 10, 32)
if error == nil {
timelyQuery.RateOptions.Interval = int32(rateInterval)
}
}
if len(timelyQueryForm.CounterMax) > 0 {
counterMax, error := strconv.ParseInt(timelyQueryForm.CounterMax, 10, 32)
if error == nil {
@@ -441,17 +435,17 @@ func (td *TimelyDatasource) clientSslSettingsChanged(settings TimelyDataSourceOp
certificateAuthorityPath != td.CertificateAuthorityPath
}
func (td *TimelyDatasource) GetHttpClient(settings TimelyDataSourceOptions, useClientCertIfAvailable bool) (*httpProperties.Client, error) {
func (td *TimelyDatasource) GetHttpClient(settings TimelyDataSourceOptions, useClientCertIfAvailable bool) (*http.Client, error) {
// handle call back
logger.Debug("Getting client", "allowInsecureSsl", strconv.FormatBool(settings.AllowInsecureSsl))
tr := &httpProperties.Transport{
Proxy: httpProperties.ProxyFromEnvironment,
tr := &http.Transport{
Proxy: http.ProxyFromEnvironment,
TLSClientConfig: &tls.Config{
InsecureSkipVerify: settings.AllowInsecureSsl,
},
}
httpClient := &httpProperties.Client{
httpClient := &http.Client{
Transport: tr,
}
@@ -518,16 +512,3 @@ func (td *TimelyDatasource) GetHttpClient(settings TimelyDataSourceOptions, useC
td.Mutex.Unlock()
return httpClient, nil
}
func main() {
// Start listening to requests send from Grafana. This call is blocking so
// it wont finish until Grafana shutsdown the process or the plugin choose
// to exit close down by itself
err := datasource.Serve(getServeOpts())
// Log any error if we could not start the plugin.
if err != nil {
logger.Error("Plugin failed to start", "error", err)
os.Exit(1)
}
}
+105
View File
@@ -0,0 +1,105 @@
package backend
type TimelyQueryForm struct {
Metric string `json:"metric"`
Alias string `json:"alias"`
Aggregator string `json:"aggregator"`
DisableDownsampling bool `json:"disableDownsampling"`
DownsampleAggregator string `json:"downsampleAggregator"`
DownsampleFillPolicy string `json:"downsampleFillPolicy"`
DownsampleInterval string `json:"downsampleInterval"`
Tags map[string]string `json:"tags"`
DatasourceTags []string `json:"datasourceTags"`
Filters []Filter `json:"filters"`
ShouldComputeRate bool `json:"shouldComputeRate"`
RateInterval string `json:"rateInterval"`
IsCounter bool `json:"isCounter"`
CounterMax string `json:"counterMax"`
CounterResetValue string `json:"counterResetValue"`
Tsuids []string `json:"tsuids"`
QueryType string `json:"queryType"`
RefId string `json:"refId"`
Datasource map[string]string `json:"datasource"`
DatasourceId int64 `json:"datasourceId"`
IntervalMs int64 `json:"intervalMs"`
MaxDataPoints int64 `json:"maxDataPoints"`
OrgId int64 `json:"ordId"`
}
type TimelyQueryServer struct {
Metric string `json:"metric"`
Aggregator string `json:"aggregator"`
DisableDownsampling bool `json:"disableDownsampling"`
DownsampleAggregator string `json:"downsampleAggregator"`
DownsampleFillPolicy string `json:"downsampleFillPolicy"`
DownsampleInterval string `json:"downsampleInterval"`
Tags map[string]string `json:"tags"`
DatasourceTags []string `json:"datasourceTags"`
Filters []Filter `json:"filters"`
ShouldComputeRate bool `json:"shouldComputeRate"`
RateInterval string `json:"rateInterval"`
IsCounter bool `json:"isCounter"`
CounterMax string `json:"counterMax"`
CounterResetValue string `json:"counterResetValue"`
Tsuids []string `json:"tsuids"`
QueryType string `json:"queryType"`
RefId string `json:"refId"`
}
type Filter struct {
Type string `json:"type"`
TagK string `json:"tagk"`
Filter string `json:"filter"`
GroupBy bool `json:"groupBy"`
}
type RateOptions struct {
Counter bool `json:"counter"`
Interval string `json:"interval"`
CounterMax int32 `json:"counterMax"`
ResetValue int32 `json:"resetValue"`
}
type TimelyQuery struct {
Metric string `json:"metric"`
Aggregator string `json:"aggregator"`
Rate bool `json:"rate"`
RateOptions RateOptions `json:"rateOptions"`
Downsample string `json:"downsample"`
Tags map[string]string `json:"tags"`
Filters []Filter `json:"filters"`
Tsuids []string `json:"tsuids"`
}
type TimelyRequest struct {
MsResolution bool `json:"msResolution"`
GlobalAnnotations bool `json:"globalAnnotations"`
Start int64 `json:"start"`
End int64 `json:"end"`
Queries []TimelyQuery `json:"queries"`
}
type TimelyResponse struct {
Metric string `json:"metric"`
Tags map[string]string `json:"tags"`
AggregatedTags []string `json:"aggregatedTags"`
DataPoints map[int64]float64 `json:"dps"`
}
type TimelyDataSourceOptions struct {
TimelyHost string `json:"timelyHost"`
HttpsPort int32 `json:"httpsPort"`
OauthPassThru bool `json:"oauthPassThru"`
UseClientCertWhenOAuthMissing bool `json:"useClientCertWhenOAuthMissing"`
ClientCertificatePath string `json:"clientCertificatePath"`
ClientKeyPath string `json:"clientKeyPath"`
CertificateAuthorityPath string `json:"certificateAuthorityPath"`
AllowInsecureSsl bool `json:"allowInsecureSsl"`
DatasourceTags map[string]string `json:"datasourceTags"`
}
type TimelyErrorResponse struct {
ResponseCode int32 `json:responseCode`
Message string `json:message`
DetailMessage string `json:detailMessage`
}
+6
View File
@@ -0,0 +1,6 @@
# Changelog
## 2.2.0
Update data source to work with newer versions of Grafana (version 10 and beyond)
Implement data source tags to allow easier maintainance and provisioning of dashboards
@@ -1,6 +1,6 @@
Apache License
Version 2.0, January 2004
httpProperties://www.apache.org/licenses/
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
@@ -192,10 +192,10 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
httpProperties://www.apache.org/licenses/LICENSE-2.0
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.
limitations under the License.
+33
View File
@@ -0,0 +1,33 @@
# Timely data source
Use this data source to fetch data from the Timely time-series database.
### Configuring the data source
Timely data source is configured with
1. Hostname or IP to Timely, Timely Balancer, or load balancer
2. Https port
3. Whether to forward the OAuth login token to Timely
4. Whether to use the server PKI is the OAuth is missing for a user
5. PKI configuration
6. Whether to allow insecure SSL (e.g. self-signed certificates for testing)
7. Data source tags where the configured tag keys / tag values are added to queries that contain the corresponding data source tag key
### Constructing a query
1. Autocomplete values (using substring matching) for the metric and tag keys/values are fetched via the suggest API from the Timely metadata table
2. Select or type a metric name
3. Tag keys will populate based on the selected metric
4. Tag values will populate based on the selected metric and selected tag key
5. Data source tags - a method of adding a tag to the query if the data source is configured with a tag value for the requested tag key
5. Alias is a way of setting the series name. Variable values can be used:
1. \${metric} will substitute the name of the metric
2. \${tag_TAGKEY} will substitute the corresponding tag value for each series
6. Downsample - downsample period to collect all values with unique tag key / tag value for all requested tags
7. Downsample Aggregator - the operation to use on each set of collected values
8. Disable downsampling - return all values; do not downsample
9. All Results Aggregator - Combine all results per downsample period into a single value using the selected operation
10. Compute Rate - for continuously increasing metrics, compute the metric change across the downsample period and divide by the rate interval
11. Rate Interval - rate interval for computing rate - defaults to the downsample period
12. Counter - for continuously increasing metrics that reset at a maximum value
+4
View File
@@ -0,0 +1,4 @@
9bbcd04e5fa6f9fe3a3b2730b450164db1e5797f2685a542246ef1fac2027425:Magefile.go
3ca1832edd2c02ab79eac74cce6bb81a9eb4e3bc1a1fb7029e698c2559c19d00:backend/datasource.go
a22056f256684f5b0730e593b2b0ed54ca7170d00583b14d2ce59ec849d627d8:backend/types.go
dab0637ff6133c01abd28bc87b8f65d5b1f09ce98f1d40d8cb49864f396839d1:main.go
File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

+4
View File
@@ -0,0 +1,4 @@
/*! For license information please see module.js.LICENSE.txt */
/* [create-plugin] version: 5.12.4 */
define(["@grafana/data","@grafana/runtime","@grafana/ui","lodash","module","react","react-dom"],((e,t,n,r,o,i,a)=>(()=>{var l={210:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var r=n(942),o=n.n(r),i=n(278),a=n.n(i)()(o());a.push([e.id,"div.timely .form-control {\n display: block;\n width: 100%;\n height: 32px;\n padding: 0px 8px;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.5;\n border: 1px solid #ced4da;\n border-radius: 2px;\n transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;\n background-clip: padding-box;\n}\n\ndiv.timely .form-control::-ms-expand {\n background-color: transparent;\n border: 0;\n}\n\ndiv.timely .form-control:-moz-focusring {\n color: transparent;\n text-shadow: 0 0 0 #495057;\n}\n\ndiv.timely .form-control:focus,\ndiv.timely input:focus {\n border-color: #80bdff;\n outline: 0;\n transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;\n}\n\ndiv.timely .form-control-file,\ndiv.timely .form-control-range {\n display: block;\n width: 100%;\n}\n\ndiv.timely .form-control-plaintext {\n display: block;\n width: 100%;\n padding: 0.375rem 0;\n margin-bottom: 0;\n font-size: 1rem;\n line-height: 1.5;\n border: solid transparent;\n border-width: 1px 0;\n}\n\ndiv.timely .form-control-plaintext.form-control-sm,\ndiv.timely .form-control-plaintext.form-control-lg {\n padding-right: 0;\n padding-left: 0;\n}\n\ndiv.timely .form-control-sm {\n height: calc(1.5em + 0.5rem + 2px);\n padding: 0.25rem 0.5rem;\n font-size: 0.875rem;\n line-height: 1.5;\n border-radius: 0.2rem;\n}\n\ndiv.timely .form-control-lg {\n height: calc(1.5em + 1rem + 2px);\n padding: 0.5rem 1rem;\n font-size: 1.25rem;\n line-height: 1.5;\n border-radius: 0.3rem;\n}\n\ndiv.timely select.form-control[size],\ndiv.timely select.form-control[multiple] {\n height: auto;\n}\n\ndiv.timely textarea.form-control {\n height: auto;\n}\n\ndiv.timely .dropdown-item {\n display: block;\n width: 100%;\n padding: 0.25rem 1.5rem;\n clear: both;\n font-weight: 400;\n color: #212529;\n text-align: inherit;\n white-space: nowrap;\n background-color: transparent;\n border: 0;\n}\n\ndiv.timely .dropdown-item:hover,\ndiv.timely .dropdown-item:focus {\n color: #16181b;\n text-decoration: none;\n background-color: #f8f9fa;\n}\n\ndiv.timely .dropdown-item.active,\ndiv.timely .dropdown-item:active {\n color: #fff;\n text-decoration: none;\n background-color: #007bff;\n}\n\ndiv.timely .dropdown-item.disabled,\ndiv.timely .dropdown-item:disabled {\n pointer-events: none;\n background-color: transparent;\n}\n\ndiv.timely .dropdown-item-text {\n display: block;\n padding: 0.25rem 1.5rem;\n color: #212529;\n}\n\ndiv.timely .dropup,\ndiv.timely .dropright,\ndiv.timely .dropdown,\ndiv.timely .dropleft {\n position: relative;\n}\n\ndiv.timely .dropdown-toggle {\n white-space: nowrap;\n}\n\ndiv.timely .dropdown-toggle::after {\n display: inline-block;\n margin-left: 0.255em;\n vertical-align: 0.255em;\n content: '';\n border-top: 0.3em solid;\n border-right: 0.3em solid transparent;\n border-bottom: 0;\n border-left: 0.3em solid transparent;\n}\n\ndiv.timely .dropdown-toggle:empty::after {\n margin-left: 0;\n}\n\ndiv.timely .dropdown-menu {\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 1000;\n display: none;\n float: left;\n min-width: 10rem;\n padding: 0.5rem 0;\n margin: 0.125rem 0 0;\n font-size: 1rem;\n text-align: left;\n list-style: none;\n background-color: #fff;\n background-clip: padding-box;\n border: 1px solid rgba(0, 0, 0, 0.15);\n border-radius: 0.25rem;\n}\n\ndiv.timely .dropdown-menu-left {\n right: auto;\n left: 0;\n}\n\ndiv.timely .dropdown-menu-right {\n right: 0;\n left: auto;\n}\n\ndiv.timely .dropup .dropdown-menu {\n top: auto;\n bottom: 100%;\n margin-top: 0;\n margin-bottom: 0.125rem;\n}\n\ndiv.timely .dropup .dropdown-toggle::after {\n display: inline-block;\n margin-left: 0.255em;\n vertical-align: 0.255em;\n content: '';\n border-top: 0;\n border-right: 0.3em solid transparent;\n border-bottom: 0.3em solid;\n border-left: 0.3em solid transparent;\n}\n\ndiv.timely .dropup .dropdown-toggle:empty::after {\n margin-left: 0;\n}\n\ndiv.timely .dropright .dropdown-menu {\n top: 0;\n right: auto;\n left: 100%;\n margin-top: 0;\n margin-left: 0.125rem;\n}\n\ndiv.timely .dropright .dropdown-toggle::after {\n display: inline-block;\n margin-left: 0.255em;\n vertical-align: 0.255em;\n content: '';\n border-top: 0.3em solid transparent;\n border-right: 0;\n border-bottom: 0.3em solid transparent;\n border-left: 0.3em solid;\n}\n\ndiv.timely .dropright .dropdown-toggle:empty::after {\n margin-left: 0;\n}\n\ndiv.timely .dropright .dropdown-toggle::after {\n vertical-align: 0;\n}\n\ndiv.timely .dropleft .dropdown-menu {\n top: 0;\n right: 100%;\n left: auto;\n margin-top: 0;\n margin-right: 0.125rem;\n}\n\ndiv.timely .dropleft .dropdown-toggle::after {\n display: inline-bloLine truncated
//# sourceMappingURL=module.js.map
Loaded 100 of 194 files, more files were not shown because too many files have changed in this diff. Show more