Skip to content

Commit

Permalink
Merge pull request #285 from AliceO2Group/O2B-FIX
Browse files Browse the repository at this point in the history
O2 b fix
  • Loading branch information
ekertt authored Jan 13, 2021
2 parents 66955af + f30a31a commit 02b0f2d
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 24 deletions.
2 changes: 1 addition & 1 deletion cpp-api-client/src/Example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions cpp-api-client/src/cpprest-client/model/Run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -424,7 +424,7 @@ bool Run::fromMultiPart(std::shared_ptr<MultipartFormData> 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);
}
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions cpp-api-client/src/cpprest-client/model/Run.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ class Run
/// <summary>
/// The amount of Flps nodes in a single run.
/// </summary>
int32_t getNFlps() const;
int64_t getNFlps() const;
bool nFlpsIsSet() const;
void unsetNFlps();

void setNFlps(int32_t value);
void setNFlps(int64_t value);

/// <summary>
/// Total number of subtimeframes processed by the O2 system.
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions go-api-client/Example.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down
28 changes: 19 additions & 9 deletions go-api-client/src/BookkeepingApi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/public/views/About/Overview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aliceo2/bookkeeping",
"version": "0.16.1",
"version": "0.16.2",
"author": "CERN",
"license": "GPL-3.0",
"scripts": {
Expand Down

0 comments on commit 02b0f2d

Please sign in to comment.