Merge pull request #2637 from jzelinskie/audit-apps

Audit Logs for Apps
This commit is contained in:
Jimmy Zelinskie 2017-05-16 17:06:25 -04:00 committed by GitHub
commit 702cdf59ff
12 changed files with 96 additions and 26 deletions

View file

@ -21,8 +21,10 @@
<cor-tab tab-title="Releases" tab-id="releases">
<i class="fa ci-package"></i>
</cor-tab>
<cor-tab tab-title="Settings" tab-id="settings"
ng-if="$ctrl.repository.can_admin">
<cor-tab tab-title="Usage Logs" tab-id="logs" tab-init="$ctrl.showLogs()" ng-if="$ctrl.repository.can_admin">
<i class="fa fa-bar-chart"></i>
</cor-tab>
<cor-tab tab-title="Settings" tab-id="settings" tab-init="$ctrl.showSettings()" ng-if="$ctrl.repository.can_admin">
<i class="fa fa-gear"></i>
</cor-tab>
</cor-tabs>
@ -85,6 +87,12 @@
</div>
</cor-tab-pane>
<!-- Usage Logs-->
<cor-tab-pane id="logs" ng-if="$ctrl.repository.can_admin">
<div class="logs-view" repository="$ctrl.repository" makevisible="$ctrl.logsShown"></div>
</cor-tab-pane>
</cor-tab-content>
<!-- Settings -->
<cor-tab-pane id="settings" ng-if="$ctrl.repository.can_admin">
<div class="repo-panel-settings" repository="$ctrl.repository" is-enabled="$ctrl.settingsShown"></div>
@ -123,4 +131,4 @@
</div>
</div>
</div>
</div>
</div>

View file

@ -11,6 +11,7 @@ import { Input, Component, Inject } from 'ng-metadata/core';
export class AppPublicViewComponent {
@Input('<') public repository: any;
private settingsShown: number = 0;
private logsShown: number = 0;
constructor(@Inject('Config') private Config: any) {
this.updateDescription = this.updateDescription.bind(this);
@ -24,4 +25,8 @@ export class AppPublicViewComponent {
public showSettings(): void {
this.settingsShown++;
}
public showLogs(): void {
this.logsShown++;
}
}

View file

@ -61,6 +61,8 @@ angular.module('quay').directive('logsView', function () {
'push_repo': function(metadata) {
if (metadata.tag) {
return 'Push of {tag} to repository {namespace}/{repo}';
} else if (metadata.release) {
return 'Push of {release} to repository {namespace}/{repo}';
} else {
return 'Repository push to {namespace}/{repo}';
}
@ -91,6 +93,15 @@ angular.module('quay').directive('logsView', function () {
description = 'tag {tag} from repository {namespace}/{repo}';
} else if (metadata.manifest_digest) {
description = 'digest {manifest_digest} from repository {namespace}/{repo}';
} else if (metadata.release) {
description = 'release {release}';
if (metadata.channel) {
description += ' via channel {channel}';
}
if (metadata.mediatype) {
description += ' for {mediatype}';
}
description += ' from repository {namespace}/{repo}';
}
if (metadata.token) {