您好,我有一个 Angular 应用程序,它实时显示在调度程序引擎中运行的进程的状态。我有下表来显示这些进程:
我想要的是根据状态动态更改行背景颜色,如下所示:
S(开始)——白色;
W(工作)——蓝色;
E(错误)——红色;
F(成品)——绿色;
html
<table mat-table [dataSource]="this.dataSource" multiTemplateDataRows class="mat-elevation-z8" >
<!--- Note that these columns can be defined in any order.
The actual rendered columns are set as a property on the row definition" -->
<ng-container matColumnDef="expandedDetail">
<td mat-cell *matCellDef="let element" [attr.colspan]="displayedColumns.length">
<div class="example-element-detail" [@detailExpand]="element == expandedElement ? 'expanded' : 'collapsed'" *ngIf="log_message">
<div class="example-element-description">
<p *ngIf="this.log_message">Log Message:</p>
<p *ngIf="!this.log_message">N/A</p>
<pre *ngIf="this.log_message"> {{ this.log_message }} </pre>
</div>
</div>
</td>
</ng-container>
<ng-container matColumnDef="UPD_DATE">
<th mat-header-cell *matHeaderCellDef> UPD_DATE …
Run Code Online (Sandbox Code Playgroud) 正如SignalR 差异文档中所说,我们可以在 .NET 4.6.1 及更高版本上使用 SignalR Core...
所以我知道两种情况下启动和配置的代码:
SignalR 核心:
配置服务
//Add SignalR service
services.AddSignalR();
Run Code Online (Sandbox Code Playgroud)
启动
app.UseSignalR(routes =>
{
routes.MapHub<NotificationsHub>("/notification");
});
Run Code Online (Sandbox Code Playgroud)
信号R:
启动
app.Map("/signalr", map =>
{
map.UseCors(CorsOptions.AllowAll);
var hubConfiguration = new HubConfiguration { };
hubConfiguration.EnableDetailedErrors = true;
map.RunSignalR(hubConfiguration);
});
Run Code Online (Sandbox Code Playgroud)
我的问题是,我需要在 .NET 4.6.1 启动中做什么来映射我的 SignalR 集线器等等......?我找不到有关此特定案例的任何文档。
更新 1: 我尝试运行相同的代码,显然更改了客户端代码以使用 SignalR 核心方法,我现在得到的是(未授权)在协商请求期间。
由于没有用于测试 CosmosDb 的文档,因此我正在尝试自己进行测试,但我无法做到。例如,我想测试一个如下所示的插入方法:
public async Task AddSignalRConnectionAsync(ConnectionData connection)
{
if (connection != null)
{
await this.container.CreateItemAsync<ConnectionData>(connection, new PartitionKey(connection.ConnectionId));
}
}
Run Code Online (Sandbox Code Playgroud)
我需要做的是测试这个方法是否成功地在 cosmosDb 上创建了一个项目,或者至少伪造了一个成功的创建。我该如何测试?
我是 Azure 数据工厂的新手。在开发管道时,我在 Azure 数据工厂中找不到撤消操作。ctrl+z
不工作。撤消的键盘快捷键是什么?
在我的应用程序中,我有几个像这样使用 signalR 的屏幕。该函数称为 useEffect 函数,它的工作原理是:
const setupSignalR = () =>
{
SecureStore.getItemAsync("token").then(tk => {
let connection = new HubConnectionBuilder()
.withUrl("URL", {
accessTokenFactory: () => tk
})
.build();
connection.on("Update", function (message) {
//DOSTUFF
});
connection.start()
.then(() => console.log("connection started"))
.catch(err => console.log("connecting hub failed err is : ", err));
});
}
Run Code Online (Sandbox Code Playgroud)
问题是,如果我离开屏幕,连接将保持打开状态,当我返回屏幕时,我会打开另一个连接,这意味着我现在同时打开了 2 个连接。我知道 signalR 有一个可以调用的停止函数,所以我尝试使用这样的导航侦听器,但它们没有被调用:
useEffect(() =>
{
Load();
setupSignalR();
const unsubscribe = navigation.addListener('focus', () => {
});
const sub = navigation.addListener('blur', () => {
console.log("============");
});
}, [navigation]);
Run Code Online (Sandbox Code Playgroud)
我通常通过按后退按钮或使用 …
我正在SignalRConnectionInfo
Azure 函数中使用输入绑定。在此绑定中,我需要提供userId
当前主体的 ,但默认情况下,Azure 函数仅支持使用应用服务身份验证中的预定义标头,如此处和以下示例中所述:
[FunctionName("negotiate")]
public static SignalRConnectionInfo Negotiate(
[HttpTrigger(AuthorizationLevel.Anonymous)]HttpRequest req,
[SignalRConnectionInfo(HubName = "foo", UserId = "{headers.x-ms-client-principal-id}")] SignalRConnectionInfo connectionInfo)
{
return connectionInfo;
}
Run Code Online (Sandbox Code Playgroud)
由于我没有使用应用程序服务身份验证,并且不希望这样做,因此这不适合我的需求。
我目前拥有的是一个 JWT,用户将其提供给我们在另一个应用服务中托管的 API,以便对请求进行身份验证并识别自己的身份。如何修改绑定UserId
的属性SignalRConnectionInfo
以从该 JWT 中的声明中检索 UserId?
我想创建一个微服务来并行处理我通过push
Azure Service Bus 获得的一些任务。如果任务成功完成,此微服务将通知Azure服务总线。请参见下图:
我已经考虑了以下三个选项:
由于先决条件之一就是该微服务必须位于.NET Core 3中,因此是否有使用Web Jobs代替Hosted Services的正当理由?哪个选项可确保鲁棒性和可扩展性?
我在类库(项目“A”)上有这个对象,我想在多个项目(“B”和“C”)中使用它:
public class Notification : INotification
{
public string Id { get; set; }
public int Type { get; set; }
public IList<Message> Messages { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
public class Message: IMessage
{
public string Key { get; set; }
public string Value { get; set; }
public string Culture { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
public interface INotification
{
string Id { get; set; }
int Type { get; set; }
IList<Message> Messages { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
现在,如果我想在我的项目“B”上创建这个对象,我需要执行以下操作: …
c# ×3
signalr ×2
.net-4.6.1 ×1
angular ×1
css ×1
html ×1
inheritance ×1
interface ×1
mocking ×1
moq ×1
object ×1
react-native ×1
unit-testing ×1
worker ×1