[GitHub] [flink] hsuanxyz commented on a change in pull request #11498: [FLINK-16741][WEB] add tm log list & tm log detail page

2020-03-24 Thread GitBox
hsuanxyz commented on a change in pull request #11498: [FLINK-16741][WEB] add 
tm log list & tm log detail page
URL: https://github.com/apache/flink/pull/11498#discussion_r397019592
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/task-manager/log-detail/task-manager-log-detail.component.html
 ##
 @@ -0,0 +1,34 @@
+
+
+
+  
+
+   Log List
 
 Review comment:
   ```suggestion
 
Log List
 
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [flink] hsuanxyz commented on a change in pull request #11498: [FLINK-16741][WEB] add tm log list & tm log detail page

2020-03-24 Thread GitBox
hsuanxyz commented on a change in pull request #11498: [FLINK-16741][WEB] add 
tm log list & tm log detail page
URL: https://github.com/apache/flink/pull/11498#discussion_r397023871
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/task-manager/log-detail/task-manager-log-detail.component.ts
 ##
 @@ -0,0 +1,89 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ */
+
+import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, 
ViewChild } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+import { TaskManagerDetailInterface } from 'interfaces';
+import { TaskManagerService } from 'services';
+import { first } from 'rxjs/operators';
+import { MonacoEditorComponent } from 
'share/common/monaco-editor/monaco-editor.component';
+
+@Component({
+  selector: 'flink-task-manager-log-detail',
+  templateUrl: './task-manager-log-detail.component.html',
+  changeDetection: ChangeDetectionStrategy.OnPush,
+  host: {
+'[class.full-screen]': 'isFullScreen'
+  },
+  styleUrls: ['./task-manager-log-detail.component.less']
+})
+export class TaskManagerLogDetailComponent implements OnInit {
+  logs = '';
+  logName = '';
+  downloadUrl = '';
+  isLoading = false;
+  taskManagerDetail: TaskManagerDetailInterface;
+  isFullScreen = false;
+  hasLogName = false;
+  @ViewChild(MonacoEditorComponent) monacoEditorComponent: 
MonacoEditorComponent;
+
+  constructor(
+private taskManagerService: TaskManagerService,
+private cdr: ChangeDetectorRef,
+private activatedRoute: ActivatedRoute
+  ) {}
+
+  reloadLog() {
+this.isLoading = true;
+this.cdr.markForCheck();
+this.taskManagerService.loadLog(this.taskManagerDetail.id, this.logName, 
this.hasLogName).subscribe(
+  data => {
+this.logs = data.data;
+this.downloadUrl = data.url;
+this.isLoading = false;
+this.layoutEditor();
+this.cdr.markForCheck();
+  },
+  () => {
+this.isLoading = false;
+this.layoutEditor();
+this.cdr.markForCheck();
+  }
+);
+  }
+
+  toggleFullScreen(fullScreen: boolean) {
+this.isFullScreen = fullScreen;
+this.layoutEditor();
+  }
+
+  layoutEditor(): void {
+setTimeout(() => this.monacoEditorComponent.layout());
+  }
+
+  ngOnInit() {
+this.hasLogName = this.activatedRoute.snapshot.data.hasLogName;
+if (this.hasLogName) {
+  this.logName = this.activatedRoute.snapshot.params.logName;
+} else {
+  this.logName = 'taskmanager.log';
 
 Review comment:
   Use a constant? 
   like this
   ```ts
   const DEFAULT_LOG_NAME = 'taskmanager.log';
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [flink] hsuanxyz commented on a change in pull request #11498: [FLINK-16741][WEB] add tm log list & tm log detail page

2020-03-24 Thread GitBox
hsuanxyz commented on a change in pull request #11498: [FLINK-16741][WEB] add 
tm log list & tm log detail page
URL: https://github.com/apache/flink/pull/11498#discussion_r397022035
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/share/customize/refresh-download/refresh-download.component.html
 ##
 @@ -16,7 +16,18 @@
   ~ limitations under the License.
   -->
 
-
-  
-  
-
+Loading...
+
+   
Reload
+
+
+ Download
+
+
+  
 
 Review comment:
   ```suggestion
 
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [flink] hsuanxyz commented on a change in pull request #11498: [FLINK-16741][WEB] add tm log list & tm log detail page

2020-03-24 Thread GitBox
hsuanxyz commented on a change in pull request #11498: [FLINK-16741][WEB] add 
tm log list & tm log detail page
URL: https://github.com/apache/flink/pull/11498#discussion_r397020975
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/task-manager/log-list/task-manager-log-list.component.ts
 ##
 @@ -0,0 +1,51 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ */
+
+import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from 
'@angular/core';
+import { first, flatMap } from 'rxjs/operators';
+import { TaskManagerService } from 'services';
+
+@Component({
+  selector: 'flink-task-manager-log-list',
+  templateUrl: './task-manager-log-list.component.html',
+  changeDetection: ChangeDetectionStrategy.OnPush,
+  styleUrls: ['./task-manager-log-list.component.less']
 
 Review comment:
   ```suggestion
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [flink] hsuanxyz commented on a change in pull request #11498: [FLINK-16741][WEB] add tm log list & tm log detail page

2020-03-24 Thread GitBox
hsuanxyz commented on a change in pull request #11498: [FLINK-16741][WEB] add 
tm log list & tm log detail page
URL: https://github.com/apache/flink/pull/11498#discussion_r397024956
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/services/task-manager.service.ts
 ##
 @@ -50,25 +50,38 @@ export class TaskManagerService {
   }
 
   /**
-   * Load TM logs
+   * Load TM log list
* @param taskManagerId
*/
-  loadLogs(taskManagerId: string) {
-return 
this.httpClient.get(`${BASE_URL}/taskmanagers/${taskManagerId}/log`, {
-  responseType: 'text',
-  headers: new HttpHeaders().append('Cache-Control', 'no-cache')
-});
+  loadLogList(taskManagerId: string) {
+return this.httpClient
+  .get<{ logs: Array<{ name: string; size: number }> 
}>(`${BASE_URL}/taskmanagers/${taskManagerId}/logs`)
 
 Review comment:
   extract to a TS interface.
   ```suggestion
 .get<{ logs: TaskLog[] 
}>(`${BASE_URL}/taskmanagers/${taskManagerId}/logs`)
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [flink] hsuanxyz commented on a change in pull request #11498: [FLINK-16741][WEB] add tm log list & tm log detail page

2020-03-24 Thread GitBox
hsuanxyz commented on a change in pull request #11498: [FLINK-16741][WEB] add 
tm log list & tm log detail page
URL: https://github.com/apache/flink/pull/11498#discussion_r397020694
 
 

 ##
 File path: 
flink-runtime-web/web-dashboard/src/app/pages/task-manager/log-list/task-manager-log-list.component.less
 ##
 @@ -0,0 +1,16 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ */
+
 
 Review comment:
   ```suggestion
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services