Skip to content

Commit

Permalink
Lint: Oups
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierodo committed Dec 1, 2023
1 parent e9e5f4a commit 0b4597c
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export default {
this.loading = false;
this.chart = Highcharts.chart(this.$refs.container, this.options);
},
update (opt) {
update(opt) {
this.chart.update(opt);
}
},
},
mounted() {
if (undefined === window.Highcharts) {
Expand Down
26 changes: 13 additions & 13 deletions packages/report-ui/src/components/restqa/history/Widget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import History from "@/services/history";
import Highcharts from "@/components/UI/highcharts/Highcharts.vue";
import Card from "@/components/UI/card/Card.vue";
import { Listen, Get } from '@/services/utils/dark-mode.js'
import { Listen, Get } from "@/services/utils/dark-mode.js";
export default {
name: "HistoryWidget",
Expand All @@ -22,11 +22,11 @@ export default {
},
},
data() {
let isDark = Get()
Listen(evt => {
this.$refs.chart && this.$refs.chart.update(this.getData(evt.isDark))
isDark = evt.isDark
})
let isDark = Get();
Listen((evt) => {
this.$refs.chart && this.$refs.chart.update(this.getData(evt.isDark));
isDark = evt.isDark;
});
return {
isDark,
currentId: null,
Expand All @@ -39,7 +39,7 @@ export default {
this.currentId = id;
},
getData(isDark) {
const txtColor = isDark ? '#ffffff': null
const txtColor = isDark ? "#ffffff" : null;
const colors = {
success: "#21AE8C",
info: "#1A86D0",
Expand All @@ -49,7 +49,7 @@ export default {
let xAxis = {
labels: {
style: {
color: txtColor
color: txtColor,
},
formatter: ({ value }) => {
const item = History.get(value);
Expand Down Expand Up @@ -124,9 +124,9 @@ export default {
},
colors: [success, info, danger],
legend: {
labelFormatter: function(t, w) {
return `<span style="color: ${txtColor}">${this.name}</span>`
}
labelFormatter: function () {
return `<span style="color: ${txtColor}">${this.name}</span>`;
},
},
yAxis: {
min: 0,
Expand All @@ -142,14 +142,14 @@ export default {
xAxis,
series,
};
}
},
},
computed: {
current() {
return this.currentId || this.data.id;
},
historyForChart() {
return this.getData(this.isDark)
return this.getData(this.isDark);
},
},
};
Expand Down
74 changes: 36 additions & 38 deletions packages/report-ui/src/layouts/partials/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,59 @@
<div class="main">
<br />
<el-row style="">
<el-col :span="4"></el-col>
<el-col :span="16">
Hand-crafted with 鉂わ笍 using
<el-link href="https://vuejs.org/" type="success" target="_blank"
>vuejs</el-link
>
and
<el-link type="info" href="https://element.eleme.io" target="_blank"
>element</el-link
>
<br />
-
<br />
<span v-if="version">v{{ version }}</span>
<el-link v-else type="primary" href="https://restqa.io"
>Try RestQA, The Next in class microservice testing Framework</el-link
>
</el-col>
<el-col :span="4">
<div style="float:right">
<el-switch
v-model="isDark"
:inactive-action-icon="sunny"
:active-action-icon="moon"
@change="getDark($event)"
/>
</div>
</el-col>
<el-col :span="4"></el-col>
<el-col :span="16">
Hand-crafted with 鉂わ笍 using
<el-link href="https://vuejs.org/" type="success" target="_blank"
>vuejs</el-link
>
and
<el-link type="info" href="https://element.eleme.io" target="_blank"
>element</el-link
>
<br />
-
<br />
<span v-if="version">v{{ version }}</span>
<el-link v-else type="primary" href="https://restqa.io"
>Try RestQA, The Next in class microservice testing Framework</el-link
>
</el-col>
<el-col :span="4">
<div style="float: right">
<el-switch
v-model="isDark"
:inactive-action-icon="sunny"
:active-action-icon="moon"
@change="getDark($event)"
/>
</div>
</el-col>
</el-row>
</div>
</template>
<script>
import { Moon, Sunny } from '@element-plus/icons-vue'
import { Toggle, Get } from '@/services/utils/dark-mode.js'
import { Moon, Sunny } from "@element-plus/icons-vue";
import { Toggle, Get } from "@/services/utils/dark-mode.js";
export default {
name: "FooterPartial",
data() {
return {
isDark: Get()
}
isDark: Get(),
};
},
methods: {
getDark() {
this.isDark = Toggle()
}
this.isDark = Toggle();
},
},
computed: {
moon() {
return Moon
return Moon;
},
sunny() {
return Sunny
return Sunny;
},
version() {
return this.$store.getters.result.version;
Expand Down
29 changes: 25 additions & 4 deletions packages/report-ui/src/layouts/partials/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
<a href="https://restqa.io" target="_blank">
<img :src="`./images/mascot.png`" />
</a>
</div>

</div>

<el-menu-item
v-for="(item, index) in menu"
Expand Down Expand Up @@ -65,7 +64,19 @@

<script>
import Sponsors from "@/components/restqa/sponsors/RestQASponsors.vue";
import { Odometer, Moon, Basketball, WindPower, Aim, Collection, IceCreamSquare, House, Reading, ChatDotRound, Message} from "@element-plus/icons-vue"
import {
Odometer,
Moon,
Basketball,
WindPower,
Aim,
Collection,
IceCreamSquare,
House,
Reading,
ChatDotRound,
Message,
} from "@element-plus/icons-vue";
const staticMenu = [
{
Expand Down Expand Up @@ -132,7 +143,17 @@ export default {
name: "SidebarPartial",
components: {
Sponsors,
Odometer, Moon, Basketball, WindPower, Aim, Collection, IceCreamSquare, House, Reading, ChatDotRound, Message
Odometer,
Moon,
Basketball,
WindPower,
Aim,
Collection,
IceCreamSquare,
House,
Reading,
ChatDotRound,
Message,
},
data() {
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/report-ui/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import store from "./store/store";
import App from "./App.vue";

import "./assets/scss/element-variables.scss";
import 'element-plus/theme-chalk/dark/css-vars.css'
import "element-plus/theme-chalk/dark/css-vars.css";

import "prismjs";
import "prismjs/components/prism-clike";
Expand Down
50 changes: 25 additions & 25 deletions packages/report-ui/src/services/utils/dark-mode.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import { useDark, useMediaQuery, useToggle } from '@vueuse/core'
import { useDark, useMediaQuery, useToggle } from "@vueuse/core";

const listeners = []
const listeners = [];

const isDark = useDark({
selector: 'html',
attribute: 'class',
valueDark: 'dark',
valueLight: 'light',
})
const toogleDark = useToggle(isDark)
selector: "html",
attribute: "class",
valueDark: "dark",
valueLight: "light",
});
const toogleDark = useToggle(isDark);

let _current = Boolean(isDark.value)
let _current = Boolean(isDark.value);

export function Toggle () {
_current = toogleDark()
const evt = getEvent(_current)
useMediaQuery(`(prefers-color-scheme: ${evt.color})`)
listeners.forEach(fn => {
fn.call(this, evt)
})
return _current
export function Toggle() {
_current = toogleDark();
const evt = getEvent(_current);
useMediaQuery(`(prefers-color-scheme: ${evt.color})`);
listeners.forEach((fn) => {
fn.call(this, evt);
});
return _current;
}

export function Listen(fn) {
listeners.push(fn)
listeners.push(fn);
}

export function Get () {
return _current
export function Get() {
return _current;
}

function getEvent(isDark) {
const color = isDark ? 'dark' : 'light'
const evt = new Event('DarkMode')
evt.isDark = isDark
evt.color = color
return evt
const color = isDark ? "dark" : "light";
const evt = new Event("DarkMode");
evt.isDark = isDark;
evt.color = color;
return evt;
}
12 changes: 6 additions & 6 deletions packages/report-ui/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { viteStaticCopy } from "vite-plugin-static-copy";
import { viteSingleFile } from "vite-plugin-singlefile";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import IconsResolver from 'unplugin-icons/resolver'
import IconsResolver from "unplugin-icons/resolver";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import { visualizer } from "rollup-plugin-visualizer";

Expand All @@ -17,16 +17,16 @@ export default defineConfig({
resolvers: [
ElementPlusResolver(),
IconsResolver({
prefix: 'Icon',
})
]
prefix: "Icon",
}),
],
}),
Components({
resolvers: [
IconsResolver({
enabledCollections: ['ep'],
enabledCollections: ["ep"],
}),
ElementPlusResolver()
ElementPlusResolver(),
],
directoryAsNamespace: true,
}),
Expand Down

0 comments on commit 0b4597c

Please sign in to comment.