SDK 2: % done column - rally

I'd like to use a % done field that uses the same functionality as % done by story plan estimate for portfolio items, except for another field.
What I'd like to do is create the same sort of bar for defects which have been marked as must fix for a particular release, and then show % done by plan estimate. I can handle getting the list of defects, calculating % done etc.
Can you show me an example of how to display such a column?

We have a PercentDoneTemplate in the SDK 2.0p3 release, but it is currently private in the SDK. You can use it, but at the risk of us changing it on you in the future. We are considering making it a publicly supported component. To use it in a grid, you just need to add a templatecolumn column to your columnCfg, something like this:
this.add({
xtype: 'rallygrid',
store: myStore,
columnCfgs: [{
text: 'Name',
dataIndex: 'Name',
flex: 1
},
{
xtype: 'templatecolumn',
tpl: Ext.create('Rally.ui.renderer.template.PercentDoneTemplate')
}]
});
The template is expecting your data to have a field called percentDone (case sensitive). You can change that by adding a config option for percentDoneName
{
xtype: 'templatecolumn',
tpl: Ext.create('Rally.ui.renderer.template.PercentDoneTemplate', {
percentDoneName: 'myPercentDoneField'
}),
}
It should end up looking like:

If you can calculate the percentage as a decimal, then you can easily generate a rallypercentdone component. However, I don't know how you expect to place them in a column. Perhaps a Rally dev will be able to better assist you in that regard.
https://rally1.rallydev.com/apps/2.0p2/doc/#!/api/Rally.ui.PercentDone

Related

Unique field types and specific GET-parameters for api calls in Apostrophe CMS

I have several questions about Apostrophe CMS:
Is it possible to add a unique field type in apostrophe-pieces? I can't find a way to do this.
Edit: I noticed that I wasn't specific enough. I want to make sure that there can't be two instances in the database with the same value in an added field. It should be something like an additional id. Is there an option for this? Maybe something like:
addFields: [
{
name: 'secondId',
label: 'Second ID',
type: 'string',
required: true,
unique: true
}
]
I want to access the apostrophe-headless api and get a specific element by passing a certain value of one of the created field types of the correspondent piece in a GET-parameter. Is something like this possible?
For example:
Piece:
module.exports = {
extend: 'apostrophe-pieces',
name: 'article',
label: 'Article',
pluralLabel: 'Articles',
restApi: {
safeFor: 'manage'
},
addFields: [
{
name: 'title',
label: 'Name',
type: 'string',
required: true
},
{
name: 'author',
label: 'Author',
type: 'string',
required: true
}
]
};
Desired api call for getting all articles which have strored "Jon" as author:
http://example.com/api/v1/article?author=Jon
Thank you very much in advance!
Custom field types
You can add custom field types at project level by extending apostrophe-schemas and adding the proper definition. You'll need to add a converter for server-side sanitization and a populator for the front-end of the form field.
You can follow the examples in Apostrophe's schema module, linked are the functions defining a float
https://github.com/apostrophecms/apostrophe/blob/0bcd5faf84bc7b05c51de7331b17f5929794f524/lib/modules/apostrophe-schemas/index.js#L1367
https://github.com/apostrophecms/apostrophe/blob/0bcd5faf84bc7b05c51de7331b17f5929794f524/lib/modules/apostrophe-schemas/public/js/user.js#L991
You would add your definitions in your project level lib/modules/apostrophe-schemas's index.js and public/js/user.js respectively.
Filtering
You can search your piece index for a string like Jon by adding ?search=jon to your query but more likely you want to filter pieces by the value of a join.
If you had piece types article and authors, you could have a joinByOne field in article's schema that lets you relate that article to an author piece. Then, by enabling pieceFilters you could filter directly on those joined properties.
A complete rundown of piecesFilters can be found here https://apostrophecms.org/docs/tutorials/intermediate/cursors.html#filtering-joins-browsing-profiles-by-market
I think you'd also need to mark that filter as safe for api use in your apostrophe-headless configuration https://github.com/apostrophecms/apostrophe-headless#filtering-products

ExtJS (4.1) creating static data store

