Skip to content

Commit d2a273f

Browse files
authored
Merge pull request #24 from ucla-data-science-center/fix/gui-branding
Use for GUI branding paths
2 parents cae5bed + c46c577 commit d2a273f

1 file changed

Lines changed: 21 additions & 56 deletions

File tree

tasks/dataverse-gui.yml

Lines changed: 21 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,46 @@
11
---
22
# dataverse/tasks/dataverse-gui.yml
3-
# Install GUI branding modifications if branding files exist
3+
# install gui modifications (branding and favicons), if defined
44

5-
- name: Set key GUI paths
5+
- name: Calculate destination directories
66
set_fact:
77
gui_file_path: '{{ payara_dir }}/glassfish/domains/{{ dataverse.payara.domain }}/applications/dataverse'
8-
branding_dir: '{{ gui_file_path }}/branding'
9-
navbar_logo_dir: '{{ payara_dir }}/glassfish/domains/{{ dataverse.payara.domain }}/docroot/logos/navbar'
8+
favicon_file_path: '{{ payara_dir }}/glassfish/domains/{{ dataverse.payara.domain }}/applications/dataverse/resources/images/fav/'
109

11-
- name: Ensure branding and logo directories exist
12-
file:
13-
path: "{{ item }}"
14-
state: directory
15-
owner: '{{ dataverse.payara.user }}'
16-
group: '{{ dataverse.payara.group }}'
17-
mode: '0755'
18-
loop:
19-
- "{{ branding_dir }}"
20-
- "{{ navbar_logo_dir }}"
10+
- name: Applying GUI design
11+
debug:
12+
msg: '##### Applying GUI design #####'
2113

22-
# --- Copy and register individual files if they exist ---
23-
24-
- name: Copy navbar logo if present
14+
- name: Copy favicons
2515
copy:
26-
src: "{{ dataverse.branding.directory }}/{{ dataverse.branding.fileSettings[2].file }}"
27-
dest: "{{ navbar_logo_dir }}/{{ dataverse.branding.fileSettings[2].file }}"
16+
src: '{{ item }}'
17+
dest: '{{ favicon_file_path }}'
2818
mode: '0644'
2919
owner: '{{ dataverse.payara.user }}'
3020
group: '{{ dataverse.payara.group }}'
31-
register: navbar_logo_result
32-
when: lookup('file', dataverse.branding.directory + '/' + dataverse.branding.fileSettings[2].file, errors='ignore') != ""
21+
with_fileglob: '{{ dataverse.branding.favicons_directory }}/*.ico'
3322

34-
- name: Copy custom-header.html if present
23+
- name: Copy branding files
3524
copy:
36-
src: "{{ dataverse.branding.directory }}/custom-header.html"
37-
dest: "{{ branding_dir }}/custom-header.html"
38-
mode: '0644'
25+
src: '{{ dataverse.branding.directory }}'
26+
dest: '{{ gui_file_path }}'
3927
owner: '{{ dataverse.payara.user }}'
4028
group: '{{ dataverse.payara.group }}'
41-
register: header_result
42-
when: lookup('file', dataverse.branding.directory + '/custom-header.html', errors='ignore') != ""
43-
44-
- name: Copy custom-stylesheet.css if present
45-
copy:
46-
src: "{{ dataverse.branding.directory }}/custom-stylesheet.css"
47-
dest: "{{ branding_dir }}/custom-stylesheet.css"
4829
mode: '0644'
49-
owner: '{{ dataverse.payara.user }}'
50-
group: '{{ dataverse.payara.group }}'
51-
register: css_result
52-
when: lookup('file', dataverse.branding.directory + '/custom-stylesheet.css', errors='ignore') != ""
53-
54-
# --- Apply GUI settings via API ---
5530

56-
- name: Apply LogoCustomizationFile setting
31+
- name: Update branding file settings on server
5732
uri:
58-
url: "http://localhost:8080/api/admin/settings/:LogoCustomizationFile"
33+
url: http://localhost:8080/api/admin/settings/:{{ item.setting }}
5934
method: PUT
60-
body: "/logos/navbar/{{ dataverse.branding.fileSettings[2].file }}"
35+
body: '/branding/{{ item.file }}'
6136
status_code: 200
62-
when: navbar_logo_result.changed
37+
with_items: '{{ dataverse.branding.fileSettings }}'
6338

64-
- name: Apply HeaderCustomizationFile setting
65-
uri:
66-
url: "http://localhost:8080/api/admin/settings/:HeaderCustomizationFile"
67-
method: PUT
68-
body: "/branding/custom-header.html"
69-
status_code: 200
70-
when: header_result.changed
7139

72-
- name: Apply StyleCustomizationFile setting
40+
- name: Update other branding settings on server
7341
uri:
74-
url: "http://localhost:8080/api/admin/settings/:StyleCustomizationFile"
42+
url: http://localhost:8080/api/admin/settings/:{{ item.setting }}
7543
method: PUT
76-
body: "/branding/custom-stylesheet.css"
44+
body: "{{ item.value }}"
7745
status_code: 200
78-
when: css_result.changed
79-
80-
- name: Restart Payara to apply GUI changes
81-
meta: flush_handlers
46+
with_items: '{{ dataverse.branding.otherSettings }}'

0 commit comments

Comments
 (0)