diff --git a/backend/backend/api/monitor.js b/backend/backend/api/monitor.js index 2ceecbcb14..52abed85e7 100755 --- a/backend/backend/api/monitor.js +++ b/backend/backend/api/monitor.js @@ -369,15 +369,6 @@ router.put( data, unsetData ); - // if ( - // data.lighthouseScanStatus && - // data.lighthouseScanStatus === 'scan' - // ) { - // await LighthouseLogService.updateManyBy( - // { monitorId: req.params.monitorId }, - // { scanning: true } - // ); - // } if (monitor) { return sendItemResponse(req, res, monitor); } else { diff --git a/backend/backend/api/probe.js b/backend/backend/api/probe.js index 39d7e0af30..dd1ff62c95 100755 --- a/backend/backend/api/probe.js +++ b/backend/backend/api/probe.js @@ -335,7 +335,8 @@ router.post('/ping/:monitorId', isAuthorizedProbe, async function( ); await LighthouseLogService.updateAllLighthouseLogs( data.monitor.projectId, - data.monitorId + data.monitorId, + { scanning: true } ); } else { await MonitorService.updateOneBy( diff --git a/backend/backend/services/lighthouseLogService.js b/backend/backend/services/lighthouseLogService.js index 3b94b4835b..9d4d95ddcd 100644 --- a/backend/backend/services/lighthouseLogService.js +++ b/backend/backend/services/lighthouseLogService.js @@ -204,12 +204,9 @@ module.exports = { throw error; } }, - async updateAllLighthouseLogs(projectId, monitorId) { + async updateAllLighthouseLogs(projectId, monitorId, query) { try { - await this.updateManyBy( - { monitorId: monitorId }, - { scanning: true } - ); + await this.updateManyBy({ monitorId: monitorId }, query); const logs = await this.findLastestScan({ monitorId, url: null, diff --git a/dashboard/src/actions/monitor.js b/dashboard/src/actions/monitor.js index 33f99854ff..de494a37d2 100755 --- a/dashboard/src/actions/monitor.js +++ b/dashboard/src/actions/monitor.js @@ -228,7 +228,6 @@ export function editMonitorSuccess(newMonitor) { if (newMonitor.lighthouseScanStatus === 'scanning') { fetchLighthouseLogs(newMonitor.projectId._id, newMonitor._id, 0, 5); } - console.log(newMonitor.lighthouseScanStatus, 'edit monitor'); return { type: types.EDIT_MONITOR_SUCCESS, payload: newMonitor, @@ -854,7 +853,6 @@ export function getMonitorLogsFailure(error) { // Fetch Lighthouse Logs list export function fetchLighthouseLogs(projectId, monitorId, skip, limit, url) { - console.log('running') return function(dispatch) { const promise = getApi( url diff --git a/dashboard/src/actions/socket.js b/dashboard/src/actions/socket.js index e84a211684..9d9d46e2d0 100755 --- a/dashboard/src/actions/socket.js +++ b/dashboard/src/actions/socket.js @@ -89,7 +89,6 @@ export function updatelighthouselogbysocket(log) { } export function updateAlllighthouselogbysocket(log) { - console.log(log, 'all lighthouse logs') return function(dispatch) { dispatch({ type: 'UPDATE_ALL_LIGHTHOUSE_LOG', diff --git a/dashboard/src/reducers/monitor.js b/dashboard/src/reducers/monitor.js index b379a02c91..dfa8a8f0d6 100755 --- a/dashboard/src/reducers/monitor.js +++ b/dashboard/src/reducers/monitor.js @@ -1085,6 +1085,14 @@ export default function monitor(state = INITIAL_STATE, action) { monitor.monitors = monitor._id === action.payload.projectId ? monitor.monitors.map(monitor => { + if ( + monitor.data && + monitor.data.url === + action.payload.data.url + ) { + monitor.currentLighthouseLog = + action.payload.data; + } if ( monitor._id === action.payload.monitorId diff --git a/status-page/package.json b/status-page/package.json index 8ff0eff4a8..719e538ce7 100755 --- a/status-page/package.json +++ b/status-page/package.json @@ -44,7 +44,7 @@ "scripts": { "start": "npm run build && node index.js", "build": "react-scripts build", - "dev": "export PORT=3006 && react-scripts start", + "dev": "set PORT=3006 && react-scripts start", "test": "mocha --exit ./src/test/statusPage.test.js", "eject": "react-scripts eject", "snapshots": "cross-env CI=true react-scripts test --env=jsdom --coverage --coverage",