Add node state colours
This commit is contained in:
parent
b367d4086e
commit
187e46ee6d
@ -5,14 +5,16 @@
|
|||||||
<span class="metric-label">{{ title }}</span>
|
<span class="metric-label">{{ title }}</span>
|
||||||
</h6>
|
</h6>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body" :class="bgColorClass">
|
||||||
<h4 class="metric-value" :class="valueClass">{{ value }}</h4>
|
<h4 class="metric-value" :class="valueClass">{{ value }}</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
defineProps({
|
import { computed } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
@ -24,8 +26,18 @@ defineProps({
|
|||||||
valueClass: {
|
valueClass: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
bgColor: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Compute the background color class based on the bgColor prop
|
||||||
|
const bgColorClass = computed(() => {
|
||||||
|
if (!props.bgColor) return '';
|
||||||
|
return `bg-${props.bgColor}`;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -42,6 +54,27 @@ defineProps({
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Background color classes */
|
||||||
|
.bg-green {
|
||||||
|
background-color: rgba(40, 167, 69, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-yellow {
|
||||||
|
background-color: rgba(255, 193, 7, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-red {
|
||||||
|
background-color: rgba(220, 53, 69, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-blue {
|
||||||
|
background-color: rgba(13, 110, 253, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-gray {
|
||||||
|
background-color: rgba(108, 117, 125, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
.metric-card .card-header {
|
.metric-card .card-header {
|
||||||
background-color: rgba(0, 0, 0, 0.03);
|
background-color: rgba(0, 0, 0, 0.03);
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
|
@ -49,18 +49,21 @@
|
|||||||
<ValueCard
|
<ValueCard
|
||||||
title="Daemon State"
|
title="Daemon State"
|
||||||
:value="selectedNodeData.daemon_state || 'Unknown'"
|
:value="selectedNodeData.daemon_state || 'Unknown'"
|
||||||
|
:bg-color="getDaemonStateColor(selectedNodeData.daemon_state)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Card 2: Coordinator State -->
|
<!-- Card 2: Coordinator State -->
|
||||||
<ValueCard
|
<ValueCard
|
||||||
title="Coordinator State"
|
title="Coordinator State"
|
||||||
:value="selectedNodeData.coordinator_state || 'Unknown'"
|
:value="selectedNodeData.coordinator_state || 'Unknown'"
|
||||||
|
:bg-color="getCoordinatorStateColor(selectedNodeData.coordinator_state)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Card 3: Domain State -->
|
<!-- Card 3: Domain State -->
|
||||||
<ValueCard
|
<ValueCard
|
||||||
title="Domain State"
|
title="Domain State"
|
||||||
:value="selectedNodeData.domain_state || 'Unknown'"
|
:value="selectedNodeData.domain_state || 'Unknown'"
|
||||||
|
:bg-color="getDomainStateColor(selectedNodeData.domain_state)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Card 4: PVC Version -->
|
<!-- Card 4: PVC Version -->
|
||||||
@ -486,6 +489,36 @@ const nodeAllocatedMemoryChartData = computed(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Helper functions for state colors
|
||||||
|
// Determine color for daemon state
|
||||||
|
const getDaemonStateColor = (state) => {
|
||||||
|
if (!state) return '';
|
||||||
|
|
||||||
|
if (state === 'run') return 'green';
|
||||||
|
if (['init', 'shutdown'].includes(state)) return 'yellow';
|
||||||
|
if (['stop', 'dead', 'fenced'].includes(state)) return 'red';
|
||||||
|
return 'blue';
|
||||||
|
};
|
||||||
|
|
||||||
|
// Determine color for coordinator state
|
||||||
|
const getCoordinatorStateColor = (state) => {
|
||||||
|
if (!state) return '';
|
||||||
|
|
||||||
|
if (state === 'primary') return 'green';
|
||||||
|
if (state === 'secondary') return 'blue';
|
||||||
|
if (state === 'hypervisor') return 'gray';
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
|
// Determine color for domain state
|
||||||
|
const getDomainStateColor = (state) => {
|
||||||
|
if (!state) return '';
|
||||||
|
|
||||||
|
if (state === 'ready') return 'green';
|
||||||
|
if (['flushing', 'flushed', 'unflushing'].includes(state)) return 'blue';
|
||||||
|
return 'gray';
|
||||||
|
};
|
||||||
|
|
||||||
// Initialize the component
|
// Initialize the component
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// Select the first node by default if available
|
// Select the first node by default if available
|
||||||
|
Loading…
x
Reference in New Issue
Block a user