diff --git a/app/src/components/PackageChart.vue b/app/src/components/PackageChart.vue
index 9ebcbc6c..a831d05b 100644
--- a/app/src/components/PackageChart.vue
+++ b/app/src/components/PackageChart.vue
@@ -2,7 +2,7 @@
@@ -11,6 +11,7 @@ import LoadingSpinner from './LoadingSpinner'
import ChartJs from './ChartJs'
import { useFetchPackagesSeries } from '../composables/useFetchPackagesSeries'
import { useConvertDataSeries } from '../composables/useConvertDataSeries'
+import { computed } from 'vue'
const props = defineProps({
packages: {
@@ -31,10 +32,25 @@ const props = defineProps({
limit: {
type: Number,
required: false
+ },
+ filter: {
+ type: String,
+ default: 'All'
}
})
const { data: fetchedData, isFetching, isFinished, error } = useFetchPackagesSeries(props.packages, { startMonth: props.startMonth, endMonth: props.endMonth, limit: props.limit })
const data = useConvertDataSeries(fetchedData, 'packagePopularities')
+
+const chartData = computed(() => {
+ if (props.filter === 'Top 5') {
+ return {
+ ...data.value,
+ datasets: data.value.datasets.slice(0, 5)
+ }
+ }
+ return data.value
+})
+
diff --git a/app/src/composables/useConvertDataSeries.js b/app/src/composables/useConvertDataSeries.js
index fa2b0d75..f8582bb3 100644
--- a/app/src/composables/useConvertDataSeries.js
+++ b/app/src/composables/useConvertDataSeries.js
@@ -32,7 +32,15 @@ const convertToDataSeries = (PopularitiesArray, pupularitiesKey) => {
datasets: []
}
- tempSeries.forEach((series, name) => {
+ // sort packages by current popularity (desc)
+ const sortedTempSeries = Array.from(tempSeries.entries()).sort((a, b) => {
+ const lastLabel = data.labels[data.labels.length - 1]
+ const popA = a[1].get(lastLabel) || 0
+ const popB = b[1].get(lastLabel) || 0
+ return popB - popA
+ })
+
+ sortedTempSeries.forEach(([name, series]) => {
data.datasets.push({
label: name,
data: (() => {
diff --git a/app/src/views/FunDetail.vue b/app/src/views/FunDetail.vue
index a9865812..0cc50b9d 100644
--- a/app/src/views/FunDetail.vue
+++ b/app/src/views/FunDetail.vue
@@ -10,7 +10,23 @@
-
+
+
+
+
@@ -21,9 +37,12 @@ import FunConfig from '../config/fun.json'
import PackageChart from '../components/PackageChart.vue'
import { ref, watch } from 'vue'
import { useRouteParams } from '@vueuse/router'
+import { useRoute } from 'vue-router'
const category = useRouteParams('category')
const preset = useRouteParams('preset')
+const route = useRoute()
+const filter = ref('All')
const pkgs = FunConfig[category.value]
diff --git a/justfile b/justfile
index 4f66f075..6fa10c4e 100644
--- a/justfile
+++ b/justfile
@@ -95,10 +95,11 @@ console *args:
phpunit *args:
{{PHP-RUN}} php -dmemory_limit=-1 vendor/bin/phpunit {{args}}
-# run phpstan inside a php containre
+# run phpstan inside a php container
phpstan *args:
{{PHP-RUN}} php -dmemory_limit=-1 vendor/bin/phpstan {{args}}
+# run rector inside the php container
rector *args:
{{PHP-RUN}} php -dmemory_limit=-1 vendor/bin/rector {{args}}
@@ -106,11 +107,11 @@ rector *args:
node *args='-h':
{{NODE-RUN}} node {{args}}
-# run pnpm inside a php containre
+# run pnpm inside a php container
pnpm *args='-h':
{{NODE-RUN}} pnpm {{args}}
-# run jest inside a node containre
+# run jest inside a node container
jest *args:
{{NODE-RUN}} node_modules/.bin/jest --passWithNoTests {{args}}
@@ -194,6 +195,7 @@ update:
{{PHP-RUN}} composer --no-interaction update --lock --no-scripts
{{NODE-RUN}} pnpm update --latest
+# runs on server after deploy; install deps, build assets, run migrations
deploy:
cd app && pnpm install --frozen-lockfile --prod
cd app && NODE_OPTIONS=--no-experimental-webstorage pnpm run build
@@ -205,6 +207,7 @@ deploy:
cd api && bin/console doctrine:migrations:sync-metadata-storage --no-interaction
cd api && bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration
+# runs on server after deploy; sets correct permissions
deploy-permissions:
cd api && sudo setfacl -dR -m u:php-pkgstats:rwX -m u:deployer:rwX var
cd api && sudo setfacl -R -m u:php-pkgstats:rwX -m u:deployer:rwX var