diff --git a/App-debug.html b/App-debug.html new file mode 100644 index 0000000..60d91ee --- /dev/null +++ b/App-debug.html @@ -0,0 +1,30 @@ + + + + portfolio-item-copy + + + + + + + + + + + + + diff --git a/App.js b/App.js index bc68ffa..e0e7ab6 100644 --- a/App.js +++ b/App.js @@ -121,13 +121,19 @@ Ext.define('CustomApp', { // displays a chooser to select the portfolio item chooseItem : function() { - Ext.create('Rally.ui.dialog.ChooserDialog', { + Ext.create('Rally.ui.dialog.ArtifactChooserDialog', { artifactTypes: ['PortfolioItem'], autoShow: true, + //override to allow pi's in projects with only + //read access + _isArtifactEditable: function(record) { + return true; + }, + title: 'Choose Item', listeners: { - artifactChosen: function(selectedRecord){ + artifactChosen: function(dialog, selectedRecord){ this.down("#item-label").setText(selectedRecord.get('Name')); this.down("#copy-button").setDisabled(true); app.itemSelected(selectedRecord); @@ -233,10 +239,16 @@ Ext.define('CustomApp', { Ext.Array.each( this.fieldsToCopy[type], function(field) { var item_release = this._getRelease(item); - if ( !Ext.isEmpty(item_release) && Ext.Array.contains(reference_fields, field) ) { - copy[field] = { _ref: item_release._ref }; + if (field === 'FlowState') { + if (Rally.util.Ref.getRelativeUri(item.get('Project')) === app.projectRef) { + copy[field] = Rally.util.Ref.getRelativeUri(item.get('FlowState')); + } } else { - copy[field] = item.get(field); + if ( !Ext.isEmpty(item_release) && Ext.Array.contains(reference_fields, field) ) { + copy[field] = { _ref: item_release._ref }; + } else { + copy[field] = item.get(field); + } } }, this); @@ -374,6 +386,10 @@ Ext.define('CustomApp', { Ext.create('Rally.data.WsapiDataStore', { autoLoad : true, + context: { + project: null, + workspace: app.getContext().getWorkspaceRef() + }, limit : "Infinity", model : config.model, fetch : config.fetch, diff --git a/config.json b/config.json index 7e697a6..45db783 100644 --- a/config.json +++ b/config.json @@ -2,7 +2,7 @@ "name": "portfolio-item-copy", "className": "CustomApp", "server": "https://rally1.rallydev.com", - "sdk": "2.0", + "sdk": "2.1", "javascript": [ "App.js", "utility.js", diff --git a/deploy/App-external.html b/deploy/App-external.html new file mode 100644 index 0000000..2bf95ec --- /dev/null +++ b/deploy/App-external.html @@ -0,0 +1,30 @@ + + + + portfolio-item-copy + + + + + + + + + + + + diff --git a/deploy/App-uncompressed.html b/deploy/App-uncompressed.html index a1d6152..787b342 100644 --- a/deploy/App-uncompressed.html +++ b/deploy/App-uncompressed.html @@ -3,7 +3,7 @@ portfolio-item-copy - + +