I want to load our 9 months sprint plan into a roadmap view. Adding bars manually, placing them in correct sprint and resizing them is too tedious task.
On load, the interface calls https://constructsecure.atlassian.net/wiki/rest/tinymce/1/macro/definition API which returns the data as URL encoded JSON string. Is there any way to convert my xls to a JSON, import it and create the roadmap with it?
title, startDate, description, duration provided in JSON format.
I came up with a hack solution (see if it helps).
Open Confluence in Google Chrome
Open developer tools in popup out mode
Edit the page with roadmap (or insert a new roadmap)
Open the edit mode of the roadmap
In developer console, in sources tab, right click on 'top' and select 'Search in all files'
Enter search string 'click #toolbar-button-add-bar'
Click on the search result to open the file in sources tab. (Click on {} to beautify the source)
Locate the 'onAddBarClick' function
Add a breakpoint inside the function
In the roadmap edit screen, click on '+ Add bar'. This should hit the breakpoint.
In developer console, go to console tab and enter
var myThis = this;
Switch back to source tab and click the run button
Switch back to console
Enter the following functions
var myAddBar = function (laneIdx, title, startDate, duration) { var d = myThis.model.get("lanes").at(laneIdx); var c = d.get("bars"); var g = myThis.model.get("timeline"); var f = new Date(startDate); //var h = g.get("displayOption") === Roadmap.TIMELINE_DISPLAY_OPTION.MONTH ? moment(f).startOf("month") : moment(f).startOf("isoWeek"); var h = moment(f); c.add(new Roadmap.Bar({ title: title, duration: duration, rowIndex: d.getNumberOfRows(), startDate: h.toDate() }))}var myAddMarker = function (title, startDate) { var g = myThis.model.get("markers"); var d = myThis.model.get("timeline"); var h = moment(new Date(startDate)); //var c = d.get("displayOption") === Roadmap.TIMELINE_DISPLAY_OPTION.MONTH ? h.date(15) : h.isoWeekday(4); var c = h; g.add(new Roadmap.Marker({ title: title, markerDate: c.toDate() }))}
Now you can add a bar programatically with
myAddBar(1, 'task 1', '2018-09-13 00:00:00', 1)
The laneIdx is the index of the lane starting with 0
The duration is dependent on what ever you have chosen in 'View by' view. 1 for 1 month or 1 week.
You could create you plan in a JSON or simple array format, paste it console, write your own function which loops on the array and calls the corresponding functions.
var m = [ ["Sprint 1", "2018-08-27 00:00:00"], ["Sprint 2", "2018-09-10 00:00:00"], ["Sprint 3", "2018-09-24 00:00:00"], ["Sprint 4", "2018-10-08 00:00:00"], ["Sprint 5", "2018-10-22 00:00:00"]]
m.forEach(function(mr) {myAddMarker(mr[0], mr[1])})
It looks like you're new here. Sign in or register to get started.