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

View File

@@ -29,10 +29,10 @@ describe('PATCH /api/v1/admin/config', () => {
const footerCopyrightText = '© AB Software GmbH';
const footerBackgroundColor = '#FFFFFF';
const footerTextColor = '#000000';
const footerDocsLink = 'https://automatisch.io/docs';
const footerTosLink = 'https://automatisch.io/terms';
const footerPrivacyPolicyLink = 'https://automatisch.io/privacy';
const footerImprintLink = 'https://automatisch.io/imprint';
const footerDocsUrl = 'https://automatisch.io/docs';
const footerTosUrl = 'https://automatisch.io/terms';
const footerPrivacyPolicyUrl = 'https://automatisch.io/privacy';
const footerImprintUrl = 'https://automatisch.io/imprint';
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>';
@@ -50,10 +50,10 @@ describe('PATCH /api/v1/admin/config', () => {
footerCopyrightText,
footerBackgroundColor,
footerTextColor,
footerDocsLink,
footerTosLink,
footerPrivacyPolicyLink,
footerImprintLink,
footerDocsUrl,
footerTosUrl,
footerPrivacyPolicyUrl,
footerImprintUrl,
footerLogoSvgData,
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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