Skip to content

Commit

Permalink
Fixes empty runs page bug
Browse files Browse the repository at this point in the history
Previously we got a null-pointer type exception. This fixes it by
double-checking whether we have no runs.
  • Loading branch information
elijahbenizzy committed Jun 15, 2024
1 parent 9b3041e commit 11eaea5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 0 additions & 2 deletions ui/backend/server/trackingserver_template/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@ async def get_dag_template_catalog(
]
for i, node_template in enumerate(node_templates):
node_template.dag_template = all_node_templates[i].dag_template_id
# node_templates = []
# dag_template = node_template.dag_template_id
code_artifacts = list(
{
code_artifact
Expand Down
6 changes: 0 additions & 6 deletions ui/backend/server/trackingserver_template/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ class Meta:

primary_code_artifact: Optional[str] = None

# @classmethod
# def from_orm(cls, obj: Any, **kw: Any) -> "NodeTemplateOut":
# out = super().from_orm(obj, **kw)
# out.dag_template_id = obj.dag_template_id
# return out


class File(Schema):
path: str
Expand Down
26 changes: 18 additions & 8 deletions ui/frontend/src/components/dashboard/Runs/RunSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ function serialize(query: Query): URLSearchParams {

function deserialize(
searchParams: URLSearchParams,
minDate: Date,
maxDate: Date
minDate: Date | null,
maxDate: Date | null
): Query {
const selectedTags = searchParams.get("selectedTags");
const startDate = searchParams.get("startDate");
Expand Down Expand Up @@ -652,14 +652,24 @@ export const RunSummary = (props: {
run.run_start_time ? new Date(run.run_start_time) : new Date(Date.now())
)
.sort((a, b) => a.getTime() - b.getTime());
const minDate = new Date(runsSortedByStartDate[0]);
const maxDate = new Date(
runsSortedByStartDate[runsSortedByStartDate.length - 1]
);
const minDate =
runsSortedByStartDate.length > 0
? new Date(runsSortedByStartDate[0])
: null;
const maxDate =
runsSortedByStartDate.length > 0
? new Date(runsSortedByStartDate[runsSortedByStartDate.length - 1])
: null;

// Quick buffer to ensure no runs are missed
minDate.setDate(minDate.getDate() - 1);
maxDate.setDate(maxDate.getDate() + 1);
console.log("minDate", minDate);
console.log("maxDate", maxDate);
if (minDate !== null) {
minDate.setDate(minDate.getDate() - 1);
}
if (maxDate !== null) {
maxDate.setDate(maxDate.getDate() + 1);
}

const [searchParams, setSearchParams] = useSearchParams();
const [query, setQuery] = useState(() =>
Expand Down

0 comments on commit 11eaea5

Please sign in to comment.