Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 71 additions & 17 deletions src/DynamoCoreWpf/Controls/Docs/NodeAutocompleteDocumentation.html

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3479,4 +3479,7 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="PreferencesViewBetaTag" xml:space="preserve">
<value>Beta</value>
</data>
</root>
<data name="SplashScreenSigningIn" xml:space="preserve">
<value>Signing In</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3466,4 +3466,7 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="PreferencesViewBetaTag" xml:space="preserve">
<value>Beta</value>
</data>
<data name="SplashScreenSigningIn" xml:space="preserve">
<value>Signing In</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -1088,8 +1088,6 @@ internal IEnumerable<string> GetAllFiles()

// union with additional files
files = files.Union(AdditionalFiles);
// union with optional markdown files from directory
files = files.Union(MarkdownFiles);
files = files.Union(Assemblies.Select(x => x.Assembly.Location));

return files;
Expand Down Expand Up @@ -1332,12 +1330,12 @@ private void SelectMarkdownDirectory()
}
MarkdownFilesDirectory = directoryPath;

// Append all md files from the directory to files list without affect the package content UI
// Store all files paths from the markdown directory to list without affecting the package content UI
MarkdownFiles = Directory
.GetFiles
(
directoryPath,
"*.md",
"*",
SearchOption.AllDirectories
).ToList();
}
Expand Down Expand Up @@ -1502,18 +1500,18 @@ private void Submit()
{
return;
}
var files = BuildPackage();
var contentFiles = BuildPackage();
try
{
//if buildPackage() returns no files then the package
//is empty so we should return
if (files == null || files.Count() < 1)
if (contentFiles == null || contentFiles.Count() < 1)
{
return;
}
// begin submission
var pmExtension = dynamoViewModel.Model.GetPackageManagerExtension();
var handle = pmExtension.PackageManagerClient.PublishAsync(Package, files, IsNewVersion);
var handle = pmExtension.PackageManagerClient.PublishAsync(Package, contentFiles, MarkdownFiles, IsNewVersion);

// start upload
Uploading = true;
Expand Down Expand Up @@ -1600,7 +1598,7 @@ private void PublishLocally()
var remapper = new CustomNodePathRemapper(DynamoViewModel.Model.CustomNodeManager,
DynamoModel.IsTestMode);
var builder = new PackageDirectoryBuilder(new MutatingFileSystem(), remapper);
builder.BuildDirectory(Package, publishPath, files);
builder.BuildDirectory(Package, publishPath, files, MarkdownFiles);
UploadState = PackageUploadHandle.State.Uploaded;

// Once upload is successful, a display message will appear to ask
Expand Down
15 changes: 8 additions & 7 deletions src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -728,13 +728,14 @@
VerticalAlignment="Center"
Foreground="{StaticResource PreferencesWindowFontColor}"/>
<Image Name="MLNodeAutocompleteToolTip"
Margin="5,3,0,0"
Width="14"
Height="14"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource QuestionIcon}"
ToolTipService.ShowDuration="30000">
Margin="5,3,0,0"
Width="14"
Height="14"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource QuestionIcon}"
MouseDown="OnMoreInfoClicked"
ToolTipService.ShowDuration="30000">
<Image.ToolTip>
<ToolTip Content="{x:Static p:Resources.PreferencesViewEnableNodeAutoCompleteTooltipText}" Style="{StaticResource GenericToolTipLight}"/>
</Image.ToolTip>
Expand Down
5 changes: 5 additions & 0 deletions src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,11 @@ private void importTextBlock_MouseLeftButtonDown(object sender, MouseButtonEvent
}
}

private void OnMoreInfoClicked(object sender, MouseButtonEventArgs e)
{
dynViewModel.OpenDocumentationLinkCommand.Execute(new OpenDocumentationLinkEventArgs(new Uri(Dynamo.Wpf.Properties.Resources.NodeAutocompleteDocumentationUriString, UriKind.Relative)));
}

