diff --git a/controllers/resource.go b/controllers/resource.go index 72c50016..c9c1dfb2 100644 --- a/controllers/resource.go +++ b/controllers/resource.go @@ -114,6 +114,7 @@ func (c *ApiController) DeleteResource() { func (c *ApiController) UploadResource() { owner := c.Input().Get("owner") + application := c.Input().Get("application") tag := c.Input().Get("tag") parent := c.Input().Get("parent") fullFilePath := c.Input().Get("fullFilePath") @@ -158,6 +159,7 @@ func (c *ApiController) UploadResource() { Name: objectKey, CreatedTime: util.GetCurrentTime(), Provider: provider.Name, + Application: application, Tag: tag, Parent: parent, FileName: filename, diff --git a/object/resource.go b/object/resource.go index ed498d0f..295a86bc 100644 --- a/object/resource.go +++ b/object/resource.go @@ -26,14 +26,15 @@ type Resource struct { Name string `xorm:"varchar(100) notnull pk" json:"name"` CreatedTime string `xorm:"varchar(100)" json:"createdTime"` - Provider string `xorm:"varchar(100)" json:"provider"` - Tag string `xorm:"varchar(100)" json:"tag"` - Parent string `xorm:"varchar(100)" json:"parent"` - FileName string `xorm:"varchar(100)" json:"fileName"` - FileType string `xorm:"varchar(100)" json:"fileType"` - FileFormat string `xorm:"varchar(100)" json:"fileFormat"` - FileSize int `json:"fileSize"` - Url string `xorm:"varchar(100)" json:"url"` + Provider string `xorm:"varchar(100)" json:"provider"` + Application string `xorm:"varchar(100)" json:"application"` + Tag string `xorm:"varchar(100)" json:"tag"` + Parent string `xorm:"varchar(100)" json:"parent"` + FileName string `xorm:"varchar(100)" json:"fileName"` + FileType string `xorm:"varchar(100)" json:"fileType"` + FileFormat string `xorm:"varchar(100)" json:"fileFormat"` + FileSize int `json:"fileSize"` + Url string `xorm:"varchar(100)" json:"url"` } func GetResources(owner string) []*Resource { diff --git a/web/src/ResourceListPage.js b/web/src/ResourceListPage.js index a9b27c37..eed769a5 100644 --- a/web/src/ResourceListPage.js +++ b/web/src/ResourceListPage.js @@ -128,6 +128,20 @@ class ResourceListPage extends React.Component { width: '80px', sorter: (a, b) => a.tag.localeCompare(b.tag), }, + { + title: i18next.t("resource:Application"), + dataIndex: 'application', + key: 'application', + width: '80px', + sorter: (a, b) => a.application.localeCompare(b.application), + render: (text, record, index) => { + return ( + + {text} + + ) + } + }, { title: i18next.t("resource:Parent"), dataIndex: 'parent', diff --git a/web/src/backend/ResourceBackend.js b/web/src/backend/ResourceBackend.js index 3da737ea..9756360f 100644 --- a/web/src/backend/ResourceBackend.js +++ b/web/src/backend/ResourceBackend.js @@ -56,9 +56,10 @@ export function deleteResource(resource, provider="") { } export function uploadResource(owner, tag, parent, fullFilePath, file, provider="") { + const application = "app-built-in"; let formData = new FormData(); formData.append("file", file); - return fetch(`${Setting.ServerUrl}/api/upload-resource?owner=${owner}&tag=${tag}&parent=${parent}&fullFilePath=${encodeURIComponent(fullFilePath)}&provider=${provider}`, { + return fetch(`${Setting.ServerUrl}/api/upload-resource?owner=${owner}&application=${application}&tag=${tag}&parent=${parent}&fullFilePath=${encodeURIComponent(fullFilePath)}&provider=${provider}`, { body: formData, method: 'POST', credentials: 'include',