mirror of
https://github.com/kestra-io/kestra.git
synced 2025-12-26 05:00:31 -05:00
Compare commits
35 Commits
dependabot
...
v1.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4e90cc540 | ||
|
|
ce0fd58c94 | ||
|
|
f1b950941c | ||
|
|
559f3f2634 | ||
|
|
9bc65b84f1 | ||
|
|
223b137381 | ||
|
|
80d1df6eeb | ||
|
|
a87e7f3b8d | ||
|
|
710862ef33 | ||
|
|
d74f535ea1 | ||
|
|
1673f24356 | ||
|
|
2ad90625b8 | ||
|
|
e77b80a1a8 | ||
|
|
6223b1f672 | ||
|
|
23329f4d48 | ||
|
|
ed60cb6670 | ||
|
|
f6306883b4 | ||
|
|
89433dc04c | ||
|
|
4837408c59 | ||
|
|
5a8c36caa5 | ||
|
|
a2335abc0c | ||
|
|
310a7bbbe9 | ||
|
|
162feaf38c | ||
|
|
94050be49c | ||
|
|
848a5ac9d7 | ||
|
|
9ac7a9ce9a | ||
|
|
c42838f3e1 | ||
|
|
c499d62b63 | ||
|
|
8fbc62e12c | ||
|
|
ae143f29f4 | ||
|
|
e4a11fc9ce | ||
|
|
ebacfc70b9 | ||
|
|
5bf67180a3 | ||
|
|
1e670b5e7e | ||
|
|
0dacad5ee1 |
@@ -2,6 +2,7 @@ package io.kestra.cli.commands.migrations.metadata;
|
|||||||
|
|
||||||
import io.kestra.cli.AbstractCommand;
|
import io.kestra.cli.AbstractCommand;
|
||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.inject.Provider;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import picocli.CommandLine;
|
import picocli.CommandLine;
|
||||||
|
|
||||||
@@ -12,13 +13,13 @@ import picocli.CommandLine;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class KvMetadataMigrationCommand extends AbstractCommand {
|
public class KvMetadataMigrationCommand extends AbstractCommand {
|
||||||
@Inject
|
@Inject
|
||||||
private MetadataMigrationService metadataMigrationService;
|
private Provider<MetadataMigrationService> metadataMigrationServiceProvider;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer call() throws Exception {
|
public Integer call() throws Exception {
|
||||||
super.call();
|
super.call();
|
||||||
try {
|
try {
|
||||||
metadataMigrationService.kvMigration();
|
metadataMigrationServiceProvider.get().kvMigration();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("❌ KV Metadata migration failed: " + e.getMessage());
|
System.err.println("❌ KV Metadata migration failed: " + e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.kestra.cli.commands.migrations.metadata;
|
|||||||
|
|
||||||
import io.kestra.cli.AbstractCommand;
|
import io.kestra.cli.AbstractCommand;
|
||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.inject.Provider;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import picocli.CommandLine;
|
import picocli.CommandLine;
|
||||||
|
|
||||||
@@ -12,13 +13,13 @@ import picocli.CommandLine;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class SecretsMetadataMigrationCommand extends AbstractCommand {
|
public class SecretsMetadataMigrationCommand extends AbstractCommand {
|
||||||
@Inject
|
@Inject
|
||||||
private MetadataMigrationService metadataMigrationService;
|
private Provider<MetadataMigrationService> metadataMigrationServiceProvider;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer call() throws Exception {
|
public Integer call() throws Exception {
|
||||||
super.call();
|
super.call();
|
||||||
try {
|
try {
|
||||||
metadataMigrationService.secretMigration();
|
metadataMigrationServiceProvider.get().secretMigration();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("❌ Secrets Metadata migration failed: " + e.getMessage());
|
System.err.println("❌ Secrets Metadata migration failed: " + e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package io.kestra.cli.commands.servers;
|
package io.kestra.cli.commands.servers;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import io.kestra.cli.services.TenantIdSelectorService;
|
||||||
import io.kestra.core.models.ServerType;
|
import io.kestra.core.models.ServerType;
|
||||||
|
import io.kestra.core.repositories.LocalFlowRepositoryLoader;
|
||||||
import io.kestra.core.runners.ExecutorInterface;
|
import io.kestra.core.runners.ExecutorInterface;
|
||||||
import io.kestra.core.services.SkipExecutionService;
|
import io.kestra.core.services.SkipExecutionService;
|
||||||
import io.kestra.core.services.StartExecutorService;
|
import io.kestra.core.services.StartExecutorService;
|
||||||
@@ -10,6 +12,8 @@ import io.micronaut.context.ApplicationContext;
|
|||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
import picocli.CommandLine;
|
import picocli.CommandLine;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -19,6 +23,9 @@ import java.util.Map;
|
|||||||
description = "Start the Kestra executor"
|
description = "Start the Kestra executor"
|
||||||
)
|
)
|
||||||
public class ExecutorCommand extends AbstractServerCommand {
|
public class ExecutorCommand extends AbstractServerCommand {
|
||||||
|
@CommandLine.Spec
|
||||||
|
CommandLine.Model.CommandSpec spec;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
@@ -28,22 +35,28 @@ public class ExecutorCommand extends AbstractServerCommand {
|
|||||||
@Inject
|
@Inject
|
||||||
private StartExecutorService startExecutorService;
|
private StartExecutorService startExecutorService;
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--skip-executions"}, split=",", description = "The list of execution identifiers to skip, separated by a coma; for troubleshooting purpose only")
|
@CommandLine.Option(names = {"-f", "--flow-path"}, description = "Tenant identifier required to load flows from the specified path")
|
||||||
|
private File flowPath;
|
||||||
|
|
||||||
|
@CommandLine.Option(names = "--tenant", description = "Tenant identifier, Required to load flows from path")
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
@CommandLine.Option(names = {"--skip-executions"}, split=",", description = "List of execution IDs to skip, separated by commas; for troubleshooting only")
|
||||||
private List<String> skipExecutions = Collections.emptyList();
|
private List<String> skipExecutions = Collections.emptyList();
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--skip-flows"}, split=",", description = "The list of flow identifiers (tenant|namespace|flowId) to skip, separated by a coma; for troubleshooting purpose only")
|
@CommandLine.Option(names = {"--skip-flows"}, split=",", description = "List of flow identifiers (tenant|namespace|flowId) to skip, separated by a coma; for troubleshooting only")
|
||||||
private List<String> skipFlows = Collections.emptyList();
|
private List<String> skipFlows = Collections.emptyList();
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--skip-namespaces"}, split=",", description = "The list of namespace identifiers (tenant|namespace) to skip, separated by a coma; for troubleshooting purpose only")
|
@CommandLine.Option(names = {"--skip-namespaces"}, split=",", description = "List of namespace identifiers (tenant|namespace) to skip, separated by a coma; for troubleshooting only")
|
||||||
private List<String> skipNamespaces = Collections.emptyList();
|
private List<String> skipNamespaces = Collections.emptyList();
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--skip-tenants"}, split=",", description = "The list of tenants to skip, separated by a coma; for troubleshooting purpose only")
|
@CommandLine.Option(names = {"--skip-tenants"}, split=",", description = "List of tenants to skip, separated by a coma; for troubleshooting only")
|
||||||
private List<String> skipTenants = Collections.emptyList();
|
private List<String> skipTenants = Collections.emptyList();
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--start-executors"}, split=",", description = "The list of Kafka Stream executors to start, separated by a command. Use it only with the Kafka queue, for debugging purpose.")
|
@CommandLine.Option(names = {"--start-executors"}, split=",", description = "List of Kafka Stream executors to start, separated by a command. Use it only with the Kafka queue; for debugging only")
|
||||||
private List<String> startExecutors = Collections.emptyList();
|
private List<String> startExecutors = Collections.emptyList();
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--not-start-executors"}, split=",", description = "The list of Kafka Stream executors to not start, separated by a command. Use it only with the Kafka queue, for debugging purpose.")
|
@CommandLine.Option(names = {"--not-start-executors"}, split=",", description = "Lst of Kafka Stream executors to not start, separated by a command. Use it only with the Kafka queue; for debugging only")
|
||||||
private List<String> notStartExecutors = Collections.emptyList();
|
private List<String> notStartExecutors = Collections.emptyList();
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@@ -64,6 +77,16 @@ public class ExecutorCommand extends AbstractServerCommand {
|
|||||||
|
|
||||||
super.call();
|
super.call();
|
||||||
|
|
||||||
|
if (flowPath != null) {
|
||||||
|
try {
|
||||||
|
LocalFlowRepositoryLoader localFlowRepositoryLoader = applicationContext.getBean(LocalFlowRepositoryLoader.class);
|
||||||
|
TenantIdSelectorService tenantIdSelectorService = applicationContext.getBean(TenantIdSelectorService.class);
|
||||||
|
localFlowRepositoryLoader.load(tenantIdSelectorService.getTenantId(this.tenantId), this.flowPath);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new CommandLine.ParameterException(this.spec.commandLine(), "Invalid flow path", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ExecutorInterface executorService = applicationContext.getBean(ExecutorInterface.class);
|
ExecutorInterface executorService = applicationContext.getBean(ExecutorInterface.class);
|
||||||
executorService.run();
|
executorService.run();
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class IndexerCommand extends AbstractServerCommand {
|
|||||||
@Inject
|
@Inject
|
||||||
private SkipExecutionService skipExecutionService;
|
private SkipExecutionService skipExecutionService;
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--skip-indexer-records"}, split=",", description = "a list of indexer record keys, separated by a coma; for troubleshooting purpose only")
|
@CommandLine.Option(names = {"--skip-indexer-records"}, split=",", description = "a list of indexer record keys, separated by a coma; for troubleshooting only")
|
||||||
private List<String> skipIndexerRecords = Collections.emptyList();
|
private List<String> skipIndexerRecords = Collections.emptyList();
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class StandAloneCommand extends AbstractServerCommand {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private FileChangedEventListener fileWatcher;
|
private FileChangedEventListener fileWatcher;
|
||||||
|
|
||||||
@CommandLine.Option(names = {"-f", "--flow-path"}, description = "the flow path containing flow to inject at startup (when running with a memory flow repository)")
|
@CommandLine.Option(names = {"-f", "--flow-path"}, description = "Tenant identifier required to load flows from the specified path")
|
||||||
private File flowPath;
|
private File flowPath;
|
||||||
|
|
||||||
@CommandLine.Option(names = "--tenant", description = "Tenant identifier, Required to load flows from path with the enterprise edition")
|
@CommandLine.Option(names = "--tenant", description = "Tenant identifier, Required to load flows from path with the enterprise edition")
|
||||||
@@ -51,19 +51,19 @@ public class StandAloneCommand extends AbstractServerCommand {
|
|||||||
@CommandLine.Option(names = {"--worker-thread"}, description = "the number of worker threads, defaults to eight times the number of available processors. Set it to 0 to avoid starting a worker.")
|
@CommandLine.Option(names = {"--worker-thread"}, description = "the number of worker threads, defaults to eight times the number of available processors. Set it to 0 to avoid starting a worker.")
|
||||||
private int workerThread = defaultWorkerThread();
|
private int workerThread = defaultWorkerThread();
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--skip-executions"}, split=",", description = "a list of execution identifiers to skip, separated by a coma; for troubleshooting purpose only")
|
@CommandLine.Option(names = {"--skip-executions"}, split=",", description = "a list of execution identifiers to skip, separated by a coma; for troubleshooting only")
|
||||||
private List<String> skipExecutions = Collections.emptyList();
|
private List<String> skipExecutions = Collections.emptyList();
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--skip-flows"}, split=",", description = "a list of flow identifiers (namespace.flowId) to skip, separated by a coma; for troubleshooting purpose only")
|
@CommandLine.Option(names = {"--skip-flows"}, split=",", description = "a list of flow identifiers (namespace.flowId) to skip, separated by a coma; for troubleshooting only")
|
||||||
private List<String> skipFlows = Collections.emptyList();
|
private List<String> skipFlows = Collections.emptyList();
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--skip-namespaces"}, split=",", description = "a list of namespace identifiers (tenant|namespace) to skip, separated by a coma; for troubleshooting purpose only")
|
@CommandLine.Option(names = {"--skip-namespaces"}, split=",", description = "a list of namespace identifiers (tenant|namespace) to skip, separated by a coma; for troubleshooting only")
|
||||||
private List<String> skipNamespaces = Collections.emptyList();
|
private List<String> skipNamespaces = Collections.emptyList();
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--skip-tenants"}, split=",", description = "a list of tenants to skip, separated by a coma; for troubleshooting purpose only")
|
@CommandLine.Option(names = {"--skip-tenants"}, split=",", description = "a list of tenants to skip, separated by a coma; for troubleshooting only")
|
||||||
private List<String> skipTenants = Collections.emptyList();
|
private List<String> skipTenants = Collections.emptyList();
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--skip-indexer-records"}, split=",", description = "a list of indexer record keys, separated by a coma; for troubleshooting purpose only")
|
@CommandLine.Option(names = {"--skip-indexer-records"}, split=",", description = "a list of indexer record keys, separated by a coma; for troubleshooting only")
|
||||||
private List<String> skipIndexerRecords = Collections.emptyList();
|
private List<String> skipIndexerRecords = Collections.emptyList();
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--no-tutorials"}, description = "Flag to disable auto-loading of tutorial flows.")
|
@CommandLine.Option(names = {"--no-tutorials"}, description = "Flag to disable auto-loading of tutorial flows.")
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class WebServerCommand extends AbstractServerCommand {
|
|||||||
@Option(names = {"--no-indexer"}, description = "Flag to disable starting an embedded indexer.")
|
@Option(names = {"--no-indexer"}, description = "Flag to disable starting an embedded indexer.")
|
||||||
private boolean indexerDisabled = false;
|
private boolean indexerDisabled = false;
|
||||||
|
|
||||||
@CommandLine.Option(names = {"--skip-indexer-records"}, split=",", description = "a list of indexer record keys, separated by a coma; for troubleshooting purpose only")
|
@CommandLine.Option(names = {"--skip-indexer-records"}, split=",", description = "a list of indexer record keys, separated by a coma; for troubleshooting only")
|
||||||
private List<String> skipIndexerRecords = Collections.emptyList();
|
private List<String> skipIndexerRecords = Collections.emptyList();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import io.kestra.core.models.annotations.Plugin;
|
|||||||
import io.kestra.core.models.dashboards.filters.AbstractFilter;
|
import io.kestra.core.models.dashboards.filters.AbstractFilter;
|
||||||
import io.kestra.core.repositories.QueryBuilderInterface;
|
import io.kestra.core.repositories.QueryBuilderInterface;
|
||||||
import io.kestra.plugin.core.dashboard.data.IData;
|
import io.kestra.plugin.core.dashboard.data.IData;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Pattern;
|
import jakarta.validation.constraints.Pattern;
|
||||||
@@ -33,9 +34,11 @@ public abstract class DataFilter<F extends Enum<F>, C extends ColumnDescriptor<F
|
|||||||
@Pattern(regexp = JAVA_IDENTIFIER_REGEX)
|
@Pattern(regexp = JAVA_IDENTIFIER_REGEX)
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
@Valid
|
||||||
private Map<String, C> columns;
|
private Map<String, C> columns;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
|
@Valid
|
||||||
private List<AbstractFilter<F>> where;
|
private List<AbstractFilter<F>> where;
|
||||||
|
|
||||||
private List<OrderBy> orderBy;
|
private List<OrderBy> orderBy;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import io.kestra.core.models.annotations.Plugin;
|
|||||||
import io.kestra.core.models.dashboards.ChartOption;
|
import io.kestra.core.models.dashboards.ChartOption;
|
||||||
import io.kestra.core.models.dashboards.DataFilter;
|
import io.kestra.core.models.dashboards.DataFilter;
|
||||||
import io.kestra.core.validations.DataChartValidation;
|
import io.kestra.core.validations.DataChartValidation;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -20,6 +21,7 @@ import lombok.experimental.SuperBuilder;
|
|||||||
@DataChartValidation
|
@DataChartValidation
|
||||||
public abstract class DataChart<P extends ChartOption, D extends DataFilter<?, ?>> extends Chart<P> implements io.kestra.core.models.Plugin {
|
public abstract class DataChart<P extends ChartOption, D extends DataFilter<?, ?>> extends Chart<P> implements io.kestra.core.models.Plugin {
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@Valid
|
||||||
private D data;
|
private D data;
|
||||||
|
|
||||||
public Integer minNumberOfAggregations() {
|
public Integer minNumberOfAggregations() {
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package io.kestra.core.models.dashboards.filters;
|
package io.kestra.core.models.dashboards.filters;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||||
import io.micronaut.core.annotation.Introspected;
|
import io.micronaut.core.annotation.Introspected;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
@@ -32,6 +35,9 @@ import lombok.experimental.SuperBuilder;
|
|||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@Introspected
|
@Introspected
|
||||||
public abstract class AbstractFilter<F extends Enum<F>> {
|
public abstract class AbstractFilter<F extends Enum<F>> {
|
||||||
|
@NotNull
|
||||||
|
@JsonProperty(value = "field", required = true)
|
||||||
|
@Valid
|
||||||
private F field;
|
private F field;
|
||||||
private String labelKey;
|
private String labelKey;
|
||||||
|
|
||||||
|
|||||||
@@ -82,8 +82,7 @@ public abstract class FilesService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String resolveUniqueNameForFile(final Path path) {
|
private static String resolveUniqueNameForFile(final Path path) {
|
||||||
String filename = path.getFileName().toString();
|
String filename = path.getFileName().toString().replace(' ', '+');
|
||||||
String encodedFilename = java.net.URLEncoder.encode(filename, java.nio.charset.StandardCharsets.UTF_8);
|
return IdUtils.from(path.toString()) + "-" + filename;
|
||||||
return IdUtils.from(path.toString()) + "-" + encodedFilename;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,10 +151,7 @@ abstract class AbstractFileFunction implements Function {
|
|||||||
// if there is a trigger of type execution, we also allow accessing a file from the parent execution
|
// if there is a trigger of type execution, we also allow accessing a file from the parent execution
|
||||||
Map<String, String> trigger = (Map<String, String>) context.getVariable(TRIGGER);
|
Map<String, String> trigger = (Map<String, String>) context.getVariable(TRIGGER);
|
||||||
|
|
||||||
if (!isFileUriValid(trigger.get(NAMESPACE), trigger.get("flowId"), trigger.get("executionId"), path)) {
|
return isFileUriValid(trigger.get(NAMESPACE), trigger.get("flowId"), trigger.get("executionId"), path);
|
||||||
throw new IllegalArgumentException("Unable to read the file '" + path + "' as it didn't belong to the parent execution");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -383,6 +383,7 @@ public class ExecutionService {
|
|||||||
if (!isFlowable || s.equals(taskRunId)) {
|
if (!isFlowable || s.equals(taskRunId)) {
|
||||||
TaskRun newTaskRun;
|
TaskRun newTaskRun;
|
||||||
|
|
||||||
|
State.Type targetState = newState;
|
||||||
if (task instanceof Pause pauseTask) {
|
if (task instanceof Pause pauseTask) {
|
||||||
State.Type terminalState = newState == State.Type.RUNNING ? State.Type.SUCCESS : newState;
|
State.Type terminalState = newState == State.Type.RUNNING ? State.Type.SUCCESS : newState;
|
||||||
Pause.Resumed _resumed = resumed != null ? resumed : Pause.Resumed.now(terminalState);
|
Pause.Resumed _resumed = resumed != null ? resumed : Pause.Resumed.now(terminalState);
|
||||||
@@ -392,23 +393,23 @@ public class ExecutionService {
|
|||||||
// if it's a Pause task with no subtask, we terminate the task
|
// if it's a Pause task with no subtask, we terminate the task
|
||||||
if (ListUtils.isEmpty(pauseTask.getTasks()) && ListUtils.isEmpty(pauseTask.getErrors()) && ListUtils.isEmpty(pauseTask.getFinally())) {
|
if (ListUtils.isEmpty(pauseTask.getTasks()) && ListUtils.isEmpty(pauseTask.getErrors()) && ListUtils.isEmpty(pauseTask.getFinally())) {
|
||||||
if (newState == State.Type.RUNNING) {
|
if (newState == State.Type.RUNNING) {
|
||||||
newTaskRun = newTaskRun.withState(State.Type.SUCCESS);
|
targetState = State.Type.SUCCESS;
|
||||||
} else if (newState == State.Type.KILLING) {
|
} else if (newState == State.Type.KILLING) {
|
||||||
newTaskRun = newTaskRun.withState(State.Type.KILLED);
|
targetState = State.Type.KILLED;
|
||||||
} else {
|
|
||||||
newTaskRun = newTaskRun.withState(newState);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// we should set the state to RUNNING so that subtasks are executed
|
// we should set the state to RUNNING so that subtasks are executed
|
||||||
newTaskRun = newTaskRun.withState(State.Type.RUNNING);
|
targetState = State.Type.RUNNING;
|
||||||
}
|
}
|
||||||
|
newTaskRun = newTaskRun.withState(targetState);
|
||||||
} else {
|
} else {
|
||||||
newTaskRun = originalTaskRun.withState(newState);
|
newTaskRun = originalTaskRun.withState(targetState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (originalTaskRun.getAttempts() != null && !originalTaskRun.getAttempts().isEmpty()) {
|
if (originalTaskRun.getAttempts() != null && !originalTaskRun.getAttempts().isEmpty()) {
|
||||||
ArrayList<TaskRunAttempt> attempts = new ArrayList<>(originalTaskRun.getAttempts());
|
ArrayList<TaskRunAttempt> attempts = new ArrayList<>(originalTaskRun.getAttempts());
|
||||||
attempts.set(attempts.size() - 1, attempts.getLast().withState(newState));
|
attempts.set(attempts.size() - 1, attempts.getLast().withState(targetState));
|
||||||
newTaskRun = newTaskRun.withAttempts(attempts);
|
newTaskRun = newTaskRun.withAttempts(attempts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -267,6 +267,12 @@ public abstract class AbstractRunnerTest {
|
|||||||
multipleConditionTriggerCaseTest.flowTriggerMultiplePreconditions();
|
multipleConditionTriggerCaseTest.flowTriggerMultiplePreconditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@LoadFlows({"flows/valids/flow-trigger-multiple-conditions-flow-a.yaml", "flows/valids/flow-trigger-multiple-conditions-flow-listen.yaml"})
|
||||||
|
void flowTriggerMultipleConditions() throws Exception {
|
||||||
|
multipleConditionTriggerCaseTest.flowTriggerMultipleConditions();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@LoadFlows({"flows/valids/each-null.yaml"})
|
@LoadFlows({"flows/valids/each-null.yaml"})
|
||||||
void eachWithNull() throws Exception {
|
void eachWithNull() throws Exception {
|
||||||
|
|||||||
@@ -445,6 +445,7 @@ class ExecutionServiceTest {
|
|||||||
|
|
||||||
assertThat(killed.getState().getCurrent()).isEqualTo(State.Type.CANCELLED);
|
assertThat(killed.getState().getCurrent()).isEqualTo(State.Type.CANCELLED);
|
||||||
assertThat(killed.findTaskRunsByTaskId("pause").getFirst().getState().getCurrent()).isEqualTo(State.Type.KILLED);
|
assertThat(killed.findTaskRunsByTaskId("pause").getFirst().getState().getCurrent()).isEqualTo(State.Type.KILLED);
|
||||||
|
assertThat(killed.findTaskRunsByTaskId("pause").getFirst().getAttempts().getFirst().getState().getCurrent()).isEqualTo(State.Type.KILLED);
|
||||||
assertThat(killed.getState().getHistories()).hasSize(5);
|
assertThat(killed.getState().getHistories()).hasSize(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,28 +106,28 @@ class FilesServiceTest {
|
|||||||
var runContext = runContextFactory.of();
|
var runContext = runContextFactory.of();
|
||||||
|
|
||||||
Path fileWithSpace = tempDir.resolve("with space.txt");
|
Path fileWithSpace = tempDir.resolve("with space.txt");
|
||||||
Path fileWithUnicode = tempDir.resolve("สวัสดี.txt");
|
Path fileWithUnicode = tempDir.resolve("สวัสดี&.txt");
|
||||||
|
|
||||||
Files.writeString(fileWithSpace, "content");
|
Files.writeString(fileWithSpace, "content");
|
||||||
Files.writeString(fileWithUnicode, "content");
|
Files.writeString(fileWithUnicode, "content");
|
||||||
|
|
||||||
Path targetFileWithSpace = runContext.workingDir().path().resolve("with space.txt");
|
Path targetFileWithSpace = runContext.workingDir().path().resolve("with space.txt");
|
||||||
Path targetFileWithUnicode = runContext.workingDir().path().resolve("สวัสดี.txt");
|
Path targetFileWithUnicode = runContext.workingDir().path().resolve("สวัสดี&.txt");
|
||||||
|
|
||||||
Files.copy(fileWithSpace, targetFileWithSpace);
|
Files.copy(fileWithSpace, targetFileWithSpace);
|
||||||
Files.copy(fileWithUnicode, targetFileWithUnicode);
|
Files.copy(fileWithUnicode, targetFileWithUnicode);
|
||||||
|
|
||||||
Map<String, URI> outputFiles = FilesService.outputFiles(
|
Map<String, URI> outputFiles = FilesService.outputFiles(
|
||||||
runContext,
|
runContext,
|
||||||
List.of("with space.txt", "สวัสดี.txt")
|
List.of("with space.txt", "สวัสดี&.txt")
|
||||||
);
|
);
|
||||||
|
|
||||||
assertThat(outputFiles).hasSize(2);
|
assertThat(outputFiles).hasSize(2);
|
||||||
assertThat(outputFiles).containsKey("with space.txt");
|
assertThat(outputFiles).containsKey("with space.txt");
|
||||||
assertThat(outputFiles).containsKey("สวัสดี.txt");
|
assertThat(outputFiles).containsKey("สวัสดี&.txt");
|
||||||
|
|
||||||
assertThat(runContext.storage().getFile(outputFiles.get("with space.txt"))).isNotNull();
|
assertThat(runContext.storage().getFile(outputFiles.get("with space.txt"))).isNotNull();
|
||||||
assertThat(runContext.storage().getFile(outputFiles.get("สวัสดี.txt"))).isNotNull();
|
assertThat(runContext.storage().getFile(outputFiles.get("สวัสดี&.txt"))).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
private URI createFile() throws IOException {
|
private URI createFile() throws IOException {
|
||||||
|
|||||||
@@ -212,4 +212,24 @@ public class MultipleConditionTriggerCaseTest {
|
|||||||
e -> e.getState().getCurrent().equals(Type.SUCCESS),
|
e -> e.getState().getCurrent().equals(Type.SUCCESS),
|
||||||
MAIN_TENANT, "io.kestra.tests.trigger.multiple.preconditions", "flow-trigger-multiple-preconditions-flow-listen", Duration.ofSeconds(1)));
|
MAIN_TENANT, "io.kestra.tests.trigger.multiple.preconditions", "flow-trigger-multiple-preconditions-flow-listen", Duration.ofSeconds(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void flowTriggerMultipleConditions() throws TimeoutException, QueueException {
|
||||||
|
Execution execution = runnerUtils.runOne(MAIN_TENANT, "io.kestra.tests.trigger.multiple.conditions",
|
||||||
|
"flow-trigger-multiple-conditions-flow-a");
|
||||||
|
assertThat(execution.getTaskRunList().size()).isEqualTo(1);
|
||||||
|
assertThat(execution.getState().getCurrent()).isEqualTo(State.Type.SUCCESS);
|
||||||
|
|
||||||
|
// trigger is done
|
||||||
|
Execution triggerExecution = runnerUtils.awaitFlowExecution(
|
||||||
|
e -> e.getState().getCurrent().equals(Type.SUCCESS),
|
||||||
|
MAIN_TENANT, "io.kestra.tests.trigger.multiple.conditions", "flow-trigger-multiple-conditions-flow-listen");
|
||||||
|
executionRepository.delete(triggerExecution);
|
||||||
|
assertThat(triggerExecution.getTaskRunList().size()).isEqualTo(1);
|
||||||
|
assertThat(triggerExecution.getState().getCurrent()).isEqualTo(State.Type.SUCCESS);
|
||||||
|
|
||||||
|
// we assert that we didn't have any other flow triggered
|
||||||
|
assertThrows(RuntimeException.class, () -> runnerUtils.awaitFlowExecution(
|
||||||
|
e -> e.getState().getCurrent().equals(Type.SUCCESS),
|
||||||
|
MAIN_TENANT, "io.kestra.tests.trigger.multiple.conditions", "flow-trigger-multiple-conditions-flow-listen", Duration.ofSeconds(1)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,33 +112,6 @@ public class FileSizeFunctionTest {
|
|||||||
assertThat(size).isEqualTo(FILE_SIZE);
|
assertThat(size).isEqualTo(FILE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void shouldThrowIllegalArgumentException_givenTrigger_andParentExecution_andMissingNamespace() throws IOException {
|
|
||||||
String executionId = IdUtils.create();
|
|
||||||
URI internalStorageURI = getInternalStorageURI(executionId);
|
|
||||||
URI internalStorageFile = getInternalStorageFile(internalStorageURI);
|
|
||||||
|
|
||||||
Map<String, Object> variables = Map.of(
|
|
||||||
"flow", Map.of(
|
|
||||||
"id", "subflow",
|
|
||||||
"namespace", NAMESPACE,
|
|
||||||
"tenantId", MAIN_TENANT),
|
|
||||||
"execution", Map.of("id", IdUtils.create()),
|
|
||||||
"trigger", Map.of(
|
|
||||||
"flowId", FLOW,
|
|
||||||
"executionId", executionId,
|
|
||||||
"tenantId", MAIN_TENANT
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
Exception ex = assertThrows(
|
|
||||||
IllegalArgumentException.class,
|
|
||||||
() -> variableRenderer.render("{{ fileSize('" + internalStorageFile + "') }}", variables)
|
|
||||||
);
|
|
||||||
|
|
||||||
assertTrue(ex.getMessage().startsWith("Unable to read the file"), "Exception message doesn't match expected one");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void returnsCorrectSize_givenUri_andCurrentExecution() throws IOException, IllegalVariableEvaluationException {
|
void returnsCorrectSize_givenUri_andCurrentExecution() throws IOException, IllegalVariableEvaluationException {
|
||||||
String executionId = IdUtils.create();
|
String executionId = IdUtils.create();
|
||||||
|
|||||||
@@ -259,6 +259,27 @@ class ReadFileFunctionTest {
|
|||||||
assertThat(variableRenderer.render("{{ read(nsfile) }}", variables)).isEqualTo("Hello World");
|
assertThat(variableRenderer.render("{{ read(nsfile) }}", variables)).isEqualTo("Hello World");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldReadChildFileEvenIfTrigger() throws IOException, IllegalVariableEvaluationException {
|
||||||
|
String namespace = "my.namespace";
|
||||||
|
String flowId = "flow";
|
||||||
|
String executionId = IdUtils.create();
|
||||||
|
URI internalStorageURI = URI.create("/" + namespace.replace(".", "/") + "/" + flowId + "/executions/" + executionId + "/tasks/task/" + IdUtils.create() + "/123456.ion");
|
||||||
|
URI internalStorageFile = storageInterface.put(MAIN_TENANT, namespace, internalStorageURI, new ByteArrayInputStream("Hello from a task output".getBytes()));
|
||||||
|
|
||||||
|
Map<String, Object> variables = Map.of(
|
||||||
|
"flow", Map.of(
|
||||||
|
"id", "flow",
|
||||||
|
"namespace", "notme",
|
||||||
|
"tenantId", MAIN_TENANT),
|
||||||
|
"execution", Map.of("id", "notme"),
|
||||||
|
"trigger", Map.of("namespace", "notme", "flowId", "parent", "executionId", "parent")
|
||||||
|
);
|
||||||
|
|
||||||
|
String render = variableRenderer.render("{{ read('" + internalStorageFile + "') }}", variables);
|
||||||
|
assertThat(render).isEqualTo("Hello from a task output");
|
||||||
|
}
|
||||||
|
|
||||||
private URI createFile() throws IOException {
|
private URI createFile() throws IOException {
|
||||||
File tempFile = File.createTempFile("file", ".txt");
|
File tempFile = File.createTempFile("file", ".txt");
|
||||||
Files.write(tempFile.toPath(), "Hello World".getBytes());
|
Files.write(tempFile.toPath(), "Hello World".getBytes());
|
||||||
|
|||||||
@@ -12,20 +12,24 @@ import io.kestra.core.queues.QueueInterface;
|
|||||||
import io.kestra.core.repositories.FlowRepositoryInterface;
|
import io.kestra.core.repositories.FlowRepositoryInterface;
|
||||||
import io.kestra.core.runners.ConcurrencyLimit;
|
import io.kestra.core.runners.ConcurrencyLimit;
|
||||||
import io.kestra.core.runners.RunnerUtils;
|
import io.kestra.core.runners.RunnerUtils;
|
||||||
|
import io.kestra.core.utils.TestsUtils;
|
||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
import jakarta.inject.Named;
|
import jakarta.inject.Named;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestInstance;
|
import org.junit.jupiter.api.TestInstance;
|
||||||
|
import reactor.core.publisher.Flux;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
import static io.kestra.core.utils.Rethrow.throwRunnable;
|
import static io.kestra.core.utils.Rethrow.throwRunnable;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
@KestraTest(startRunner = true)
|
@KestraTest(startRunner = true)
|
||||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||||
@@ -54,14 +58,29 @@ class ConcurrencyLimitServiceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@LoadFlows("flows/valids/flow-concurrency-queue.yml")
|
@LoadFlows("flows/valids/flow-concurrency-queue.yml")
|
||||||
void unqueueExecution() throws QueueException, TimeoutException {
|
void unqueueExecution() throws QueueException, TimeoutException, InterruptedException {
|
||||||
// run a first flow so the second is queued
|
// run a first flow so the second is queued
|
||||||
runnerUtils.runOneUntilRunning(TENANT_ID, TESTS_FLOW_NS, "flow-concurrency-queue");
|
Execution first = runnerUtils.runOneUntilRunning(TENANT_ID, TESTS_FLOW_NS, "flow-concurrency-queue");
|
||||||
Execution result = runUntilQueued(TESTS_FLOW_NS, "flow-concurrency-queue");
|
Execution result = runUntilQueued(TESTS_FLOW_NS, "flow-concurrency-queue");
|
||||||
assertThat(result.getState().isQueued()).isTrue();
|
assertThat(result.getState().isQueued()).isTrue();
|
||||||
|
|
||||||
|
// await for the execution to be terminated
|
||||||
|
CountDownLatch terminated = new CountDownLatch(2);
|
||||||
|
Flux<Execution> receive = TestsUtils.receive(executionQueue, (either) -> {
|
||||||
|
if (either.getLeft().getId().equals(first.getId()) && either.getLeft().getState().isTerminated()) {
|
||||||
|
terminated.countDown();
|
||||||
|
}
|
||||||
|
if (either.getLeft().getId().equals(result.getId()) && either.getLeft().getState().isTerminated()) {
|
||||||
|
terminated.countDown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Execution unqueued = concurrencyLimitService.unqueue(result, State.Type.RUNNING);
|
Execution unqueued = concurrencyLimitService.unqueue(result, State.Type.RUNNING);
|
||||||
assertThat(unqueued.getState().isRunning()).isTrue();
|
assertThat(unqueued.getState().isRunning()).isTrue();
|
||||||
|
executionQueue.emit(unqueued);
|
||||||
|
|
||||||
|
assertTrue(terminated.await(10, TimeUnit.SECONDS));
|
||||||
|
receive.blockLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -73,7 +92,6 @@ class ConcurrencyLimitServiceTest {
|
|||||||
assertThat(limit.get().getTenantId()).isEqualTo(execution.getTenantId());
|
assertThat(limit.get().getTenantId()).isEqualTo(execution.getTenantId());
|
||||||
assertThat(limit.get().getNamespace()).isEqualTo(execution.getNamespace());
|
assertThat(limit.get().getNamespace()).isEqualTo(execution.getNamespace());
|
||||||
assertThat(limit.get().getFlowId()).isEqualTo(execution.getFlowId());
|
assertThat(limit.get().getFlowId()).isEqualTo(execution.getFlowId());
|
||||||
assertThat(limit.get().getRunning()).isEqualTo(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
id: flow-trigger-multiple-conditions-flow-a
|
||||||
|
namespace: io.kestra.tests.trigger.multiple.conditions
|
||||||
|
|
||||||
|
labels:
|
||||||
|
some: label
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- id: only
|
||||||
|
type: io.kestra.plugin.core.debug.Return
|
||||||
|
format: "from parents: {{execution.id}}"
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
id: flow-trigger-multiple-conditions-flow-listen
|
||||||
|
namespace: io.kestra.tests.trigger.multiple.conditions
|
||||||
|
|
||||||
|
triggers:
|
||||||
|
- id: on_completion
|
||||||
|
type: io.kestra.plugin.core.trigger.Flow
|
||||||
|
states: [ SUCCESS ]
|
||||||
|
conditions:
|
||||||
|
- type: io.kestra.plugin.core.condition.ExecutionFlow
|
||||||
|
namespace: io.kestra.tests.trigger.multiple.conditions
|
||||||
|
flowId: flow-trigger-multiple-conditions-flow-a
|
||||||
|
- id: on_failure
|
||||||
|
type: io.kestra.plugin.core.trigger.Flow
|
||||||
|
states: [ FAILED ]
|
||||||
|
conditions:
|
||||||
|
- type: io.kestra.plugin.core.condition.ExecutionFlow
|
||||||
|
namespace: io.kestra.tests.trigger.multiple.conditions
|
||||||
|
flowId: flow-trigger-multiple-conditions-flow-a
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- id: only
|
||||||
|
type: io.kestra.plugin.core.debug.Return
|
||||||
|
format: "It works"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
version=1.1.0-SNAPSHOT
|
version=1.1.2
|
||||||
|
|
||||||
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public abstract class AbstractJdbcExecutionQueuedStorage extends AbstractJdbcRepository {
|
public abstract class AbstractJdbcExecutionQueuedStorage extends AbstractJdbcRepository {
|
||||||
protected io.kestra.jdbc.AbstractJdbcRepository<ExecutionQueued> jdbcRepository;
|
protected io.kestra.jdbc.AbstractJdbcRepository<ExecutionQueued> jdbcRepository;
|
||||||
@@ -70,18 +69,12 @@ public abstract class AbstractJdbcExecutionQueuedStorage extends AbstractJdbcRep
|
|||||||
this.jdbcRepository
|
this.jdbcRepository
|
||||||
.getDslContextWrapper()
|
.getDslContextWrapper()
|
||||||
.transaction(configuration -> {
|
.transaction(configuration -> {
|
||||||
var select = DSL
|
DSL
|
||||||
.using(configuration)
|
.using(configuration)
|
||||||
.select(AbstractJdbcRepository.field("value"))
|
.deleteFrom(this.jdbcRepository.getTable())
|
||||||
.from(this.jdbcRepository.getTable())
|
.where(buildTenantCondition(execution.getTenantId()))
|
||||||
.where(buildTenantCondition(execution.getTenantId()))
|
.and(field("key").eq(IdUtils.fromParts(execution.getTenantId(), execution.getNamespace(), execution.getFlowId(), execution.getId())))
|
||||||
.and(field("key").eq(IdUtils.fromParts(execution.getTenantId(), execution.getNamespace(), execution.getFlowId(), execution.getId())))
|
.execute();
|
||||||
.forUpdate();
|
|
||||||
|
|
||||||
Optional<ExecutionQueued> maybeExecution = this.jdbcRepository.fetchOne(select);
|
|
||||||
if (maybeExecution.isPresent()) {
|
|
||||||
this.jdbcRepository.delete(maybeExecution.get());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1230,8 +1230,10 @@ public class JdbcExecutor implements ExecutorInterface {
|
|||||||
private void processFlowTriggers(Execution execution) throws QueueException {
|
private void processFlowTriggers(Execution execution) throws QueueException {
|
||||||
// directly process simple conditions
|
// directly process simple conditions
|
||||||
flowTriggerService.withFlowTriggersOnly(allFlows.stream())
|
flowTriggerService.withFlowTriggersOnly(allFlows.stream())
|
||||||
.filter(f ->ListUtils.emptyOnNull(f.getTrigger().getConditions()).stream().noneMatch(c -> c instanceof MultipleCondition) && f.getTrigger().getPreconditions() == null)
|
.filter(f -> ListUtils.emptyOnNull(f.getTrigger().getConditions()).stream().noneMatch(c -> c instanceof MultipleCondition) && f.getTrigger().getPreconditions() == null)
|
||||||
.flatMap(f -> flowTriggerService.computeExecutionsFromFlowTriggers(execution, List.of(f.getFlow()), Optional.empty()).stream())
|
.map(f -> f.getFlow())
|
||||||
|
.distinct() // as computeExecutionsFromFlowTriggers is based on flow, we must map FlowWithFlowTrigger to a flow and distinct to avoid multiple execution for the same flow
|
||||||
|
.flatMap(f -> flowTriggerService.computeExecutionsFromFlowTriggers(execution, List.of(f), Optional.empty()).stream())
|
||||||
.forEach(throwConsumer(exec -> executionQueue.emit(exec)));
|
.forEach(throwConsumer(exec -> executionQueue.emit(exec)));
|
||||||
|
|
||||||
// send multiple conditions to the multiple condition queue for later processing
|
// send multiple conditions to the multiple condition queue for later processing
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Singleton
|
@Singleton
|
||||||
public class TestRunner implements Runnable, AutoCloseable {
|
public class TestRunner implements Runnable, AutoCloseable {
|
||||||
@Setter private int workerThread = Math.max(3, Runtime.getRuntime().availableProcessors());
|
@Setter private int workerThread = Math.max(3, Runtime.getRuntime().availableProcessors()) * 16;
|
||||||
@Setter private boolean schedulerEnabled = true;
|
@Setter private boolean schedulerEnabled = true;
|
||||||
@Setter private boolean workerEnabled = true;
|
@Setter private boolean workerEnabled = true;
|
||||||
|
|
||||||
|
|||||||
@@ -35,16 +35,18 @@
|
|||||||
<WeatherSunny v-else />
|
<WeatherSunny v-else />
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="panelWrapper" :class="{panelTabResizing: resizing}" :style="{width: activeTab?.length ? `${panelWidth}px` : 0}">
|
<div class="panelWrapper" ref="panelWrapper" :class="{panelTabResizing: resizing}" :style="{width: activeTab?.length ? `${panelWidth}px` : 0}">
|
||||||
<div :style="{overflow: 'hidden'}">
|
<div :style="{overflow: 'hidden'}">
|
||||||
<button v-if="activeTab.length" class="closeButton" @click="setActiveTab('')">
|
<button v-if="activeTab.length" class="closeButton" @click="setActiveTab('')">
|
||||||
<Close />
|
<Close />
|
||||||
</button>
|
</button>
|
||||||
<ContextDocs v-if="activeTab === 'docs'" />
|
<KeepAlive>
|
||||||
<ContextNews v-else-if="activeTab === 'news'" />
|
<ContextDocs v-if="activeTab === 'docs'" />
|
||||||
<template v-else>
|
<ContextNews v-else-if="activeTab === 'news'" />
|
||||||
{{ activeTab }}
|
<template v-else>
|
||||||
</template>
|
{{ activeTab }}
|
||||||
|
</template>
|
||||||
|
</KeepAlive>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -96,6 +98,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const panelWidth = ref(640)
|
const panelWidth = ref(640)
|
||||||
|
const panelWrapper = ref<HTMLDivElement | null>(null)
|
||||||
|
|
||||||
const {startResizing, resizing} = useResizablePanel(activeTab)
|
const {startResizing, resizing} = useResizablePanel(activeTab)
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,22 @@
|
|||||||
<slot name="back-button" />
|
<slot name="back-button" />
|
||||||
<h2>{{ title }}</h2>
|
<h2>{{ title }}</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content" ref="contentRef">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import {ref} from "vue";
|
||||||
|
|
||||||
defineProps<{title:string}>();
|
defineProps<{title:string}>();
|
||||||
|
|
||||||
|
const contentRef = ref<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
contentRef
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -197,7 +197,6 @@
|
|||||||
|
|
||||||
import {trackTabOpen, trackTabClose} from "../utils/tabTracking";
|
import {trackTabOpen, trackTabClose} from "../utils/tabTracking";
|
||||||
import {Panel, Tab, TabLive} from "../utils/multiPanelTypes";
|
import {Panel, Tab, TabLive} from "../utils/multiPanelTypes";
|
||||||
import {usePanelDefaultSize} from "../composables/usePanelDefaultSize";
|
|
||||||
|
|
||||||
const {t} = useI18n();
|
const {t} = useI18n();
|
||||||
const {showKeyShortcuts} = useKeyShortcuts();
|
const {showKeyShortcuts} = useKeyShortcuts();
|
||||||
@@ -449,7 +448,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultSize = usePanelDefaultSize(panels);
|
const defaultSize = computed(() => panels.value.length === 0 ? 1 : (panels.value.reduce((acc, panel) => acc + panel.size, 0) / panels.value.length));
|
||||||
|
|
||||||
function newPanelDrop(_e: DragEvent, direction: "left" | "right") {
|
function newPanelDrop(_e: DragEvent, direction: "left" | "right") {
|
||||||
if (!movedTabInfo.value) return;
|
if (!movedTabInfo.value) return;
|
||||||
|
|||||||
@@ -298,6 +298,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import _merge from "lodash/merge";
|
import _merge from "lodash/merge";
|
||||||
import {ref, computed, watch} from "vue";
|
import {ref, computed, watch} from "vue";
|
||||||
|
import moment from "moment";
|
||||||
import {useI18n} from "vue-i18n";
|
import {useI18n} from "vue-i18n";
|
||||||
import {useRoute} from "vue-router";
|
import {useRoute} from "vue-router";
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
@@ -337,7 +338,6 @@
|
|||||||
import SelectTable from "../layout/SelectTable.vue";
|
import SelectTable from "../layout/SelectTable.vue";
|
||||||
import TriggerAvatar from "../flows/TriggerAvatar.vue";
|
import TriggerAvatar from "../flows/TriggerAvatar.vue";
|
||||||
import KSFilter from "../filter/components/KSFilter.vue";
|
import KSFilter from "../filter/components/KSFilter.vue";
|
||||||
import useRestoreUrl from "../../composables/useRestoreUrl";
|
|
||||||
import MarkdownTooltip from "../layout/MarkdownTooltip.vue";
|
import MarkdownTooltip from "../layout/MarkdownTooltip.vue";
|
||||||
import useRouteContext from "../../composables/useRouteContext";
|
import useRouteContext from "../../composables/useRouteContext";
|
||||||
|
|
||||||
@@ -436,8 +436,6 @@
|
|||||||
.filter(Boolean) as ColumnConfig[]
|
.filter(Boolean) as ColumnConfig[]
|
||||||
);
|
);
|
||||||
|
|
||||||
const {saveRestoreUrl} = useRestoreUrl();
|
|
||||||
|
|
||||||
const loadData = (callback?: () => void) => {
|
const loadData = (callback?: () => void) => {
|
||||||
const query = loadQuery({
|
const query = loadQuery({
|
||||||
size: parseInt(String(route.query?.size ?? "25")),
|
size: parseInt(String(route.query?.size ?? "25")),
|
||||||
@@ -463,8 +461,7 @@
|
|||||||
|
|
||||||
const {ready, onSort, onPageChanged, queryWithFilter, load} = useDataTableActions({
|
const {ready, onSort, onPageChanged, queryWithFilter, load} = useDataTableActions({
|
||||||
dataTableRef: dataTable,
|
dataTableRef: dataTable,
|
||||||
loadData,
|
loadData
|
||||||
saveRestoreUrl
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -696,7 +693,16 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const loadQuery = (base: any) => {
|
const loadQuery = (base: any) => {
|
||||||
let queryFilter = queryWithFilter();
|
const queryFilter = queryWithFilter();
|
||||||
|
|
||||||
|
const timeRange = queryFilter["filters[timeRange][EQUALS]"];
|
||||||
|
if (timeRange) {
|
||||||
|
const end = new Date();
|
||||||
|
const start = new Date(end.getTime() - moment.duration(timeRange).asMilliseconds());
|
||||||
|
queryFilter["filters[startDate][GREATER_THAN_OR_EQUAL_TO]"] = start.toISOString();
|
||||||
|
queryFilter["filters[endDate][LESS_THAN_OR_EQUAL_TO]"] = end.toISOString();
|
||||||
|
delete queryFilter["filters[timeRange][EQUALS]"];
|
||||||
|
}
|
||||||
|
|
||||||
return _merge(base, queryFilter);
|
return _merge(base, queryFilter);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {computed, onBeforeMount, ref, useTemplateRef} from "vue";
|
import {computed, onBeforeMount, ref, useTemplateRef, watch} from "vue";
|
||||||
import {stringify, parse} from "@kestra-io/ui-libs/flow-yaml-utils";
|
import {stringify, parse} from "@kestra-io/ui-libs/flow-yaml-utils";
|
||||||
|
|
||||||
import type {Dashboard, Chart} from "./composables/useDashboards";
|
import type {Dashboard, Chart} from "./composables/useDashboards";
|
||||||
@@ -89,9 +89,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!props.isFlow && !props.isNamespace) {
|
if (!props.isFlow && !props.isNamespace) {
|
||||||
|
// Preserve timeRange filter when switching dashboards
|
||||||
|
const preservedQuery = Object.fromEntries(
|
||||||
|
Object.entries(route.query).filter(([key]) =>
|
||||||
|
key.includes("timeRange")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
router.replace({
|
router.replace({
|
||||||
params: {...route.params, dashboard: id},
|
params: {...route.params, dashboard: id},
|
||||||
query: route.params.dashboard !== id ? {} : {...route.query},
|
query: route.params.dashboard !== id ? preservedQuery : {...route.query},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +109,22 @@
|
|||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
const ID = getDashboard(route, "id");
|
const ID = getDashboard(route, "id");
|
||||||
|
|
||||||
if (props.isFlow && ID === "default") load("default", processFlowYaml(YAML_FLOW, route.params.namespace as string, route.params.id as string));
|
if (props.isFlow) {
|
||||||
else if (props.isNamespace && ID === "default") load("default", YAML_NAMESPACE);
|
load(ID, processFlowYaml(YAML_FLOW, route.params.namespace as string, route.params.id as string));
|
||||||
|
} else if (props.isNamespace) {
|
||||||
|
load(ID, YAML_NAMESPACE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(() => getDashboard(route, "id"), (newId, oldId) => {
|
||||||
|
if (newId !== oldId) {
|
||||||
|
const defaultYAML = props.isFlow
|
||||||
|
? processFlowYaml(YAML_FLOW, route.params.namespace as string, route.params.id as string)
|
||||||
|
: props.isNamespace
|
||||||
|
? YAML_NAMESPACE
|
||||||
|
: YAML_MAIN;
|
||||||
|
load(newId, defaultYAML);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -28,33 +28,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadChart(chart: any) {
|
|
||||||
const yamlChart = YAML_UTILS.stringify(chart);
|
|
||||||
const result: { error: string | null; data: null | {
|
|
||||||
id?: string;
|
|
||||||
name?: string;
|
|
||||||
type?: string;
|
|
||||||
chartOptions?: Record<string, any>;
|
|
||||||
dataFilters?: any[];
|
|
||||||
charts?: any[];
|
|
||||||
}; raw: any } = {
|
|
||||||
error: null,
|
|
||||||
data: null,
|
|
||||||
raw: {}
|
|
||||||
};
|
|
||||||
const errors = await dashboardStore.validateChart(yamlChart);
|
|
||||||
if (errors.constraints) {
|
|
||||||
result.error = errors.constraints;
|
|
||||||
} else {
|
|
||||||
result.data = {...chart, content: yamlChart, raw: chart};
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function updateChartPreview(event: any) {
|
async function updateChartPreview(event: any) {
|
||||||
const chart = YAML_UTILS.getChartAtPosition(event.model.getValue(), event.position);
|
const chart = YAML_UTILS.getChartAtPosition(event.model.getValue(), event.position);
|
||||||
if (chart) {
|
if (chart) {
|
||||||
const result = await loadChart(chart);
|
const result = await dashboardStore.loadChart(chart);
|
||||||
dashboardStore.selectedChart = typeof result.data === "object"
|
dashboardStore.selectedChart = typeof result.data === "object"
|
||||||
? {
|
? {
|
||||||
...result.data,
|
...result.data,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
FIELDNAME_INJECTION_KEY,
|
FIELDNAME_INJECTION_KEY,
|
||||||
FULL_SCHEMA_INJECTION_KEY,
|
FULL_SCHEMA_INJECTION_KEY,
|
||||||
FULL_SOURCE_INJECTION_KEY,
|
FULL_SOURCE_INJECTION_KEY,
|
||||||
|
ON_TASK_EDITOR_CLICK_INJECTION_KEY,
|
||||||
PARENT_PATH_INJECTION_KEY,
|
PARENT_PATH_INJECTION_KEY,
|
||||||
POSITION_INJECTION_KEY,
|
POSITION_INJECTION_KEY,
|
||||||
REF_PATH_INJECTION_KEY,
|
REF_PATH_INJECTION_KEY,
|
||||||
@@ -111,6 +112,15 @@
|
|||||||
provide(BLOCK_SCHEMA_PATH_INJECTION_KEY, computed(() => props.blockSchemaPath ?? dashboardStore.schema.$ref ?? ""));
|
provide(BLOCK_SCHEMA_PATH_INJECTION_KEY, computed(() => props.blockSchemaPath ?? dashboardStore.schema.$ref ?? ""));
|
||||||
provide(FULL_SOURCE_INJECTION_KEY, computed(() => dashboardStore.sourceCode ?? ""));
|
provide(FULL_SOURCE_INJECTION_KEY, computed(() => dashboardStore.sourceCode ?? ""));
|
||||||
provide(POSITION_INJECTION_KEY, props.position ?? "after");
|
provide(POSITION_INJECTION_KEY, props.position ?? "after");
|
||||||
|
provide(ON_TASK_EDITOR_CLICK_INJECTION_KEY, (elt) => {
|
||||||
|
const type = elt?.type;
|
||||||
|
dashboardStore.loadChart(elt);
|
||||||
|
if(type){
|
||||||
|
pluginsStore.updateDocumentation({type});
|
||||||
|
}else{
|
||||||
|
pluginsStore.updateDocumentation();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const pluginsStore = usePluginsStore();
|
const pluginsStore = usePluginsStore();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="w-100 p-4">
|
<div class="w-100 p-4">
|
||||||
<Sections
|
<Sections
|
||||||
|
:key="dashboardStore.sourceCode"
|
||||||
:dashboard="{id: 'default', charts: []}"
|
:dashboard="{id: 'default', charts: []}"
|
||||||
:charts="charts.map(chart => chart.data).filter(chart => chart !== null)"
|
:charts="charts.map(chart => chart.data).filter(chart => chart !== null)"
|
||||||
showDefault
|
showDefault
|
||||||
@@ -9,11 +10,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {onMounted, ref} from "vue";
|
import {ref, watch} from "vue";
|
||||||
import Sections from "../sections/Sections.vue";
|
import Sections from "../sections/Sections.vue";
|
||||||
import {Chart} from "../composables/useDashboards";
|
import {Chart} from "../composables/useDashboards";
|
||||||
import {useDashboardStore} from "../../../stores/dashboard";
|
import {useDashboardStore} from "../../../stores/dashboard";
|
||||||
import * as YAML_UTILS from "@kestra-io/ui-libs/flow-yaml-utils";
|
import * as YAML_UTILS from "@kestra-io/ui-libs/flow-yaml-utils";
|
||||||
|
import throttle from "lodash/throttle";
|
||||||
|
|
||||||
interface Result {
|
interface Result {
|
||||||
error: string[] | null;
|
error: string[] | null;
|
||||||
@@ -23,21 +25,27 @@
|
|||||||
|
|
||||||
const charts = ref<Result[]>([])
|
const charts = ref<Result[]>([])
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
validateAndLoadAllCharts();
|
|
||||||
});
|
|
||||||
|
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
|
|
||||||
function validateAndLoadAllCharts() {
|
const validateAndLoadAllChartsThrottled = throttle(validateAndLoadAllCharts, 500);
|
||||||
charts.value = [];
|
|
||||||
|
async function validateAndLoadAllCharts() {
|
||||||
const allCharts = YAML_UTILS.getAllCharts(dashboardStore.sourceCode) ?? [];
|
const allCharts = YAML_UTILS.getAllCharts(dashboardStore.sourceCode) ?? [];
|
||||||
allCharts.forEach(async (chart: any) => {
|
charts.value = await Promise.all(allCharts.map(async (chart: any) => {
|
||||||
const loadedChart = await loadChart(chart);
|
return loadChart(chart);
|
||||||
charts.value.push(loadedChart);
|
}));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => dashboardStore.sourceCode,
|
||||||
|
() => {
|
||||||
|
validateAndLoadAllChartsThrottled();
|
||||||
|
}
|
||||||
|
, {immediate: true}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function loadChart(chart: any) {
|
async function loadChart(chart: any) {
|
||||||
const yamlChart = YAML_UTILS.stringify(chart);
|
const yamlChart = YAML_UTILS.stringify(chart);
|
||||||
const result: Result = {
|
const result: Result = {
|
||||||
|
|||||||
@@ -96,14 +96,19 @@
|
|||||||
return [DEFAULT, ...dashboards.value].filter((d) => !search.value || d.title.toLowerCase().includes(search.value.toLowerCase()));
|
return [DEFAULT, ...dashboards.value].filter((d) => !search.value || d.title.toLowerCase().includes(search.value.toLowerCase()));
|
||||||
});
|
});
|
||||||
|
|
||||||
const ID = getDashboard(route, "id") as string;
|
const STORAGE_KEY = getDashboard(route, "key");
|
||||||
|
|
||||||
const selected = ref(null);
|
const selected = ref<string | null>(null);
|
||||||
const select = (dashboard: any) => {
|
const select = (dashboard: any) => {
|
||||||
selected.value = dashboard?.title;
|
selected.value = dashboard?.title;
|
||||||
|
|
||||||
if (dashboard?.id) localStorage.setItem(ID, dashboard.id)
|
if (STORAGE_KEY) {
|
||||||
else localStorage.removeItem(ID);
|
if (dashboard?.id) {
|
||||||
|
localStorage.setItem(STORAGE_KEY, dashboard.id);
|
||||||
|
} else {
|
||||||
|
localStorage.removeItem(STORAGE_KEY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
emits("dashboard", dashboard.id);
|
emits("dashboard", dashboard.id);
|
||||||
};
|
};
|
||||||
@@ -121,7 +126,7 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchLast = () => localStorage.getItem(ID);
|
const getStoredDashboard = () => STORAGE_KEY ? localStorage.getItem(STORAGE_KEY) : null;
|
||||||
const fetchDashboards = () => {
|
const fetchDashboards = () => {
|
||||||
dashboardStore
|
dashboardStore
|
||||||
.list({})
|
.list({})
|
||||||
@@ -129,13 +134,17 @@
|
|||||||
dashboards.value = response.results;
|
dashboards.value = response.results;
|
||||||
|
|
||||||
const creation = Boolean(route.query.created);
|
const creation = Boolean(route.query.created);
|
||||||
const lastSelected = creation ? (route.params?.dashboard ?? fetchLast()) : (fetchLast() ?? route.params?.dashboard);
|
const lastSelected = creation
|
||||||
|
? (route.params?.dashboard ?? getStoredDashboard())
|
||||||
|
: (getStoredDashboard() ?? route.params?.dashboard);
|
||||||
|
|
||||||
if (lastSelected) {
|
if (lastSelected) {
|
||||||
const dashboard = dashboards.value.find((d) => d.id === lastSelected);
|
const dashboard = dashboards.value.find((d) => d.id === lastSelected);
|
||||||
|
|
||||||
if (dashboard) select(dashboard);
|
if (dashboard) {
|
||||||
else {
|
selected.value = dashboard.title;
|
||||||
|
emits("dashboard", dashboard.id);
|
||||||
|
} else {
|
||||||
selected.value = null;
|
selected.value = null;
|
||||||
emits("dashboard", "default");
|
emits("dashboard", "default");
|
||||||
}
|
}
|
||||||
@@ -145,15 +154,19 @@
|
|||||||
|
|
||||||
onBeforeMount(() => fetchDashboards());
|
onBeforeMount(() => fetchDashboards());
|
||||||
|
|
||||||
const tenant = ref(route.params.tenant);
|
const tenant = ref();
|
||||||
watch(route, (r) => {
|
watch(() => route.params.tenant, (t) => {
|
||||||
if (tenant.value !== r.params.tenant) {
|
if (tenant.value !== t) {
|
||||||
fetchDashboards();
|
fetchDashboards();
|
||||||
tenant.value = r.params.tenant;
|
tenant.value = t;
|
||||||
}
|
}
|
||||||
},
|
}, {immediate: true});
|
||||||
{deep: true},
|
|
||||||
);
|
watch(() => route.params?.dashboard, (val) => {
|
||||||
|
if(route.name === "home" && STORAGE_KEY) {
|
||||||
|
localStorage.setItem(STORAGE_KEY, val as string);
|
||||||
|
}
|
||||||
|
}, {immediate: true});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@@ -161,14 +174,6 @@
|
|||||||
span{
|
span{
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(svg){
|
|
||||||
color: var(--ks-content-tertiary);
|
|
||||||
font-size: 1.10rem;
|
|
||||||
position: absolute;
|
|
||||||
bottom: -0.10rem;
|
|
||||||
right: 0.08rem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.dropdown {
|
.dropdown {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<section id="charts" :class="{padding}">
|
<div class="dashboard-sections-container">
|
||||||
<el-row :gutter="16">
|
<section id="charts" :class="{padding}">
|
||||||
<el-col
|
<div
|
||||||
v-for="chart in props.charts"
|
v-for="chart in props.charts"
|
||||||
:key="`chart__${chart.id}`"
|
:key="`chart__${chart.id}`"
|
||||||
:xs="24"
|
class="dashboard-block"
|
||||||
:sm="(chart.chartOptions?.width || 6) * 4"
|
:class="{
|
||||||
:md="(chart.chartOptions?.width || 6) * 2"
|
[`dash-width-${chart.chartOptions?.width || 6}`]: true
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<div class="d-flex flex-column">
|
<div class="d-flex flex-column">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
@@ -64,9 +65,9 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</div>
|
||||||
</el-row>
|
</section>
|
||||||
</section>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -133,14 +134,28 @@
|
|||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "@kestra-io/ui-libs/src/scss/variables";
|
@import "@kestra-io/ui-libs/src/scss/variables";
|
||||||
|
|
||||||
|
.dashboard-sections-container{
|
||||||
|
container-type: inline-size;
|
||||||
|
}
|
||||||
|
|
||||||
|
$smallMobile: 375px;
|
||||||
|
$tablet: 768px;
|
||||||
|
|
||||||
section#charts {
|
section#charts {
|
||||||
|
display: grid;
|
||||||
|
gap: 1rem;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
@container (min-width: #{$smallMobile}) {
|
||||||
|
grid-template-columns: repeat(6, 1fr);
|
||||||
|
}
|
||||||
|
@container (min-width: #{$tablet}) {
|
||||||
|
grid-template-columns: repeat(12, 1fr);
|
||||||
|
}
|
||||||
&.padding {
|
&.padding {
|
||||||
padding: 0 2rem 1rem;
|
padding: 0 2rem 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
& .el-row .el-col {
|
.dashboard-block {
|
||||||
margin-bottom: 1rem;
|
|
||||||
|
|
||||||
& > div {
|
& > div {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 1.5rem;
|
padding: 1.5rem;
|
||||||
@@ -159,5 +174,24 @@ section#charts {
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dash-width-3, .dash-width-6, .dash-width-9, .dash-width-12 {
|
||||||
|
grid-column: span 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (min-width: #{$smallMobile}) {
|
||||||
|
.dash-width-6, .dash-width-9, .dash-width-12 {
|
||||||
|
grid-column: span 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (min-width: #{$tablet}) {
|
||||||
|
.dash-width-9 {
|
||||||
|
grid-column: span 9;
|
||||||
|
}
|
||||||
|
.dash-width-12 {
|
||||||
|
grid-column: span 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContextInfoContent :title="routeInfo.title">
|
<ContextInfoContent :title="routeInfo.title" ref="contextInfoRef">
|
||||||
<template v-if="isOnline" #back-button>
|
<template v-if="isOnline" #back-button>
|
||||||
<button
|
<button
|
||||||
class="back-button"
|
class="back-button"
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<OpenInNew class="blank" />
|
<OpenInNew class="blank" />
|
||||||
</router-link>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
<div ref="docWrapper" class="docs-controls">
|
<div class="docs-controls">
|
||||||
<template v-if="isOnline">
|
<template v-if="isOnline">
|
||||||
<ContextDocsSearch />
|
<ContextDocsSearch />
|
||||||
<DocsMenu />
|
<DocsMenu />
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, watch, computed, getCurrentInstance, onUnmounted, onMounted, nextTick} from "vue";
|
import {ref, watch, computed, getCurrentInstance, onUnmounted, onMounted} from "vue";
|
||||||
import {useDocStore} from "../../stores/doc";
|
import {useDocStore} from "../../stores/doc";
|
||||||
import {useI18n} from "vue-i18n";
|
import {useI18n} from "vue-i18n";
|
||||||
import OpenInNew from "vue-material-design-icons/OpenInNew.vue";
|
import OpenInNew from "vue-material-design-icons/OpenInNew.vue";
|
||||||
@@ -55,7 +55,9 @@
|
|||||||
import ContextInfoContent from "../ContextInfoContent.vue";
|
import ContextInfoContent from "../ContextInfoContent.vue";
|
||||||
import ContextChildTableOfContents from "./ContextChildTableOfContents.vue";
|
import ContextChildTableOfContents from "./ContextChildTableOfContents.vue";
|
||||||
|
|
||||||
|
|
||||||
import {useNetwork} from "@vueuse/core"
|
import {useNetwork} from "@vueuse/core"
|
||||||
|
import {useScrollMemory} from "../../composables/useScrollMemory"
|
||||||
const {isOnline} = useNetwork()
|
const {isOnline} = useNetwork()
|
||||||
|
|
||||||
import Markdown from "../../components/layout/Markdown.vue";
|
import Markdown from "../../components/layout/Markdown.vue";
|
||||||
@@ -64,19 +66,18 @@
|
|||||||
const docStore = useDocStore();
|
const docStore = useDocStore();
|
||||||
const {t} = useI18n({useScope: "global"});
|
const {t} = useI18n({useScope: "global"});
|
||||||
|
|
||||||
const docWrapper = ref<HTMLDivElement | null>(null);
|
const contextInfoRef = ref<InstanceType<typeof ContextInfoContent> | null>(null);
|
||||||
const docHistory = ref<string[]>([]);
|
const docHistory = ref<string[]>([]);
|
||||||
const currentHistoryIndex = ref(-1);
|
const currentHistoryIndex = ref(-1);
|
||||||
const ast = ref<any>(undefined);
|
const ast = ref<any>(undefined);
|
||||||
|
|
||||||
const pageMetadata = computed(() => docStore.pageMetadata);
|
const pageMetadata = computed(() => docStore.pageMetadata);
|
||||||
const docPath = computed(() => docStore.docPath);
|
const docPath = computed(() => docStore.docPath);
|
||||||
|
|
||||||
const routeInfo = computed(() => ({
|
const routeInfo = computed(() => ({
|
||||||
title: pageMetadata.value?.title ?? t("docs"),
|
title: pageMetadata.value?.title ?? t("docs"),
|
||||||
}));
|
}));
|
||||||
const canGoBack = computed(() => docHistory.value.length > 1 && currentHistoryIndex.value > 0);
|
const canGoBack = computed(() => docHistory.value.length > 1 && currentHistoryIndex.value > 0);
|
||||||
|
|
||||||
|
|
||||||
const addToHistory = (path: string) => {
|
const addToHistory = (path: string) => {
|
||||||
// Always store the path, even empty ones
|
// Always store the path, even empty ones
|
||||||
const pathToAdd = path || "";
|
const pathToAdd = path || "";
|
||||||
@@ -179,8 +180,10 @@
|
|||||||
|
|
||||||
addToHistory(val);
|
addToHistory(val);
|
||||||
refreshPage(val);
|
refreshPage(val);
|
||||||
nextTick(() => docWrapper.value?.scrollTo(0, 0));
|
|
||||||
}, {immediate: true});
|
}, {immediate: true});
|
||||||
|
|
||||||
|
const scrollableElement = computed(() => contextInfoRef.value?.contentRef ?? null)
|
||||||
|
useScrollMemory(ref("context-panel-docs"), scrollableElement as any)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -23,9 +23,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref} from "vue"
|
import {ref, computed} from "vue"
|
||||||
|
import {useRoute} from "vue-router";
|
||||||
|
import {useScrollMemory} from "../../composables/useScrollMemory";
|
||||||
|
|
||||||
const collapsed = ref(false);
|
const collapsed = ref(false);
|
||||||
|
const route = useRoute();
|
||||||
|
const scrollKey = computed(() => `docs:${route.fullPath}`);
|
||||||
|
|
||||||
|
useScrollMemory(scrollKey, undefined, true);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
import {useExecutionsStore} from "../../stores/executions";
|
import {useExecutionsStore} from "../../stores/executions";
|
||||||
import {useAuthStore} from "override/stores/auth";
|
import {useAuthStore} from "override/stores/auth";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
component: string;
|
component: string;
|
||||||
execution: {
|
execution: {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -95,7 +95,10 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
tooltipPosition: string;
|
tooltipPosition: string;
|
||||||
}>();
|
}>(), {
|
||||||
|
component: "el-button",
|
||||||
|
tooltipPosition: "bottom"
|
||||||
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
follow: [];
|
follow: [];
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="showStatChart()" #top>
|
<template v-if="showStatChart()" #top>
|
||||||
<Sections ref="dashboardComponent" :dashboard="{id: 'default', charts: []}" :charts showDefault />
|
<Sections ref="dashboardComponent" :dashboard="{id: 'default', charts: []}" :charts showDefault class="mb-4" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #table>
|
<template #table>
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
:selectable="!hidden?.includes('selection') && canCheck"
|
:selectable="!hidden?.includes('selection') && canCheck"
|
||||||
:no-data-text="$t('no_results.executions')"
|
:no-data-text="$t('no_results.executions')"
|
||||||
:rowKey="(row: any) => `${row.namespace}-${row.id}`"
|
:rowKey="(row: any) => row.id"
|
||||||
>
|
>
|
||||||
<template #select-actions>
|
<template #select-actions>
|
||||||
<BulkSelect
|
<BulkSelect
|
||||||
@@ -384,7 +384,7 @@
|
|||||||
import _merge from "lodash/merge";
|
import _merge from "lodash/merge";
|
||||||
import {useI18n} from "vue-i18n";
|
import {useI18n} from "vue-i18n";
|
||||||
import {useRoute, useRouter} from "vue-router";
|
import {useRoute, useRouter} from "vue-router";
|
||||||
import {ref, computed, onMounted, watch, h, useTemplateRef} from "vue";
|
import {ref, computed, watch, h, useTemplateRef} from "vue";
|
||||||
import * as YAML_UTILS from "@kestra-io/ui-libs/flow-yaml-utils";
|
import * as YAML_UTILS from "@kestra-io/ui-libs/flow-yaml-utils";
|
||||||
import {ElMessageBox, ElSwitch, ElFormItem, ElAlert, ElCheckbox} from "element-plus";
|
import {ElMessageBox, ElSwitch, ElFormItem, ElAlert, ElCheckbox} from "element-plus";
|
||||||
|
|
||||||
@@ -424,18 +424,17 @@
|
|||||||
import {filterValidLabels} from "./utils";
|
import {filterValidLabels} from "./utils";
|
||||||
import {useToast} from "../../utils/toast";
|
import {useToast} from "../../utils/toast";
|
||||||
import {storageKeys} from "../../utils/constants";
|
import {storageKeys} from "../../utils/constants";
|
||||||
import {defaultNamespace} from "../../composables/useNamespaces";
|
|
||||||
import {humanizeDuration, invisibleSpace} from "../../utils/filters";
|
import {humanizeDuration, invisibleSpace} from "../../utils/filters";
|
||||||
import Utils from "../../utils/utils";
|
import Utils from "../../utils/utils";
|
||||||
|
|
||||||
import action from "../../models/action";
|
import action from "../../models/action";
|
||||||
import permission from "../../models/permission";
|
import permission from "../../models/permission";
|
||||||
|
|
||||||
import useRestoreUrl from "../../composables/useRestoreUrl";
|
|
||||||
import useRouteContext from "../../composables/useRouteContext";
|
import useRouteContext from "../../composables/useRouteContext";
|
||||||
import {useTableColumns} from "../../composables/useTableColumns";
|
import {useTableColumns} from "../../composables/useTableColumns";
|
||||||
import {useDataTableActions} from "../../composables/useDataTableActions";
|
import {useDataTableActions} from "../../composables/useDataTableActions";
|
||||||
import {useSelectTableActions} from "../../composables/useSelectTableActions";
|
import {useSelectTableActions} from "../../composables/useSelectTableActions";
|
||||||
|
import {useApplyDefaultFilter} from "../filter/composables/useDefaultFilter";
|
||||||
|
|
||||||
import {useFlowStore} from "../../stores/flow";
|
import {useFlowStore} from "../../stores/flow";
|
||||||
import {useAuthStore} from "override/stores/auth";
|
import {useAuthStore} from "override/stores/auth";
|
||||||
@@ -496,7 +495,6 @@
|
|||||||
const selectedStatus = ref(undefined);
|
const selectedStatus = ref(undefined);
|
||||||
const lastRefreshDate = ref(new Date());
|
const lastRefreshDate = ref(new Date());
|
||||||
const unqueueDialogVisible = ref(false);
|
const unqueueDialogVisible = ref(false);
|
||||||
const isDefaultNamespaceAllow = ref(true);
|
|
||||||
const changeStatusDialogVisible = ref(false);
|
const changeStatusDialogVisible = ref(false);
|
||||||
const actionOptions = ref<Record<string, any>>({});
|
const actionOptions = ref<Record<string, any>>({});
|
||||||
const dblClickRouteName = ref("executions/update");
|
const dblClickRouteName = ref("executions/update");
|
||||||
@@ -614,11 +612,6 @@
|
|||||||
const routeInfo = computed(() => ({title: t("executions")}));
|
const routeInfo = computed(() => ({title: t("executions")}));
|
||||||
useRouteContext(routeInfo, props.embed);
|
useRouteContext(routeInfo, props.embed);
|
||||||
|
|
||||||
const {saveRestoreUrl} = useRestoreUrl({
|
|
||||||
restoreUrl: true,
|
|
||||||
isDefaultNamespaceAllow: isDefaultNamespaceAllow.value
|
|
||||||
});
|
|
||||||
|
|
||||||
const dataTableRef = ref(null);
|
const dataTableRef = ref(null);
|
||||||
const selectTableRef = useTemplateRef<typeof SelectTable>("selectTable");
|
const selectTableRef = useTemplateRef<typeof SelectTable>("selectTable");
|
||||||
|
|
||||||
@@ -634,8 +627,7 @@
|
|||||||
dblClickRouteName: dblClickRouteName.value,
|
dblClickRouteName: dblClickRouteName.value,
|
||||||
embed: props.embed,
|
embed: props.embed,
|
||||||
dataTableRef,
|
dataTableRef,
|
||||||
loadData: loadData,
|
loadData: loadData
|
||||||
saveRestoreUrl
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -1043,29 +1035,10 @@
|
|||||||
emit("state-count", {runningCount, totalCount});
|
emit("state-count", {runningCount, totalCount});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
useApplyDefaultFilter({
|
||||||
const query = {...route.query};
|
namespace: props.namespace,
|
||||||
let queryHasChanged = false;
|
includeTimeRange: true,
|
||||||
|
includeScope: true
|
||||||
const queryKeys = Object.keys(query);
|
|
||||||
if (props.namespace === undefined && defaultNamespace() && !queryKeys.some(key => key.startsWith("filters[namespace]"))) {
|
|
||||||
query["filters[namespace][PREFIX]"] = defaultNamespace();
|
|
||||||
queryHasChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!queryKeys.some(key => key.startsWith("filters[scope]"))) {
|
|
||||||
query["filters[scope][EQUALS]"] = "USER";
|
|
||||||
queryHasChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queryHasChanged) {
|
|
||||||
router.replace({query});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (route.name === "flows/update") {
|
|
||||||
optionalColumns.value = optionalColumns.value.
|
|
||||||
filter(col => col.prop !== "namespace" && col.prop !== "flowId");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(isOpenLabelsModal, (opening) => {
|
watch(isOpenLabelsModal, (opening) => {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
v-if="!isExecutionStarted"
|
v-if="!isExecutionStarted"
|
||||||
:execution="execution"
|
:execution="execution"
|
||||||
/>
|
/>
|
||||||
<el-card id="gantt" shadow="never" v-else-if="execution && executionsStore.flow">
|
<el-card id="gantt" shadow="never" :class="{'no-border': !hasValidDate}" v-else-if="execution && executionsStore.flow">
|
||||||
<template #header>
|
<template #header v-if="hasValidDate">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<Duration class="th text-end" :histories="execution.state.histories" />
|
<Duration class="th text-end" :histories="execution.state.histories" />
|
||||||
<span class="text-end" v-for="(date, i) in dates" :key="i">
|
<span class="text-end" v-for="(date, i) in dates" :key="i">
|
||||||
@@ -234,6 +234,9 @@
|
|||||||
isExecutionStarted() {
|
isExecutionStarted() {
|
||||||
return this.execution?.state?.current && !["CREATED", "QUEUED"].includes(this.execution.state.current);
|
return this.execution?.state?.current && !["CREATED", "QUEUED"].includes(this.execution.state.current);
|
||||||
},
|
},
|
||||||
|
hasValidDate() {
|
||||||
|
return isFinite(this.delta());
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
forwardEvent(type, event) {
|
forwardEvent(type, event) {
|
||||||
@@ -443,6 +446,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-border {
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
// To Separate through Line
|
// To Separate through Line
|
||||||
:deep(.vue-recycle-scroller__item-view) {
|
:deep(.vue-recycle-scroller__item-view) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {ref, computed, watch, PropType} from "vue";
|
import {ref, computed, watch, PropType} from "vue";
|
||||||
import DateSelect from "./DateSelect.vue";
|
import DateSelect from "./DateSelect.vue";
|
||||||
|
import {useI18n} from "vue-i18n";
|
||||||
|
|
||||||
interface TimePreset {
|
interface TimePreset {
|
||||||
value?: string;
|
value?: string;
|
||||||
@@ -64,9 +65,11 @@
|
|||||||
timeFilterPresets.value.map(preset => preset.value)
|
timeFilterPresets.value.map(preset => preset.value)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const {t} = useI18n();
|
||||||
|
|
||||||
const customAwarePlaceholder = computed<string | undefined>(() => {
|
const customAwarePlaceholder = computed<string | undefined>(() => {
|
||||||
if (props.placeholder) return props.placeholder;
|
if (props.placeholder) return props.placeholder;
|
||||||
return props.allowCustom ? "datepicker.custom" : undefined;
|
return props.allowCustom ? t("datepicker.custom") : undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
const onTimeRangeSelect = (range: string | undefined) => {
|
const onTimeRangeSelect = (range: string | undefined) => {
|
||||||
|
|||||||
70
ui/src/components/filter/composables/useDefaultFilter.ts
Normal file
70
ui/src/components/filter/composables/useDefaultFilter.ts
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
import {onMounted} from "vue";
|
||||||
|
import {LocationQuery, useRoute, useRouter} from "vue-router";
|
||||||
|
import {useMiscStore} from "override/stores/misc";
|
||||||
|
import {defaultNamespace} from "../../../composables/useNamespaces";
|
||||||
|
|
||||||
|
interface DefaultFilterOptions {
|
||||||
|
namespace?: string;
|
||||||
|
includeTimeRange?: boolean;
|
||||||
|
includeScope?: boolean;
|
||||||
|
legacyQuery?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const NAMESPACE_FILTER_PREFIX = "filters[namespace]";
|
||||||
|
const SCOPE_FILTER_PREFIX = "filters[scope]";
|
||||||
|
const TIME_RANGE_FILTER_PREFIX = "filters[timeRange]";
|
||||||
|
|
||||||
|
const hasFilterKey = (query: LocationQuery, prefix: string): boolean =>
|
||||||
|
Object.keys(query).some(key => key.startsWith(prefix));
|
||||||
|
|
||||||
|
export function applyDefaultFilters(
|
||||||
|
currentQuery: LocationQuery,
|
||||||
|
options: DefaultFilterOptions & {
|
||||||
|
configuration?: any;
|
||||||
|
route?: any
|
||||||
|
} = {}): { query: LocationQuery; hasChanges: boolean } {
|
||||||
|
|
||||||
|
const {configuration, route, namespace, includeTimeRange, includeScope, legacyQuery = false} = options;
|
||||||
|
|
||||||
|
const hasTimeRange = configuration && route
|
||||||
|
? configuration.keys?.some((k: any) => k.key === "timeRange") ?? false
|
||||||
|
: includeTimeRange ?? false;
|
||||||
|
const hasScope = configuration && route
|
||||||
|
? route?.name !== "logs/list" && (configuration.keys?.some((k: any) => k.key === "scope") ?? false)
|
||||||
|
: includeScope ?? false;
|
||||||
|
|
||||||
|
const query = {...currentQuery};
|
||||||
|
let hasChanges = false;
|
||||||
|
|
||||||
|
if (namespace === undefined && defaultNamespace() && !hasFilterKey(query, NAMESPACE_FILTER_PREFIX)) {
|
||||||
|
query[legacyQuery ? "namespace" : `${NAMESPACE_FILTER_PREFIX}[PREFIX]`] = defaultNamespace();
|
||||||
|
hasChanges = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasScope && !hasFilterKey(query, SCOPE_FILTER_PREFIX)) {
|
||||||
|
query[legacyQuery ? "scope" : `${SCOPE_FILTER_PREFIX}[EQUALS]`] = "USER";
|
||||||
|
hasChanges = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TIME_FILTER_KEYS = /startDate|endDate|timeRange/;
|
||||||
|
|
||||||
|
if (hasTimeRange && !Object.keys(query).some(key => TIME_FILTER_KEYS.test(key))) {
|
||||||
|
const defaultDuration = useMiscStore().configs?.chartDefaultDuration ?? "P30D";
|
||||||
|
query[legacyQuery ? "timeRange" : `${TIME_RANGE_FILTER_PREFIX}[EQUALS]`] = defaultDuration;
|
||||||
|
hasChanges = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {query, hasChanges};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useApplyDefaultFilter(options?: DefaultFilterOptions) {
|
||||||
|
const router = useRouter();
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const {query, hasChanges} = applyDefaultFilters(route.query, options);
|
||||||
|
if (hasChanges) {
|
||||||
|
router.replace({query});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
KV_COMPARATORS
|
KV_COMPARATORS
|
||||||
} from "../utils/filterTypes";
|
} from "../utils/filterTypes";
|
||||||
import {usePreAppliedFilters} from "./usePreAppliedFilters";
|
import {usePreAppliedFilters} from "./usePreAppliedFilters";
|
||||||
|
import {applyDefaultFilters} from "./useDefaultFilter";
|
||||||
|
|
||||||
export function useFilters(configuration: FilterConfiguration, showSearchInput = true, legacyQuery = false) {
|
export function useFilters(configuration: FilterConfiguration, showSearchInput = true, legacyQuery = false) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -28,8 +29,7 @@ export function useFilters(configuration: FilterConfiguration, showSearchInput =
|
|||||||
const {
|
const {
|
||||||
markAsPreApplied,
|
markAsPreApplied,
|
||||||
hasPreApplied,
|
hasPreApplied,
|
||||||
getPreApplied,
|
getPreApplied
|
||||||
getAllPreApplied
|
|
||||||
} = usePreAppliedFilters();
|
} = usePreAppliedFilters();
|
||||||
|
|
||||||
const appendQueryParam = (query: Record<string, any>, key: string, value: string) => {
|
const appendQueryParam = (query: Record<string, any>, key: string, value: string) => {
|
||||||
@@ -367,13 +367,10 @@ export function useFilters(configuration: FilterConfiguration, showSearchInput =
|
|||||||
updateRoute();
|
updateRoute();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets all filters to their pre-applied state and clears the search query
|
|
||||||
*/
|
|
||||||
const resetToPreApplied = () => {
|
const resetToPreApplied = () => {
|
||||||
appliedFilters.value = getAllPreApplied();
|
const defaultQuery = applyDefaultFilters({}, {configuration, route, legacyQuery}).query;
|
||||||
searchQuery.value = "";
|
searchQuery.value = "";
|
||||||
updateRoute();
|
router.push({query: defaultQuery});
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export function useValues(label: string | undefined, t?: ReturnType<typeof useI1
|
|||||||
{label: t("datepicker.last24hours"), value: "PT24H"},
|
{label: t("datepicker.last24hours"), value: "PT24H"},
|
||||||
{label: t("datepicker.last48hours"), value: "PT48H"},
|
{label: t("datepicker.last48hours"), value: "PT48H"},
|
||||||
{label: t("datepicker.last7days"), value: "PT168H"},
|
{label: t("datepicker.last7days"), value: "PT168H"},
|
||||||
{label: t("datepicker.last30days"), value: "PT720H"},
|
{label: t("datepicker.last30days"), value: "P30D"},
|
||||||
{label: t("datepicker.last365days"), value: "PT8760H"},
|
{label: t("datepicker.last365days"), value: "PT8760H"},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export const useNamespacesFilter = (): ComputedRef<FilterConfiguration> => compu
|
|||||||
const {t} = useI18n();
|
const {t} = useI18n();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: t("filter.titles.namespaces_filters"),
|
title: t("filter.titles.namespace_filters"),
|
||||||
searchPlaceholder: t("filter.search_placeholders.search_namespaces"),
|
searchPlaceholder: t("filter.search_placeholders.search_namespaces"),
|
||||||
keys: [],
|
keys: [],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export const decodeSearchParams = (query: LocationQuery) =>
|
|||||||
operation
|
operation
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(v => v !== null);
|
||||||
|
|
||||||
type Filter = Pick<AppliedFilter, "key" | "comparator" | "value">;
|
type Filter = Pick<AppliedFilter, "key" | "comparator" | "value">;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
:namespace="flowStore.flow?.namespace"
|
:namespace="flowStore.flow?.namespace"
|
||||||
:flowId="flowStore.flow?.id"
|
:flowId="flowStore.flow?.id"
|
||||||
:topbar="false"
|
:topbar="false"
|
||||||
:restoreUrl="false"
|
|
||||||
filter
|
filter
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
import FlowRootTopBar from "./FlowRootTopBar.vue";
|
import FlowRootTopBar from "./FlowRootTopBar.vue";
|
||||||
import FlowConcurrency from "./FlowConcurrency.vue";
|
import FlowConcurrency from "./FlowConcurrency.vue";
|
||||||
import DemoAuditLogs from "../demo/AuditLogs.vue";
|
import DemoAuditLogs from "../demo/AuditLogs.vue";
|
||||||
import {useAuthStore} from "override/stores/auth"
|
import {useAuthStore} from "override/stores/auth";
|
||||||
import {useMiscStore} from "override/stores/misc";
|
import {useMiscStore} from "override/stores/misc";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -59,13 +59,12 @@
|
|||||||
"$route.params.tab": {
|
"$route.params.tab": {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler: function (newTab) {
|
handler: function (newTab) {
|
||||||
if (newTab === "overview") {
|
if (newTab === "overview" || newTab === "executions") {
|
||||||
const dateTimeKeys = ["startDate", "endDate", "timeRange"];
|
const dateTimeKeys = ["startDate", "endDate", "timeRange"];
|
||||||
|
|
||||||
if (!Object.keys(this.$route.query).some((key) => dateTimeKeys.some((dateTimeKey) => key.includes(dateTimeKey)))) {
|
if (!Object.keys(this.$route.query).some((key) => dateTimeKeys.some((dateTimeKey) => key.includes(dateTimeKey)))) {
|
||||||
const miscStore = useMiscStore();
|
const DEFAULT_DURATION = this.miscStore.configs?.chartDefaultDuration ?? "P30D";
|
||||||
const defaultDuration = miscStore.configs?.chartDefaultDuration || "P30D";
|
const newQuery = {...this.$route.query, "filters[timeRange][EQUALS]": DEFAULT_DURATION};
|
||||||
const newQuery = {...this.$route.query, "filters[timeRange][EQUALS]": defaultDuration};
|
|
||||||
this.$router.replace({name: this.$route.name, params: this.$route.params, query: newQuery});
|
this.$router.replace({name: this.$route.name, params: this.$route.params, query: newQuery});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -314,7 +313,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useCoreStore, useFlowStore, useAuthStore),
|
...mapStores(useCoreStore, useFlowStore, useAuthStore, useMiscStore),
|
||||||
routeInfo() {
|
routeInfo() {
|
||||||
return {
|
return {
|
||||||
title: this.$route.params.id,
|
title: this.$route.params.id,
|
||||||
|
|||||||
@@ -204,6 +204,7 @@
|
|||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<TimeSeries
|
<TimeSeries
|
||||||
:chart="mappedChart(scope.row.id, scope.row.namespace)"
|
:chart="mappedChart(scope.row.id, scope.row.namespace)"
|
||||||
|
:filters="chartFilters()"
|
||||||
showDefault
|
showDefault
|
||||||
short
|
short
|
||||||
/>
|
/>
|
||||||
@@ -248,8 +249,8 @@
|
|||||||
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, computed, onMounted, useTemplateRef} from "vue";
|
import {ref, computed, useTemplateRef} from "vue";
|
||||||
import {useRoute, useRouter} from "vue-router";
|
import {useRoute} from "vue-router";
|
||||||
import {useI18n} from "vue-i18n";
|
import {useI18n} from "vue-i18n";
|
||||||
import _merge from "lodash/merge";
|
import _merge from "lodash/merge";
|
||||||
import * as FILTERS from "../../utils/filters";
|
import * as FILTERS from "../../utils/filters";
|
||||||
@@ -283,16 +284,16 @@
|
|||||||
import permission from "../../models/permission";
|
import permission from "../../models/permission";
|
||||||
|
|
||||||
import {useToast} from "../../utils/toast";
|
import {useToast} from "../../utils/toast";
|
||||||
import {defaultNamespace} from "../../composables/useNamespaces";
|
|
||||||
|
|
||||||
import {useFlowStore} from "../../stores/flow";
|
import {useFlowStore} from "../../stores/flow";
|
||||||
import {useAuthStore} from "override/stores/auth";
|
import {useAuthStore} from "override/stores/auth";
|
||||||
|
import {useMiscStore} from "override/stores/misc";
|
||||||
import {useExecutionsStore} from "../../stores/executions";
|
import {useExecutionsStore} from "../../stores/executions";
|
||||||
|
|
||||||
import {useTableColumns} from "../../composables/useTableColumns";
|
import {useTableColumns} from "../../composables/useTableColumns";
|
||||||
import {DataTableRef, useDataTableActions} from "../../composables/useDataTableActions";
|
import {DataTableRef, useDataTableActions} from "../../composables/useDataTableActions";
|
||||||
import {useSelectTableActions} from "../../composables/useSelectTableActions";
|
import {useSelectTableActions} from "../../composables/useSelectTableActions";
|
||||||
|
import {useApplyDefaultFilter} from "../filter/composables/useDefaultFilter";
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
topbar?: boolean;
|
topbar?: boolean;
|
||||||
@@ -307,9 +308,9 @@
|
|||||||
const flowStore = useFlowStore();
|
const flowStore = useFlowStore();
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const executionsStore = useExecutionsStore();
|
const executionsStore = useExecutionsStore();
|
||||||
|
const miscStore = useMiscStore();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const {t} = useI18n();
|
const {t} = useI18n();
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
@@ -494,6 +495,11 @@
|
|||||||
updateVisibleColumns(newColumns);
|
updateVisibleColumns(newColumns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useApplyDefaultFilter({
|
||||||
|
namespace: props.namespace,
|
||||||
|
includeScope: true
|
||||||
|
});
|
||||||
|
|
||||||
function exportFlows() {
|
function exportFlows() {
|
||||||
toast.confirm(
|
toast.confirm(
|
||||||
t("flow export", {flowCount: queryBulkAction.value ? flowStore.total : selection.value.length}),
|
t("flow export", {flowCount: queryBulkAction.value ? flowStore.total : selection.value.length}),
|
||||||
@@ -622,24 +628,14 @@
|
|||||||
return MAPPED_CHARTS;
|
return MAPPED_CHARTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
function chartFilters() {
|
||||||
const query = {...route.query};
|
const DEFAULT_DURATION = miscStore.configs?.chartDefaultDuration ?? "P30D";
|
||||||
const queryKeys = Object.keys(query);
|
return [{
|
||||||
let queryHasChanged = false;
|
field: "timeRange",
|
||||||
|
value: DEFAULT_DURATION,
|
||||||
if (props.namespace === undefined && defaultNamespace() && !queryKeys.some(key => key.startsWith("filters[namespace]"))) {
|
operation: "EQUALS"
|
||||||
query["filters[namespace][PREFIX]"] = defaultNamespace();
|
}];
|
||||||
queryHasChanged = true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!queryKeys.some(key => key.startsWith("filters[scope]"))) {
|
|
||||||
query["filters[scope][EQUALS]"] = "USER";
|
|
||||||
queryHasChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queryHasChanged) router.replace({query});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -56,7 +56,6 @@
|
|||||||
import DataTable from "../layout/DataTable.vue";
|
import DataTable from "../layout/DataTable.vue";
|
||||||
import SearchField from "../layout/SearchField.vue";
|
import SearchField from "../layout/SearchField.vue";
|
||||||
import NamespaceSelect from "../namespaces/components/NamespaceSelect.vue";
|
import NamespaceSelect from "../namespaces/components/NamespaceSelect.vue";
|
||||||
import useRestoreUrl from "../../composables/useRestoreUrl";
|
|
||||||
import useRouteContext from "../../composables/useRouteContext";
|
import useRouteContext from "../../composables/useRouteContext";
|
||||||
import {useDataTableActions} from "../../composables/useDataTableActions";
|
import {useDataTableActions} from "../../composables/useDataTableActions";
|
||||||
|
|
||||||
@@ -77,11 +76,9 @@
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
useRouteContext(routeInfo);
|
useRouteContext(routeInfo);
|
||||||
const {saveRestoreUrl} = useRestoreUrl({restoreUrl: true, isDefaultNamespaceAllow: true});
|
|
||||||
|
|
||||||
const {onPageChanged, onDataTableValue, queryWithFilter, ready} = useDataTableActions({
|
const {onPageChanged, onDataTableValue, queryWithFilter, ready} = useDataTableActions({
|
||||||
loadData,
|
loadData
|
||||||
saveRestoreUrl
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const namespace = computed({
|
const namespace = computed({
|
||||||
|
|||||||
@@ -83,6 +83,7 @@
|
|||||||
/* eslint-disable vue/enforce-style-attribute */
|
/* eslint-disable vue/enforce-style-attribute */
|
||||||
import {computed, onMounted, ref, shallowRef, watch} from "vue";
|
import {computed, onMounted, ref, shallowRef, watch} from "vue";
|
||||||
import {useI18n} from "vue-i18n";
|
import {useI18n} from "vue-i18n";
|
||||||
|
import {useThrottleFn} from "@vueuse/core";
|
||||||
import UnfoldLessHorizontal from "vue-material-design-icons/UnfoldLessHorizontal.vue";
|
import UnfoldLessHorizontal from "vue-material-design-icons/UnfoldLessHorizontal.vue";
|
||||||
import UnfoldMoreHorizontal from "vue-material-design-icons/UnfoldMoreHorizontal.vue";
|
import UnfoldMoreHorizontal from "vue-material-design-icons/UnfoldMoreHorizontal.vue";
|
||||||
import Help from "vue-material-design-icons/Help.vue";
|
import Help from "vue-material-design-icons/Help.vue";
|
||||||
@@ -94,6 +95,7 @@
|
|||||||
import {TabFocus} from "monaco-editor/esm/vs/editor/browser/config/tabFocus";
|
import {TabFocus} from "monaco-editor/esm/vs/editor/browser/config/tabFocus";
|
||||||
import MonacoEditor from "./MonacoEditor.vue";
|
import MonacoEditor from "./MonacoEditor.vue";
|
||||||
import type * as monaco from "monaco-editor/esm/vs/editor/editor.api";
|
import type * as monaco from "monaco-editor/esm/vs/editor/editor.api";
|
||||||
|
import {useScrollMemory} from "../../composables/useScrollMemory";
|
||||||
|
|
||||||
const {t} = useI18n()
|
const {t} = useI18n()
|
||||||
|
|
||||||
@@ -123,6 +125,7 @@
|
|||||||
shouldFocus: {type: Boolean, default: true},
|
shouldFocus: {type: Boolean, default: true},
|
||||||
showScroll: {type: Boolean, default: false},
|
showScroll: {type: Boolean, default: false},
|
||||||
diffOverviewBar: {type: Boolean, default: true},
|
diffOverviewBar: {type: Boolean, default: true},
|
||||||
|
scrollKey: {type: String, default: undefined},
|
||||||
})
|
})
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@@ -312,6 +315,29 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const codeEditor = editor as monaco.editor.IStandaloneCodeEditor;
|
||||||
|
const scrollMemory = props.scrollKey ? useScrollMemory(ref(props.scrollKey)) : null;
|
||||||
|
|
||||||
|
if (props.scrollKey && scrollMemory) {
|
||||||
|
const savedState = scrollMemory.loadData<monaco.editor.ICodeEditorViewState>("viewState");
|
||||||
|
if (savedState) {
|
||||||
|
codeEditor.restoreViewState(savedState);
|
||||||
|
codeEditor.revealLineInCenterIfOutsideViewport?.(codeEditor.getPosition()?.lineNumber ?? 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const top = scrollMemory.loadData<number>("scrollTop", 0);
|
||||||
|
if (typeof top === "number") {
|
||||||
|
codeEditor.setScrollTop(top);
|
||||||
|
}
|
||||||
|
|
||||||
|
const throttledSave = useThrottleFn(() => {
|
||||||
|
scrollMemory.saveData(codeEditor.saveViewState(), "viewState");
|
||||||
|
scrollMemory.saveData(codeEditor.getScrollTop(), "scrollTop");
|
||||||
|
}, 100);
|
||||||
|
|
||||||
|
codeEditor.onDidScrollChange?.(throttledSave);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isDiff.value) {
|
if (!isDiff.value) {
|
||||||
editor.onDidBlurEditorWidget?.(() => {
|
editor.onDidBlurEditorWidget?.(() => {
|
||||||
emit("focusout", isCodeEditor(editor)
|
emit("focusout", isCodeEditor(editor)
|
||||||
@@ -468,6 +494,10 @@
|
|||||||
position: position,
|
position: position,
|
||||||
model: model,
|
model: model,
|
||||||
});
|
});
|
||||||
|
// Save view state when cursor changes
|
||||||
|
if (scrollMemory) {
|
||||||
|
scrollMemory.saveData(codeEditor.saveViewState(), "viewState");
|
||||||
|
}
|
||||||
}, 100) as unknown as number;
|
}, 100) as unknown as number;
|
||||||
highlightPebble();
|
highlightPebble();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -59,12 +59,12 @@
|
|||||||
const {t} = useI18n();
|
const {t} = useI18n();
|
||||||
|
|
||||||
const exportYaml = () => {
|
const exportYaml = () => {
|
||||||
const src = flowStore.flowYaml
|
if(!flowStore.flow || !flowStore.flowYaml) return;
|
||||||
if(!src) {
|
|
||||||
return;
|
const {id, namespace} = flowStore.flow;
|
||||||
}
|
const blob = new Blob([flowStore.flowYaml], {type: "text/yaml"});
|
||||||
const blob = new Blob([src], {type: "text/yaml"});
|
|
||||||
localUtils.downloadUrl(window.URL.createObjectURL(blob), "flow.yaml");
|
localUtils.downloadUrl(window.URL.createObjectURL(blob), `${namespace}.${id}.yaml`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const flowStore = useFlowStore();
|
const flowStore = useFlowStore();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
:creating="isCreating"
|
:creating="isCreating"
|
||||||
:path="path"
|
:path="path"
|
||||||
:diffOverviewBar="false"
|
:diffOverviewBar="false"
|
||||||
|
:scrollKey="editorScrollKey"
|
||||||
@update:model-value="editorUpdate"
|
@update:model-value="editorUpdate"
|
||||||
@cursor="updatePluginDocumentation"
|
@cursor="updatePluginDocumentation"
|
||||||
@save="flow ? saveFlowYaml(): saveFileContent()"
|
@save="flow ? saveFlowYaml(): saveFileContent()"
|
||||||
@@ -224,6 +225,19 @@
|
|||||||
const namespacesStore = useNamespacesStore();
|
const namespacesStore = useNamespacesStore();
|
||||||
const miscStore = useMiscStore();
|
const miscStore = useMiscStore();
|
||||||
|
|
||||||
|
const editorScrollKey = computed(() => {
|
||||||
|
if (props.flow) {
|
||||||
|
const ns = flowStore.flow?.namespace ?? "";
|
||||||
|
const id = flowStore.flow?.id ?? "";
|
||||||
|
return `flow:${ns}/${id}:code`;
|
||||||
|
}
|
||||||
|
const ns = namespace.value;
|
||||||
|
if (ns && props.path) {
|
||||||
|
return `file:${ns}:${props.path}`;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
});
|
||||||
|
|
||||||
function loadPluginsHash() {
|
function loadPluginsHash() {
|
||||||
miscStore.loadConfigs().then(config => {
|
miscStore.loadConfigs().then(config => {
|
||||||
hash.value = config.pluginsHash;
|
hash.value = config.pluginsHash;
|
||||||
|
|||||||
@@ -688,21 +688,22 @@
|
|||||||
|
|
||||||
async function removeItems() {
|
async function removeItems() {
|
||||||
if(confirmation.value.nodes === undefined) return;
|
if(confirmation.value.nodes === undefined) return;
|
||||||
for (const node of confirmation.value.nodes) {
|
await Promise.all(confirmation.value.nodes.map(async (node, i) => {
|
||||||
|
const path = filesStore.getPath(node.id) ?? "";
|
||||||
try {
|
try {
|
||||||
await namespacesStore.deleteFileDirectory({
|
await namespacesStore.deleteFileDirectory({
|
||||||
namespace: props.currentNS ?? route.params.namespace as string,
|
namespace: props.currentNS ?? route.params.namespace as string,
|
||||||
path: filesStore.getPath(node) ?? "",
|
path,
|
||||||
});
|
});
|
||||||
tree.value.remove(node.id);
|
tree.value.remove(node.id);
|
||||||
closeTab?.({
|
closeTab?.({
|
||||||
path: filesStore.getPath(node) ?? "",
|
path,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Failed to delete file: ${node.fileName}`, error);
|
console.error(`Failed to delete file: ${node.fileName}`, error);
|
||||||
toast.error(`Failed to delete file: ${node.fileName}`);
|
toast.error(`Failed to delete file: ${node.fileName}`);
|
||||||
}
|
}
|
||||||
}
|
}));
|
||||||
confirmation.value = {visible: false, nodes: []};
|
confirmation.value = {visible: false, nodes: []};
|
||||||
toast.success("Selected files deleted successfully.");
|
toast.success("Selected files deleted successfully.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -235,7 +235,7 @@
|
|||||||
import {useI18n} from "vue-i18n";
|
import {useI18n} from "vue-i18n";
|
||||||
import {useRoute} from "vue-router";
|
import {useRoute} from "vue-router";
|
||||||
import _groupBy from "lodash/groupBy";
|
import _groupBy from "lodash/groupBy";
|
||||||
import {computed, ref, useTemplateRef, watch} from "vue";
|
import {computed, nextTick, ref, useTemplateRef, watch} from "vue";
|
||||||
|
|
||||||
import Check from "vue-material-design-icons/Check.vue";
|
import Check from "vue-material-design-icons/Check.vue";
|
||||||
import Delete from "vue-material-design-icons/Delete.vue";
|
import Delete from "vue-material-design-icons/Delete.vue";
|
||||||
@@ -272,7 +272,6 @@
|
|||||||
import DataTable from "../layout/DataTable.vue";
|
import DataTable from "../layout/DataTable.vue";
|
||||||
import _merge from "lodash/merge";
|
import _merge from "lodash/merge";
|
||||||
import {type DataTableRef, useDataTableActions} from "../../composables/useDataTableActions.ts";
|
import {type DataTableRef, useDataTableActions} from "../../composables/useDataTableActions.ts";
|
||||||
|
|
||||||
const dataTable = useTemplateRef<DataTableRef>("dataTable");
|
const dataTable = useTemplateRef<DataTableRef>("dataTable");
|
||||||
|
|
||||||
const loadData = async (callback?: () => void) => {
|
const loadData = async (callback?: () => void) => {
|
||||||
@@ -491,6 +490,8 @@
|
|||||||
kv.value.key = entry.key;
|
kv.value.key = entry.key;
|
||||||
const {type, value} = await namespacesStore.kv({namespace: entry.namespace, key: entry.key});
|
const {type, value} = await namespacesStore.kv({namespace: entry.namespace, key: entry.key});
|
||||||
kv.value.type = type;
|
kv.value.type = type;
|
||||||
|
// Force the type reset before setting the value
|
||||||
|
await nextTick();
|
||||||
if (type === "JSON") {
|
if (type === "JSON") {
|
||||||
kv.value.value = JSON.stringify(value);
|
kv.value.value = JSON.stringify(value);
|
||||||
} else if (type === "BOOLEAN") {
|
} else if (type === "BOOLEAN") {
|
||||||
@@ -504,7 +505,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeKv(namespace: string, key: string) {
|
function removeKv(namespace: string, key: string) {
|
||||||
toast.confirm("delete confirm", async () => {
|
toast.confirm(t("delete confirm"), async () => {
|
||||||
return namespacesStore
|
return namespacesStore
|
||||||
.deleteKv({namespace, key: key})
|
.deleteKv({namespace, key: key})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -543,14 +544,16 @@
|
|||||||
const type = kv.value.type;
|
const type = kv.value.type;
|
||||||
let value: any = kv.value.value;
|
let value: any = kv.value.value;
|
||||||
|
|
||||||
if (type === "STRING" || type === "DURATION") {
|
if (type === "STRING") {
|
||||||
|
value = JSON.stringify(value);
|
||||||
|
} else if (["DURATION", "JSON"].includes(type)) {
|
||||||
value = value || "";
|
value = value || "";
|
||||||
} else if (type === "DATETIME") {
|
} else if (type === "DATETIME") {
|
||||||
value = new Date(value!).toISOString();
|
value = new Date(value!).toISOString();
|
||||||
} else if (type === "DATE") {
|
} else if (type === "DATE") {
|
||||||
value = new Date(value!).toISOString().split("T")[0];
|
value = new Date(value!).toISOString().split("T")[0];
|
||||||
} else if (["NUMBER", "BOOLEAN", "JSON"].includes(type)) {
|
} else {
|
||||||
value = JSON.stringify(value);
|
value = String(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const contentType = "text/plain";
|
const contentType = "text/plain";
|
||||||
@@ -605,10 +608,9 @@
|
|||||||
|
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
|
||||||
watch(() => kv.value.type, () => {
|
watch(() => kv.value.type, (newType) => {
|
||||||
if (formRef.value) {
|
formRef.value?.clearValidate("value");
|
||||||
(formRef.value as any).clearValidate("value");
|
if (newType === "BOOLEAN") kv.value.value = false;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContextInfoContent :title="t('feeds.title')">
|
<ContextInfoContent ref="contextInfoRef" :title="t('feeds.title')">
|
||||||
<div
|
<div
|
||||||
class="post"
|
class="post"
|
||||||
:class="{
|
:class="{
|
||||||
@@ -46,9 +46,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {computed, onMounted, reactive} from "vue";
|
import {computed, onMounted, reactive, ref} from "vue";
|
||||||
import {useI18n} from "vue-i18n";
|
import {useI18n} from "vue-i18n";
|
||||||
import {useStorage} from "@vueuse/core"
|
import {useStorage} from "@vueuse/core"
|
||||||
|
import {useScrollMemory} from "../../composables/useScrollMemory"
|
||||||
|
|
||||||
import OpenInNew from "vue-material-design-icons/OpenInNew.vue";
|
import OpenInNew from "vue-material-design-icons/OpenInNew.vue";
|
||||||
import MenuDown from "vue-material-design-icons/MenuDown.vue";
|
import MenuDown from "vue-material-design-icons/MenuDown.vue";
|
||||||
@@ -62,6 +63,7 @@
|
|||||||
const apiStore = useApiStore();
|
const apiStore = useApiStore();
|
||||||
const {t} = useI18n({useScope: "global"});
|
const {t} = useI18n({useScope: "global"});
|
||||||
|
|
||||||
|
const contextInfoRef = ref<InstanceType<typeof ContextInfoContent> | null>(null);
|
||||||
const feeds = computed(() => apiStore.feeds);
|
const feeds = computed(() => apiStore.feeds);
|
||||||
|
|
||||||
const expanded = reactive<Record<string, boolean>>({});
|
const expanded = reactive<Record<string, boolean>>({});
|
||||||
@@ -70,6 +72,9 @@
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
lastNewsReadDate.value = feeds.value[0].publicationDate;
|
lastNewsReadDate.value = feeds.value[0].publicationDate;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const scrollableElement = computed(() => contextInfoRef.value?.contentRef || null)
|
||||||
|
useScrollMemory(ref("context-panel-news"), scrollableElement as any)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<TopNavBar v-if="!embed" :title="routeInfo.title" />
|
<TopNavBar v-if="!embed" :title="routeInfo.title" />
|
||||||
<section v-bind="$attrs" :class="{'container': !embed}" class="log-panel">
|
<section v-bind="$attrs" :class="{'container': !embed}" class="log-panel">
|
||||||
<div class="log-content">
|
<div class="log-content">
|
||||||
<DataTable @page-changed="onPageChanged" ref="dataTable" :total="logsStore.total" :size="pageSize" :page="pageNumber" :embed="embed">
|
<DataTable @page-changed="onPageChanged" ref="dataTable" :total="logsStore.total" :size="internalPageSize" :page="internalPageNumber" :embed="embed">
|
||||||
<template #navbar v-if="!embed || showFilters">
|
<template #navbar v-if="!embed || showFilters">
|
||||||
<KSFilter
|
<KSFilter
|
||||||
:configuration="logFilter"
|
:configuration="logFilter"
|
||||||
@@ -15,12 +15,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="showStatChart()" #top>
|
<template v-if="showStatChart()" #top>
|
||||||
<Sections ref="dashboard" :charts :dashboard="{id: 'default', charts: []}" showDefault />
|
<Sections ref="dashboardRef" :charts :dashboard="{id: 'default', charts: []}" showDefault class="mb-4" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #table>
|
<template #table>
|
||||||
<div v-loading="isLoading">
|
<div v-loading="isLoading">
|
||||||
<div v-if="logsStore.logs !== undefined && logsStore.logs.length > 0" class="logs-wrapper">
|
<div v-if="logsStore.logs !== undefined && logsStore.logs?.length > 0" class="logs-wrapper">
|
||||||
<LogLine
|
<LogLine
|
||||||
v-for="(log, i) in logsStore.logs"
|
v-for="(log, i) in logsStore.logs"
|
||||||
:key="`${log.taskRunId}-${i}`"
|
:key="`${log.taskRunId}-${i}`"
|
||||||
@@ -42,6 +42,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import {ref, computed, onMounted, watch} from "vue";
|
||||||
|
import {useRoute} from "vue-router";
|
||||||
|
import {useI18n} from "vue-i18n";
|
||||||
|
import _merge from "lodash/merge";
|
||||||
|
import moment from "moment";
|
||||||
import {useLogFilter} from "../filter/configurations";
|
import {useLogFilter} from "../filter/configurations";
|
||||||
import KSFilter from "../filter/components/KSFilter.vue";
|
import KSFilter from "../filter/components/KSFilter.vue";
|
||||||
import Sections from "../dashboard/sections/Sections.vue";
|
import Sections from "../dashboard/sections/Sections.vue";
|
||||||
@@ -49,193 +54,151 @@
|
|||||||
import TopNavBar from "../../components/layout/TopNavBar.vue";
|
import TopNavBar from "../../components/layout/TopNavBar.vue";
|
||||||
import LogLine from "../logs/LogLine.vue";
|
import LogLine from "../logs/LogLine.vue";
|
||||||
import NoData from "../layout/NoData.vue";
|
import NoData from "../layout/NoData.vue";
|
||||||
|
|
||||||
const logFilter = useLogFilter();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import {mapStores} from "pinia";
|
|
||||||
import RouteContext from "../../mixins/routeContext";
|
|
||||||
import RestoreUrl from "../../mixins/restoreUrl";
|
|
||||||
import DataTableActions from "../../mixins/dataTableActions";
|
|
||||||
import _merge from "lodash/merge";
|
|
||||||
import {storageKeys} from "../../utils/constants";
|
import {storageKeys} from "../../utils/constants";
|
||||||
import {decodeSearchParams} from "../filter/utils/helpers";
|
import {decodeSearchParams} from "../filter/utils/helpers";
|
||||||
import * as YAML_UTILS from "@kestra-io/ui-libs/flow-yaml-utils";
|
import * as YAML_UTILS from "@kestra-io/ui-libs/flow-yaml-utils";
|
||||||
import YAML_CHART from "../dashboard/assets/logs_timeseries_chart.yaml?raw";
|
import YAML_CHART from "../dashboard/assets/logs_timeseries_chart.yaml?raw";
|
||||||
import {useLogsStore} from "../../stores/logs";
|
import {useLogsStore} from "../../stores/logs";
|
||||||
import {defaultNamespace} from "../../composables/useNamespaces";
|
import {useDataTableActions} from "../../composables/useDataTableActions";
|
||||||
import {defineComponent} from "vue";
|
import useRouteContext from "../../composables/useRouteContext";
|
||||||
|
|
||||||
export default defineComponent({
|
const props = withDefaults(defineProps<{
|
||||||
mixins: [RouteContext, RestoreUrl, DataTableActions],
|
logLevel?: string;
|
||||||
props: {
|
embed?: boolean;
|
||||||
logLevel: {
|
showFilters?: boolean;
|
||||||
type: String,
|
filters?: Record<string, any>;
|
||||||
default: undefined
|
reloadLogs?: number;
|
||||||
},
|
}>(), {
|
||||||
embed: {
|
embed: false,
|
||||||
type: Boolean,
|
showFilters: false,
|
||||||
default: false
|
filters: undefined,
|
||||||
},
|
logLevel: undefined,
|
||||||
showFilters: {
|
reloadLogs: undefined
|
||||||
type: Boolean,
|
});
|
||||||
default: false
|
|
||||||
},
|
|
||||||
filters: {
|
|
||||||
type: Object,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
reloadLogs: {
|
|
||||||
type: Number,
|
|
||||||
default: undefined
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isDefaultNamespaceAllow: true,
|
|
||||||
task: undefined,
|
|
||||||
isLoading: false,
|
|
||||||
lastRefreshDate: new Date(),
|
|
||||||
canAutoRefresh: false,
|
|
||||||
showChart: localStorage.getItem(storageKeys.SHOW_LOGS_CHART) !== "false",
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
storageKeys() {
|
|
||||||
return storageKeys
|
|
||||||
},
|
|
||||||
...mapStores(useLogsStore),
|
|
||||||
routeInfo() {
|
|
||||||
return {
|
|
||||||
title: this.$t("logs"),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
isFlowEdit() {
|
|
||||||
return this.$route.name === "flows/update"
|
|
||||||
},
|
|
||||||
isNamespaceEdit() {
|
|
||||||
return this.$route.name === "namespaces/update"
|
|
||||||
},
|
|
||||||
selectedLogLevel() {
|
|
||||||
const decodedParams = decodeSearchParams(this.$route.query);
|
|
||||||
const levelFilters = decodedParams.filter(item => item?.field === "level");
|
|
||||||
const decoded = levelFilters.length > 0 ? levelFilters[0]?.value : "INFO";
|
|
||||||
return this.logLevel || decoded || localStorage.getItem("defaultLogLevel") || "INFO";
|
|
||||||
},
|
|
||||||
endDate() {
|
|
||||||
if (this.$route.query.endDate) {
|
|
||||||
return this.$route.query.endDate;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
},
|
|
||||||
startDate() {
|
|
||||||
// we mention the last refresh date here to trick
|
|
||||||
// VueJs fine grained reactivity system and invalidate
|
|
||||||
// computed property startDate
|
|
||||||
if (this.$route.query.startDate && this.lastRefreshDate) {
|
|
||||||
return this.$route.query.startDate;
|
|
||||||
}
|
|
||||||
if (this.$route.query.timeRange) {
|
|
||||||
return this.$moment().subtract(this.$moment.duration(this.$route.query.timeRange).as("milliseconds")).toISOString(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// the default is PT30D
|
const route = useRoute();
|
||||||
return this.$moment().subtract(7, "days").toISOString(true);
|
const {t} = useI18n();
|
||||||
},
|
const logsStore = useLogsStore();
|
||||||
namespace() {
|
const logFilter = useLogFilter();
|
||||||
return this.$route.params.namespace ?? this.$route.params.id;
|
|
||||||
},
|
|
||||||
flowId() {
|
|
||||||
return this.$route.params.id;
|
|
||||||
},
|
|
||||||
charts() {
|
|
||||||
return [
|
|
||||||
{...YAML_UTILS.parse(YAML_CHART), content: YAML_CHART}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
beforeRouteEnter(to: any, _: any, next: (route?: any) => void) {
|
|
||||||
const query = {...to.query};
|
|
||||||
let queryHasChanged = false;
|
|
||||||
|
|
||||||
const queryKeys = Object.keys(query);
|
const routeInfo = computed(() => ({
|
||||||
if (defaultNamespace() && !queryKeys.some(key => key.startsWith("filters[namespace]"))) {
|
title: t("logs"),
|
||||||
query["filters[namespace][PREFIX]"] = defaultNamespace();
|
}));
|
||||||
queryHasChanged = true;
|
useRouteContext(routeInfo, props.embed);
|
||||||
}
|
|
||||||
|
|
||||||
if (queryHasChanged) {
|
const isLoading = ref(false);
|
||||||
next({
|
const lastRefreshDate = ref(new Date());
|
||||||
...to,
|
const showChart = ref(localStorage.getItem(storageKeys.SHOW_LOGS_CHART) !== "false");
|
||||||
query,
|
const dashboardRef = ref();
|
||||||
replace: true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
showStatChart() {
|
|
||||||
return this.showChart;
|
|
||||||
},
|
|
||||||
onShowChartChange(value: boolean) {
|
|
||||||
this.showChart = value;
|
|
||||||
localStorage.setItem(storageKeys.SHOW_LOGS_CHART, value.toString());
|
|
||||||
if (this.showStatChart()) {
|
|
||||||
this.load();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
refresh() {
|
|
||||||
this.lastRefreshDate = new Date();
|
|
||||||
if (this.$refs.dashboard) {
|
|
||||||
this.$refs.dashboard.refreshCharts();
|
|
||||||
}
|
|
||||||
this.load();
|
|
||||||
},
|
|
||||||
loadQuery(base: any) {
|
|
||||||
let queryFilter = this.filters ?? this.queryWithFilter();
|
|
||||||
|
|
||||||
if (this.isFlowEdit) {
|
const isFlowEdit = computed(() => route.name === "flows/update");
|
||||||
queryFilter["filters[namespace][EQUALS]"] = this.namespace;
|
const isNamespaceEdit = computed(() => route.name === "namespaces/update");
|
||||||
queryFilter["filters[flowId][EQUALS]"] = this.flowId;
|
const selectedLogLevel = computed(() => {
|
||||||
} else if (this.isNamespaceEdit) {
|
const decodedParams = decodeSearchParams(route.query);
|
||||||
queryFilter["filters[namespace][EQUALS]"] = this.namespace;
|
const levelFilters = decodedParams.filter(item => item?.field === "level");
|
||||||
}
|
const decoded = levelFilters.length > 0 ? levelFilters[0]?.value : "INFO";
|
||||||
|
return props.logLevel || decoded || localStorage.getItem("defaultLogLevel") || "INFO";
|
||||||
|
});
|
||||||
|
const endDate = computed(() => {
|
||||||
|
if (route.query.endDate) {
|
||||||
|
return route.query.endDate;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
});
|
||||||
|
const startDate = computed(() => {
|
||||||
|
// we mention the last refresh date here to trick
|
||||||
|
// VueJs fine grained reactivity system and invalidate
|
||||||
|
// computed property startDate
|
||||||
|
if (route.query.startDate && lastRefreshDate.value) {
|
||||||
|
return route.query.startDate;
|
||||||
|
}
|
||||||
|
if (route.query.timeRange) {
|
||||||
|
return moment().subtract(moment.duration(route.query.timeRange as string).as("milliseconds")).toISOString(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (!queryFilter["startDate"] || !queryFilter["endDate"]) {
|
// the default is PT30D
|
||||||
queryFilter["startDate"] = this.startDate;
|
return moment().subtract(7, "days").toISOString(true);
|
||||||
queryFilter["endDate"] = this.endDate;
|
});
|
||||||
}
|
const flowId = computed(() => route.params.id);
|
||||||
|
const namespace = computed(() => route.params.namespace ?? route.params.id);
|
||||||
|
const charts = computed(() => [
|
||||||
|
{...YAML_UTILS.parse(YAML_CHART), content: YAML_CHART}
|
||||||
|
]);
|
||||||
|
|
||||||
delete queryFilter["level"];
|
const loadQuery = (base: any) => {
|
||||||
|
let queryFilter = props.filters ?? queryWithFilter();
|
||||||
|
|
||||||
return _merge(base, queryFilter)
|
if (isFlowEdit.value) {
|
||||||
},
|
queryFilter["filters[namespace][EQUALS]"] = namespace.value;
|
||||||
load() {
|
queryFilter["filters[flowId][EQUALS]"] = flowId.value;
|
||||||
this.isLoading = true
|
} else if (isNamespaceEdit.value) {
|
||||||
|
queryFilter["filters[namespace][EQUALS]"] = namespace.value;
|
||||||
|
}
|
||||||
|
|
||||||
const data = {
|
if (!queryFilter["startDate"] || !queryFilter["endDate"]) {
|
||||||
page: this.filters ? this.internalPageNumber : this.$route.query.page || this.internalPageNumber,
|
queryFilter["startDate"] = startDate.value;
|
||||||
size: this.filters ? this.internalPageSize : this.$route.query.size || this.internalPageSize,
|
queryFilter["endDate"] = endDate.value;
|
||||||
...this.filters
|
}
|
||||||
};
|
|
||||||
this.logsStore.findLogs(this.loadQuery({
|
|
||||||
...data,
|
|
||||||
minLevel: this.filters ? null : this.selectedLogLevel,
|
|
||||||
sort: "timestamp:desc"
|
|
||||||
}))
|
|
||||||
.finally(() => {
|
|
||||||
this.isLoading = false
|
|
||||||
this.saveRestoreUrl();
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
delete queryFilter["level"];
|
||||||
},
|
|
||||||
watch: {
|
return _merge(base, queryFilter);
|
||||||
reloadLogs(newValue) {
|
};
|
||||||
if(newValue) this.refresh();
|
|
||||||
},
|
const loadData = (callback?: () => void) => {
|
||||||
|
isLoading.value = true;
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
page: props.filters ? internalPageNumber.value : route.query.page || internalPageNumber.value,
|
||||||
|
size: props.filters ? internalPageSize.value : route.query.size || internalPageSize.value,
|
||||||
|
...props.filters
|
||||||
|
};
|
||||||
|
|
||||||
|
logsStore.findLogs(loadQuery({
|
||||||
|
...data,
|
||||||
|
minLevel: props.filters ? null : selectedLogLevel.value,
|
||||||
|
sort: "timestamp:desc"
|
||||||
|
}))
|
||||||
|
.finally(() => {
|
||||||
|
isLoading.value = false;
|
||||||
|
if (callback) callback();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const {onPageChanged, queryWithFilter, internalPageNumber, internalPageSize} = useDataTableActions({
|
||||||
|
loadData
|
||||||
|
});
|
||||||
|
|
||||||
|
const showStatChart = () => showChart.value;
|
||||||
|
|
||||||
|
const onShowChartChange = (value: boolean) => {
|
||||||
|
showChart.value = value;
|
||||||
|
localStorage.setItem(storageKeys.SHOW_LOGS_CHART, value.toString());
|
||||||
|
if (showStatChart()) {
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const refresh = () => {
|
||||||
|
lastRefreshDate.value = new Date();
|
||||||
|
if (dashboardRef.value) {
|
||||||
|
dashboardRef.value.refreshCharts();
|
||||||
|
}
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(() => route.query, () => {
|
||||||
|
loadData();
|
||||||
|
}, {deep: true});
|
||||||
|
|
||||||
|
watch(() => props.reloadLogs, (newValue) => {
|
||||||
|
if (newValue) refresh();
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// Load data on mount if not embedded
|
||||||
|
if (!props.embed) {
|
||||||
|
loadData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
const namespace = computed(() => route.params?.id) as Ref<string>;
|
const namespace = computed(() => route.params?.id) as Ref<string>;
|
||||||
|
|
||||||
|
const miscStore = useMiscStore();
|
||||||
const namespacesStore = useNamespacesStore();
|
const namespacesStore = useNamespacesStore();
|
||||||
|
|
||||||
watch(namespace, (newID) => {
|
watch(namespace, (newID) => {
|
||||||
@@ -40,13 +41,12 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
watch(() => route.params.tab, (newTab) => {
|
watch(() => route.params.tab, (newTab) => {
|
||||||
if (newTab === "overview") {
|
if (newTab === "overview" || newTab === "executions") {
|
||||||
const dateTimeKeys = ["startDate", "endDate", "timeRange"];
|
const dateTimeKeys = ["startDate", "endDate", "timeRange"];
|
||||||
|
|
||||||
if (!Object.keys(route.query).some((key) => dateTimeKeys.some((dateTimeKey) => key.includes(dateTimeKey)))) {
|
if (!Object.keys(route.query).some((key) => dateTimeKeys.some((dateTimeKey) => key.includes(dateTimeKey)))) {
|
||||||
const miscStore = useMiscStore();
|
const DEFAULT_DURATION = miscStore.configs?.chartDefaultDuration ?? "P30D";
|
||||||
const defaultDuration = miscStore.configs?.chartDefaultDuration || "P30D";
|
const newQuery = {...route.query, "filters[timeRange][EQUALS]": DEFAULT_DURATION};
|
||||||
const newQuery = {...route.query, "filters[timeRange][EQUALS]": defaultDuration};
|
|
||||||
router.replace({name: route.name, params: route.params, query: newQuery});
|
router.replace({name: route.name, params: route.params, query: newQuery});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="no-code">
|
<div class="no-code" ref="scrollContainer">
|
||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<Task
|
<Task
|
||||||
v-if="creatingTask || editingTask"
|
v-if="creatingTask || editingTask"
|
||||||
@@ -64,6 +64,7 @@
|
|||||||
import {usePluginsStore} from "../../stores/plugins";
|
import {usePluginsStore} from "../../stores/plugins";
|
||||||
import {useKeyboardSave} from "./utils/useKeyboardSave";
|
import {useKeyboardSave} from "./utils/useKeyboardSave";
|
||||||
import {deepEqual} from "../../utils/utils";
|
import {deepEqual} from "../../utils/utils";
|
||||||
|
import {useScrollMemory} from "../../composables/useScrollMemory";
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps<NoCodeProps>();
|
const props = defineProps<NoCodeProps>();
|
||||||
@@ -195,6 +196,28 @@
|
|||||||
emit("editTask", parentPath, blockSchemaPath, refPath)
|
emit("editTask", parentPath, blockSchemaPath, refPath)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Scroll position persistence for No-code editor
|
||||||
|
const scrollContainer = ref<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
|
const flowIdentity = computed(() => {
|
||||||
|
const namespace = flowStore.flow?.namespace ?? "";
|
||||||
|
const flowId = flowStore.flow?.id ?? "";
|
||||||
|
return `${namespace}/${flowId}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
const scrollKey = computed(() => {
|
||||||
|
const base = `nocode:${flowIdentity.value}`;
|
||||||
|
// home screen
|
||||||
|
if (!props.creatingTask && !props.editingTask) return `${base}:home`;
|
||||||
|
// task-specific
|
||||||
|
const action = props.creatingTask ? "create" : "edit";
|
||||||
|
const parentPath = props.parentPath ?? "";
|
||||||
|
const refPath = props.refPath ?? "";
|
||||||
|
const fieldName = props.fieldName ?? "";
|
||||||
|
return `${base}:task:${action}:parentPath:${parentPath}:refPath:${refPath}:fieldName:${fieldName}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
useScrollMemory(scrollKey, scrollContainer);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="playgroundStore.enabled && isTask && taskObject?.id" class="flow-playground">
|
<div v-if="playgroundStore.enabled && isTask && taskModel?.id" class="flow-playground">
|
||||||
<PlaygroundRunTaskButton :taskId="taskObject?.id" />
|
<PlaygroundRunTaskButton :taskId="taskModel?.id" />
|
||||||
</div>
|
</div>
|
||||||
<el-form v-if="isTaskDefinitionBasedOnType" labelPosition="top">
|
<el-form v-if="isTaskDefinitionBasedOnType" labelPosition="top">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
@@ -17,12 +17,12 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div @click="isPlugin && pluginsStore.updateDocumentation(taskObject as Parameters<typeof pluginsStore.updateDocumentation>[0])">
|
<div @click="() => onTaskEditorClick(taskModel)">
|
||||||
<TaskObject
|
<TaskObject
|
||||||
v-loading="isLoading"
|
v-loading="isLoading"
|
||||||
v-if="(selectedTaskType || !isTaskDefinitionBasedOnType) && schema"
|
v-if="(selectedTaskType || !isTaskDefinitionBasedOnType) && schema"
|
||||||
name="root"
|
name="root"
|
||||||
:modelValue="taskObject"
|
:modelValue="taskModel"
|
||||||
@update:model-value="onTaskInput"
|
@update:model-value="onTaskInput"
|
||||||
:schema
|
:schema
|
||||||
:properties
|
:properties
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
FULL_SCHEMA_INJECTION_KEY,
|
FULL_SCHEMA_INJECTION_KEY,
|
||||||
SCHEMA_DEFINITIONS_INJECTION_KEY,
|
SCHEMA_DEFINITIONS_INJECTION_KEY,
|
||||||
DATA_TYPES_MAP_INJECTION_KEY,
|
DATA_TYPES_MAP_INJECTION_KEY,
|
||||||
|
ON_TASK_EDITOR_CLICK_INJECTION_KEY,
|
||||||
} from "../injectionKeys";
|
} from "../injectionKeys";
|
||||||
import {removeNullAndUndefined} from "../utils/cleanUp";
|
import {removeNullAndUndefined} from "../utils/cleanUp";
|
||||||
import {removeRefPrefix, usePluginsStore} from "../../../stores/plugins";
|
import {removeRefPrefix, usePluginsStore} from "../../../stores/plugins";
|
||||||
@@ -63,9 +64,9 @@
|
|||||||
const pluginsStore = usePluginsStore();
|
const pluginsStore = usePluginsStore();
|
||||||
const playgroundStore = usePlaygroundStore();
|
const playgroundStore = usePlaygroundStore();
|
||||||
|
|
||||||
type PartialCodeElement = Partial<NoCodeElement>;
|
type PartialNoCodeElement = Partial<NoCodeElement>;
|
||||||
|
|
||||||
const taskObject = ref<PartialCodeElement | undefined>({});
|
const taskModel = ref<PartialNoCodeElement | undefined>({});
|
||||||
const selectedTaskType = ref<string>();
|
const selectedTaskType = ref<string>();
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
|
||||||
@@ -108,7 +109,7 @@
|
|||||||
|
|
||||||
watch(modelValue, (v) => {
|
watch(modelValue, (v) => {
|
||||||
if (!v) {
|
if (!v) {
|
||||||
taskObject.value = {};
|
taskModel.value = {};
|
||||||
selectedTaskType.value = undefined;
|
selectedTaskType.value = undefined;
|
||||||
} else {
|
} else {
|
||||||
setup()
|
setup()
|
||||||
@@ -150,20 +151,20 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
const parsed = YAML_UTILS.parse<PartialCodeElement>(modelValue.value);
|
const parsed = YAML_UTILS.parse<PartialNoCodeElement>(modelValue.value);
|
||||||
if(isPluginDefaults.value){
|
if(isPluginDefaults.value){
|
||||||
const {forced, type, values} = parsed as any;
|
const {forced, type, values} = parsed as any;
|
||||||
taskObject.value = {...values, forced, type};
|
taskModel.value = {...values, forced, type};
|
||||||
}else{
|
}else{
|
||||||
taskObject.value = parsed;
|
taskModel.value = parsed;
|
||||||
}
|
}
|
||||||
selectedTaskType.value = taskObject.value?.type;
|
selectedTaskType.value = taskModel.value?.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
// when tab is opened, load the documentation
|
// when tab is opened, load the documentation
|
||||||
onActivated(() => {
|
onActivated(() => {
|
||||||
if(selectedTaskType.value && parentPath !== "inputs"){
|
if(selectedTaskType.value && parentPath !== "inputs"){
|
||||||
pluginsStore.updateDocumentation(taskObject.value as Parameters<typeof pluginsStore.updateDocumentation>[0]);
|
pluginsStore.updateDocumentation(taskModel.value as Parameters<typeof pluginsStore.updateDocumentation>[0]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -218,7 +219,7 @@
|
|||||||
const resolvedType = computed<string>(() => {
|
const resolvedType = computed<string>(() => {
|
||||||
if(resolvedTypes.value.length > 1 && selectedTaskType.value){
|
if(resolvedTypes.value.length > 1 && selectedTaskType.value){
|
||||||
// find the resolvedType that match the current dataType
|
// find the resolvedType that match the current dataType
|
||||||
const dataType = taskObject.value?.data?.type;
|
const dataType = taskModel.value?.data?.type;
|
||||||
if(dataType){
|
if(dataType){
|
||||||
for(const typeLocal of resolvedTypes.value){
|
for(const typeLocal of resolvedTypes.value){
|
||||||
const schema = definitions.value?.[typeLocal];
|
const schema = definitions.value?.[typeLocal];
|
||||||
@@ -330,13 +331,13 @@
|
|||||||
watch([selectedTaskType, fullSchema], ([task]) => {
|
watch([selectedTaskType, fullSchema], ([task]) => {
|
||||||
if (task) {
|
if (task) {
|
||||||
if(isPlugin.value){
|
if(isPlugin.value){
|
||||||
pluginsStore.updateDocumentation(taskObject.value as Parameters<typeof pluginsStore.updateDocumentation>[0]);
|
pluginsStore.updateDocumentation(taskModel.value as Parameters<typeof pluginsStore.updateDocumentation>[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {immediate: true});
|
}, {immediate: true});
|
||||||
|
|
||||||
function onTaskInput(val: PartialCodeElement | undefined) {
|
function onTaskInput(val: PartialNoCodeElement | undefined) {
|
||||||
taskObject.value = val;
|
taskModel.value = val;
|
||||||
if(fieldName){
|
if(fieldName){
|
||||||
val = {
|
val = {
|
||||||
[fieldName]: val,
|
[fieldName]: val,
|
||||||
@@ -362,12 +363,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onTaskTypeSelect() {
|
function onTaskTypeSelect() {
|
||||||
const value: PartialCodeElement = {
|
const value: PartialNoCodeElement = {
|
||||||
type: selectedTaskType.value ?? ""
|
type: selectedTaskType.value ?? ""
|
||||||
};
|
};
|
||||||
|
|
||||||
onTaskInput(value);
|
onTaskInput(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onTaskEditorClick = inject(ON_TASK_EDITOR_CLICK_INJECTION_KEY, (elt?: PartialNoCodeElement) => {
|
||||||
|
const type = elt?.type;
|
||||||
|
if(isPlugin.value && type){
|
||||||
|
pluginsStore.updateDocumentation({type});
|
||||||
|
}else{
|
||||||
|
pluginsStore.updateDocumentation();
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type {ComputedRef, InjectionKey, Ref} from "vue"
|
import type {ComputedRef, InjectionKey, Ref} from "vue"
|
||||||
import {TopologyClickParams} from "./utils/types"
|
import {NoCodeElement, TopologyClickParams} from "./utils/types"
|
||||||
import {Panel} from "../../utils/multiPanelTypes"
|
import {Panel} from "../../utils/multiPanelTypes"
|
||||||
|
|
||||||
export const BLOCK_SCHEMA_PATH_INJECTION_KEY = Symbol("block-schema-path-injection-key") as InjectionKey<ComputedRef<string>>
|
export const BLOCK_SCHEMA_PATH_INJECTION_KEY = Symbol("block-schema-path-injection-key") as InjectionKey<ComputedRef<string>>
|
||||||
@@ -91,3 +91,5 @@ export const FULL_SCHEMA_INJECTION_KEY = Symbol("full-schema-injection-key") as
|
|||||||
export const SCHEMA_DEFINITIONS_INJECTION_KEY = Symbol("schema-definitions-injection-key") as InjectionKey<ComputedRef<Record<string, any>>>
|
export const SCHEMA_DEFINITIONS_INJECTION_KEY = Symbol("schema-definitions-injection-key") as InjectionKey<ComputedRef<Record<string, any>>>
|
||||||
|
|
||||||
export const DATA_TYPES_MAP_INJECTION_KEY = Symbol("data-types-injection-key") as InjectionKey<ComputedRef<Record<string, string[] | undefined>>>
|
export const DATA_TYPES_MAP_INJECTION_KEY = Symbol("data-types-injection-key") as InjectionKey<ComputedRef<Record<string, string[] | undefined>>>
|
||||||
|
|
||||||
|
export const ON_TASK_EDITOR_CLICK_INJECTION_KEY = Symbol("on-task-editor-click-injection-key") as InjectionKey<(elt?: Partial<NoCodeElement>) => void>;
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, computed, onBeforeMount} from "vue";
|
import {ref, computed, onBeforeMount, watch} from "vue";
|
||||||
import {useRoute, useRouter} from "vue-router";
|
import {useRoute, useRouter} from "vue-router";
|
||||||
import {isEntryAPluginElementPredicate, TaskIcon} from "@kestra-io/ui-libs";
|
import {isEntryAPluginElementPredicate, TaskIcon} from "@kestra-io/ui-libs";
|
||||||
import DottedLayout from "../layout/DottedLayout.vue";
|
import DottedLayout from "../layout/DottedLayout.vue";
|
||||||
@@ -71,6 +71,7 @@
|
|||||||
import headerImage from "../../assets/icons/plugin.svg";
|
import headerImage from "../../assets/icons/plugin.svg";
|
||||||
import headerImageDark from "../../assets/icons/plugin-dark.svg";
|
import headerImageDark from "../../assets/icons/plugin-dark.svg";
|
||||||
import {usePluginsStore} from "../../stores/plugins";
|
import {usePluginsStore} from "../../stores/plugins";
|
||||||
|
import useRestoreUrl from "../../composables/useRestoreUrl";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -85,13 +86,23 @@
|
|||||||
embed: false
|
embed: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const {saveRestoreUrl} = useRestoreUrl();
|
||||||
|
|
||||||
const icons = ref<Record<string, any>>({});
|
const icons = ref<Record<string, any>>({});
|
||||||
const searchText = ref("");
|
const searchText = ref("");
|
||||||
|
|
||||||
const handleSearch = (query: string) => {
|
const handleSearch = (query: string) => {
|
||||||
searchText.value = query;
|
searchText.value = query;
|
||||||
|
const newQuery: Record<string, any> = {...route.query};
|
||||||
|
if (query !== undefined && query !== null && String(query).trim() !== "") {
|
||||||
|
newQuery.q = query;
|
||||||
|
} else {
|
||||||
|
// remove an empty `q=` in the URL on plugins/view
|
||||||
|
delete newQuery.q;
|
||||||
|
}
|
||||||
|
|
||||||
router.push({
|
router.push({
|
||||||
query: {...route.query, q: query || undefined}
|
query: newQuery
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -144,7 +155,13 @@
|
|||||||
if (!cls) {
|
if (!cls) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
router.push({name: "plugins/view", params: {cls: cls}})
|
router.push({
|
||||||
|
name: "plugins/view",
|
||||||
|
params: {
|
||||||
|
...route.params,
|
||||||
|
cls: cls
|
||||||
|
}
|
||||||
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
const isVisible = (plugin: any) => {
|
const isVisible = (plugin: any) => {
|
||||||
@@ -171,6 +188,11 @@
|
|||||||
loadPluginIcons();
|
loadPluginIcons();
|
||||||
searchText.value = String(route.query?.q ?? "");
|
searchText.value = String(route.query?.q ?? "");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(() => route.query.q, (newQ) => {
|
||||||
|
searchText.value = String(newQ ?? "");
|
||||||
|
saveRestoreUrl();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</el-breadcrumb>
|
</el-breadcrumb>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="currentView === 'list'" class="list">
|
<div v-if="currentView === 'list'" class="list" ref="listRef">
|
||||||
<div
|
<div
|
||||||
v-for="plugin in sortedPlugins"
|
v-for="plugin in sortedPlugins"
|
||||||
:key="`${plugin.group}-${plugin.title}`"
|
:key="`${plugin.group}-${plugin.title}`"
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="currentView === 'group'" class="group-view">
|
<div v-else-if="currentView === 'group'" class="group-view" ref="groupRef">
|
||||||
<PluginUnified
|
<PluginUnified
|
||||||
:group="currentGroup"
|
:group="currentGroup"
|
||||||
:subgroup="currentSubgroup"
|
:subgroup="currentSubgroup"
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="currentView === 'documentation'" :class="['doc-view', {'no-padding': !currentDocumentationPlugin}]">
|
<div v-else-if="currentView === 'documentation'" :class="['doc-view', {'no-padding': !currentDocumentationPlugin}]" ref="docRef">
|
||||||
<PluginDocumentation
|
<PluginDocumentation
|
||||||
:plugin="currentDocumentationPlugin"
|
:plugin="currentDocumentationPlugin"
|
||||||
/>
|
/>
|
||||||
@@ -72,6 +72,7 @@
|
|||||||
import PluginUnified from "./PluginUnified.vue";
|
import PluginUnified from "./PluginUnified.vue";
|
||||||
import PluginDocumentation from "./PluginDocumentation.vue";
|
import PluginDocumentation from "./PluginDocumentation.vue";
|
||||||
import {usePluginsStore} from "../../stores/plugins";
|
import {usePluginsStore} from "../../stores/plugins";
|
||||||
|
import {useScrollMemory} from "../../composables/useScrollMemory";
|
||||||
import {capitalize, formatPluginTitle} from "../../utils/global";
|
import {capitalize, formatPluginTitle} from "../../utils/global";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -94,6 +95,18 @@
|
|||||||
const navigationStack = ref<NavigationItem[]>([]);
|
const navigationStack = ref<NavigationItem[]>([]);
|
||||||
const currentDocumentationPlugin = ref<any>(null);
|
const currentDocumentationPlugin = ref<any>(null);
|
||||||
const currentView = ref<"list" | "group" | "documentation">("documentation");
|
const currentView = ref<"list" | "group" | "documentation">("documentation");
|
||||||
|
const listRef = ref<HTMLDivElement | null>(null);
|
||||||
|
const groupRef = ref<HTMLDivElement | null>(null);
|
||||||
|
const docRef = ref<HTMLDivElement | null>(null);
|
||||||
|
const scrollKeyBase = "plugins:documentation";
|
||||||
|
|
||||||
|
const listScrollKey = computed(() => `${scrollKeyBase}:list`);
|
||||||
|
const groupScrollKey = computed(() => `${scrollKeyBase}:group`);
|
||||||
|
const docScrollKey = computed(() => `${scrollKeyBase}:documentation`);
|
||||||
|
|
||||||
|
useScrollMemory(listScrollKey, listRef);
|
||||||
|
useScrollMemory(groupScrollKey, groupRef);
|
||||||
|
useScrollMemory(docScrollKey, docRef);
|
||||||
|
|
||||||
const getSimpleType = (item: string) => item.split(".").pop() || item;
|
const getSimpleType = (item: string) => item.split(".").pop() || item;
|
||||||
|
|
||||||
@@ -275,7 +288,9 @@
|
|||||||
}
|
}
|
||||||
}, {immediate: true, deep: true});
|
}, {immediate: true, deep: true});
|
||||||
|
|
||||||
onMounted(loadPluginIcons);
|
onMounted(async () => {
|
||||||
|
await loadPluginIcons();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {useRoute, useRouter} from "vue-router";
|
|||||||
import _merge from "lodash/merge";
|
import _merge from "lodash/merge";
|
||||||
import _cloneDeep from "lodash/cloneDeep";
|
import _cloneDeep from "lodash/cloneDeep";
|
||||||
import _isEqual from "lodash/isEqual";
|
import _isEqual from "lodash/isEqual";
|
||||||
|
import useRestoreUrl from "./useRestoreUrl";
|
||||||
|
|
||||||
interface SortItem {
|
interface SortItem {
|
||||||
prop?: string;
|
prop?: string;
|
||||||
@@ -26,7 +27,6 @@ interface DataTableActionsOptions {
|
|||||||
embed?: boolean;
|
embed?: boolean;
|
||||||
dataTableRef?: Ref<DataTableRef | null>;
|
dataTableRef?: Ref<DataTableRef | null>;
|
||||||
loadData?: (callback?: () => void) => void;
|
loadData?: (callback?: () => void) => void;
|
||||||
saveRestoreUrl?: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useDataTableActions(options: DataTableActionsOptions = {}) {
|
export function useDataTableActions(options: DataTableActionsOptions = {}) {
|
||||||
@@ -35,7 +35,6 @@ export function useDataTableActions(options: DataTableActionsOptions = {}) {
|
|||||||
|
|
||||||
const sort = ref("");
|
const sort = ref("");
|
||||||
const dblClickRouteName = ref(options.dblClickRouteName);
|
const dblClickRouteName = ref(options.dblClickRouteName);
|
||||||
const loadInit = ref(true);
|
|
||||||
const ready = ref(false);
|
const ready = ref(false);
|
||||||
const internalPageSize = ref(25);
|
const internalPageSize = ref(25);
|
||||||
const internalPageNumber = ref(1);
|
const internalPageNumber = ref(1);
|
||||||
@@ -47,6 +46,8 @@ export function useDataTableActions(options: DataTableActionsOptions = {}) {
|
|||||||
const embed = computed(() => options.embed);
|
const embed = computed(() => options.embed);
|
||||||
const dataTableRef = computed(() => options.dataTableRef?.value);
|
const dataTableRef = computed(() => options.dataTableRef?.value);
|
||||||
|
|
||||||
|
const {loadInit, saveRestoreUrl} = useRestoreUrl({restoreUrl: true});
|
||||||
|
|
||||||
const sortString = (sortItem: SortItem, sortKeyMapper: (k: string) => string): string | undefined => {
|
const sortString = (sortItem: SortItem, sortKeyMapper: (k: string) => string): string | undefined => {
|
||||||
if (sortItem && sortItem.prop && sortItem.order) {
|
if (sortItem && sortItem.prop && sortItem.order) {
|
||||||
return `${sortKeyMapper(sortItem.prop)}:${sortItem.order === "descending" ? "desc" : "asc"}`;
|
return `${sortKeyMapper(sortItem.prop)}:${sortItem.order === "descending" ? "desc" : "asc"}`;
|
||||||
@@ -149,9 +150,7 @@ export function useDataTableActions(options: DataTableActionsOptions = {}) {
|
|||||||
ready.value = true;
|
ready.value = true;
|
||||||
loadInit.value = true;
|
loadInit.value = true;
|
||||||
|
|
||||||
if (options.saveRestoreUrl) {
|
saveRestoreUrl();
|
||||||
options.saveRestoreUrl();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dataTableRef.value) {
|
if (dataTableRef.value) {
|
||||||
dataTableRef.value.isLoading = false;
|
dataTableRef.value.isLoading = false;
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ export default function useRestoreUrl(options: UseRestoreUrlOptions = {}) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merges saved URL query parameters from sessionStorage with current route.
|
||||||
|
* Only adds missing parameters to avoid overwriting user changes.
|
||||||
|
* Updates route only when changes are made.
|
||||||
|
*/
|
||||||
const goToRestoreUrl = () => {
|
const goToRestoreUrl = () => {
|
||||||
if (!restoreUrl) {
|
if (!restoreUrl) {
|
||||||
return;
|
return;
|
||||||
@@ -84,9 +89,12 @@ export default function useRestoreUrl(options: UseRestoreUrlOptions = {}) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Automatically call goToRestoreUrl on mount if needed (equivalent to created() hook)
|
/**
|
||||||
|
* Automatically restores saved URL state from sessionStorage on mount.
|
||||||
|
* Only triggers when restoreUrl is enabled and saved state exists.
|
||||||
|
*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (Object.keys(route.query).length === 0 && restoreUrl) {
|
if (restoreUrl && localStorageValue.value) {
|
||||||
loadInit.value = false;
|
loadInit.value = false;
|
||||||
goToRestoreUrl();
|
goToRestoreUrl();
|
||||||
}
|
}
|
||||||
|
|||||||
49
ui/src/composables/useScrollMemory.ts
Normal file
49
ui/src/composables/useScrollMemory.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import {watch, nextTick, ref, Ref, onActivated} from "vue"
|
||||||
|
import {useScroll, useThrottleFn, useWindowScroll} from "@vueuse/core"
|
||||||
|
import {storageKeys} from "../utils/constants"
|
||||||
|
|
||||||
|
export function useScrollMemory(keyRef: Ref<string>, elementRef?: Ref<HTMLElement | null>, useWindow = false): {
|
||||||
|
saveData: (value: any, suffix?: string) => void;
|
||||||
|
loadData: <T = any>(suffix?: string, defaultValue?: T) => T | undefined;
|
||||||
|
} {
|
||||||
|
const getStorageKey = (suffix = "") => `${storageKeys.SCROLL_MEMORY_PREFIX}-${keyRef.value}${suffix}`
|
||||||
|
|
||||||
|
const saveToStorage = (value: any, suffix = "") => {
|
||||||
|
sessionStorage?.setItem(getStorageKey(suffix), JSON.stringify(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadFromStorage = <T = any>(suffix = "", defaultValue?: T): T | undefined => {
|
||||||
|
const saved = sessionStorage?.getItem(getStorageKey(suffix))
|
||||||
|
return saved ? JSON.parse(saved) : defaultValue
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveScroll = (value: number) => saveToStorage(value)
|
||||||
|
const loadScroll = (): number => loadFromStorage("", 0) || 0
|
||||||
|
|
||||||
|
const restoreScroll = () => {
|
||||||
|
const scrollTop = loadScroll()
|
||||||
|
const applyScroll = useWindow
|
||||||
|
? () => window.scrollTo({top: scrollTop, behavior: "smooth"})
|
||||||
|
: () => { if (elementRef?.value) elementRef.value.scrollTo({top: scrollTop, behavior: "smooth"}) }
|
||||||
|
setTimeout(applyScroll, 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
const throttledSave = useThrottleFn((top: number) => saveScroll(top), 100)
|
||||||
|
|
||||||
|
if (useWindow) {
|
||||||
|
const {y} = useWindowScroll({throttle: 16, onScroll: () => throttledSave(y.value)})
|
||||||
|
watch(keyRef, () => nextTick(restoreScroll), {immediate: true})
|
||||||
|
onActivated(() => nextTick(restoreScroll))
|
||||||
|
} else {
|
||||||
|
useScroll(elementRef || ref(null), {
|
||||||
|
throttle: 16,
|
||||||
|
onScroll: () => { if (elementRef?.value) throttledSave(elementRef.value.scrollTop) }
|
||||||
|
})
|
||||||
|
watch([keyRef, () => elementRef?.value], ([newKey, newElement]) => {
|
||||||
|
if (newElement && newKey) nextTick(restoreScroll)
|
||||||
|
}, {immediate: true})
|
||||||
|
onActivated(() => nextTick(restoreScroll))
|
||||||
|
}
|
||||||
|
|
||||||
|
return {saveData: saveToStorage, loadData: loadFromStorage}
|
||||||
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<Dashboards
|
||||||
|
v-if="tab === 'overview' && ALLOWED_CREATION_ROUTES.includes(String(route.name))"
|
||||||
|
@dashboard="onSelectDashboard"
|
||||||
|
/>
|
||||||
<Action
|
<Action
|
||||||
v-if="deleted"
|
v-if="deleted"
|
||||||
type="default"
|
type="default"
|
||||||
@@ -34,12 +38,20 @@
|
|||||||
import Action from "../../../components/namespaces/components/buttons/Action.vue";
|
import Action from "../../../components/namespaces/components/buttons/Action.vue";
|
||||||
// @ts-expect-error does not have types
|
// @ts-expect-error does not have types
|
||||||
import TriggerFlow from "../../../components/flows/TriggerFlow.vue";
|
import TriggerFlow from "../../../components/flows/TriggerFlow.vue";
|
||||||
|
import Dashboards from "../../../components/dashboard/components/selector/Selector.vue";
|
||||||
|
import {ALLOWED_CREATION_ROUTES} from "../../../components/dashboard/composables/useDashboards";
|
||||||
import permission from "../../../models/permission";
|
import permission from "../../../models/permission";
|
||||||
import action from "../../../models/action";
|
import action from "../../../models/action";
|
||||||
import {useAuthStore} from "override/stores/auth";
|
import {useAuthStore} from "override/stores/auth";
|
||||||
|
|
||||||
const {t} = useI18n();
|
const {t} = useI18n();
|
||||||
|
|
||||||
|
const onSelectDashboard = (value: any) => {
|
||||||
|
router.replace({
|
||||||
|
params: {...route.params, dashboard: value}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const coreStore = useCoreStore();
|
const coreStore = useCoreStore();
|
||||||
const flowStore = useFlowStore();
|
const flowStore = useFlowStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -107,7 +107,6 @@
|
|||||||
import {useDocStore} from "../../../../stores/doc";
|
import {useDocStore} from "../../../../stores/doc";
|
||||||
import {canCreate} from "override/composables/blueprintsPermissions";
|
import {canCreate} from "override/composables/blueprintsPermissions";
|
||||||
import {useDataTableActions} from "../../../../composables/useDataTableActions";
|
import {useDataTableActions} from "../../../../composables/useDataTableActions";
|
||||||
import useRestoreUrl from "../../../../composables/useRestoreUrl";
|
|
||||||
import {useBlueprintFilter} from "../../../../components/filter/configurations";
|
import {useBlueprintFilter} from "../../../../components/filter/configurations";
|
||||||
|
|
||||||
const blueprintFilter = useBlueprintFilter();
|
const blueprintFilter = useBlueprintFilter();
|
||||||
@@ -128,8 +127,6 @@
|
|||||||
|
|
||||||
const {onPageChanged, onDataLoaded, load, ready, internalPageNumber, internalPageSize} = useDataTableActions({loadData});
|
const {onPageChanged, onDataLoaded, load, ready, internalPageNumber, internalPageSize} = useDataTableActions({loadData});
|
||||||
|
|
||||||
useRestoreUrl();
|
|
||||||
|
|
||||||
const emit = defineEmits(["goToDetail", "loaded"]);
|
const emit = defineEmits(["goToDetail", "loaded"]);
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@@ -273,15 +270,13 @@
|
|||||||
docStore.docId = `blueprints.${props.blueprintType}`;
|
docStore.docId = `blueprints.${props.blueprintType}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(route,
|
watch(route, (newRoute, oldRoute) => {
|
||||||
(newValue, oldValue) => {
|
if (newRoute.name === oldRoute.name) {
|
||||||
if (oldValue.name === newValue.name) {
|
selectedTags.value = initSelectedTags();
|
||||||
selectedTags.value = initSelectedTags();
|
searchText.value = newRoute.query.q || "";
|
||||||
searchText.value = route.query.q || "";
|
load(onDataLoaded);
|
||||||
load(onDataLoaded);
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
watch(searchText, () => {
|
watch(searchText, () => {
|
||||||
load(onDataLoaded);
|
load(onDataLoaded);
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<Dashboards
|
||||||
|
v-if="tab === 'overview' && ALLOWED_CREATION_ROUTES.includes(String(route.name))"
|
||||||
|
@dashboard="onSelectDashboard"
|
||||||
|
/>
|
||||||
|
|
||||||
<Action
|
<Action
|
||||||
v-if="tab === 'flows'"
|
v-if="tab === 'flows'"
|
||||||
:label="t('create_flow')"
|
:label="t('create_flow')"
|
||||||
@@ -21,17 +26,25 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {computed, Ref} from "vue";
|
import {computed, Ref} from "vue";
|
||||||
import {useRoute} from "vue-router";
|
import {useRoute, useRouter} from "vue-router";
|
||||||
import {useI18n} from "vue-i18n";
|
import {useI18n} from "vue-i18n";
|
||||||
import {useNamespacesStore} from "override/stores/namespaces";
|
import {useNamespacesStore} from "override/stores/namespaces";
|
||||||
import Action from "../../../components/namespaces/components/buttons/Action.vue";
|
import Action from "../../../components/namespaces/components/buttons/Action.vue";
|
||||||
|
import Dashboards from "../../../components/dashboard/components/selector/Selector.vue";
|
||||||
|
import {ALLOWED_CREATION_ROUTES} from "../../../components/dashboard/composables/useDashboards";
|
||||||
import FamilyTree from "vue-material-design-icons/FamilyTree.vue";
|
import FamilyTree from "vue-material-design-icons/FamilyTree.vue";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
const {t} = useI18n({useScope: "global"});
|
const {t} = useI18n({useScope: "global"});
|
||||||
const namespacesStore = useNamespacesStore();
|
const namespacesStore = useNamespacesStore();
|
||||||
|
|
||||||
|
const onSelectDashboard = (value: any) => {
|
||||||
|
router.replace({
|
||||||
|
params: {...route.params, dashboard: value}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const tab = computed(() => route.params?.tab);
|
const tab = computed(() => route.params?.tab);
|
||||||
const namespace = computed(() => route.params?.id) as Ref<string>;
|
const namespace = computed(() => route.params?.id) as Ref<string>;
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -89,11 +89,14 @@
|
|||||||
import permission from "../../../models/permission";
|
import permission from "../../../models/permission";
|
||||||
import action from "../../../models/action";
|
import action from "../../../models/action";
|
||||||
|
|
||||||
|
import useRestoreUrl from "../../../composables/useRestoreUrl";
|
||||||
|
|
||||||
import DotsSquare from "vue-material-design-icons/DotsSquare.vue";
|
import DotsSquare from "vue-material-design-icons/DotsSquare.vue";
|
||||||
import TextSearch from "vue-material-design-icons/TextSearch.vue";
|
import TextSearch from "vue-material-design-icons/TextSearch.vue";
|
||||||
import {useAuthStore} from "override/stores/auth";
|
import {useAuthStore} from "override/stores/auth";
|
||||||
|
|
||||||
const namespacesFilter = useNamespacesFilter();
|
const namespacesFilter = useNamespacesFilter();
|
||||||
|
const {saveRestoreUrl} = useRestoreUrl({restoreUrl: true});
|
||||||
|
|
||||||
interface Node {
|
interface Node {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -127,8 +130,12 @@
|
|||||||
|
|
||||||
onMounted(() => loadData());
|
onMounted(() => loadData());
|
||||||
watch(
|
watch(
|
||||||
() => route.query,
|
() => route.query.q,
|
||||||
() => loadData(),
|
() => {
|
||||||
|
loadData();
|
||||||
|
saveRestoreUrl();
|
||||||
|
},
|
||||||
|
{immediate: true}
|
||||||
);
|
);
|
||||||
|
|
||||||
const miscStore = useMiscStore();
|
const miscStore = useMiscStore();
|
||||||
|
|||||||
@@ -7,21 +7,23 @@ import DemoAuditLogs from "../components/demo/AuditLogs.vue"
|
|||||||
import DemoInstance from "../components/demo/Instance.vue"
|
import DemoInstance from "../components/demo/Instance.vue"
|
||||||
import DemoApps from "../components/demo/Apps.vue"
|
import DemoApps from "../components/demo/Apps.vue"
|
||||||
import DemoTests from "../components/demo/Tests.vue"
|
import DemoTests from "../components/demo/Tests.vue"
|
||||||
import {useMiscStore} from "override/stores/misc";
|
import {applyDefaultFilters} from "../components/filter/composables/useDefaultFilter";
|
||||||
|
|
||||||
function maybeAddTimeRangeFilter(to) {
|
export function applyBeforeEnterFilter(options) {
|
||||||
const dateTimeKeys = ["startDate", "endDate", "timeRange"];
|
return (to, _from, next) => {
|
||||||
|
const {query, hasChanges} = applyDefaultFilters(to.query, options);
|
||||||
|
|
||||||
// Default to the configured duration if no time range is set
|
if (hasChanges) {
|
||||||
if (!Object.keys(to.query).some((key) => dateTimeKeys.some((dateTimeKey) => key.includes(dateTimeKey)))) {
|
next({
|
||||||
const miscStore = useMiscStore();
|
name: to.name,
|
||||||
const defaultDuration = miscStore.configs?.chartDefaultDuration || "P30D"; // Fallback to 30 days
|
params: to.params,
|
||||||
to.query["filters[timeRange][EQUALS]"] = defaultDuration;
|
query,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
next();
|
||||||
}
|
};
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
@@ -35,15 +37,6 @@ export default [
|
|||||||
path: "/:tenant?/dashboards/:dashboard?",
|
path: "/:tenant?/dashboards/:dashboard?",
|
||||||
component: () => import("../components/dashboard/Dashboard.vue"),
|
component: () => import("../components/dashboard/Dashboard.vue"),
|
||||||
beforeEnter: (to, from, next) => {
|
beforeEnter: (to, from, next) => {
|
||||||
if (maybeAddTimeRangeFilter(to)) {
|
|
||||||
next({
|
|
||||||
name: to.name,
|
|
||||||
params: to.params,
|
|
||||||
query: to.query,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!to.params.dashboard) {
|
if (!to.params.dashboard) {
|
||||||
next({
|
next({
|
||||||
name: "home",
|
name: "home",
|
||||||
@@ -53,16 +46,21 @@ export default [
|
|||||||
},
|
},
|
||||||
query: to.query,
|
query: to.query,
|
||||||
});
|
});
|
||||||
} else {
|
return;
|
||||||
next();
|
|
||||||
}
|
}
|
||||||
|
applyBeforeEnterFilter({includeTimeRange: true, includeScope: false})(to, from, next);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{name: "dashboards/create", path: "/:tenant?/dashboards/new", component: () => import("../components/dashboard/components/Create.vue")},
|
{name: "dashboards/create", path: "/:tenant?/dashboards/new", component: () => import("../components/dashboard/components/Create.vue")},
|
||||||
{name: "dashboards/update", path: "/:tenant?/dashboards/:dashboard/edit", component: () => import("override/components/dashboard/Edit.vue")},
|
{name: "dashboards/update", path: "/:tenant?/dashboards/:dashboard/edit", component: () => import("override/components/dashboard/Edit.vue")},
|
||||||
|
|
||||||
//Flows
|
//Flows
|
||||||
{name: "flows/list", path: "/:tenant?/flows", component: () => import("../components/flows/Flows.vue")},
|
{
|
||||||
|
name: "flows/list",
|
||||||
|
path: "/:tenant?/flows",
|
||||||
|
component: () => import("../components/flows/Flows.vue"),
|
||||||
|
beforeEnter: applyBeforeEnterFilter({includeTimeRange: false, includeScope: true}),
|
||||||
|
},
|
||||||
{name: "flows/search", path: "/:tenant?/flows/search", component: () => import("../components/flows/FlowsSearch.vue")},
|
{name: "flows/search", path: "/:tenant?/flows/search", component: () => import("../components/flows/FlowsSearch.vue")},
|
||||||
{name: "flows/create", path: "/:tenant?/flows/new", component: () => import("../components/flows/FlowCreate.vue")},
|
{name: "flows/create", path: "/:tenant?/flows/new", component: () => import("../components/flows/FlowCreate.vue")},
|
||||||
{name: "flows/update", path: "/:tenant?/flows/edit/:namespace/:id/:tab?", component: () => import("../components/flows/FlowRoot.vue")},
|
{name: "flows/update", path: "/:tenant?/flows/edit/:namespace/:id/:tab?", component: () => import("../components/flows/FlowRoot.vue")},
|
||||||
@@ -72,18 +70,7 @@ export default [
|
|||||||
name: "executions/list",
|
name: "executions/list",
|
||||||
path: "/:tenant?/executions",
|
path: "/:tenant?/executions",
|
||||||
component: () => import("../components/executions/Executions.vue"),
|
component: () => import("../components/executions/Executions.vue"),
|
||||||
beforeEnter: (to, from, next) => {
|
beforeEnter: applyBeforeEnterFilter({includeTimeRange: true, includeScope: true}),
|
||||||
if (maybeAddTimeRangeFilter(to)) {
|
|
||||||
next({
|
|
||||||
name: to.name,
|
|
||||||
params: to.params,
|
|
||||||
query: to.query,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{name: "executions/update", path: "/:tenant?/executions/:namespace/:flowId/:id/:tab?", component: () => import("../components/executions/ExecutionRoot.vue")},
|
{name: "executions/update", path: "/:tenant?/executions/:namespace/:flowId/:id/:tab?", component: () => import("../components/executions/ExecutionRoot.vue")},
|
||||||
|
|
||||||
@@ -111,18 +98,7 @@ export default [
|
|||||||
name: "logs/list",
|
name: "logs/list",
|
||||||
path: "/:tenant?/logs",
|
path: "/:tenant?/logs",
|
||||||
component: () => import("../components/logs/LogsWrapper.vue"),
|
component: () => import("../components/logs/LogsWrapper.vue"),
|
||||||
beforeEnter: (to, from, next) => {
|
beforeEnter: applyBeforeEnterFilter({includeTimeRange: true, includeScope: false}),
|
||||||
if (maybeAddTimeRangeFilter(to)) {
|
|
||||||
next({
|
|
||||||
name: to.name,
|
|
||||||
params: to.params,
|
|
||||||
query: to.query,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//Namespaces
|
//Namespaces
|
||||||
|
|||||||
@@ -140,6 +140,49 @@ export const useDashboardStore = defineStore("dashboard", () => {
|
|||||||
return rootSchema.value?.properties;
|
return rootSchema.value?.properties;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function loadChart(chart: any) {
|
||||||
|
const yamlChart = YAML_UTILS.stringify(chart);
|
||||||
|
if(selectedChart.value?.content === yamlChart){
|
||||||
|
return {
|
||||||
|
error: chartErrors.value.length > 0 ? chartErrors.value[0] : null,
|
||||||
|
data: selectedChart.value ? {...selectedChart.value, raw: chart} : null,
|
||||||
|
raw: chart
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const result: { error: string | null; data: null | {
|
||||||
|
id?: string;
|
||||||
|
name?: string;
|
||||||
|
type?: string;
|
||||||
|
chartOptions?: Record<string, any>;
|
||||||
|
dataFilters?: any[];
|
||||||
|
charts?: any[];
|
||||||
|
}; raw: any } = {
|
||||||
|
error: null,
|
||||||
|
data: null,
|
||||||
|
raw: {}
|
||||||
|
};
|
||||||
|
const errors = await validateChart(yamlChart);
|
||||||
|
|
||||||
|
if (errors.constraints) {
|
||||||
|
result.error = errors.constraints;
|
||||||
|
} else {
|
||||||
|
result.data = {...chart, content: yamlChart, raw: chart};
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedChart.value = typeof result.data === "object"
|
||||||
|
? {
|
||||||
|
...result.data,
|
||||||
|
chartOptions: {
|
||||||
|
...result.data?.chartOptions,
|
||||||
|
width: 12
|
||||||
|
}
|
||||||
|
} as any
|
||||||
|
: undefined;
|
||||||
|
chartErrors.value = [result.error].filter(e => e !== null);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dashboard,
|
dashboard,
|
||||||
chartErrors,
|
chartErrors,
|
||||||
@@ -155,6 +198,7 @@ export const useDashboardStore = defineStore("dashboard", () => {
|
|||||||
validateChart,
|
validateChart,
|
||||||
chartPreview,
|
chartPreview,
|
||||||
export: exportDashboard,
|
export: exportDashboard,
|
||||||
|
loadChart,
|
||||||
|
|
||||||
schema,
|
schema,
|
||||||
definitions,
|
definitions,
|
||||||
|
|||||||
@@ -107,25 +107,11 @@
|
|||||||
|
|
||||||
:deep(.alert-info) {
|
:deep(.alert-info) {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 12px;
|
padding: .5rem !important;
|
||||||
padding: 16px 16px 0 16px;
|
|
||||||
background-color: var(--ks-background-info);
|
background-color: var(--ks-background-info);
|
||||||
border: 1px solid var(--ks-border-info);
|
border: 1px solid var(--ks-border-info);
|
||||||
border-left-width: 5px;
|
border-left-width: 0.25rem;
|
||||||
border-radius: 8px;
|
border-radius: 0.5rem;
|
||||||
|
|
||||||
&::before {
|
|
||||||
content: '!';
|
|
||||||
min-width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
margin-top: 4px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: var(--ks-content-info);
|
|
||||||
border: 1px solid var(--ks-border-info);
|
|
||||||
color: var(--ks-content-inverse);
|
|
||||||
font: 600 13px/20px sans-serif;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
p { color: var(--ks-content-info); }
|
p { color: var(--ks-content-info); }
|
||||||
}
|
}
|
||||||
@@ -135,7 +121,7 @@
|
|||||||
color: var(--ks-content-info);
|
color: var(--ks-content-info);
|
||||||
border: 1px solid var(--ks-border-info);
|
border: 1px solid var(--ks-border-info);
|
||||||
font-family: 'Courier New', Courier, monospace;
|
font-family: 'Courier New', Courier, monospace;
|
||||||
white-space: nowrap; // Prevent button text from wrapping
|
white-space: nowrap;
|
||||||
|
|
||||||
.material-design-icon {
|
.material-design-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ export const storageKeys = {
|
|||||||
TIMEZONE_STORAGE_KEY: "timezone",
|
TIMEZONE_STORAGE_KEY: "timezone",
|
||||||
SAVED_FILTERS_PREFIX: "saved_filters",
|
SAVED_FILTERS_PREFIX: "saved_filters",
|
||||||
FILTER_ORDER_PREFIX: "filter-order",
|
FILTER_ORDER_PREFIX: "filter-order",
|
||||||
|
SCROLL_MEMORY_PREFIX: "scroll",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const executeFlowBehaviours = {
|
export const executeFlowBehaviours = {
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ class FlowControllerTest {
|
|||||||
List<String> namespaces = client.toBlocking().retrieve(
|
List<String> namespaces = client.toBlocking().retrieve(
|
||||||
HttpRequest.GET("/api/v1/main/flows/distinct-namespaces"), Argument.listOf(String.class));
|
HttpRequest.GET("/api/v1/main/flows/distinct-namespaces"), Argument.listOf(String.class));
|
||||||
|
|
||||||
assertThat(namespaces.size()).isEqualTo(11);
|
assertThat(namespaces.size()).isEqualTo(12);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -202,24 +202,24 @@ class KVControllerTest {
|
|||||||
|
|
||||||
static Stream<Arguments> kvSetKeyValueArgs() {
|
static Stream<Arguments> kvSetKeyValueArgs() {
|
||||||
return Stream.of(
|
return Stream.of(
|
||||||
Arguments.of("{\"hello\":\"world\"}", Map.class),
|
Arguments.of(MediaType.TEXT_PLAIN, "{\"hello\":\"world\"}", Map.class),
|
||||||
Arguments.of("[\"hello\",\"world\"]", List.class),
|
Arguments.of(MediaType.TEXT_PLAIN, "[\"hello\",\"world\"]", List.class),
|
||||||
Arguments.of("\"hello\"", String.class),
|
Arguments.of(MediaType.TEXT_PLAIN, "\"hello\"", String.class),
|
||||||
Arguments.of("1", Integer.class),
|
Arguments.of(MediaType.TEXT_PLAIN, "1", Integer.class),
|
||||||
Arguments.of("1.0", BigDecimal.class),
|
Arguments.of(MediaType.TEXT_PLAIN, "1.0", BigDecimal.class),
|
||||||
Arguments.of("true", Boolean.class),
|
Arguments.of(MediaType.TEXT_PLAIN, "true", Boolean.class),
|
||||||
Arguments.of("false", Boolean.class),
|
Arguments.of(MediaType.TEXT_PLAIN, "false", Boolean.class),
|
||||||
Arguments.of("2021-09-01", LocalDate.class),
|
Arguments.of(MediaType.TEXT_PLAIN, "2021-09-01", LocalDate.class),
|
||||||
Arguments.of("2021-09-01T01:02:03Z", Instant.class),
|
Arguments.of(MediaType.TEXT_PLAIN, "2021-09-01T01:02:03Z", Instant.class),
|
||||||
Arguments.of("\"PT5S\"", Duration.class)
|
Arguments.of(MediaType.TEXT_PLAIN, "\"PT5S\"", Duration.class)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("kvSetKeyValueArgs")
|
@MethodSource("kvSetKeyValueArgs")
|
||||||
void setKeyValue(String value, Class<?> expectedClass) throws IOException, ResourceExpiredException {
|
void setKeyValue(MediaType mediaType, String value, Class<?> expectedClass) throws IOException, ResourceExpiredException {
|
||||||
String myDescription = "myDescription";
|
String myDescription = "myDescription";
|
||||||
client.toBlocking().exchange(HttpRequest.PUT("/api/v1/main/namespaces/" + NAMESPACE + "/kv/my-key", value).header("ttl", "PT5M").header("description", myDescription));
|
client.toBlocking().exchange(HttpRequest.PUT("/api/v1/main/namespaces/" + NAMESPACE + "/kv/my-key", value).contentType(mediaType).header("ttl", "PT5M").header("description", myDescription));
|
||||||
|
|
||||||
KVStore kvStore = kvStore();
|
KVStore kvStore = kvStore();
|
||||||
Class<?> valueClazz = kvStore.getValue("my-key").get().value().getClass();
|
Class<?> valueClazz = kvStore.getValue("my-key").get().value().getClass();
|
||||||
@@ -294,7 +294,7 @@ class KVControllerTest {
|
|||||||
assertThat(httpClientResponseException.getStatus().getCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY.getCode());
|
assertThat(httpClientResponseException.getStatus().getCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY.getCode());
|
||||||
assertThat(httpClientResponseException.getMessage()).isEqualTo(expectedErrorMessage);
|
assertThat(httpClientResponseException.getMessage()).isEqualTo(expectedErrorMessage);
|
||||||
|
|
||||||
httpClientResponseException = Assertions.assertThrows(HttpClientResponseException.class, () -> client.toBlocking().exchange(HttpRequest.PUT("/api/v1/main/namespaces/" + NAMESPACE + "/kv/bad$key", "\"content\"")));
|
httpClientResponseException = Assertions.assertThrows(HttpClientResponseException.class, () -> client.toBlocking().exchange(HttpRequest.PUT("/api/v1/main/namespaces/" + NAMESPACE + "/kv/bad$key", "\"content\"").contentType(MediaType.TEXT_PLAIN)));
|
||||||
assertThat(httpClientResponseException.getStatus().getCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY.getCode());
|
assertThat(httpClientResponseException.getStatus().getCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY.getCode());
|
||||||
assertThat(httpClientResponseException.getMessage()).isEqualTo(expectedErrorMessage);
|
assertThat(httpClientResponseException.getMessage()).isEqualTo(expectedErrorMessage);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user