Compare commits

...

6 Commits

Author SHA1 Message Date
Joshua Boniface
e11217e28a Unify and clean up position styling 2025-03-02 17:06:47 -05:00
Joshua Boniface
4ca93fcc9a Further adjust spacing to be perfect 2025-03-02 16:52:52 -05:00
Joshua Boniface
0200df7b16 Fix up Node page styling 2025-03-02 16:38:09 -05:00
Joshua Boniface
d581d17273 Clean up styling and organize components 2025-03-02 15:56:52 -05:00
Joshua Boniface
5b691d0e5b Add more search bar features 2025-03-02 15:07:35 -05:00
Joshua Boniface
745d554768 Fix search bar behaviour (step 9) 2025-03-02 14:56:51 -05:00
11 changed files with 613 additions and 1155 deletions

View File

@ -1,368 +0,0 @@
/* Global spacing adjustments */
.content-grid {
gap: 0.25rem !important;
}
.main-content {
padding-top: 0.25rem;
}
/* Reduce space between page title and content */
.content-grid > *:first-child + * {
margin-top: 0.375rem !important;
}
/* Target the specific space between title underline and first card */
.content-grid > div:first-child {
margin-bottom: 0.375rem !important;
}
/* Reduce space after PageTitle component */
.page-title {
margin-bottom: 0.25rem !important;
}
/* Remove left padding from node tabs */
.nav-tabs {
padding-left: 0 !important;
margin-left: 0 !important;
}
/* Ensure node content aligns with left edge */
.node-content, .tab-content {
padding-left: 0 !important;
margin-left: 0 !important;
}
/* Target the specific element causing the padding */
div.node-tabs {
padding-left: 0 !important;
padding-right: 0 !important;
}
/* More aggressive targeting for node tabs */
.node-overview .nav,
.node-overview .nav-tabs,
.node-overview ul.nav,
.node-overview ul.nav-tabs {
padding-left: 0 !important;
margin-left: 0 !important;
border-left: 0 !important;
}
/* Target the first tab item specifically */
.node-overview .nav-item:first-child,
.node-overview .nav-link:first-child {
margin-left: 0 !important;
padding-left: 0 !important;
}
/* Target any container that might be wrapping the tabs */
.node-overview > div,
.node-overview > ul {
padding-left: 0 !important;
margin-left: 0 !important;
}
/* Style VM search bar section like node tabs */
.vm-search-container,
.vm-list-header,
.vm-controls {
border: none !important;
border-bottom: 1px solid rgba(0, 0, 0, 0.125) !important;
border-radius: 0 !important;
background-color: transparent !important;
padding: 0.5rem 0 !important;
margin-bottom: 1rem !important;
}
/* Remove any box shadow from VM search elements */
.vm-search-container *,
.vm-list-header *,
.vm-controls * {
box-shadow: none !important;
}
/* Ensure search input has proper styling */
.vm-search-input {
border: 1px solid rgba(0, 0, 0, 0.2) !important;
border-radius: 0.25rem !important;
}
/* Target the specific VM list controls more directly */
.vm-overview .list-vms-container,
.vm-overview .vm-controls-container {
border: none !important;
box-shadow: none !important;
background: transparent !important;
border-bottom: 1px solid rgba(0, 0, 0, 0.125) !important;
border-radius: 0 !important;
padding-left: 0 !important;
}
/* Target the buttons and inputs directly */
.vm-overview .btn-group,
.vm-overview .input-group {
margin: 0 !important;
background: transparent !important;
}
/* Target the List VMs button specifically */
.vm-overview .btn-secondary,
.vm-overview button[type="button"] {
background-color: #6c757d !important;
border-color: #6c757d !important;
}
/* Super aggressive targeting for VM search container */
.vm-list-container > div:first-child,
.vm-overview > div:first-child,
div[class*="vm-"] > div:first-child {
border: none !important;
background: transparent !important;
box-shadow: none !important;
border-radius: 0 !important;
border-bottom: 1px solid rgba(0, 0, 0, 0.125) !important;
padding: 0.5rem 0 !important;
}
/* Target the actual search box and buttons */
.input-group,
.btn-group {
margin-bottom: 0 !important;
}
/* Target any card or container in the VM list header */
.card,
.card-header,
.card-body {
/* Target only VM list cards, not ValueCards */
.vm-list-container .card,
.vm-list-container .card-header,
.vm-list-container .card-body,
.vm-controls-container .card,
.vm-controls-container .card-header,
.vm-controls-container .card-body {
border: none !important;
background: transparent !important;
box-shadow: none !important;
padding: 0.5rem 0 !important;
}
}
/* Target the specific vm-controls-container element */
div.vm-controls-container {
background-color: transparent !important;
border-radius: 0 !important;
box-shadow: none !important;
padding: 0.5rem 0 !important;
}
/* Target the light blue background */
div.vm-controls-container[data-v-8e678963] {
background-color: transparent !important;
}
/* Adjust spacing after page title on VM page */
.vm-overview .page-title,
.vm-overview .page-title-container {
margin-bottom: 0.05rem !important;
}
/* Ensure consistent spacing between title and controls */
.vm-overview .content-grid > *:first-child + * {
margin-top: 0.05rem !important;
}
/* Remove lines under VM names */
.vm-list-item,
.vm-item {
border-bottom: none !important;
}
/* Ensure only the controls container has the bottom border */
.vm-list-container > div:not(:first-child),
.vm-overview > div:not(:first-child) {
border-bottom: none !important;
}
/* Further reduce spacing between title and controls */
.content-grid > div:first-child {
margin-bottom: 0.05rem !important;
}
/* Extremely aggressive spacing reduction */
.page-title + *,
.page-title-container + * {
margin-top: 0 !important;
}
/* Specifically target VM list items to remove bottom borders */
.vm-list > div,
.vm-list-item,
.vm-item,
div[class*="vm-list"] > div {
border-bottom: none !important;
border: none !important;
}
/* Target the VM list container to remove any borders from its children except the first */
.vm-list-container > div:not(:first-child) *,
.vm-overview > div:not(:first-child) * {
border-bottom: none !important;
}
/* Zero out all margins between title and controls */
.page-title,
.page-title-container,
.content-grid > div:first-child {
margin-bottom: 0 !important;
}
/* Reduce padding above the VM controls container */
div.vm-controls-container,
.vm-list-container > div:first-child {
margin-top: 0.05rem !important;
padding-top: 0 !important;
}
/* Fix double border issue - ensure only one border appears below search */
.vm-list-container > div:first-child,
.vm-overview > div:first-child,
div[class*="vm-"] > div:first-child {
border-bottom: 1px solid rgba(0, 0, 0, 0.125) !important;
}
/* Remove ALL borders from VM list items - extremely aggressive */
.vm-list-container .vm-list-item,
.vm-list-container .vm-item,
.vm-list-container li,
.vm-list-container tr,
.vm-list-container div[class*="vm-"],
.vm-list > div,
.vm-list > li,
.vm-list > tr,
.vm-list-item,
.vm-item,
div[class*="vm-list"] > div,
div[class*="vm-list"] div {
border: none !important;
border-bottom: none !important;
border-top: none !important;
border-left: none !important;
border-right: none !important;
}
/* Ensure VM list container itself doesn't have a border */
.vm-list-container {
border: none !important;
}
/* Target the actual VM list to remove borders */
.vm-list {
border: none !important;
}
/* Override any hr elements that might be creating lines */
.vm-list-container hr,
.vm-list hr,
.vm-item + hr,
.vm-list-item + hr {
display: none !important;
}
/* Single border under search bar */
.vm-controls-container {
border: none !important;
background: transparent !important;
}
/* Target VM list items specifically */
.vm-list-container .vm-list-item {
border: none !important;
background: transparent !important;
padding-top: 0.25rem !important;
padding-bottom: 0.25rem !important;
}
/* Target the VM item content to reduce spacing */
.vm-item-content,
.vm-list-item > div,
button.vm-list-item {
padding-top: 0.25rem !important;
padding-bottom: 0.25rem !important;
}
/* Also target any nested content */
.vm-name,
.vm-status {
padding-top: 0.25rem !important;
padding-bottom: 0.25rem !important;
}
/* Remove any dividers between VM items */
.vm-list-container .divider,
.vm-list-container hr,
.vm-list-item::after,
.vm-list-item::before {
display: none !important;
}
/* Adjust spacing between title and search */
.page-title + .vm-controls-container {
margin-top: 0 !important;
}
/* Let's also clean up any duplicate rules */
.controls-row {
border-bottom: 1px solid rgba(0, 0, 0, 0.125) !important;
}
/* Remove border from vm-name elements */
.vm-name {
border: none !important;
border-bottom: none !important;
}
/* Target both instances of the border */
div[class*="vm-"] > div:first-child div[class*="vm-"] > div:first-child,
.vm-list-container > div:first-child div[class*="vm-"] > div:first-child {
border: none !important;
border-bottom: none !important;
}
/* Super specific targeting for the border issue */
div[class*="vm-"] > div:first-child H {
border: none !important;
border-bottom: none !important;
}
/* Keep node tabs close to title but adjust content below tabs */
.node-overview .node-tabs-wrapper {
margin-top: 0.25rem !important;
}
/* Adjust spacing below tabs to match overview spacing */
.node-overview .node-tabs-wrapper + * {
margin-top: 0.375rem !important;
}
/* Ensure consistent spacing in overview page */
.overview-container > *:first-child {
margin-top: 0.375rem !important;
}
/* Override spacing specifically for node tabs - keep tight to title */
.node-overview .content-grid > *:first-child + * {
margin-top: 0.25rem !important; /* Keep tabs close to title */
}
/* Adjust spacing between tabs and content below */
.node-overview .node-tabs-wrapper {
margin-bottom: 0.375rem !important; /* Match overview spacing */
}
/* Remove any extra spacing that might be added by other elements */
.node-overview .node-details {
margin-top: 0 !important;
}

