mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 17:58:41 +00:00
implement additional actions (reason was logout functionality)
This commit is contained in:
parent
4514673727
commit
bf803f6919
|
|
@ -103,7 +103,7 @@ export class EventManager {
|
|||
{
|
||||
if (this.callbacks.hasOwnProperty(group)) {
|
||||
return this.triggerSingleEvent(group, id, data);
|
||||
}p
|
||||
}
|
||||
|
||||
const allGroups = Object.keys(this.callbacks),
|
||||
regex = new RegExp(group),
|
||||
|
|
|
|||
19
Model/Action/Dom/Reload.js
Normal file
19
Model/Action/Dom/Reload.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Reload dom.
|
||||
*
|
||||
* @param {Object} action Action data
|
||||
* @param {function} callback Callback
|
||||
* @param {string} id Action element
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export function reloadButtonAction (action, callback, id)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
setTimeout(function () {
|
||||
document.location.reload(true);
|
||||
}, parseInt(action.delay));
|
||||
|
||||
callback();
|
||||
};
|
||||
|
|
@ -11,6 +11,8 @@ export function preventEvent (action, callback, id)
|
|||
{
|
||||
"use strict";
|
||||
|
||||
console.log('prevented');
|
||||
|
||||
jsOMS.preventAll(action.data);
|
||||
|
||||
callback();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
import { Request } from '../../../Message/Request/Request.js';
|
||||
|
||||
|
||||
/**
|
||||
* Set message.
|
||||
*
|
||||
|
|
@ -11,7 +14,7 @@ export function requestAction (action, callback)
|
|||
"use strict";
|
||||
|
||||
/** global: jsOMS */
|
||||
const request = new jsOMS.Message.Request.Request(action.uri, action.method, action.request_type);
|
||||
const request = new Request(action.uri, action.method, action.request_type);
|
||||
|
||||
request.setSuccess(function(xhr) {
|
||||
console.log(xhr.responseText);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ export class ActionManager {
|
|||
*/
|
||||
constructor(app)
|
||||
{
|
||||
this.logger = Logger.getInstance();
|
||||
this.app = app;
|
||||
this.actions = {};
|
||||
};
|
||||
|
|
@ -55,7 +56,7 @@ export class ActionManager {
|
|||
bindElement (e)
|
||||
{
|
||||
if (!jsOMS.isValidJson(e.getAttribute('data-action'))) {
|
||||
jsOMS.Log.Logger.instance.error('Invalid json string: \'' + e.getAttribute('data-action') + '\'');
|
||||
this.logger.error('Invalid json string: \'' + e.getAttribute('data-action') + '\'');
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -122,7 +123,7 @@ export class ActionManager {
|
|||
|
||||
for (let j = 1; j < actionLength; ++j) {
|
||||
if (typeof id === 'undefined' || typeof listener.key === 'undefined') {
|
||||
jsOMS.Log.Logger.instance.error('Invalid element id/key: ' + id + '/' + listener.key);
|
||||
this.logger.error('Invalid element id/key: ' + id + '/' + listener.key);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +163,7 @@ export class ActionManager {
|
|||
const self = this;
|
||||
|
||||
if (!this.actions.hasOwnProperty(action.type)) {
|
||||
jsOMS.Log.Logger.instance.warning('Undefined action ' + action.type);
|
||||
this.logger.warning('Undefined action ' + action.type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user