mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
Qu1003 (#621)
* use new peeringdb client (1.0.0) for pdb_load_data sync (#599) * drop django-mobi for lack of py3/dj2 support (#492) remove django-forms-bootstrap for lack of py3/dj2 support (#492) * black formatted * django2.2 and py3 upgrade (#492) * drop ixlans (#21) ui and api changes * drop local_asn (#168) * org search (#193) * phone number validation (#50) * implement help text tooltips (#228) * Mark own ASN as transit-free (#394) * py3 fix for `pdb_migrate_ixlans` command when writing migration report * pdb_migrate_ixlans: properly handle py3 Runtime error if ixlan dict changes during iteration * set rest DEFAULT_SCHEMA_CLASS to coreapi to fix swagger apidocs fix migration 0027 missing from facsimile manifest * fix swagger doc strings * fix tests that were broken from api doc fixes * fix UniqueFieldValidator for netixlan ipaddress validation that broke during django/drf upgrade * fix org merge tool layout issues * travis config * update pipfile and lock * black formatting * update travis dist * beta mode banner (#411) * add beta banner template (#411) * automatically scheduled sync may not always be on, add a flag that lets us reflect that state in the beta banner message clean up beta banner implementation (#411) * add tests for beta banner (#411)
This commit is contained in:
@@ -186,6 +186,57 @@ function moveCursorToEnd(el) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tools to handle pre and post processing of ix/net/fac/org views
|
||||
* submissions
|
||||
* @class ViewTools
|
||||
* @namespace PeeringDB
|
||||
*/
|
||||
|
||||
PeeringDB.ViewTools = {
|
||||
|
||||
/**
|
||||
* applies the value of a field as it was returned by the
|
||||
* server in the response to the submissions to the corresponding
|
||||
* form element on the page
|
||||
*
|
||||
* this only needs to be done for fields that rely on server side
|
||||
* data validation that can't be done locally
|
||||
*
|
||||
* @method apply_data
|
||||
* @param {jQuery} container - main js-edit element for the submissions
|
||||
* @param {Object} data - object literal containing server response for the entity
|
||||
* @param {String} field - field name
|
||||
*/
|
||||
|
||||
apply_data : function(container, data, field) {
|
||||
|
||||
var input;
|
||||
input = $('[data-edit-name="'+field+'"]').data("edit-input-instance")
|
||||
if(input) {
|
||||
input.set(data[field]);
|
||||
input.apply(data[field]);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* after submission cleanup / handling
|
||||
*
|
||||
* @method after_submit
|
||||
* @param {jQuery} container - main js-edit element for the submissions
|
||||
* @param {Object} data - object literal containing server response for the entity
|
||||
*/
|
||||
|
||||
after_submit : function(container, data) {
|
||||
var target = container.data("edit-target")
|
||||
if(target == "api:ix:update") {
|
||||
this.apply_data(container, data, "tech_phone");
|
||||
this.apply_data(container, data, "policy_phone");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PeeringDB.ViewActions = {
|
||||
|
||||
init : function() {
|
||||
@@ -201,6 +252,13 @@ PeeringDB.ViewActions = {
|
||||
actions : {}
|
||||
}
|
||||
|
||||
PeeringDB.ViewActions.actions.ix_ixf_preview = function(netId) {
|
||||
$("#ixf-preview-modal").modal("show");
|
||||
var preview = new PeeringDB.IXFPreview()
|
||||
preview.request(netId, $("#ixf-log"));
|
||||
}
|
||||
|
||||
|
||||
PeeringDB.ViewActions.actions.net_ixf_preview = function(netId) {
|
||||
$("#ixf-preview-modal").modal("show");
|
||||
var preview = new PeeringDB.IXFNetPreview()
|
||||
@@ -211,7 +269,6 @@ PeeringDB.ViewActions.actions.net_ixf_postmortem = function(netId) {
|
||||
$("#ixf-postmortem-modal").modal("show");
|
||||
var postmortem = new PeeringDB.IXFNetPostmortem()
|
||||
postmortem.request(netId, $("#ixf-postmortem"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1036,6 +1093,7 @@ twentyc.editable.target.register(
|
||||
"base"
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* editable api listing module
|
||||
*/
|
||||
@@ -1047,6 +1105,7 @@ twentyc.editable.module.register(
|
||||
|
||||
init : function() {
|
||||
this.listing_init();
|
||||
|
||||
this.container.on("listing:row-add", function(e, rowId, row, data, me) {
|
||||
var target = me.target;
|
||||
if(!target)
|
||||
@@ -1100,9 +1159,18 @@ twentyc.editable.module.register(
|
||||
|
||||
submit : function(id, data, row, trigger, container) {
|
||||
data._id = id;
|
||||
var me = this;
|
||||
var sentData = data;
|
||||
this.target.data = data;
|
||||
this.target.args[2] = "update"
|
||||
this.target.context = row;
|
||||
|
||||
$(this.target).on("success", function(ev, data) {
|
||||
var finalizer = "finalize_update_"+me.target.args[1];
|
||||
if(me[finalizer]) {
|
||||
me[finalizer](id, row, data);
|
||||
}
|
||||
});
|
||||
this.target.execute();
|
||||
},
|
||||
|
||||
@@ -1174,13 +1242,21 @@ twentyc.editable.module.register(
|
||||
|
||||
finalize_row_poc : function(rowId, row, data) {
|
||||
row.editable("payload", {
|
||||
net_id : data.network,
|
||||
net_id : data.net_id,
|
||||
role : data.role
|
||||
})
|
||||
|
||||
//row.find(".phone").val(data.phone);
|
||||
var phone = row.find(".phone").data("edit-input-instance")
|
||||
phone.set(data.phone)
|
||||
|
||||
row.data("edit-label", gettext("Network Contact") + ": "+data.name); ///
|
||||
},
|
||||
|
||||
finalize_update_poc : function(rowId, row, data) {
|
||||
row.find(".phone").text(data.phone);
|
||||
},
|
||||
|
||||
// FINALIZERS: NETIX
|
||||
|
||||
finalize_row_netixlan : function(rowId, row, data) {
|
||||
@@ -1276,34 +1352,6 @@ twentyc.editable.module.register(
|
||||
|
||||
},
|
||||
|
||||
// FINALIZERS: IXLAN
|
||||
|
||||
finalize_add_ixlan : function(data, callback, sentData) {
|
||||
|
||||
// we currently do not publish ix-f setting fields on the API
|
||||
// so we need to set those from sent data
|
||||
data.ixf_ixp_member_list_url = sentData.ixf_ixp_member_list_url;
|
||||
data.ixf_ixp_import_enabled = sentData.ixf_ixp_import_enabled;
|
||||
callback(data);
|
||||
},
|
||||
|
||||
|
||||
finalize_row_ixlan : function(rowId, row, data) {
|
||||
row.editable("payload", {
|
||||
ix_id : data.ix_id
|
||||
})
|
||||
row.data("edit-label", gettext("IXLAN") + ": "+data.name); ///
|
||||
|
||||
var modPrefix = row.find('[data-edit-module="api_listing"]');
|
||||
modPrefix.editable("sync");
|
||||
modPrefix.editable("toggle");
|
||||
|
||||
var cmpPrefixAdd = row.find('[data-edit-component="add"]')
|
||||
cmpPrefixAdd.editable("payload", {
|
||||
ixlan_id : data.id
|
||||
});
|
||||
},
|
||||
|
||||
// FINALIZERS: IXLAN PREFIX
|
||||
|
||||
finalize_row_ixpfx : function(rowId, row, data) {
|
||||
@@ -1382,6 +1430,23 @@ twentyc.editable.input.register(
|
||||
},
|
||||
"text"
|
||||
);
|
||||
|
||||
twentyc.editable.input.register(
|
||||
"readonly",
|
||||
{
|
||||
make : function() {
|
||||
return $('<span class="editable input-note-relative"></span>')
|
||||
},
|
||||
set : function(value) {
|
||||
this.element.text(value)
|
||||
},
|
||||
get : function(value) {
|
||||
return this.element.text()
|
||||
}
|
||||
},
|
||||
"text"
|
||||
);
|
||||
|
||||
/*
|
||||
* autocomplete input type
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user