Skip to content

Commit

Permalink
fix(condo): DOMA-6736 rename onlyProgressionMeterReadingsIsEnabled to…
Browse files Browse the repository at this point in the history
… onlyGreaterThanPreviousMeterReadingIsEnabled
  • Loading branch information
VKislov committed Aug 2, 2023
1 parent b2f1844 commit c14a6fa
Show file tree
Hide file tree
Showing 16 changed files with 120 additions and 120 deletions.
2 changes: 1 addition & 1 deletion apps/condo/domains/settings/access/MobileFeatureConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyProgressionMeterReadingsIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyGreaterThanPreviousMeterReadingIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
*/

const { uniq, map, get } = require('lodash')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export const OnlyProgressionMeterReadingsForm: React.FC<ITicketSubmittingSetting
const EnableMessage = intl.formatMessage({ id: 'pages.condo.settings.mobileFeatureConfig.OnlyProgressionMeterReadings.isEnabled' })

const router = useRouter()
const [onlyProgressionMeterReadingsIsEnabled, setOnlyProgressionMeterReadingsIsEnabled] = useState<boolean>(get(mobileConfig, 'onlyProgressionMeterReadingsIsEnabled'))
const [onlyGreaterThanPreviousMeterReadingIsEnabled, setonlyGreaterThanPreviousMeterReadingIsEnabled] = useState<boolean>(get(mobileConfig, 'onlyGreaterThanPreviousMeterReadingIsEnabled'))

const initialValues = {
onlyProgressionMeterReadingsIsEnabled: get(mobileConfig, 'onlyProgressionMeterReadingsIsEnabled'),
onlyGreaterThanPreviousMeterReadingIsEnabled: get(mobileConfig, 'onlyGreaterThanPreviousMeterReadingIsEnabled'),
}

const updateHook = MobileFeatureConfig.useUpdate({}, () => router.push('/settings?tab=mobileFeatureConfig'))
Expand All @@ -64,7 +64,7 @@ export const OnlyProgressionMeterReadingsForm: React.FC<ITicketSubmittingSetting
values.organization = { connect: { id: userOrganizationId } }
}

values.onlyProgressionMeterReadingsIsEnabled = onlyProgressionMeterReadingsIsEnabled
values.onlyGreaterThanPreviousMeterReadingIsEnabled = onlyGreaterThanPreviousMeterReadingIsEnabled

return values
}}
Expand All @@ -80,16 +80,16 @@ export const OnlyProgressionMeterReadingsForm: React.FC<ITicketSubmittingSetting
</Col>
<Col span={24}>
<Form.Item
name='onlyProgressionMeterReadingsIsEnabled'
name='onlyGreaterThanPreviousMeterReadingIsEnabled'
label={EnableMessage}
labelAlign='left'
{...INPUT_LAYOUT_PROPS}
valuePropName='checked'
initialValue={onlyProgressionMeterReadingsIsEnabled}
initialValue={onlyGreaterThanPreviousMeterReadingIsEnabled}
>
<Checkbox
onChange={() => {
setOnlyProgressionMeterReadingsIsEnabled(!onlyProgressionMeterReadingsIsEnabled)
setonlyGreaterThanPreviousMeterReadingIsEnabled(!onlyGreaterThanPreviousMeterReadingIsEnabled)
}}
/>
</Form.Item>
Expand Down Expand Up @@ -117,5 +117,5 @@ export const OnlyProgressionMeterReadingsForm: React.FC<ITicketSubmittingSetting
</Row>
)}
</FormWithAction>
), [action, mobileConfig, onlyProgressionMeterReadingsIsEnabled])
), [action, mobileConfig, onlyGreaterThanPreviousMeterReadingIsEnabled])
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ export const OnlyProgressionMeterReadingsSettingCard: React.FC<OnlyProgressionMe
const intl = useIntl()
const OnlyProgressionMeterReadingsTitle = intl.formatMessage({ id: 'pages.condo.settings.barItem.MobileFeatureConfig.OnlyProgressionMeterReadings.title' })
const OnlyProgressionMeterReadingsIsDisabledLabel = intl.formatMessage({ id: 'pages.condo.settings.barItem.MobileFeatureConfig.OnlyProgressionMeterReadings.isDisabled' })
const OnlyProgressionMeterReadingsIsEnabledLabel = intl.formatMessage({ id: 'pages.condo.settings.barItem.MobileFeatureConfig.OnlyProgressionMeterReadings.isEnabled' })
const onlyGreaterThanPreviousMeterReadingIsEnabledLabel = intl.formatMessage({ id: 'pages.condo.settings.barItem.MobileFeatureConfig.OnlyProgressionMeterReadings.isEnabled' })

const router = useRouter()

const handleClickCard = useCallback(() => {
router.push(TICKET_DISABLING_SETTINGS_URL)
}, [router])

const isEnabled = get(mobileConfig, 'onlyProgressionMeterReadingsIsEnabled')
const isEnabled = get(mobileConfig, 'onlyGreaterThanPreviousMeterReadingIsEnabled')

return (
<SettingCard title={OnlyProgressionMeterReadingsTitle} onClick={handleClickCard}>
<Typography.Text type='secondary' >
{isEnabled ? OnlyProgressionMeterReadingsIsEnabledLabel : OnlyProgressionMeterReadingsIsDisabledLabel}
{isEnabled ? onlyGreaterThanPreviousMeterReadingIsEnabledLabel : OnlyProgressionMeterReadingsIsDisabledLabel}
</Typography.Text>
</SettingCard>
)
Expand Down
2 changes: 1 addition & 1 deletion apps/condo/domains/settings/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyProgressionMeterReadingsIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyGreaterThanPreviousMeterReadingIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
*/

const MOBILE_FEATURE_CONFIGURATION = 'mobile-feature-configuration'
Expand Down
4 changes: 2 additions & 2 deletions apps/condo/domains/settings/gql.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyProgressionMeterReadingsIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyGreaterThanPreviousMeterReadingIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* In most cases you should not change it by hands
* Please, don't remove `AUTOGENERATE MARKER`s
*/
Expand All @@ -11,7 +11,7 @@ const { generateGqlQueries } = require('@open-condo/codegen/generate.gql')

const COMMON_FIELDS = 'id dv sender { dv fingerprint } v deletedAt newId createdBy { id name } updatedBy { id name } createdAt updatedAt'

const MOBILE_FEATURE_CONFIG_FIELDS = `{ organization { id } commonPhone onlyProgressionMeterReadingsIsEnabled ticketSubmittingIsDisabled meta ${COMMON_FIELDS} }`
const MOBILE_FEATURE_CONFIG_FIELDS = `{ organization { id } commonPhone onlyGreaterThanPreviousMeterReadingIsEnabled ticketSubmittingIsDisabled meta ${COMMON_FIELDS} }`
const MobileFeatureConfig = generateGqlQueries('MobileFeatureConfig', MOBILE_FEATURE_CONFIG_FIELDS)

/* AUTOGENERATE MARKER <CONST> */
Expand Down
4 changes: 2 additions & 2 deletions apps/condo/domains/settings/schema/MobileFeatureConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyProgressionMeterReadingsIsEnabled:Checkbox; meta:Json; ticketSubmittingIsDisabled:Checkbox'`
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyGreaterThanPreviousMeterReadingIsEnabled:Checkbox; meta:Json; ticketSubmittingIsDisabled:Checkbox'`
*/

const { Text, Relationship, Checkbox } = require('@keystonejs/fields')
Expand Down Expand Up @@ -74,7 +74,7 @@ const MobileFeatureConfig = new GQLListSchema('MobileFeatureConfig', {
},
},

onlyProgressionMeterReadingsIsEnabled: {
onlyGreaterThanPreviousMeterReadingIsEnabled: {
schemaDoc: 'Restricts residents to submit only meter readings, that are greater than previous. ' +
'Restrictions apply to mobile phones only.',
type: Checkbox,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyProgressionMeterReadingsIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyGreaterThanPreviousMeterReadingIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
*/

const { makeLoggedInAdminClient, makeClient, UUID_RE, expectValuesOfCommonFields, catchErrorFrom } = require('@open-condo/keystone/test.utils')
Expand Down
2 changes: 1 addition & 1 deletion apps/condo/domains/settings/schema/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is autogenerated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyProgressionMeterReadingsIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* This file is autogenerated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyGreaterThanPreviousMeterReadingIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* In most cases you should not change it by hands. And please don't remove `AUTOGENERATE MARKER`s
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyProgressionMeterReadingsIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyGreaterThanPreviousMeterReadingIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
*/

import {
Expand Down
2 changes: 1 addition & 1 deletion apps/condo/domains/settings/utils/clientSchema/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* This file is autogenerated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyProgressionMeterReadingsIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* This file is autogenerated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyGreaterThanPreviousMeterReadingIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* In most cases you should not change it by hands. And please don't remove `AUTOGENERATE MARKER`s
*/

Expand Down
2 changes: 1 addition & 1 deletion apps/condo/domains/settings/utils/serverSchema/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyProgressionMeterReadingsIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyGreaterThanPreviousMeterReadingIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* In most cases you should not change it by hands
* Please, don't remove `AUTOGENERATE MARKER`s
*/
Expand Down
4 changes: 2 additions & 2 deletions apps/condo/domains/settings/utils/testSchema/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyProgressionMeterReadingsIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* Generated by `createschema settings.MobileFeatureConfig 'organization:Relationship:Organization:CASCADE; emergencyPhone:Text; commonPhone:Text; onlyGreaterThanPreviousMeterReadingIsEnabled:Checkbox; meta:Json; ticketSubmittingIsEnabled:Checkbox'`
* In most cases you should not change it by hands
* Please, don't remove `AUTOGENERATE MARKER`s
*/
Expand All @@ -25,7 +25,7 @@ async function createTestMobileFeatureConfig (client, organization, extraAttrs =
sender,
commonPhone: faker.phone.number('+7922#######'),
ticketSubmittingIsDisabled: false,
onlyProgressionMeterReadingsIsEnabled: false,
onlyGreaterThanPreviousMeterReadingIsEnabled: false,
organization: { connect: { id: organization.id } },
...extraAttrs,
}
Expand Down
Loading

0 comments on commit c14a6fa

Please sign in to comment.