Skip to content

Commit

Permalink
feat: Analysis is hidden if W3C Validator is not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume DESPREZ (T0128193) committed Jun 6, 2024
1 parent e2a9981 commit 2f3dc62
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
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 @@ -66,7 +66,7 @@ export default class AnalysisPerUrlPanel extends React.PureComponent {
})
getAnalysisUrlConfiguration(this.state.projectName, this.state.selectedUrl)
.then((res) => {
if (res !== undefined && res.lastAnalysis.greenit !== null && res.lastAnalysis.lighthouse !== null && res.lastAnalysis.w3c !== null && res.deployments.greenit.length !== 0 && res.deployments.lighthouse.length !== 0 && res.deployments.lighthouse.w3c !== 0) {
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.lastAnalysis.lighthouse !== null && analysis.lastAnalysis.w3c !== null && analysis.deployments.greenit.length !== 0 && analysis.deployments.lighthouse.length !== 0 && analysis.deployments.lighthouse.w3c !== 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.lighthouse.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

0 comments on commit 2f3dc62

Please sign in to comment.