Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Analysis is hidden if W3C Validator is not enabled + fix #10 #33

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EcoSonar-API/services/exportAuditService.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function formatExcelSheet (urlName, index, workbook, projectName, analysis, date
if (urlName !== '') {
sheet = workbook.addWorksheet('url' + index)
} else {
sheet = workbook.addWorksheet(projectName)
sheet = workbook.addWorksheet(projectName.replace(":", " "))
}
let row = sheet.getRow(1)
row.getCell(1).value = 'EcoSonar Analysis'
Expand Down
1 change: 1 addition & 0 deletions EcoSonar-API/services/retrieveAnalysisService.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ RetrieveAnalysisService.prototype.getUrlAnalysis = async function (projectName,
reject(new SystemError())
} else {
const analysis = {
allowW3c: process.env.ECOSONAR_ENV_ALLOW_EXTERNAL_API || 'false',
deployments: {
greenit: greenitAnalysisDeployment,
lighthouse: lighthouseResultDeployment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function AnalysisPanel (props) {
const fileType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
const fileExtension = '.xlsx'
const blob = new Blob([buffer], { type: fileType })
saveAs(blob, './audits' + fileExtension)
saveAs(blob, projectName + ' - EcoSonar Audit' + fileExtension)
setLoading(false)
})
.catch((err) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class AnalysisPerUrlPanel extends React.PureComponent {
})
getAnalysisUrlConfiguration(this.state.projectName, this.state.selectedUrl)
.then((res) => {
if (res !== undefined) {
if (res !== undefined && res.lastAnalysis.greenit !== null && res.lastAnalysis.lighthouse !== null && res.deployments.greenit.length !== 0 && res.deployments.lighthouse.length !== 0) {
this.setState({
greenItLastAnalysis: res.lastAnalysis.greenit,
lighthouseLastAnalysis: res.lastAnalysis.lighthouse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default class EcoSonarAnalysisPage extends React.PureComponent {
initEcoSonarAnalysisPage (projectName) {
getAnalysisForProjectConfiguration(projectName)
.then((analysis) => {
if (analysis !== undefined && analysis.lastAnalysis.greenit !== null && analysis.deployments.greenit.length !== 0) {
if (analysis !== undefined && analysis.lastAnalysis.greenit !== null && analysis.lastAnalysis.lighthouse !== null && (analysis.allowW3c === 'false' || analysis.lastAnalysis.w3c !== null) && analysis.deployments.greenit.length !== 0 && analysis.deployments.lighthouse.length !== 0 && (analysis.allowW3c === 'false' || analysis.deployments.w3c.length !== 0)) {
const dateGreenitLastAnalysis = analysis.lastAnalysis.greenit !== null && analysis.lastAnalysis.greenit.dateAnalysis
? `${new Date(analysis.lastAnalysis.greenit.dateAnalysis).toDateString()} - ${new Date(analysis.lastAnalysis.greenit.dateAnalysis).toLocaleTimeString([], { hour12: false })} `
: null
Expand Down