Index: docs/api.rst =================================================================== --- docs/api.rst +++ docs/api.rst @@ -38,6 +38,8 @@ +---------------------------+------------------------------------------------------------------------------------------+ | /schema | Return test suite schema. | +---------------------------+------------------------------------------------------------------------------------------+ +| /fields | Return all fields in this testsuite. | ++---------------------------+------------------------------------------------------------------------------------------+ .. _auth_tokens: Index: lnt/server/ui/api.py =================================================================== --- lnt/server/ui/api.py +++ lnt/server/ui/api.py @@ -61,6 +61,18 @@ """Update a dict with the common fields.""" to_update.update(common_fields_factory()) +class Fields(Resource): + """List all the fields in the test suite.""" + method_decorators = [in_db] + + @staticmethod + def get(): + ts = request.get_testsuite() + + result = common_fields_factory() + result['fields'] = [{'column_id': i, 'column_name': f.column.name} + for i, f in enumerate(ts.sample_fields)] + return result class Machines(Resource): """List all the machines and give summary information.""" @@ -501,6 +513,7 @@ resp.headers.extend(headers) return resp + api.add_resource(Fields, ts_path("fields"), ts_path("fields/")) api.add_resource(Machines, ts_path("machines"), ts_path("machines/")) api.add_resource(Machine, ts_path("machines/")) api.add_resource(Runs, ts_path("runs"), ts_path("runs/"))