Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let text searches access the vidarr id #1305

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changes/fix_vidarr-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Text search includes vidarr id

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.regex.Pattern;
import java.util.stream.Stream;

/**
Expand All @@ -20,6 +21,8 @@
*/
abstract class RunState {

public abstract boolean search(Pattern query);

public static final class PerformResult {
private final ActionState actionState;
private final List<String> errors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.regex.Pattern;
import java.util.stream.Stream;

/** State when we have no knowledge of what's going on in Vidarr */
Expand All @@ -36,6 +37,11 @@ public RunStateAttemptSubmit(int attempt) {
this.attempt = attempt;
}

@Override
public boolean search(Pattern query) {
return false;
}

@Override
public AvailableCommands commands() {
return AvailableCommands.RESET_ONLY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.regex.Pattern;
import java.util.stream.Stream;

final class RunStateConflicted extends RunState {
Expand All @@ -26,6 +27,11 @@ public RunStateConflicted(List<String> ids) {
+ String.join(", ", ids));
}

@Override
public boolean search(Pattern query) {
return ids.stream().anyMatch(id -> query.matcher(id).matches());
}

@Override
public AvailableCommands commands() {
return AvailableCommands.RESET_ONLY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.regex.Pattern;
import java.util.stream.Stream;

final class RunStateDead extends RunState {

@Override
public boolean search(Pattern query) {
return false;
}

@Override
public AvailableCommands commands() {
return AvailableCommands.RESET_ONLY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand All @@ -34,6 +35,11 @@ public RunStateMissing(String id, List<ExternalKey> keys) {
.collect(Collectors.toList());
}

@Override
public boolean search(Pattern query) {
return query.matcher(id).matches();
}

@Override
public AvailableCommands commands() {
return AvailableCommands.RESET_ONLY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.regex.Pattern;
import java.util.stream.Stream;

final class RunStateMonitor extends RunState {
Expand Down Expand Up @@ -93,6 +94,11 @@ public RunStateMonitor(String workflowRunUrl, WorkflowRunStatusResponse status)
this.status = status;
}

@Override
public boolean search(Pattern query) {
return query.matcher(status.getId()).matches();
}

@Override
public AvailableCommands commands() {
// Failed during provision out may be retried
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ public boolean search(Pattern query) {
|| query.matcher(v.getValue()).matches()))
|| checkJson(request.getArguments(), query)
|| checkJson(request.getMetadata(), query)
|| checkJson(request.getEngineParameters(), query);
|| checkJson(request.getEngineParameters(), query)
|| state.search(query);
}

@ActionParameter(required = false)
Expand Down