private void exportTextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var dialog = new DynamoFolderBrowserDialog
Expand Down
6 changes: 4 additions & 2 deletions src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ internal async void SetSignInStatus(bool status)
{
if (webView?.CoreWebView2 != null)
{
await webView.CoreWebView2.ExecuteScriptAsync("window.setSignInStatus({" +
$"signInTitle: \"" + (status ? Wpf.Properties.Resources.SplashScreenSignOut : Wpf.Properties.Resources.SplashScreenSignIn).ToString() + "\"," +
await webView.CoreWebView2.ExecuteScriptAsync("window.setSignInStatus({" +
$"signInStatus: \"" + status + "\"})");
}
}
Expand All @@ -365,6 +364,9 @@ await webView.CoreWebView2.ExecuteScriptAsync("window.setLabels({" +
$"launchTitle: \"{Wpf.Properties.Resources.SplashScreenLaunchTitle}\"," +
$"importSettingsTitle: \"{Wpf.Properties.Resources.ImportSettingsDialogTitle}\"," +
$"showScreenAgainLabel: \"{Wpf.Properties.Resources.SplashScreenShowScreenAgainLabel}\"," +
$"signInTitle: \"{Wpf.Properties.Resources.SplashScreenSignIn}\"," +
$"signOutTitle: \"{Wpf.Properties.Resources.SplashScreenSignOut}\"," +
$"signingInTitle: \"{Wpf.Properties.Resources.SplashScreenSigningIn}\"," +
$"importSettingsTooltipDescription: \"{Wpf.Properties.Resources.ImportPreferencesInfo}\"" + "})");
}
}
Expand Down
45 changes: 27 additions & 18 deletions src/DynamoPackages/PackageDirectoryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Dynamo.PackageManager
{
public interface IPackageDirectoryBuilder
{
IDirectoryInfo BuildDirectory(Package packages, string packagesDirectory, IEnumerable<string> files);
IDirectoryInfo BuildDirectory(Package packages, string packagesDirectory, IEnumerable<string> files, IEnumerable<string> markdownfiles);
}

/// <summary>
Expand All @@ -34,11 +34,8 @@ internal class PackageDirectoryBuilder : IPackageDirectoryBuilder
/// <param name="pathRemapper">For modifying custom node paths</param>
internal PackageDirectoryBuilder(IFileSystem fileSystem, IPathRemapper pathRemapper)
{
if (fileSystem == null) throw new ArgumentNullException("fileSystem");
if (pathRemapper == null) throw new ArgumentNullException("pathRemapper");

this.fileSystem = fileSystem;
this.pathRemapper = pathRemapper;
this.fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
this.pathRemapper = pathRemapper ?? throw new ArgumentNullException(nameof(pathRemapper));
}

#region Public Class Operational Methods
Expand All @@ -50,18 +47,16 @@ internal PackageDirectoryBuilder(IFileSystem fileSystem, IPathRemapper pathRemap
/// <param name="packagesDirectory">The parent directory for the parent directory</param>
/// <param name="files">The collection of files to be moved</param>
/// <returns></returns>
public IDirectoryInfo BuildDirectory(Package package, string packagesDirectory, IEnumerable<string> files)
public IDirectoryInfo BuildDirectory(Package package, string packagesDirectory, IEnumerable<string> contentFiles, IEnumerable<string> markdownFiles)
{
IDirectoryInfo rootDir, dyfDir, binDir, extraDir, docDir;

FormPackageDirectory(packagesDirectory, package.Name, out rootDir, out dyfDir, out binDir, out extraDir, out docDir); // shouldn't do anything for pkg versions
FormPackageDirectory(packagesDirectory, package.Name, out IDirectoryInfo rootDir, out IDirectoryInfo dyfDir, out IDirectoryInfo binDir, out IDirectoryInfo extraDir, out IDirectoryInfo docDir); // shouldn't do anything for pkg versions
package.RootDirectory = rootDir.FullName;

WritePackageHeader(package, rootDir);
RemoveUnselectedFiles(files, rootDir);
CopyFilesIntoPackageDirectory(files, dyfDir, binDir, extraDir, docDir);
RemoveDyfFiles(files, dyfDir);
RemapCustomNodeFilePaths(files, dyfDir.FullName);
RemoveUnselectedFiles(contentFiles, rootDir);
CopyFilesIntoPackageDirectory(contentFiles, markdownFiles, dyfDir, binDir, extraDir, docDir);
RemoveDyfFiles(contentFiles, dyfDir);
RemapCustomNodeFilePaths(contentFiles, dyfDir.FullName);

return rootDir;
}
Expand Down Expand Up @@ -145,9 +140,9 @@ private void WritePackageHeader(Package package, IDirectoryInfo rootDir)
}


internal void CopyFilesIntoPackageDirectory(IEnumerable<string> files, IDirectoryInfo dyfDir,
IDirectoryInfo binDir, IDirectoryInfo extraDir,
IDirectoryInfo docDir)
internal void CopyFilesIntoPackageDirectory(IEnumerable<string> files, IEnumerable<string> markdownFiles,
IDirectoryInfo dyfDir, IDirectoryInfo binDir,
IDirectoryInfo extraDir, IDirectoryInfo docDir)
{
// normalize the paths to ensure correct comparison
var dyfDirPath = NormalizePath(dyfDir.FullName);
Expand All @@ -166,7 +161,7 @@ internal void CopyFilesIntoPackageDirectory(IEnumerable<string> files, IDirector
// determine which folder to put the file in
string targetFolder = extraDirPath;

if (Path.GetDirectoryName(file).EndsWith(DocumentationDirectoryName) || file.EndsWith(".md"))
if (Path.GetDirectoryName(file).EndsWith(DocumentationDirectoryName))
{
targetFolder = docDirPath;
}
Expand All @@ -192,6 +187,20 @@ internal void CopyFilesIntoPackageDirectory(IEnumerable<string> files, IDirector
fileSystem.DeleteFile(destPath);
}

fileSystem.CopyFile(file, destPath);
}
// All files under Markdown directory do not apply to the rule above,
// because they may fall into extra folder instead of docs folder,
// currently there is on obvious way to filter them properly only based on path string.
foreach (var file in markdownFiles.Where(x => x != null))
{
var destPath = Path.Combine(docDirPath, Path.GetFileName(file));

if (fileSystem.FileExists(destPath))
{
fileSystem.DeleteFile(destPath);
}

fileSystem.CopyFile(file, destPath);
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/DynamoPackages/PackageManagerClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Dynamo.Graph.Workspaces;
Expand Down Expand Up @@ -207,33 +207,33 @@ private bool ExecuteTermsOfUseCall(bool queryAcceptanceStatus)
}, false);
}

