Skip to content

Commit

Permalink
Improve UI for importing a GPO folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ellman12 committed Mar 17, 2022
1 parent acaad7c commit a58e902
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 19 deletions.
12 changes: 6 additions & 6 deletions PSS/PSS/Pages/ImportGPOFolder.razor
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,19 @@
allShortPaths = new List<string>();

//Get all supported file types in pss_upload and group them together in a single List.
pngPaths = Directory.GetFiles(Upload.gpoFolderPath, "*.png", SearchOption.AllDirectories).ToList();
jpgPaths = Directory.GetFiles(Upload.gpoFolderPath, "*.jp*g", SearchOption.AllDirectories).ToList();
gifPaths = Directory.GetFiles(Upload.gpoFolderPath, "*.gif", SearchOption.AllDirectories).ToList();
mp4Paths = Directory.GetFiles(Upload.gpoFolderPath, "*.mp4", SearchOption.AllDirectories).ToList();
mkvPaths = Directory.GetFiles(Upload.gpoFolderPath, "*.mkv", SearchOption.AllDirectories).ToList();
pngPaths = Directory.GetFiles(Upload.GpoFolderPath, "*.png", SearchOption.AllDirectories).ToList();
jpgPaths = Directory.GetFiles(Upload.GpoFolderPath, "*.jp*g", SearchOption.AllDirectories).ToList();
gifPaths = Directory.GetFiles(Upload.GpoFolderPath, "*.gif", SearchOption.AllDirectories).ToList();
mp4Paths = Directory.GetFiles(Upload.GpoFolderPath, "*.mp4", SearchOption.AllDirectories).ToList();
mkvPaths = Directory.GetFiles(Upload.GpoFolderPath, "*.mkv", SearchOption.AllDirectories).ToList();
allFullPaths = jpgPaths.Concat(pngPaths).Concat(gifPaths).Concat(mp4Paths).Concat(mkvPaths).ToList();
allFiles = new List<C.UAFile>(allFullPaths.Count);

foreach (string fullPath in allFullPaths)
{
//Get the date taken based on this item's fullPath.
string dtPath = fullPath.Replace('\\', '/');
dtPath = dtPath.Replace(Upload.gpoFolderPath, "");
dtPath = dtPath.Replace(Upload.GpoFolderPath, "");
dtPath = dtPath.Replace(Path.GetFileName(dtPath), "");
if (dtPath[0] == '/') dtPath = dtPath.Remove(0, 1);

Expand Down
65 changes: 52 additions & 13 deletions PSS/PSS/Pages/Upload.razor
Original file line number Diff line number Diff line change
@@ -1,34 +1,73 @@
@page "/upload"
@inject NavigationManager navigationManager;

<title>Upload - PSS</title>
<link href="css/Upload.css" rel="stylesheet"/>

@{
jpgPaths = Directory.GetFiles(S.uploadFolderPath, "*.jp*g", SearchOption.AllDirectories);
pngPaths = Directory.GetFiles(S.uploadFolderPath, "*.png", SearchOption.AllDirectories);
gifPaths = Directory.GetFiles(S.uploadFolderPath, "*.gif", SearchOption.AllDirectories);
mp4Paths = Directory.GetFiles(S.uploadFolderPath, "*.mp4", SearchOption.AllDirectories);
mkvPaths = Directory.GetFiles(S.uploadFolderPath, "*.mkv", SearchOption.AllDirectories);
allPaths = jpgPaths.Concat(pngPaths).Concat(gifPaths).Concat(mp4Paths).Concat(mkvPaths).ToArray();

<div id="mainDiv">
@if (allPaths.Length > 0)
{
<span style="font-size: 25px; margin-bottom: 20px">Items Found in pss_upload Waiting to Be Added to Library</span>
<span class="bigText">Items Found in pss_upload Waiting to Be Added to Library</span>
<button class="textBtn">
<span class="material-icons-outlined">add_photo_alternate</span><a href="apply-upload">Go to Upload Apply</a>
</button>
}

<span class="bigText">Import a Folder in pss_upload Sorted with GPO</span>

<button class="textBtn">
<span class="material-icons-outlined">drive_folder_upload</span><a href="gpo-import">Import a Folder in pss_upload Sorted with GPO</a>
<button class="textBtn" @onclick="@(() => gpoFolderInputVis = "visible")">
<span class="material-icons-outlined">drive_folder_upload</span><span>Click to Begin</span>
</button>

<input style="color: black; width: 650px; visibility: @gpoFolderInputVis" placeholder="Enter the Full Path to a GPO Folder" type="text" @bind="@GpoFolderPath" @bind:event="oninput"/>
<span style="color: red; visibility: @errorSpanVis">Folder path is invalid</span>

<button class="textBtn" style="visibility: @gpoBtnVis;">
<span class="material-icons-outlined">add_photo_alternate</span><a href="gpo-import">Begin Importing</a>
</button>

<input style="color: black; width: 400px" placeholder="Enter the Full Path to a GPO Folder" type="text" @bind="gpoFolderPath" @bind:event="oninput"/>
</div>
}

@code {
private static string[] jpgPaths, pngPaths, gifPaths, mp4Paths, mkvPaths, allPaths;
public static string gpoFolderPath = ""; //Actually used in ImportGPOFolder.razor

private static string gpoFolderPath;

public static string GpoFolderPath //Actually used in ImportGPOFolder.razor
{
get => gpoFolderPath;
private set
{
gpoFolderPath = value;
if (!String.IsNullOrWhiteSpace(value) && Directory.Exists(value))
{
errorSpanVis = "hidden";
gpoBtnVis = "visible";
}
else
{
errorSpanVis = "visible";
gpoBtnVis = "hidden";
}
}
}

private static string gpoFolderInputVis, errorSpanVis, gpoBtnVis;

protected override void OnInitialized()
{
gpoFolderPath = "";
gpoFolderInputVis = "hidden";
errorSpanVis = "hidden";
gpoBtnVis = "hidden";

jpgPaths = Directory.GetFiles(S.uploadFolderPath, "*.jp*g", SearchOption.AllDirectories);
pngPaths = Directory.GetFiles(S.uploadFolderPath, "*.png", SearchOption.AllDirectories);
gifPaths = Directory.GetFiles(S.uploadFolderPath, "*.gif", SearchOption.AllDirectories);
mp4Paths = Directory.GetFiles(S.uploadFolderPath, "*.mp4", SearchOption.AllDirectories);
mkvPaths = Directory.GetFiles(S.uploadFolderPath, "*.mkv", SearchOption.AllDirectories);
allPaths = jpgPaths.Concat(pngPaths).Concat(gifPaths).Concat(mp4Paths).Concat(mkvPaths).ToArray();
}

}
6 changes: 6 additions & 0 deletions PSS/PSS/wwwroot/css/Upload.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@

#mainDiv > .textBtn {
width: fit-content;
}

#mainDiv > .bigText {
font-size: 25px;
margin-bottom: 20px;
margin-top: 70px;
}

0 comments on commit a58e902

Please sign in to comment.