Merge pull request #2480 from wknet123/master-log-query-params

Update audit log query params.
This commit is contained in:
Steven Zou 2017-06-09 14:54:47 +08:00 committed by GitHub
commit 6cee61cb23
3 changed files with 16 additions and 17 deletions

View File

@ -151,7 +151,7 @@ export class AuditLogComponent implements OnInit {
for(var i in this.filterOptions) {
let filterOption = this.filterOptions[i];
if(filterOption.checked) {
operationFilter.push(this.filterOptions[i].key);
operationFilter.push('operation=' + this.filterOptions[i].key);
}else{
selectAll = false;
}
@ -159,7 +159,7 @@ export class AuditLogComponent implements OnInit {
if(selectAll) {
operationFilter = [];
}
this.queryParam.keywords = operationFilter.join('/');
this.queryParam.keywords = operationFilter.join('&');
this.retrieve();
}

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { Injectable } from '@angular/core';
import { Http, Headers, RequestOptions } from '@angular/http';
import { Http, Headers, RequestOptions, URLSearchParams } from '@angular/http';
import { AuditLog } from './audit-log';
@ -35,15 +35,14 @@ export class AuditLogService {
constructor(private http: Http) {}
listAuditLogs(queryParam: AuditLog): Observable<any> {
let params: URLSearchParams = new URLSearchParams(queryParam.keywords);
params.set('begin_timestamp', <string>queryParam.begin_timestamp);
params.set('end_timestamp', <string>queryParam.end_timestamp);
params.set('username', queryParam.username);
params.set('page', <string>queryParam.page);
params.set('page_size', <string>queryParam.page_size);
return this.http
.post(`/api/projects/${queryParam.project_id}/logs/filter?page=${queryParam.page}&page_size=${queryParam.page_size}`, {
begin_timestamp: queryParam.begin_timestamp,
end_timestamp: queryParam.end_timestamp,
keywords: queryParam.keywords,
operation: queryParam.operation,
project_id: queryParam.project_id,
username: queryParam.username
})
.get(`/api/projects/${queryParam.project_id}/logs`, {params: params})
.map(response => response)
.catch(error => Observable.throw(error));
}

View File

@ -30,18 +30,18 @@
}
*/
export class AuditLog {
log_id: number;
project_id: number;
log_id: number | string;
project_id: number | string;
username: string;
repo_name: string;
repo_tag: string;
operation: string;
op_time: Date;
begin_timestamp: number = 0;
end_timestamp: number = 0;
begin_timestamp: number | string;
end_timestamp: number | string;
keywords: string;
page: number;
page_size: number;
page: number | string;
page_size: number | string;
fromTime: string;
toTime: string;
}