Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose nodes api to get permanent node info #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Jenkins. The command is `jcli plugin upload`.

# API

## labels

URL: `GET http://localhost:8080/labelsdashboard/labelsData`

Response:
Expand All @@ -34,3 +36,40 @@ Response:
]
}
```

## nodes

URL: `GET http://localhost:8080/labelsdashboard/nodesData`

Response:
```
{
"status": "ok",
"data": [
{
"hasMoreThanOneJob": false,
"jobs": [],
"jobsCount": 0,
"jobsWithLabelDefaultValue": [],
"jobsWithLabelDefaultValueCount": 0,
"labelURL": "label/master/",
"name": "Jenkins",
"nodeURL": "computer/(master)/",
"triggeredJobs": [],
"triggeredJobsCount": 0
},
{
"hasMoreThanOneJob": false,
"jobs": [],
"jobsCount": 0,
"jobsWithLabelDefaultValue": [],
"jobsWithLabelDefaultValueCount": 0,
"labelURL": "label/macos1/",
"name": "macos1",
"nodeURL": "computer/macos1/",
"triggeredJobs": [],
"triggeredJobsCount": 0
}
]
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,18 @@ public List<NodeData> getSingleNodeJobs() {
Collections.sort(result);
return result;
}

@StaplerDispatchable
public HttpResponse doNodesData() {
getRefresh();
Collection<NodeData> nodes = getNodesData();
if (nodes.size() == 0) {
// sometimes it's empty, in order to have the correct list, try it again
getRefresh();
nodes = getNodesData();
}
return HttpResponses.okJSON(JSONArray.fromObject(nodes));
}

/**
* This function scans all jobs to find those that are
Expand Down