add new survey entries for welcome page link, headline and text

This commit is contained in:
Michael Collins 2021-10-08 14:18:59 +08:00
parent 0f4cb513b8
commit 208dce51d8
2 changed files with 92 additions and 8 deletions

View file

@ -56,10 +56,46 @@
"required": false, "required": false,
"min": 0, "min": 0,
"max": 1024, "max": 1024,
"default": "{{ ext_matrix_client_element_welcome_logo_raw }}", "default": "{{ ext_matrix_client_element_welcome_logo }}",
"choices": "", "choices": "",
"new_question": true, "new_question": true,
"variable": "ext_matrix_client_element_welcome_logo_raw", "variable": "ext_matrix_client_element_welcome_logo",
"type": "text"
},
{
"question_name": "Set Welcome Page Logo URL",
"question_description": "Sets the URL link the welcome page logo leads to, must be a valid https link. Leaving this field blank will cause this default link to be used: 'https://element.io'",
"required": false,
"min": 0,
"max": 1024,
"default": "{{ ext_matrix_client_element_welcome_logo_link }}",
"choices": "",
"new_question": true,
"variable": "ext_matrix_client_element_welcome_logo_link",
"type": "text"
},
{
"question_name": "Set Welcome Page Headline",
"question_description": "Sets the headline seen on the welcome page. Leaving this field blank will cause this default headline to be used: 'Welcome to Element'",
"required": false,
"min": 0,
"max": 512,
"default": "{{ ext_matrix_client_element_welcome_headline }}",
"choices": "",
"new_question": true,
"variable": "ext_matrix_client_element_welcome_headline",
"type": "text"
},
{
"question_name": "Set Welcome Page Text",
"question_description": "Sets the text seen on the welcome page. Leaving this field blank will cause this default headline to be used: 'Decentralised, encrypted chat & collaboration powered by [Matrix]'",
"required": false,
"min": 0,
"max": 2048,
"default": "{{ ext_matrix_client_element_welcome_text }}",
"choices": "",
"new_question": true,
"variable": "ext_matrix_client_element_welcome_text",
"type": "text" "type": "text"
}, },
{ {

View file

@ -21,13 +21,15 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertbefore: '# Custom Settings Start' insertbefore: '# Custom Settings Start'
with_dict: with_dict:
'ext_matrix_client_element_welcome_logo_raw': '{{ ext_matrix_client_element_welcome_logo_raw }}' 'ext_matrix_client_element_welcome_logo': '{{ ext_matrix_client_element_welcome_logo }}'
'ext_matrix_client_element_welcome_logo_link': '{{ ext_matrix_client_element_welcome_logo_link }}'
'ext_matrix_client_element_welcome_headline': '{{ ext_matrix_client_element_welcome_headline }}'
- name: Set fact for 'https' string - name: Set fact for 'https' string
set_fact: set_fact:
awx_https_string: "https" awx_https_string: "https"
- name: Set custom logo URL locally on AWX if defined - name: Set custom logo locally on AWX if defined
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
lineinfile: lineinfile:
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
@ -35,16 +37,62 @@
line: "{{ item.key }}: {{ item.value }}" line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Element Settings Start' insertafter: '# Element Settings Start'
with_dict: with_dict:
'matrix_client_element_welcome_logo': '{{ ext_matrix_client_element_welcome_logo_raw }}' 'matrix_client_element_welcome_logo': '{{ ext_matrix_client_element_welcome_logo }}'
when: ( awx_https_string in ext_matrix_client_element_welcome_logo_raw ) and ( ext_matrix_client_element_welcome_logo_raw|trim|length > 0 ) when: ( awx_https_string in ext_matrix_client_element_welcome_logo ) and ( ext_matrix_client_element_welcome_logo_raw|trim|length > 0 )
- name: Remove custom logo URL locally on AWX if not defined - name: Remove custom logo locally on AWX if not defined
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
lineinfile: lineinfile:
path: '{{ awx_cached_matrix_vars }}' path: '{{ awx_cached_matrix_vars }}'
regexp: "^matrix_client_element_welcome_logo: " regexp: "^matrix_client_element_welcome_logo: "
state: absent state: absent
when: ext_matrix_client_element_welcome_logo_raw|trim|length == 0 when: ext_matrix_client_element_welcome_logo|trim|length == 0
- name: Set custom logo link locally on AWX if defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^#? *{{ item.key | regex_escape() }}:"
line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Element Settings Start'
with_dict:
'matrix_client_element_welcome_logo_link': '{{ ext_matrix_client_element_welcome_logo_link }}'
when: ( awx_https_string in ext_matrix_client_element_welcome_logo_link ) and ( ext_matrix_client_element_welcome_logo_link|trim|length > 0 )
- name: Remove custom logo link locally on AWX if not defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^matrix_client_element_welcome_logo_link: "
state: absent
when: ext_matrix_client_element_welcome_logo_link|trim|length == 0
- name: Set custom headline locally on AWX if defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^#? *{{ item.key | regex_escape() }}:"
line: "{{ item.key }}: {{ item.value }}"
insertafter: '# Element Settings Start'
with_dict:
'matrix_client_element_welcome_headline': '{{ ext_matrix_client_element_welcome_headline }}'
when: ( awx_https_string in ext_matrix_client_element_welcome_headline ) and ( ext_matrix_client_element_welcome_headline|trim|length > 0 )
- name: Remove custom headline locally on AWX if not defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^matrix_client_element_welcome_headline: "
state: absent
when: ext_matrix_client_element_welcome_headline|trim|length == 0
- name: Remove custom headline locally on AWX if not defined
delegate_to: 127.0.0.1
lineinfile:
path: '{{ awx_cached_matrix_vars }}'
regexp: "^matrix_client_element_welcome_headline: "
state: absent
when: ext_matrix_client_element_welcome_headline|trim|length == 0
- name: Record Element-Web Background variable locally on AWX - name: Record Element-Web Background variable locally on AWX
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1