mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Remove testing code
This commit is contained in:
parent
8312efe927
commit
7d5d6dad28
@ -1,87 +0,0 @@
|
|||||||
##########################################################################
|
|
||||||
#
|
|
||||||
# pgAdmin 4 - PostgreSQL Tools
|
|
||||||
#
|
|
||||||
# Copyright (C) 2013 - 2016, The pgAdmin Development Team
|
|
||||||
# This software is released under the PostgreSQL Licence
|
|
||||||
#
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
"""Browser integration functions for the Test module."""
|
|
||||||
MODULE_NAME = 'test'
|
|
||||||
from flask.ext.security import login_required
|
|
||||||
from flask import url_for, current_app
|
|
||||||
from flask.ext.babel import gettext
|
|
||||||
from pgadmin.utils import PgAdminModule
|
|
||||||
from pgadmin.utils.menu import MenuItem
|
|
||||||
from time import time, ctime
|
|
||||||
|
|
||||||
class TestModule(PgAdminModule):
|
|
||||||
|
|
||||||
def get_own_menuitems(self):
|
|
||||||
return {'file_items': [
|
|
||||||
MenuItem(name='mnu_generate_test_html',
|
|
||||||
label=gettext('Generated Test HTML'),
|
|
||||||
priority=2,
|
|
||||||
url=url_for('test.generated')),
|
|
||||||
MenuItem(name='mnu_test_alert',
|
|
||||||
label=gettext('Test Alert'),
|
|
||||||
priority=200,
|
|
||||||
module='pgAdmin.Test',
|
|
||||||
category=gettext('alertify'),
|
|
||||||
callback='test_alert'),
|
|
||||||
MenuItem(name='mnu_test_confirm',
|
|
||||||
label=gettext('Test Confirm'),
|
|
||||||
priority=300,
|
|
||||||
module='pgAdmin.Test',
|
|
||||||
category=gettext('alertify'),
|
|
||||||
callback='test_confirm'),
|
|
||||||
MenuItem(name='mnu_test_dialog',
|
|
||||||
label=gettext('Test Dialog'),
|
|
||||||
priority=400,
|
|
||||||
module='pgAdmin.Test',
|
|
||||||
category=gettext('alertify'),
|
|
||||||
callback='test_dialog'),
|
|
||||||
MenuItem(name='mnu_test_prompt',
|
|
||||||
label=gettext('Test Prompt'),
|
|
||||||
priority=500,
|
|
||||||
module='pgAdmin.Test',
|
|
||||||
category=gettext('alertify'),
|
|
||||||
callback='test_prompt'),
|
|
||||||
MenuItem(name='mnu_test_notifier',
|
|
||||||
label=gettext('Test Notifier'),
|
|
||||||
priority=600,
|
|
||||||
module='pgAdmin.Test',
|
|
||||||
category=gettext('alertify'),
|
|
||||||
callback='test_notifier'),
|
|
||||||
MenuItem(name='mnu_test_disabled',
|
|
||||||
label=gettext('Test Disabled'),
|
|
||||||
priority=700,
|
|
||||||
module='pgAdmin.Test',
|
|
||||||
callback='test_notifier',
|
|
||||||
enable=False)
|
|
||||||
]}
|
|
||||||
|
|
||||||
def get_own_javascripts(self):
|
|
||||||
return [{
|
|
||||||
'name': 'pgadmin.test',
|
|
||||||
'path': url_for('test.static', filename='js/test'),
|
|
||||||
'when': None
|
|
||||||
}]
|
|
||||||
|
|
||||||
# Initialise the module
|
|
||||||
blueprint = TestModule(MODULE_NAME, __name__)
|
|
||||||
|
|
||||||
@blueprint.route("/generated")
|
|
||||||
@login_required
|
|
||||||
def generated():
|
|
||||||
"""Generate a simple test page to demonstrate that output can be rendered."""
|
|
||||||
output = """
|
|
||||||
Today is <b>%s</b>
|
|
||||||
<br />
|
|
||||||
<i>This is Flask-generated HTML.</i>
|
|
||||||
<br /><br />
|
|
||||||
<a href="http://www.pgadmin.org/">%s v%s</a>""" % (ctime(time()),
|
|
||||||
current_app.config['APP_NAME'],
|
|
||||||
current_app.config['APP_VERSION'])
|
|
||||||
return output
|
|
@ -1,99 +0,0 @@
|
|||||||
define(
|
|
||||||
['jquery', 'alertify', 'pgadmin', 'pgadmin.node.server', 'pgadmin.node.server-group'],
|
|
||||||
function($, alertify, pgAdmin, pgServer, ServerGroup) {
|
|
||||||
pgAdmin = pgAdmin || window.pgAdmin || {};
|
|
||||||
|
|
||||||
if (pgAdmin.Test)
|
|
||||||
return pgAdmin.Test;
|
|
||||||
|
|
||||||
pgAdmin.Test = {
|
|
||||||
test_alert: function() {
|
|
||||||
alertify.alert(
|
|
||||||
'Alert Test',
|
|
||||||
'This is a test alert from Alertify!'
|
|
||||||
);
|
|
||||||
},
|
|
||||||
test_prompt: function() {
|
|
||||||
var alert = alertify.prompt(
|
|
||||||
'Prompt Test',
|
|
||||||
'Enter a value to configure the application',
|
|
||||||
'Enter a value',
|
|
||||||
function(evt, value) { alertify.message('You entered: ' + value);},
|
|
||||||
function(evt, value) { alertify.message('You cancelled');}
|
|
||||||
);
|
|
||||||
alert.show();
|
|
||||||
},
|
|
||||||
test_confirm: function() {
|
|
||||||
alertify.confirm(
|
|
||||||
'Confirm Test',
|
|
||||||
'This is a confirmation message from Alertify!');
|
|
||||||
},
|
|
||||||
test_notifier: function() {
|
|
||||||
alertify.notify(
|
|
||||||
'Notifier Test',
|
|
||||||
'success',
|
|
||||||
5,
|
|
||||||
function() { console.log('dismissed'); }
|
|
||||||
);
|
|
||||||
},
|
|
||||||
test_dialog: function() {
|
|
||||||
if (!alertify.myAlert) {
|
|
||||||
alertify.dialog('myAlert', function factory() {
|
|
||||||
return {
|
|
||||||
main: function(title, message, data) {
|
|
||||||
this.set('title', title);
|
|
||||||
this.message = message;
|
|
||||||
this.data = data;
|
|
||||||
},
|
|
||||||
setup:function() {
|
|
||||||
return {
|
|
||||||
buttons: [
|
|
||||||
{text: "Cancel", key: 27, className: "btn btn-danger"}],
|
|
||||||
focus: { element: 0 },
|
|
||||||
options: { modal: 0, title: this.title }
|
|
||||||
};
|
|
||||||
},
|
|
||||||
prepare:function() {
|
|
||||||
this.setContent(this.message);
|
|
||||||
},
|
|
||||||
callback:function(closeEvent) {
|
|
||||||
alertify.alert('Close Event', 'You pressed: ' + closeEvent.button.text + ' on ' + this.data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
true /* Transient */ );
|
|
||||||
}
|
|
||||||
|
|
||||||
alertify.myAlert('Dialog Test',
|
|
||||||
'This is a test dialog from Alertify!', 'This is dialog 1');
|
|
||||||
|
|
||||||
alertify.myAlert('Dialog Test 2',
|
|
||||||
'This is another test dialog from Alertify!', 'This is dialog 2');
|
|
||||||
},
|
|
||||||
init: function() {
|
|
||||||
if (this.initialized)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this.initialized = true;
|
|
||||||
|
|
||||||
// Add the alertify category
|
|
||||||
pgAdmin.Browser.add_menu_category(
|
|
||||||
'alertify', 'Alertify', 3, 'fa fa-film', true, true
|
|
||||||
);
|
|
||||||
|
|
||||||
pgServer.on(
|
|
||||||
'server-connected', function() {
|
|
||||||
console.log(arguments);
|
|
||||||
console.log('Yay - we connected the server!');
|
|
||||||
},
|
|
||||||
{'a': 'test'});
|
|
||||||
|
|
||||||
ServerGroup.on('browser-node.loaded', function() {
|
|
||||||
console.log('I know that the server-group has been expanded!');
|
|
||||||
}, pgAdmin.Test);
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return pgAdmin.Test;
|
|
||||||
});
|
|
Loading…
Reference in New Issue
Block a user