diff --git a/cpp-api-client/src/Example.cpp b/cpp-api-client/src/Example.cpp index e2b2bcedfa..d3cd47c441 100644 --- a/cpp-api-client/src/Example.cpp +++ b/cpp-api-client/src/Example.cpp @@ -60,7 +60,7 @@ int main(int argc, char const *argv[]) // todo: add attachments to request std::cout << "Creating log" << std::endl; std::this_thread::sleep_for(std::chrono::seconds(1)); - api->createLog("Porsche 911..", "LoggyTitle", {1, 5, 6}, 1); + api->createLog("Porsche 911..", "LoggyTitle", {runNumber}, -1); // Get runs std::cout << "Getting runs" << std::endl; diff --git a/cpp-api-client/src/cpprest-client/model/Run.cpp b/cpp-api-client/src/cpprest-client/model/Run.cpp index ac9c682571..fd79747aad 100644 --- a/cpp-api-client/src/cpprest-client/model/Run.cpp +++ b/cpp-api-client/src/cpprest-client/model/Run.cpp @@ -35,7 +35,7 @@ Run::Run() m_NDetectorsIsSet = false; m_NEpns = 0L; m_NEpnsIsSet = false; - m_NFlps = 0; + m_NFlps = 0L; m_NFlpsIsSet = false; m_NSubtimeframes = 0L; m_NSubtimeframesIsSet = false; @@ -206,7 +206,7 @@ bool Run::fromJson(const web::json::value& val) const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("nFlps")); if(!fieldValue.is_null()) { - int32_t refVal_nFlps; + int64_t refVal_nFlps; ok &= ModelBase::fromJson(fieldValue, refVal_nFlps); setNFlps(refVal_nFlps); } @@ -424,7 +424,7 @@ bool Run::fromMultiPart(std::shared_ptr multipart, const util } if(multipart->hasContent(utility::conversions::to_string_t("nFlps"))) { - int32_t refVal_nFlps; + int64_t refVal_nFlps; ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("nFlps")), refVal_nFlps ); setNFlps(refVal_nFlps); } @@ -605,12 +605,12 @@ void Run::unsetNEpns() { m_NEpnsIsSet = false; } -int32_t Run::getNFlps() const +int64_t Run::getNFlps() const { return m_NFlps; } -void Run::setNFlps(int32_t value) +void Run::setNFlps(int64_t value) { m_NFlps = value; m_NFlpsIsSet = true; diff --git a/cpp-api-client/src/cpprest-client/model/Run.h b/cpp-api-client/src/cpprest-client/model/Run.h index 0679727b2f..fa1b0af3a9 100644 --- a/cpp-api-client/src/cpprest-client/model/Run.h +++ b/cpp-api-client/src/cpprest-client/model/Run.h @@ -112,11 +112,11 @@ class Run /// /// The amount of Flps nodes in a single run. /// - int32_t getNFlps() const; + int64_t getNFlps() const; bool nFlpsIsSet() const; void unsetNFlps(); - void setNFlps(int32_t value); + void setNFlps(int64_t value); /// /// Total number of subtimeframes processed by the O2 system. @@ -213,7 +213,7 @@ class Run bool m_NDetectorsIsSet; int64_t m_NEpns; bool m_NEpnsIsSet; - int32_t m_NFlps; + int64_t m_NFlps; bool m_NFlpsIsSet; int64_t m_NSubtimeframes; bool m_NSubtimeframesIsSet; diff --git a/go-api-client/Example.go b/go-api-client/Example.go index 96e221d940..8bb21933c0 100644 --- a/go-api-client/Example.go +++ b/go-api-client/Example.go @@ -5,15 +5,15 @@ import sw "./src/go-client-generated" func main() { // Set base url and api token - baseUrl := "http://localhost:4000/api" - apiToken := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwidXNlcm5hbWUiOiJBbm9ueW1vdXMiLCJhY2Nlc3MiOjAsImlhdCI6MTYxMDUzMzY1NSwiZXhwIjoxNjEwNjIwMDU1LCJpc3MiOiJvMi11aSJ9.s-Xc8lSIzmcJjJh3HkbZECEXcbzRqEXkpOollgXWhoo" + baseUrl := "http://vm4.jiskefet.io/api" + apiToken := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NzQ2NjQwLCJ1c2VybmFtZSI6ImF3ZWdyenluIiwiYWNjZXNzIjoxLCJpYXQiOjE2MTA1NDM0ODYsImV4cCI6MTYxMDYyOTg4NiwiaXNzIjoibzItdWkifQ.8pM1K0HIfpnZop7bJk_rD5GvkfeiWaNNs2S7ZM1tqYg" // Initialize api with manual JWT token + baseurl // TODO: generate correct JWT token instead of manual insertion apiClient.InitializeApi(baseUrl, apiToken) // Create a run - apiClient.CreateRun("cpp-api", 5, 5, 5, 9000, sw.COSMICS_RunType, 12040213, 12040213) + apiClient.CreateRun("cpp-api", 5, 5, 1, 9000, sw.COSMICS_RunType, 12040213, 12040213) // Update a run apiClient.UpdateRun(9000, sw.BAD_RunQuality, 12040213, 12040213) @@ -25,7 +25,7 @@ func main() { apiClient.UpdateFlp(1, "testing-go-client-update", 5, 5, 9000, 9000) // Create a log - apiClient.CreateLog("test", "test", "1,5,6", 1) + apiClient.CreateLog("test", "test", "1", -1) // Retrieve all logs from the api apiClient.GetLogs() diff --git a/go-api-client/src/BookkeepingApi.go b/go-api-client/src/BookkeepingApi.go index 85c788eb0f..0ee796563c 100644 --- a/go-api-client/src/BookkeepingApi.go +++ b/go-api-client/src/BookkeepingApi.go @@ -130,16 +130,26 @@ func UpdateFlp(flpId int64, name string, nSubtimeframes int64, nEquipmentBytes i */ // todo: keep runNumbers as string? or convert to css (comma separated string) in function body? func CreateLog(text string, title string, runNumbers string, parentLogId int64){ - - obj := sw.CreateLog{ - Text : text, - Title : title, - RunNumbers : runNumbers, - ParentLogId : parentLogId, - } - arrayResponse, response, err := api.LogApi.CreateLog(auth, obj) - fmt.Println(arrayResponse, response, err) + // todo: remove if-statement with optional parameter-like construct. + if(parentLogId == -1){ + obj := sw.CreateLog{ + Text : text, + Title : title, + RunNumbers : runNumbers, + } + arrayResponse, response, err := api.LogApi.CreateLog(auth, obj) + fmt.Println(arrayResponse, response, err) + }else{ + obj := sw.CreateLog{ + Text : text, + Title : title, + RunNumbers : runNumbers, + ParentLogId : parentLogId, + } + arrayResponse, response, err := api.LogApi.CreateLog(auth, obj) + fmt.Println(arrayResponse, response, err) + } } /** * Get all logs diff --git a/lib/public/views/About/Overview/index.js b/lib/public/views/About/Overview/index.js index 25d125753c..3e17bee29d 100644 --- a/lib/public/views/About/Overview/index.js +++ b/lib/public/views/About/Overview/index.js @@ -22,7 +22,7 @@ import table from '../../../components/Table/index.js'; const aboutOverview = (model) => { const data = [ { type: 'Bookkeeping', version: '1', hostname: 'localhost', port: '4000' }, - { type: 'NPM', version: '0.16.1', hostname: '', port: '' }, + { type: 'NPM', version: '0.16.2', hostname: '', port: '' }, ]; const aboutColumns = { diff --git a/package.json b/package.json index 9cc1753d5d..2310ef9850 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aliceo2/bookkeeping", - "version": "0.16.1", + "version": "0.16.2", "author": "CERN", "license": "GPL-3.0", "scripts": {