@@ -125,6 +125,7 @@ function fakeAPI_MyServices () {
125125
126126function MyServiceCtrl ( $scope , $http ) {
127127 this . title = 'My Service' ;
128+ $scope . noServices = true ;
128129
129130 $scope . returnObjLength = function ( obj ) {
130131 var t = Object . keys ( obj )
@@ -146,11 +147,18 @@ function MyServiceCtrl ($scope, $http) {
146147 }
147148 $http . defaults . headers . common . Authorization = "Basic " + _base64 . encode ( 'testuser' + ":" + 'Hello' ) ;
148149 $http . get ( "http://127.0.0.1:8080/ui/myServices?categories=¤t=0&count=15" ) . success ( function ( data ) {
149- console . log ( data )
150- $scope . data = data
150+ console . log ( "Count of Services: " + $scope . returnObjLength ( data ) ) ;
151+ console . log ( data ) ;
152+ $scope . data = data ;
153+
154+ if ( $scope . returnObjLength ( data ) != 0 ) {
155+ // There is services to show --> Hide notification
156+ $scope . noServices = false ;
157+ }
158+
151159 } )
152160 . error ( function ( data ) {
153- console . log ( data )
161+ console . log ( data ) ;
154162 //$scope.data = fakeAPI_MyServices()
155163 } ) ;
156164}
@@ -711,8 +719,11 @@ function MyServiceDetailCtrl ($scope, $http, $stateParams, $state, $modal) {
711719
712720 function getServicesWithConsentDetails ( data ) {
713721
714- $scope . potentialDataSinkWithoutContract = [ ]
715- $scope . potentialDataSourceWithoutContract = [ ]
722+ $scope . potentialDataSinkWithoutContract = [ ] ;
723+ $scope . potentialDataSourceWithoutContract = [ ] ;
724+
725+ $scope . noSinkServicesWithoutContract = true ;
726+ $scope . noSourceServicesWithoutContract = true ;
716727
717728 Object . keys ( data . potentialServicesWithoutContract ) . forEach ( function ( id ) {
718729 var obj = data . potentialServicesWithoutContract [ id ]
@@ -721,10 +732,12 @@ function MyServiceDetailCtrl ($scope, $http, $stateParams, $state, $modal) {
721732 success ( function ( data , status , headers , config ) {
722733 data [ 'serviceID' ] = id
723734 if ( obj . role === 'Sink' || obj . role === 'Both' ) {
724- $scope . potentialDataSinkWithoutContract . push ( data [ id ] )
735+ $scope . potentialDataSinkWithoutContract . push ( data [ id ] ) ;
736+ $scope . noSinkServicesWithoutContract = false ;
725737 }
726738 if ( obj . role === 'Source' || obj . role === 'Both' ) {
727- $scope . potentialDataSourceWithoutContract . push ( data [ id ] )
739+ $scope . potentialDataSourceWithoutContract . push ( data [ id ] ) ;
740+ $scope . noSourceServicesWithoutContract = false ;
728741 }
729742
730743 } ) .
@@ -742,8 +755,11 @@ function MyServiceDetailCtrl ($scope, $http, $stateParams, $state, $modal) {
742755
743756 } ) ;
744757
745- $scope . potentialDataSinkWithContract = [ ]
746- $scope . potentialDataSourceWithContract = [ ]
758+ $scope . potentialDataSinkWithContract = [ ] ;
759+ $scope . potentialDataSourceWithContract = [ ] ;
760+
761+ $scope . noSinkServicesWithContract = true ;
762+ $scope . noSourceServicesWithContract = true ;
747763
748764 Object . keys ( data . potentialServicesWithContract ) . forEach ( function ( id ) {
749765 var obj = data . potentialServicesWithContract [ id ]
@@ -756,12 +772,14 @@ function MyServiceDetailCtrl ($scope, $http, $stateParams, $state, $modal) {
756772 d [ 'role' ] = obj . role
757773 console . log ( )
758774 if ( obj . role === 'Sink' || obj . role === 'Both' ) {
759- $scope . potentialDataSinkWithContract . push ( d )
775+ $scope . potentialDataSinkWithContract . push ( d ) ;
776+ $scope . noSinkServicesWithContract = false ;
760777 }
761778 if ( obj . role === 'Source' || obj . role === 'Both' ) {
762779 //FIX_FOR_DEMO: FIX THE DOT-NOTATION. CHANGE TO THE SAME STYLE SHOWING IN CONSENT DETAIL MODAL
763- d [ 'categories' ] = reorganize ( d [ 'categories' ] )
764- $scope . potentialDataSourceWithContract . push ( d )
780+ d [ 'categories' ] = reorganize ( d [ 'categories' ] ) ;
781+ $scope . potentialDataSourceWithContract . push ( d ) ;
782+ $scope . noSourceServicesWithContract = false ;
765783 }
766784
767785 console . log ( "potentialDataSinkWithContract" )
@@ -786,6 +804,9 @@ function MyServiceDetailCtrl ($scope, $http, $stateParams, $state, $modal) {
786804 $scope . datasinkWithConsent = [ ]
787805 $scope . datasourceWithConsent = [ ]
788806
807+ $scope . noSinkServicesWithoutConsent = true ;
808+ $scope . noSourceServicesWithoutConsent = true ;
809+
789810 Object . keys ( data . servicesWithConsent ) . forEach ( function ( id ) {
790811 var obj = data . servicesWithConsent [ id ]
791812 $http . defaults . headers . common . Authorization = "Basic " + _base64 . encode ( 'testuser' + ":" + 'Hello' ) ;
@@ -801,12 +822,14 @@ function MyServiceDetailCtrl ($scope, $http, $stateParams, $state, $modal) {
801822 d [ 'duration' ] = obj . duration
802823 d [ 'role' ] = obj . role
803824 if ( obj . role === 'Sink' || obj . role === 'Both' ) {
804- $scope . datasinkWithConsent . push ( d )
825+ $scope . datasinkWithConsent . push ( d ) ;
826+ $scope . noSinkServicesWithoutConsent = false ;
805827 }
806828 if ( obj . role === 'Source' || obj . role === 'Both' ) {
807829 //FIX_FOR_DEMO: FIX THE DOT-NOTATION. CHANGE TO THE SAME STYLE SHOWING IN CONSENT DETAIL MODAL
808- d [ 'categories' ] = reorganize ( d [ 'categories' ] )
809- $scope . datasourceWithConsent . push ( d )
830+ d [ 'categories' ] = reorganize ( d [ 'categories' ] ) ;
831+ $scope . datasourceWithConsent . push ( d ) ;
832+ $scope . noSourceServicesWithoutConsent = false ;
810833 }
811834 } ) .
812835 error ( function ( data , status , headers , config ) {
@@ -1145,22 +1168,41 @@ function ServiceDetailCtrl ($scope, $http, $stateParams, $modal, $state) {
11451168 } ) ;
11461169 }
11471170
1148- $scope . servicesCanAccess = [ ]
1171+ $scope . sinkServicesCanAccess = [ ]
1172+ $scope . sourceServicesCanAccess = [ ]
1173+
1174+ $scope . noSinkServices = true ;
1175+ $scope . noSourceServices = true ;
11491176
11501177 function makeListOfserviceCanAccess ( serviceDetails ) {
11511178 Object . keys ( serviceDetails . potentialServicesWithContract ) . forEach ( function ( id ) {
1179+ var obj = serviceDetails . potentialServicesWithContract [ id ]
11521180 $http . defaults . headers . common . Authorization = "Basic " + _base64 . encode ( 'testuser' + ":" + 'Hello' ) ;
11531181 $http . get ( 'http://127.0.0.1:8080/ui/services/' + id ) .
11541182 success ( function ( data , status , headers , config ) {
11551183 console . log ( data )
1156- $scope . servicesCanAccess . push ( data [ id ] )
1184+ var d = data [ id ]
1185+ d [ 'serviceID' ] = id
1186+
1187+ //$scope.servicesCanAccess.push(d)
1188+ //$scope.servicesCanAccess.push(data[id])
1189+
1190+ if ( obj . role === 'Sink' || obj . role === 'Both' ) {
1191+ $scope . sinkServicesCanAccess . push ( data [ id ] ) ;
1192+ //console.log("Length of sinkServicesCanAccess: " + $scope.sinkServicesCanAccess.length);
1193+ $scope . noSinkServices = false ;
1194+ }
1195+ if ( obj . role === 'Source' || obj . role === 'Both' ) {
1196+ $scope . sourceServicesCanAccess . push ( data [ id ] ) ;
1197+ //console.log("Length of sourceServicesCanAccess: " + $scope.sourceServicesCanAccess.length);
1198+ $scope . noSourceServices = false ;
1199+ }
11571200 } ) .
11581201 error ( function ( data , status , headers , config ) {
11591202 //$scope.servicesCanAccess.push(fakeAPI_Service(id)[id])
11601203 } ) ;
1161- } )
1204+ } ) ;
11621205 }
1163-
11641206}
11651207
11661208function HomeCtrl ( $scope , $http ) {
0 commit comments