-
-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #751 from skadefro/master
minor updates as prep for 1.5
- Loading branch information
Showing
8 changed files
with
137 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using OpenRPA.Interfaces; | ||
using System.Management.Automation; | ||
using Newtonsoft.Json.Linq; | ||
using System.Collections.ObjectModel; | ||
//using System; | ||
//using System.Collections.Generic; | ||
//using System.Linq; | ||
//using System.Text; | ||
//using System.Threading.Tasks; | ||
//using OpenRPA.Interfaces; | ||
//using System.Management.Automation; | ||
//using Newtonsoft.Json.Linq; | ||
//using System.Collections.ObjectModel; | ||
|
||
namespace OpenRPA.PS | ||
{ | ||
[Cmdlet(VerbsCommon.Add, "NoderedInstance")] | ||
public class AddNoderedInstance : OpenRPACmdlet | ||
{ | ||
[Parameter(Position = 0, ValueFromPipeline = true)] public string _id { get; set; } | ||
protected override async Task ProcessRecordAsync() | ||
{ | ||
try | ||
{ | ||
string traceId = ""; string spanId = ""; | ||
if (string.IsNullOrEmpty(_id)) { _id = global.webSocketClient.user._id; } | ||
await global.webSocketClient.EnsureNoderedInstance(_id, traceId, spanId); | ||
} | ||
catch (Exception ex) | ||
{ | ||
WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); | ||
} | ||
//namespace OpenRPA.PS | ||
//{ | ||
// [Cmdlet(VerbsCommon.Add, "NoderedInstance")] | ||
// public class AddNoderedInstance : OpenRPACmdlet | ||
// { | ||
// [Parameter(Position = 0, ValueFromPipeline = true)] public string _id { get; set; } | ||
// protected override async Task ProcessRecordAsync() | ||
// { | ||
// try | ||
// { | ||
// string traceId = ""; string spanId = ""; | ||
// if (string.IsNullOrEmpty(_id)) { _id = global.webSocketClient.user._id; } | ||
// await global.webSocketClient.EnsureNoderedInstance(_id, traceId, spanId); | ||
// } | ||
// catch (Exception ex) | ||
// { | ||
// WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); | ||
// } | ||
|
||
|
||
} | ||
} | ||
} | ||
// } | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using OpenRPA.Interfaces; | ||
using System.Management.Automation; | ||
using Newtonsoft.Json.Linq; | ||
using System.Collections.ObjectModel; | ||
//using System; | ||
//using System.Collections.Generic; | ||
//using System.Linq; | ||
//using System.Text; | ||
//using System.Threading.Tasks; | ||
//using OpenRPA.Interfaces; | ||
//using System.Management.Automation; | ||
//using Newtonsoft.Json.Linq; | ||
//using System.Collections.ObjectModel; | ||
|
||
namespace OpenRPA.PS | ||
{ | ||
[Cmdlet(VerbsCommon.Get, "NoderedInstance")] | ||
public class GetNoderedInstance : OpenRPACmdlet | ||
{ | ||
[Parameter(Position = 0, ValueFromPipeline = true)] public string _id { get; set; } | ||
[Parameter(Position = 1)] public int Minutes { get; set; } | ||
protected override async Task ProcessRecordAsync() | ||
{ | ||
try | ||
{ | ||
if (Minutes < 1) Minutes = 1; | ||
// string dt = DateTime.UtcNow.AddMinutes(Minutes).ToString("o", System.Globalization.CultureInfo.InvariantCulture); | ||
string dt = DateTime.UtcNow.AddMinutes(-Minutes).ToString("yyyy-MM-dd'T'HH:mm:ss.fffK", System.Globalization.CultureInfo.InvariantCulture); | ||
string json = "{\"_type\":\"user\", \"_noderedheartbeat\": { \"$gte\": \"" + dt + "\" } }"; | ||
if (!string.IsNullOrEmpty(_id)) { json = "{\"_type\":\"user\", \"_id\": \"" + _id + "\"}"; } | ||
var entities = await global.webSocketClient.Query<JObject>("users", json, top: 100); | ||
int index = 0; | ||
foreach (var entity in entities) | ||
{ | ||
if (entity.ContainsKey("name")) | ||
{ | ||
WriteVerbose("Parsing " + entity.Value<string>("_id") + " " + entity.Value<string>("name")); | ||
} | ||
else | ||
{ | ||
WriteVerbose("Parsing " + entity.Value<string>("_id")); | ||
} | ||
// results.Add(obj); | ||
WriteObject(entity.toPSObjectWithTypeName("users")); | ||
index++; | ||
if (index % 10 == 9) await Task.Delay(1); | ||
} | ||
//namespace OpenRPA.PS | ||
//{ | ||
// [Cmdlet(VerbsCommon.Get, "NoderedInstance")] | ||
// public class GetNoderedInstance : OpenRPACmdlet | ||
// { | ||
// [Parameter(Position = 0, ValueFromPipeline = true)] public string _id { get; set; } | ||
// [Parameter(Position = 1)] public int Minutes { get; set; } | ||
// protected override async Task ProcessRecordAsync() | ||
// { | ||
// try | ||
// { | ||
// if (Minutes < 1) Minutes = 1; | ||
// // string dt = DateTime.UtcNow.AddMinutes(Minutes).ToString("o", System.Globalization.CultureInfo.InvariantCulture); | ||
// string dt = DateTime.UtcNow.AddMinutes(-Minutes).ToString("yyyy-MM-dd'T'HH:mm:ss.fffK", System.Globalization.CultureInfo.InvariantCulture); | ||
// string json = "{\"_type\":\"user\", \"_noderedheartbeat\": { \"$gte\": \"" + dt + "\" } }"; | ||
// if (!string.IsNullOrEmpty(_id)) { json = "{\"_type\":\"user\", \"_id\": \"" + _id + "\"}"; } | ||
// var entities = await global.webSocketClient.Query<JObject>("users", json, top: 100); | ||
// int index = 0; | ||
// foreach (var entity in entities) | ||
// { | ||
// if (entity.ContainsKey("name")) | ||
// { | ||
// WriteVerbose("Parsing " + entity.Value<string>("_id") + " " + entity.Value<string>("name")); | ||
// } | ||
// else | ||
// { | ||
// WriteVerbose("Parsing " + entity.Value<string>("_id")); | ||
// } | ||
// // results.Add(obj); | ||
// WriteObject(entity.toPSObjectWithTypeName("users")); | ||
// index++; | ||
// if (index % 10 == 9) await Task.Delay(1); | ||
// } | ||
|
||
} | ||
catch (Exception ex) | ||
{ | ||
WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); | ||
} | ||
// } | ||
// catch (Exception ex) | ||
// { | ||
// WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); | ||
// } | ||
|
||
|
||
} | ||
} | ||
} | ||
// } | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using OpenRPA.Interfaces; | ||
using System.Management.Automation; | ||
using Newtonsoft.Json.Linq; | ||
using System.Collections.ObjectModel; | ||
//using System; | ||
//using System.Collections.Generic; | ||
//using System.Linq; | ||
//using System.Text; | ||
//using System.Threading.Tasks; | ||
//using OpenRPA.Interfaces; | ||
//using System.Management.Automation; | ||
//using Newtonsoft.Json.Linq; | ||
//using System.Collections.ObjectModel; | ||
|
||
namespace OpenRPA.PS | ||
{ | ||
[Cmdlet(VerbsCommon.Remove, "NoderedInstance")] | ||
public class RemoveNoderedInstance : OpenRPACmdlet | ||
{ | ||
[Parameter(Position = 0, ValueFromPipeline = true)] public string _id { get; set; } | ||
protected override async Task ProcessRecordAsync() | ||
{ | ||
try | ||
{ | ||
string traceId = ""; string spanId = ""; | ||
if (string.IsNullOrEmpty(_id)) { _id = global.webSocketClient.user._id; } | ||
await global.webSocketClient.DeleteNoderedInstance(_id, "", ""); | ||
} | ||
catch (Exception ex) | ||
{ | ||
WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); | ||
} | ||
//namespace OpenRPA.PS | ||
//{ | ||
// [Cmdlet(VerbsCommon.Remove, "NoderedInstance")] | ||
// public class RemoveNoderedInstance : OpenRPACmdlet | ||
// { | ||
// [Parameter(Position = 0, ValueFromPipeline = true)] public string _id { get; set; } | ||
// protected override async Task ProcessRecordAsync() | ||
// { | ||
// try | ||
// { | ||
// string traceId = ""; string spanId = ""; | ||
// if (string.IsNullOrEmpty(_id)) { _id = global.webSocketClient.user._id; } | ||
// await global.webSocketClient.DeleteNoderedInstance(_id, "", ""); | ||
// } | ||
// catch (Exception ex) | ||
// { | ||
// WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); | ||
// } | ||
|
||
|
||
} | ||
} | ||
} | ||
// } | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters