WebFileServer
Changes
FileServer/SPA/src/JS/Tools/Configuration.js 33(+31 -2)
FileServer/SPA/src/JS/Tools/Notification.js 23(+22 -1)
FileServer/Web/Config.xml 2(+1 -1)
Details
diff --git a/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerControl.jsx b/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerControl.jsx
index f722e84..aa4cf26 100644
--- a/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerControl.jsx
+++ b/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerControl.jsx
@@ -116,7 +116,7 @@ export default class FileExplorerControl extends BaseControl {
.then(
function (data) {
- debugger;
+ //debugger;
currentDirectory.CanChangeDirectoryItems
= data.CanWrite;
diff --git a/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerRow.jsx b/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerRow.jsx
index 7d46664..63eeb55 100644
--- a/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerRow.jsx
+++ b/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerRow.jsx
@@ -66,16 +66,13 @@ export default class FileExplorerRow extends BaseControl {
OnPreviewClick(sender) {
let id = sender.target.attributes[0].value;
let extension = sender.target.attributes[1].value;
- let url =
- Configuration.OpenRegisteredExtension
+ // Service это функция открытия определенного расширения по указанной ссылке
+ let Service =
+ Configuration
+ .OpenRegisteredExtension
.find(item => item.Ext.includes(extension))
- .Service
- + window.location.origin
- + '/'
- + FileExplorerServices.staticURL_Download
- + id;
+ .Service;
- //window.open(url, '_blank');
this
.fileExplorerServices
.CreateTmpLink(id)
@@ -84,26 +81,13 @@ export default class FileExplorerRow extends BaseControl {
if (!data.Successe)
{
- //Popup error
- Notification.MesEr(data.ResMessage, 'Ошибка генерация одноразовой ссылки');
+ Notification.MesEr_Hide(data.ResMessage, 'Ошибка генерация одноразовой ссылки');
return;
}
-
- //console.log(data);
- //console.log(data.Key);
-
- //let u = 'https://view.officeapps.live.com/op/view.aspx?src=' + window.location.origin + '/api/Explorer/GetFileOneLink/' + data.Key;
- let u = 'http://docs.google.com/viewer?url=' + window.location.origin + '/api/Explorer/GetFileOneLink/' + data.Key;
-
- console.log(u);
- debugger;
-
- window.open(
- u,
- '_blank'
- );
+
+ Service(window.location.origin + '/api/Explorer/GetFileOneLink/' + data.Key);
}
- .bind(this)
+ .bind(this)
);
}
@@ -142,9 +126,9 @@ export default class FileExplorerRow extends BaseControl {
(Configuration.RegisteredExtension.includes(elem.FileExtension))
?
<td>
- <div Style="position: relative;">
- <p Style="float: left;margin-bottom: 0;margin-top: .5rem;">{elem.Name}</p>
- <Button onClick={this.OnPreviewClick} variant="light" Style="padding: .375rem; float: right;">
+ <div style={{ position: 'relative'}}>
+ <p style={{ float: 'left', marginBottom: 0, marginTop: '.5rem' }}>{elem.Name}</p>
+ <Button elemid={elem.ID} elemext={elem.FileExtension} onClick={this.OnPreviewClick} variant="light" style={{ padding: '.375rem', float: 'right' }}>
<img elemid={elem.ID} elemext={elem.FileExtension} src={ImageFileFind} width="24" height="24" />
</Button>
</div>
diff --git a/FileServer/SPA/src/JS/React/Controls/FileExplorer/UploaderControl.jsx b/FileServer/SPA/src/JS/React/Controls/FileExplorer/UploaderControl.jsx
index 1d81606..a8c5608 100644
--- a/FileServer/SPA/src/JS/React/Controls/FileExplorer/UploaderControl.jsx
+++ b/FileServer/SPA/src/JS/React/Controls/FileExplorer/UploaderControl.jsx
@@ -45,7 +45,7 @@ export default class UploaderControl extends BaseControl {
}
);
- debugger;
+ //debugger;
}
@@ -72,7 +72,7 @@ export default class UploaderControl extends BaseControl {
this.GlobalState.MainExplorer.ID
).then(
function () {
- Notification.MesOk('Complete', 'Upload');
+ Notification.MesOk_NoHide('Complete', 'Upload');
input.value = "";
this.setState({
diff --git a/FileServer/SPA/src/JS/React/Controls/User/UserControl.jsx b/FileServer/SPA/src/JS/React/Controls/User/UserControl.jsx
index 3a72cdc..4668eb2 100644
--- a/FileServer/SPA/src/JS/React/Controls/User/UserControl.jsx
+++ b/FileServer/SPA/src/JS/React/Controls/User/UserControl.jsx
@@ -72,7 +72,7 @@ export default class UserControl extends BaseControl {
else {
this.GlobalState.User = this.UserInfo(null);
- Notification.MesEr(data.ResMessage, "Auth");
+ Notification.MesEr_Hide(data.ResMessage, "Auth");
}
this.setState({
diff --git a/FileServer/SPA/src/JS/React/Pages/FileExplorerPage.jsx b/FileServer/SPA/src/JS/React/Pages/FileExplorerPage.jsx
index 7d97649..503e555 100644
--- a/FileServer/SPA/src/JS/React/Pages/FileExplorerPage.jsx
+++ b/FileServer/SPA/src/JS/React/Pages/FileExplorerPage.jsx
@@ -16,7 +16,7 @@ export default class FileExplorerPage extends BaseControl {
super(props, "FileExplorerPage");
let a = Configuration.EnviromentValue;
- debugger;
+ //debugger;
let DirectoryID = -1;
//Получить ID из url
FileServer/SPA/src/JS/Tools/Configuration.js 33(+31 -2)
diff --git a/FileServer/SPA/src/JS/Tools/Configuration.js b/FileServer/SPA/src/JS/Tools/Configuration.js
index 5e99a59..0e993be 100644
--- a/FileServer/SPA/src/JS/Tools/Configuration.js
+++ b/FileServer/SPA/src/JS/Tools/Configuration.js
@@ -4,11 +4,40 @@
export default class Configuration {
static RooDirectoryID = -1;
static upload_chunk_size = 1048576;
- static RegisteredExtension = ['.doc', '.docx', '.xls', '.xlsx', '.txt', '.pdf', '.jpg', '.png', '.jpeg', '.bmp', '.gif'];
static OpenRegisteredExtension =
[
- { Ext: ['.txt', '.doc', '.docx', '.xls', '.xlsx'], Service: 'https://view.officeapps.live.com/op/view.aspx?src=' },
+ {
+ Ext: ['.txt', '.doc', '.docx', '.xls', '.xlsx', '.pdf', '.ppt', '.pptx'],
+ Service: function (url)
+ {
+ let u = 'http://docs.google.com/viewer?url=' + url;
+
+ if (Configuration.EnviromentValue == 'Development') {
+ console.log(u);
+ //debugger;
+ }
+
+ window.open(
+ u,
+ '_blank'
+ );
+ }
+ },
+ {
+ Ext: ['.jpg', '.png', '.jpeg', '.bmp', '.gif'],
+ Service: function (url) {
+
+ if (Configuration.EnviromentValue == 'Development') {
+ console.log(url);
+ //debugger;
+ }
+
+ const w = window.open('about:blank', 'new image'); // открываем окно
+ w.document.write("<img src='" + url + "' alt='from old image' />"); // вставляем картинку
+ }
+ },
];
+ static RegisteredExtension = this.OpenRegisteredExtension.flatMap(e => e.Ext);
//Заполнятся при старте запросом из WebApi
static EnviromentValue = "NoSet";
FileServer/SPA/src/JS/Tools/Notification.js 23(+22 -1)
diff --git a/FileServer/SPA/src/JS/Tools/Notification.js b/FileServer/SPA/src/JS/Tools/Notification.js
index 1775486..5a41d0f 100644
--- a/FileServer/SPA/src/JS/Tools/Notification.js
+++ b/FileServer/SPA/src/JS/Tools/Notification.js
@@ -68,7 +68,28 @@ export default class Notification {
title,
{
- //"timeOut": -1,
+ "timeOut": -1,
+ "closeButton": true
+ }
+ );
+ }
+
+ static MesEr_Hide(text, title) {
+ let Data = new Date();
+ let Timestring = "" + Data.getHours() + ":"
+ + Data.getMinutes() + ":"
+ + Data.getSeconds() + " | "
+ + text;
+
+
+ debugger;
+
+ toastr
+ .error(
+ Timestring,
+ title,
+
+ {
"timeOut": 10000,
"progressBar": true,
"closeButton": true
FileServer/Web/Config.xml 2(+1 -1)
diff --git a/FileServer/Web/Config.xml b/FileServer/Web/Config.xml
index 3dad11a..903178d 100644
--- a/FileServer/Web/Config.xml
+++ b/FileServer/Web/Config.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ConfigData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <LastExportDate>2020-12-19T22:38:20.062325+04:00</LastExportDate>
+ <LastExportDate>2020-12-20T15:18:15.4306522+04:00</LastExportDate>
<WriteNewRootDir>true</WriteNewRootDir>
<ClearDBWithStart>true</ClearDBWithStart>
<RootDirs>