-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstanceHeaderDirective.js
More file actions
57 lines (54 loc) · 1.45 KB
/
instanceHeaderDirective.js
File metadata and controls
57 lines (54 loc) · 1.45 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
'use strict';
require('app')
.directive('instanceHeader', instanceHeader);
/**
* @ngInject
*/
function instanceHeader(
$localStorage,
$stateParams,
ahaGuide,
currentOrg,
demoFlowService,
eventTracking,
fetchPullRequest,
keypather
) {
return {
restrict: 'A',
templateUrl: 'instanceHeaderView',
scope: {
instance: '=',
openItems: '=',
demoFlowFlags: '=?'
},
link: function ($scope) {
$scope.$storage = $localStorage;
$scope.currentOrg = currentOrg;
$scope.openedPRUrl = eventTracking.openedPRUrl;
$scope.userName = $stateParams.userName;
$scope.$watch('instance', function (newValue) {
if (!newValue) {
return;
}
fetchPullRequest($scope.instance)
.then(function (pr) {
if (pr) {
$scope.pr = pr;
}
});
});
$scope.showPrCallout = function () {
return demoFlowService.isInDemoFlow() && !demoFlowService.getItem('clickedPrLink');
};
$scope.isInGuide = ahaGuide.isInGuide;
$scope.showUrlCallout = function () {
return demoFlowService.isInDemoFlow() &&
!!keypather.get($scope.instance, 'contextVersion.getMainAppCodeVersion()') &&
!demoFlowService.hasSeenUrlCallout() &&
demoFlowService.hasSeenHangTightMessage() === $scope.instance.attrs.id &&
keypather.get($scope.instance, 'status()') === 'running';
};
}
};
}