Skip to content

Commit

Permalink
Remove custom status for untriggered/pristine jobs && Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Sousa authored and Miguel Sousa committed Mar 15, 2021
1 parent 8c9440b commit ffaf975
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 184 deletions.
208 changes: 36 additions & 172 deletions dkron/assets_ui/assets_vfsdata.go

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions dkron/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ func (s *Store) SetJob(job *Job, copyDependentJobs bool) error {
}

err := s.db.Update(func(tx *buntdb.Tx) error {
// set pristine as default for newly created jobs
job.Status = "pristine"

// Get if the requested job already exist
err := s.getJobTxFunc(job.Name, &pbej)(tx)
if err != nil && err != buntdb.ErrNotFound {
Expand Down Expand Up @@ -332,9 +329,9 @@ func (s *Store) GetJobs(options *JobOptions) ([]*Job, error) {

if options == nil ||
(options.Metadata == nil || len(options.Metadata) == 0 || s.jobHasMetadata(job, options.Metadata)) &&
(options.Query == "" || strings.Contains(job.Name, options.Query)) &&
(options.Status == "" || job.Status == options.Status) &&
(options.Disabled == "" || strconv.FormatBool(job.Disabled) == options.Disabled) {
(options.Query == "" || strings.Contains(job.Name, options.Query) || strings.Contains(job.DisplayName, options.Query)) &&
(options.Disabled == "" || strconv.FormatBool(job.Disabled) == options.Disabled) &&
((options.Status == "untriggered" && job.Status == "") || (options.Status == "" || job.Status == options.Status)) {

jobs = append(jobs, job)
}
Expand Down
6 changes: 3 additions & 3 deletions dkron/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ func (h *HTTPTransport) UI(r *gin.RouterGroup) {
}
var (
totalJobs = len(jobs)
successfulJobs, failedJobs, pristineJobs int
successfulJobs, failedJobs, untriggeredJobs int
)
for _, j := range jobs {
if j.Status == "success" {
successfulJobs++
} else if j.Status == "failed" {
failedJobs++
} else {
pristineJobs++
untriggeredJobs++
}
}
l, err := h.agent.leaderMember()
Expand All @@ -65,7 +65,7 @@ func (h *HTTPTransport) UI(r *gin.RouterGroup) {
"DKRON_LEADER": ln,
"DKRON_TOTAL_JOBS": totalJobs,
"DKRON_FAILED_JOBS": failedJobs,
"DKRON_PRISTINE_JOBS": pristineJobs,
"DKRON_PRISTINE_JOBS": untriggeredJobs,
"DKRON_SUCCESSFUL_JOBS": successfulJobs,
})
}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/dashboard/PristineJobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ interface Props {
const PristineJobs: FC<Props> = ({ value }) => {
return (
<CardWithIcon
to='/jobs?filter={"status":"pristine"}'
to='/jobs?filter={"status":"untriggered"}'
icon={Icon}
title='Pristine Jobs'
title='Untriggered Jobs'
subtitle={value}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/jobs/JobList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const JobFilter = (props: any) => (
<SelectInput source="status" choices={[
{ id: 'success', name: 'Success' },
{ id: 'failed', name: 'Failed' },
{ id: 'pristine', name: 'Waiting to Run' },
{ id: 'untriggered', name: 'Waiting to Run' },
]} />
<BooleanInput source="disabled"/>
</Filter>
Expand Down

0 comments on commit ffaf975

Please sign in to comment.