Skip to content

Commit

Permalink
Use const/let instead of var
Browse files Browse the repository at this point in the history
Also remove reference to docker package.
  • Loading branch information
marusak committed Dec 18, 2020
1 parent 0cd83ef commit 1fff0b8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/ContainerLogs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class ContainerLogs extends React.Component {
}

resize(width) {
var padding = 11 + 5 + 50;
var realWidth = this.state.view._core._renderService.dimensions.actualCellWidth;
var cols = Math.floor((width - padding) / realWidth);
const padding = 11 + 5 + 50;
const realWidth = this.state.view._core._renderService.dimensions.actualCellWidth;
const cols = Math.floor((width - padding) / realWidth);
this.state.view.resize(cols, 24);
}

Expand Down
8 changes: 4 additions & 4 deletions src/ContainerTerminal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ class ContainerTerminal extends React.Component {
}

resize(width) {
var padding = 11 + 5 + 50;
var realWidth = this.state.term._core._renderService.dimensions.actualCellWidth;
var cols = Math.floor((width - padding) / realWidth);
const padding = 11 + 5 + 50;
const realWidth = this.state.term._core._renderService.dimensions.actualCellWidth;
const cols = Math.floor((width - padding) / realWidth);
this.state.term.resize(cols, 24);
client.resizeContainersTTY(this.props.system, this.state.sessionId, this.props.tty, cols, 24)
.catch(e => this.setState({ errorMessage: e.message }));
Expand Down Expand Up @@ -234,7 +234,7 @@ class ContainerTerminal extends React.Component {
}

onChannelClose(event, options) {
var term = this.state.term;
const term = this.state.term;
term.write('\x1b[31m disconnected \x1b[m\r\n');
this.disconnectChannel();
this.setState({ channel: null });
Expand Down
2 changes: 1 addition & 1 deletion src/Containers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class Containers extends React.Component {
data: { containerId: container.Id, containerStatus: container.State, width:this.state.width, system:container.isSystem, tty: tty }
}];

var actions = [
const actions = [
<Button
key={container.Id + "delete"}
variant="danger"
Expand Down
23 changes: 10 additions & 13 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export function format_memory_and_limit(usage, limit) {

usage = usage / 1073741824; // 1024^3
limit = limit / 1073741824;
var mtext = "";
var units = 1024;
var parts;
let mtext = "";
let units = 1024;
let parts;
if (limit) {
parts = cockpit.format_bytes(limit, units, true);
mtext = " / " + parts.join(" ");
Expand Down Expand Up @@ -70,9 +70,6 @@ export function getCommitArr(arr, cmd) {
* contains whitespace or the other quote character. A backslash can
* be used to protect any character. Quotes can appear in the middle
* of a word.
*
* This comes from cockpit-project/cockpit docker package. Changes should be
* made there and then backported here.
*/

export function quote_cmdline(words) {
Expand All @@ -83,9 +80,9 @@ export function quote_cmdline(words) {
}

function quote(word) {
var text = "";
var quote_char = "";
var i;
let text = "";
let quote_char = "";
let i;
for (i = 0; i < word.length; i++) {
if (word[i] == '\\' || word[i] == quote_char)
text += '\\';
Expand All @@ -105,8 +102,8 @@ export function quote_cmdline(words) {
}

export function unquote_cmdline(text) {
var words = [];
var next;
const words = [];
let next;

function is_whitespace(c) {
return c == ' ';
Expand All @@ -118,8 +115,8 @@ export function unquote_cmdline(text) {
}

function parse_word() {
var word = "";
var quote_char = null;
let word = "";
let quote_char = null;

while (next < text.length) {
if (text[next] == '\\') {
Expand Down

0 comments on commit 1fff0b8

Please sign in to comment.