mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Switch WeblinkStore to injectable migrations
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
6620bb5340
commit
a55cd67d6c
@ -7,7 +7,7 @@ import { Environments, getEnvironmentSpecificLegacyGlobalDiForExtensionApi } fro
|
|||||||
import type { CatalogEntityContextMenuContext, CatalogEntityMetadata, CatalogEntityStatus } from "../catalog";
|
import type { CatalogEntityContextMenuContext, CatalogEntityMetadata, CatalogEntityStatus } from "../catalog";
|
||||||
import { CatalogCategory, CatalogEntity, categoryVersion } from "../catalog/catalog-entity";
|
import { CatalogCategory, CatalogEntity, categoryVersion } from "../catalog/catalog-entity";
|
||||||
import productNameInjectable from "../vars/product-name.injectable";
|
import productNameInjectable from "../vars/product-name.injectable";
|
||||||
import weblinkStoreInjectable from "../weblink-store.injectable";
|
import weblinkStoreInjectable from "../weblinks-store/weblink-store.injectable";
|
||||||
|
|
||||||
export type WebLinkStatusPhase = "available" | "unavailable";
|
export type WebLinkStatusPhase = "available" | "unavailable";
|
||||||
|
|
||||||
|
|||||||
@ -55,12 +55,4 @@ export const apiKubePrefix = "/api-kube"; // k8s cluster apis
|
|||||||
export const issuesTrackerUrl = "https://github.com/lensapp/lens/issues" as string;
|
export const issuesTrackerUrl = "https://github.com/lensapp/lens/issues" as string;
|
||||||
export const slackUrl = "https://join.slack.com/t/k8slens/shared_invite/zt-wcl8jq3k-68R5Wcmk1o95MLBE5igUDQ" as string;
|
export const slackUrl = "https://join.slack.com/t/k8slens/shared_invite/zt-wcl8jq3k-68R5Wcmk1o95MLBE5igUDQ" as string;
|
||||||
export const supportUrl = "https://docs.k8slens.dev/support/" as string;
|
export const supportUrl = "https://docs.k8slens.dev/support/" as string;
|
||||||
|
|
||||||
export const lensWebsiteWeblinkId = "lens-website-link";
|
|
||||||
export const lensDocumentationWeblinkId = "lens-documentation-link";
|
|
||||||
export const lensSlackWeblinkId = "lens-slack-link";
|
|
||||||
export const lensTwitterWeblinkId = "lens-twitter-link";
|
|
||||||
export const lensBlogWeblinkId = "lens-blog-link";
|
|
||||||
export const kubernetesDocumentationWeblinkId = "kubernetes-documentation-link";
|
|
||||||
|
|
||||||
export const docsUrl = "https://docs.k8slens.dev" as string;
|
export const docsUrl = "https://docs.k8slens.dev" as string;
|
||||||
|
|||||||
11
src/common/weblinks-store/migration-token.ts
Normal file
11
src/common/weblinks-store/migration-token.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||||
|
import type { MigrationDeclaration } from "../base-store/migrations.injectable";
|
||||||
|
|
||||||
|
export const weblinkStoreMigrationInjectionToken = getInjectionToken<MigrationDeclaration>({
|
||||||
|
id: "weblink-store-migration-token",
|
||||||
|
});
|
||||||
@ -3,10 +3,12 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import directoryForUserDataInjectable from "./app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
import directoryForUserDataInjectable from "../app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||||
import getConfigurationFileModelInjectable from "./get-configuration-file-model/get-configuration-file-model.injectable";
|
import storeMigrationsInjectable from "../base-store/migrations.injectable";
|
||||||
import loggerInjectable from "./logger.injectable";
|
import getConfigurationFileModelInjectable from "../get-configuration-file-model/get-configuration-file-model.injectable";
|
||||||
import storeMigrationVersionInjectable from "./vars/store-migration-version.injectable";
|
import loggerInjectable from "../logger.injectable";
|
||||||
|
import storeMigrationVersionInjectable from "../vars/store-migration-version.injectable";
|
||||||
|
import { weblinkStoreMigrationInjectionToken } from "./migration-token";
|
||||||
import { WeblinkStore } from "./weblink-store";
|
import { WeblinkStore } from "./weblink-store";
|
||||||
|
|
||||||
const weblinkStoreInjectable = getInjectable({
|
const weblinkStoreInjectable = getInjectable({
|
||||||
@ -16,6 +18,7 @@ const weblinkStoreInjectable = getInjectable({
|
|||||||
getConfigurationFileModel: di.inject(getConfigurationFileModelInjectable),
|
getConfigurationFileModel: di.inject(getConfigurationFileModelInjectable),
|
||||||
logger: di.inject(loggerInjectable),
|
logger: di.inject(loggerInjectable),
|
||||||
storeMigrationVersion: di.inject(storeMigrationVersionInjectable),
|
storeMigrationVersion: di.inject(storeMigrationVersionInjectable),
|
||||||
|
migrations: di.inject(storeMigrationsInjectable, weblinkStoreMigrationInjectionToken),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -4,11 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { action, comparer, observable, makeObservable } from "mobx";
|
import { action, comparer, observable, makeObservable } from "mobx";
|
||||||
import type { BaseStoreDependencies } from "./base-store/base-store";
|
import type { BaseStoreDependencies } from "../base-store/base-store";
|
||||||
import { BaseStore } from "./base-store/base-store";
|
import { BaseStore } from "../base-store/base-store";
|
||||||
import migrations from "../migrations/weblinks-store";
|
|
||||||
import * as uuid from "uuid";
|
import * as uuid from "uuid";
|
||||||
import { toJS } from "./utils";
|
import { toJS } from "../utils";
|
||||||
|
|
||||||
export interface WeblinkData {
|
export interface WeblinkData {
|
||||||
id: string;
|
id: string;
|
||||||
@ -38,7 +37,6 @@ export class WeblinkStore extends BaseStore<WeblinkStoreModel> {
|
|||||||
syncOptions: {
|
syncOptions: {
|
||||||
equals: comparer.structural,
|
equals: comparer.structural,
|
||||||
},
|
},
|
||||||
migrations,
|
|
||||||
});
|
});
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
this.load();
|
this.load();
|
||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { syncWeblinks } from "./weblinks";
|
import { syncWeblinks } from "./weblinks";
|
||||||
import weblinkStoreInjectable from "../../common/weblink-store.injectable";
|
import weblinkStoreInjectable from "../../common/weblinks-store/weblink-store.injectable";
|
||||||
import catalogEntityRegistryInjectable from "../catalog/entity-registry.injectable";
|
import catalogEntityRegistryInjectable from "../catalog/entity-registry.injectable";
|
||||||
|
|
||||||
const syncWeblinksInjectable = getInjectable({
|
const syncWeblinksInjectable = getInjectable({
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { computed, observable, reaction } from "mobx";
|
import { computed, observable, reaction } from "mobx";
|
||||||
import type { WeblinkStore } from "../../common/weblink-store";
|
import type { WeblinkStore } from "../../common/weblinks-store/weblink-store";
|
||||||
import { WebLink } from "../../common/catalog-entities";
|
import { WebLink } from "../../common/catalog-entities";
|
||||||
import type { CatalogEntityRegistry } from "../catalog";
|
import type { CatalogEntityRegistry } from "../catalog";
|
||||||
import got from "got";
|
import got from "got";
|
||||||
|
|||||||
24
src/main/weblinks-store/links.ts
Normal file
24
src/main/weblinks-store/links.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
export const lensWebsiteWeblinkId = "lens-website-link";
|
||||||
|
export const lensWebsiteLinkName = "Lens Website";
|
||||||
|
|
||||||
|
export const lensDocumentationWeblinkId = "lens-documentation-link";
|
||||||
|
export const lensDocumentationWeblinkName = "Lens Documentation";
|
||||||
|
|
||||||
|
export const lensSlackWeblinkId = "lens-slack-link";
|
||||||
|
export const lensSlackWeblinkName = "Lens Community Slack";
|
||||||
|
|
||||||
|
export const lensTwitterWeblinkId = "lens-twitter-link";
|
||||||
|
export const lensTwitterWeblinkName = "Lens on Twitter";
|
||||||
|
|
||||||
|
export const lensBlogWeblinkId = "lens-blog-link";
|
||||||
|
export const lensBlogWeblinkName = "Lens Official Blog";
|
||||||
|
|
||||||
|
export const kubernetesDocumentationWeblinkId = "kubernetes-documentation-link";
|
||||||
|
export const kubernetesDocumentationWeblinkName = "Kubernetes Documentation";
|
||||||
|
|
||||||
35
src/main/weblinks-store/migrations/5.1.4.injectable.ts
Normal file
35
src/main/weblinks-store/migrations/5.1.4.injectable.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { docsUrl, slackUrl } from "../../../common/vars";
|
||||||
|
import type { WeblinkData } from "../../../common/weblinks-store/weblink-store";
|
||||||
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
import { weblinkStoreMigrationInjectionToken } from "../../../common/weblinks-store/migration-token";
|
||||||
|
import * as links from "../links";
|
||||||
|
|
||||||
|
const v514WeblinkStoreMigrationInjectable = getInjectable({
|
||||||
|
id: "v5.1.4-weblink-store-migration",
|
||||||
|
instantiate: () => ({
|
||||||
|
version: "5.1.4",
|
||||||
|
run(store) {
|
||||||
|
const weblinksRaw = store.get("weblinks");
|
||||||
|
const weblinks = (Array.isArray(weblinksRaw) ? weblinksRaw : []) as WeblinkData[];
|
||||||
|
|
||||||
|
weblinks.push(
|
||||||
|
{ id: "https://k8slens.dev", name: links.lensWebsiteLinkName, url: "https://k8slens.dev" },
|
||||||
|
{ id: docsUrl, name: links.lensDocumentationWeblinkName, url: docsUrl },
|
||||||
|
{ id: slackUrl, name: links.lensSlackWeblinkName, url: slackUrl },
|
||||||
|
{ id: "https://twitter.com/k8slens", name: links.lensTwitterWeblinkName, url: "https://twitter.com/k8slens" },
|
||||||
|
{ id: "https://medium.com/k8slens", name: links.lensBlogWeblinkName, url: "https://medium.com/k8slens" },
|
||||||
|
{ id: "https://kubernetes.io/docs/home/", name: links.kubernetesDocumentationWeblinkName, url: "https://kubernetes.io/docs/home/" },
|
||||||
|
);
|
||||||
|
|
||||||
|
store.set("weblinks", weblinks);
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
injectionToken: weblinkStoreMigrationInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default v514WeblinkStoreMigrationInjectable;
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { WeblinkData } from "../../../common/weblinks-store/weblink-store";
|
||||||
|
import * as links from "../links";
|
||||||
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
import { weblinkStoreMigrationInjectionToken } from "../../../common/weblinks-store/migration-token";
|
||||||
|
|
||||||
|
const v545Beta1WeblinkStoreMigrationInjectable = getInjectable({
|
||||||
|
id: "v5.4.5-beta.1-weblink-store-migration",
|
||||||
|
instantiate: () => ({
|
||||||
|
version: "5.4.5-beta.1 || >=5.5.0-alpha.0",
|
||||||
|
run(store) {
|
||||||
|
const weblinksRaw = store.get("weblinks");
|
||||||
|
const weblinks = (Array.isArray(weblinksRaw) ? weblinksRaw : []) as WeblinkData[];
|
||||||
|
|
||||||
|
const lensWebsiteLink = weblinks.find(weblink => weblink.name === links.lensWebsiteLinkName);
|
||||||
|
|
||||||
|
if (lensWebsiteLink) {
|
||||||
|
lensWebsiteLink.id = links.lensWebsiteWeblinkId;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lensDocumentationWeblinkLink = weblinks.find(weblink => weblink.name === links.lensDocumentationWeblinkName);
|
||||||
|
|
||||||
|
if (lensDocumentationWeblinkLink) {
|
||||||
|
lensDocumentationWeblinkLink.id = links.lensDocumentationWeblinkId;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lensSlackWeblinkLink = weblinks.find(weblink => weblink.name === links.lensSlackWeblinkName);
|
||||||
|
|
||||||
|
if (lensSlackWeblinkLink) {
|
||||||
|
lensSlackWeblinkLink.id = links.lensSlackWeblinkId;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lensTwitterWeblinkLink = weblinks.find(weblink => weblink.name === links.lensTwitterWeblinkName);
|
||||||
|
|
||||||
|
if (lensTwitterWeblinkLink) {
|
||||||
|
lensTwitterWeblinkLink.id = links.lensTwitterWeblinkId;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lensBlogWeblinkLink = weblinks.find(weblink => weblink.name === links.lensBlogWeblinkName);
|
||||||
|
|
||||||
|
if (lensBlogWeblinkLink) {
|
||||||
|
lensBlogWeblinkLink.id = links.lensBlogWeblinkId;
|
||||||
|
}
|
||||||
|
|
||||||
|
const kubernetesDocumentationWeblinkLink = weblinks.find(weblink => weblink.name === links.kubernetesDocumentationWeblinkName);
|
||||||
|
|
||||||
|
if (kubernetesDocumentationWeblinkLink) {
|
||||||
|
kubernetesDocumentationWeblinkLink.id = links.kubernetesDocumentationWeblinkId;
|
||||||
|
}
|
||||||
|
|
||||||
|
store.set("weblinks", weblinks);
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
injectionToken: weblinkStoreMigrationInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default v545Beta1WeblinkStoreMigrationInjectable;
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { docsUrl, slackUrl } from "../../../common/vars";
|
||||||
|
import type { WeblinkData } from "../../../common/weblinks-store/weblink-store";
|
||||||
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
import { weblinkStoreMigrationInjectionToken } from "../../../common/weblinks-store/migration-token";
|
||||||
|
import applicationInformationInjectable from "../../../common/vars/application-information.injectable";
|
||||||
|
import { lensDocumentationWeblinkId, lensSlackWeblinkId } from "../links";
|
||||||
|
|
||||||
|
const currentVersionWeblinkStoreMigrationInjectable = getInjectable({
|
||||||
|
id: "current-version-weblink-store-migration",
|
||||||
|
instantiate: (di) => {
|
||||||
|
const { version } = di.inject(applicationInformationInjectable);
|
||||||
|
|
||||||
|
return {
|
||||||
|
version, // Run always after upgrade
|
||||||
|
run(store) {
|
||||||
|
const weblinksRaw = store.get("weblinks");
|
||||||
|
const weblinks = (Array.isArray(weblinksRaw) ? weblinksRaw : []) as WeblinkData[];
|
||||||
|
const slackWeblink = weblinks.find(weblink => weblink.id === lensSlackWeblinkId);
|
||||||
|
|
||||||
|
if (slackWeblink) {
|
||||||
|
slackWeblink.url = slackUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const docsWeblink = weblinks.find(weblink => weblink.id === lensDocumentationWeblinkId);
|
||||||
|
|
||||||
|
if (docsWeblink) {
|
||||||
|
docsWeblink.url = docsUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
store.set("weblinks", weblinks);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
injectionToken: weblinkStoreMigrationInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default currentVersionWeblinkStoreMigrationInjectable;
|
||||||
@ -1,34 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { docsUrl, slackUrl } from "../../common/vars";
|
|
||||||
import type { WeblinkData } from "../../common/weblink-store";
|
|
||||||
import type { MigrationDeclaration } from "../helpers";
|
|
||||||
|
|
||||||
export const lensWebsiteLinkName = "Lens Website";
|
|
||||||
export const lensDocumentationWeblinkName = "Lens Documentation";
|
|
||||||
export const lensSlackWeblinkName = "Lens Community Slack";
|
|
||||||
export const lensTwitterWeblinkName = "Lens on Twitter";
|
|
||||||
export const lensBlogWeblinkName = "Lens Official Blog";
|
|
||||||
export const kubernetesDocumentationWeblinkName = "Kubernetes Documentation";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
version: "5.1.4",
|
|
||||||
run(store) {
|
|
||||||
const weblinksRaw: any = store.get("weblinks");
|
|
||||||
const weblinks = (Array.isArray(weblinksRaw) ? weblinksRaw : []) as WeblinkData[];
|
|
||||||
|
|
||||||
weblinks.push(
|
|
||||||
{ id: "https://k8slens.dev", name: lensWebsiteLinkName, url: "https://k8slens.dev" },
|
|
||||||
{ id: docsUrl, name: lensDocumentationWeblinkName, url: docsUrl },
|
|
||||||
{ id: slackUrl, name: lensSlackWeblinkName, url: slackUrl },
|
|
||||||
{ id: "https://twitter.com/k8slens", name: lensTwitterWeblinkName, url: "https://twitter.com/k8slens" },
|
|
||||||
{ id: "https://medium.com/k8slens", name: lensBlogWeblinkName, url: "https://medium.com/k8slens" },
|
|
||||||
{ id: "https://kubernetes.io/docs/home/", name: kubernetesDocumentationWeblinkName, url: "https://kubernetes.io/docs/home/" },
|
|
||||||
);
|
|
||||||
|
|
||||||
store.set("weblinks", weblinks);
|
|
||||||
},
|
|
||||||
} as MigrationDeclaration;
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { kubernetesDocumentationWeblinkId, lensBlogWeblinkId, lensDocumentationWeblinkId, lensSlackWeblinkId, lensTwitterWeblinkId, lensWebsiteWeblinkId } from "../../common/vars";
|
|
||||||
import type { WeblinkData } from "../../common/weblink-store";
|
|
||||||
import type { MigrationDeclaration } from "../helpers";
|
|
||||||
import { kubernetesDocumentationWeblinkName, lensBlogWeblinkName, lensDocumentationWeblinkName, lensSlackWeblinkName, lensTwitterWeblinkName, lensWebsiteLinkName } from "./5.1.4";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
version: "5.4.5-beta.1 || >=5.5.0-alpha.0",
|
|
||||||
run(store) {
|
|
||||||
const weblinksRaw: any = store.get("weblinks");
|
|
||||||
const weblinks = (Array.isArray(weblinksRaw) ? weblinksRaw : []) as WeblinkData[];
|
|
||||||
|
|
||||||
const lensWebsiteLink = weblinks.find(weblink => weblink.name === lensWebsiteLinkName);
|
|
||||||
|
|
||||||
if (lensWebsiteLink) {
|
|
||||||
lensWebsiteLink.id = lensWebsiteWeblinkId;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lensDocumentationWeblinkLink = weblinks.find(weblink => weblink.name === lensDocumentationWeblinkName);
|
|
||||||
|
|
||||||
if (lensDocumentationWeblinkLink) {
|
|
||||||
lensDocumentationWeblinkLink.id = lensDocumentationWeblinkId;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lensSlackWeblinkLink = weblinks.find(weblink => weblink.name === lensSlackWeblinkName);
|
|
||||||
|
|
||||||
if (lensSlackWeblinkLink) {
|
|
||||||
lensSlackWeblinkLink.id = lensSlackWeblinkId;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lensTwitterWeblinkLink = weblinks.find(weblink => weblink.name === lensTwitterWeblinkName);
|
|
||||||
|
|
||||||
if (lensTwitterWeblinkLink) {
|
|
||||||
lensTwitterWeblinkLink.id = lensTwitterWeblinkId;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lensBlogWeblinkLink = weblinks.find(weblink => weblink.name === lensBlogWeblinkName);
|
|
||||||
|
|
||||||
if (lensBlogWeblinkLink) {
|
|
||||||
lensBlogWeblinkLink.id = lensBlogWeblinkId;
|
|
||||||
}
|
|
||||||
|
|
||||||
const kubernetesDocumentationWeblinkLink = weblinks.find(weblink => weblink.name === kubernetesDocumentationWeblinkName);
|
|
||||||
|
|
||||||
if (kubernetesDocumentationWeblinkLink) {
|
|
||||||
kubernetesDocumentationWeblinkLink.id = kubernetesDocumentationWeblinkId;
|
|
||||||
}
|
|
||||||
|
|
||||||
store.set("weblinks", weblinks);
|
|
||||||
},
|
|
||||||
} as MigrationDeclaration;
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { docsUrl, lensDocumentationWeblinkId, lensSlackWeblinkId, slackUrl } from "../../common/vars";
|
|
||||||
import type { WeblinkData } from "../../common/weblink-store";
|
|
||||||
import type { MigrationDeclaration } from "../helpers";
|
|
||||||
import packageJson from "../../../package.json";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
// TODO: replace with injection once migrations are made as injectables
|
|
||||||
version: packageJson.version, // Run always after upgrade
|
|
||||||
run(store) {
|
|
||||||
const weblinksRaw: any = store.get("weblinks");
|
|
||||||
const weblinks = (Array.isArray(weblinksRaw) ? weblinksRaw : []) as WeblinkData[];
|
|
||||||
const slackWeblink = weblinks.find(weblink => weblink.id === lensSlackWeblinkId);
|
|
||||||
|
|
||||||
if (slackWeblink) {
|
|
||||||
slackWeblink.url = slackUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const docsWeblink = weblinks.find(weblink => weblink.id === lensDocumentationWeblinkId);
|
|
||||||
|
|
||||||
if (docsWeblink) {
|
|
||||||
docsWeblink.url = docsUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
store.set("weblinks", weblinks);
|
|
||||||
},
|
|
||||||
} as MigrationDeclaration;
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { joinMigrations } from "../helpers";
|
|
||||||
|
|
||||||
import version514 from "./5.1.4";
|
|
||||||
import version545Beta1 from "./5.4.5-beta.1";
|
|
||||||
import currentVersion from "./currentVersion";
|
|
||||||
|
|
||||||
export default joinMigrations(
|
|
||||||
version514,
|
|
||||||
version545Beta1,
|
|
||||||
currentVersion,
|
|
||||||
);
|
|
||||||
@ -19,7 +19,7 @@ import { DefaultProps } from "./mui-base-theme";
|
|||||||
import configurePackages from "../common/configure-packages";
|
import configurePackages from "../common/configure-packages";
|
||||||
import * as initializers from "./initializers";
|
import * as initializers from "./initializers";
|
||||||
import logger from "../common/logger";
|
import logger from "../common/logger";
|
||||||
import { registerCustomThemes } from "./components/monaco-editor";
|
import { registerCustomThemes ../common/weblinks-store/weblink-storenaco-editor";
|
||||||
import { getDi } from "./getDi";
|
import { getDi } from "./getDi";
|
||||||
import { DiContextProvider } from "@ogre-tools/injectable-react";
|
import { DiContextProvider } from "@ogre-tools/injectable-react";
|
||||||
import type { DiContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
|
|||||||
@ -7,11 +7,11 @@ import React from "react";
|
|||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { Input } from "../input";
|
import { Input } from "../input";
|
||||||
import { isUrl } from "../input/input_validators";
|
import { isUrl } from "../input/input_validators";
|
||||||
import type { WeblinkStore } from "../../../common/weblink-store";
|
import type { WeblinkStore } from "../../../common/weblinks-store/weblink-store";
|
||||||
import { computed, makeObservable, observable } from "mobx";
|
import { computed, makeObservable, observable } from "mobx";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
import commandOverlayInjectable from "../command-palette/command-overlay.injectable";
|
import commandOverlayInjectable from "../command-palette/command-overlay.injectable";
|
||||||
import weblinkStoreInjectable from "../../../common/weblink-store.injectable";
|
import weblinkStoreInjectable from "../../../common/weblinks-store/weblink-store.injectable";
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
closeCommandOverlay: () => void;
|
closeCommandOverlay: () => void;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user