This repository was archived by the owner on Oct 3, 2025. It is now read-only.
forked from klegro/AnalyticsSnapshotGridApp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHistoricalCard.js
More file actions
65 lines (55 loc) · 1.96 KB
/
HistoricalCard.js
File metadata and controls
65 lines (55 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Ext.define('Rally.ui.cardboard.HistoricalCard', {
extend: 'Rally.ui.cardboard.ArtifactCard',
componentCls: 'historical-card',
alias: 'widget.historicalcard',
inheritableStatics: {
/**
* @returns {String[]} List of field names needed to render, used in addition to Rally.ui.cardboard.Card.getDisplayedContentFields to create Rally.ui.cardboard.Card.getRequiredFetchFields
* @protected
*/
getAdditionalFetchFields: function() {
return [];
},
/**
* @returns {String[]} List of field names to be displayed in the card content
* @protected
*/
getDisplayedContentFields: function() {
return ['Name'];
}
},
getOwnerDataFromRecord: function(record){
var ownerData = {};
var contextPath = Rally.environment.getServer().getContextUrl();
if (record.get('Owner')) {
var owner = record.get('Owner');
ownerData.profileImageSrc = contextPath + '/profile/viewThumbnailImage.sp?tSize=20&uid=' + owner.ObjectID;
ownerData.ownerName = owner.Name;
} else {
ownerData.ownerName = 'No Owner';
ownerData.profileImageSrc = contextPath + '/images/rally/components/profile-mark-18.png';
}
return ownerData;
},
buildHeader: function(){
var renderData = this.getOwnerDataFromRecord(this.getRecord());
Ext.applyIf(renderData, this.getRecord().data);
var types = this.getRecord().get('_Type');
var type = types[types.length -1];
var objectID = this.getRecord().get('ObjectID');
var server = Rally.environment.getServer();
renderData.artifactRef = server.getWsapiUrl() +'/'+ type +'/'+ objectID;
return Ext.widget('container', {
itemId: 'cardHeader',
cls: 'cardHeader',
renderTpl: Ext.create('Ext.XTemplate',
'<div class="leftCardHeader">',
' <a href="{[Rally.util.Navigation.createRallyDetailUrl(values.artifactRef)]}" target="_top">Details</a>',
'</div>',
'<img class="cardOwner" src="{profileImageSrc}">',
'<div class="cardOwnerName">{ownerName}</div>'
),
renderData: renderData
});
}
});