<< Back to previous view

[QB-3555] An option in CKEditor to edit plain content instead of disable html editor for whole site
Created: 24/Apr/20  Updated: 20/Feb/21

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: JPEG File 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>&dollar;&lcub;groovy:<br><br>configuration_id = 2;<br>number_of_builds = 10;<br>qb_link = &#x27;http://quickbuild.domain.com&#x27;;&lt;br&gt;&lt;br&gt;configuration_path = system.getConfigurationManager().get(configuration_id).getPathName()<br>if (system.getConfiguration(configuration_path) != null) &lcub;<br> def build_list = &#x27;&lt;div class=&quot;round-box build-history&quot;&gt;&lt;table class=&quot;records builds&quot;&gt;&lt;thead&gt;&lt;tr class=&quot;headers&quot;&gt;&#x27;<br> <br> build_list += &#x27;&lt;th class=&quot;id&quot;&gt;&lt;span&gt;Id&lt;/span&gt;&lt;/th&gt;&#x27;<br> build_list += &#x27;&lt;th&gt;&lt;span&gt;Version&lt;/span&gt;&lt;/th&gt;&#x27;<br> build_list += &#x27;&lt;th&gt;&lt;span&gt;Configuration&lt;/span&gt;&lt;/th&gt;&#x27;<br> build_list += &#x27;&lt;th&gt;&lt;span&gt;Begin Date&lt;/span&gt;&lt;/th&gt;&#x27;<br> build_list += &#x27;&lt;th class=&quot;id&quot;&gt;&lt;span&gt;Duration&lt;/span&gt;&lt;/th&gt;&#x27;<br> build_list += &#x27;&lt;th&gt;&lt;span&gt;Triggered By&lt;/span&gt;&lt;/th&gt;&#x27;<br> <br> build_list += &#x27;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&#x27;<br> def prev_build = system.getConfiguration(configuration_path).getLatestBuild()<br> def triggered_by = &#x27;&#x27;<br> def image = &#x27;&#x27;<br> def status_class = &#x27;&#x27;<br> def duration = &#x27;&#x27;<br> def i = 0<br> while(i&lt;number_of_builds)&lcub;<br> if(prev_build == null) &lcub;break;\&rcub;<br> if( i % 2) &lcub;<br> build_list += &#x27;&lt;tr class=&quot;odd&quot;&gt;&#x27; \&rcub;<br> else &lcub; <br> build_list += &#x27;&lt;tr class=&quot;even&quot;&gt;&#x27; <br> \&rcub;<br> if(prev_build.isScheduled())&lcub;<br> triggered_by = &#x27;&lt;b&gt;Scheduler&lt;/b&gt;&#x27; \&rcub; <br> else&lcub;<br> triggered_by = prev_build.getRequester().getDisplayName() <br> \&rcub; <br> if(prev_build.isRunning())&lcub; <br> duration = &#x27;&lt;b&gt;running...&lt;/b&gt;&#x27;<br> image = &#x27;spin-ball&#x27;<br> status_class = &#x27;running&#x27; \&rcub; <br> else&lcub; <br> duration = util.formatDuration(prev_build.getDuration()) <br> switch (prev_build.getStatus()) &lcub; <br> case &#x27;SUCCESSFUL&#x27;: <br> image = &#x27;green-ball&#x27;<br> status_class = &#x27;successful&#x27;<br> break <br> case &#x27;FAILED&#x27;: <br> image = &#x27;red-ball&#x27;<br> status_class = &#x27;failed&#x27;<br> break<br> case &#x27;RECOMMENDED&#x27;:<br> image = &#x27;star&#x27;<br> status_class = &#x27;recommended&#x27;<br> break <br> case &#x27;CANCELLED&#x27;:<br> image = &#x27;cancelled&#x27;<br> status_class = &#x27;cancelled&#x27;<br> break<br> case &#x27;TIMEOUT&#x27;:<br> image = &#x27;timeout&#x27;<br> status_class = &#x27;timeout&#x27;<br> break<br> default: <br> result = &#x27;green-ball&#x27;<br> status_class = &#x27;successful&#x27; <br> \&rcub; <br> \&rcub; <br> build_list += &#x27;&lt;td class=&quot;id&quot;&gt;&lt;span&gt;&#x27; + prev_build.getId() + &#x27;&lt;/span&gt;&lt;/td&gt;&#x27; <br> build_list += &#x27;&lt;td&gt;&lt;span&gt;&lt;div class=&quot;build-info&quot;&gt;&lt;img src=&quot;&#x27; + qb_link + &#x27;/images/&#x27; + image + &#x27;.gif&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;&#x27; + qb_link + &#x27;/build/&#x27; + prev_build.getId() + &#x27;&quot; target=&quot;new&quot; class=&quot;build-status &#x27; + status_class + &#x27; maskable&quot;&gt;&#x27; + prev_build.getVersion() +&#x27;&lt;/a&gt;&lt;/div&gt;&lt;/span&gt;&lt;/td&gt;&#x27; <br> build_list += &#x27;&lt;td&gt;&lt;span&gt;&lt;a href=&quot;&#x27; + qb_link + &#x27;/&#x27; + configuration_id + &#x27;&quot; target=&quot;new&quot;&gt;&#x27; + configuration_path + &#x27;&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;&#x27; <br> build_list += &#x27;&lt;td class=&quot;id&quot;&gt;&lt;span&gt;&#x27; + util.formatDate(prev_build.getBeginDate()) + &#x27;&lt;/span&gt;&lt;/td&gt;&#x27; <br> build_list += &#x27;&lt;td&gt;&lt;span&gt;&#x27; + duration +&#x27;&lt;/span&gt;&lt;/td&gt;&#x27;<br> build_list += &#x27;&lt;td&gt;&lt;span&gt;&#x27; + triggered_by + &#x27;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&#x27; <br> <br> prev_build = system.getBuildManager().getPrevious(prev_build) <br> i = i+1 <br> \&rcub; <br> build_list += &#x27;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&#x27; <br> <br> build_list <br>\&rcub;<br>&rcub;<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">&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>'
   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.
Generated at Thu May 02 00:34:57 UTC 2024 using JIRA 189.