Browse Source

History completed

pull/1/head
Sebastian 9 years ago
parent
commit
9fabb00bcb
  1. 17
      src/Squidex.Store.MongoDb/History/Messages.cs
  2. 26
      src/Squidex.Store.MongoDb/History/MessagesEN.cs
  3. 67
      src/Squidex.Store.MongoDb/History/MongoHistoryEventRepository.cs
  4. 2
      src/Squidex.Write/Apps/ClientKeyGenerator.cs
  5. 4
      src/Squidex/app/features/settings/pages/clients/client.component.html
  6. 4
      src/Squidex/app/features/settings/pages/clients/client.component.scss
  7. 5
      src/Squidex/app/features/settings/pages/clients/client.component.ts
  8. 2
      src/Squidex/app/features/settings/pages/clients/clients-page.component.html
  9. 4
      src/Squidex/app/features/settings/pages/clients/clients-page.component.scss
  10. 6
      src/Squidex/app/shared/components/history.component.ts
  11. 2
      src/Squidex/app/shared/services/app-languages.service.ts
  12. 1
      src/Squidex/app/shell/pages/internal/internal-area.component.scss
  13. 4
      src/Squidex/app/theme/_history.scss

17
src/Squidex.Store.MongoDb/History/Messages.cs

@ -1,17 +0,0 @@
// ==========================================================================
// Messages.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
namespace Squidex.Store.MongoDb.History
{
public static class Messages
{
public const string AppCreated = "AppCreated";
public const string AppContributor = "SchemaDeleted";
}
}

26
src/Squidex.Store.MongoDb/History/MessagesEN.cs

@ -19,11 +19,35 @@ namespace Squidex.Store.MongoDb.History
{
{
TypeNameRegistry.GetName<AppContributorAssigned>(),
"assigned {user:[Contributor]} to app with permission [Permission]"
"assigned {user:[Contributor]} as [Permission]"
},
{
TypeNameRegistry.GetName<AppContributorRemoved>(),
"removed {user:[Contributor]} from app"
},
{
TypeNameRegistry.GetName<AppClientAttached>(),
"added client {[Id]} to app"
},
{
TypeNameRegistry.GetName<AppClientRevoked>(),
"revoked client {[Id]}"
},
{
TypeNameRegistry.GetName<AppClientRenamed>(),
"renamed client {[Id]} to {[Name]}"
},
{
TypeNameRegistry.GetName<AppLanguageAdded>(),
"added language {[Language]}"
},
{
TypeNameRegistry.GetName<AppLanguageRemoved>(),
"removed language {[Language]}"
},
{
TypeNameRegistry.GetName<AppMasterLanguageSet>(),
"changed master language to {[Language]}"
}
};
}

67
src/Squidex.Store.MongoDb/History/MongoHistoryEventRepository.cs

@ -72,6 +72,73 @@ namespace Squidex.Store.MongoDb.History
}, false);
}
protected Task On(AppClientRenamed @event, EnvelopeHeaders headers)
{
return Collection.CreateAsync(headers, x =>
{
const string channel = "settings.clients";
x.Setup<AppClientRenamed>(headers, channel)
.AddParameter("Id", @event.Id)
.AddParameter("Name", !string.IsNullOrWhiteSpace(@event.Name) ? @event.Name : @event.Id);
}, false);
}
protected Task On(AppClientAttached @event, EnvelopeHeaders headers)
{
return Collection.CreateAsync(headers, x =>
{
const string channel = "settings.clients";
x.Setup<AppClientAttached>(headers, channel)
.AddParameter("Id", @event.Id);
}, false);
}
protected Task On(AppClientRevoked @event, EnvelopeHeaders headers)
{
return Collection.CreateAsync(headers, x =>
{
const string channel = "settings.clients";
x.Setup<AppClientRevoked>(headers, channel)
.AddParameter("Id", @event.Id);
}, false);
}
protected Task On(AppLanguageAdded @event, EnvelopeHeaders headers)
{
return Collection.CreateAsync(headers, x =>
{
const string channel = "settings.languages";
x.Setup<AppLanguageAdded>(headers, channel)
.AddParameter("Language", @event.Language.EnglishName);
}, false);
}
protected Task On(AppLanguageRemoved @event, EnvelopeHeaders headers)
{
return Collection.CreateAsync(headers, x =>
{
const string channel = "settings.languages";
x.Setup<AppLanguageRemoved>(headers, channel)
.AddParameter("Language", @event.Language.EnglishName);
}, false);
}
protected Task On(AppMasterLanguageSet @event, EnvelopeHeaders headers)
{
return Collection.CreateAsync(headers, x =>
{
const string channel = "settings.languages";
x.Setup<AppMasterLanguageSet>(headers, channel)
.AddParameter("Language", @event.Language.EnglishName);
}, false);
}
public Task On(Envelope<IEvent> @event)
{
return this.DispatchActionAsync(@event.Payload, @event.Headers);

2
src/Squidex.Write/Apps/ClientKeyGenerator.cs

@ -26,7 +26,7 @@ namespace Squidex.Write.Apps
var bytes = Encoding.UTF8.GetBytes(input);
var hash = sha.ComputeHash(bytes);
return Convert.ToBase64String(hash);
return Convert.ToBase64String(hash).Replace("+", "x");
}
}
}

