1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/_vue/components/MainMenu/MainMenu.vue
Sebastian Malton a6f7bc3c10 Clean up electron-store based stores
- Add some type script types for better editor experience
- Remove redundent global of a singleton

Signed-off-by: Sebastian Malton <smalton@mirantis.com>

remove references to double statics

Signed-off-by: Sebastian Malton <smalton@mirantis.com>

fix mocking of user-store

Signed-off-by: Sebastian Malton <smalton@mirantis.com>
2020-07-10 10:25:50 -04:00

110 lines
2.3 KiB
Vue

<template>
<div :style="{ paddingTop: computedPaddingTop }" class="main-menu">
<draggable v-model="clusters">
<ClusterMenuItem
v-for="cluster in clusters" :key="cluster.id"
:cluster="cluster"
/>
</draggable>
<AddClusterMenuItem />
<b-tooltip v-if="clusters.length === 0" show target="add-cluster" placement="rightbottom">
<p class="text-left">
This is the quick launch menu.
</p>
<p class="text-left">
Associate clusters and choose the ones you want to access via quick launch menu by clicking the + button.
</p>
</b-tooltip>
</div>
</template>
<script>
import ClusterMenuItem from "@/_vue/components/MainMenu/ClusterMenuItem";
import AddClusterMenuItem from "@/_vue/components/MainMenu/AddClusterMenuItem";
import draggable from 'vuedraggable'
import { isMac } from "../../../../common/vars"
import { ClusterStore } from "@/../common/cluster-store";
import * as os from "os";
const {remote} = require('electron')
const {Menu, MenuItem} = remote
export default {
name: "MainMenu",
components: {
ClusterMenuItem,
AddClusterMenuItem,
draggable
},
data() {
return {
computedPaddingTop: "15px"
}
},
computed: {
clusters: {
get: function () {
return this.$store.getters.clusters;
},
set: function (clusters) {
this.$store.commit("updateClusters", clusters);
ClusterStore.getInstance().storeClusters(clusters);
}
}
},
methods: {
isActive: function (id) {
return id === this.$route.params.id;
},
addCluster: async function () {
this.$router.push({
name: "add-cluster-page",
params: {
id: "new"
},
}).catch(err => {})
}
},
mounted: function () {
if (isMac) {
this.computedPaddingTop = "25px";
}
}
}
</script>
<style scoped lang="scss">
.main-menu {
position: absolute;
left: 0;
top: 0;
bottom: 20px;
width: 70px;
padding-top: 15px;
background: #252729;
overflow: hidden;
z-index: 1000;
}
.menu-item {
position: relative;
cursor: pointer;
display: block;
padding: 6px 15px 6px 15px;
color: #87909c;
opacity: 0.3;
&.active {
opacity: 1;
}
&.online {
opacity: 1;
}
&:hover {
opacity: 1;
}
}
</style>