View File

@ -4,7 +4,7 @@
<div v-if="!isExpanded" class="section-content-wrapper"> <div v-if="!isExpanded" class="section-content-wrapper">
<div class="section-content"> <div class="section-content">
<div class="collapsed-section-header"> <div class="collapsed-section-header">
<h6 class="card-title mb-0 metric-label">{{ title }}</h6> <h5 class="section-title" v-if="title">{{ title }}</h5>
</div> </div>
</div> </div>
<div class="toggle-column"> <div class="toggle-column">
@ -137,4 +137,20 @@ const toggleSection = () => {
.section-container.collapsed .section-content-wrapper { .section-container.collapsed .section-content-wrapper {
margin-bottom: 0; margin-bottom: 0;
} }
.section-header h6 {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.5rem 0;
cursor: pointer;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
margin-bottom: 0.75rem;
}
.section-title {
margin: 0;
font-size: 0.95rem;
font-weight: 600;
}
</style> </style>

View File

@ -1,5 +1,6 @@
<template> <template>
<div class="node-select-bar"> <div class="node-select-bar">
<div class="node-select-row">
<button <button
v-for="node in nodes" v-for="node in nodes"
:key="node" :key="node"
@ -10,6 +11,7 @@
{{ node }} {{ node }}
</button> </button>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
@ -38,17 +40,23 @@ const selectNode = (node) => {
<style scoped> <style scoped>
.node-select-bar { .node-select-bar {
display: flex; display: flex;
gap: 0.25rem; flex-direction: column;
padding: 0.5rem; gap: 0.5rem;
background-color: white; background-color: white;
border-radius: 0.25rem; border-radius: 0.25rem;
overflow-x: auto; padding-top: 0.25rem;
border-bottom: 1px solid rgba(0, 0, 0, 0.125); border-bottom: 1px solid rgba(0, 0, 0, 0.125);
margin-bottom: 0.5rem; }
.node-select-row {
display: flex;
align-items: center;
gap: 0.5rem;
padding-bottom: 0.75rem !important;
} }
.node-tab { .node-tab {
padding: 0.375rem 0.75rem; padding: 0.45rem 0.75rem;
border: none; border: none;
background: none; background: none;
color: #495057; color: #495057;
@ -66,5 +74,7 @@ const selectNode = (node) => {
.node-tab.active { .node-tab.active {
color: #0d6efd; color: #0d6efd;
background-color: rgba(13, 110, 253, 0.1); background-color: rgba(13, 110, 253, 0.1);
border-bottom: 4px solid rgba(13, 110, 253, 0.25);
margin-bottom: -4px;
} }
</style> </style>

View File

@ -21,7 +21,6 @@ defineProps({
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 1rem;
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
border-bottom: 1px solid rgba(0, 0, 0, 0.1); border-bottom: 1px solid rgba(0, 0, 0, 0.1);
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="controls-bar" ref="controlsBar"> <div class="vm-selector-bar" ref="controlsBar">
<div class="controls-row"> <div class="vm-selector-row">
<button <button
class="btn btn-outline-secondary list-toggle-btn" class="btn btn-outline-secondary list-toggle-btn"
@click="toggleList" @click="toggleList"
@ -46,7 +46,7 @@
</button> </button>
<div class="filter-menu" v-show="showFilterMenu" ref="filterMenu"> <div class="filter-menu" v-show="showFilterMenu" ref="filterMenu">
<div class="filter-section"> <div class="filter-section">
<h6>Status</h6> <h6>State</h6>
<div class="filter-options-dropdown"> <div class="filter-options-dropdown">
<div class="filter-pills"> <div class="filter-pills">
<button <button
@ -104,10 +104,14 @@
<div v-if="selectedVM === vm.name || vmFromUrl === vm.name" class="active-indicator"></div> <div v-if="selectedVM === vm.name || vmFromUrl === vm.name" class="active-indicator"></div>
<div class="vm-item-content"> <div class="vm-item-content">
<div class="vm-name">{{ vm.name }}</div> <div class="vm-name">{{ vm.name }}</div>
<div class="vm-status" :class="getStatusClass(vm.state)"> <div class="vm-state" :class="getStateClass(vm.state)">
<i class="fas fa-circle status-indicator"></i> <i class="fas fa-circle state-indicator"></i>
<span>{{ vm.state }}</span> <span>{{ vm.state }}</span>
</div> </div>
<div v-if="vm.node" class="vm-node">
<i class="fas fa-server node-icon"></i>
<span>{{ vm.node }}</span>
</div>
</div> </div>
</button> </button>
</div> </div>
@ -186,6 +190,9 @@ onMounted(() => {
searchText.value = savedSearchText; searchText.value = savedSearchText;
} }
// Load saved filters
loadFiltersFromLocalStorage();
// Initialize input value based on selected VM // Initialize input value based on selected VM
if (!props.showList && (props.selectedVM || props.vmFromUrl)) { if (!props.showList && (props.selectedVM || props.vmFromUrl)) {
inputValue.value = props.selectedVM || props.vmFromUrl; inputValue.value = props.selectedVM || props.vmFromUrl;
@ -328,8 +335,11 @@ const clearSearch = () => {
emit('update:modelValue', ''); emit('update:modelValue', '');
emit('clear'); emit('clear');
// Focus the search input after clearing // Scroll to selected VM after clearing search
nextTick(() => { nextTick(() => {
scrollToSelectedVM();
// Focus the search input after clearing
const searchInput = document.querySelector('.search-input'); const searchInput = document.querySelector('.search-input');
if (searchInput) { if (searchInput) {
searchInput.focus(); searchInput.focus();
@ -377,6 +387,7 @@ const toggleFilterMenu = () => {
// Filter toggle // Filter toggle
const handleFilterToggle = (type, value) => { const handleFilterToggle = (type, value) => {
appliedFilters.value[type][value] = !appliedFilters.value[type][value]; appliedFilters.value[type][value] = !appliedFilters.value[type][value];
saveFiltersToLocalStorage();
}; };
// Reset filters // Reset filters
@ -387,6 +398,7 @@ const handleResetFilters = () => {
Object.keys(appliedFilters.value.nodes).forEach(node => { Object.keys(appliedFilters.value.nodes).forEach(node => {
appliedFilters.value.nodes[node] = false; appliedFilters.value.nodes[node] = false;
}); });
saveFiltersToLocalStorage();
showFilterMenu.value = false; showFilterMenu.value = false;
}; };
@ -427,7 +439,24 @@ const availableStates = computed(() => {
props.vmList.forEach(vm => { props.vmList.forEach(vm => {
if (vm.state) states.add(vm.state); if (vm.state) states.add(vm.state);
}); });
return Array.from(states).sort();
// Convert to array and ensure all important states are included
const statesArray = Array.from(states);
const importantStates = ['start', 'disable', 'migrate', 'unmigrate', 'provision', 'mirror', 'stop', 'fail', 'shutdown', 'restart'];
// Add any missing important states
importantStates.forEach(state => {
if (!statesArray.includes(state)) {
statesArray.push(state);
}
});
// Sort with 'start' first, then alphabetically
return statesArray.sort((a, b) => {
if (a.toLowerCase() === 'start') return -1;
if (b.toLowerCase() === 'start') return 1;
return a.localeCompare(b);
});
}); });
// Calculate available nodes from vmList // Calculate available nodes from vmList
@ -454,6 +483,9 @@ watch([availableStates, availableNodes], ([states, nodes]) => {
appliedFilters.value.nodes[node] = false; appliedFilters.value.nodes[node] = false;
} }
}); });
// Save updated filters
saveFiltersToLocalStorage();
}); });
// Count active filters // Count active filters
@ -468,15 +500,39 @@ const activeFiltersCount = computed(() => {
return count; return count;
}); });
// Status class helper // Update function name from getStatusClass to getStateClass
const getStatusClass = (state) => { const getStateClass = (state) => {
if (!state) return 'status-unknown'; if (!state) return 'status-unknown';
switch(state.toLowerCase()) {
case 'start': return 'status-running'; const lowerState = state.toLowerCase();
case 'stop': return 'status-stopped';
case 'disable': return 'status-paused'; // Green for running VMs
default: return 'status-unknown'; if (lowerState === 'start') {
return 'status-running';
} }
// Blue for provisioning, migration, etc.
if (['disable', 'migrate', 'unmigrate', 'provision'].includes(lowerState)) {
return 'status-provisioning';
}
// Purple for mirror
if (lowerState === 'mirror') {
return 'status-mirror';
}
// Red for stopped or failed VMs
if (['stop', 'fail'].includes(lowerState)) {
return 'status-stopped';
}
// Yellow for shutdown or restart
if (['shutdown', 'restart'].includes(lowerState)) {
return 'status-restarting';
}
// Default to unknown (black) for any other states
return 'status-unknown';
}; };
// Watch for changes in showList // Watch for changes in showList
@ -532,22 +588,45 @@ const scrollToSelectedVM = () => {
} }
}); });
}; };
// Add localStorage persistence for filters
const saveFiltersToLocalStorage = () => {
localStorage.setItem('vmFilters', JSON.stringify(appliedFilters.value));
};
const loadFiltersFromLocalStorage = () => {
const savedFilters = localStorage.getItem('vmFilters');
if (savedFilters) {
try {
const parsedFilters = JSON.parse(savedFilters);
// Merge saved filters with current filters to handle new states/nodes
appliedFilters.value = {
states: { ...appliedFilters.value.states, ...parsedFilters.states },
nodes: { ...appliedFilters.value.nodes, ...parsedFilters.nodes }
};
} catch (e) {
console.error('Error parsing saved filters:', e);
}
}
};
</script> </script>
<style scoped> <style scoped>
.controls-bar { .vm-selector-bar {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.5rem; gap: 0.5rem;
background-color: white; background-color: white;
border-radius: 0.25rem; border-radius: 0.25rem;
padding: 1rem; padding-top: 0.25rem;
border-bottom: 1px solid rgba(0, 0, 0, 0.125);
} }
.controls-row { .vm-selector-row {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.5rem; gap: 0.5rem;
padding-bottom: 0.75rem !important;
} }
.search-box { .search-box {
@ -622,7 +701,8 @@ const scrollToSelectedVM = () => {
background-color: white; background-color: white;
border-radius: 0.25rem; border-radius: 0.25rem;
overflow: hidden; overflow: hidden;
margin-top: 0.5rem; margin-top: -0.5rem;
padding-bottom: 0.25rem;
} }
.vm-list { .vm-list {
@ -631,6 +711,7 @@ const scrollToSelectedVM = () => {
width: 100%; width: 100%;
max-height: calc(100vh - 200px); max-height: calc(100vh - 200px);
overflow-y: auto; overflow-y: auto;
padding-bottom: 0.25rem;
} }
.vm-list-item { .vm-list-item {
@ -638,7 +719,6 @@ const scrollToSelectedVM = () => {
align-items: center; align-items: center;
padding: 0.75rem 1rem; padding: 0.75rem 1rem;
border: none !important; border: none !important;
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
background-color: white; background-color: white;
text-align: left; text-align: left;
cursor: pointer; cursor: pointer;
@ -648,6 +728,7 @@ const scrollToSelectedVM = () => {
.vm-list-item:last-child { .vm-list-item:last-child {
border-bottom: none !important; border-bottom: none !important;
margin-bottom: 0.25rem;
} }
.vm-list-item:hover { .vm-list-item:hover {
@ -671,12 +752,12 @@ const scrollToSelectedVM = () => {
z-index: 2 !important; z-index: 2 !important;
} }
.controls-bar .vm-list-container .vm-list .vm-list-item.active { .vm-selector-bar .vm-list-container .vm-list .vm-list-item.active {
background-color: rgba(13, 110, 253, 0.15) !important; background-color: rgba(13, 110, 253, 0.15) !important;
position: relative !important; position: relative !important;
} }
.controls-bar .vm-list-container .vm-list .vm-list-item.active::before { .vm-selector-bar .vm-list-container .vm-list .vm-list-item.active::before {
content: ''; content: '';
position: absolute !important; position: absolute !important;
left: 0 !important; left: 0 !important;
@ -688,45 +769,60 @@ const scrollToSelectedVM = () => {
.vm-item-content { .vm-item-content {
display: flex; display: flex;
justify-content: space-between;
align-items: center; align-items: center;
width: 100%; width: 100%;
gap: 1rem;
} }
.vm-name { .vm-name {
font-weight: 500; font-weight: 500;
flex: 1;
} }
.vm-status { .vm-state {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.5rem; gap: 0.5rem;
font-size: 0.875rem; font-size: 0.875rem;
width: 100px;
} }
.status-indicator { .vm-node {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.875rem;
color: #6c757d;
width: 100px;
}
.node-icon {
font-size: 0.75rem;
}
.state-indicator {
font-size: 0.625rem; font-size: 0.625rem;
} }
/* Status colors */ /* Status colors - updated */
.status-running { .status-running {
color: #28a745; color: #28a745; /* Green */
} }
.status-stopped { .status-stopped {
color: #6c757d; color: #dc3545; /* Red */
} }
.status-paused { .status-provisioning {
color: #ffc107; color: #0d6efd; /* Blue */
} }
.status-error { .status-mirror {
color: #dc3545; color: #6f42c1; /* Purple */
} }
.status-unknown { .status-restarting {
color: #6c757d; color: #ffc107; /* Yellow */
} }
.no-vms-message { .no-vms-message {
@ -741,7 +837,7 @@ const scrollToSelectedVM = () => {
top: 100%; top: 100%;
right: 0; right: 0;
z-index: 1000; z-index: 1000;
min-width: 250px; min-width: 350px;
padding: 1rem; padding: 1rem;
margin-top: 0.5rem; margin-top: 0.5rem;
background-color: white; background-color: white;
@ -757,12 +853,11 @@ const scrollToSelectedVM = () => {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
font-weight: 600; font-weight: 600;
color: #495057; color: #495057;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
padding-bottom: 0.25rem; padding-bottom: 0.25rem;
} }
.filter-options-dropdown { .filter-options-dropdown {
max-height: 150px; max-height: 200px;
overflow-y: auto; overflow-y: auto;
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -1,5 +1,4 @@
<template> <template>
<div class="overview-container">
<NodeSelectBar <NodeSelectBar
v-model="selectedNode" v-model="selectedNode"
:nodes="availableNodes" :nodes="availableNodes"
@ -7,7 +6,7 @@
/> />
<!-- Node Details --> <!-- Node Details -->
<div v-if="selectedNodeData" class="node-details"> <div v-if="selectedNodeData" class="content-container">
<!-- Information Cards Section --> <!-- Information Cards Section -->
<CollapsibleSection title="Node Information" :initially-expanded="sections.info"> <CollapsibleSection title="Node Information" :initially-expanded="sections.info">
<div class="info-row"> <div class="info-row">
@ -146,32 +145,12 @@
<!-- Running VMs Section --> <!-- Running VMs Section -->
<CollapsibleSection title="Running VMs" :initially-expanded="sections.vms"> <CollapsibleSection title="Running VMs" :initially-expanded="sections.vms">
<div class="vms-container"> <div class="vm-list-row">
<div class="vms-card"> <NodeVMList
<div class="card-header"> :vmData="props.vmData"
<h6 class="card-title mb-0"> :nodeData="props.nodeData"
<span class="metric-label">Running VMs</span> :nodeName="selectedNode"
</h6> />
</div>
<div class="card-body">
<div v-if="!selectedNodeData.running_domains || selectedNodeData.running_domains.length === 0" class="no-vms">
<p>No VMs running on this node</p>
</div>
<div v-else class="vm-list" :style="{
'grid-template-columns': `repeat(auto-fill, minmax(${calculateVmItemMinWidth}px, 1fr))`
}">
<div
v-for="vm in selectedNodeData.running_domains"
:key="vm"
class="vm-item"
@click="handleVmClick(vm)"
title="View VM details"
>
{{ vm }}
</div>
</div>
</div>
</div>
</div> </div>
</CollapsibleSection> </CollapsibleSection>
</div> </div>
@ -180,7 +159,6 @@
<div v-else class="no-node-selected"> <div v-else class="no-node-selected">
<p>Select a node to view details</p> <p>Select a node to view details</p>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
@ -193,6 +171,8 @@ import HealthChart from '../../charts/HealthChart.vue';
import ValueCard from '../../general/ValueCard.vue'; import ValueCard from '../../general/ValueCard.vue';
import CollapsibleSection from '../../general/CollapsibleSection.vue'; import CollapsibleSection from '../../general/CollapsibleSection.vue';
import NodeSelectBar from '../../general/NodeSelectBar.vue'; import NodeSelectBar from '../../general/NodeSelectBar.vue';
import NodeVMList from './NodeVMList.vue';
import { useRouter, useRoute } from 'vue-router';
// Move all the props, refs, computed properties, and functions from Nodes.vue // Move all the props, refs, computed properties, and functions from Nodes.vue
const props = defineProps({ const props = defineProps({
@ -210,6 +190,11 @@ const props = defineProps({
type: Object, type: Object,
required: true, required: true,
default: () => ({}) default: () => ({})
},
vmData: {
type: Array,
required: true,
default: () => []
} }
}); });
@ -430,28 +415,6 @@ const getDomainStateColor = (state) => {
return 'gray'; return 'gray';
}; };
// Handle VM click (placeholder until VMs page is implemented)
const handleVmClick = (vmName) => {
console.log(`VM clicked: ${vmName}`);
alert(`The VMs page is not yet implemented. You clicked on VM: ${vmName}`);
};
// Calculate the minimum width for VM items based on the longest VM name
const calculateVmItemMinWidth = computed(() => {
if (!selectedNodeData.value || !selectedNodeData.value.running_domains || !selectedNodeData.value.running_domains.length) {
return 100; // Default minimum width
}
// Find the longest VM name
const longestVmName = selectedNodeData.value.running_domains.reduce((longest, current) => {
return current.length > longest.length ? current : longest;
}, '');
// Calculate width based on character count (approx 8px per character plus padding)
const minWidth = Math.max(100, longestVmName.length * 8 + 32);
return minWidth;
});
// Initialize the component // Initialize the component
onMounted(() => { onMounted(() => {
// Select the first node by default if available // Select the first node by default if available
@ -492,172 +455,22 @@ const handleNodeSelect = (node) => {
<style scoped> <style scoped>
/* Add these missing styles from the original Nodes.vue */ /* Add these missing styles from the original Nodes.vue */
.overview-container { .content-container {
background-color: white;
border-radius: 0.25rem;
width: 100%;
padding-top: 0.25rem;
}
.loading-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.5rem;
width: 100%;
}
/* Node tabs styling */
.node-tabs-wrapper {
position: relative;
width: 100%;
overflow: hidden;
border-bottom: 1px solid rgba(0, 0, 0, 0.125);
margin-bottom: 1rem;
}
.node-tabs {
display: flex;
overflow-x: auto;
scrollbar-width: none; /* Hide scrollbar for Firefox */
-ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
scroll-behavior: smooth;
padding: 0 40px; /* Make room for scroll buttons */
}
.node-tabs::-webkit-scrollbar {
display: none; /* Hide scrollbar for Chrome, Safari, and Opera */
}
.node-tab {
padding: 0.5rem 1rem;
background: none;
border: none;
border-bottom: 2px solid transparent;
cursor: pointer;
white-space: nowrap;
transition: all 0.2s;
color: #495057;
}
.node-tab:hover {
background-color: rgba(0, 0, 0, 0.03);
}
.node-tab.active {
border-bottom: 2px solid #0d6efd;
color: #0d6efd;
font-weight: 600;
}
.tab-scroll-button {
position: absolute;
top: 0;
height: 100%;
width: 40px;
background: rgba(255, 255, 255, 0.9);
border: none;
cursor: pointer;
display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
z-index: 10; padding: 2rem;
} }
.tab-scroll-button.left { .info-row, .graphs-row, .resources-row-cpu, .resources-row-memory, .vm-list-row {
left: 0;
box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}
.tab-scroll-button.right {
right: 0;
box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
}
/* Node details styling */
.node-details {
display: flex;
flex-direction: column;
gap: 0.5rem;
width: 100%;
}
.no-node-selected {
display: flex;
justify-content: center;
align-items: center;
height: 200px;
background-color: rgba(0, 0, 0, 0.03);
border-radius: 0.25rem;
color: #666;
}
/* Section styling */
.section-container {
position: relative;
margin-bottom: 0.5rem;
}
.section-content-wrapper {
display: flex;
position: relative;
}
.section-content {
flex: 1;
min-width: 0;
padding-right: 40px;
}
.toggle-column {
position: absolute;
top: 4px;
right: 0;
width: 40px;
height: 30px;
z-index: 10;
padding-left: 6px;
}
.section-toggle {
background: none;
border: none;
color: #666;
cursor: pointer;
padding: 0.25rem;
border-radius: 0.25rem;
transition: all 0.2s;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(255, 255, 255, 0.8);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.section-toggle:hover {
background-color: rgba(0, 0, 0, 0.05);
color: #333;
}
.section-toggle:focus {
outline: none;
box-shadow: none;
}
.collapsed-section-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.5rem;
background-color: rgba(0, 0, 0, 0.03);
border: 1px solid rgba(0, 0, 0, 0.125);
border-radius: 0.25rem;
height: 38px;
width: 100%;
}
.collapsed-section-header .card-title {
margin: 0;
color: #495057;
font-size: 0.95rem;
font-weight: 600;
}
.metrics-row, .graphs-row, .resources-row-cpu, .resources-row-memory, .info-row {
display: grid; display: grid;
gap: 0.5rem; gap: 0.5rem;
width: 100%; width: 100%;
@ -665,10 +478,6 @@ const handleNodeSelect = (node) => {
/* Responsive grid layouts */ /* Responsive grid layouts */
@media (min-width: 1201px) { @media (min-width: 1201px) {
.metrics-row {
grid-template-columns: repeat(4, 1fr);
}
.info-row { .info-row {
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
} }
@ -687,10 +496,6 @@ const handleNodeSelect = (node) => {
} }
@media (min-width: 801px) and (max-width: 1200px) { @media (min-width: 801px) and (max-width: 1200px) {
.metrics-row {
grid-template-columns: repeat(2, 1fr);
}
.info-row { .info-row {
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
} }
@ -709,7 +514,6 @@ const handleNodeSelect = (node) => {
} }
@media (max-width: 800px) { @media (max-width: 800px) {
.metrics-row,
.info-row, .info-row,
.graphs-row, .graphs-row,
.resources-row-cpu, .resources-row-cpu,
@ -718,245 +522,4 @@ const handleNodeSelect = (node) => {
} }
} }
.metric-card {
min-width: 180px;
background: white;
border: 1px solid rgba(0,0,0,0.125);
border-radius: 0.25rem;
height: 100%;
display: flex;
flex-direction: column;
min-width: 0;
width: 100%;
overflow: hidden;
}
.metric-card .card-header {
background-color: rgba(0, 0, 0, 0.03);
padding: 0.5rem;
border-bottom: 1px solid rgba(0, 0, 0, 0.125);
height: 38px;
display: flex;
justify-content: space-between;
align-items: center;
}
.card-header h6 {
font-size: 0.95rem;
font-weight: 600;
display: flex;
justify-content: space-between;
align-items: center;
margin: 0;
}
.metric-card .card-body {
flex: 1;
padding: 0.5rem;
display: flex;
flex-direction: column;
position: relative;
width: 100%;
overflow: visible;
justify-content: center;
align-items: center;
}
.metric-card .metric-value {
font-size: 1.25rem;
font-weight: bold;
color: #333;
line-height: 1;
margin: 0;
text-align: center;
white-space: nowrap;
min-width: fit-content;
}
/* Add back the VM-specific styles */
.vms-container {
width: 100%;
}
.vms-card {
background: white;
border: 1px solid rgba(0,0,0,0.125);
border-radius: 0.25rem;
height: 100%;
display: flex;
flex-direction: column;
width: 100%;
overflow: hidden;
}
.vms-card .card-header {
background-color: rgba(0, 0, 0, 0.03);
padding: 0.5rem;
border-bottom: 1px solid rgba(0, 0, 0, 0.125);
height: 38px;
display: flex;
justify-content: space-between;
align-items: center;
}
.vms-card .card-body {
flex: 1;
padding: 0.5rem;
display: flex;
flex-direction: column;
position: relative;
width: 100%;
overflow: visible;
}
.no-vms {
display: flex;
justify-content: center;
align-items: center;
height: 100px;
color: #6c757d;
font-style: italic;
}
.vm-list {
display: grid;
gap: 0.5rem;
width: 100%;
}
.vm-item {
padding: 0.5rem;
background-color: rgba(0, 0, 0, 0.015);
border: 1px solid rgba(0, 0, 0, 0.05);
border-radius: 0.25rem;
cursor: pointer;
text-align: center;
font-weight: 500;
color: #333;
transition: all 0.2s;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
position: relative;
}
.vm-item:hover {
background-color: rgba(0, 0, 0, 0.04);
border-color: rgba(0, 0, 0, 0.1);
}
/* Also add back these missing utility styles */
.metric-percentage {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(255, 255, 255, 0.8);
padding: 0.25rem 0.75rem;
border-radius: 0.5rem;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
z-index: 2;
}
.metric-percentage .metric-value {
font-size: 2.5rem;
font-weight: 500;
color: #333;
line-height: 1;
margin: 0;
text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}
.chart-wrapper {
position: relative;
width: 100%;
height: 160px;
min-height: 160px;
overflow: hidden;
border: none;
border-radius: 0;
background-color: white;
margin: 0;
}
/* Status colors */
.status-healthy { color: #28a745; }
.status-warning { color: #ffc107; }
.status-error { color: #dc3545; }
/* Chart colors */
.chart-cpu {
background: white;
border: none;
}
.chart-memory {
background: white;
border: none;
}
.chart-storage, .chart-allocated {
background: white;
border: none;
}
.chart-health {
background: white;
border: none;
}
/* Toggle column styles */
.toggle-column.expanded {
top: 0;
right: 0;
height: 100%;
display: flex;
align-items: flex-start;
padding-top: 4px;
}
/* Section container styles */
.section-container.collapsed {
margin-bottom: 0.5rem;
}
.section-container.collapsed .section-content-wrapper {
margin-bottom: 0;
}
/* Target the specific element causing the padding */
ul.nav.nav-tabs {
padding-left: 0 !important;
margin-left: 0 !important;
}
/* Target Bootstrap's default tab styling */
.nav-tabs {
padding-left: 0 !important;
margin-left: 0 !important;
}
/* Target any list items in the tabs */
.nav-tabs > li {
margin-left: 0 !important;
padding-left: 0 !important;
}
/* Target the tab container */
.tab-container {
padding-left: 0 !important;
margin-left: 0 !important;
}
/* Target the content grid in nodes view */
.nodes-view .content-grid {
padding-left: 0 !important;
margin-left: 0 !important;
}
/* Target all direct children of content-grid in nodes view */
.nodes-view .content-grid > * {
padding-left: 0 !important;
margin-left: 0 !important;
}
</style> </style>

View File

@ -0,0 +1,164 @@
<template>
<div class="vms-container">
<div class="card-header">
<h6 class="card-title mb-0">
<span class="metric-label">Running VMs</span>
</h6>
</div>
<div v-if="!runningDomains || runningDomains.length === 0" class="no-vms">
No VMs running on this node
</div>
<div v-else class="vm-list" :style="{
'grid-template-columns': `repeat(auto-fill, minmax(150px, 1fr))`
}">
<div
v-for="vmName in runningDomains"
:key="vmName"
class="vm-item"
@click="selectVM(vmName)"
>
{{ vmName }}
</div>
</div>
</div>
</template>
<script setup>
import { computed } from 'vue';
import { useRouter } from 'vue-router';
const props = defineProps({
vmData: {
type: Array,
required: true,
default: () => []
},
nodeData: {
type: Array,
required: true,
default: () => []
},
nodeName: {
type: String,
required: true
}
});
const router = useRouter();
// Get the selected node data
const nodeData = computed(() => {
if (!props.nodeName || !props.nodeData || props.nodeData.length === 0) {
console.log('No node selected or no node data available');
return null;
}
const node = props.nodeData.find(node => node.name === props.nodeName);
console.log(`Node data for ${props.nodeName}:`, node);
return node;
});
// Get running domains from the node data
const runningDomains = computed(() => {
if (!nodeData.value || !nodeData.value.running_domains) {
console.log('No running domains found for node:', props.nodeName);
return [];
}
console.log(`Found ${nodeData.value.running_domains.length} running domains on node ${props.nodeName}:`, nodeData.value.running_domains);
return nodeData.value.running_domains;
});
// Navigate to VM details
const selectVM = (vmName) => {
console.log('Navigating to VM:', vmName);
// Find the full VM data if available
const vmData = props.vmData.find(vm => vm.name === vmName);
console.log('Found VM data:', vmData);
router.push({
path: '/vms',
query: { vm: vmName }
});
};
</script>
<style scoped>
.vms-container {
min-width: 180px;
background: white;
border: 1px solid rgba(0,0,0,0.125);
border-radius: 0.25rem;
height: 100%;
display: flex;
flex-direction: column;
min-width: 0;
width: 100%;
overflow: hidden;
}
.card-header {
background-color: rgba(0, 0, 0, 0.03);
padding: 0.5rem;
border-bottom: 1px solid rgba(0, 0, 0, 0.125);
height: 38px;
display: flex;
justify-content: space-between;
align-items: center;
}
.card-header h6 {
font-size: 0.95rem;
font-weight: 600;
display: flex;
justify-content: space-between;
align-items: center;
margin: 0;
}
.no-vms {
display: flex;
justify-content: center;
align-items: center;
height: 100px;
color: #6c757d;
font-style: italic;
}
.vm-list {
display: grid;
gap: 0.5rem;
width: 100%;
padding: 0.5rem;
border-radius: 0.25rem;
}
.vm-item {
padding: 0.5rem;
background-color: rgba(0, 0, 0, 0.015);
border: 1px solid rgba(0, 0, 0, 0.05);
border-radius: 0.25rem;
cursor: pointer;
text-align: center;
font-weight: 500;
color: #333;
transition: all 0.2s;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
position: relative;
display: block;
}
.vm-item:hover {
background-color: rgba(0, 0, 0, 0.04);
border-color: rgba(0, 0, 0, 0.1);
}
.vm-node {
font-size: 0.7rem;
color: #6c757d;
margin-top: 0.25rem;
}
</style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="overview-container"> <div class="content-container">
<!-- Information Cards Section --> <!-- Information Cards Section -->
<CollapsibleSection title="Cluster Information" :initially-expanded="sections.info"> <CollapsibleSection title="Cluster Information" :initially-expanded="sections.info">
<div class="metrics-row"> <div class="metrics-row">
@ -870,11 +870,12 @@ const isMaintenanceMode = computed(() => {
</script> </script>
<style scoped> <style scoped>
.overview-container { .content-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.5rem; gap: 0.5rem;
width: 100%; width: 100%;
padding-top: 0.25rem;
} }
.metrics-row { .metrics-row {

View File

@ -1,5 +1,4 @@
<template> <template>
<div class="overview-container">
<VMSearchBar <VMSearchBar
:key="`vm-search-${selectedVM}`" :key="`vm-search-${selectedVM}`"
v-model="searchQuery" v-model="searchQuery"
@ -19,7 +18,7 @@
<!-- VM Details --> <!-- VM Details -->
<div v-if="selectedVMData && !showVMList" class="content-container"> <div v-if="selectedVMData && !showVMList" class="content-container">
<CollapsibleSection title="VM Information" :initially-expanded="sections.info"> <CollapsibleSection title="VM Information" :initially-expanded="sections.info">
<div class="info-grid"> <div class="info-grid-general">
<ValueCard <ValueCard
title="State" title="State"
:value="selectedVMData.state || 'Unknown'" :value="selectedVMData.state || 'Unknown'"
@ -42,7 +41,7 @@
<!-- Resources Section --> <!-- Resources Section -->
<CollapsibleSection title="Resources" :initially-expanded="sections.resources"> <CollapsibleSection title="Resources" :initially-expanded="sections.resources">
<div class="info-grid-2"> <div class="info-grid-resources">
<ValueCard <ValueCard
title="Disk Size" title="Disk Size"
:value="formatStorage(selectedVMData.disk_size)" :value="formatStorage(selectedVMData.disk_size)"
@ -113,7 +112,6 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
@ -318,17 +316,12 @@ const formatStorage = (sizeGB) => {
</script> </script>
<style scoped> <style scoped>
.overview-container {
display: flex;
flex-direction: column;
gap: 0.5rem;
width: 100%;
}
.content-container { .content-container {
background-color: white; background-color: white;
border-radius: 0.25rem; border-radius: 0.25rem;
padding: 1rem; padding: 1rem;
width: 100%;
padding-top: 0.25rem;
} }
.loading-container { .loading-container {
@ -344,37 +337,33 @@ const formatStorage = (sizeGB) => {
padding: 2rem; padding: 2rem;
} }
/* Keep only the styles needed for VM details display */ .info-grid-general {
.info-grid {
display: grid; display: grid;
gap: 1rem; gap: 0.5rem;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
} }
.info-grid-2 { .info-grid-resources {
display: grid; display: grid;
gap: 1rem; gap: 0.5rem;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
} }
.cards-stack { .cards-stack {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 0.5rem;
} }
.detail-card { .detail-card {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem; gap: 0.5rem;
padding: 1rem;
background-color: rgba(0, 0, 0, 0.02);
border-radius: 0.25rem;
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.info-grid, .info-grid-general,
.info-grid-2 { .info-grid-resources {
grid-template-columns: 1fr; grid-template-columns: 1fr;
} }

View File

@ -13,7 +13,7 @@
import PageTitle from '../components/general/PageTitle.vue'; import PageTitle from '../components/general/PageTitle.vue';
import NodeOverview from '../components/pages/nodes/NodeOverview.vue'; import NodeOverview from '../components/pages/nodes/NodeOverview.vue';
defineProps({ const props = defineProps({
nodeData: { nodeData: {
type: Array, type: Array,
required: true, required: true,
@ -39,9 +39,4 @@ defineProps({
gap: 0.5rem; gap: 0.5rem;
width: 100%; width: 100%;
} }
/* Remove top margin from first child (usually PageTitle) */
.content-grid > :first-child {
margin-top: 0 !important;
}
</style> </style>

View File

@ -14,7 +14,6 @@
import PageTitle from '../components/general/PageTitle.vue'; import PageTitle from '../components/general/PageTitle.vue';
import VMOverview from '../components/pages/vms/VMOverview.vue'; import VMOverview from '../components/pages/vms/VMOverview.vue';
// Define props to receive data from App.vue
const props = defineProps({ const props = defineProps({
vmData: { vmData: {
type: Array, type: Array,
@ -45,9 +44,4 @@ const props = defineProps({
gap: 0.5rem; gap: 0.5rem;
width: 100%; width: 100%;
} }
/* Remove top margin from first child (usually PageTitle) */
.content-grid > :first-child {
margin-top: 0 !important;
}
</style> </style>