Skip to content

Commit

Permalink
review comments changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ananya-agarwal committed Jan 24, 2025
1 parent 6e2fccb commit 4e1e996
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const ServerLogsHeader: React.FC<ServerLogsHeaderProps> = ({
id="wrapLogsToggle"
/>
<label className="server__wrap-logs" htmlFor="wrapLogsToggle">
Wrap logs
{t('Wrap logs')}
</label>

<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

.server__display-logs {
overflow: auto;
height: calc(100vh - 250px);
background-color: $fluidx-white;
width: 100%;
padding: 10px 0 10px 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import React, { useState, useEffect } from 'react';
import React, { useState } from 'react';
import { Spin, Alert } from 'antd';
import ServerLogsHeader from './ServerLogsHeader';
import { i18nReact } from '../../../utils/i18nReact';
import useLoadData from '../../../utils/hooks/useLoadData';
import './ServerLogsTab.scss';
import { SERVER_LOGS_API_URL } from '../utils';

interface ServerLogsData {
logs: string[];
Expand All @@ -36,20 +37,8 @@ const ServerLogs: React.FC = (): JSX.Element => {
loading,
error
//reloadData
} = useLoadData<ServerLogsData>('/api/v1/logs');
} = useLoadData<ServerLogsData>(SERVER_LOGS_API_URL);

useEffect(() => {
const updateSize = () => {
const newHeight = document.documentElement.clientHeight - 250;
const logsComponent = document.querySelector('.server__display-logs') as HTMLElement;
if (logsComponent) {
logsComponent.style.height = `${newHeight}px`;
}
};
updateSize();
window.addEventListener('resize', updateSize);
return () => window.removeEventListener('resize', updateSize);
}, []);

Check failure on line 42 in desktop/core/src/desktop/js/apps/admin/ServerLogs/ServerLogsTab.tsx

View workflow job for this annotation

GitHub Actions / build

Delete `⏎`
const highlightText = (text: string, searchValue: string) => {
if (!searchValue) {
Expand All @@ -73,7 +62,7 @@ const ServerLogs: React.FC = (): JSX.Element => {
<div className="server-logs-component">
<Alert
message={t(`Error: ${error}`)}
description="An error occurred while fetching server logs."
description={t("An error occurred while fetching server logs.")}

Check failure on line 65 in desktop/core/src/desktop/js/apps/admin/ServerLogs/ServerLogsTab.tsx

View workflow job for this annotation

GitHub Actions / build

Replace `"An·error·occurred·while·fetching·server·logs."` with `'An·error·occurred·while·fetching·server·logs.'`
type="error"
/>
</div>
Expand Down
17 changes: 17 additions & 0 deletions desktop/core/src/desktop/js/apps/admin/utils.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Licensed to Cloudera, Inc. under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. Cloudera, Inc. 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.

export const SERVER_LOGS_API_URL = '/api/v1/logs';

Check failure on line 17 in desktop/core/src/desktop/js/apps/admin/utils.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `⏎`

0 comments on commit 4e1e996

Please sign in to comment.