Skip to content

Commit

Permalink
Merge pull request #1929 from microsoft/staging
Browse files Browse the repository at this point in the history
Release - 11/21/23
  • Loading branch information
EricJohnson327 authored Nov 20, 2023
2 parents 7e06e0f + 134c895 commit d2c27d5
Show file tree
Hide file tree
Showing 153 changed files with 3,583 additions and 2,011 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/Documentation_Issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ description: Report issues on our documentation
labels:
- Issue-Docs
body:
- type: textarea
- id: description
type: textarea
attributes:
label: Provide a description of requested docs changes
placeholder: Briefly describe which document needs to be corrected and why.
Expand Down
2 changes: 0 additions & 2 deletions .github/policies/moderatorTriggers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ configuration:
- activitySenderHasAssociation:
association: Member
then:
- removeLabel:
label: Needs-Triage
- removeLabel:
label: Needs-Team-Response
- addLabel:
Expand Down
40 changes: 34 additions & 6 deletions .vsconfig
Original file line number Diff line number Diff line change
@@ -1,17 +1,45 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.Component.MSBuild",
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
"Microsoft.VisualStudio.Component.SQL.CLR",
"Microsoft.VisualStudio.Component.CoreEditor",
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.Net.Component.4.8.SDK",
"Microsoft.Net.Component.4.7.2.TargetingPack",
"Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
"Microsoft.VisualStudio.Component.TypeScript.TSServer",
"Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
"Microsoft.VisualStudio.Component.JavaScript.TypeScript",
"Microsoft.VisualStudio.Component.TextTemplating",
"Microsoft.VisualStudio.Component.NuGet",
"Microsoft.Component.ClickOnce",
"Microsoft.VisualStudio.Component.ManagedDesktop.Core",
"Microsoft.NetCore.Component.Runtime.6.0",
"Microsoft.NetCore.Component.Runtime.7.0",
"Microsoft.NetCore.Component.SDK",
"Microsoft.VisualStudio.Component.ManagedDesktop.Core",
"Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
"Microsoft.VisualStudio.Component.NuGet",
"Microsoft.VisualStudio.Component.FSharp",
"Microsoft.ComponentGroup.ClickOnce.Publish",
"Microsoft.NetCore.Component.DevelopmentTools",
"Microsoft.Net.Component.4.8.TargetingPack",
"Microsoft.Net.ComponentGroup.4.8.DeveloperTools",
"Microsoft.VisualStudio.Component.IntelliTrace.FrontEnd",
"Microsoft.VisualStudio.Component.DiagnosticTools",
"Microsoft.VisualStudio.Component.EntityFramework",
"Microsoft.VisualStudio.Component.LiveUnitTesting",
"Microsoft.VisualStudio.Component.Debugger.JustInTime",
"Component.Microsoft.VisualStudio.LiveShare.2022",
"Microsoft.VisualStudio.Component.IntelliCode",
"Microsoft.VisualStudio.Component.Windows10SDK",
"Microsoft.VisualStudio.Component.Windows10SDK.19041",
"Microsoft.VisualStudio.Component.Windows11SDK.22000",
"Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging",
"Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
"Microsoft.VisualStudio.Component.DotNetModelBuilder",
"Microsoft.VisualStudio.ComponentGroup.WindowsAppSDK.Cs",
"Microsoft.VisualStudio.Workload.ManagedDesktop"
"Microsoft.ComponentGroup.Blend",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.VisualStudio.Component.Windows11SDK.22000",
"Microsoft.VisualStudio.Component.Windows10SDK.19041"
]
}
4 changes: 2 additions & 2 deletions CoreWidgetProvider/Helpers/MemoryStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ulong UsedMem
get; set;
}

public ulong MemCommited
public ulong MemCommitted
{
get; set;
}
Expand Down Expand Up @@ -75,7 +75,7 @@ public void GetData()
}

