mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Change notification when extension is not found - Removes legacy downloadFile and downloadJson in favour of using `node-fetch` - A notification will be displayed if the URL provided results in a status of 404 Signed-off-by: Sebastian Malton <sebastian@malton.name> * Resolve PR comments Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name>
27 lines
815 B
TypeScript
27 lines
815 B
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
import { getInjectable } from "@ogre-tools/injectable";
|
|
import loggerInjectable from "../../../common/logger.injectable";
|
|
import attemptInstallsInjectable from "./attempt-installs.injectable";
|
|
|
|
export type InstallOnDrop = (files: File[]) => Promise<void>;
|
|
|
|
const installOnDropInjectable = getInjectable({
|
|
id: "install-on-drop",
|
|
|
|
instantiate: (di): InstallOnDrop => {
|
|
const attemptInstalls = di.inject(attemptInstallsInjectable);
|
|
const logger = di.inject(loggerInjectable);
|
|
|
|
return (files) => {
|
|
logger.info("Install from D&D");
|
|
|
|
return attemptInstalls(files.map(({ path }) => path));
|
|
};
|
|
},
|
|
});
|
|
|
|
export default installOnDropInjectable;
|