Birt Mapit not working in Birt-Viewer - birt

I have created few maps using the mapit library of Birt. The maps are working fantastic in Birt Designer. However, when I put the same report in Birtviewer, the map does not load. My question is whether this is a compatibility issue of Mapit with java8 or birtviewer that it does not work in birt viewer?
My second question is how can I actually see whether the birt library file is being read correctly and whether it could be a problem with reading the library file?
Arif

Unlike "preview" mode, the frameset servlet loads the report through an ajax query. Problem is the Eclipse Webviewer does not make use of a framework such jquery to handle ajax: only the first html script tag is triggered.
Your sample works with the portlet viewer i developed because jquery handles all this ajax stuff automatically. To make it work with the frameset servlet of the Eclipse WebViewer, i tried a quick and dirty workaround, only tested with Chrome & Firefox:
1/ I added this fragment at the end of your first script tag:
setTimeout(function(){
console.log("Evaluate ajax html...");
var scripts = document.getElementsByName("scriptMap");
for (var i=0;i<scripts.length;i++) {
if (scripts[i].text!=null) eval(scripts[i].text)
}
}, 1000);
2/ I also added a name "scriptMap" allowing to select the 2 remaining script tags For example here is the last script:
<script name="scriptMap">
setTimeout(actuate.birt.maps.google.start, 1);
</script>
This way the sample runs finely with a WebViewer frameset.
Furthermore, if you need to deploy a flat file as relative path you can manage this by using a file URI such described below. It means in your sample you have to declare two distinct datasource, one for each file. I hope it will help.

Related

How to show a custom page output in TeamCity build status window

I want to publish a jpg graph image or a table of them in TeamCity's build status page.
I'm trying to use the plugin Build Result Decorator for TeamCity to add a results page which doesn't seem to be working as expected. Wonder if anyone has a solution. When installed it creates this area (highlighted below) in the build status page, and should render a html in there. But it shows a download file requestor instead of rendering the HTML.
Im testing with a basic page
<html><body>
<h1>hello TC</h1>
</body></html>
I've added that like this:
Here is the config as code along side the NUnit xml feature.
features {
feature {
type = "BuildResultDecorator"
param("artifactFilename", "status.html")
}
xmlReport {
reportType = XmlReport.XmlReportType.NUNIT
rules = "**/result.xml"
}
}
Has anyone got this working correctly ? Or is there an alternative to this?
Figured this out: This is possible without plugin.
Under the Project setting you add a Project Level report or Build level report (which will create a tab in either of those screens) and point it at a html artifact that you saved in the build. Then in Global settings you can either disable protection in a secured environment or specifically provide a URL to retrieve the html artifact.
Documented here
Publishing 3rd Party reports
Global settings for artifacts

Exporting Sonarqube reports into Excel - based on major, minor and critical categories