MemCached = (ulong)memCached.NextValue();
MemCommited = (ulong)memCommitted.NextValue();
MemCommitted = (ulong)memCommitted.NextValue();
MemCommitLimit = (ulong)memCommittedLimit.NextValue();
MemPagedPool = (ulong)memPoolPaged.NextValue();
MemNonPagedPool = (ulong)memPoolNonPaged.NextValue();
Expand Down
4 changes: 3 additions & 1 deletion CoreWidgetProvider/Helpers/Resources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static string[] GetWidgetResourceIdentifiers()
"Memory_Widget_Template/MemoryUsage",
"Memory_Widget_Template/AllMemory",
"Memory_Widget_Template/UsedMemory",
"Memory_Widget_Template/Commited",
"Memory_Widget_Template/Committed",
"Memory_Widget_Template/Cached",
"Memory_Widget_Template/NonPagedPool",
"Memory_Widget_Template/PagedPool",
Expand All @@ -87,6 +87,8 @@ public static string[] GetWidgetResourceIdentifiers()
"CPUUsage_Widget_Template/CPU_Speed",
"CPUUsage_Widget_Template/Processes",
"CPUUsage_Widget_Template/End_Process",
"Widget_Template_Button/Save",
"Widget_Template_Button/Cancel",
};
}
}
12 changes: 10 additions & 2 deletions CoreWidgetProvider/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
<data name="Memory_Widget_Template.UsedMemory" xml:space="preserve">
<value>In use (compressed)</value>
</data>
<data name="Memory_Widget_Template.Commited" xml:space="preserve">
<value>Commited</value>
<data name="Memory_Widget_Template.Committed" xml:space="preserve">
<value>Committed</value>
</data>
<data name="Memory_Widget_Template.Cached" xml:space="preserve">
<value>Cached</value>
Expand Down Expand Up @@ -162,4 +162,12 @@
<data name="CPUUsage_Widget_Template.End_Process" xml:space="preserve">
<value>End process</value>
</data>
<data name="Widget_Template_Button.Save" xml:space="preserve">
<value>Save</value>
<comment>Shown in Widget, Button text</comment>
</data>
<data name="Widget_Template_Button.Cancel" xml:space="preserve">
<value>Cancel</value>
<comment>Shown in Widget, Button text</comment>
</data>
</root>
2 changes: 2 additions & 0 deletions CoreWidgetProvider/Widgets/CoreWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public override void OnWidgetContextChanged(WidgetContextChangedArgs contextChan

public override void OnActionInvoked(WidgetActionInvokedArgs actionInvokedArgs) => throw new NotImplementedException();

public override void OnCustomizationRequested(WidgetCustomizationRequestedArgs customizationRequestedArgs) => throw new NotImplementedException();

protected WidgetAction GetWidgetActionForVerb(string verb)
{
try
Expand Down
5 changes: 5 additions & 0 deletions CoreWidgetProvider/Widgets/Enums/WidgetAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license.

namespace CoreWidgetProvider.Widgets.Enums;

public enum WidgetAction
{
/// <summary>
Expand Down Expand Up @@ -43,4 +44,8 @@ public enum WidgetAction
/// Kill process #3.
/// </summary>
CpuKill3,

Save,

Cancel,
}
59 changes: 41 additions & 18 deletions CoreWidgetProvider/Widgets/SSHWalletWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ protected string ConfigFile
set => SetState(value);
}

private string _savedContentData = string.Empty;
private string _savedConfigFile = string.Empty;

public SSHWalletWidget()
{
}
Expand Down Expand Up @@ -114,24 +117,39 @@ public override void OnActionInvoked(WidgetActionInvokedArgs actionInvokedArgs)
case WidgetAction.Unknown:
Log.Logger()?.ReportError(Name, ShortId, $"Unknown verb: {actionInvokedArgs.Verb}");
break;

case WidgetAction.Save:
_savedContentData = string.Empty;
_savedConfigFile = string.Empty;
ContentData = EmptyJson;
SetActive();
break;

case WidgetAction.Cancel:
ConfigFile = _savedConfigFile;
ContentData = _savedContentData;
SetActive();
break;
}
}

private void HandleConnect(WidgetActionInvokedArgs args)
public override void OnCustomizationRequested(WidgetCustomizationRequestedArgs customizationRequestedArgs)
{
var data = args.Data;

Process cmd = new Process();
_savedContentData = ContentData;
_savedConfigFile = ConfigFile;
SetConfigure();
}

var info = new ProcessStartInfo
private void HandleConnect(WidgetActionInvokedArgs args)
{
var cmd = new Process();
cmd.StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = $"/k \"ssh {data}\"",
Arguments = $"/k \"ssh {args.Data}\"",
UseShellExecute = true,
};

cmd.StartInfo = info;

cmd.Start();
}

Expand Down Expand Up @@ -161,8 +179,10 @@ private void HandleCheckPath(WidgetActionInvokedArgs args)

