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

时间:2019-03-09 16:59:06

标签: javascript sdk rally

我尝试使用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
						});
如果删除“ PortfolioItem”属性,则它的作用就像一个超级按钮。

这是我的全局脚本:

<!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 SDK2吗?

0 个答案:

没有答案