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

Provide filter query by job displayName, add pristine jobs reports #897

Merged
merged 26 commits into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5be4196
Provide filter query by job displayName, add disabled pristine jobs r…
Jan 25, 2021
20ab436
FIX change header name DKRON_PRISTINE_JOBS
Jan 25, 2021
31c6324
Added Pristine Jobs to React UI
Mar 10, 2021
92fd8f5
Added public directory
Mar 15, 2021
347cf72
Remove custom status for untriggered/pristine jobs && Minor changes
Mar 15, 2021
d1c3184
Provide filter query by job displayName, add disabled pristine jobs r…
Jan 25, 2021
eb18129
FIX change header name DKRON_PRISTINE_JOBS
Jan 25, 2021
aa96dcf
Added Pristine Jobs to React UI
Mar 10, 2021
8c9440b
Added public directory
Mar 15, 2021
ffaf975
Remove custom status for untriggered/pristine jobs && Minor changes
Mar 15, 2021
a127a76
Merge branch 'master' of https://github.com/MGSousa/dkron
Mar 15, 2021
52c44af
Squashed commit of the following:
Mar 15, 2021
7aad02a
Merge branch 'master' of https://github.com/MGSousa/dkron
Mar 15, 2021
5e03f86
Removed pristine from front-end
Mar 21, 2021
d7c1406
FIX conflicts status
Mar 21, 2021
03f325f
FIX conflicts status
Mar 21, 2021
66e7401
Merge branch 'master' of https://github.com/distribworks/dkron
Mar 21, 2021
140ea66
Merge branch 'master' of https://github.com/MGSousa/dkron
Mar 21, 2021
902abc2
Updated assets
Mar 21, 2021
8b4daf4
Remove old file
Mar 21, 2021
0959b09
Update ui/src/jobs/StatusField.tsx
MGSousa Mar 21, 2021
61ab77b
Update ui/src/jobs/StatusField.tsx
MGSousa Mar 21, 2021
210ddcf
Update ui/public/index.html
MGSousa Mar 21, 2021
0d9163e
Minor change on fmt
Mar 22, 2021
a6d1f2a
Merge branch 'master' of https://github.com/MGSousa/dkron
Mar 22, 2021
04fcfb8
FIX only consider untriggered jobs with empty status
Mar 22, 2021
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
138 changes: 69 additions & 69 deletions dkron/assets_ui/assets_vfsdata.go

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dkron/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,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 Expand Up @@ -716,4 +716,4 @@ func trimDirectoryKey(key []byte) []byte {

func isDirectoryKey(key []byte) bool {
return len(key) > 0 && key[len(key)-1] == ':'
}
}
22 changes: 13 additions & 9 deletions dkron/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@ func (h *HTTPTransport) UI(r *gin.RouterGroup) {
if err != nil {
log.Error(err)
}
totalJobs := len(jobs)
successfulJobs := 0
failedJobs := 0
var (
totalJobs = len(jobs)
successfulJobs, failedJobs, untriggeredJobs int
)
for _, j := range jobs {
if j.Status == "success" {
successfulJobs++
} else {
} else if j.Status == "failed" {
failedJobs++
} else {
untriggeredJobs++
}
}
l, err := h.agent.leaderMember()
Expand All @@ -58,11 +61,12 @@ func (h *HTTPTransport) UI(r *gin.RouterGroup) {
ln = l.Name
}
ctx.HTML(http.StatusOK, "index.html", gin.H{
"DKRON_API_URL": fmt.Sprintf("/%s", apiPathPrefix),
"DKRON_LEADER": ln,
"DKRON_TOTAL_JOBS": totalJobs,
"DKRON_FAILED_JOBS": failedJobs,
"DKRON_SUCCESSFUL_JOBS": successfulJobs,
"DKRON_API_URL": fmt.Sprintf("/%s", apiPathPrefix),
"DKRON_LEADER": ln,
"DKRON_TOTAL_JOBS": totalJobs,
"DKRON_FAILED_JOBS": failedJobs,
"DKRON_PRISTINE_JOBS": untriggeredJobs,
"DKRON_SUCCESSFUL_JOBS": successfulJobs,
})
}
})
Expand Down
3 changes: 2 additions & 1 deletion ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
window.DKRON_TOTAL_JOBS={{.DKRON_TOTAL_JOBS}};
window.DKRON_SUCCESSFUL_JOBS={{.DKRON_SUCCESSFUL_JOBS}};
window.DKRON_FAILED_JOBS={{.DKRON_FAILED_JOBS}};
window.DKRON_PRISTINE_JOBS={{.DKRON_PRISTINE_JOBS}};
</script>
</head>
<body>
Expand All @@ -47,4 +48,4 @@
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
</html>
MGSousa marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion ui/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
}
2 changes: 1 addition & 1 deletion ui/public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
Disallow:
1 change: 1 addition & 0 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ declare global {
interface Window {
DKRON_API_URL: string;
DKRON_LEADER: string;
DKRON_PRISTINE_JOBS: string;
DKRON_FAILED_JOBS: string;
DKRON_SUCCESSFUL_JOBS: string;
DKRON_TOTAL_JOBS: string;
Expand Down
3 changes: 3 additions & 0 deletions ui/src/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { TagsField } from '../TagsField'
import Leader from './Leader';
import FailedJobs from './FailedJobs';
import SuccessfulJobs from './SuccessfulJobs';
import PristineJobs from './PristineJobs';
import TotalJobs from './TotalJobs';

let fakeProps = {
Expand Down Expand Up @@ -46,6 +47,8 @@ const Dashboard = () => (
<SuccessfulJobs value={window.DKRON_SUCCESSFUL_JOBS || "0"} />
<Spacer />
<FailedJobs value={window.DKRON_FAILED_JOBS || "0"} />
<Spacer />
<PristineJobs value={window.DKRON_PRISTINE_JOBS || "0"} />
</div>
</div>
</div>
Expand Down
22 changes: 22 additions & 0 deletions ui/src/dashboard/PristineJobs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as React from 'react';
import { FC } from 'react';
import Icon from '@material-ui/icons/NewReleases';

import CardWithIcon from './CardWithIcon';

interface Props {
value?: string;
}

const PristineJobs: FC<Props> = ({ value }) => {
return (
<CardWithIcon
to='/jobs?filter={"status":"untriggered"}'
icon={Icon}
title='Untriggered Jobs'
subtitle={value}
/>
);
};

export default PristineJobs;
1 change: 1 addition & 0 deletions ui/src/jobs/JobList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const JobFilter = (props: any) => (
<SelectInput source="status" choices={[
{ id: 'success', name: 'Success' },
{ id: 'failed', name: 'Failed' },
{ id: 'untriggered', name: 'Waiting to Run' },
]} />
<BooleanInput source="disabled"/>
</Filter>
Expand Down
9 changes: 8 additions & 1 deletion ui/src/jobs/StatusFiled.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import * as React from "react";
MGSousa marked this conversation as resolved.
Show resolved Hide resolved
import SuccessIcon from '@material-ui/icons/CheckCircle';
import FailedIcon from '@material-ui/icons/Cancel';
import PristineIcon from '@material-ui/icons/Timer';
import { Tooltip } from '@material-ui/core';

const StatusField = (props: any) => {
return (props.record[props.source] === 'success' ? <Tooltip title="Success"><SuccessIcon htmlColor="green" /></Tooltip> : <Tooltip title="Success"><FailedIcon htmlColor="red" /></Tooltip>);
if (props.record[props.source] === 'success') {
return <Tooltip title="Success"><SuccessIcon htmlColor="green" /></Tooltip>
} else if (props.record[props.source] === 'failed') {
return <Tooltip title="Error"><FailedIcon htmlColor="red" /></Tooltip>
} else {
return <Tooltip title="Waiting to Run"><PristineIcon htmlColor="blue" /></Tooltip>
}
};

export default StatusField;