@@ -9,6 +9,7 @@ app.controller('FagiGisCtrl', function($q, $scope, ConfigurationService, Compone
99
1010 var componentId = "FagiGis" ;
1111 var serviceId = "FagiGisService" ;
12+ var workbenchHP ;
1213
1314 ComponentsService . getComponent ( componentId ) . then (
1415 //success
@@ -17,6 +18,11 @@ app.controller('FagiGisCtrl', function($q, $scope, ConfigurationService, Compone
1718 $scope . service = ComponentsService . getComponentService ( serviceId , $scope . component ) ;
1819 if ( $scope . service == null )
1920 flash . error = "Service not configured: " + serviceId ;
21+
22+ workbenchHP = ConfigurationService . getFrameworkHomepage ( ) ;
23+ if ( workbenchHP . substr ( - 1 ) != '/' )
24+ workbenchHP += '/' ;
25+
2026 } ,
2127 function ( response ) {
2228 flash . error = "Component not configured: " + ServerErrorResponse . getMessage ( response ) ;
@@ -36,7 +42,24 @@ app.controller('FagiGisCtrl', function($q, $scope, ConfigurationService, Compone
3642 } ;
3743
3844 $scope . openService = function ( ) {
39- window . open ( $scope . service . serviceUrl ) ;
45+
46+ createAuthEndpoint ( ) . then ( function ( authEndpoint ) {
47+ var url = $scope . service . serviceUrl +
48+ '?endpoint-a=' + encodeURIComponent ( $scope . fagi . endpointA == $scope . endpoint ? authEndpoint : $scope . fagi . endpointA ) +
49+ '&endpoint-b=' + encodeURIComponent ( $scope . fagi . endpointB == $scope . endpoint ? authEndpoint : $scope . fagi . endpointB ) +
50+ '&dataset-a=' + encodeURIComponent ( $scope . fagi . datasetA != "" ? $scope . fagi . datasetA . replace ( ':' , ConfigurationService . getUriBase ( ) ) :"" ) +
51+ '&dataset-b=' + encodeURIComponent ( $scope . fagi . datasetB != "" ? $scope . fagi . datasetB . replace ( ':' , ConfigurationService . getUriBase ( ) ) :"" ) +
52+ '&postgis-username=' + encodeURIComponent ( $scope . fagi . database . dbUser ) +
53+ '&postgis-password=' + encodeURIComponent ( $scope . fagi . database . dbPassword ) +
54+ '&postgis-database=' + encodeURIComponent ( $scope . fagi . database . dbName ) +
55+ '&virtuoso-host=' + encodeURIComponent ( $scope . fagi . database . dbHost ) +
56+ '&virtuoso-port=' + encodeURIComponent ( $scope . fagi . database . dbPort ) +
57+ '&target-endpoint=' + encodeURIComponent ( authEndpoint ) +
58+ '&target-dataset=' + encodeURIComponent ( $scope . fagi . targetGraph . replace ( ':' , ConfigurationService . getUriBase ( ) ) ) ;
59+ console . log ( url ) ;
60+ window . open ( url ) ;
61+ } ) ;
62+
4063 return false ;
4164 }
4265
@@ -50,38 +73,42 @@ app.controller('FagiGisCtrl', function($q, $scope, ConfigurationService, Compone
5073
5174 var createAuthEndpoint = function ( ) {
5275 var deferred = $q . defer ( ) ;
76+ console . log ( $scope . fagi . targetEndpoint ) ;
5377 if ( $scope . fagi . targetEndpoint != "" )
5478 deferred . resolve ( $scope . fagi . targetEndpoint ) ;
5579 else {
56- var workbench = ConfigurationService . getComponent ( ConfigurationService . getFrameworkUri ( ) ) ;
5780 // get proxied endpoint
5881 AuthSessionService . createSession ( ) . then ( function ( response ) {
59- deferred . resolve ( workbench . homepage + response . data . endpoint ) ;
82+ deferred . resolve ( workbenchHP + response . data . endpoint ) ;
6083 } ) ;
6184 }
6285 return deferred . promise ;
6386 } ;
6487
88+ $scope . describeGraph = function ( ngraph ) {
89+ return ngraph . graph . label + " | " + ngraph . name ;
90+ } ;
91+
6592 $scope . updateServiceParams = function ( ) {
6693
67- if ( ! $scope . fagiForm . $valid )
68- return ;
94+ // if(!$scope.fagiForm.$valid)
95+ // return;
6996
70- createAuthEndpoint ( ) . then ( function ( authEndpoint ) {
71- $scope . url = $scope . service . serviceUrl +
72- '?endpoint-a=' + encodeURIComponent ( $scope . fagi . endpointA == $scope . endpoint ? authEndpoint : $scope . fagi . endpointA ) +
73- '&endpoint-b=' + encodeURIComponent ( $scope . fagi . endpointB == $scope . endpoint ? authEndpoint : $scope . fagi . endpointB ) +
74- '&dataset-a=' + encodeURIComponent ( $scope . fagi . datasetA != "" ? $scope . fagi . datasetA . replace ( ':' , ConfigurationService . getUriBase ( ) ) :"" ) +
75- '&dataset-b=' + encodeURIComponent ( $scope . fagi . datasetB != "" ? $scope . fagi . datasetB . replace ( ':' , ConfigurationService . getUriBase ( ) ) :"" ) +
76- '&postgis-username=' + encodeURIComponent ( $scope . fagi . database . dbUser ) +
77- '&postgis-password=' + encodeURIComponent ( $scope . fagi . database . dbPassword ) +
78- '&postgis-database=' + encodeURIComponent ( $scope . fagi . database . dbName ) +
79- '&postgis -host=' + encodeURIComponent ( $scope . fagi . database . dbHost ) +
80- '&postgis -port=' + encodeURIComponent ( $scope . fagi . database . dbPort ) +
81- '&target-endpoint=' + encodeURIComponent ( authEndpoint ) +
82- '&target-dataset=' + encodeURIComponent ( $scope . fagi . targetGraph . replace ( ':' , ConfigurationService . getUriBase ( ) ) ) ;
83- console . log ( $scope . url ) ;
84- } ) ;
97+ // createAuthEndpoint().then(function(authEndpoint){
98+ // $scope.url= $scope.service.serviceUrl +
99+ // '?endpoint-a=' + encodeURIComponent($scope.fagi.endpointA == $scope.endpoint? authEndpoint : $scope.fagi.endpointA ) +
100+ // '&endpoint-b=' + encodeURIComponent($scope.fagi.endpointB == $scope.endpoint? authEndpoint : $scope.fagi.endpointB ) +
101+ // '&dataset-a=' + encodeURIComponent($scope.fagi.datasetA!=""? $scope.fagi.datasetA.replace(':',ConfigurationService.getUriBase()):"") +
102+ // '&dataset-b=' + encodeURIComponent($scope.fagi.datasetB!=""? $scope.fagi.datasetB.replace(':',ConfigurationService.getUriBase()):"") +
103+ // '&postgis-username='+ encodeURIComponent($scope.fagi.database.dbUser) +
104+ // '&postgis-password='+ encodeURIComponent($scope.fagi.database.dbPassword) +
105+ // '&postgis-database='+ encodeURIComponent($scope.fagi.database.dbName) +
106+ // '&virtuoso -host='+ encodeURIComponent($scope.fagi.database.dbHost) +
107+ // '&virtuoso -port='+ encodeURIComponent($scope.fagi.database.dbPort) +
108+ // '&target-endpoint='+ encodeURIComponent(authEndpoint) +
109+ // '&target-dataset='+ encodeURIComponent($scope.fagi.targetGraph.replace(':',ConfigurationService.getUriBase())) ;
110+ // console.log($scope.url);
111+ // });
85112 } ;
86113
87114 $scope . createTargetGraph = function ( ) {
0 commit comments