mirror of
https://github.com/louislam/dockge.git
synced 2025-02-26 05:25:56 +00:00
Compare commits
6 commits
dffbc72e37
...
04708c2f02
Author | SHA1 | Date | |
---|---|---|---|
|
04708c2f02 | ||
|
2674226ce3 | ||
|
59d941f128 | ||
|
b9f135bdaa | ||
|
bd4a012404 | ||
|
f08ba9b889 |
3 changed files with 86 additions and 1 deletions
1
frontend/components.d.ts
vendored
1
frontend/components.d.ts
vendored
|
@ -8,6 +8,7 @@ export {}
|
|||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
About: typeof import('./src/components/settings/About.vue')['default']
|
||||
AgentStackList: typeof import('./src/components/AgentStackList.vue')['default']
|
||||
Appearance: typeof import('./src/components/settings/Appearance.vue')['default']
|
||||
ArrayInput: typeof import('./src/components/ArrayInput.vue')['default']
|
||||
ArraySelect: typeof import('./src/components/ArraySelect.vue')['default']
|
||||
|
|
46
frontend/src/components/AgentStackList.vue
Normal file
46
frontend/src/components/AgentStackList.vue
Normal file
|
@ -0,0 +1,46 @@
|
|||
<template>
|
||||
<div class="wrapper">
|
||||
<div class="group-header">
|
||||
{{ agentName }}
|
||||
</div>
|
||||
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
interface AgentStackListProps {
|
||||
agentName: string;
|
||||
}
|
||||
|
||||
defineProps<AgentStackListProps>();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "../styles/vars.scss";
|
||||
|
||||
.group-header {
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 500;
|
||||
padding: 10px;
|
||||
|
||||
.dark & {
|
||||
background-color: darken($color: $dark-header-bg, $amount: 1.90);
|
||||
border-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 770px) {
|
||||
.group-header {
|
||||
margin: -20px;
|
||||
margin-bottom: 10px;
|
||||
padding: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
|
@ -42,7 +42,22 @@
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div ref="stackList" class="stack-list" :class="{ scrollbar: scrollbar }" :style="stackListStyle">
|
||||
|
||||
<div v-if="searchText === '' && $root.agentCount > 1" ref="stackList" :style="stackListStyle" class="stack-list">
|
||||
<AgentStackList v-for="[agentName, stacks] in stackListByAgent" :agentName="agentName" :key="agentName">
|
||||
<StackListItem
|
||||
v-for="(stack, index) in stacks"
|
||||
:key="index"
|
||||
:stack="stack"
|
||||
:isSelectMode="selectMode"
|
||||
:isSelected="isSelected"
|
||||
:select="select"
|
||||
:deselect="deselect"
|
||||
/>
|
||||
</AgentStackList>
|
||||
</div>
|
||||
|
||||
<div v-else ref="stackList" class="stack-list" :class="{ scrollbar: scrollbar }" :style="stackListStyle">
|
||||
<div v-if="Object.keys(sortedStackList).length === 0" class="text-center mt-3">
|
||||
<router-link to="/compose">{{ $t("addFirstStackMsg") }}</router-link>
|
||||
</div>
|
||||
|
@ -189,7 +204,30 @@ export default {
|
|||
|
||||
return result;
|
||||
},
|
||||
/**
|
||||
* Groups all stacks by it's agent
|
||||
* @returns {Map<string, object} A map containing all agents with their stacks
|
||||
*/
|
||||
stackListByAgent() {
|
||||
const stacksByAgent = new Map();
|
||||
const stacks = this.$root.completeStackList;
|
||||
|
||||
for (const key of Object.keys(stacks)) {
|
||||
// Handle stacks with no suffix (from the current endpoint)
|
||||
let [ stackName, agent ] = key.split("_");
|
||||
const stackHasEndpoint = agent !== "";
|
||||
agent = stackHasEndpoint ? agent : this.$t("currentEndpoint");
|
||||
|
||||
if (!stacksByAgent.has(agent)) {
|
||||
stacksByAgent.set(agent, []);
|
||||
}
|
||||
|
||||
const stack = stacks[!stackHasEndpoint ? `${stackName}_` : `${stackName}_${agent}`];
|
||||
stacksByAgent.get(agent).push(stack);
|
||||
}
|
||||
|
||||
return stacksByAgent;
|
||||
},
|
||||
isDarkTheme() {
|
||||
return document.body.classList.contains("dark");
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue