Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
wullub committed Apr 24, 2024
1 parent 09f0d21 commit ce24a1e
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 28 deletions.
1 change: 1 addition & 0 deletions ansible/group_vars/server_type_oasys_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ packages_yum_install:
- zip
- git
- net-tools
- jq

packages_yum_update: []

Expand Down
10 changes: 7 additions & 3 deletions ansible/roles/oasys-ords/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ oasys_links_default_path: "/eor/f?p=100:101"
oasys_index_page: "{{ ec2.tags['oasys-environment'] }}-index.html"
oasys_ords_docroot_dir: "{{ oasys_ords_root_dir }}/webapps/ROOT"
oasys_ords_extra_files:
- "redirect.html"
- "index_message.html"
- "index_no_message.html"
- "redirect.html.j2"
- "index_message.html.j2"
- "index_no_message.html.j2"
- "favicon.ico"
oasys_ords_s3_bucket: "hmpps/oasys-ords"
oasys_maintenance_msg: ""
ords_db_port: 1521
Expand All @@ -32,3 +33,6 @@ secret_db_prefix: /oracle/database
oasys_ords_maintenance_msg_secret: "/ec2/{{ ec2.tags.Name }}/maintenance_message"
oasys_ords_get_maintenance_msg_command: "aws secretsmanager get-secret-value --secret-id {{ oasys_ords_maintenance_msg_secret }} --query SecretString --output text"
oasys_ords_maintenance_message_file: "{{ oasys_ords_docroot_dir }}/maintenance_message.html"


aws secretsmanager get-secret-value --secret-id /ec2/t2-oasys-web-b/maintenance_message --query SecretString --output text | jq .message | xargs
2 changes: 1 addition & 1 deletion ansible/roles/oasys-ords/tasks/files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

