WebFileServer
Changes
FileServer/SPA/SPA.njsproj 1(+1 -0)
FileServer/SPA/SPA.njsproj.user 2(+1 -1)
FileServer/Web/Config.xml 2(+1 -1)
FileServer/Web/Web.csproj.user 2(+1 -1)
Details
FileServer/SPA/SPA.njsproj 1(+1 -0)
diff --git a/FileServer/SPA/SPA.njsproj b/FileServer/SPA/SPA.njsproj
index 73e7bec..ed010ca 100644
--- a/FileServer/SPA/SPA.njsproj
+++ b/FileServer/SPA/SPA.njsproj
@@ -81,6 +81,7 @@
<Content Include="index.html" />
<Content Include="package.json" />
<Content Include="src\CSS\TestStyle.css" />
+ <Content Include="src\Images\file-find.png" />
<Content Include="src\Images\Folder.png" />
<Content Include="src\Images\Scan.png" />
<Content Include="src\Images\Update.png" />
FileServer/SPA/SPA.njsproj.user 2(+1 -1)
diff --git a/FileServer/SPA/SPA.njsproj.user b/FileServer/SPA/SPA.njsproj.user
index 4e7bcf0..a993f99 100644
--- a/FileServer/SPA/SPA.njsproj.user
+++ b/FileServer/SPA/SPA.njsproj.user
@@ -2,6 +2,6 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
- <LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
+ <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
</PropertyGroup>
</Project>
\ No newline at end of file
diff --git a/FileServer/SPA/src/Images/file-find.png b/FileServer/SPA/src/Images/file-find.png
new file mode 100644
index 0000000..4018fd6
Binary files /dev/null and b/FileServer/SPA/src/Images/file-find.png differ
diff --git a/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerControl.jsx b/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerControl.jsx
index 20827ae..f722e84 100644
--- a/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerControl.jsx
+++ b/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerControl.jsx
@@ -74,12 +74,19 @@ export default class FileExplorerControl extends BaseControl {
OnSortClick(sender) {
let SortProperty = sender.target.attributes[0].value;
+ this.SortData(SortProperty, null);
+ }
+
+ SortData(SortProperty, DecAsc) {
if (this.SortColumnProperty != SortProperty) {
this.SortDecAsc = 1;
this.SortColumnProperty = SortProperty;
}
else
this.SortDecAsc = -this.SortDecAsc;
+
+ if (DecAsc == 1 || DecAsc == -1)
+ this.SortDecAsc = DecAsc;
let data = this.state.data;
//debugger;
@@ -124,6 +131,8 @@ export default class FileExplorerControl extends BaseControl {
)
});
+ this.SortData("Type", 1);
+
this
.EventRegister
.EventAction(
@@ -232,27 +241,32 @@ export default class FileExplorerControl extends BaseControl {
<Table striped bordered hover variant="dark">
<thead>
<tr>
- <th>
- <Button property="ID" onClick={this.OnSortClick} variant="outline-light">ID</Button>
- </th>
+ {
+ (Configuration.EnviromentValue == 'Development')
+ ?
+ <th>
+ <Button property="ID" onClick={this.OnSortClick} variant="outline-light">ID</Button>
+ </th>
+ : null
+ }
{
this.state.ShoSelectColumn
? <th>
- <Button disabled variant="outline-light">SELECT</Button>
+ <Button disabled variant="outline-light">Выбор</Button>
</th>
: null
}
<th>
- <Button property="Name" onClick={this.OnSortClick} variant="outline-light">NAME</Button>
+ <Button property="Name" onClick={this.OnSortClick} variant="outline-light">Имя</Button>
</th>
<th>
- <Button property="Type" onClick={this.OnSortClick} variant="outline-light">TYPE</Button>
+ <Button property="Type" onClick={this.OnSortClick} variant="outline-light">Тип</Button>
</th>
<th>
- <Button property="FileExtension" onClick={this.OnSortClick} variant="outline-light">EXT</Button>
+ <Button property="FileExtension" onClick={this.OnSortClick} variant="outline-light">Тип файла</Button>
</th>
<th>
- <Button property="Size" onClick={this.OnSortClick} variant="outline-light">SIZE(MB)</Button>
+ <Button property="Size" onClick={this.OnSortClick} variant="outline-light">Размер (Mb)</Button>
</th>
</tr>
</thead>
diff --git a/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerRow.jsx b/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerRow.jsx
index b62e76c..bc331e6 100644
--- a/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerRow.jsx
+++ b/FileServer/SPA/src/JS/React/Controls/FileExplorer/FileExplorerRow.jsx
@@ -4,6 +4,11 @@ import { Link } from 'react-router-dom';
import { Button, Form } from 'react-bootstrap'
import BaseControl from '../../BaseControl.jsx'
+import Configuration from '../../../Tools/Configuration'
+import FileExplorerServices from '../../../Services/FileExplorerServices'
+
+
+import ImageFileFind from '../../../../Images/file-find.png'
export default class FileExplorerRow extends BaseControl {
@@ -55,13 +60,34 @@ export default class FileExplorerRow extends BaseControl {
this.EventRegister.EventAction(this.GetDirectory().ChangeEvent);
}
+ OnPreviewClick(sender) {
+ let id = sender.target.attributes[0].value;
+ let extension = sender.target.attributes[1].value;
+ let url =
+ Configuration.OpenRegisteredExtension
+ .find(item => item.Ext.includes(extension))
+ .Service
+ + window.location.origin
+ + '/'
+ + FileExplorerServices.staticURL_Download
+ + id;
+
+ //window.open(url, '_blank');
+ debugger;
+ }
+
render() {
let state = this.state;
let elem = state.Data;
return (
<tr>
- <td>{elem.ID}</td>
+ {
+ (Configuration.EnviromentValue == 'Development')
+ ?
+ <td>{elem.ID}</td>
+ : null
+ }
{state.ShoSelectColumn
?
<td>
@@ -80,7 +106,21 @@ export default class FileExplorerRow extends BaseControl {
</Button>
</Link>
</td>
- : <td>{elem.Name}</td>
+ :
+ (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;">
+ <img elemid={elem.ID} elemext={elem.FileExtension} src={ImageFileFind} width="24" height="24" />
+ </Button>
+ </div>
+ </td>
+ :
+ <td>{elem.Name}</td>
+
+
}
<td>{elem.Type}</td>
<td>{elem.FileExtension}</td>
diff --git a/FileServer/SPA/src/JS/Services/FileExplorerServices.js b/FileServer/SPA/src/JS/Services/FileExplorerServices.js
index 9e72d73..9cf088b 100644
--- a/FileServer/SPA/src/JS/Services/FileExplorerServices.js
+++ b/FileServer/SPA/src/JS/Services/FileExplorerServices.js
@@ -1,6 +1,7 @@
import ApiQuery from '../Tools/ApiQuery'
+const URL_download = "api/Explorer/GetFile?ID=";
export default class FileExplorerServices {
constructor() {
@@ -10,11 +11,12 @@ export default class FileExplorerServices {
this.URL_Delete = "api/Explorer/DeleteFile";
this.URL_Move = "api/Explorer/MoveElement";
- this.URL_Download = "api/Explorer/GetFile?ID=";
+ this.URL_Download = URL_download;
this.URL_CreateDirectory = "api/Explorer/CreateDirectory?";
}
+ static staticURL_Download = URL_download;
async DirectoryGetItemsAsync(ID) {
let url = this.URL_DirectoryItems + ID;
@@ -48,7 +50,6 @@ export default class FileExplorerServices {
OpenDownload(ID) {
let url = this.URL_Download + ID;
-
window.open(url, '_blank');
}
diff --git a/FileServer/SPA/src/JS/Tools/Configuration.js b/FileServer/SPA/src/JS/Tools/Configuration.js
index 605a06a..5e99a59 100644
--- a/FileServer/SPA/src/JS/Tools/Configuration.js
+++ b/FileServer/SPA/src/JS/Tools/Configuration.js
@@ -4,6 +4,11 @@
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=' },
+ ];
//Заполнятся при старте запросом из WebApi
static EnviromentValue = "NoSet";
FileServer/Web/Config.xml 2(+1 -1)
diff --git a/FileServer/Web/Config.xml b/FileServer/Web/Config.xml
index df78dfa..74a3237 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-07T12:44:55.3695976+04:00</LastExportDate>
+ <LastExportDate>2020-12-19T19:26:22.6586096+04:00</LastExportDate>
<WriteNewRootDir>true</WriteNewRootDir>
<ClearDBWithStart>true</ClearDBWithStart>
<RootDirs>
FileServer/Web/Web.csproj.user 2(+1 -1)
diff --git a/FileServer/Web/Web.csproj.user b/FileServer/Web/Web.csproj.user
index a74010b..48274bb 100644
--- a/FileServer/Web/Web.csproj.user
+++ b/FileServer/Web/Web.csproj.user
@@ -8,7 +8,7 @@
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
- <LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
+ <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Controller</Controller_SelectedScaffolderCategoryPath>
<WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>