mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
25 lines
798 B
TypeScript
25 lines
798 B
TypeScript
import { LensRendererExtension } from "@k8slens/extensions";
|
|
import { survey } from "./src/survey";
|
|
import { SurveyPreferenceHint, SurveyPreferenceInput } from "./src/survey-preference";
|
|
import { surveyPreferencesStore } from "./src/survey-preferences-store";
|
|
import React from "react";
|
|
|
|
export default class SurveyRendererExtension extends LensRendererExtension {
|
|
appPreferences = [
|
|
{
|
|
title: "In-App Surveys",
|
|
components: {
|
|
Hint: () => <SurveyPreferenceHint/>,
|
|
Input: () => <SurveyPreferenceInput survey={surveyPreferencesStore}/>
|
|
}
|
|
}
|
|
];
|
|
async onActivate() {
|
|
// Activate extension only on main renderer
|
|
if (window.location.hostname === "localhost") {
|
|
await surveyPreferencesStore.loadExtension(this);
|
|
survey.start();
|
|
}
|
|
}
|
|
}
|