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 92fd8f5 commit 347cf72
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 46 deletions.
72 changes: 36 additions & 36 deletions dkron/assets_ui/assets_vfsdata.go

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions dkron/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,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 @@ -331,7 +328,7 @@ 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) || strings.Contains(job.DisplayName, options.Query)) &&
(options.Status == "" || job.Status == options.Status) {
((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 @@ -23,7 +23,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' },
]} />
</Filter>
);
Expand Down

0 comments on commit 347cf72

Please sign in to comment.