Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed Jan 31, 2024
2 parents b9c5578 + e8c6189 commit cc97fb7
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 64 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/halo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ jobs:
run: ./gradlew check
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
- name: Analyze code
if: ${{ github.event_name == 'push' && env.SONAR_TOKEN != '' }} # Due to inability to access secrets during PR, only the code pushed into the branch can be analyzed.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar --info

build:
runs-on: ubuntu-latest
if: always() && (needs.test.result == 'skipped' || needs.test.result == 'success')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private Flux<Contributor> listContributors(List<String> usernames) {
return Flux.empty();
}
return Flux.fromIterable(usernames)
.flatMap(userService::getUserOrGhost)
.concatMap(userService::getUserOrGhost)
.map(user -> {
Contributor contributor = new Contributor();
contributor.setName(user.getMetadata().getName());
Expand Down
13 changes: 13 additions & 0 deletions console/console-src/composables/use-dashboard-stats.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { apiClient } from "@/utils/api-client";
import { useQuery } from "@tanstack/vue-query";

export function useDashboardStats() {
const { data } = useQuery({
queryKey: ["dashboard-stats"],
queryFn: async () => {
const { data } = await apiClient.stats.getStats();
return data;
},
});
return { data };
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script lang="ts" setup>
import type { DashboardStats } from "@halo-dev/api-client";
import { useDashboardStats } from "@console/composables/use-dashboard-stats";
import { VCard, IconMessage } from "@halo-dev/components";
import { inject, type Ref } from "vue";
const dashboardStats = inject<Ref<DashboardStats>>("dashboardStats");
const { data: stats } = useDashboardStats();
</script>
<template>
<VCard class="h-full" :body-class="['h-full']">
Expand All @@ -20,7 +19,7 @@ const dashboardStats = inject<Ref<DashboardStats>>("dashboardStats");
{{ $t("core.dashboard.widgets.presets.comment_stats.title") }}
</span>
<p class="text-2xl font-medium text-gray-900">
{{ dashboardStats?.approvedComments }}
{{ stats?.approvedComments }}
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
<script lang="ts" setup>
import { VCard, IconPages } from "@halo-dev/components";
import { onMounted, ref } from "vue";
import { apiClient } from "@/utils/api-client";
import { singlePageLabels } from "@/constants/labels";
import { useQuery } from "@tanstack/vue-query";
const singlePageTotal = ref<number>(0);
const handleFetchSinglePages = async () => {
const { data } = await apiClient.singlePage.listSinglePages({
labelSelector: [
`${singlePageLabels.DELETED}=false`,
`${singlePageLabels.PUBLISHED}=true`,
],
page: 0,
size: 0,
});
singlePageTotal.value = data.total;
};
onMounted(handleFetchSinglePages);
const { data: total } = useQuery({
queryKey: ["widget-singlePage-count"],
queryFn: async () => {
const { data } = await apiClient.singlePage.listSinglePages({
labelSelector: [
`${singlePageLabels.DELETED}=false`,
`${singlePageLabels.PUBLISHED}=true`,
],
page: 0,
size: 0,
});
return data.total;
},
});
</script>
<template>
<VCard class="h-full" :body-class="['h-full']">
Expand All @@ -35,7 +34,7 @@ onMounted(handleFetchSinglePages);
{{ $t("core.dashboard.widgets.presets.page_stats.title") }}
</span>
<p class="text-2xl font-medium text-gray-900">
{{ singlePageTotal || 0 }}
{{ total || 0 }}
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script lang="ts" setup>
import { VCard, IconBookRead } from "@halo-dev/components";
import { inject, type Ref } from "vue";
import type { DashboardStats } from "@halo-dev/api-client";
import { useDashboardStats } from "@console/composables/use-dashboard-stats";
const dashboardStats = inject<Ref<DashboardStats>>("dashboardStats");
const { data: stats } = useDashboardStats();
</script>
<template>
<VCard class="h-full" :body-class="['h-full']">
Expand All @@ -20,7 +19,7 @@ const dashboardStats = inject<Ref<DashboardStats>>("dashboardStats");
{{ $t("core.dashboard.widgets.presets.post_stats.title") }}
</span>
<p class="text-2xl font-medium text-gray-900">
{{ dashboardStats?.posts || 0 }}
{{ stats?.posts || 0 }}
</p>
</div>
</div>
Expand Down
26 changes: 3 additions & 23 deletions console/console-src/modules/dashboard/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@
</div>

<VModal
v-model:visible="widgetsModal"
v-if="widgetsModal"
height="calc(100vh - 20px)"
:width="1280"
:layer-closable="true"
:title="$t('core.dashboard.widgets.modal_title')"
@close="widgetsModal = false"
>
<VTabbar
v-model:active-id="activeId"
Expand Down Expand Up @@ -121,11 +122,9 @@ import {
VSpace,
VTabbar,
} from "@halo-dev/components";
import { onMounted, provide, ref, type Ref } from "vue";
import { ref } from "vue";
import { useStorage } from "@vueuse/core";
import { cloneDeep } from "lodash-es";
import { apiClient } from "@/utils/api-client";
import type { DashboardStats } from "@halo-dev/api-client";
import { useI18n } from "vue-i18n";
import { usePermission } from "@/utils/permission";
Expand Down Expand Up @@ -271,25 +270,6 @@ function handleRemove(item: any) {
};
});
}
// Dashboard basic stats
const dashboardStats = ref<DashboardStats>({
posts: 0,
comments: 0,
approvedComments: 0,
users: 0,
visits: 0,
});
provide<Ref<DashboardStats>>("dashboardStats", dashboardStats);
const handleFetchStats = async () => {
const { data } = await apiClient.stats.getStats();
dashboardStats.value = data;
};
onMounted(handleFetchStats);
</script>

