Skip to content

Commit

Permalink
feature: Alternative-package column added packages table
Browse files Browse the repository at this point in the history
  • Loading branch information
abugraokkali committed Jan 9, 2024
1 parent ae4b1e1 commit d31fc4b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
3 changes: 2 additions & 1 deletion frontend/src/localization/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@
"name": "Name",
"vendor": "Vendor",
"version": "Version",
"count": "Asset Count"
"count": "Asset Count",
"alternative_package": "Alternative Package"
},
"fetch": {
"messages": {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/localization/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@
"name": "Adı",
"vendor": "Sağlayıcı",
"version": "Versiyon",
"count": "Varlık Sayısı"
"count": "Varlık Sayısı",
"alternative_package": "Alternatif Paket"
},
"fetch": {
"messages": {
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/models/Package.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
export interface IPackage {
name: string
count: number
alternative_package: IAlternativePackage
}

interface IAlternativePackage {
id: string
created_at: string
updated_at: string
deleted_at: string
name: string
url: string
package_name: string
}
25 changes: 25 additions & 0 deletions frontend/src/views/pages/Packages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import AsyncStore from "@/components/Table/AsyncStore.vue"
import Header from "@/components/UIElements/Header.vue"
import type { IColumn } from "@/models/Column"
import fileTypes from "@/utils/data/file_types.json"
import type { IPackage } from "@/models/Package"
import { h } from "vue"
import { NButton, NText } from "naive-ui"
const { t } = useI18n()
const store = usePackageStore()
Expand All @@ -22,6 +25,28 @@ const columns: IColumn[] = reactive([
tooltip: true,
},
},
{
title: t("package.table.alternative_package"),
key: "alternative_package.name",
resizable: true,
ellipsis: {
tooltip: true,
},
render: (row: IPackage) => {
return row.alternative_package
? h(
NButton,
{
text: true,
onClick: () => {
window.open(row.alternative_package.url, "_blank")
},
},
h(NText, { underline: true }, row.alternative_package.name),
)
: "-"
},
},
{
title: t("package.table.count"),
key: "count",
Expand Down

0 comments on commit d31fc4b

Please sign in to comment.