I am no JS star so I'm having trouble finding a solution to something that is probably easier than I know.
the page loads, but the ui content stops when it hits the ui code to load the static store data. The preexisting project uses dynamically grabbed data from the database but this just needs a small list of options. (I miss the days of just using HTML). Firebug shows a non-helpful error in ext-all.js that q is undefined, but since that's obfuscated well maintained code I'm sure it's a problem in my code. Do I need to define the proxy for this even if it's static data? Thank you ahead of time!
Here is the model, store, and ui code
//model
Ext.define('HITS.model.ComboBox', {
extend: 'Ext.data.Model',
fields: [
{type: 'string', name: 'label', mapping: 'label'},
{type: 'string', name: 'value', mapping: 'value'}
]
});
//store
Ext.define('HITS.store.ReportType', {
extend: 'Ext.data.Store',
model: 'HITS.model.ComboBox',
storeId:'ReportType',
data: [
{label:'All Tags', value: 'AllTags'},
{label:'Key Findings', value: 'KeyFindings'}
]
});
//ui
<ui:ComboBox
renderTo="ui_report_list"
fieldLabel="Report:"
inputId="reportSelect"
store="ReportType">
The solution had a couple of changes required. The first was the "value" column, which is of course a reserved word in the database(oracle). The other was because I didn't add some prefunction comments for the model that trigger autogenerated code(I hate this practice).
The code here should mostly work but you'd need the model I ended up using. If you check sencha and don't use reserved words you should be ok.

How can I make a field visible in Rally App builder

I have a Rally grid that I'm creating using the Rally app builder. Standard grid using the defect model. One of the fields in the defect model is set to hidden in the field setup in the Rally Workspaces and Projects setup. I'd like to dynamically make the field visible in my grid so that it only appears on my grid and not on the defect page when entering a defect. Any ideas on how to do that? Thanks.
This was a pretty tricky one. The grid and board components are hard wired to not show data from hidden fields by default and unfortunately there are not any config properties exposed to turn this behavior off. Here's what I came up with:
this.add({
xtype: 'rallygrid',
columnCfgs: [
'FormattedID',
'Name',
'Owner',
{
text: 'Hidden Field', //set column header text
renderer: function(value, meta, record) {
//return the rendered field data
return record.get('c_HiddenField');
}
}
],
context: this.getContext(),
storeConfig: {
model: 'userstory',
fetch: ['c_HiddenField'] //need to explicitly fetch
}
});
Basically you include a column in your columnCfgs without a dataIndex specified. Set the text and renderer to work with your field.
You'll also need to manually fetch your field in the storeConfig since the grid won't understand how to do it otherwise.

Edit hover in rallygrid missing

Trying to do some cell validation in a rallygrid, but in order to add it I need to use objects in columnCfg instead of just file names. I have something like
{
dataIndex: 'field1',
text: 'field1',
editor: { xtype: 'rallynumberfield', allowBlank: true , allowDecimals: false},
editable: true,
},
Everything works (and I'll add a renderer when it does) but I don't get the little edit hover (pencil icon) on this column. Any hint where to look? My goal is for it to look like a default grid with just the renderer, but as soon as I use the options opbject instead of a string, the hover goes away. Any hints?
Thanks for reporting this - I'm seeing the same issue (i.e. cells in column are editable, but the "pencil hover is missing). This looks like an oversight in the rendering of the component in AppSDK2. I'll file a Defect with Rally Engineering. Sorry for the inconvenience.

Add more than a field in selectfield displayvalue (Sencha Touch 2)

I have the following select field :
{
xtype: 'selectfield',
name: 'sourcecurrency',
label: 'Source Currency',
valueField: 'name',
displayField: '{name} - {description}',
store: 'Countries',
placeHolder: 'Select your source currency'
},
The data is returning two fields 'name' and 'description'; I want to display the two fields in the select area, setting the displayField as shown works but i still have the '{}' surrounding them.
Must be really damn stupid but can't figure it out.
There's no direct way of showing more than one field in selectfield's displayField.
So, you will need to create an extension based on the selectfield.
I know its old, but heres another way to go about it for completeness:
Create a field like DisplayName in your model and have that be whatever combination of fields and information you want the display.
Then just have displayField: '{displayName}'
Creating a custom field is more efficient, but this is easier. Just depends on what you need to display and how efficient you need your app to be and how much time you want to invest in the solution.
In case it helps someone you can just ovveride getTabletPicker or getPhonePicker (Tested in sencha 6).
For example in getTabletPicker all you need to change is line
itemTpl: '<span class="x-list-label">{' + me.getDisplayField() + ':htmlEncode}</span>',
to something else like
itemTpl : me.getTpl()
so your selectfield would be
xtype : 'selectfield',
displayField : 'YOURDISPLAY',
valueField : 'YOURVALUE',
tpl : new Ext.XTemplate(
'<tpl for=".">',
'{YOURDISPLAY}',
'{YOURDISPLAY2}',
'{YOURDISPLAY3}',
'</tpl>'
)