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

Remove import jobs stats from /health/info #1336

Merged
merged 5 commits into from
Sep 26, 2024
Merged
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
95 changes: 0 additions & 95 deletions app/services/health/fetch-import-jobs.service.js

This file was deleted.

31 changes: 5 additions & 26 deletions app/services/health/info.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,23 @@ const exec = util.promisify(ChildProcess.exec)

const ChargingModuleRequest = require('../../requests/charging-module.request.js')
const CreateRedisClientService = require('./create-redis-client.service.js')
const FetchImportJobsService = require('./fetch-import-jobs.service.js')
const FetchSystemInfoService = require('./fetch-system-info.service.js')
const { formatLongDateTime } = require('../../presenters/base.presenter.js')
const BaseRequest = require('../../requests/base.request.js')
const LegacyRequest = require('../../requests/legacy.request.js')

const servicesConfig = require('../../../config/services.config.js')

/**
* Checks status and gathers info for each of the services which make up WRLS
*
* Returns data required to populate our `/service-status` page, eg. task activity status, virus checker status, service
* version numbers, etc.
*
* Each data set is returned in the format needed to populate the gov.uk table elements ie. an array containing one
* array per row, where each row array contains multiple `{ text: '...' }` elements, one for each cell in the row.
*/
*
* @returns {object} data about each service formatted for the view
*/
async function go () {
const addressFacadeData = await _getAddressFacadeData()
const chargingModuleData = await _getChargingModuleData()
Expand Down Expand Up @@ -83,7 +85,6 @@ async function _getLegacyAppData () {
if (result.succeeded) {
service.version = result.response.body.version
service.commit = result.response.body.commit
service.jobs = service.name === 'Import' ? await _getImportJobsData() : []
} else {
service.version = _parseFailedRequestResult(result)
service.commit = ''
Expand All @@ -103,16 +104,6 @@ async function _getChargingModuleData () {
return _parseFailedRequestResult(result)
}

async function _getImportJobsData () {
try {
const importJobs = await FetchImportJobsService.go()

return _mapArrayToTextCells(importJobs)
} catch (error) {
return []
}
}

async function _getRedisConnectivityData () {
let redis

Expand Down Expand Up @@ -141,18 +132,6 @@ async function _getVirusScannerData () {
}
}

function _mapArrayToTextCells (rows) {
return rows.map((row) => {
return [
...[{ text: row.name }],
...[{ text: row.completedCount }],
...[{ text: row.failedCount }],
...[{ text: row.activeCount }],
...[{ text: row.maxCompletedonDate ? formatLongDateTime(row.maxCompletedonDate) : '-' }]
]
})
}

function _parseFailedRequestResult (result) {
if (result.response.statusCode) {
return `ERROR: ${result.response.statusCode} - ${result.response.body}`
Expand Down
63 changes: 19 additions & 44 deletions app/views/info.njk
Original file line number Diff line number Diff line change
Expand Up @@ -26,55 +26,30 @@
<p class="govuk-body">{{ chargingModuleData }}</p>

{% for app in appData %}
<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">
<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">

<h2 class="govuk-heading-m">{{ app.name }}</h2>
{{ govukSummaryList({
classes: 'govuk-summary-list--no-border',
rows: [
{
key: {
text: "Version"
},
value: {
text: app.version
}
},
{
key: {
text: "Commit hash"
},
value: {
text: app.commit
}
}
]
}) }}

{% if app.jobs.length %}
{{ govukTable({
firstCellIsHeader: false,
head: [
<h2 class="govuk-heading-m">{{ app.name }}</h2>
{{ govukSummaryList({
classes: 'govuk-summary-list--no-border',
rows: [
{
text: "Import task name (data for the last 24 hrs)"
key: {
text: "Version"
},
value: {
text: app.version
}
},
{
text: "Completed"
},
{
text: "Failed"
},
{
text: "Active"
},
{
text: "Last job completed"
key: {
text: "Commit hash"
},
value: {
text: app.commit
}
}
],
rows: app.jobs
]
}) }}
{% endif %}

{% endfor %}
{% endfor %}
</div>
{% endblock %}
Loading
Loading