4
src/Squidex/app/features/settings/pages/clients/client.component.html

@ -26,14 +26,14 @@
</form>
<h3 *ngIf="!isRenaming">
{{client.name}} <i class="client-edit icon-pencil" (click)="startRename()"></i>
<span (dblclick)="startRename()">{{client.name}}</span> <i class="client-edit icon-pencil" (click)="startRename()"></i>
</h3>
</div>
<div class="client-expires">Expires: {{client.expiresUtc}}</div>
</td>
<td class="client-delete">
<button type="button" class="btn btn-link btn-danger" (click)="revokeClient(client)">
<button type="button" class="btn btn-link btn-danger" (click)="revoked.emit()">
<i class="icon-bin"></i>
</button>
</td>

4
src/Squidex/app/features/settings/pages/clients/client.component.scss

@ -38,10 +38,6 @@
h3 {
font-size: 1.6rem;
}
.form-control {
width: 250px;
}
}
}

5
src/Squidex/app/features/settings/pages/clients/client.component.ts

@ -36,6 +36,9 @@ export class ClientComponent {
@Output()
public renamed = new EventEmitter<string>();
@Output()
public revoked = new EventEmitter();
@Input()
public client: AppClientDto;
@ -93,7 +96,7 @@ export class ClientComponent {
const newName = this.renameForm.controls['name'].value;
if (newName !== this.clientName) {
this.renamed.emit();
this.renamed.emit(newName);
}
} finally {
this.isRenaming = false;

2
src/Squidex/app/features/settings/pages/clients/clients-page.component.html

@ -16,7 +16,7 @@
</div>
<div *ngFor="let client of appClients">
<sqx-client [client]="client" [appName]="appName() | async" (renamed)="renameClient(client, $event)"></sqx-client>
<sqx-client [client]="client" [appName]="appName() | async" (renamed)="renameClient(client, $event)" (revoked)="revokeClient(client)"></sqx-client>
</div>
<div class="table-items-footer">

4
src/Squidex/app/features/settings/pages/clients/clients-page.component.scss

@ -2,8 +2,8 @@
@import '_mixins';
.panel {
min-width: 600px;
max-width: 600px;
min-width: 700px;
max-width: 700px;
}
.card {

6
src/Squidex/app/shared/components/history.component.ts

@ -47,7 +47,7 @@ export class HistoryComponent extends AppComponentBase implements OnDestroy, OnI
this.interval =
setInterval(() => {
this.load();
}, 10000);
}, 5000);
}
public load() {
@ -82,6 +82,10 @@ export class HistoryComponent extends AppComponentBase implements OnDestroy, OnI
}
});
message = message.replace(/{([^\s:]*)}/, (match: string, marker: string) => {
return `<span class="marker-ref">${marker}</span>`;
});
if (foundUserId) {
return this.userName(foundUserId).map(t => message.replace(REPLACEMENT_TEMP, `<span class="user-ref">${t}</span>`));
}

2
src/Squidex/app/shared/services/app-languages.service.ts

@ -23,7 +23,7 @@ export class AppLanguageDto {
export class AddAppLanguageDto {
constructor(
public readonly name: string
public readonly language: string
) {
}
}

1
src/Squidex/app/shell/pages/internal/internal-area.component.scss

@ -24,6 +24,7 @@
&-container {
@include fixed(auto, 10px, 10px, auto);
width: 260px;
z-index: 100000;
}
&-item {

4
src/Squidex/app/theme/_history.scss

@ -3,4 +3,8 @@
.user-ref {
color: $color-theme-blue-dark;
}
.marker-ref {
color: $color-theme-blue-dark;
}
Loading…
Cancel
Save