mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
implemented review suggestions
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user