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 { toJS } from "./utils";
import { CatalogEntity } from "./catalog";
import { catalogEntity } from "../main/catalog-sources/general";
export interface HotbarItem {
entity: {
@ -92,7 +93,13 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
}
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> = {}) {

View File

@ -24,43 +24,47 @@ import { GeneralEntity } from "../../common/catalog-entities/general";
import { catalogURL, preferencesURL } from "../../common/routes";
import { catalogEntityRegistry } from "../catalog";
export const catalogEntity = new GeneralEntity({
metadata: {
uid: "catalog-entity",
name: "Catalog",
source: "app",
labels: {}
},
spec: {
path: catalogURL(),
icon: {
material: "view_list",
background: "#3d90ce"
}
},
status: {
phase: "active",
}
});
const preferencesEntity = new GeneralEntity({
metadata: {
uid: "preferences-entity",
name: "Preferences",
source: "app",
labels: {}
},
spec: {
path: preferencesURL(),
icon: {
material: "settings",
background: "#3d90ce"
}
},
status: {
phase: "active",
}
});
const generalEntities = observable([
new GeneralEntity({
metadata: {
uid: "catalog-entity",
name: "Catalog",
source: "local",
labels: {}
},
spec: {
path: catalogURL(),
icon: {
material: "view_list",
background: "#3d90ce"
}
},
status: {
phase: "active",
}
}),
new GeneralEntity({
metadata: {
uid: "preferences-entity",
name: "Preferences",
source: "local",
labels: {}
},
spec: {
path: preferencesURL(),
icon: {
material: "settings",
background: "#3d90ce"
}
},
status: {
phase: "active",
}
})
catalogEntity,
preferencesEntity
]);
export function addGeneralEntities() {

View File

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