Is there a way to export Sonarqube reports into Excel - based on major, minor and critical categories?
You can use the REST API, to query the data into JSON text and then export that JSON to a CSV file.
I used the command below to get a JSON response:
http://xxxxx.xx.xxxx.com:9000/api/issues/search?componentRoots=test_xxx_xx&statuses=OPEN,REOPENED&pageSize=500&pageIndex=1
Where componentRoots is the your sonar project name.
It gave all the issues in JSON and then I converted it in to a CSV.
The only way is to use the api/issues/search web service
Yes you can use the REST APIs provided with SonarQube to query. The documentation of APIs is also embedded into every Sonar instance as different versions expose different APIs.
We use Python for similar work as response will be in JSON and it will be easier to manipulate. Once you have arrived extracted issues of your liking, write them into .CSV or excel.
Link to web services will be in footer of Sonar Instance.
PS: Expanded answer to offset short-sighted answering. What is provided here is only abstract and not complete answer with query details.
Not recommended by community
With DB:- If you have been using Sonar for long and if you won't upgrade SQ too often you can choose to study table structure and understand how data is organised. We have done this too, but it gets messier with every passing upgrade (more inner queries). Cost of querying will be saved on bulk process of data as ES is not involved
Please try the following command to get all issues in JSON format. Then you may consider to parse output by using jason parser programs.
Replace "XXX:XXX" with Sonar Key defined in "sonar.projectKey" variable on "sonar-project.properties.txt" file
http://localhost:9000/api/issues/search?componentKeys=XXX:XXX
I used F12 developer tools to create the report. Here is step by step solution:
Before opening Sonar report, press F12 to open developer tools in the browser tab (Refer screenshot). Click on Network tab. Initially it'll be empty:
Open Sonar report in the same browser tab.
Now you have to select a request in URL column (Refer screenshot in point # 4). You've to select that request whose URL is of the format - https://sonar:8443/api/issues/search?. Base URL might be different depending upon the name of the server where you have hosted Sonar website.
Click on Response tab (Refer screenshot):
Copy the entire JSON data to clipboard. First press Ctrl + A and then Ctrl + C to copy the contents.
JSON data that you got is in below format:
Data of all the issues is present inside issues key. It is of array type as it contains a list of issues. Paste the entire JSON data into any notepad editor and get the value of issues node. A sample issues node data is shown below:
[
{
"key":"AYMBNpviy48WWZHdsU1Z"
,"rule":"OWASP:UsingComponentWithKnownVulnerability"
,"severity":"MAJOR"
,"component":"B91661CE-50F8-45CB-8F54-29CD044EF32D"
,"project":"B91661CE-50F8-45CB-8F54-29CD044EF32D"
,"flows":[]
,"status":"OPEN"
,"message":"Filename: jquery-ui-1.10.3.custom.js | Reference: CVE-2021-41184 | CVSS Score: 6.1 | Category: CWE-79 | jQuery-UI is the official jQuery user interface library. Prior to version 1.13.0, accepting the value of the `of` option of the `.position()` util from untrusted sources may execute untrusted code. The issue is fixed in jQuery UI 1.13.0. Any string value passed to the `of` option is now treated as a CSS selector. A workaround is to not accept the value of the `of` option from untrusted sources."
,"author":""
,"tags":["cve","cwe","cwe-937","owasp-a9","vulnerability"]
,"transitions":["confirm"]
,"actions":["set_tags","comment","assign"]
,"comments":[]
,"creationDate":"2022-08-18T06:35:49+0100"
,"updateDate":"2022-08-18T06:35:49+0100"
,"type":"VULNERABILITY"
,"branch":"sonarqubepr"
,"scope":"MAIN"
,"quickFixAvailable":false
},
{
"key":"AYMBNpviy48WWZHdsU1_"
,"rule":"OWASP:UsingComponentWithKnownVulnerability"
,"severity":"MAJOR"
,"component":"B91661CE-50F8-45CB-8F54-29CD044EF32D"
,"project":"B91661CE-50F8-45CB-8F54-29CD044EF32D"
,"flows":[]
,"status":"OPEN"
,"message":"Filename: jquery.ui.datepicker-ml.min.js | Reference: CVE-2021-41183 | CVSS Score: 6.1 | Category: CWE-79 | jQuery-UI is the official jQuery user interface library. Prior to version 1.13.0, accepting the value of various `*Text` options of the Datepicker widget from untrusted sources may execute untrusted code. The issue is fixed in jQuery UI 1.13.0. The values passed to various `*Text` options are now always treated as pure text, not HTML. A workaround is to not accept the value of the `*Text` options from untrusted sources."
,"author":""
,"tags":["cve","cwe","cwe-937","owasp-a9","vulnerability"]
,"transitions":["confirm"]
,"actions":["set_tags","comment","assign"]
,"comments":[]
,"creationDate":"2022-08-18T06:35:49+0100"
,"updateDate":"2022-08-18T06:35:49+0100"
,"type":"VULNERABILITY"
,"branch":"sonarqubepr"
,"scope":"MAIN"
,"quickFixAvailable":false
}
]
The JSON array data obtained in previous step is of real use. Convert this JSON array data into an EXCEL file using any online converter. I used the following website - https://www.convertcsv.com/json-to-csv.htm
What if my report has more than one page?
Sonar loads 100 records per page. To get the next page you've to click on Show More button at the bottom:
Every time you click on the Show More button, a new request goes to the Sonar server which will show up in the F12 developer tool's Network tab. So for all subsequent pages, repeat same set of steps to create a new Excel sheet per page. Then merge all the Excel sheets manually to create single master report.
Note: While merging the Excel files, remember that every Excel file will have a header row at the top. While merging the files, you'll have to keep the header row from from the first Excel sheet and ignore from the rest.

Angular 2 events get postponed strangely when I include some other non-angular script

I have encountered a strange problem when using angular 2 beta RC.
Events get postponed if I include an external script I wrote into any angular 2 project:
<script>
(function(r,a,k,e,y,o,u){r['RakrWidgetObject']=y;r[y]=r[y]||function(){
(r[y].q=r[y].q||[]).push(arguments)},r[y].l=1*new Date();o=a.createElement(k),
u=a.getElementsByTagName(k)[0];o.async=1;o.src=e;u.parentNode.insertBefore(o,u)
})(window,document,'script','//cht.technology/rakr.js','rakr');
rakr('//localhost:3000', 'RAKR-000001');
</script>
Take github project thelgevold/angular-2-samples for example, once I add the below script as I did in https://github.com/tan9/angular-2-samples/tree/event-postponed branch.
The angular 2 application starts to behave strangely, some event changes won't be taking into account by angular until I trigger another event manually, I have to click a button twice to get correct rendering as this recording I uploaded to imgur
I don't know what's happening to the external script I wrote, it's a simple project that only depends on html2canvas and es6-promise, which can capture screenshot using html2canvas and send it to another web service. The bundle was built by webpack, and I tried to build the bundle by using browersify, with no luck.
This is a caveat with how Zone.js works. Zone.js patches async browser events and provides an API in which Angular uses to determine when changes happen and when to run change detection in order to update the UI.
In the case of your third-party library that uses the browser Promise API, it needs to be loaded before Zone.js is loaded via script tag. This is so that async events are patched so it will be run in the "zone" that Angular runs in. Events running outside the zone won't be picked up unless change detection is run manually, or the event is run in the context of the Angular zone.
As explained by brandon, make the code run inside Angulars zone
inject NgZone
constructor(private ngZone:NgZone){}
...
this.zone.run(() => ... /* code here that modifies Angulars model from the outside */);
You can also get the zone outside Angular
bootstrap(AppComponent, ...).then((ref => ref.instance.injector.get(NgZone));
(Not sure if this is 100% correct, I'm just on my phone and looking up is cumbersome. Please post a comment if you can't make it work.

Kendo UI MVC cant find KendoNotification widget?

Similar to a previous post, but this time Im using MVC and the html helper
Using Kendo.MVC ver# 2015.1.318.545
and script ui library 2013.3.1324
#(Html.Kendo().Notification()
.Name("popupNotification")
)
At run time the above results in this code:
<span id="popupNotification"></span><script>
jQuery(function(){jQuery("#popupNotification").kendoNotification({});});
</script>
, in chrome developer tools, I see an error:
Uncaught TypeError: jQuery(...).kendoNotification is not a function
Its strange that I can put in a datepicker in the same spot, but the notification blows chunks.
[ See reply by user Win below - that was the answer ]
Ideally, you want to use all 3 files (CSS and images too) in same version. Otherwise, they will be out of sync.
Kendo.Mvc.dll
kendo.aspnetmvc.min.js
kendo.all.min.js (this might vary if you use individual widget)
FYI: Also make sure that you use Kendo supported jQuery version. New version requires new jQuery version.

How to detect the last Docpad render pass?

Im currently writing a small Docpad plugin to output a documents contentRenderedWithoutLayouts into a separate .json file next to the .html version for loading it via an ajax request later.
The plugin works by overriding Baseplugin's render: (opts) -> method and doing a few checks whether we're rendering a document and to html.
I now noticed that this method gets called multiple times for some documents, which seems to be render pass related. So how can I detect the final render pass per document to avoid writing the .json multiple times per render?
Many Thanks
--
Edit:
found the answer after another look at Docpads events list: http://docpad.org/docs/events
The writeAfter event is the right place to get the final data and have the output directory tree set up so I can put my .json files next to the .html.
In case you're interested find the plugin here: https://github.com/field/docpad-plugin-jsonfragment
Another approach to this would be to use the serverExtend event, and write a router that detects if it is an ajax request (existance of the IS_XHR header) and then sends the necessary json data from that. This would require your hosting platform to support node.js as you'll be using the docpad server.

Resources