Skip to content

Commit

Permalink
Add a button to the profile details page to trigger a profile refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Dec 6, 2013
1 parent cb52bff commit 215382b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Expand Up @@ -10,6 +10,7 @@ <h2 class="inline" title="Profile: {{row.id}}">{{row.id}}</h2>
</div>

<div class="pull-right" ng-show="inDirective">
<a class="btn" href="" title="Manually trigger provisioning of this profile on all associated containers" ng-click="refreshProfile(versionId, profileId)"><i class="icon-refresh"> Refresh</i></a>
<a class="btn" href="" title="Create a new profile that is a copy of this one" ng-click="copyProfileDialog = true"><i class="icon-copy"></i> Copy</a>
<a class="btn" ng-href="#/fabric/assignProfile?vid={{versionId}}&pid={{profileId}}" title="Assign this this profile to an existing container"><i class="icon-truck"></i> Assign</a>
<a class="btn" ng-href="#/fabric/containers/createContainer?versionId={{versionId}}&profileIds={{profileId}}" title="Deploy this profile to a new container"><i class="icon-truck"></i> New</a>
Expand Down
26 changes: 25 additions & 1 deletion hawtio-web/src/main/webapp/app/fabric/js/fabricHelpers.ts
Expand Up @@ -66,7 +66,7 @@ module Fabric {
* Adds a bunch of common helper functions to the given scope
* @method initScope
* @for Fabric
* @param {any} $scope
* @param {*} $scope
* @param {ng.ILocationService} $location
* @paran {*} jolokia
* @param {Workspace} workspace
Expand Down Expand Up @@ -104,6 +104,30 @@ module Fabric {
return !$scope.isCurrentContainer(container);
};

$scope.refreshProfile = (versionId, profileId) => {
log.debug('Refreshing profile: ' + profileId + '/' + versionId);
if (!versionId || !profileId) {
return;
}
jolokia.request({
type: 'exec',
mbean: Fabric.managerMBean,
operation: 'refreshProfile',
arguments: [versionId, profileId]
}, {
method: 'POST',
success: () => {
notification('success', 'Triggered refresh of profile ' + profileId + '/' + versionId);
Core.$apply($scope);
},
error: (response) => {
log.warn('Failed to trigger refresh for profile ' + profileId + '/' + versionId + ' due to: ', response.error);
log.info("Stack trace: ", response.stacktrace);
Core.$apply($scope);
}
})
}

$scope.hasFabricWiki = () => {
return Git.isGitMBeanFabric(workspace);
};
Expand Down

0 comments on commit 215382b

Please sign in to comment.