1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Adding Catalog initially to first hotbar

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-06-18 14:17:36 +03:00
parent f0ff4110d8
commit 80803f78a6
3 changed files with 49 additions and 37 deletions

View File

@ -26,6 +26,7 @@ import * as uuid from "uuid";
import isNull from "lodash/isNull"; import isNull from "lodash/isNull";
import { toJS } from "./utils"; import { toJS } from "./utils";
import { CatalogEntity } from "./catalog"; import { CatalogEntity } from "./catalog";
import { catalogEntity } from "../main/catalog-sources/general";
export interface HotbarItem { export interface HotbarItem {
entity: { entity: {
@ -92,7 +93,13 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
} }
get initialItems() { get initialItems() {
return [...Array.from(Array(defaultHotbarCells).fill(null))]; const { metadata: { uid, name, source } } = catalogEntity;
const initialItem = { entity: { uid, name, source }};
return [
initialItem,
...Array.from(Array(defaultHotbarCells - 1).fill(null))
];
} }
@action protected async fromStore(data: Partial<HotbarStoreModel> = {}) { @action protected async fromStore(data: Partial<HotbarStoreModel> = {}) {

View File

@ -24,12 +24,11 @@ import { GeneralEntity } from "../../common/catalog-entities/general";
import { catalogURL, preferencesURL } from "../../common/routes"; import { catalogURL, preferencesURL } from "../../common/routes";
import { catalogEntityRegistry } from "../catalog"; import { catalogEntityRegistry } from "../catalog";
const generalEntities = observable([ export const catalogEntity = new GeneralEntity({
new GeneralEntity({
metadata: { metadata: {
uid: "catalog-entity", uid: "catalog-entity",
name: "Catalog", name: "Catalog",
source: "local", source: "app",
labels: {} labels: {}
}, },
spec: { spec: {
@ -42,12 +41,13 @@ const generalEntities = observable([
status: { status: {
phase: "active", phase: "active",
} }
}), });
new GeneralEntity({
const preferencesEntity = new GeneralEntity({
metadata: { metadata: {
uid: "preferences-entity", uid: "preferences-entity",
name: "Preferences", name: "Preferences",
source: "local", source: "app",
labels: {} labels: {}
}, },
spec: { spec: {
@ -60,7 +60,11 @@ const generalEntities = observable([
status: { status: {
phase: "active", phase: "active",
} }
}) });
const generalEntities = observable([
catalogEntity,
preferencesEntity
]); ]);
export function addGeneralEntities() { export function addGeneralEntities() {

View File

@ -130,5 +130,6 @@
margin-left: 1px; margin-left: 1px;
margin-top: 1px; margin-top: 1px;
text-shadow: none; text-shadow: none;
font-size: 180%;
} }
} }