Spade
Mini Shell
css/admin-view-task.min.css.gz000064400000000261151167502440012253
0ustar00����
1�_E�ϡ�(���'�J,rɚ,n~H6��{w�+�r`�栝�x՝OG���+�N�Z8�U�c�I�k�FR#P{�a'U�8$e+��"@i����~0X���@@���/�y�-��:��~��2?����d��S�@��WbL��`�|$����3css/admin-view-task.css000064400000000554151167502440011057
0ustar00@charset "UTF-8";
.match-custom .control-group .control-label {
width: auto;
padding: 0;
}
.match-custom .control-group .controls {
min-width: 7rem;
display: inline-block;
}
.match-custom .control-group {
margin-right: 1.5rem;
display: inline-block;
}
.match-custom label {
font-size: small;
}
.match-custom select[multiple] {
height: 15rem;
}
css/admin-view-tasks.css000064400000000161151167502440011234
0ustar00@charset "UTF-8";
.task-title span.failure-indicator {
color: #ffb514;
position: relative;
bottom: .5em;
}
css/admin-view-task.min.css000064400000000463151167502440011640
0ustar00@charset "UTF-8";.match-custom .control-group
.control-label{width:auto;padding:0}.match-custom .control-group
.controls{min-width:7rem;display:inline-block}.match-custom
.control-group{margin-right:1.5rem;display:inline-block}.match-custom
label{font-size:small}.match-custom
select[multiple]{height:15rem}css/admin-view-tasks.min.css000064400000000140151167502440012013
0ustar00@charset "UTF-8";.task-title
span.failure-indicator{color:#ffb514;position:relative;bottom:.5em}css/admin-view-tasks.min.css.gz000064400000000161151167502440012435
0ustar00��A
�0Ы��((�d�������|�����!k��__�{�у��AP�kU�I�i줾%�~I�Zrަ�m��A.���?�~��s]`joomla.asset.json000064400000002633151167502440010047
0ustar00{
"$schema":
"https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "com_scheduler",
"version": "4.0.0",
"description": "Joomla CMS",
"license": "GNU General Public License version 2 or later;
see LICENSE.txt",
"assets": [
{
"name": "com_scheduler.admin-view-task-css",
"type": "style",
"uri": "com_scheduler/admin-view-task.css",
"version": "b5f92b"
},
{
"name": "com_scheduler.admin-view-tasks-css",
"type": "style",
"uri": "com_scheduler/admin-view-tasks.css",
"version": "adee39"
},
{
"name": "com_scheduler.test-task",
"type": "script",
"uri":
"com_scheduler/admin-view-run-test-task.js",
"dependencies": [
"core",
"joomla.dialog"
],
"attributes": {
"type": "module"
},
"version": "e15a57"
},
{
"name":
"com_scheduler.admin-view-select-task-search",
"type": "script",
"uri":
"com_scheduler/admin-view-select-task-search.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "878d30"
},
{
"name": "com_scheduler.scheduler-config",
"type": "script",
"uri": "com_scheduler/scheduler-config.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
},
"version": "ab7203"
}
]
}js/admin-view-run-test-task.min.js.gz000064400000002053151167502440013503
0ustar00��Vao�6��_��A4�f+0�U6�Q�d�]�2P
0Z�XjeR%Oq���}�䦉`��O։��x����IN��]ӯ֮%u�
������7������ !l��q���`��V.r��yA�M*ɇ����f����֭N�\E���@�ߧ�|N�s�,�v�o���rL�#�Bp}���|�g��[|C�Rk<2'0�T��j�Ó�6nCm�j
e�@!D�O����!V"����!
��hY�Ya��X��Q�Q*���Rsa�"m��
��
H�:F�O3�U��Qa�)��e��+�w��Q.|�ɽ��
��\c�w���l�O�\u}���=
���
�4�q�[!c<<y����������k��)�{=���3x@�5`�1'�3P����p6�؍�704�h{����[�M���ؼ���K�����5{�~�9�!6$r�:���-ʄы����,\�$�t:�&��,�R.��J��Oȶҏ�Q���
�zkNF+T���x�'�8ǔ�~������e2�E��Q4M�h'�8�Ńx>K���ϣ(�N)-�+��b��:��,��a��)Fu~Ců!�Χ��|2~^�'0��4;�?���v:�5&��<�ǧ��� q.�A��SB�V���;*h�=��z�go{uoSU�n�go�q�����|<h�r
@��{�qEk�ø�|˷�'RZG7`���M�<�F�{��D�V�2-���.+Dk���wZ��̂�~-^䭺�N�j�S�VU�����������\�m�M9=������8�⊖��肋d/��*�z�T_�/�h�M<��./A��h�0�f���↑�x0�g_q��y��w��Ńi������>3��"y�c'\�Oݶv{�匋"�m(g��-�2�+!��)rT�";k�8��Z�ǣ��M�a���<��dQ.���
����+o�Ƞ��:�nڮ�[�/^Pz{�����W��������L�n�&7�nda�ֻVi�&����o���J�js/scheduler-config.js000064400000002776151167502440010760
0ustar00/**
* @copyright (C) 2021 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
if (!window.Joomla) {
throw new Error('Joomla API was not properly initialised!');
}
const copyToClipboardFallback = input => {
input.focus();
input.select();
try {
const copy = document.execCommand('copy');
if (copy) {
Joomla.renderMessages({
message:
[Joomla.Text._('COM_SCHEDULER_CONFIG_WEBCRON_LINK_COPY_SUCCESS')]
});
} else {
Joomla.renderMessages({
error:
[Joomla.Text._('COM_SCHEDULER_CONFIG_WEBCRON_LINK_COPY_FAIL')]
});
}
} catch (err) {
Joomla.renderMessages({
error: [err]
});
}
};
const copyToClipboard = () => {
const button = document.getElementById('link-copy');
button.addEventListener('click', ({
currentTarget
}) => {
const input = currentTarget.previousElementSibling;
if (!navigator.clipboard) {
copyToClipboardFallback(input);
return;
}
navigator.clipboard.writeText(input.value).then(() => {
Joomla.renderMessages({
message:
[Joomla.Text._('COM_SCHEDULER_CONFIG_WEBCRON_LINK_COPY_SUCCESS')]
});
}, () => {
Joomla.renderMessages({
error:
[Joomla.Text._('COM_SCHEDULER_CONFIG_WEBCRON_LINK_COPY_FAIL')]
});
});
});
};
const onBoot = () => {
copyToClipboard();
document.removeEventListener('DOMContentLoaded', onBoot);
};
document.addEventListener('DOMContentLoaded', onBoot);
js/admin-view-select-task-search.min.js.gz000064400000001153151167502460014446
0ustar00��TMs�0��W<cD�#ġ-ä�4��Q���]�!�w��@�$7�꽷���f�5�����}��O����
�o�0�l�b3�<t���r��z?�Zy�^�K�̀�cW�8@mُ��f��^�!�3��j��F��z<PtG'��6�b`Ǡ�̒ԛb��h`���TS�������������e�%��#�9���<Rw�>�Nߧ��̡f���PX
��y���-�$��,k�G��pZ�X.��Dl����!��6�t��h���)�-�E�c�"�S�N���r���$���t-�I�Ke~��j�c�p�E�c*
��������^9X�P�5���GkW�S�kL�T�mf���U6���!T�)��_��i�y\�
�T��֭��p���j�-��V$sdtN�w���s������1&�g��]E
�ȏ����2gl�B�AFFQ�
����O����=�{`�Q��ql�{�*;��~U�
��U�~���~oI�&�A�.a�:r�����Ya�V+����irMfvoY�`ɾBy�5�&ޚWJ�1n�ٜ�E�js/scheduler-config.min.js000064400000002206151167502460011530
0ustar00/**
* @copyright (C) 2021 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/if(!window.Joomla)throw new Error("Joomla API was not properly
initialised!");const
copyToClipboardFallback=o=>{o.focus(),o.select();try{document.execCommand("copy")?Joomla.renderMessages({message:[Joomla.Text._("COM_SCHEDULER_CONFIG_WEBCRON_LINK_COPY_SUCCESS")]}):Joomla.renderMessages({error:[Joomla.Text._("COM_SCHEDULER_CONFIG_WEBCRON_LINK_COPY_FAIL")]})}catch(e){Joomla.renderMessages({error:[e]})}},copyToClipboard=()=>{document.getElementById("link-copy").addEventListener("click",({currentTarget:e})=>{const
t=e.previousElementSibling;if(!navigator.clipboard){copyToClipboardFallback(t);return}navigator.clipboard.writeText(t.value).then(()=>{Joomla.renderMessages({message:[Joomla.Text._("COM_SCHEDULER_CONFIG_WEBCRON_LINK_COPY_SUCCESS")]})},()=>{Joomla.renderMessages({error:[Joomla.Text._("COM_SCHEDULER_CONFIG_WEBCRON_LINK_COPY_FAIL")]})})})},onBoot=()=>{copyToClipboard(),document.removeEventListener("DOMContentLoaded",onBoot)};document.addEventListener("DOMContentLoaded",onBoot);
js/admin-view-run-test-task.js000064400000010234151167502460012304
0ustar00import JoomlaDialog from 'joomla.dialog';
/**
* @copyright (C) 2021 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
/**
* Helper to create an element
*
* @param {String} nodeName
* @param {String} text
* @param {Array} classList
* @returns {HTMLElement}
*/
const createEl = (nodeName, text = '', classList = []) => {
const el = document.createElement(nodeName);
el.textContent = text;
if (classList && classList.length) {
el.classList.add(...classList);
}
return el;
};
/**
* Trigger the task through a GET request
*
* @param {String} url
* @param {HTMLElement} resultContainer
*/
const runTheTask = (url, resultContainer) => {
const statusHolder =
resultContainer.querySelector('.scheduler-status');
const progressBar =
resultContainer.querySelector('.progress-bar');
const complete = success => {
progressBar.style.width = '100%';
progressBar.classList.add(success ? 'bg-success' :
'bg-danger');
setTimeout(() =>
progressBar.classList.remove('progress-bar-animated'), 500);
};
progressBar.style.width = '15%';
fetch(url, {
headers: {
'X-CSRF-Token': Joomla.getOptions('csrf.token',
'')
}
}).then(response => {
if (!response.ok) {
throw new
Error(Joomla.Text._('JLIB_JS_AJAX_ERROR_OTHER').replace('%s',
response.status).replace('%d', response.status));
}
return response.json();
}).then(output => {
if (!output.data) {
// The request was successful but the response is empty in some
reason
throw new
Error(Joomla.Text._('JLIB_JS_AJAX_ERROR_NO_CONTENT'));
}
statusHolder.textContent =
Joomla.Text._('COM_SCHEDULER_TEST_RUN_STATUS_COMPLETED');
if (output.data.duration > 0) {
resultContainer.appendChild(createEl('div',
Joomla.Text._('COM_SCHEDULER_TEST_RUN_DURATION').replace('%s',
output.data.duration.toFixed(2))));
}
if (output.data.output) {
resultContainer.appendChild(createEl('div',
Joomla.Text._('COM_SCHEDULER_TEST_RUN_OUTPUT').replace('%s',
'').replace('<br>', '')));
resultContainer.appendChild(createEl('pre',
output.data.output, ['bg-body', 'p-2']));
}
complete(true);
}).catch(error => {
complete(false);
statusHolder.textContent =
Joomla.Text._('COM_SCHEDULER_TEST_RUN_STATUS_TERMINATED');
resultContainer.appendChild(createEl('div', error.message,
['text-danger']));
});
};
// Listen on click over a task button to run a task
document.addEventListener('click', event => {
const button =
event.target.closest('button[data-scheduler-run]');
if (!button) return;
event.preventDefault();
// Get the task info from the button
const {
id,
title,
url
} = button.dataset;
// Prepare the initial popup content, by following template:
// <div class="p-3">
// <h4>Task: Task title</h4>
// <div class="mb-2 scheduler-status">Status: Task
Status</div>
// <div class="progress mb-2"><div
class="progress-bar progress-bar-striped
bg-success"></div></div>
// </div>
const content = (() => {
const body = createEl('div', '',
['p-3']);
const progress = createEl('div', '',
['progress', 'mb-2']);
const progressBar = createEl('div', '',
['progress-bar', 'progress-bar-striped',
'progress-bar-animated']);
body.appendChild(createEl('h4',
Joomla.Text._('COM_SCHEDULER_TEST_RUN_TASK').replace('%s',
title)));
body.appendChild(createEl('div',
Joomla.Text._('COM_SCHEDULER_TEST_RUN_STATUS_STARTED'),
['mb-2', 'scheduler-status']));
progress.appendChild(progressBar);
body.appendChild(progress);
progressBar.style.width = '0%';
return body;
})();
// Create dialog instance
const dialog = new JoomlaDialog({
popupType: 'inline',
textHeader:
Joomla.Text._('COM_SCHEDULER_TEST_RUN_TITLE').replace('%d',
id),
textClose: Joomla.Text._('JCLOSE'),
popupContent: content,
width: '800px',
height: 'fit-content'
});
// Run the task when dialog is ready
dialog.addEventListener('joomla-dialog:open', () => {
runTheTask(url, content);
});
// Reload the page when dialog is closed
dialog.addEventListener('joomla-dialog:close', () => {
window.location.reload();
});
dialog.show();
});
js/admin-view-select-task-search.js000064400000011110151167502460013237
0ustar00/**
* @copyright (C) 2021 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
/**
* Add a keyboard event listener to the Select a Task Type search element.
*
* IMPORTANT! This script is meant to be loaded deferred. This means that
a. it's non-blocking
* (the browser can load it whenever) and b. it doesn't need an on
DOMContentLoaded event handler
* because the browser is guaranteed to execute it only after the DOM
content has loaded, the
* whole point of it being deferred.
*
* The search box has a keyboard handler that fires every time you press a
keyboard button or send
* a keypress with a touch / virtual keyboard. We then iterate all task
type cards and check if
* the plain text (HTML stripped out) representation of the task title or
description partially
* matches the text you entered in the search box. If it doesn't we
add a Bootstrap class to hide
* the task.
*
* This way we limit the displayed tasks only to those searched.
*
* This feature follows progressive enhancement. The search box is hidden
by default and only
* displayed when this JavaScript here executes. Furthermore, session
storage is only used if it
* is available in the browser. That's a bit of a pain but makes sure
things won't break in older
* browsers.
*
* Furthermore and to facilitate the user experience we auto-focus the
search element which has a
* suitable title so that non-sighted users are not startled. This way we
address both UX concerns
* and accessibility.
*
* Finally, the search string is saved into session storage on the
assumption that the user is
* probably going to be creating multiple instances of the same task, one
after another, as is
* typical when building a new Joomla! site.
*/
// Make sure the element exists i.e. a template override has not removed
it.
const elSearch =
document.getElementById('comSchedulerSelectSearch');
const elSearchContainer =
document.getElementById('comSchedulerSelectSearchContainer');
const elSearchHeader =
document.getElementById('comSchedulerSelectTypeHeader');
const elSearchResults =
document.getElementById('comSchedulerSelectResultsContainer');
const alertElement = document.querySelector('.tasks-alert');
if (elSearch && elSearchContainer) {
// Add the keyboard event listener which performs the live search in the
cards
elSearch.addEventListener('keyup', ({
target
}) => {
/** @type {KeyboardEvent} event */
const partialSearch = target.value;
let hasSearchResults = false; // Save the search string into session
storage
if (typeof sessionStorage !== 'undefined') {
sessionStorage.setItem('Joomla.com_scheduler.new.search',
partialSearch);
}
// Iterate over all the task cards
document.querySelectorAll('.comSchedulerSelectCard').forEach(card
=> {
// First remove the class which hide the task cards
card.classList.remove('d-none');
// An empty search string means that we should show everything
if (!partialSearch) {
return;
}
const cardHeader = card.querySelector('.new-task-title');
const cardBody = card.querySelector('.new-task-caption');
const title = cardHeader ? cardHeader.textContent : '';
const description = cardBody ? cardBody.textContent : '';
// If the task title and description don’t match add a class to
hide it.
if (title &&
!title.toLowerCase().includes(partialSearch.toLowerCase()) &&
description &&
!description.toLowerCase().includes(partialSearch.toLowerCase())) {
card.classList.add('d-none');
} else {
hasSearchResults = true;
}
});
if (hasSearchResults || !partialSearch) {
alertElement.classList.add('d-none');
elSearchHeader.classList.remove('d-none');
elSearchResults.classList.remove('d-none');
} else {
alertElement.classList.remove('d-none');
elSearchHeader.classList.add('d-none');
elSearchResults.classList.add('d-none');
}
});
// For reasons of progressive enhancement the search box is hidden by
default.
elSearchContainer.classList.remove('d-none');
// Focus the just show element
elSearch.focus();
try {
if (typeof sessionStorage !== 'undefined') {
// Load the search string from session storage
elSearch.value =
sessionStorage.getItem('Joomla.com_scheduler.new.search') ||
'';
// Trigger the keyboard handler event manually to initiate the search
elSearch.dispatchEvent(new KeyboardEvent('keyup'));
}
} catch (e) {
// This is probably Internet Explorer which doesn't support the
KeyboardEvent constructor :(
}
}
js/scheduler-config.min.js.gz000064400000001057151167502460012152
0ustar00��RMo1��WL�d#j�ْ6�lRZ>�����
���gY�W4��&���/��{3��hA�Z����D&���.�È�`��ClB�og̋�n���R߉�N+
����}D������c��ˉ�z��C���(�ӌ!���n�F��A�e��qe}A���#�<T��
�(�d����.T:�'�E���-[�l��8��!�mo)sv1!�K��D��uN7��ɔQ�&��
�rXo
2�=+\��h>I
��w�T@_`�c�z�Ql���P����H�a<�>�w��f�
�ݫ��<�ƽ���8^��,��m+��P`���\�u{;��lf��e��n�O��9�%�9wX���n!g�ë�PJE�D�=��"1Κ��)6�=��0En����T��KKe<
���Y?M����N5SP��Dr�ǂe���hSU������R���z�[�m�Do��9�{"���G+�i�O��3�\�HX$4�M��ٮ�����js/admin-view-select-task-search.min.js000064400000003006151167502460014026
0ustar00/**
* @copyright (C) 2021 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/const
elSearch=document.getElementById("comSchedulerSelectSearch"),elSearchContainer=document.getElementById("comSchedulerSelectSearchContainer"),elSearchHeader=document.getElementById("comSchedulerSelectTypeHeader"),elSearchResults=document.getElementById("comSchedulerSelectResultsContainer"),alertElement=document.querySelector(".tasks-alert");if(elSearch&&elSearchContainer){elSearch.addEventListener("keyup",({target:s})=>{const
e=s.value;let o=!1;typeof
sessionStorage<"u"&&sessionStorage.setItem("Joomla.com_scheduler.new.search",e),document.querySelectorAll(".comSchedulerSelectCard").forEach(t=>{if(t.classList.remove("d-none"),!e)return;const
n=t.querySelector(".new-task-title"),c=t.querySelector(".new-task-caption"),a=n?n.textContent:"",r=c?c.textContent:"";a&&!a.toLowerCase().includes(e.toLowerCase())&&r&&!r.toLowerCase().includes(e.toLowerCase())?t.classList.add("d-none"):o=!0}),o||!e?(alertElement.classList.add("d-none"),elSearchHeader.classList.remove("d-none"),elSearchResults.classList.remove("d-none")):(alertElement.classList.remove("d-none"),elSearchHeader.classList.add("d-none"),elSearchResults.classList.add("d-none"))}),elSearchContainer.classList.remove("d-none"),elSearch.focus();try{typeof
sessionStorage<"u"&&(elSearch.value=sessionStorage.getItem("Joomla.com_scheduler.new.search")||"",elSearch.dispatchEvent(new
KeyboardEvent("keyup")))}catch{}}
js/admin-view-run-test-task.min.js000064400000004345151167502460013074
0ustar00import i from"joomla.dialog";/**
* @copyright (C) 2021 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/const a=(r,t="",d=[])=>{const
o=document.createElement(r);return
o.textContent=t,d&&d.length&&o.classList.add(...d),o},c=(r,t)=>{const
d=t.querySelector(".scheduler-status"),o=t.querySelector(".progress-bar"),s=e=>{o.style.width="100%",o.classList.add(e?"bg-success":"bg-danger"),setTimeout(()=>o.classList.remove("progress-bar-animated"),500)};o.style.width="15%",fetch(r,{headers:{"X-CSRF-Token":Joomla.getOptions("csrf.token","")}}).then(e=>{if(!e.ok)throw
new
Error(Joomla.Text._("JLIB_JS_AJAX_ERROR_OTHER").replace("%s",e.status).replace("%d",e.status));return
e.json()}).then(e=>{if(!e.data)throw new
Error(Joomla.Text._("JLIB_JS_AJAX_ERROR_NO_CONTENT"));d.textContent=Joomla.Text._("COM_SCHEDULER_TEST_RUN_STATUS_COMPLETED"),e.data.duration>0&&t.appendChild(a("div",Joomla.Text._("COM_SCHEDULER_TEST_RUN_DURATION").replace("%s",e.data.duration.toFixed(2)))),e.data.output&&(t.appendChild(a("div",Joomla.Text._("COM_SCHEDULER_TEST_RUN_OUTPUT").replace("%s","").replace("<br>",""))),t.appendChild(a("pre",e.data.output,["bg-body","p-2"]))),s(!0)}).catch(e=>{s(!1),d.textContent=Joomla.Text._("COM_SCHEDULER_TEST_RUN_STATUS_TERMINATED"),t.appendChild(a("div",e.message,["text-danger"]))})};document.addEventListener("click",r=>{const
t=r.target.closest("button[data-scheduler-run]");if(!t)return;r.preventDefault();const{id:d,title:o,url:s}=t.dataset,e=(()=>{const
n=a("div","",["p-3"]),_=a("div","",["progress","mb-2"]),T=a("div","",["progress-bar","progress-bar-striped","progress-bar-animated"]);return
n.appendChild(a("h4",Joomla.Text._("COM_SCHEDULER_TEST_RUN_TASK").replace("%s",o))),n.appendChild(a("div",Joomla.Text._("COM_SCHEDULER_TEST_RUN_STATUS_STARTED"),["mb-2","scheduler-status"])),_.appendChild(T),n.appendChild(_),T.style.width="0%",n})(),l=new
i({popupType:"inline",textHeader:Joomla.Text._("COM_SCHEDULER_TEST_RUN_TITLE").replace("%d",d),textClose:Joomla.Text._("JCLOSE"),popupContent:e,width:"800px",height:"fit-content"});l.addEventListener("joomla-dialog:open",()=>{c(s,e)}),l.addEventListener("joomla-dialog:close",()=>{window.location.reload()}),l.show()});