All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gadgets.sonar-sqale-sunburst-gadget.xml Maven / Gradle / Ivy

There is a newer version: 1.9.1
Show newest version
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 ~ Licensed to Marvelution under one or more contributor license 
 ~ agreements.  See the NOTICE file distributed with this work 
 ~ for additional information regarding copyright ownership.
 ~ Marvelution licenses this file to you under the Apache License,
 ~ Version 2.0 (the "License"); you may not use this file except
 ~ in compliance with the License.
 ~ You may obtain a copy of the License at
 ~
 ~  http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing,
 ~ software distributed under the License is distributed on an
 ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 ~ KIND, either express or implied. See the License for the
 ~ specific language governing permissions and limitations
 ~ under the License.
 -->
<Module>
	<ModulePrefs title="__MSG_sonar.gadget.sqale-sunburst.title__" directory_title="__MSG_sonar.gadget.sqale-sunburst.title__"
				 description="__MSG_sonar.gadget.sqale-sunburst.description__"
				 author="Marvelution" author_email="[email protected]" author_affiliation="Marvelution"
				 author_commentsation="Beverwijk, The Netherlands" title_url="http://docs.marvelution.com/x/CwDw" height="100"
				 screenshot='#staticResourceUrl("${atlassian.plugin.key}:sonar-sqale-sunburst-gadget", "sonar-sqale-sunburst-screenshot.png")'
				 thumbnail='#staticResourceUrl("${atlassian.plugin.key}:sonar-sqale-sunburst-gadget", "sonar-sqale-sunburst-thumb.png")'>
		<Optional feature="gadget-directory">
			<Param name="categories">
				JIRA
				Sonar
				External Content
				Other
			</Param>
		</Optional>
        <Require feature="setprefs"/>
        <Require feature="settitle"/>
        <Require feature="dynamic-height"/>
        <Require feature="views" />
        <Optional feature="atlassian.util" />
        <Require feature="oauthpopup"/>
        <Optional feature="auth-refresh" />
		#oauth
		#supportedLocales("gadget.common,sonar.views,sonar.gadget,sonar.error")
	</ModulePrefs>
	<UserPref name="sonarServer" datatype="hidden" default_value="" />
	<UserPref name="sonarProject" datatype="hidden" default_value="" />
	<UserPref name="depth" datatype="hidden" default_value="3" />
	<UserPref name="refresh" datatype="hidden" default_value="false" />
	<UserPref name="isConfigured" datatype="hidden" default_value="false" />
	<UserPref name="titleRequired" datatype="hidden" default_value="true" />
	<Content type="html">
		<![CDATA[
		#requireResource("${atlassian.plugin.key}:gadget-common")
		#requireResource("${atlassian.plugin.key}:sqale-sunburst-gadget-js")
        #includeResources()
		<script type="text/javascript">
		var WAIT_IMAGE_SRC = "__ATLASSIAN_BASE_URL__" + "/download/resources/${atlassian.plugin.key}/images/wait.gif";
		(function () {
			AJS.Gadget({
				baseUrl: "__ATLASSIAN_BASE_URL__",
				config: {
					descriptor: function (args) {
						var gadget = this;
						AJS.sonar.gadget.utils.setGadgetTitle(gadget, "__MSG_sonar.gadget.sqale-sunburst.title__");
						return  {
							action : "",
							theme : AJS.gadget.sonar.config.getThemeConfig(gadgets),
							fields: AJS.gadget.sonar.fields.generateServerAndProjectPickerFields(gadget, "sonarServer", "sonarProject")
						};
					},
					args: []
				},
				view: {
					enableReload: true,
					onResizeReload: true,
					template: function (args) {
						var gadget = this;
						gadget.getView().empty();
						AJS.sonar.text.getMsgCallBack = gadget.getMsg;
						var sonarServer = AJS.sonar.accessor.parseSonarServer(gadget.getBaseUrl(), gadget.getPref("sonarServer"));
						if (!args.measureData[0]) {
							AJS.sonar.gadget.utils.setGadgetTitle(gadget, "__MSG_sonar.gadget.sqale-sunburst.title__");
							gadget.getView().append(
								AJS.sonar.utils.generateErrorMessageBox(
									AJS.format("__MSG_sonar.error.project.not.on.server__", gadget.getPref("sonarProject"), sonarServer.host)
								)
							);
						} else if (AJS.sonar.utils.isValidMetric(AJS.sonar.utils.getMetricFromMetricsArray(args.metricsDetails, "sqale_rating"))) {
							AJS.sonar.gadget.utils.setGadgetTitle(gadget, "__MSG_sonar.gadget.sqale-sunburst.title__");
							gadget.getView().append(
								AJS.sonar.utils.generateErrorMessageBox(
									AJS.format("__MSG_sonar.error.plugin.not.installed.on.server__", "__MSG_sonar.error.plugin.sqale__", sonarServer.host)
								)
							);
						} else {
							var measureData = args.measureData[0];
							AJS.sonar.gadget.utils.setGadgetTitle(gadget, AJS.format("__MSG_sonar.gadget.sqale-sunburst.project.title__", measureData.name));
							var dimensions = {
								width: (gadget.getView().parent().width() - 20),
								height: (gadget.getView().parent().width() - 20)
							};
							var onChangeCallback = function(depth) {
								gadget.savePref("depth", depth);
							};
							gadget.getView().append(
								AJS.sonar.views.sqale.sunburst.generateViewDetaile(gadget.getBaseUrl(), sonarServer, measureData, gadget.getPref("depth"), dimensions, onChangeCallback)
							);
						}
					},
					args: [{
						key: "measureData",
						ajaxOptions: function () {
							var gadget = this;
							var sonarServer = AJS.sonar.accessor.parseSonarServer(gadget.getBaseUrl(), gadget.getPref("sonarServer"));
							return AJS.sonar.accessor.getAjaxOptions(sonarServer, AJS.sonar.accessor.generateApiUrl(gadget.getPref("sonarProject"), AJS.sonar.views.sqale.sunburst.METRICS));
						}
					}, {
						key: "metricsDetails",
						ajaxOptions: function () {
							var gadget = this;
							var sonarServer = AJS.sonar.accessor.parseSonarServer(gadget.getBaseUrl(), gadget.getPref("sonarServer"));
							return AJS.sonar.accessor.getAjaxOptions(sonarServer, AJS.sonar.accessor.generateServerMetricsApiUrl());
						}
					}]
				}
			});
		})();
		</script>
		]]>
	</Content>
</Module>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy