refactor(config): rename and re-type footer columns

This commit is contained in:
Ali BARIN
2025-03-10 12:06:13 +00:00
parent 65f5cbc330
commit be8a967ab1
12 changed files with 87 additions and 87 deletions

View File

@@ -14,12 +14,12 @@ const configParams = (request) => {
enableFooter, enableFooter,
footerBackgroundColor, footerBackgroundColor,
footerCopyrightText, footerCopyrightText,
footerDocsLink, footerDocsUrl,
footerImprintLink, footerImprintUrl,
footerLogoSvgData, footerLogoSvgData,
footerPrivacyPolicyLink, footerPrivacyPolicyUrl,
footerTextColor, footerTextColor,
footerTosLink, footerTosUrl,
logoSvgData, logoSvgData,
palettePrimaryDark, palettePrimaryDark,
palettePrimaryLight, palettePrimaryLight,
@@ -31,12 +31,12 @@ const configParams = (request) => {
enableFooter, enableFooter,
footerBackgroundColor, footerBackgroundColor,
footerCopyrightText, footerCopyrightText,
footerDocsLink, footerDocsUrl,
footerImprintLink, footerImprintUrl,
footerLogoSvgData, footerLogoSvgData,
footerPrivacyPolicyLink, footerPrivacyPolicyUrl,
footerTextColor, footerTextColor,
footerTosLink, footerTosUrl,
logoSvgData, logoSvgData,
palettePrimaryDark, palettePrimaryDark,
palettePrimaryLight, palettePrimaryLight,

View File

@@ -29,10 +29,10 @@ describe('PATCH /api/v1/admin/config', () => {
const footerCopyrightText = '© AB Software GmbH'; const footerCopyrightText = '© AB Software GmbH';
const footerBackgroundColor = '#FFFFFF'; const footerBackgroundColor = '#FFFFFF';
const footerTextColor = '#000000'; const footerTextColor = '#000000';
const footerDocsLink = 'https://automatisch.io/docs'; const footerDocsUrl = 'https://automatisch.io/docs';
const footerTosLink = 'https://automatisch.io/terms'; const footerTosUrl = 'https://automatisch.io/terms';
const footerPrivacyPolicyLink = 'https://automatisch.io/privacy'; const footerPrivacyPolicyUrl = 'https://automatisch.io/privacy';
const footerImprintLink = 'https://automatisch.io/imprint'; const footerImprintUrl = 'https://automatisch.io/imprint';
const footerLogoSvgData = const footerLogoSvgData =
'<svg width="25" height="25" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100"><rect width="100%" height="100%" fill="white" /><text x="10" y="40" font-family="Arial" font-size="40" fill="black">Sample Footer Logo</text></svg>'; '<svg width="25" height="25" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100"><rect width="100%" height="100%" fill="white" /><text x="10" y="40" font-family="Arial" font-size="40" fill="black">Sample Footer Logo</text></svg>';
@@ -50,10 +50,10 @@ describe('PATCH /api/v1/admin/config', () => {
footerCopyrightText, footerCopyrightText,
footerBackgroundColor, footerBackgroundColor,
footerTextColor, footerTextColor,
footerDocsLink, footerDocsUrl,
footerTosLink, footerTosUrl,
footerPrivacyPolicyLink, footerPrivacyPolicyUrl,
footerImprintLink, footerImprintUrl,
footerLogoSvgData, footerLogoSvgData,
}; };

View File

@@ -33,10 +33,10 @@ describe('GET /api/v1/automatisch/config', () => {
footerCopyrightText: '© AB Software GmbH', footerCopyrightText: '© AB Software GmbH',
footerBackgroundColor: '#FFFFFF', footerBackgroundColor: '#FFFFFF',
footerTextColor: '#000000', footerTextColor: '#000000',
footerDocsLink: 'https://automatisch.io/docs', footerDocsUrl: 'https://automatisch.io/docs',
footerTosLink: 'https://automatisch.io/terms', footerTosUrl: 'https://automatisch.io/terms',
footerPrivacyPolicyLink: 'https://automatisch.io/privacy', footerPrivacyPolicyUrl: 'https://automatisch.io/privacy',
footerImprintLink: 'https://automatisch.io/imprint', footerImprintUrl: 'https://automatisch.io/imprint',
}); });
const response = await request(app) const response = await request(app)
@@ -56,10 +56,10 @@ describe('GET /api/v1/automatisch/config', () => {
footerCopyrightText: '© AB Software GmbH', footerCopyrightText: '© AB Software GmbH',
footerBackgroundColor: '#FFFFFF', footerBackgroundColor: '#FFFFFF',
footerTextColor: '#000000', footerTextColor: '#000000',
footerDocsLink: 'https://automatisch.io/docs', footerDocsUrl: 'https://automatisch.io/docs',
footerTosLink: 'https://automatisch.io/terms', footerTosUrl: 'https://automatisch.io/terms',
footerPrivacyPolicyLink: 'https://automatisch.io/privacy', footerPrivacyPolicyUrl: 'https://automatisch.io/privacy',
footerImprintLink: 'https://automatisch.io/imprint', footerImprintUrl: 'https://automatisch.io/imprint',
}); });
expect(response.body).toStrictEqual(expectedPayload); expect(response.body).toStrictEqual(expectedPayload);

View File

@@ -2,13 +2,13 @@ export async function up(knex) {
await knex.schema.table('config', (table) => { await knex.schema.table('config', (table) => {
table.boolean('enable_footer').defaultTo(false); table.boolean('enable_footer').defaultTo(false);
table.text('footer_logo_svg_data'); table.text('footer_logo_svg_data');
table.text('footer_copyright_text'); table.string('footer_copyright_text');
table.text('footer_background_color'); table.string('footer_background_color');
table.text('footer_text_color'); table.string('footer_text_color');
table.text('footer_docs_link'); table.string('footer_docs_url');
table.text('footer_tos_link'); table.string('footer_tos_url');
table.text('footer_privacy_policy_link'); table.string('footer_privacy_policy_url');
table.text('footer_imprint_link'); table.string('footer_imprint_url');
}); });
} }
@@ -19,9 +19,9 @@ export async function down(knex) {
table.dropColumn('footer_logo_svg_data'); table.dropColumn('footer_logo_svg_data');
table.dropColumn('footer_background_color'); table.dropColumn('footer_background_color');
table.dropColumn('footer_text_color'); table.dropColumn('footer_text_color');
table.dropColumn('footer_docs_link'); table.dropColumn('footer_docs_url');
table.dropColumn('footer_tos_link'); table.dropColumn('footer_tos_url');
table.dropColumn('footer_privacy_policy_link'); table.dropColumn('footer_privacy_policy_url');
table.dropColumn('footer_imprint_link'); table.dropColumn('footer_imprint_url');
}); });
} }

View File

