问题
Actully I want functionality like feature deep copy Which will copy all the stories and tasks inside those stories in that feature. I modified the code from StoryDeepCopy but features are not getting populated just stories are only getting populated, I don't know why its happening. I think the story deep copy app was in version 1.32 which don't have concept of feature or any PortfolioItem but 2.0 version has the support for that. This may be the reaason. Any suggestions This is some of the code from the app
function onChooserClose(chooser, args) {
if (args.selectedItem) {
selectedValue = args.selectedItem;
goButton.setEnabled(true);
dojo.byId('featureBox').innerHTML = args.selectedItem.FormattedID + ' - ' + args.selectedItem.Name;
}
}
function showChooser() {
var chooserConfig = {
fetch:"FormattedID,Name,Description",
title: 'Feature Chooser'
};
chooser = new rally.sdk.ui.Chooser(chooserConfig, dataSource);
chooser.addEventListener('onClose', onChooserClose);
chooser.display();
}
rally.addOnLoad(function () {
goButton = new rally.sdk.ui.basic.Button({
text: "Copy",
enabled: false
});
goButton.addEventListener('onClick', buttonPressed);
goButton.display('goButton');
chooseButton = new rally.sdk.ui.basic.Button({
text: "Choose"
});
chooseButton.addEventListener('onClick', showChooser);
chooseButton.display('chooseButton');
showChooser();
rally.sdk.ui.AppHeader.setHelpTopic("252");
});
});
回答1:
There is no equivalent of deep copy for features in the app catalog. You are correct that AppSDK1, latest version of which is 1.33 has no concept of PortfolioItem objects. If you want to access Portfolio Items or Blocked Reason, or any other feature introduced in later versions of WS API up to 1.43 this syntax will allow it:
<script type="text/javascript" src="/apps/1.33/sdk.js?apiVersion=1.43"></script>
Another variation of this trick is shown in a code fragment below from an app that builds a table of PortfolioItems in AppSDK1 app:
<script type="text/javascript" src="https://rally1.rallydev.com/apps/1.32/sdk.js"></script>
<script type="text/javascript">
function tableExample() {
var rallyDataSource = new rally.sdk.data.RallyDataSource('111','222','false','false');
rallyDataSource.setApiVersion("1.43");
function itemQuery() {
var queryObject = {
key: "pi",
type: "portfolioitem",
fetch: "FormattedID,Name"
};
rallyDataSource.findAll(queryObject, populateTable);
}
This method does not work with v2.0 of WS API.
It has to be used with caution. One thing that definitely will break is around calculations of timebox start and end dates. That's why many legacy Rally App Catalog apps are still at 1.29. This is due to changes in API Version 1.30. See API versioning section in the WS API documentation.
来源:https://stackoverflow.com/questions/24182698/feature-deep-copy-in-rally