Skip to content

Commit

Permalink
small ui change
Browse files Browse the repository at this point in the history
  • Loading branch information
bmario committed Oct 2, 2024
1 parent cb4c9ff commit d72d4c3
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
9 changes: 3 additions & 6 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h2>MetricQ Webview erfordert Javascript, aber es ist deaktiviert oder wird nich
<nav class="navbar navbar-light bg-light">
<a class="navbar-brand" href="?">
<img src="img/metricq-logo.png" width="35" height="35" alt="MetricQ-Logo" style="border-radius: .25rem;"/>
MetricQ-WebView
MetricQ WebView
</a>
<label class="btn btn-outline-primary btn-navbar" id="button_configuration"
v-on:click="configurationButtonClicked"
Expand All @@ -47,10 +47,6 @@ <h2>MetricQ Webview erfordert Javascript, aber es ist deaktiviert oder wird nich
<input type="checkbox" id='checkbox_min_max' v-bind:checked="globalMinMax" v-on:change="toggleMinMaxButton">
<span>Werteumfang zeichnen</span>
</label>
<label class="btn btn-outline-primary btn-navbar" id="button_palette" v-on:click="colorPaletteClicked"
v-b-tooltip.hover title="Metriken eindeutig färben">
<b-icon-palette></b-icon-palette>
</label>
<label>
<time-button id="date_range" class="btn btn-outline-primary btn-navbar"
v-if="isWebviewLoaded"
Expand All @@ -75,7 +71,8 @@ <h2>MetricQ Webview erfordert Javascript, aber es ist deaktiviert oder wird nich
:key="metric.name"
:position="configuration.legendDisplay"
></metric-legend>
<hide-metrics-button v-bind:position="configuration.legendDisplay"></hide-metrics-button>
<hide-metrics-button :position="configuration.legendDisplay"></hide-metrics-button>
<recolor-metrics-button :position="configuration.legendDisplay"></recolor-metrics-button>
<new-metric-legend
:position="configuration.legendDisplay"></new-metric-legend>
<clear-metrics-button
Expand Down
2 changes: 2 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ExportPopup from './ui/export-popup.vue'
import LinkPopup from './ui/link-popup.vue'
import MetricLegend from './ui/metric-legend.vue'
import HideMetricsButton from './ui/hide-metrics-button.vue'
import RecolorMetricsButton from './ui/recolor-metrics-button.vue'
import NewMetricLegend from './ui/new-metric-legend.vue'
import ClearMetricsButton from './ui/clear-metrics-button.vue'
import MetricPopup from './ui/metric-popup.vue'
Expand Down Expand Up @@ -41,6 +42,7 @@ export const mainApp = new Vue({
LinkPopup,
MetricLegend,
HideMetricsButton,
RecolorMetricsButton,
NewMetricLegend,
ClearMetricsButton,
MetricPopup,
Expand Down
4 changes: 2 additions & 2 deletions src/components/query-points.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
>
<span>
<span>Datenpunkte:</span>
<span> Raw: {{ performance.raw | withDecimalPlaces(0) }}
<span v-if="performance.agg !== null">( Aggregate: {{ performance.agg | withDecimalPlaces(0) }} )</span>
<span> {{ performance.raw | withDecimalPlaces(0) }} Punkte
<span v-if="performance.agg !== null">in {{ performance.agg | withDecimalPlaces(0) }} Aggregate</span>
</span>
</span>
</li>
Expand Down
44 changes: 44 additions & 0 deletions src/ui/recolor-metrics-button.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<template>
<li
v-if="hasMetrics"
:class="'clickable legend_end legend_item legend_item_' + position"
@click="onRecolorClicked"
>
<span>
<b-icon-palette />
<span class="m-2">
Metriken eindeutig einfärben
</span>
</span>
</li>
</template>

<script>
import distinctColors from 'distinct-colors'
export default {
props: {
position: {
type: String,
required: true
}
},
computed: {
hasMetrics () {
return this.$store.getters['metrics/length']() > 0
}
},
methods: {
onRecolorClicked () {
const palette = distinctColors({ count: this.$store.getters['metrics/length'](), lightMin: 25, lightMax: 75 }).values()
for (const metric of this.$store.getters['metrics/getAll']()) {
const color = palette.next().value.css()
this.$store.dispatch('metrics/updateColor', { metricKey: metric.key, color: color })
}
}
}
}
</script>

<style scoped>
</style>

1 comment on commit d72d4c3

@Quimoniz
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs more 🦓.

Please sign in to comment.