Rally SDK 2 - 如何将故事附加到功能

问题描述 投票:0回答:1

我尝试使用Rally SDK 2.1(Javascript)编写自定义HTML块以创建新故事。我可以想出如何用自定义标题和描述创建故事。

如果我尝试设置该功能,那么创建就会挂起并且没有任何反应......以下是我如何设置脚本的功能:

						var story = Ext.create(model, {
							Name: 'Can be deleted, created via Rally app SDK 2.1',
							Description: 'Dummy generated story - tests',
							PortfolioItem: '/portfolioitem/featureset/12345' // FEATURE
						});
If I remove the "PortfolioItem" attribute, then it works like a charm.

这是我的全局脚本:

<!DOCTYPE html>
<html>
<head>
    <title>test - Story creation</title>
	
    <script type="text/javascript" src="/apps/2.1/sdk.js"></script>

    <script type="text/javascript">		
		
		// SDK documentation: https://docs.ca.com/en-us/ca-agile-central/saas/apps/2.1/doc/#!/api
				
        Rally.onReady(function() {
					
			// Create a new story
			function addStory() {		
			
				console.log('Creating a new story...');
				// Retrieve the Rally user stories model
				Rally.data.ModelFactory.getModel({
					type: 'UserStory',
					context: {
						workspace: '/workspace/12345', // dummy reference
						project: '/project/12345' // dummy reference
					},
					success: function(model) {
						// Create a new story thanks to the retrieved model
						var story = Ext.create(model, {
							Name: 'Can be deleted, created via Rally app SDK 2.1',
							Description: 'Dummy generated story - tests',
							PortfolioItem: '/portfolioitem/featureset/12345' // dummy reference
						});
						// Save the new story
						story.save({
							callback: function(result, operation) {
								if(operation.wasSuccessful()) {
									console.log('New story created!', result.get('FormattedID'));
								}
							}
						});
					}
				});
			}
			
			// The Rally application
			Ext.define('Rally.grg.storyCreation', {
				extend: 'Rally.app.App',
				
				// Method fired on application launch
				// Retrieve release features asynchronously
				launch: function() {
					console.log('Launch...');
					addStory();		
				}					
			});			
						
            Rally.launchApp('Rally.grg.storyCreation', {
              name: 'test - Story creation'
            });	

        });
    </script>

    <style type="text/css">
        
    </style>
</head>
<body></body>
</html>

我试图声明一个新的portfolioitem对象,它将引用我想要的功能。然后我在故事层面引用它,但它的行为完全相同:

				var f; 
			
				console.log('Defining the feature...');
				// Retrieve the Rally features model
				Rally.data.ModelFactory.getModel({
					type: 'portfolioitem',
					success: function(portfolioitemkModel) {
						// Define an existing feature thanks to the retrieved model
						f = Ext.create(portfolioitemkModel, {
							_ref: "/portfolioitem/featureset/12345",
							_refObjectName: "...",
							_refObjectUUID: "...",
							_type: "PortfolioItem/FeatureSet"							
						});
					}
				});	

作为一个通过JavaScript SDK 2链接故事及其父功能的例子,好吗?

javascript sdk rally
1个回答
0
投票

我会尝试改变这一行:

PortfolioItem: '/portfolioitem/featureset/12345'

对此:

PortfolioItem: '/portfolioitem/feature/12345'
© www.soinside.com 2019 - 2024. All rights reserved.