From 1abb7f26e1b14491b3d3b5eaa2ca8f24312cf6e6 Mon Sep 17 00:00:00 2001 From: Kyle Morse Date: Wed, 11 Apr 2018 16:23:23 -0600 Subject: [PATCH] Fix project scoping and flow state issues --- App-debug.html | 30 ++++++++++++++++++++++++++++++ App.js | 26 +++++++++++++++++++++----- config.json | 2 +- deploy/App-external.html | 30 ++++++++++++++++++++++++++++++ deploy/App-uncompressed.html | 35 ++++++++++++++++++++++++++++------- deploy/App.html | 9 +++++---- package.json | 2 +- utility.js | 4 ++++ 8 files changed, 120 insertions(+), 18 deletions(-) create mode 100644 App-debug.html create mode 100644 deploy/App-external.html 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 - + +