Skip to content

Commit 4cdd51d

Browse files
committed
style: reformat
1 parent c648b1d commit 4cdd51d

32 files changed

+143
-144
lines changed

src/builder/Code.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default class {
6464
...(silent ? [] : [`mininet.log.info('\\n*** ${name}\\n')`, ""]),
6565
...arr,
6666
"",
67-
"# }}}"
67+
"# }}}",
6868
);
6969
}
7070
});

src/builder/Items.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default class {
1818
itemsArray
1919
.map(
2020
// Add new attrs without modifying original data.
21-
(item) => Object.create(item)
21+
(item) => Object.create(item),
2222
)
2323
.forEach((item) => {
2424
const { id, type } = item;
@@ -41,7 +41,7 @@ export default class {
4141
this.arr = {};
4242
Object.keys(this.map).forEach((key) => {
4343
this.arr[key] = Object.values(this.map[key]).sort(
44-
({ hostname: a }, { hostname: b }) => collator.compare(a, b)
44+
({ hostname: a }, { hostname: b }) => collator.compare(a, b),
4545
);
4646
});
4747

src/builder/index.js

+26-26
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export default class {
5050
this._log(
5151
`Failed to add ${node.type}/${node.hostname}: conflicting hostname.`,
5252
"error",
53-
node
54-
)
53+
node,
54+
),
5555
);
5656
} else if (
5757
error instanceof SyntaxError &&
@@ -62,8 +62,8 @@ export default class {
6262
this._log(
6363
`Failed to add ${port.type}/${port.hostname}: conflicting interface name ${devname}.`,
6464
"error",
65-
port
66-
)
65+
port,
66+
),
6767
);
6868
} else if (
6969
error instanceof SyntaxError &&
@@ -73,7 +73,7 @@ export default class {
7373
this._log(
7474
`Failed to add ${port.type}/${port.hostname}: single port has multiple links.`,
7575
"error",
76-
port
76+
port,
7777
);
7878
} else if (
7979
error instanceof SyntaxError &&
@@ -83,18 +83,18 @@ export default class {
8383
this._log(
8484
`Failed to add ${port.type}/${port.hostname}: port can't be both physical and connected to a link.`,
8585
"error",
86-
port
86+
port,
8787
);
8888
} else {
8989
console.error(error);
9090
this._log(
9191
item != null && item.type !== null && item.id !== null
9292
? `Failed to add ${item.type}/${item.hostname}.`
9393
: `Malformed item (${this._items.arr.$all.find(
94-
(v) => v === item
94+
(v) => v === item,
9595
)}).`,
9696
"error",
97-
item
97+
item,
9898
);
9999
}
100100

@@ -106,19 +106,19 @@ export default class {
106106
// Log level
107107
if (this._data.logLevel) {
108108
this._code.preInit.push(
109-
`mininet.log.setLogLevel('${this._data.logLevel}')`
109+
`mininet.log.setLogLevel('${this._data.logLevel}')`,
110110
);
111111
}
112112

113113
// Scripts
114114
if (this._data.startScript) {
115115
this._code.globalStartCmds.push(
116-
...this._scriptToCmds(this._data.startScript)
116+
...this._scriptToCmds(this._data.startScript),
117117
);
118118
}
119119
if (this._data.stopScript) {
120120
this._code.globalStopCmds.push(
121-
...this._scriptToCmds(this._data.stopScript)
121+
...this._scriptToCmds(this._data.stopScript),
122122
);
123123
}
124124

@@ -156,7 +156,7 @@ export default class {
156156
Boolean,
157157
"xterms",
158158
],
159-
])
159+
]),
160160
);
161161

