Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #27783 - CVV status error in default CV #8337

Merged
merged 2 commits into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/foreman/smart_proxies/_content_tab.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</tr>
<tr ng-repeat-end ng-repeat="cv in env.content_views" ng-show="isEnvronmentExpanded(env)">
<td>
<a href="/content_views/{{cv.id}}/versions" target="_self">
<a href="{{ productsOrVersionUrl(cv.default, cv.id) }}" target="_self">
{{ cv.name }}
</a>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ child @lifecycle_environments => :lifecycle_environments do
:name => content_view.name,
:composite => content_view.composite,
:last_published => content_view.versions.empty? ? nil : content_view.versions.last.created_at,
:default => content_view.default,
:counts => {
:content_hosts => content_view.hosts.authorized("view_hosts").count,
:products => content_view.products.enabled.count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ angular.module('Bastion.capsule-content').controller('CapsuleContentController',
}
}

$scope.productsOrVersionUrl = function (cvIsDefault, cvId) {
return cvIsDefault ? '/products' : '/content_views/' + cvId + '/versions';
};

function aggregateTasks(tasks) {
var taskIds = _.map(tasks, function (task) {
return task.id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,17 @@ describe('Controller: CapsuleContentController', function() {
syncState.set(syncState.DEFAULT);
}));

describe('productsOrVersionUrl', function() {
it('returns the correct url if default CV', function() {
expect($scope.productsOrVersionUrl(true, 1)).toBe("/products")
});

describe('syncCapsule', function() {
it('returns the correct url if not default CV', function() {
expect($scope.productsOrVersionUrl(false, 2)).toBe("/content_views/2/versions")
});
});

describe('syncCapsule', function() {
it('has no effect when sync is in progress', function() {
spyOn(CapsuleContent, 'sync').and.callThrough();
syncState.set(syncState.SYNCING);
Expand Down Expand Up @@ -110,11 +118,9 @@ describe('Controller: CapsuleContentController', function() {

expect(syncState.is(syncState.DEFAULT)).toBeTruthy();
});

});

describe('cancelSync', function() {

it('has no effect when sync is not in progress', function() {
spyOn(CapsuleContent, 'cancelSync').and.callThrough();
$scope.cancelSync();
Expand All @@ -134,8 +140,5 @@ describe('Controller: CapsuleContentController', function() {
$scope.cancelSync();
expect(syncState.is(syncState.CANCEL_TRIGGERED)).toBeTruthy();
});

});


});