diff --git a/openbis-ipad/BisKit/Classes/CISDOBIpadService.h b/openbis-ipad/BisKit/Classes/CISDOBIpadService.h index 286468e8a990832ea06d220ee6c708cd4b16ac9d..bd5632dd6af24d571cbeb5a0caa8265be386a288 100644 --- a/openbis-ipad/BisKit/Classes/CISDOBIpadService.h +++ b/openbis-ipad/BisKit/Classes/CISDOBIpadService.h @@ -56,6 +56,9 @@ enum CISOBIpadServiceErrorCode { //! A call that has no purpose except to inform the server that we are still here - (CISDOBAsyncCall *)heartbeat; +//! Get all top-level categories from the openBIS ipad service. The success block will be invoked with a collection of CISDOBIpadRawEntity objects. +- (CISDOBAsyncCall *)listNavigationalEntities; + //! Get all root-level entities from the openBIS ipad service, possibly along with some children as well. The success block will be invoked with a collection of CISDOBIpadRawEntity objects. - (CISDOBAsyncCall *)listRootLevelEntities; diff --git a/openbis-ipad/BisKit/Classes/CISDOBIpadService.m b/openbis-ipad/BisKit/Classes/CISDOBIpadService.m index c8426d5acfaab169359711c80d8354e16afd8601..d219906939bcab4af6621cd11ef51f396253e20d 100644 --- a/openbis-ipad/BisKit/Classes/CISDOBIpadService.m +++ b/openbis-ipad/BisKit/Classes/CISDOBIpadService.m @@ -147,6 +147,13 @@ static id OpenBisTableRowValueAtIndex(NSArray *rowData, NSUInteger index) return serviceCall; } +- (CISDOBAsyncCall *)listNavigationalEntities +{ + NSDictionary *parameters = [NSDictionary dictionaryWithObject: @"NAVIGATION" forKey: @"requestKey"]; + CISDOBIpadServiceCall *serviceCall = [self createIpadServiceCallWithParameters: parameters]; + return serviceCall; +} + - (CISDOBAsyncCall *)listRootLevelEntities { NSDictionary *parameters = [NSDictionary dictionaryWithObject: @"ROOT" forKey: @"requestKey"]; diff --git a/openbis-ipad/BisKit/Tests/CISDOBIpadServiceTest.m b/openbis-ipad/BisKit/Tests/CISDOBIpadServiceTest.m index ecabae8423d0abe8f79724a58290b27b1d2f17b3..73de90f7d68efcd3d90bee84785f2eee0e7d15e5 100644 --- a/openbis-ipad/BisKit/Tests/CISDOBIpadServiceTest.m +++ b/openbis-ipad/BisKit/Tests/CISDOBIpadServiceTest.m @@ -55,6 +55,31 @@ [self waitSeconds: waitTime forCallToComplete: call]; } +- (void)testListNavigationalEntities +{ + CISDOBAsyncCall *call; + call = [_service loginUser: GetDefaultUserName() password: GetDefaultUserPassword()]; + [self configureAndRunCallSynchronously: call]; + call = [_service listNavigationalEntities]; + [self configureAndRunCallSynchronously: call]; + + STAssertNotNil(_callResult, @"The iPad service should have returned some entities."); + NSArray *rawEntities = _callResult; + STAssertTrue([rawEntities count] > 0, @"The Pad service should have returned some entities."); + + for (CISDOBIpadRawEntity *rawEntity in rawEntities) { + NSString *summaryHeader = rawEntity.summaryHeader; + STAssertNotNil(summaryHeader, @"The summary header should not be nil"); + STAssertNotNil(rawEntity.permId, @"PermId should not be nil"); + STAssertNotNil(rawEntity.refcon, @"Refcon should not be nil"); +// STAssertNotNil(rawEntity.category, @"Group should not be nil"); + STAssertTrue([summaryHeader length], @"Summary header should not be empty"); + STAssertNotNil(rawEntity.summary, @"Summary should not be nil"); + STAssertNotNil(rawEntity.rootLevel, @"RootLevel should not be nil"); + STAssertEquals([rawEntity.rootLevel boolValue], YES, @"RootLevel should not be true"); + } +} + - (void)testListRootEntities { CISDOBAsyncCall *call; diff --git a/openbis-ipad/Research/BisMac.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate b/openbis-ipad/Research/BisMac.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate index 963b69a498b01e3974540d2ed115cfcb7a45a224..08b77991592b08444d9cccedf10cb4fc4a5b3430 100644 Binary files a/openbis-ipad/Research/BisMac.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate and b/openbis-ipad/Research/BisMac.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/openbis-ipad/core-plugin/readme.md b/openbis-ipad/core-plugin/readme.md index bd3b16cb839a62cd0894d0dbb3312114d29b3b00..b48d6ce448676c250ea5ca4534a0800307e89ca1 100644 --- a/openbis-ipad/core-plugin/readme.md +++ b/openbis-ipad/core-plugin/readme.md @@ -185,11 +185,11 @@ The communication model between the iPad and the service has been designed to tr <td>KEY, VALUE</td> </tr> <tr> - <td>CATEGORIES</td> + <td>NAVIGATION</td> <td>None</td> - <td>Return the root categories.</td> + <td>Return the top-level categories used for navigation.</td> <td>Used to initialize the top level of the navigation view.</td> - <td>PERM_ID, REFCON, SUMMARY_HEADER, SUMMARY, CHILDREN</td> + <td>PERM_ID, REFCON, CATEGORY, SUMMARY_HEADER, SUMMARY, ROOT_LEVEL</td> </tr> <tr> <td>ROOT</td> diff --git a/openbis-ipad/ipad-example-data/ipad-ui/1/dss/reporting-plugins/ipad-read-service-v1/ipad_read.py b/openbis-ipad/ipad-example-data/ipad-ui/1/dss/reporting-plugins/ipad-read-service-v1/ipad_read.py index 7dc1287dd7d181b6677ba4ca41352d304f1c9de2..f84d9af463b4dae8a8242bf89d68f59f39c41719 100644 --- a/openbis-ipad/ipad-example-data/ipad-ui/1/dss/reporting-plugins/ipad-read-service-v1/ipad_read.py +++ b/openbis-ipad/ipad-example-data/ipad-ui/1/dss/reporting-plugins/ipad-read-service-v1/ipad_read.py @@ -179,6 +179,12 @@ class DetailRequestHandler(RequestHandler): def optional_headers(self): return ["CATEGORY", "SUMMARY_HEADER", "SUMMARY", "IDENTIFIER", "IMAGES", "PROPERTIES"] +class NavigationRequestHandler(RequestHandler): + """Abstract Handler for the NAVIGATION request.""" + + def optional_headers(self): + return ["CATEGORY", "SUMMARY_HEADER", "SUMMARY", "ROOT_LEVEL"] + # # END Infrastructure # @@ -462,6 +468,13 @@ class ExampleDetailRequestHandler(DetailRequestHandler): self.add_rows(self.material_dict_array) self.add_rows(samples_to_dict(self.samples, self.material_by_perm_id, self.sample_type_properties_definitions)) +class ExampleNavigationRequestHandler(NavigationRequestHandler): + """Handler for the NAVIGATION request""" + def add_data_rows(self): + materials_nav = navigation_dict('Targets and Compounds', []) + probe_nav = navigation_dict('Probes', []) + self.add_rows([materials_nav, probe_nav]) + class TestingRootRequestHandler(ExampleRootRequestHandler): """A version of the root request handler designed for testing""" @@ -490,6 +503,8 @@ def aggregate(parameters, builder): request_key = parameters.get('requestKey') if 'CLIENT_PREFS' == request_key: handler = ExampleClientPreferencesRequestHandler(parameters, builder) + elif 'NAVIGATION' == request_key: + handler = ExampleNavigationRequestHandler(parameters, builder) elif 'ROOT' == request_key: handler = TestingRootRequestHandler(parameters, builder) elif 'DRILL' == request_key: diff --git a/openbis-ipad/openBIS/openBIS.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate b/openbis-ipad/openBIS/openBIS.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate index 9c84184cb40fdde92bdea4c23d47da223bbafabf..b1103cc0e75a3549078f5c4d9b6a5d8d79961c03 100644 Binary files a/openbis-ipad/openBIS/openBIS.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate and b/openbis-ipad/openBIS/openBIS.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate differ