mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-15 08:48:42 +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)) {
|
if (this.callbacks.hasOwnProperty(group)) {
|
||||||
return this.triggerSingleEvent(group, id, data);
|
return this.triggerSingleEvent(group, id, data);
|
||||||
}p
|
}
|
||||||
|
|
||||||
const allGroups = Object.keys(this.callbacks),
|
const allGroups = Object.keys(this.callbacks),
|
||||||
regex = new RegExp(group),
|
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";
|
"use strict";
|
||||||
|
|
||||||
|
console.log('prevented');
|
||||||
|
|
||||||
jsOMS.preventAll(action.data);
|
jsOMS.preventAll(action.data);
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { Request } from '../../../Message/Request/Request.js';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set message.
|
* Set message.
|
||||||
*
|
*
|
||||||
|
|
@ -11,7 +14,7 @@ export function requestAction (action, callback)
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/** global: jsOMS */
|
/** 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) {
|
request.setSuccess(function(xhr) {
|
||||||
console.log(xhr.responseText);
|
console.log(xhr.responseText);
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ export class ActionManager {
|
||||||
*/
|
*/
|
||||||
constructor(app)
|
constructor(app)
|
||||||
{
|
{
|
||||||
|
this.logger = Logger.getInstance();
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.actions = {};
|
this.actions = {};
|
||||||
};
|
};
|
||||||
|
|
@ -55,7 +56,7 @@ export class ActionManager {
|
||||||
bindElement (e)
|
bindElement (e)
|
||||||
{
|
{
|
||||||
if (!jsOMS.isValidJson(e.getAttribute('data-action'))) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +123,7 @@ export class ActionManager {
|
||||||
|
|
||||||
for (let j = 1; j < actionLength; ++j) {
|
for (let j = 1; j < actionLength; ++j) {
|
||||||
if (typeof id === 'undefined' || typeof listener.key === 'undefined') {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -162,7 +163,7 @@ export class ActionManager {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
if (!this.actions.hasOwnProperty(action.type)) {
|
if (!this.actions.hasOwnProperty(action.type)) {
|
||||||
jsOMS.Log.Logger.instance.warning('Undefined action ' + action.type);
|
this.logger.warning('Undefined action ' + action.type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user