Skip to content

Commit

Permalink
fix(web-app-template): Auto-resolve eslint issues
Browse files Browse the repository at this point in the history
Automatically resolve issues flagged by eslint by running `eslint . --fix`.

Signed-off-by: Thomas Steenbergen <[email protected]>
  • Loading branch information
tsteenbe committed Apr 9, 2024
1 parent bcaff15 commit a4b8872
Show file tree
Hide file tree
Showing 30 changed files with 674 additions and 662 deletions.
85 changes: 45 additions & 40 deletions plugins/reporters/web-app-template/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,35 @@
* License-Filename: LICENSE
*/

import React, { Component } from 'react';
import { Component } from 'react';

import {
ControlOutlined,
PartitionOutlined,
PieChartOutlined,
TableOutlined
} from '@ant-design/icons';
import {
Alert,
Col,
Progress,
Row,
Tabs
} from 'antd';
import {
ControlOutlined,
PartitionOutlined,
PieChartOutlined,
TableOutlined
} from '@ant-design/icons';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';

import { connect } from 'react-redux';

import AboutModal from './components/AboutModal';
import SummaryView from './components/SummaryView';
import TableView from './components/TableView';
import TreeView from './components/TreeView';
import './App.css';
import store from './store';
import {
getAppView,
getOrtResult
} from './reducers/selectors';
import store from './store';

class ReporterApp extends Component {
constructor(props) {
Expand Down Expand Up @@ -70,18 +73,18 @@ class ReporterApp extends Component {
} = this.props;

switch (showKey) {
case 'ort-tabs-summary':
case 'ort-tabs-table':
case 'ort-tabs-tree':
case 'ort-tabs': {
return (
case 'ort-tabs-summary':
case 'ort-tabs-table':
case 'ort-tabs-tree':
case 'ort-tabs': {
return (
<Row
className="ort-app"
key="ort-tabs"
>
<Col span={24}>
{
showAboutModal && (<AboutModal webAppOrtResult={webAppOrtResult} />)
!!showAboutModal && <AboutModal webAppOrtResult={webAppOrtResult} />
}
<Tabs
activeKey={showKey}
Expand All @@ -94,7 +97,7 @@ class ReporterApp extends Component {
Summary
</span>
),
key: "ort-tabs-summary",
key: 'ort-tabs-summary',
children: (
<SummaryView />
)
Expand All @@ -106,7 +109,7 @@ class ReporterApp extends Component {
Table
</span>
),
key: "ort-tabs-table",
key: 'ort-tabs-table',
children: (
<TableView />
)
Expand All @@ -118,31 +121,31 @@ class ReporterApp extends Component {
Tree
</span>
),
key: "ort-tabs-tree",
key: 'ort-tabs-tree',
children: (
<TreeView />
)
}
]}
onChange={this.onChangeTab}
tabBarExtraContent={(
<ControlOutlined
className="ort-control"
onClick={this.onClickAbout}
/>
)}
onChange={this.onChangeTab}
/>
</Col>
</Row>
);
}
case 'ort-loading': {
const {
percentage: loadingPercentage,
text: loadingText
} = loading;
);
}
case 'ort-loading': {
const {
percentage: loadingPercentage,
text: loadingText
} = loading;

return (
return (
<Row
align="middle"
justify="space-around"
Expand All @@ -161,17 +164,19 @@ class ReporterApp extends Component {
<span>
{loadingText}
</span>
{loadingPercentage === 100 ? (
{loadingPercentage === 100
? (
<Progress percent={100} />
) : (
)
: (
<Progress percent={loadingPercentage} status="active" />
)}
)}
</Col>
</Row>
);
}
case 'ort-no-report-data':
return (
);
}
case 'ort-no-report-data':
return (
<Row
align="middle"
className="ort-app"
Expand All @@ -182,6 +187,7 @@ class ReporterApp extends Component {
<Col span={8}>
<Alert
message="No review results could be loaded..."
type="error"
description={(
<div>
<p>
Expand All @@ -201,13 +207,12 @@ class ReporterApp extends Component {
</p>
</div>
)}
type="error"
/>
</Col>
</Row>
);
default:
return (
);
default:
return (
<Row
align="middle"
className="ort-app"
Expand All @@ -218,6 +223,7 @@ class ReporterApp extends Component {
<Col span={8}>
<Alert
message="Oops, something went wrong..."
type="error"
description={(
<div>
<p>
Expand All @@ -238,11 +244,10 @@ class ReporterApp extends Component {
</p>
</div>
)}
type="error"
/>
</Col>
</Row>
);
);
}
}
}
Expand Down
38 changes: 19 additions & 19 deletions plugins/reporters/web-app-template/src/components/AboutModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@
* License-Filename: LICENSE
*/

import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import {
Descriptions,
Modal,
Tabs
} from 'antd';
import {
FileTextOutlined,
InfoCircleOutlined,
TagsOutlined
} from '@ant-design/icons';
import { Light as SyntaxHighlighter } from 'react-syntax-highlighter';
import lioshi from 'react-syntax-highlighter/dist/esm/styles/hljs/lioshi';
import {
Descriptions,
Modal,
Tabs
} from 'antd';
import PropTypes from 'prop-types';
import yaml from 'react-syntax-highlighter/dist/esm/languages/hljs/yaml';
import lioshi from 'react-syntax-highlighter/dist/esm/styles/hljs/lioshi';

import { connect } from 'react-redux';
import { Light as SyntaxHighlighter } from 'react-syntax-highlighter';

import {
getOrtResult
} from '../reducers/selectors';
Expand All @@ -42,8 +43,7 @@ const { Item } = Descriptions;

SyntaxHighlighter.registerLanguage('yaml', yaml);

const AboutModal = (props) => {
const { webAppOrtResult } = props;
const AboutModal = ({ webAppOrtResult }) => {
const { repositoryConfiguration } = webAppOrtResult;
const {
labels,
Expand Down Expand Up @@ -76,7 +76,7 @@ const AboutModal = (props) => {
<Tabs
animated={false}
items={(() => {
var tabItems = [];
const tabItems = [];

if (webAppOrtResult.hasRepositoryConfiguration()) {
tabItems.push({
Expand All @@ -86,11 +86,11 @@ const AboutModal = (props) => {
Excludes (.ort.yml)
</span>
),
key: "ort-tabs-excludes",
key: 'ort-tabs-excludes',
children: (
<SyntaxHighlighter
language="yaml"
showLineNumbers
showLineNumbers={true}
style={lioshi}
>
{repositoryConfiguration}
Expand All @@ -107,10 +107,10 @@ const AboutModal = (props) => {
Labels
</span>
),
key: "ort-tabs-labels",
key: 'ort-tabs-labels',
children: (
<Descriptions
bordered
bordered={true}
column={1}
size="small"
>
Expand All @@ -130,7 +130,7 @@ const AboutModal = (props) => {
>
{value}
</a>
)
)
: value
}
</Item>
Expand All @@ -148,7 +148,7 @@ const AboutModal = (props) => {
About
</span>
),
key: "ort-tabs-about",
key: 'ort-tabs-about',
children: (
<span>
<a
Expand Down
Loading

0 comments on commit a4b8872

Please sign in to comment.