private MatchCollection? GetHostEntries()
{
FileStreamOptions options = new FileStreamOptions();
options.Access = FileAccess.Read;
var options = new FileStreamOptions()
{
Access = FileAccess.Read,
};

using var reader = new StreamReader(ConfigFile, options);

Expand All @@ -179,12 +199,7 @@ private void HandleCheckPath(WidgetActionInvokedArgs args)
private int GetNumberOfHostEntries()
{
var hostEntries = GetHostEntries();
if (hostEntries == null)
{
return 0;
}

return hostEntries.Count;
return (hostEntries != null) ? hostEntries.Count : 0;
}

private void SetupFileWatcher()
Expand Down Expand Up @@ -235,17 +250,25 @@ private JsonObject FillConfigurationData(bool hasConfiguration, string configFil
{
var configurationData = new JsonObject();

var currentOrDefaultConfigFile = string.IsNullOrEmpty(configFile) ? DefaultConfigFile : configFile;
// Determine what config file to suggest in configuration form.
// 1. If there is a currently selected configFile, show that.
// 2. Else, check if there is a _savedConfigFile. If so, the user
// is in the customize flow and we should show the _savedConfigFile.
// 3. Else, show the DefaultConfigFile.
var suggestedConfigFile = string.IsNullOrEmpty(configFile) ? _savedConfigFile : configFile;
suggestedConfigFile = string.IsNullOrEmpty(suggestedConfigFile) ? DefaultConfigFile : suggestedConfigFile;

var sshConfigData = new JsonObject
{
{ "configFile", configFile },
{ "currentOrDefaultConfigFile", currentOrDefaultConfigFile },
{ "currentOrDefaultConfigFile", suggestedConfigFile },
{ "numOfEntries", numOfEntries.ToString(CultureInfo.InvariantCulture) },
};

configurationData.Add("configuring", configuring);
configurationData.Add("hasConfiguration", hasConfiguration);
configurationData.Add("configuration", sshConfigData);
configurationData.Add("savedConfigFile", _savedConfigFile);
configurationData.Add("submitIcon", IconLoader.GetIconAsBase64("arrow.png"));

if (!string.IsNullOrEmpty(errorMessage))
Expand Down
4 changes: 2 additions & 2 deletions CoreWidgetProvider/Widgets/SystemMemoryWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public override void LoadContentData()
memoryData.Add("allMem", MemUlongToString(currentData.AllMem));
memoryData.Add("usedMem", MemUlongToString(currentData.UsedMem));
memoryData.Add("memUsage", FloatToPercentString(currentData.MemUsage));
memoryData.Add("commitedMem", MemUlongToString(currentData.MemCommited));
memoryData.Add("commitedLimitMem", MemUlongToString(currentData.MemCommitLimit));
memoryData.Add("committedMem", MemUlongToString(currentData.MemCommitted));
memoryData.Add("committedLimitMem", MemUlongToString(currentData.MemCommitLimit));
memoryData.Add("cachedMem", MemUlongToString(currentData.MemCached));
memoryData.Add("pagedPoolMem", MemUlongToString(currentData.MemPagedPool));
memoryData.Add("nonPagedPoolMem", MemUlongToString(currentData.MemNonPagedPool));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,48 @@
"$data": "${$root.configuration}",
"$when": "${$root.hasConfiguration}",
"bleed": true
},
{
"type": "ColumnSet",
"spacing": "ExtraLarge",
"$when": "${$root.savedConfigFile != \"\"}",
"columns": [
{
"type": "Column",
"width": "stretch"
},
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "Container",
"items": [
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Execute",
"title": "%Widget_Template_Button/Save%",
"verb": "Save",
"isEnabled": "${$root.hasConfiguration}"
},
{
"type": "Action.Execute",
"title": "%Widget_Template_Button/Cancel%",
"verb": "Cancel"
}
]
}
]
}
]
},
{
"type": "Column",
"width": "stretch"
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@
"type": "Column",
"items": [
{
"text": "%Memory_Widget_Template/Commited%",
"text": "%Memory_Widget_Template/Committed%",
"type": "TextBlock",
"size": "small",
"isSubtle": true
},
{
"text": "${commitedMem}/${commitedLimitMem}",
"text": "${committedMem}/${committedLimitMem}",
"type": "TextBlock",
"size": "medium"
}
Expand Down
2 changes: 2 additions & 0 deletions CoreWidgetProvider/Widgets/WidgetImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,7 @@ public void SetState(string state)

public abstract void OnActionInvoked(WidgetActionInvokedArgs actionInvokedArgs);

public abstract void OnCustomizationRequested(WidgetCustomizationRequestedArgs customizationRequestedArgs);

public abstract void OnWidgetContextChanged(WidgetContextChangedArgs contextChangedArgs);
}
13 changes: 12 additions & 1 deletion CoreWidgetProvider/Widgets/WidgetProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace CoreWidgetProvider.Widgets;
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("F8B2DBB9-3687-4C6E-99B2-B92C82905937")]
internal class WidgetProvider : IWidgetProvider
internal class WidgetProvider : IWidgetProvider, IWidgetProvider2
{
private readonly Dictionary<string, IWidgetImplFactory> widgetDefinitionRegistry = new ();
private readonly Dictionary<string, WidgetImpl> runningWidgets = new ();
Expand Down Expand Up @@ -140,6 +140,17 @@ public void OnActionInvoked(WidgetActionInvokedArgs actionInvokedArgs)
}
}

public void OnCustomizationRequested(WidgetCustomizationRequestedArgs customizationRequestedArgs)
{
Log.Logger()?.ReportDebug($"OnCustomizationRequested id: {customizationRequestedArgs.WidgetContext.Id} definitionId: {customizationRequestedArgs.WidgetContext.DefinitionId}");
var widgetContext = customizationRequestedArgs.WidgetContext;
var widgetId = widgetContext.Id;
if (runningWidgets.ContainsKey(widgetId))
{
runningWidgets[widgetId].OnCustomizationRequested(customizationRequestedArgs);
}
}

public void OnWidgetContextChanged(WidgetContextChangedArgs contextChangedArgs)
{
Log.Logger()?.ReportDebug($"OnWidgetContextChanged id: {contextChangedArgs.WidgetContext.Id} definitionId: {contextChangedArgs.WidgetContext.DefinitionId}");
Expand Down
Loading

0 comments on commit d2c27d5

Please sign in to comment.