Support warning/error messages

This commit is contained in:
Jan Kvetina 2022-03-12 20:55:18 +01:00
parent 6eb977de31
commit 0a90557de9
3 changed files with 26 additions and 7 deletions

View File

@ -153,14 +153,24 @@ var apex_page_loaded = function() {
async : true,
dataType : 'json',
success : function(data) {
if (data.message && data.status == 'SUCCESS') {
apex.message.showPageSuccess(data.message);
if (data.message) {
if (data.status == 'SUCCESS') {
apex.message.showPageSuccess(data.message);
}
else if (data.status == 'WARNING' || data.status == 'ERROR') {
apex.message.showErrors([{
type: apex.message.TYPE.ERROR,
location: ['page'],
message: data.message,
unsafe: false
}]);
}
}
}
}
);
loop(i);
}, 10000); // 10sec forever
}, 6000); // 6sec forever
})();
}
};

View File

@ -348,7 +348,7 @@ CREATE OR REPLACE PACKAGE BODY app AS
RETURN COALESCE(out_value, out_default, in_name);
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN NULL;
RETURN in_name;
END;

View File

@ -238,6 +238,17 @@ CREATE OR REPLACE PACKAGE BODY app_actions AS
);
--
app.log_success(TO_CHAR(in_log_id));
EXCEPTION
WHEN OTHERS THEN
app_actions.send_message (
in_app_id => in_app_id,
in_user_id => in_user_id,
in_message => app.get_translated_message('MVW_FAILED', in_app_id, in_lang_id),
in_type => 'WARNING'
);
COMMIT;
--
app.raise_error();
END;
@ -1848,8 +1859,6 @@ CREATE OR REPLACE PACKAGE BODY app_actions AS
--
-- APEX_APPLICATION.G_X01, APEX_APPLICATION.G_X02, APEX_APPLICATION.G_X03
--
APEX_JSON.WRITE('status', 'SUCCESS');
--
FOR c IN (
SELECT m.*
FROM user_messages m
@ -1861,7 +1870,7 @@ CREATE OR REPLACE PACKAGE BODY app_actions AS
FETCH FIRST 1 ROWS ONLY
) LOOP
APEX_JSON.WRITE('message', c.message_payload);
APEX_JSON.WRITE('type', c.message_type);
APEX_JSON.WRITE('status', NVL(c.message_type, 'SUCCESS'));
--
UPDATE user_messages m
SET m.delivered_at = SYSDATE