1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-16 15:19:06 +00:00

Fix media url and thumbnail center (#6809)

* 01 change generate thumbnail

* fix mediaUrl

* fix mediaUrl
This commit is contained in:
Michael An
2024-09-20 16:05:24 +08:00
committed by GitHub
parent e62d59fc55
commit da6de8ca8f
3 changed files with 28 additions and 19 deletions

View File

@@ -14,8 +14,20 @@ export const VIEW_TYPE_ICON = {
};
export const VIEW_TYPE_DEFAULT_BASIC_FILTER = {
[VIEW_TYPE.TABLE]: [{ column_key: PRIVATE_COLUMN_KEY.IS_DIR, filter_predicate: FILTER_PREDICATE_TYPE.IS, filter_term: 'file' }],
[VIEW_TYPE.GALLERY]: [{ column_key: PRIVATE_COLUMN_KEY.FILE_TYPE, filter_predicate: FILTER_PREDICATE_TYPE.IS, filter_term: 'picture' }],
[VIEW_TYPE.TABLE]: [
{
column_key: PRIVATE_COLUMN_KEY.IS_DIR,
filter_predicate: FILTER_PREDICATE_TYPE.IS,
filter_term: 'file'
}
],
[VIEW_TYPE.GALLERY]: [
{
column_key: PRIVATE_COLUMN_KEY.FILE_TYPE,
filter_predicate: FILTER_PREDICATE_TYPE.IS,
filter_term: 'picture'
}
],
};
export const VIEW_TYPE_DEFAULT_SORTS = {

View File

@@ -6,10 +6,10 @@ import toaster from '../../components/toast';
import Icon from '../../components/icon';
import ViewItem from './view-item';
import { AddView } from '../components/popover/view-popover';
import { gettext } from '../../utils/constants';
import { gettext, mediaUrl } from '../../utils/constants';
import { useMetadata } from '../hooks';
import { PRIVATE_FILE_TYPE } from '../../constants';
import { VIEW_TYPE_ICON } from '../constants';
import { VIEW_TYPE, VIEW_TYPE_ICON } from '../constants';
import { isValidViewName } from '../utils/validate';
import { isEnter } from '../utils/hotkey';
@@ -20,13 +20,13 @@ const updateFavicon = (iconName) => {
if (favicon) {
switch (iconName) {
case 'image':
favicon.href = '/media/favicons/gallery.png';
favicon.href = `${mediaUrl}favicons/gallery.png`;
break;
case 'table':
favicon.href = '/media/favicons/table.png';
case VIEW_TYPE.TABLE:
favicon.href = `${mediaUrl}favicons/table.png`;
break;
default:
favicon.href = '/media/favicons/favicon.png';
favicon.href = `${mediaUrl}favicons/favicon.png`;
}
}
};
@@ -68,7 +68,7 @@ const MetadataTreeView = ({ userPerm, currentPath }) => {
if (lastOpenedView) {
selectView(lastOpenedView);
document.title = `${lastOpenedView.name} - Seafile`;
updateFavicon(VIEW_TYPE_ICON[lastOpenedView.type] || 'table');
updateFavicon(VIEW_TYPE_ICON[lastOpenedView.type] || VIEW_TYPE.TABLE);
return;
}
const url = `${origin}${pathname}`;
@@ -80,7 +80,7 @@ const MetadataTreeView = ({ userPerm, currentPath }) => {
if (showFirstView && firstView) {
selectView(firstView);
document.title = `${firstView.name} - Seafile`;
updateFavicon(VIEW_TYPE_ICON[firstView.type] || 'table');
updateFavicon(VIEW_TYPE_ICON[firstView.type] || VIEW_TYPE.TABLE);
} else {
document.title = originalTitle;
updateFavicon('default');
@@ -93,7 +93,7 @@ const MetadataTreeView = ({ userPerm, currentPath }) => {
const currentView = viewsMap[currentViewId];
if (currentView) {
document.title = `${currentView.name} - Seafile`;
updateFavicon(VIEW_TYPE_ICON[currentView.type] || 'table');
updateFavicon(VIEW_TYPE_ICON[currentView.type] || VIEW_TYPE.TABLE);
} else {
document.title = originalTitle;
updateFavicon('default');
@@ -176,7 +176,7 @@ const MetadataTreeView = ({ userPerm, currentPath }) => {
{showInput && (
<div className="tree-view-inner sf-metadata-view-form">
<div className="left-icon">
<Icon symbol={VIEW_TYPE_ICON[newView.type] || 'table'} className="metadata-views-icon" />
<Icon symbol={VIEW_TYPE_ICON[newView.type] || VIEW_TYPE.TABLE} className="metadata-views-icon" />
</div>
<Input
className="sf-metadata-view-input"

View File

@@ -5,12 +5,12 @@ class ThumbnailCenter {
constructor() {
this.waitingQuery = [];
this.isStartQuery = false;
this.queryStart = false;
}
createThumbnail = ({ repoID, path, callback }) => {
this.waitingQuery.push({ repoID, path, callback });
if (!this.isStartQuery) {
if (!this.queryStart) {
this.startQuery();
}
};
@@ -20,17 +20,14 @@ class ThumbnailCenter {
if (index > -1) {
this.waitingQuery.splice(index, 1);
}
if (this.waitingQuery.length === 0) {
this.isStartQuery = false;
}
};
startQuery = () => {
if (this.waitingQuery.length === 0) {
this.isStartQuery = false;
this.queryStart = false;
return;
}
this.isStartQuery = true;
this.queryStart = true;
let { repoID, path, callback } = this.waitingQuery[0];
seafileAPI.createThumbnail(repoID, path, thumbnailDefaultSize).then((res) => {
callback && callback(res.data.encoded_thumbnail_src);