mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +08:00
Add application to Resource.
This commit is contained in:
@ -114,6 +114,7 @@ func (c *ApiController) DeleteResource() {
|
|||||||
|
|
||||||
func (c *ApiController) UploadResource() {
|
func (c *ApiController) UploadResource() {
|
||||||
owner := c.Input().Get("owner")
|
owner := c.Input().Get("owner")
|
||||||
|
application := c.Input().Get("application")
|
||||||
tag := c.Input().Get("tag")
|
tag := c.Input().Get("tag")
|
||||||
parent := c.Input().Get("parent")
|
parent := c.Input().Get("parent")
|
||||||
fullFilePath := c.Input().Get("fullFilePath")
|
fullFilePath := c.Input().Get("fullFilePath")
|
||||||
@ -158,6 +159,7 @@ func (c *ApiController) UploadResource() {
|
|||||||
Name: objectKey,
|
Name: objectKey,
|
||||||
CreatedTime: util.GetCurrentTime(),
|
CreatedTime: util.GetCurrentTime(),
|
||||||
Provider: provider.Name,
|
Provider: provider.Name,
|
||||||
|
Application: application,
|
||||||
Tag: tag,
|
Tag: tag,
|
||||||
Parent: parent,
|
Parent: parent,
|
||||||
FileName: filename,
|
FileName: filename,
|
||||||
|
@ -26,14 +26,15 @@ type Resource struct {
|
|||||||
Name string `xorm:"varchar(100) notnull pk" json:"name"`
|
Name string `xorm:"varchar(100) notnull pk" json:"name"`
|
||||||
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
|
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
|
||||||
|
|
||||||
Provider string `xorm:"varchar(100)" json:"provider"`
|
Provider string `xorm:"varchar(100)" json:"provider"`
|
||||||
Tag string `xorm:"varchar(100)" json:"tag"`
|
Application string `xorm:"varchar(100)" json:"application"`
|
||||||
Parent string `xorm:"varchar(100)" json:"parent"`
|
Tag string `xorm:"varchar(100)" json:"tag"`
|
||||||
FileName string `xorm:"varchar(100)" json:"fileName"`
|
Parent string `xorm:"varchar(100)" json:"parent"`
|
||||||
FileType string `xorm:"varchar(100)" json:"fileType"`
|
FileName string `xorm:"varchar(100)" json:"fileName"`
|
||||||
FileFormat string `xorm:"varchar(100)" json:"fileFormat"`
|
FileType string `xorm:"varchar(100)" json:"fileType"`
|
||||||
FileSize int `json:"fileSize"`
|
FileFormat string `xorm:"varchar(100)" json:"fileFormat"`
|
||||||
Url string `xorm:"varchar(100)" json:"url"`
|
FileSize int `json:"fileSize"`
|
||||||
|
Url string `xorm:"varchar(100)" json:"url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetResources(owner string) []*Resource {
|
func GetResources(owner string) []*Resource {
|
||||||
|
@ -128,6 +128,20 @@ class ResourceListPage extends React.Component {
|
|||||||
width: '80px',
|
width: '80px',
|
||||||
sorter: (a, b) => a.tag.localeCompare(b.tag),
|
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 (
|
||||||
|
<Link to={`/applications/${text}`}>
|
||||||
|
{text}
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("resource:Parent"),
|
title: i18next.t("resource:Parent"),
|
||||||
dataIndex: 'parent',
|
dataIndex: 'parent',
|
||||||
|
@ -56,9 +56,10 @@ export function deleteResource(resource, provider="") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function uploadResource(owner, tag, parent, fullFilePath, file, provider="") {
|
export function uploadResource(owner, tag, parent, fullFilePath, file, provider="") {
|
||||||
|
const application = "app-built-in";
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
formData.append("file", file);
|
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,
|
body: formData,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
|
Reference in New Issue
Block a user