MT#9177 Bootstrap_uri logic and fixes.

changes/52/552/1
Irina Peshinskaya 11 years ago
parent 089432204e
commit 64dd9c01e2

@ -286,10 +286,10 @@ sub devmod_edit :Chained('devmod_base') :PathPart('edit') :Args(0) :Does(ACL) :A
push @{ $params->{linerange} }, $r;
}
#TODO: TO inflate/deflate, I think
foreach ( $c->model('DB')->resultset('autoprov_sync_parameters')->search_rs({
'me.bootstrap_method' => $c->stash->{devmod}->bootstrap_method,
foreach ( $c->model('DB')->resultset('autoprov_sync')->search_rs({
device_id =>$c->stash->{devmod}->id,
})->all ){
$params->{'bootstrap_config_'.$c->stash->{devmod}->bootstrap_method.'_'.$_->parameter_name} = $_->parameter_value;
$params->{'bootstrap_config_'.$c->stash->{devmod}->bootstrap_method.'_'.$_->autoprov_sync_parameters->parameter_name} = $_->parameter_value;
}
my $credentials_rs = $c->model('DB')->resultset('autoprov_redirect_credentials')->search_rs({
'me.device_id' => $c->stash->{devmod}->id,

@ -213,6 +213,16 @@ has_field 'bootstrap_method' => (
javascript => ' onchange="bootstrapDynamicFields(this.options[this.selectedIndex].value);" ',
},
);
has_field 'bootstrap_uri' => (
type => 'Text',
required => 0,
label => 'Bootstrap URI',
default => '',
element_attr => {
rel => ['tooltip'],
title => ['Custom provisioning server URI.'],
},
);
has_field 'bootstrap_config_http_sync_uri' => (
@ -288,7 +298,7 @@ has_field 'save' => (
has_block 'fields' => (
tag => 'div',
class => [qw/modal-body/],
render_list => [qw/vendor model linerange linerange_add bootstrap_method bootstrap_config_http_sync_uri bootstrap_config_http_sync_method bootstrap_config_http_sync_params bootstrap_config_redirect_panasonic_user bootstrap_config_redirect_panasonic_password front_image mac_image/],
render_list => [qw/vendor model linerange linerange_add bootstrap_uri bootstrap_method bootstrap_config_http_sync_uri bootstrap_config_http_sync_method bootstrap_config_http_sync_params bootstrap_config_redirect_panasonic_user bootstrap_config_redirect_panasonic_password front_image mac_image/],
);
has_block 'actions' => (

@ -7,7 +7,7 @@ use Moose::Util::TypeConstraints;
has_block 'fields' => (
tag => 'div',
class => [qw/modal-body/],
render_list => [qw/reseller vendor model linerange bootstrap_method bootstrap_config_http_sync_uri bootstrap_config_http_sync_method bootstrap_config_http_sync_params bootstrap_config_redirect_panasonic_user bootstrap_config_redirect_panasonic_password/],
render_list => [qw/reseller vendor model linerange bootstrap_uri bootstrap_method bootstrap_config_http_sync_uri bootstrap_config_http_sync_method bootstrap_config_http_sync_params bootstrap_config_redirect_panasonic_user bootstrap_config_redirect_panasonic_password/],
);
override 'field_list' => sub {

@ -26,7 +26,7 @@ has_field 'save' => (
has_block 'fields' => (
tag => 'div',
class => [qw/modal-body/],
render_list => [qw/reseller vendor model linerange linerange_add bootstrap_method bootstrap_config_http_sync_uri bootstrap_config_http_sync_method bootstrap_config_http_sync_params bootstrap_config_redirect_panasonic_user bootstrap_config_redirect_panasonic_password front_image mac_image/],
render_list => [qw/reseller vendor model linerange linerange_add bootstrap_uri bootstrap_method bootstrap_config_http_sync_uri bootstrap_config_http_sync_method bootstrap_config_http_sync_params bootstrap_config_redirect_panasonic_user bootstrap_config_redirect_panasonic_password front_image mac_image/],
);
has_block 'actions' => (

@ -25,8 +25,13 @@ sub prepare {
$p->{auth} = encode_base64($creds->user.':'.$creds->password);
}
$p->{uri} = NGCP::Panel::Utils::DeviceBootstrap::get_baseuri($c);
$p->{uri} .= '{MAC}';
$p->{uri} = ($devmod->bootstrap_uri)
? $devmod->bootstrap_uri
: NGCP::Panel::Utils::DeviceBootstrap::get_baseuri($c);
if ($p->{uri} !~/\{MAC\}$/){
$p->{uri} .= '{MAC}' ;
}
$p->{uri} = URI::Escape::uri_escape($p->{uri});
return $p;

Loading…
Cancel
Save