From a81fdbdde9e6a3cb87af0b8a8199541455a198f0 Mon Sep 17 00:00:00 2001 From: Brandon Tietse Date: Tue, 31 Aug 2021 18:20:55 +0200 Subject: [PATCH 01/14] Admin UI for live view of queries --- .../conquery/apiv1/ExecutionStatus.java | 5 + .../conquery/apiv1/QueryProcessor.java | 5 +- .../models/execution/ManagedExecution.java | 22 +- .../models/forms/managed/ManagedForm.java | 6 +- .../conquery/models/query/ManagedQuery.java | 12 +- .../conquery/resources/ResourceConstants.java | 1 + .../resources/admin/rest/AdminResource.java | 325 +++++++++++++++++- .../resources/admin/rest/UIProcessor.java | 4 + .../resources/admin/ui/AdminUIResource.java | 6 + .../resources/admin/ui/queries.html.ftl | 322 +++++++++++++++++ .../admin/ui/templates/template.html.ftl | 3 + 11 files changed, 674 insertions(+), 37 deletions(-) create mode 100644 backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/queries.html.ftl diff --git a/backend/src/main/java/com/bakdata/conquery/apiv1/ExecutionStatus.java b/backend/src/main/java/com/bakdata/conquery/apiv1/ExecutionStatus.java index eba51f2d30..ef08d4e746 100644 --- a/backend/src/main/java/com/bakdata/conquery/apiv1/ExecutionStatus.java +++ b/backend/src/main/java/com/bakdata/conquery/apiv1/ExecutionStatus.java @@ -1,11 +1,13 @@ package com.bakdata.conquery.apiv1; import java.net.URL; +import java.time.LocalDateTime; import java.time.ZonedDateTime; import java.util.Collections; import java.util.List; import com.bakdata.conquery.models.execution.ExecutionState; +import com.bakdata.conquery.models.identifiable.ids.specific.DatasetId; import com.bakdata.conquery.models.identifiable.ids.specific.ManagedExecutionId; import com.bakdata.conquery.models.identifiable.ids.specific.SecondaryIdDescriptionId; import com.bakdata.conquery.models.identifiable.ids.specific.UserId; @@ -38,6 +40,9 @@ public abstract class ExecutionStatus { private Long numberOfResults; private Long requiredTime; + private LocalDateTime startTime; + private LocalDateTime finishTime; + private String queryType; private SecondaryIdDescriptionId secondaryId; diff --git a/backend/src/main/java/com/bakdata/conquery/apiv1/QueryProcessor.java b/backend/src/main/java/com/bakdata/conquery/apiv1/QueryProcessor.java index 6af2e4f26c..e89c481af6 100644 --- a/backend/src/main/java/com/bakdata/conquery/apiv1/QueryProcessor.java +++ b/backend/src/main/java/com/bakdata/conquery/apiv1/QueryProcessor.java @@ -192,8 +192,7 @@ public Stream getQueriesFiltered(Dataset datasetId, UriBuilder .map(mq -> { OverviewExecutionStatus status = mq.buildStatusOverview( uriBuilder.clone(), - user, - datasetAbilities + user ); if (mq.isReadyToDownload(datasetAbilities)) { setDownloadUrls(status, config.getResultProviders(), mq, uriBuilder, allProviders); @@ -351,7 +350,7 @@ public FullExecutionStatus getQueryFullStatus(ManagedExecution query, User us query.initExecutable(datasetRegistry, config); Map> datasetAbilities = buildDatasetAbilityMap(user, datasetRegistry); - final FullExecutionStatus status = query.buildStatusFull(storage, url, user, datasetRegistry, datasetAbilities); + final FullExecutionStatus status = query.buildStatusFull(storage, user, datasetRegistry); if (query.isReadyToDownload(datasetAbilities)) { setDownloadUrls(status, config.getResultProviders(), query, url, allProviders); diff --git a/backend/src/main/java/com/bakdata/conquery/models/execution/ManagedExecution.java b/backend/src/main/java/com/bakdata/conquery/models/execution/ManagedExecution.java index 5780e68751..33702ce615 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/execution/ManagedExecution.java +++ b/backend/src/main/java/com/bakdata/conquery/models/execution/ManagedExecution.java @@ -55,11 +55,7 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.google.common.base.Preconditions; import com.google.common.util.concurrent.Uninterruptibles; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.NonNull; -import lombok.Setter; -import lombok.ToString; +import lombok.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ArrayUtils; import org.apache.shiro.authz.Permission; @@ -238,7 +234,7 @@ public void awaitDone(int time, TimeUnit unit) { Uninterruptibles.awaitUninterruptibly(execution, time, unit); } - protected void setStatusBase(@NonNull User user, @NonNull ExecutionStatus status, UriBuilder url, Map> datasetAbilities) { + protected void setStatusBase(@NonNull User user, @NonNull ExecutionStatus status) { status.setLabel(label == null ? queryId.toString() : getLabelWithoutAutoLabelSuffix()); status.setPristineLabel(label == null || queryId.toString().equals(label) || isAutoLabeled()); status.setId(getId()); @@ -247,6 +243,8 @@ protected void setStatusBase(@NonNull User user, @NonNull ExecutionStatus status status.setOwn(user.isOwner(this)); status.setCreatedAt(getCreationTime().atZone(ZoneId.systemDefault())); status.setRequiredTime((startTime != null && finishTime != null) ? ChronoUnit.MILLIS.between(startTime, finishTime) : null); + status.setStartTime(startTime); + status.setFinishTime(finishTime); status.setStatus(getState()); if (owner != null) { status.setOwner(owner.getId()); @@ -257,9 +255,9 @@ protected void setStatusBase(@NonNull User user, @NonNull ExecutionStatus status /** * Renders a lightweight status with meta information about this query. Computation an size should be small for this. */ - public OverviewExecutionStatus buildStatusOverview(UriBuilder url, User user, Map> datasetAbilities) { + public OverviewExecutionStatus buildStatusOverview(UriBuilder url, User user) { OverviewExecutionStatus status = new OverviewExecutionStatus(); - setStatusBase(user, status, url, datasetAbilities); + setStatusBase(user, status); return status; } @@ -268,12 +266,12 @@ public OverviewExecutionStatus buildStatusOverview(UriBuilder url, User user, Ma * Renders an extensive status of this query (see {@link FullExecutionStatus}. The rendering can be computation intensive and can produce a large * object. The use of the full status is only intended if a client requested specific information about this execution. */ - public FullExecutionStatus buildStatusFull(@NonNull MetaStorage storage, UriBuilder url, User user, DatasetRegistry datasetRegistry, Map> datasetAbilities) { + public FullExecutionStatus buildStatusFull(@NonNull MetaStorage storage, User user, DatasetRegistry datasetRegistry) { Preconditions.checkArgument(isInitialized(), "The execution must have been initialized first"); FullExecutionStatus status = new FullExecutionStatus(); - setStatusBase(user, status, url, datasetAbilities); + setStatusBase(user, status); - setAdditionalFieldsForStatusWithColumnDescription(storage, url, user, status, datasetRegistry); + setAdditionalFieldsForStatusWithColumnDescription(storage, user, status, datasetRegistry); setAdditionalFieldsForStatusWithSource(user, status); setAdditionalFieldsForStatusWithGroups(storage, status); setAvailableSecondaryIds(status); @@ -313,7 +311,7 @@ private void setAdditionalFieldsForStatusWithGroups(@NonNull MetaStorage storage status.setGroups(permittedGroups); } - protected void setAdditionalFieldsForStatusWithColumnDescription(@NonNull MetaStorage storage, UriBuilder url, User user, FullExecutionStatus status, DatasetRegistry datasetRegistry) { + protected void setAdditionalFieldsForStatusWithColumnDescription(@NonNull MetaStorage storage, User user, FullExecutionStatus status, DatasetRegistry datasetRegistry) { // Implementation specific } diff --git a/backend/src/main/java/com/bakdata/conquery/models/forms/managed/ManagedForm.java b/backend/src/main/java/com/bakdata/conquery/models/forms/managed/ManagedForm.java index fc9ba0e605..006065edfd 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/forms/managed/ManagedForm.java +++ b/backend/src/main/java/com/bakdata/conquery/models/forms/managed/ManagedForm.java @@ -8,8 +8,6 @@ import java.util.function.Consumer; import java.util.stream.Collectors; -import javax.ws.rs.core.UriBuilder; - import com.bakdata.conquery.apiv1.FullExecutionStatus; import com.bakdata.conquery.apiv1.forms.Form; import com.bakdata.conquery.apiv1.query.QueryDescription; @@ -179,8 +177,8 @@ public QueryDescription getSubmitted() { @Override - protected void setAdditionalFieldsForStatusWithColumnDescription(@NonNull MetaStorage storage, UriBuilder url, User user, FullExecutionStatus status, DatasetRegistry datasetRegistry) { - super.setAdditionalFieldsForStatusWithColumnDescription(storage, url, user, status, datasetRegistry); + protected void setAdditionalFieldsForStatusWithColumnDescription(@NonNull MetaStorage storage, User user, FullExecutionStatus status, DatasetRegistry datasetRegistry) { + super.setAdditionalFieldsForStatusWithColumnDescription(storage, user, status, datasetRegistry); // Set the ColumnDescription if the Form only consits of a single subquery if (subQueries == null) { // If subqueries was not set the Execution was not initialized, do it manually diff --git a/backend/src/main/java/com/bakdata/conquery/models/query/ManagedQuery.java b/backend/src/main/java/com/bakdata/conquery/models/query/ManagedQuery.java index fe5d8b21ae..7c0d6b87c0 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/query/ManagedQuery.java +++ b/backend/src/main/java/com/bakdata/conquery/models/query/ManagedQuery.java @@ -11,8 +11,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.ws.rs.core.UriBuilder; - import c10n.C10N; import com.bakdata.conquery.apiv1.ExecutionStatus; import com.bakdata.conquery.apiv1.FullExecutionStatus; @@ -26,7 +24,6 @@ import com.bakdata.conquery.io.cps.CPSType; import com.bakdata.conquery.io.storage.MetaStorage; import com.bakdata.conquery.models.auth.entities.User; -import com.bakdata.conquery.models.auth.permissions.Ability; import com.bakdata.conquery.models.config.ConqueryConfig; import com.bakdata.conquery.models.datasets.Dataset; import com.bakdata.conquery.models.execution.ExecutionState; @@ -34,7 +31,6 @@ import com.bakdata.conquery.models.externalservice.ResultType; import com.bakdata.conquery.models.i18n.I18n; import com.bakdata.conquery.models.identifiable.ids.NamespacedIdentifiable; -import com.bakdata.conquery.models.identifiable.ids.specific.DatasetId; import com.bakdata.conquery.models.messages.namespaces.WorkerMessage; import com.bakdata.conquery.models.messages.namespaces.specific.ExecuteQuery; import com.bakdata.conquery.models.query.resultinfo.ResultInfo; @@ -135,8 +131,8 @@ public void start() { } @Override - protected void setStatusBase(@NonNull User user, @NonNull ExecutionStatus status, UriBuilder url, Map> datasetAbilities) { - super.setStatusBase(user, status, url, datasetAbilities); + protected void setStatusBase(@NonNull User user, @NonNull ExecutionStatus status) { + super.setStatusBase(user, status); status.setNumberOfResults(lastResultCount); status.setQueryType(query.getClass().getAnnotation(CPSType.class).id()); @@ -147,8 +143,8 @@ protected void setStatusBase(@NonNull User user, @NonNull ExecutionStatus status } @Override - protected void setAdditionalFieldsForStatusWithColumnDescription(@NonNull MetaStorage storage, UriBuilder url, User user, FullExecutionStatus status, DatasetRegistry datasetRegistry) { - super.setAdditionalFieldsForStatusWithColumnDescription(storage, url, user, status, datasetRegistry); + protected void setAdditionalFieldsForStatusWithColumnDescription(@NonNull MetaStorage storage, User user, FullExecutionStatus status, DatasetRegistry datasetRegistry) { + super.setAdditionalFieldsForStatusWithColumnDescription(storage, user, status, datasetRegistry); if (columnDescriptions == null) { columnDescriptions = generateColumnDescriptions(datasetRegistry); } diff --git a/backend/src/main/java/com/bakdata/conquery/resources/ResourceConstants.java b/backend/src/main/java/com/bakdata/conquery/resources/ResourceConstants.java index 78733db5fa..a59c5f12a7 100644 --- a/backend/src/main/java/com/bakdata/conquery/resources/ResourceConstants.java +++ b/backend/src/main/java/com/bakdata/conquery/resources/ResourceConstants.java @@ -12,6 +12,7 @@ public class ResourceConstants { public static final String TABLE = "table"; public static final String FILTER = "filter"; public static final String QUERY = "query"; + public static final String QUERIES_MONITOR_PATH_ELEMENT = "queries"; public static final String FORM_CONFIG = "form-config"; public static final String FILENAME = "filename"; public static final String API = "api"; diff --git a/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/AdminResource.java b/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/AdminResource.java index ce273bdb61..9d5aa35cc2 100644 --- a/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/AdminResource.java +++ b/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/AdminResource.java @@ -1,18 +1,24 @@ package com.bakdata.conquery.resources.admin.rest; -import com.bakdata.conquery.io.jackson.Jackson; +import com.bakdata.conquery.apiv1.FullExecutionStatus; +import com.bakdata.conquery.apiv1.query.ConceptQuery; +import com.bakdata.conquery.apiv1.query.Query; +import com.bakdata.conquery.apiv1.query.concept.specific.CQAnd; +import com.bakdata.conquery.apiv1.query.concept.specific.CQConcept; import com.bakdata.conquery.io.jersey.ExtraMimeTypes; +import com.bakdata.conquery.io.storage.MetaStorage; import com.bakdata.conquery.models.auth.entities.User; -import com.bakdata.conquery.models.common.Range; +import com.bakdata.conquery.models.error.ConqueryError; +import com.bakdata.conquery.models.execution.ExecutionState; +import com.bakdata.conquery.models.execution.ManagedExecution; import com.bakdata.conquery.models.identifiable.ids.specific.DatasetId; -import com.bakdata.conquery.models.jobs.Job; +import com.bakdata.conquery.models.identifiable.ids.specific.ManagedExecutionId; import com.bakdata.conquery.models.jobs.JobManagerStatus; import com.bakdata.conquery.models.messages.network.specific.CancelJobMessage; +import com.bakdata.conquery.models.worker.DatasetRegistry; import com.bakdata.conquery.models.worker.ShardNodeInformation; import com.bakdata.conquery.resources.admin.ui.AdminUIResource; -import com.fasterxml.jackson.core.JsonProcessingException; import com.google.common.collect.ImmutableMap; -import com.google.common.util.concurrent.Uninterruptibles; import io.dropwizard.auth.Auth; import javax.inject.Inject; @@ -20,11 +26,11 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; -import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZonedDateTime; +import java.util.List; import java.util.Objects; import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.stream.Stream; import static com.bakdata.conquery.resources.ResourceConstants.JOB_ID; @@ -52,7 +58,6 @@ public String executeScript(@Auth User user, String script) { * Execute script and serialize return value as Json. * Useful for configuration and verification scripts. */ - @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.TEXT_PLAIN) @POST @Path("/script") @@ -79,6 +84,306 @@ public Response cancelJob(@PathParam(JOB_ID) UUID jobId) { @GET @Path("/jobs/") public ImmutableMap getJobs() { - return processor.getJobs(); + return processor.getJobs(); } + + + + + @GET + @Path("/queries") + public FullExecutionStatus[] getQueries(@Auth User currentUser) { + final MetaStorage storage = processor.getStorage(); + final DatasetRegistry datasetRegistry = processor.getDatasetRegistry(); + return processor.getStorage().getAllExecutions().stream().map(t->t.buildStatusFull(storage, currentUser, datasetRegistry)).toArray(FullExecutionStatus[]::new); + } + + + + // For test purposes +/* + @GET + @Path("/queries") + public FullExecutionStatus[] getQueries() { + CQAnd root = new CQAnd(); + CQConcept e1 = new CQConcept(); + e1.setLabel("Concept Label"); + root.setChildren(List.of(e1)); + Query testQuery = new ConceptQuery(root); + + FullExecutionStatus[] result = new FullExecutionStatus[]{ + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset2"),UUID.randomUUID())); + setOwnerName("Doriane"); + setQueryType("QueryType1"); + setStatus(ExecutionState.NEW); + setLabel("dataset2Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(3)); + setFinishTime(LocalDateTime.now().plusMinutes(5)); + setRequiredTime(3400L); + setProgress(0F); + setError(null); + setQuery(testQuery); + } + }, + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset2"),UUID.randomUUID())); + setOwnerName("Doriane"); + setQueryType("QueryType2"); + setStatus(ExecutionState.RUNNING); + setLabel("dataset2Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(12)); + setFinishTime(LocalDateTime.now().plusMinutes(33)); + setRequiredTime(300L); + setProgress(78.9F); + setError(null); + setQuery(testQuery); + } + }, + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset2"),UUID.randomUUID())); + setOwnerName("Doriane"); + setQueryType("QueryType3"); + setStatus(ExecutionState.FAILED); + setLabel("dataset2Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(1)); + setFinishTime(null); + setRequiredTime(120L); + setProgress(12.6F); + setError(ConqueryError.asConqueryError(new IllegalStateException())); + setQuery(testQuery); + } + }, + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset2"),UUID.randomUUID())); + setOwnerName("Doriane"); + setQueryType("QueryType4"); + setStatus(ExecutionState.DONE); + setLabel("dataset2Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(2)); + setFinishTime(LocalDateTime.now().plusMinutes(3)); + setRequiredTime(200L); + setProgress(99F); + setError(null); + setQuery(testQuery); + } + }, + + + + + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset3"),UUID.randomUUID())); + setOwnerName("David"); + setQueryType("QueryType1"); + setStatus(ExecutionState.NEW); + setLabel("dataset3Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(2)); + setFinishTime(LocalDateTime.now().plusMinutes(3)); + setRequiredTime(200L); + setProgress(0F); + setError(null); + setQuery(testQuery); + } + }, + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset3"),UUID.randomUUID())); + setOwnerName("David"); + setQueryType("QueryType2"); + setStatus(ExecutionState.RUNNING); + setLabel("dataset3Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(21)); + setFinishTime(LocalDateTime.now().plusMinutes(32)); + setRequiredTime(300L); + setProgress(43.1F); + setError(null); + setQuery(testQuery); + } + }, + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset3"),UUID.randomUUID())); + setOwnerName("David"); + setQueryType("QueryType3"); + setStatus(ExecutionState.FAILED); + setLabel("dataset3Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(2)); + setFinishTime(null); + setRequiredTime(120L); + setProgress(78.3F); + setError(ConqueryError.asConqueryError(new IllegalStateException())); + setQuery(testQuery); + } + }, + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset3"),UUID.randomUUID())); + setOwnerName("David"); + setQueryType("QueryType4"); + setStatus(ExecutionState.DONE); + setLabel("dataset3Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(3)); + setFinishTime(LocalDateTime.now().plusMinutes(9)); + setRequiredTime(200L); + setProgress(99.9F); + setError(null); + setQuery(testQuery); + } + }, + + + + + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset4"),UUID.randomUUID())); + setOwnerName("Meza"); + setQueryType("QueryType1"); + setStatus(ExecutionState.NEW); + setLabel("dataset4Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(9)); + setFinishTime(LocalDateTime.now().plusMinutes(13)); + setRequiredTime(2220L); + setProgress(0F); + setError(null); + setQuery(testQuery); + } + }, + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset4"),UUID.randomUUID())); + setOwnerName("Meza"); + setQueryType("QueryType2"); + setStatus(ExecutionState.RUNNING); + setLabel("dataset4Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(9)); + setFinishTime(LocalDateTime.now().plusMinutes(11)); + setRequiredTime(330L); + setProgress(24.9F); + setError(null); + setQuery(testQuery); + } + }, + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset4"),UUID.randomUUID())); + setOwnerName("Meza"); + setQueryType("QueryType3"); + setStatus(ExecutionState.FAILED); + setLabel("dataset4Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(23)); + setFinishTime(null); + setRequiredTime(120L); + setProgress(55F); + setError(ConqueryError.asConqueryError(new IllegalStateException())); + setQuery(testQuery); + } + }, + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset4"),UUID.randomUUID())); + setOwnerName("Meza"); + setQueryType("QueryType4"); + setStatus(ExecutionState.DONE); + setLabel("dataset4Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(17)); + setFinishTime(LocalDateTime.now().plusMinutes(19)); + setRequiredTime(200L); + setProgress(99F); + setError(null); + setQuery(testQuery); + } + }, + + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset1"),UUID.randomUUID())); + setOwnerName("Peter"); + setQueryType("QueryType1"); + setStatus(ExecutionState.NEW); + setLabel("dataset1Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(2)); + setFinishTime(LocalDateTime.now().plusMinutes(3)); + setRequiredTime(200L); + setProgress(0F); + setError(null); + setQuery(testQuery); + } + }, + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset1"),UUID.randomUUID())); + setOwnerName("Audrane"); + setQueryType("QueryType2"); + setStatus(ExecutionState.RUNNING); + setLabel("dataset1Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(2)); + setFinishTime(LocalDateTime.now().plusMinutes(3)); + setRequiredTime(300L); + setProgress(35.45F); + setError(null); + setQuery(testQuery); + } + }, + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset1"),UUID.randomUUID())); + setOwnerName("Audrane"); + setQueryType("QueryType3"); + setStatus(ExecutionState.FAILED); + setLabel("dataset1Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(2)); + setFinishTime(null); + setRequiredTime(120L); + setProgress(35.45F); + setError(ConqueryError.asConqueryError(new IllegalStateException())); + setQuery(testQuery); + } + }, + new FullExecutionStatus(){ + { + setId(new ManagedExecutionId(new DatasetId("Dataset1"),UUID.randomUUID())); + setOwnerName("Audrane"); + setQueryType("QueryType4"); + setStatus(ExecutionState.DONE); + setLabel("dataset1Label"); + setCreatedAt(ZonedDateTime.now()); + setStartTime(LocalDateTime.now().plusMinutes(2)); + setFinishTime(LocalDateTime.now().plusMinutes(3)); + setRequiredTime(200L); + setProgress(99F); + setError(null); + setQuery(testQuery); + } + }, + + }; + + return result; + } +*/ + + + } diff --git a/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/UIProcessor.java b/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/UIProcessor.java index 549bc7c9c3..586dbd9ac6 100644 --- a/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/UIProcessor.java +++ b/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/UIProcessor.java @@ -179,6 +179,10 @@ public ImportStatistics getImportStatistics(Import imp) { return new ImportStatistics(imp, cBlockSize); } + public void getAllQueries() + { + getStorage().getAllExecutions(); + } public static long calculateCBlocksSizeBytes(Import imp, Collection> concepts) { diff --git a/backend/src/main/java/com/bakdata/conquery/resources/admin/ui/AdminUIResource.java b/backend/src/main/java/com/bakdata/conquery/resources/admin/ui/AdminUIResource.java index 20f457f6e2..061e288bb2 100644 --- a/backend/src/main/java/com/bakdata/conquery/resources/admin/ui/AdminUIResource.java +++ b/backend/src/main/java/com/bakdata/conquery/resources/admin/ui/AdminUIResource.java @@ -73,4 +73,10 @@ public View getJobs() { return new UIView<>("jobs.html.ftl", uiProcessor.getUIContext(), uiProcessor.getAdminProcessor().getJobs()); } + @GET + @Path("queries") + public View getQueries() { + return new UIView<>("queries.html.ftl", uiProcessor.getUIContext()); + } + } diff --git a/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/queries.html.ftl b/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/queries.html.ftl new file mode 100644 index 0000000000..73290e1e51 --- /dev/null +++ b/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/queries.html.ftl @@ -0,0 +1,322 @@ +<#import "templates/template.html.ftl" as layout> +<@layout.layout> + + +

Queries

+ + + +
+
+
+
+ +
+
+ +
+ + +
+ + + + + +
#
+
+
+
+
+
+
+ +
+
+
+
+ + + + + +
#
+ +
+
+
+
+
+
+ +
+
+
+
+ + + + +
#
+
+
+
+
+
+
+ +
+
+
+
+ + + + +
#
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/templates/template.html.ftl b/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/templates/template.html.ftl index 0bc4c3773c..24d87e961b 100644 --- a/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/templates/template.html.ftl +++ b/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/templates/template.html.ftl @@ -49,6 +49,9 @@ +