@@ -27,13 +27,13 @@ exports[`Config model > jsonSchema should have correct validations 1`] = `
"null", "null",
], ],
}, },
"footerDocsLink": { "footerDocsUrl": {
"type": [ "type": [
"string", "string",
"null", "null",
], ],
}, },
"footerImprintLink": { "footerImprintUrl": {
"type": [ "type": [
"string", "string",
"null", "null",
@@ -45,7 +45,7 @@ exports[`Config model > jsonSchema should have correct validations 1`] = `
"null", "null",
], ],
}, },
"footerPrivacyPolicyLink": { "footerPrivacyPolicyUrl": {
"type": [ "type": [
"string", "string",
"null", "null",
@@ -57,7 +57,7 @@ exports[`Config model > jsonSchema should have correct validations 1`] = `
"null", "null",
], ],
}, },
"footerTosLink": { "footerTosUrl": {
"type": [ "type": [
"string", "string",
"null", "null",

View File

@@ -21,10 +21,10 @@ class Config extends Base {
footerCopyrightText: { type: ['string', 'null'] }, footerCopyrightText: { type: ['string', 'null'] },
footerBackgroundColor: { type: ['string', 'null'] }, footerBackgroundColor: { type: ['string', 'null'] },
footerTextColor: { type: ['string', 'null'] }, footerTextColor: { type: ['string', 'null'] },
footerDocsLink: { type: ['string', 'null'] }, footerDocsUrl: { type: ['string', 'null'] },
footerTosLink: { type: ['string', 'null'] }, footerTosUrl: { type: ['string', 'null'] },
footerPrivacyPolicyLink: { type: ['string', 'null'] }, footerPrivacyPolicyUrl: { type: ['string', 'null'] },
footerImprintLink: { type: ['string', 'null'] }, footerImprintUrl: { type: ['string', 'null'] },
createdAt: { type: 'string' }, createdAt: { type: 'string' },
updatedAt: { type: 'string' }, updatedAt: { type: 'string' },
}, },

View File

@@ -20,10 +20,10 @@ const configSerializer = (config) => {
footerCopyrightText: config.footerCopyrightText, footerCopyrightText: config.footerCopyrightText,
footerBackgroundColor: config.footerBackgroundColor, footerBackgroundColor: config.footerBackgroundColor,
footerTextColor: config.footerTextColor, footerTextColor: config.footerTextColor,
footerDocsLink: config.footerDocsLink, footerDocsUrl: config.footerDocsUrl,
footerTosLink: config.footerTosLink, footerTosUrl: config.footerTosUrl,
footerPrivacyPolicyLink: config.footerPrivacyPolicyLink, footerPrivacyPolicyUrl: config.footerPrivacyPolicyUrl,
footerImprintLink: config.footerImprintLink, footerImprintUrl: config.footerImprintUrl,
}; };
}; };

View File

@@ -27,12 +27,12 @@ describe('configSerializer', () => {
enableFooter: config.enableFooter, enableFooter: config.enableFooter,
footerBackgroundColor: config.footerBackgroundColor, footerBackgroundColor: config.footerBackgroundColor,
footerCopyrightText: config.footerCopyrightText, footerCopyrightText: config.footerCopyrightText,
footerDocsLink: config.footerDocsLink, footerDocsUrl: config.footerDocsUrl,
footerImprintLink: config.footerImprintLink, footerImprintUrl: config.footerImprintUrl,
footerLogoSvgData: config.footerLogoSvgData, footerLogoSvgData: config.footerLogoSvgData,
footerPrivacyPolicyLink: config.footerPrivacyPolicyLink, footerPrivacyPolicyUrl: config.footerPrivacyPolicyUrl,
footerTextColor: config.footerTextColor, footerTextColor: config.footerTextColor,
footerTosLink: config.footerTosLink, footerTosUrl: config.footerTosUrl,
createdAt: config.createdAt.getTime(), createdAt: config.createdAt.getTime(),
updatedAt: config.updatedAt.getTime(), updatedAt: config.updatedAt.getTime(),
}; };

View File

@@ -21,10 +21,10 @@ const configMock = (config) => {
footerCopyrightText: config.footerCopyrightText, footerCopyrightText: config.footerCopyrightText,
footerBackgroundColor: config.footerBackgroundColor, footerBackgroundColor: config.footerBackgroundColor,
footerTextColor: config.footerTextColor, footerTextColor: config.footerTextColor,
footerDocsLink: config.footerDocsLink, footerDocsUrl: config.footerDocsUrl,
footerTosLink: config.footerTosLink, footerTosUrl: config.footerTosUrl,
footerPrivacyPolicyLink: config.footerPrivacyPolicyLink, footerPrivacyPolicyUrl: config.footerPrivacyPolicyUrl,
footerImprintLink: config.footerImprintLink, footerImprintUrl: config.footerImprintUrl,
}, },
meta: { meta: {
count: 1, count: 1,

View File

@@ -22,28 +22,28 @@ const LayoutFooter = () => {
const links = [ const links = [
{ {
key: 'docs', key: 'docs',
show: !!config.data.footerDocsLink, show: !!config.data.footerDocsUrl,
href: config.data.footerDocsLink, href: config.data.footerDocsUrl,
text: formatMessage('footer.docsLinkText'), text: formatMessage('footer.docsLinkText'),
}, },
{ {
key: 'terms-of-services', key: 'terms-of-services',
show: !!config.data.footerTosLink, show: !!config.data.footerTosUrl,
href: config.data.footerTosLink, href: config.data.footerTosUrl,
text: formatMessage('footer.tosLinkText'), text: formatMessage('footer.tosLinkText'),
}, },
{ {
key: 'privacy-policy', key: 'privacy-policy',
show: !!config.data.footerPrivacyPolicyLink, show: !!config.data.footerPrivacyPolicyUrl,
href: config.data.footerPrivacyPolicyLink, href: config.data.footerPrivacyPolicyUrl,
text: formatMessage('footer.privacyPolicyLinkText'), text: formatMessage('footer.privacyPolicyLinkText'),
}, },
{ {
key: 'imprint', key: 'imprint',
show: !!config.data.footerImprintLink, show: !!config.data.footerImprintUrl,
href: config.data.footerImprintLink, href: config.data.footerImprintUrl,
text: formatMessage('footer.imprintLinkText'), text: formatMessage('footer.imprintLinkText'),
}, },
, ,

View File

@@ -281,15 +281,15 @@
"userInterfacePage.primaryDarkColorFieldLabel": "Primary dark color", "userInterfacePage.primaryDarkColorFieldLabel": "Primary dark color",
"userInterfacePage.primaryLightColorFieldLabel": "Primary light color", "userInterfacePage.primaryLightColorFieldLabel": "Primary light color",
"userInterfacePage.svgDataFieldLabel": "Logo SVG code", "userInterfacePage.svgDataFieldLabel": "Logo SVG code",
"userInterfacePage.footerLogoSvgDataFieldLabel": "logo SVG code", "userInterfacePage.footerLogoSvgDataFieldLabel": "Footer logo SVG code",
"userInterfacePage.footerCopyrightTextFieldLabel": "Copyright text", "userInterfacePage.footerCopyrightTextFieldLabel": "Copyright text",
"userInterfacePage.enableFooterLabel": "Enable footer", "userInterfacePage.enableFooterLabel": "Enable footer",
"userInterfacePage.footerTextColorLabel": "Text color", "userInterfacePage.footerTextColorLabel": "Text color",
"userInterfacePage.footerBackgroundColorLabel": "Background color", "userInterfacePage.footerBackgroundColorLabel": "Background color",
"userInterfacePage.footerDocsLinkLabel": "Documentation link", "userInterfacePage.footerDocsUrlLabel": "Documentation link",
"userInterfacePage.footerTosLinkLabel": "Terms of services link", "userInterfacePage.footerTosUrlLabel": "Terms of services link",
"userInterfacePage.footerPrivacyPolicyLinkLabel": "Privacy policy link", "userInterfacePage.footerPrivacyPolicyUrlLabel": "Privacy policy link",
"userInterfacePage.footerImprintLinkLabel": "Imprint link", "userInterfacePage.footerImprintUrlLabel": "Imprint link",
"userInterfacePage.submit": "Update", "userInterfacePage.submit": "Update",
"authenticationPage.title": "Single Sign-On with SAML", "authenticationPage.title": "Single Sign-On with SAML",
"authenticationForm.active": "Active", "authenticationForm.active": "Active",

View File

@@ -37,10 +37,10 @@ const defaultValues = {
footerCopyrightText: '', footerCopyrightText: '',
footerBackgroundColor: '#FFFFFF', footerBackgroundColor: '#FFFFFF',
footerTextColor: '#000000', footerTextColor: '#000000',
footerDocsLink: '', footerDocsUrl: '',
footerTosLink: '', footerTosUrl: '',
footerPrivacyPolicyLink: '', footerPrivacyPolicyUrl: '',
footerImprintLink: '', footerImprintUrl: '',
}; };
const mergeIfGiven = (oldValue, newValue) => { const mergeIfGiven = (oldValue, newValue) => {
@@ -66,12 +66,12 @@ export default function UserInterface() {
enableFooter: uiData.enableFooter, enableFooter: uiData.enableFooter,
footerBackgroundColor: uiData.footerBackgroundColor, footerBackgroundColor: uiData.footerBackgroundColor,
footerCopyrightText: uiData.footerCopyrightText, footerCopyrightText: uiData.footerCopyrightText,
footerDocsLink: uiData.footerDocsLink, footerDocsUrl: uiData.footerDocsUrl,
footerImprintLink: uiData.footerImprintLink, footerImprintUrl: uiData.footerImprintUrl,
footerLogoSvgData: uiData.footerLogoSvgData, footerLogoSvgData: uiData.footerLogoSvgData,
footerPrivacyPolicyLink: uiData.footerPrivacyPolicyLink, footerPrivacyPolicyUrl: uiData.footerPrivacyPolicyUrl,
footerTextColor: uiData.footerTextColor, footerTextColor: uiData.footerTextColor,
footerTosLink: uiData.footerTosLink, footerTosUrl: uiData.footerTosUrl,
logoSvgData: uiData.logoSvgData, logoSvgData: uiData.logoSvgData,
palettePrimaryDark: getPrimaryDarkColor(uiData.palettePrimaryDark), palettePrimaryDark: getPrimaryDarkColor(uiData.palettePrimaryDark),
palettePrimaryLight: getPrimaryLightColor(uiData.palettePrimaryLight), palettePrimaryLight: getPrimaryLightColor(uiData.palettePrimaryLight),
@@ -208,39 +208,39 @@ export default function UserInterface() {
/> />
<TextField <TextField
name="footerDocsLink" name="footerDocsUrl"
label={formatMessage('userInterfacePage.footerDocsLinkLabel')} label={formatMessage('userInterfacePage.footerDocsUrlLabel')}
multiline multiline
fullWidth fullWidth
data-test="logo-docs-text-field" data-test="logo-docs-text-field"
/> />
<TextField <TextField
name="footerTosLink" name="footerTosUrl"
label={formatMessage('userInterfacePage.footerTosLinkLabel')} label={formatMessage('userInterfacePage.footerTosUrlLabel')}
multiline multiline
fullWidth fullWidth
data-test="logo-tos-text-field" data-test="logo-tos-url-text-field"
/> />
<TextField <TextField
name="footerPrivacyPolicyLink" name="footerPrivacyPolicyUrl"
label={formatMessage( label={formatMessage(
'userInterfacePage.footerPrivacyPolicyLinkLabel', 'userInterfacePage.footerPrivacyPolicyUrlLabel',
)} )}
multiline multiline
fullWidth fullWidth
data-test="logo-privacy-policy-text-field" data-test="logo-privacy-policy-url-text-field"
/> />
<TextField <TextField
name="footerImprintLink" name="footerImprintUrl"
label={formatMessage( label={formatMessage(
'userInterfacePage.footerImprintLinkLabel', 'userInterfacePage.footerImprintUrlLabel',
)} )}
multiline multiline
fullWidth fullWidth
data-test="logo-imprint-text-field" data-test="logo-imprint-url-text-field"
/> />
<LoadingButton <LoadingButton