Skip to content

Commit

Permalink
Add button for listing host CPUs (#51)
Browse files Browse the repository at this point in the history
Co-authored-by: Achref Hawech <[email protected]>
  • Loading branch information
zed3250 and Achref Hawech authored Jul 11, 2022
1 parent 75e46bd commit e2f823c
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/css/components/icons.less
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
background-size: contain;
}

&.cpu {
background-image: url("img/icons/icon-mini-cpu.svg");
background-size: contain;
filter: invert(100%);
}

&.icon-xs {
font-size: floor(@icon-xs-height*@icon-xs-scale);
line-height: floor(@icon-xs-height*@icon-xs-scale);
Expand Down
54 changes: 54 additions & 0 deletions src/img/icons/icon-mini-cpu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/js/components/TaskListComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ var TaskListComponent = React.createClass({
<th className="text-center">
Traffic dump
</th>
<th className="text-center">
Host CPU allocation
</th>
<th className="text-center">
Debug
</th>
Expand Down
10 changes: 10 additions & 0 deletions src/js/components/TaskListItemComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ var TaskListItemComponent = React.createClass({
</a>);
},

getHostCpuListLink: function () {
const Link = Config.hostCpuListLinkGenerator(this.props.task);
return (<a href={Link} target="_blank">
<div className="icon icon-small cpu"></div>
</a>);
},

getDebugLink: function () {
const debugLink = Config.debugLinkGenerator(this.props.task.id);
return (<a href={debugLink} target="_blank">
Expand Down Expand Up @@ -349,6 +356,9 @@ var TaskListItemComponent = React.createClass({
<td className="text-center">
{this.getTrafficDumpTaskLink()}
</td>
<td className="text-center">
{this.getHostCpuListLink()}
</td>
<td className="text-center">
{this.getDebugLink()}
</td>
Expand Down
7 changes: 7 additions & 0 deletions src/js/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ var config = Object.assign({
return "";
},

// The generator building the traffic dump link for tasks
// input: appId, taskId
// output: the link to the logs
hostCpuListLinkGenerator: function () {
return "";
},

// Size of page size on task list
taskPageSize: 8,
// The generator build the exec links for tasks debugging
Expand Down
5 changes: 5 additions & 0 deletions src/js/config/runtimeConfig.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ var runtimeConfig = {
return "http://some-traffic-dump-tool/" + task.host;
},

// The generator building the traffic dump link for tasks
hostCpuListLinkGenerator: function (task) {
return "http://mesos-agent-watcher/cpus";
},

// The generator building the web terminal link for debugging tasks
debugLinkGenerator: function (taskId) {
return "http://webterminal/?taskId=" + taskId;
Expand Down
6 changes: 3 additions & 3 deletions src/test/units/TaskListItemComponent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe("Task List Item component", function () {
it("has the correct version", function () {
expect(this.component
.find("td")
.at(10)
.at(11)
.children()
.first()
.props()
Expand All @@ -145,7 +145,7 @@ describe("Task List Item component", function () {
it("has the correct update timestamp", function () {
var cellProps = this.component
.find("td")
.at(11)
.at(12)
.children()
.first()
.props();
Expand All @@ -166,7 +166,7 @@ describe("Task List Item component", function () {
it("has the correct debug link", function () {
var a = this.component
.find("td")
.at(9)
.at(10)
.children()
.first()
.props();
Expand Down

0 comments on commit e2f823c

Please sign in to comment.