mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
Improve resource list page.
This commit is contained in:
parent
a1b16f88d1
commit
f4a59de3a5
@ -99,7 +99,7 @@ class ApplicationEditPage extends React.Component {
|
|||||||
}
|
}
|
||||||
this.setState({uploading: true});
|
this.setState({uploading: true});
|
||||||
const fullFilePath = `termsOfUse/${this.state.application.owner}/${this.state.application.name}.html`;
|
const fullFilePath = `termsOfUse/${this.state.application.owner}/${this.state.application.name}.html`;
|
||||||
ResourceBackend.uploadResource(this.props.account.owner, this.props.account.name, "termsOfUse", this.state.application.name, fullFilePath, info.file)
|
ResourceBackend.uploadResource(this.props.account.owner, this.props.account.name, "termsOfUse", "ApplicationEditPage", fullFilePath, info.file)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
Setting.showMessage("success", i18next.t("application:File uploaded successfully"));
|
Setting.showMessage("success", i18next.t("application:File uploaded successfully"));
|
||||||
|
@ -58,7 +58,7 @@ export const CropperDiv = (props) => {
|
|||||||
// Setting.showMessage("success", "uploading...");
|
// Setting.showMessage("success", "uploading...");
|
||||||
const extension = image.substring(image.indexOf('/') + 1, image.indexOf(';base64'));
|
const extension = image.substring(image.indexOf('/') + 1, image.indexOf(';base64'));
|
||||||
const fullFilePath = `avatar/${user.owner}/${user.name}.${extension}`;
|
const fullFilePath = `avatar/${user.owner}/${user.name}.${extension}`;
|
||||||
ResourceBackend.uploadResource(user.owner, user.name, "avatar", account.name, fullFilePath, blob)
|
ResourceBackend.uploadResource(user.owner, user.name, "avatar", "CropperDiv", fullFilePath, blob)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
window.location.href = "/account";
|
window.location.href = "/account";
|
||||||
|
@ -63,7 +63,7 @@ class ResourceListPage extends React.Component {
|
|||||||
this.setState({uploading: true});
|
this.setState({uploading: true});
|
||||||
const filename = info.fileList[0].name;
|
const filename = info.fileList[0].name;
|
||||||
const fullFilePath = `resource/${this.props.account.owner}/${this.props.account.name}/${filename}`;
|
const fullFilePath = `resource/${this.props.account.owner}/${this.props.account.name}/${filename}`;
|
||||||
ResourceBackend.uploadResource(this.props.account.owner, this.props.account.name, "custom", this.props.account.name, fullFilePath, info.file)
|
ResourceBackend.uploadResource(this.props.account.owner, this.props.account.name, "custom", "ResourceListPage", fullFilePath, info.file)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
Setting.showMessage("success", i18next.t("application:File uploaded successfully"));
|
Setting.showMessage("success", i18next.t("application:File uploaded successfully"));
|
||||||
@ -105,28 +105,18 @@ class ResourceListPage extends React.Component {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("general:Name"),
|
title: i18next.t("resource:Application"),
|
||||||
dataIndex: 'name',
|
dataIndex: 'application',
|
||||||
key: 'name',
|
key: 'application',
|
||||||
width: '150px',
|
|
||||||
sorter: (a, b) => a.name.localeCompare(b.name),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: i18next.t("general:Created time"),
|
|
||||||
dataIndex: 'createdTime',
|
|
||||||
key: 'createdTime',
|
|
||||||
width: '160px',
|
|
||||||
sorter: (a, b) => a.createdTime.localeCompare(b.createdTime),
|
|
||||||
render: (text, record, index) => {
|
|
||||||
return Setting.getFormattedDate(text);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: i18next.t("resource:Tag"),
|
|
||||||
dataIndex: 'tag',
|
|
||||||
key: 'tag',
|
|
||||||
width: '80px',
|
width: '80px',
|
||||||
sorter: (a, b) => a.tag.localeCompare(b.tag),
|
sorter: (a, b) => a.application.localeCompare(b.application),
|
||||||
|
render: (text, record, index) => {
|
||||||
|
return (
|
||||||
|
<Link to={`/applications/${text}`}>
|
||||||
|
{text}
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("resource:User"),
|
title: i18next.t("resource:User"),
|
||||||
@ -142,20 +132,6 @@ class ResourceListPage extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
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',
|
||||||
@ -163,6 +139,30 @@ class ResourceListPage extends React.Component {
|
|||||||
width: '80px',
|
width: '80px',
|
||||||
sorter: (a, b) => a.parent.localeCompare(b.parent),
|
sorter: (a, b) => a.parent.localeCompare(b.parent),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: i18next.t("general:Name"),
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
width: '150px',
|
||||||
|
sorter: (a, b) => a.name.localeCompare(b.name),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: i18next.t("general:Created time"),
|
||||||
|
dataIndex: 'createdTime',
|
||||||
|
key: 'createdTime',
|
||||||
|
width: '150px',
|
||||||
|
sorter: (a, b) => a.createdTime.localeCompare(b.createdTime),
|
||||||
|
render: (text, record, index) => {
|
||||||
|
return Setting.getFormattedDate(text);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: i18next.t("resource:Tag"),
|
||||||
|
dataIndex: 'tag',
|
||||||
|
key: 'tag',
|
||||||
|
width: '80px',
|
||||||
|
sorter: (a, b) => a.tag.localeCompare(b.tag),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("resource:File name"),
|
title: i18next.t("resource:File name"),
|
||||||
dataIndex: 'fileName',
|
dataIndex: 'fileName',
|
||||||
@ -171,24 +171,24 @@ class ResourceListPage extends React.Component {
|
|||||||
sorter: (a, b) => a.fileName.localeCompare(b.fileName),
|
sorter: (a, b) => a.fileName.localeCompare(b.fileName),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("resource:File type"),
|
title: i18next.t("resource:Type"),
|
||||||
dataIndex: 'fileType',
|
dataIndex: 'fileType',
|
||||||
key: 'fileType',
|
key: 'fileType',
|
||||||
width: '120px',
|
width: '80px',
|
||||||
sorter: (a, b) => a.fileType.localeCompare(b.fileType),
|
sorter: (a, b) => a.fileType.localeCompare(b.fileType),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("resource:File format"),
|
title: i18next.t("resource:Format"),
|
||||||
dataIndex: 'fileFormat',
|
dataIndex: 'fileFormat',
|
||||||
key: 'fileFormat',
|
key: 'fileFormat',
|
||||||
width: '130px',
|
width: '80px',
|
||||||
sorter: (a, b) => a.fileFormat.localeCompare(b.fileFormat),
|
sorter: (a, b) => a.fileFormat.localeCompare(b.fileFormat),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("resource:File size"),
|
title: i18next.t("resource:File size"),
|
||||||
dataIndex: 'fileSize',
|
dataIndex: 'fileSize',
|
||||||
key: 'fileSize',
|
key: 'fileSize',
|
||||||
width: '120px',
|
width: '100px',
|
||||||
sorter: (a, b) => a.fileSize - b.fileSize,
|
sorter: (a, b) => a.fileSize - b.fileSize,
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return Setting.getFriendlyFileSize(text);
|
return Setting.getFriendlyFileSize(text);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user