diff --git a/cypress/integration/list/job-toggle/index.js b/cypress/integration/list/job-toggle/index.js
index 87f9e5d11..d96b7f5ec 100644
--- a/cypress/integration/list/job-toggle/index.js
+++ b/cypress/integration/list/job-toggle/index.js
@@ -20,7 +20,7 @@ Given('the user navigated to the job list page', () => {
})
Given('the job toggle switch is off', () => {
- cy.findByRole('switch', { name: 'Toggle job' }).should('not.be.checked')
+ cy.findByRole('switch', { name: 'Enable' }).should('not.be.checked')
})
When('the user clicks the enabled job toggle switch', () => {
@@ -33,7 +33,7 @@ When('the user clicks the enabled job toggle switch', () => {
{ fixture: 'list/disabled-user-job' }
)
- cy.findByRole('switch', { name: 'Toggle job' }).click()
+ cy.findByRole('switch', { name: 'Disable' }).click()
})
When('the user clicks the disabled job toggle switch', () => {
@@ -46,9 +46,9 @@ When('the user clicks the disabled job toggle switch', () => {
{ fixture: 'list/enabled-user-job' }
)
- cy.findByRole('switch', { name: 'Toggle job' }).click()
+ cy.findByRole('switch', { name: 'Enable' }).click()
})
Then('the job toggle switch is on', () => {
- cy.findByRole('switch', { name: 'Toggle job' }).should('be.checked')
+ cy.findByRole('switch', { name: 'Disable' }).should('be.checked')
})
diff --git a/i18n/en.pot b/i18n/en.pot
index e5017e98e..98fa1b6a8 100644
--- a/i18n/en.pot
+++ b/i18n/en.pot
@@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
-"POT-Creation-Date: 2023-11-16T13:48:39.789Z\n"
-"PO-Revision-Date: 2023-11-16T13:48:39.789Z\n"
+"POT-Creation-Date: 2023-11-16T14:05:43.332Z\n"
+"PO-Revision-Date: 2023-11-16T14:05:43.332Z\n"
msgid "Something went wrong"
msgstr "Something went wrong"
@@ -259,8 +259,11 @@ msgstr ""
"Something went wrong whilst loading the requested job. Make sure it has not "
"been deleted and try refreshing the page."
-msgid "Toggle job"
-msgstr "Toggle job"
+msgid "Disable"
+msgstr "Disable"
+
+msgid "Enable"
+msgstr "Enable"
msgid "New Job"
msgstr "New Job"
diff --git a/src/components/JobTable/JobTableRow.js b/src/components/JobTable/JobTableRow.js
index 18c9b05b9..d73f5b582 100644
--- a/src/components/JobTable/JobTableRow.js
+++ b/src/components/JobTable/JobTableRow.js
@@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import { TableRow, TableCell } from '@dhis2/ui'
import { jobTypesMap } from '../../services/server-translations'
-import { ToggleJobSwitch } from '../Switches'
+import { JobSwitch } from '../Switches'
import JobActions from './JobActions'
import Status from './Status'
import NextRun from './NextRun'
@@ -36,7 +36,7 @@ const JobTableRow = ({
-
- {
+const JobSwitch = ({ id, checked, disabled, refetch }) => {
const [disableQuery] = useState({
resource: `jobConfigurations/${id}/disable`,
type: 'create',
@@ -27,18 +27,18 @@ const ToggleJobSwitch = ({ id, checked, disabled, refetch }) => {
onChange={() => {
toggleJob().then(refetch)
}}
- ariaLabel={i18n.t('Toggle job')}
+ ariaLabel={checked ? i18n.t('Disable') : i18n.t('Enable')}
/>
)
}
const { bool, string, func } = PropTypes
-ToggleJobSwitch.propTypes = {
+JobSwitch.propTypes = {
checked: bool.isRequired,
disabled: bool.isRequired,
id: string.isRequired,
refetch: func.isRequired,
}
-export default ToggleJobSwitch
+export default JobSwitch
diff --git a/src/components/Switches/ToggleJobSwitch.test.js b/src/components/Switches/JobSwitch.test.js
similarity index 90%
rename from src/components/Switches/ToggleJobSwitch.test.js
rename to src/components/Switches/JobSwitch.test.js
index 1de96a98c..b66000251 100644
--- a/src/components/Switches/ToggleJobSwitch.test.js
+++ b/src/components/Switches/JobSwitch.test.js
@@ -2,12 +2,12 @@ import React from 'react'
import waitForExpect from 'wait-for-expect'
import { shallow, mount } from 'enzyme'
import { CustomDataProvider } from '@dhis2/app-runtime'
-import ToggleJobSwitch from './ToggleJobSwitch'
+import JobSwitch from './JobSwitch'
-describe('', () => {
+describe('', () => {
it('renders without errors', () => {
shallow(
- ', () => {
refetch: refetchSpy,
}
const data = { 'jobConfigurations/id/enable': answerSpy }
- const wrapper = mount(, {
+ const wrapper = mount(, {
wrappingComponent: CustomDataProvider,
wrappingComponentProps: { data },
})
@@ -58,7 +58,7 @@ describe('', () => {
refetch: refetchSpy,
}
const data = { 'jobConfigurations/id/disable': answerSpy }
- const wrapper = mount(, {
+ const wrapper = mount(, {
wrappingComponent: CustomDataProvider,
wrappingComponentProps: { data },
})
diff --git a/src/components/Switches/index.js b/src/components/Switches/index.js
index 8987b2795..890554dd9 100644
--- a/src/components/Switches/index.js
+++ b/src/components/Switches/index.js
@@ -1 +1 @@
-export { default as ToggleJobSwitch } from './ToggleJobSwitch'
+export { default as JobSwitch } from './JobSwitch'