tobias-istvan closed pull request #39: [AMBARI-24945] [Log Search UI] Handling
null or undefined value in log's level property.
URL: https://github.com/apache/ambari-logsearch/pull/39
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/ambari-logsearch-web/src/app/components/log-level/log-level.component.html
b/ambari-logsearch-web/src/app/components/log-level/log-level.component.html
index d72c9d3344..c2584a645d 100644
--- a/ambari-logsearch-web/src/app/components/log-level/log-level.component.html
+++ b/ambari-logsearch-web/src/app/components/log-level/log-level.component.html
@@ -15,4 +15,4 @@
limitations under the License.
-->
<i class="fa {{cssClass}}"></i>
-{{logEntry.level}}
+{{('levels.' + (logEntry.level || 'unknown').toLowerCase()) | translate}}
diff --git
a/ambari-logsearch-web/src/app/components/log-level/log-level.component.spec.ts
b/ambari-logsearch-web/src/app/components/log-level/log-level.component.spec.ts
index c13d373956..a735138e54 100644
---
a/ambari-logsearch-web/src/app/components/log-level/log-level.component.spec.ts
+++
b/ambari-logsearch-web/src/app/components/log-level/log-level.component.spec.ts
@@ -14,11 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {DebugElement} from '@angular/core';
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import { DebugElement } from '@angular/core';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import {LogLevelComponent} from './log-level.component';
-import {By} from '@angular/platform-browser';
+import { LogLevelComponent } from './log-level.component';
+import { By } from '@angular/platform-browser';
+
+import { TranslationModules } from '@app/test-config.spec';
describe('LogLevelComponent', () => {
let component: LogLevelComponent;
@@ -37,6 +39,9 @@ describe('LogLevelComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
+ imports: [
+ ...TranslationModules
+ ],
declarations: [ LogLevelComponent ]
})
.compileComponents();
diff --git
a/ambari-logsearch-web/src/app/components/service-logs-table/service-logs-table.component.html
b/ambari-logsearch-web/src/app/components/service-logs-table/service-logs-table.component.html
index 31375ed127..ee6b0da851 100644
---
a/ambari-logsearch-web/src/app/components/service-logs-table/service-logs-table.component.html
+++
b/ambari-logsearch-web/src/app/components/service-logs-table/service-logs-table.component.html
@@ -95,7 +95,7 @@
{{log.logtime | amTz: timeZone | amDateFormat: timeFormat}}
</time>
</td>
- <td *ngIf="isColumnDisplayed('level')" [ngClass]="'log-level ' +
log.level.toLowerCase()">
+ <td *ngIf="isColumnDisplayed('level')" [ngClass]="'log-level ' +
(log.level ? log.level.toLowerCase() : '')">
<log-level [logEntry]="log"></log-level>
</td>
<td *ngIf="isColumnDisplayed('type')" [ngClass]="'log-type'">
@@ -138,7 +138,7 @@
<dropdown-button iconClass="fa fa-ellipsis-v action"
[hideCaret]="true" [options]="logActions"
[listItemArguments]="[log]"
[showSelectedValue]="false"></dropdown-button>
</div>
- <div *ngIf="isColumnDisplayed('level')" [ngClass]="'log-level '
+ log.level.toLowerCase()">
+ <div *ngIf="isColumnDisplayed('level')" [ngClass]="'log-level '
+ (log.level ? log.level.toLowerCase() : '')">
<log-level [logEntry]="log"></log-level>
</div>
<div *ngIf="isColumnDisplayed('type')" [ngClass]="'log-type'"
[title]="log.type">
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services