- name: Copy any additional docroot files
ansible.builtin.template:
src: "doc_root/{{ item }}.j2"
src: "doc_root/{{ item }}"
dest: "{{ oasys_ords_docroot_dir }}/{{ item }}"
owner: "{{ ords_install_user }}"
group: "{{ ords_install_group }}"
Expand Down
Binary file not shown.
19 changes: 15 additions & 4 deletions ansible/roles/oasys-ords/templates/doc_root/index_message.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,23 @@ jQuery.fn.pngFix = function(settings) {
jQuery.fn.maintenanceMessage = function() {
jQuery.get('maintenance_message.html', function(message) {
console.log(message);
$('textarea[name="Comments"]').val(message)
var messageJs = JSON.parse(message)
var messageText = messageJs.message;
var messageShow = messageJs.show;
$('textarea[name="Comments"]').val(messageText);
// hide row if no message
if(!message) {
// hide row if show is false
if (messageShow === true) {
$("#maintenanceMessageBox").show();
} else if (messageShow === false) {
$("#maintenanceMessageBox").hide();
} else if (messageShow.toLowerCase().replace(/\s/g,'') === "true") {
$("#maintenanceMessageBox").show();
} else if (messageShow.toLowerCase().replace(/\s/g,'') === "false") {
$("#maintenanceMessageBox").hide();
} else {
$("#maintenanceMessageBox").show();
}
}, 'text');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,23 @@ jQuery.fn.pngFix = function(settings) {
jQuery.fn.maintenanceMessage = function() {
jQuery.get('maintenance_message.html', function(message) {
console.log(message);
$('textarea[name="Comments"]').val(message)
var messageJs = JSON.parse(message)
var messageText = messageJs.message;
var messageShow = messageJs.show;
$('textarea[name="Comments"]').val(messageText);
// hide row if no message
if(!message) {
// hide row if show is false
if (messageShow === true) {
$("#maintenanceMessageBox").show();
} else if (messageShow === false) {
$("#maintenanceMessageBox").hide();
} else if (messageShow.toLowerCase().replace(/\s/g,'') === "true") {
$("#maintenanceMessageBox").show();
} else if (messageShow.toLowerCase().replace(/\s/g,'') === "false") {
$("#maintenanceMessageBox").hide();
} else {
$("#maintenanceMessageBox").show();
}
}, 'text');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,23 @@ jQuery.fn.pngFix = function(settings) {
jQuery.fn.maintenanceMessage = function() {
jQuery.get('maintenance_message.html', function(message) {
console.log(message);
$('textarea[name="Comments"]').val(message)
var messageJs = JSON.parse(message)
var messageText = messageJs.message;
var messageShow = messageJs.show;
$('textarea[name="Comments"]').val(messageText);
// hide row if no message
if(!message) {
// hide row if show is false
if (messageShow === true) {
$("#maintenanceMessageBox").show();
} else if (messageShow === false) {
$("#maintenanceMessageBox").hide();
} else if (messageShow.toLowerCase().replace(/\s/g,'') === "true") {
$("#maintenanceMessageBox").show();
} else if (messageShow.toLowerCase().replace(/\s/g,'') === "false") {
$("#maintenanceMessageBox").hide();
} else {
$("#maintenanceMessageBox").show();
}
}, 'text');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,23 @@ jQuery.fn.pngFix = function(settings) {
jQuery.fn.maintenanceMessage = function() {
jQuery.get('maintenance_message.html', function(message) {
console.log(message);
$('textarea[name="Comments"]').val(message)
var messageJs = JSON.parse(message)
var messageText = messageJs.message;
var messageShow = messageJs.show;
$('textarea[name="Comments"]').val(messageText);
// hide row if no message
if(!message) {
// hide row if show is false
if (messageShow === true) {
$("#maintenanceMessageBox").show();
} else if (messageShow === false) {
$("#maintenanceMessageBox").hide();
} else if (messageShow.toLowerCase().replace(/\s/g,'') === "true") {
$("#maintenanceMessageBox").show();
} else if (messageShow.toLowerCase().replace(/\s/g,'') === "false") {
$("#maintenanceMessageBox").hide();
} else {
$("#maintenanceMessageBox").show();
}
}, 'text');
Expand Down
19 changes: 15 additions & 4 deletions ansible/roles/oasys-ords/templates/doc_root/t1-index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,23 @@ jQuery.fn.pngFix = function(settings) {
jQuery.fn.maintenanceMessage = function() {
jQuery.get('maintenance_message.html', function(message) {
console.log(message);
$('textarea[name="Comments"]').val(message)
var messageJs = JSON.parse(message)
var messageText = messageJs.message;
var messageShow = messageJs.show;
$('textarea[name="Comments"]').val(messageText);
// hide row if no message
if(!message) {
// hide row if show is false
if (messageShow === true) {
$("#maintenanceMessageBox").show();
} else if (messageShow === false) {
$("#maintenanceMessageBox").hide();
} else if (messageShow.toLowerCase().replace(/\s/g,'') === "true") {
$("#maintenanceMessageBox").show();
} else if (messageShow.toLowerCase().replace(/\s/g,'') === "false") {
$("#maintenanceMessageBox").hide();
} else {
$("#maintenanceMessageBox").show();
}
}, 'text');
Expand Down
19 changes: 15 additions & 4 deletions ansible/roles/oasys-ords/templates/doc_root/t2-index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,23 @@ jQuery.fn.pngFix = function(settings) {
jQuery.fn.maintenanceMessage = function() {
jQuery.get('maintenance_message.html', function(message) {
console.log(message);
$('textarea[name="Comments"]').val(message)
var messageJs = JSON.parse(message)
var messageText = messageJs.message;
var messageShow = messageJs.show;
$('textarea[name="Comments"]').val(messageText);
// hide row if no message
if(!message) {
// hide row if show is false
if (messageShow === true) {
$("#maintenanceMessageBox").show();
} else if (messageShow === false) {
$("#maintenanceMessageBox").hide();
} else if (messageShow.toLowerCase().replace(/\s/g,'') === "true") {
$("#maintenanceMessageBox").show();
} else if (messageShow.toLowerCase().replace(/\s/g,'') === "false") {
$("#maintenanceMessageBox").hide();
} else {
$("#maintenanceMessageBox").show();
}
}, 'text');
Expand Down

0 comments on commit ce24a1e

Please sign in to comment.