hashi-ui
hashi-ui copied to clipboard
Add support for Job version diff (change view)
Similar to the default Nomad-UI, add a change/diff view of job versions. Right now in hashi-ui, one can select a previous version from the drop-down, but it is hard to detect what exactly has changed from the previous config. The default Nomad-UI shows a *.nomad
config file diff, making it very easy to spot what was changed (like port config, image version, task name, etc...)
My UI skills are not great, but I'll take a look to see what I can muster.
The Nomad CLI provides the diff output out of the box, i.e. nomad job history -p job-name
and the API exposes that data as well via v1/job/job-name/versions?diffs=true
The API returns a JSON that has 2 sections: Versions
and Diffs
The relevant pieces of interest from HashiCorp Nomad code are:
https://github.com/hashicorp/nomad/blob/master/command/job_history.go#L136 shows what the nomad job history
does internally
https://github.com/hashicorp/nomad/blob/master/ui/app/serializers/job-version.js#L12 shows the mapping of the JSON to a joined structure
https://github.com/hashicorp/nomad/blob/master/ui/app/templates/components/job-diff.hbs shows how the diff display is formatted
Design-wise, I'd propose to add another link to https://github.com/jippi/hashi-ui/blob/master/frontend/src/components/JobTopbar/JobTopbar.js named "Versions", which would output the formatted diff result, similar to what "Raw" does.