162162
return this._code.toString();
@@ -178,7 +178,7 @@ export default class {
178178
[controller.protocol != null, controller.protocol, String, "protocol"],
179179
]);
180180
this._code.nodes.push(
181-
`${controller.hostname} = net.addController(${args.join(", ")})`
181+
`${controller.hostname} = net.addController(${args.join(", ")})`,
182182
);
183183
this._code.startControllers.push(`${controller.hostname}.start()`);
184184
}
@@ -197,7 +197,7 @@ export default class {
197197
],
198198
[
199199
[host.cpuScheduler, host.cpuCores, host.cpuLimit].some(
200-
(v) => v != null
200+
(v) => v != null,
201201
),
202202
"mininet.node.CPULimitedHost",
203203
null,
@@ -212,15 +212,15 @@ export default class {
212212
[host.cpuLimit != null, host.cpuLimit, Number, "f"],
213213
]);
214214
this._code.nodeLimits.push(
215-
`${host.hostname}.setCPUFrac(${args.join(", ")})`
215+
`${host.hostname}.setCPUFrac(${args.join(", ")})`,
216216
);
217217
}
218218
if (host.cpuCores != null) {
219219
const args = pyArgs([
220220
[host.cpuCores != null, host.cpuCores.join(","), String, "cores"],
221221
]);
222222
this._code.nodeLimits.push(
223-
`${host.hostname}.setCPUs(${args.join(", ")})`
223+
`${host.hostname}.setCPUs(${args.join(", ")})`,
224224
);
225225
}
226226

@@ -241,16 +241,16 @@ export default class {
241241
this._log(
242242
`Failed to add ${link.type}/${link.hostname}: link can't be connected to disconnected port(s).`,
243243
"warning",
244-
link
244+
link,
245245
);
246246
[...(fromNode ? [] : [fromPort]), ...(toNode ? [] : [toPort])].forEach(
247247
(port) => {
248248
this._log(
249249
`Failed to add ${port.type}/${port.hostname}: port can't be connected to a link but not to a node.`,
250250
"warning",
251-
port
251+
port,
252252
);
253-
}
253+
},
254254
);
255255

256256
return;
@@ -280,7 +280,7 @@ export default class {
280280
this._log(
281281
`Skipping ${port.type}/${port.hostname}: not connected to any node.`,
282282
"info",
283-
port
283+
port,
284284
);
285285
return;
286286
}
@@ -289,7 +289,7 @@ export default class {
289289
this._log(
290290
`Skipping ${port.type}/${port.hostname}: port has to be either physical or connected to a link.`,
291291
"info",
292-
port
292+
port,
293293
);
294294
return;
295295
}
@@ -321,7 +321,7 @@ export default class {
321321
`${node.hostname}.intf('${dev}').prefixLen = ${ip.split("/")[1]}`,
322322
]
323323
: []),
324-
`${node.hostname}.cmd('ip a a ${ip} dev ${dev}')`
324+
`${node.hostname}.cmd('ip a a ${ip} dev ${dev}')`,
325325
);
326326
});
327327
}
@@ -354,13 +354,13 @@ export default class {
354354
[swtch.verbose != null, swtch.verbose, Boolean, "verbose"],
355355
]);
356356
const controllerHostnames = this._getNeighbors(swtch, ["controller"]).map(
357-
(controller) => controller.hostname
357+
(controller) => controller.hostname,
358358
);
359359
this._code.nodes.push(
360-
`${swtch.hostname} = net.addSwitch(${args.join(", ")})`
360+
`${swtch.hostname} = net.addSwitch(${args.join(", ")})`,
361361
);
362362
this._code.startSwitches.push(
363-
`${swtch.hostname}.start([${controllerHostnames.join(", ")}])`
363+
`${swtch.hostname}.start([${controllerHostnames.join(", ")}])`,
364364
);
365365

