|
1 | 1 | import { TextEditor, Grammar } from "atom";
|
2 |
| -import _ from "lodash"; |
| 2 | +import map from "lodash/map"; |
| 3 | +import mapKeys from "lodash/mapKeys"; |
| 4 | +import sortBy from "lodash/sortBy"; |
3 | 5 | import { findAll as kernelSpecsFindAll } from "kernelspecs";
|
4 | 6 | import { shell } from "electron";
|
5 | 7 | import ZMQKernel from "./zmq-kernel";
|
@@ -81,13 +83,12 @@ export class KernelManager {
|
81 | 83 |
|
82 | 84 | async update(): Promise<KernelspecMetadata[]> {
|
83 | 85 | const kernelSpecs = await kernelSpecsFindAll();
|
84 |
| - this.kernelSpecs = _.sortBy( |
85 |
| - _.map( |
86 |
| - _.mapKeys(kernelSpecs, function (value, key) { |
87 |
| - return (value.spec.name = key); |
88 |
| - }), |
89 |
| - "spec" |
90 |
| - ), |
| 86 | + |
| 87 | + const kernelResourcesDict = mapKeys(kernelSpecs, function (value, key) { |
| 88 | + return (value.spec.name = key); |
| 89 | + }); |
| 90 | + this.kernelSpecs = sortBy( |
| 91 | + map(kernelResourcesDict, "spec"), |
91 | 92 | (spec) => spec.display_name
|
92 | 93 | );
|
93 | 94 | return this.kernelSpecs;
|
@@ -169,8 +170,9 @@ export class KernelManager {
|
169 | 170 | atom.notifications.addError(message, options);
|
170 | 171 | } else {
|
171 | 172 | const message = "Hydrogen Kernels updated:";
|
| 173 | + const displayNames = map(kernelSpecs, "display_name"); // kernelSpecs.map((kernelSpec) => kernelSpec.display_name) |
172 | 174 | const options = {
|
173 |
| - detail: _.map(kernelSpecs, "display_name").join("\n"), |
| 175 | + detail: displayNames.join("\n"), |
174 | 176 | };
|
175 | 177 | atom.notifications.addInfo(message, options);
|
176 | 178 | }
|
|
0 commit comments