<< Back to previous view |
[QB-3555] An option in CKEditor to edit plain content instead of disable html editor for whole site
|
|
Status: | Closed |
Project: | QuickBuild |
Component/s: | None |
Affects Version/s: | 10.0.10 |
Fix Version/s: | None |
Type: | Improvement | Priority: | Major |
Reporter: | Robin Shen | Assigned To: | Robin Shen |
Resolution: | Fixed | Votes: | 2 |
Remaining Estimate: | Unknown | Time Spent: | Unknown |
Original Estimate: | Unknown |
File Attachments: | builds_list.jpg |
Comments |
Comment by Jonasz Wojcik [ 24/Apr/20 09:14 AM ] |
Thanks,
That will help a lot with the dashboard gadgets exp: in CKEEditor ${util.getCalendar().getShortYear()} is not translate to 20. it was useful for adding custom build list based on system.getBuildManager() |
Comment by Jonasz Wojcik [ 24/Apr/20 11:10 AM ] |
groovy code example:
<pre><br>${groovy:<br><br>configuration_id = 2;<br>number_of_builds = 10;<br>qb_link = 'http://quickbuild.domain.com';<br><br>configuration_path = system.getConfigurationManager().get(configuration_id).getPathName()<br>if (system.getConfiguration(configuration_path) != null) {<br> def build_list = '<div class="round-box build-history"><table class="records builds"><thead><tr class="headers">'<br> <br> build_list += '<th class="id"><span>Id</span></th>'<br> build_list += '<th><span>Version</span></th>'<br> build_list += '<th><span>Configuration</span></th>'<br> build_list += '<th><span>Begin Date</span></th>'<br> build_list += '<th class="id"><span>Duration</span></th>'<br> build_list += '<th><span>Triggered By</span></th>'<br> <br> build_list += '</tr></thead><tbody>'<br> def prev_build = system.getConfiguration(configuration_path).getLatestBuild()<br> def triggered_by = ''<br> def image = ''<br> def status_class = ''<br> def duration = ''<br> def i = 0<br> while(i<number_of_builds){<br> if(prev_build == null) {break;\}<br> if( i % 2) {<br> build_list += '<tr class="odd">' \}<br> else { <br> build_list += '<tr class="even">' <br> \}<br> if(prev_build.isScheduled()){<br> triggered_by = '<b>Scheduler</b>' \} <br> else{<br> triggered_by = prev_build.getRequester().getDisplayName() <br> \} <br> if(prev_build.isRunning()){ <br> duration = '<b>running...</b>'<br> image = 'spin-ball'<br> status_class = 'running' \} <br> else{ <br> duration = util.formatDuration(prev_build.getDuration()) <br> switch (prev_build.getStatus()) { <br> case 'SUCCESSFUL': <br> image = 'green-ball'<br> status_class = 'successful'<br> break <br> case 'FAILED': <br> image = 'red-ball'<br> status_class = 'failed'<br> break<br> case 'RECOMMENDED':<br> image = 'star'<br> status_class = 'recommended'<br> break <br> case 'CANCELLED':<br> image = 'cancelled'<br> status_class = 'cancelled'<br> break<br> case 'TIMEOUT':<br> image = 'timeout'<br> status_class = 'timeout'<br> break<br> default: <br> result = 'green-ball'<br> status_class = 'successful' <br> \} <br> \} <br> build_list += '<td class="id"><span>' + prev_build.getId() + '</span></td>' <br> build_list += '<td><span><div class="build-info"><img src="' + qb_link + '/images/' + image + '.gif">&nbsp;&nbsp;<a href="' + qb_link + '/build/' + prev_build.getId() + '" target="new" class="build-status ' + status_class + ' maskable">' + prev_build.getVersion() +'</a></div></span></td>' <br> build_list += '<td><span><a href="' + qb_link + '/' + configuration_id + '" target="new">' + configuration_path + '</a></span></td>' <br> build_list += '<td class="id"><span>' + util.formatDate(prev_build.getBeginDate()) + '</span></td>' <br> build_list += '<td><span>' + duration +'</span></td>'<br> build_list += '<td><span>' + triggered_by + '</span></td></tr>' <br> <br> prev_build = system.getBuildManager().getPrevious(prev_build) <br> i = i+1 <br> \} <br> build_list += '</tbody></table></div>' <br> <br> build_list <br>\}<br>}<br></pre> |
Comment by Jonasz Wojcik [ 24/Apr/20 11:11 AM ] |
${groovy:
configuration_id = 2; number_of_builds = 10; qb_link = 'http://quickbuild.comain.com'; configuration_path = system.getConfigurationManager().get(configuration_id).getPathName() if (system.getConfiguration(configuration_path) != null) { def build_list = '<div class="round-box build-history"><table class="records builds"><thead><tr class="headers">' build_list += '<th class="id"><span>Id</span></th>' build_list += '<th><span>Version</span></th>' build_list += '<th><span>Configuration</span></th>' build_list += '<th><span>Begin Date</span></th>' build_list += '<th class="id"><span>Duration</span></th>' build_list += '<th><span>Triggered By</span></th>' build_list += '</tr></thead><tbody>' def prev_build = system.getConfiguration(configuration_path).getLatestBuild() def triggered_by = '' def image = '' def status_class = '' def duration = '' def i = 0 while(i<number_of_builds){ if(prev_build == null) {break;\} if( i % 2) { build_list += '<tr class="odd">' \} else { build_list += '<tr class="even">' \} if(prev_build.isScheduled()){ triggered_by = '<b>Scheduler</b>' \} else{ triggered_by = prev_build.getRequester().getDisplayName() \} if(prev_build.isRunning()){ duration = '<b>running...</b>' image = 'spin-ball' status_class = 'running' \} else{ duration = util.formatDuration(prev_build.getDuration()) switch (prev_build.getStatus()) { case 'SUCCESSFUL': image = 'green-ball' status_class = 'successful' break case 'FAILED': image = 'red-ball' status_class = 'failed' break case 'RECOMMENDED': image = 'star' status_class = 'recommended' break case 'CANCELLED': image = 'cancelled' status_class = 'cancelled' break case 'TIMEOUT': image = 'timeout' status_class = 'timeout' break default: result = 'green-ball' status_class = 'successful' \} \} build_list += '<td class="id"><span>' + prev_build.getId() + '</span></td>' build_list += '<td><span><div class="build-info"><img src="' + qb_link + '/images/' + image + '.gif"> <a href="' + qb_link + '/build/' + prev_build.getId() + '" target="new" class="build-status ' + status_class + ' maskable">' + prev_build.getVersion() +'</a></div></span></td>' build_list += '<td><span><a href="' + qb_link + '/' + configuration_id + '" target="new">' + configuration_path + '</a></span></td>' build_list += '<td class="id"><span>' + util.formatDate(prev_build.getBeginDate()) + '</span></td>' build_list += '<td><span>' + duration +'</span></td>' build_list += '<td><span>' + triggered_by + '</span></td></tr>' prev_build = system.getBuildManager().getPrevious(prev_build) i = i+1 \} build_list += '</tbody></table></div>' build_list \} } |
Comment by Jonasz Wojcik [ 24/Apr/20 11:21 AM ] |
this is how it looks like |
Comment by Robin Shen [ 20/Feb/21 02:50 AM ] |
Starting from QB 10.0.13, this can be done by editing source in source mode of CKEditor, then save the content without switching back to html mode. Next time when the content is edited, QB will open plain text editor if it detects scripts inside it. |