From cd8892355527e45225f40f04deec57108adfceb8 Mon Sep 17 00:00:00 2001 From: Spurs20 <22457841+Spurs20@users.noreply.github.com> Date: Wed, 1 Nov 2023 15:11:23 -0600 Subject: [PATCH] Closes #1145 and #1143 --- ...at-docker-compose-authenticated-config.ini | 4 ++-- .../slycat-docker-compose-config.ini | 4 ++-- .../timeseries-wizard/TimeseriesWizard.tsx | 2 +- web-server/js/slycat-web-client.js | 22 +++++++++++++++++++ web-server/plugins/slycat-no-marking.py | 2 +- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/docker/compose/slycat-compose/slycat-docker-compose-authenticated-config.ini b/docker/compose/slycat-compose/slycat-docker-compose-authenticated-config.ini index 50ad2b653..97a03186a 100644 --- a/docker/compose/slycat-compose/slycat-docker-compose-authenticated-config.ini +++ b/docker/compose/slycat-compose/slycat-docker-compose-authenticated-config.ini @@ -8,8 +8,8 @@ session-timeout: datetime.timedelta(minutes=1000) access-log: "-" access-log-count: 100 access-log-size: 10000000 -allowed-markings: ["", "faculty", "airmail"] -selectable-markings: ["", "airmail"] +allowed-markings: ["mna", "faculty", "airmail"] +selectable-markings: ["mna", "airmail"] authentication: {"plugin":"slycat-password-authentication", "kwargs":{"realm":"Slycat", "rules":[]}} autoreload: True cache-store: "/var/lib/slycat/cache-store" diff --git a/docker/compose/slycat-compose/slycat-docker-compose-config.ini b/docker/compose/slycat-compose/slycat-docker-compose-config.ini index 932703520..de51c599c 100644 --- a/docker/compose/slycat-compose/slycat-docker-compose-config.ini +++ b/docker/compose/slycat-compose/slycat-docker-compose-config.ini @@ -8,8 +8,8 @@ session-timeout: datetime.timedelta(minutes=1000) access-log: "-" access-log-count: 100 access-log-size: 10000000 -allowed-markings: ["", "faculty", "airmail"] -selectable-markings: ["", "airmail"] +allowed-markings: ["mna", "faculty", "airmail"] +selectable-markings: ["mna", "airmail"] authentication: {"plugin":"slycat-no-authentication", "kwargs":{"realm":"Slycat", "rules":[]}} autoreload: True cache-store: "/var/lib/slycat/cache-store" diff --git a/web-server/components/timeseries-wizard/TimeseriesWizard.tsx b/web-server/components/timeseries-wizard/TimeseriesWizard.tsx index aa519fa51..46f1b41d9 100644 --- a/web-server/components/timeseries-wizard/TimeseriesWizard.tsx +++ b/web-server/components/timeseries-wizard/TimeseriesWizard.tsx @@ -439,7 +439,7 @@ export default class TimeseriesWizard extends React.Component< } getMarkings = () => { - client.get_configuration_markings_fetch().then((markings) => { + client.get_selectable_configuration_markings_fetch().then((markings) => { markings.sort(function (left: any, right: any) { return left.type == right.type ? 0 : left.type < right.type ? -1 : 1; }); diff --git a/web-server/js/slycat-web-client.js b/web-server/js/slycat-web-client.js index 67769fa6b..e69cb1d05 100644 --- a/web-server/js/slycat-web-client.js +++ b/web-server/js/slycat-web-client.js @@ -378,6 +378,28 @@ module.get_selectable_configuration_markings = function (params) { }); }; +// Fetch version of get_selectable_configuration_markings +module.get_selectable_configuration_markings_fetch = async function (params) { + return fetch(`${api_root}configuration/selectable-markings`, { + credentials: 'same-origin', + cache: 'no-store', + dataType: 'json' + }) + .then(async function (response) { + if (!response.ok) { + throw `bad response with: ${response.status} :: ${response.statusText}`; + } + return response.json(); + }) + .catch(error => { + if (errorFunction) { + errorFunction(error); + } else { + console.log(error) + } + }) +}; + // Fetch version of get_configuration_markings module.get_configuration_markings_fetch = async function (params) { return fetch(`${api_root}configuration/markings`, { diff --git a/web-server/plugins/slycat-no-marking.py b/web-server/plugins/slycat-no-marking.py index acb5df5cf..ac1db55d4 100644 --- a/web-server/plugins/slycat-no-marking.py +++ b/web-server/plugins/slycat-no-marking.py @@ -3,5 +3,5 @@ # retains certain rights in this software. def register_slycat_plugin(context): - context.register_marking("", "None", "") + context.register_marking("mna", "None", "")