internal PackageUploadHandle PublishAsync(Package package, IEnumerable<string> files, bool isNewVersion)
internal PackageUploadHandle PublishAsync(Package package, IEnumerable<string> files, IEnumerable<string> markdownFiles, bool isNewVersion)
{
var packageUploadHandle = new PackageUploadHandle(PackageUploadBuilder.NewRequestBody(package));

Task.Factory.StartNew(() =>
{
Publish(package, files, isNewVersion, packageUploadHandle);
Publish(package, files, markdownFiles, isNewVersion, packageUploadHandle);
});

return packageUploadHandle;
}

internal void Publish(Package package, IEnumerable<string> files, bool isNewVersion, PackageUploadHandle packageUploadHandle)
internal void Publish(Package package, IEnumerable<string> files, IEnumerable<string> markdownFiles, bool isNewVersion, PackageUploadHandle packageUploadHandle)
{
try
{
ResponseBody ret = null;
if (isNewVersion)
{
var pkg = uploadBuilder.NewPackageVersionUpload(package, packageUploadDirectory, files,
var pkg = uploadBuilder.NewPackageVersionUpload(package, packageUploadDirectory, files, markdownFiles,
packageUploadHandle);
packageUploadHandle.UploadState = PackageUploadHandle.State.Uploading;
ret = this.client.ExecuteAndDeserialize(pkg);
}
else
{
var pkg = uploadBuilder.NewPackageUpload(package, packageUploadDirectory, files,
var pkg = uploadBuilder.NewPackageUpload(package, packageUploadDirectory, files, markdownFiles,
packageUploadHandle);
packageUploadHandle.UploadState = PackageUploadHandle.State.Uploading;
ret = this.client.ExecuteAndDeserialize(pkg);
Expand Down
39 changes: 29 additions & 10 deletions src/DynamoPackages/PackageUploadBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
Expand All @@ -9,11 +9,11 @@ namespace Dynamo.PackageManager
{
public interface IPackageUploadBuilder
{
PackageUpload NewPackageUpload(Package package, string packagesDirectory, IEnumerable<string> files,
PackageUpload NewPackageUpload(Package package, string packagesDirectory, IEnumerable<string> files, IEnumerable<string> markdownFiles,
PackageUploadHandle handle);

PackageVersionUpload NewPackageVersionUpload(Package package, string packagesDirectory,
IEnumerable<string> files, PackageUploadHandle handle);
IEnumerable<string> files, IEnumerable<string> markdownFiles, PackageUploadHandle handle);
}

internal class PackageUploadBuilder : IPackageUploadBuilder
Expand Down Expand Up @@ -56,37 +56,56 @@ public static PackageUploadRequestBody NewRequestBody(Package package)
package.NodeLibraries.Select(x => x.FullName), package.HostDependencies, package.CopyrightHolder, package.CopyrightYear);
}


public PackageUpload NewPackageUpload(Package package, string packagesDirectory, IEnumerable<string> files, PackageUploadHandle handle)
/// <summary>
/// Build a new package and upload
/// </summary>
/// <param name="package"></param>
/// <param name="packagesDirectory"></param>
/// <param name="files"></param>
/// <param name="markdownFiles"></param>
/// <param name="handle"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public PackageUpload NewPackageUpload(Package package, string packagesDirectory, IEnumerable<string> files, IEnumerable<string> markdownFiles, PackageUploadHandle handle)
{
if (package == null) throw new ArgumentNullException("package");
if (packagesDirectory == null) throw new ArgumentNullException("packagesDirectory");
if (files == null) throw new ArgumentNullException("files");
if (handle == null) throw new ArgumentNullException("handle");

return new PackageUpload(NewRequestBody(package),
BuildAndZip(package, packagesDirectory, files, handle).Name);
BuildAndZip(package, packagesDirectory, files, markdownFiles, handle).Name);
}

public PackageVersionUpload NewPackageVersionUpload(Package package, string packagesDirectory, IEnumerable<string> files, PackageUploadHandle handle)
/// <summary>
/// Build a new version of the package and upload
/// </summary>
/// <param name="package"></param>
/// <param name="packagesDirectory"></param>
/// <param name="files"></param>
/// <param name="markdownFiles"></param>
/// <param name="handle"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public PackageVersionUpload NewPackageVersionUpload(Package package, string packagesDirectory, IEnumerable<string> files, IEnumerable<string> markdownFiles, PackageUploadHandle handle)
{
if (package == null) throw new ArgumentNullException("package");
if (packagesDirectory == null) throw new ArgumentNullException("packagesDirectory");
if (files == null) throw new ArgumentNullException("files");
if (handle == null) throw new ArgumentNullException("handle");

return new PackageVersionUpload(NewRequestBody(package), BuildAndZip(package, packagesDirectory, files, handle).Name);
return new PackageVersionUpload(NewRequestBody(package), BuildAndZip(package, packagesDirectory, files, markdownFiles, handle).Name);
}

#endregion

#region Private Class Methods

private IFileInfo BuildAndZip(Package package, string packagesDirectory, IEnumerable<string> files, PackageUploadHandle handle)
private IFileInfo BuildAndZip(Package package, string packagesDirectory, IEnumerable<string> files, IEnumerable<string> markdownFiles, PackageUploadHandle handle)
{
handle.UploadState = PackageUploadHandle.State.Copying;

var dir = builder.BuildDirectory(package, packagesDirectory, files);
var dir = builder.BuildDirectory(package, packagesDirectory, files, markdownFiles);

handle.UploadState = PackageUploadHandle.State.Compressing;

Expand Down
Loading