<style>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script lang="ts" setup>
import type { DashboardStats } from "@halo-dev/api-client";
import { useDashboardStats } from "@console/composables/use-dashboard-stats";
import { VCard, IconEye } from "@halo-dev/components";
import { inject, type Ref } from "vue";
const dashboardStats = inject<Ref<DashboardStats>>("dashboardStats");
const { data: stats } = useDashboardStats();
</script>
<template>
<VCard class="h-full" :body-class="['h-full']">
Expand All @@ -20,7 +19,7 @@ const dashboardStats = inject<Ref<DashboardStats>>("dashboardStats");
{{ $t("core.dashboard.widgets.presets.views_stats.title") }}
</span>
<p class="text-2xl font-medium text-gray-900">
{{ dashboardStats?.visits || 0 }}
{{ stats?.visits || 0 }}
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script lang="ts" setup>
import { VCard, IconUserSettings } from "@halo-dev/components";
import { inject, type Ref } from "vue";
import type { DashboardStats } from "@halo-dev/api-client";
import { useDashboardStats } from "@console/composables/use-dashboard-stats";
const dashboardStats = inject<Ref<DashboardStats>>("dashboardStats");
const { data: stats } = useDashboardStats();
</script>
<template>
<VCard class="h-full" :body-class="['h-full']">
Expand All @@ -20,7 +19,7 @@ const dashboardStats = inject<Ref<DashboardStats>>("dashboardStats");
{{ $t("core.dashboard.widgets.presets.user_stats.title") }}
</span>
<p class="text-2xl font-medium text-gray-900">
{{ dashboardStats?.users }}
{{ stats?.users }}
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion console/packages/editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@halo-dev/richtext-editor",
"version": "0.0.0-alpha.33",
"version": "2.12.0",
"description": "Default editor for Halo",
"homepage": "https://github.com/halo-dev/halo/tree/main/console/packages/editor#readme",
"bugs": {
Expand Down

0 comments on commit cc97fb7

Please sign in to comment.