366366
this._addNodeScripts(swtch.hostname, swtch.startScript, swtch.stopScript);
@@ -425,7 +425,7 @@ export default class {
425425
_addNodeScripts(hostname, startScript, stopScript) {
426426
if (startScript) {
427427
this._code.nodeStartCmds.push(
428-
...this._scriptToCmds(startScript, hostname)
428+
...this._scriptToCmds(startScript, hostname),
429429
);
430430
}
431431
if (stopScript) {

src/components/BindingsList.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ kbd {
232232
background-color: #eee;
233233
border-radius: 3px;
234234
border: 1px solid #b4b4b4;
235-
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2),
235+
box-shadow:
236+
0 1px 1px rgba(0, 0, 0, 0.2),
236237
0 2px 0 0 rgba(255, 255, 255, 0.7) inset;
237238
color: #333;
238239
display: inline-block;

src/components/TopologyToolbar.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default {
6969
window.open(
7070
`${this.$router.mode === "hash" ? "#" : ""}${this.viewURL}`,
7171
"",
72-
"_blank"
72+
"_blank",
7373
);
7474
},
7575
},

src/components/VisContainer.vue

+11-11
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export default {
182182
"dummy",
183183
["port", "host", "switch", "controller"],
184184
"{{IPS}}",
185-
true
185+
true,
186186
);
187187
this.net.addNodeMode();
188188
},
@@ -261,7 +261,7 @@ export default {
261261
actionName = "Close",
262262
actionFunction = () => {
263263
this.snackbar.show = false;
264-
}
264+
},
265265
) {
266266
this.snackbar.type = type;
267267
this.snackbar.values = values;
@@ -376,15 +376,15 @@ export default {
376376
const ports = this.getConnectedNodes(node.id, "port").sort(compareNodes);
377377
const coords = this.generateOrganizedPortCoors(
378378
this.net.getPositions([node.id])[node.id],
379-
ports.length
379+
ports.length,
380380
);
381381
382382
this.commit(
383383
"updateItems",
384384
coords.map((coords, i) => ({
385385
...coords,
386386
id: ports[i].id,
387-
}))
387+
})),
388388
);
389389
},
390390
getNextHostname(hostnames, fallback) {
@@ -411,9 +411,9 @@ export default {
411411
412412
return this.getNextHostname(
413413
this.getConnectedNodes(rootNodeId, type).map(
414-
({ id }) => this.data.items[id].hostname
414+
({ id }) => this.data.items[id].hostname,
415415
),
416-
baseHostnames[type]
416+
baseHostnames[type],
417417
);
418418
} else {
419419
// Global namespace
@@ -422,7 +422,7 @@ export default {
422422
.get()
423423
.filter((node) => node.group === type)
424424
.map(({ id }) => this.data.items[id].hostname),
425-
baseHostnames[type]
425+
baseHostnames[type],
426426
);
427427
}
428428
},
@@ -432,11 +432,11 @@ export default {
432432
.filter((id) => types.indexOf(this.data.items[id].type) !== -1);
433433
const positions = this.net.getPositions(ids);
434434
const distances = ids.map((id) =>
435-
Math.hypot(positions[id].x - x, positions[id].y - y)
435+
Math.hypot(positions[id].x - x, positions[id].y - y),
436436
);
437437
const closestIndex = distances.reduce(
438438
(acc, val, i) => (val < distances[acc] ? i : acc),
439-
0
439+
0,
440440
);
441441
442442
return distances[closestIndex] <= maxDistance ? ids[closestIndex] : null;
@@ -702,7 +702,7 @@ export default {
702702
toSelect.add(edge.from);
703703
});
704704
const toSelectFiltered = [...toSelect].filter(
705-
(nodeId) => this.data.items[nodeId].type === "port"
705+
(nodeId) => this.data.items[nodeId].type === "port",
706706
);
707707
if (toSelectFiltered.length) {
708708
this.net.selectNodes([event.nodes[0], ...toSelectFiltered]);
@@ -723,7 +723,7 @@ export default {
723723
container,
724724
this.net,
725725
this.nodes,
726-
selectionTheme
726+
selectionTheme,
727727
);
728728
rs.attach();
729729
},

src/components/edit/Host.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default {
114114
.split(/\s*[\s,]\s*/g)
115115
.map((str) => (re.test(str) ? +str : NaN))
116116
.sort((a, b) => a - b)
117-
.filter((value, index, array) => array[index - 1] !== value)
117+
.filter((value, index, array) => array[index - 1] !== value),
118118
);
119119
}
120120
},

src/components/edit/Port.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default {
5252
this.$set(
5353
this.item,
5454
"ips",
55-
val.split("\n").filter((line) => line !== "")
55+
val.split("\n").filter((line) => line !== ""),
5656
);
5757
} else {
5858
this.$delete(this.item, "ips");

0 commit comments

Comments
 (0)