Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/2406 #2476

Merged
merged 7 commits into from
Jul 31, 2023
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
12 changes: 6 additions & 6 deletions api-gateway/src/api/service/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class NotificationsApi {
@ApiExtraModels(NotificationDTO, InternalServerErrorDTO)
@ApiOkResponse({
description:
'Successful operation. Suggested next and nested block types respectively.',
'Successful operation. Returns notifications and count.',
schema: {
type: 'array',
items: {
Expand Down Expand Up @@ -96,7 +96,7 @@ export class NotificationsApi {
@ApiExtraModels(NotificationDTO, InternalServerErrorDTO)
@ApiOkResponse({
description:
'Successful operation. Suggested next and nested block types respectively.',
'Successful operation. Returns new notifications.',
schema: {
type: 'array',
items: {
Expand Down Expand Up @@ -139,7 +139,7 @@ export class NotificationsApi {
@ApiExtraModels(ProgressDTO, InternalServerErrorDTO)
@ApiOkResponse({
description:
'Successful operation. Suggested next and nested block types respectively.',
'Successful operation. Returns progresses.',
schema: {
type: 'array',
items: {
Expand Down Expand Up @@ -180,7 +180,7 @@ export class NotificationsApi {
@ApiExtraModels(NotificationDTO, InternalServerErrorDTO)
@ApiOkResponse({
description:
'Successful operation. Suggested next and nested block types respectively.',
'Successful operation. Returns notifications.',
schema: {
type: 'array',
items: {
Expand Down Expand Up @@ -215,7 +215,7 @@ export class NotificationsApi {

@ApiOperation({
summary: 'Delete notifications up to this point',
description: 'Returns deleted count.',
description: 'Returns deleted notifications count.',
})
@ApiSecurity('bearerAuth')
@ApiExtraModels(InternalServerErrorDTO)
Expand All @@ -225,7 +225,7 @@ export class NotificationsApi {
})
@ApiOkResponse({
description:
'Successful operation. Suggested next and nested block types respectively.',
'Successful operation. Returns deleted notifications count.',
schema: {
type: 'number',
},
Expand Down
1 change: 1 addition & 0 deletions auth-service/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Promise.all([
NestFactory.createMicroservice<MicroserviceOptions>(AppModule,{
transport: Transport.NATS,
options: {
queue: 'auth-service',
name: `${process.env.SERVICE_CHANNEL}`,
servers: [
`nats://${process.env.MQ_ADDRESS}:4222`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ export class NotificationComponent implements OnInit {
}

viewProgress(taskId: string) {
this.router.navigate(['task', taskId]);
this.router.navigate(['task', taskId], {
replaceUrl: this.router.url.startsWith('/task'),
});
}

onScrollNotifications(event: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,24 @@ export class AsyncProgressComponent implements OnInit, OnDestroy {
this.wsService.updateProfile();
this.router.navigate([
this.userRole === UserRole.USER ? 'user-profile' : 'config',
]);
], {
replaceUrl: true,
});
return;
case TaskAction.DELETE_TOKEN:
case TaskAction.UPDATE_TOKEN:
case TaskAction.CREATE_TOKEN:
this.router.navigate(['tokens']);
this.router.navigate(['tokens'], {
replaceUrl: true,
});
break;
case TaskAction.CLONE_POLICY:
case TaskAction.CREATE_POLICY:
this.router.navigate(['policy-configuration'], {
queryParams: {
policyId: result,
},
replaceUrl: true,
});
break;
case TaskAction.IMPORT_POLICY_FILE:
Expand All @@ -164,6 +169,7 @@ export class AsyncProgressComponent implements OnInit, OnDestroy {
queryParams: {
policyId: result.policyId,
},
replaceUrl: true,
});
break;
case TaskAction.WIZARD_CREATE_POLICY:
Expand All @@ -177,6 +183,7 @@ export class AsyncProgressComponent implements OnInit, OnDestroy {
queryParams: {
policyId,
},
replaceUrl: true,
});
break;
case TaskAction.PUBLISH_POLICY:
Expand Down Expand Up @@ -205,26 +212,32 @@ export class AsyncProgressComponent implements OnInit, OnDestroy {
text.join(''),
'The policy is invalid'
);
return;
}
this.router.navigate(['policy-configuration'], {
queryParams: {
policyId,
},
replaceUrl: true,
});
}
break;
case TaskAction.DELETE_POLICY:
this.router.navigate(['policies']);
this.router.navigate(['policies'], {
replaceUrl: true,
});
break;
case TaskAction.CREATE_SCHEMA:
localStorage.removeItem('restoreSchemaData');
this.router.navigate(['schemas']);
this.router.navigate(['schemas'], {
replaceUrl: true,
});
break;
case TaskAction.PUBLISH_SCHEMA:
case TaskAction.IMPORT_SCHEMA_FILE:
case TaskAction.IMPORT_SCHEMA_MESSAGE:
this.router.navigate(['schemas']);
this.router.navigate(['schemas'], {
replaceUrl: true,
});
break;
}
}
Expand All @@ -240,12 +253,16 @@ export class AsyncProgressComponent implements OnInit, OnDestroy {
case TaskAction.CONNECT_USER:
this.router.navigate([
this.userRole === UserRole.USER ? 'user-profile' : 'config',
]);
], {
replaceUrl: true,
});
break;
case TaskAction.DELETE_TOKEN:
case TaskAction.UPDATE_TOKEN:
case TaskAction.CREATE_TOKEN:
this.router.navigate(['tokens']);
this.router.navigate(['tokens'], {
replaceUrl: true,
});
break;
case TaskAction.CLONE_POLICY:
case TaskAction.CREATE_POLICY:
Expand All @@ -254,13 +271,17 @@ export class AsyncProgressComponent implements OnInit, OnDestroy {
case TaskAction.WIZARD_CREATE_POLICY:
case TaskAction.PUBLISH_POLICY:
case TaskAction.DELETE_POLICY:
this.router.navigate(['policies']);
this.router.navigate(['policies'], {
replaceUrl: true,
});
break;
case TaskAction.CREATE_SCHEMA:
case TaskAction.PUBLISH_SCHEMA:
case TaskAction.IMPORT_SCHEMA_FILE:
case TaskAction.IMPORT_SCHEMA_MESSAGE:
this.router.navigate(['schemas']);
this.router.navigate(['schemas'], {
replaceUrl: true,
});
break;
}
}
Expand Down
1 change: 1 addition & 0 deletions guardian-service/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Promise.all([
NestFactory.createMicroservice<MicroserviceOptions>(AppModule,{
transport: Transport.NATS,
options: {
queue: 'guardian-service',
name: `${process.env.SERVICE_CHANNEL}`,
servers: [
`nats://${process.env.MQ_ADDRESS}:4222`
Expand Down
2 changes: 1 addition & 1 deletion guardian-service/src/helpers/notifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function getNotificationResultMessage(action: TaskAction, result: any) {
function getNotificationResultTitle(action: TaskAction, result: any) {
switch (action) {
case TaskAction.PUBLISH_POLICY:
if (result.errors && result.errors.length > 0) {
if (!result.isValid) {
return;
}
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,23 +249,32 @@ export class PolicyImportExportHelper {
await DatabaseServer.saveTopic(topicRow.toObject());
}

notifier.completed();
policy.topicId = topicRow.topicId;
notifier.start('Publish Policy in Hedera');
const messageServer = new MessageServer(root.hederaAccountId, root.hederaAccountKey);
const message = new PolicyMessage(MessageType.Policy, MessageAction.CreatePolicy);
message.setDocument(policy);
const messageStatus = await messageServer
.setTopicObject(parent)
.sendMessage(message);
notifier.completedAndStart('Link topic and policy');
await topicHelper.twoWayLink(topicRow, parent, messageStatus.getId());
notifier.completedAndStart('Publishing schemas');
const systemSchemas = await PolicyImportExportHelper.getSystemSchemas();
notifier.info(`Found ${systemSchemas.length} schemas`);
messageServer.setTopicObject(topicRow);

await publishSystemSchemas(systemSchemas, messageServer, policyOwner, notifier);

if (!versionOfTopicId) {
notifier.completedAndStart('Publish Policy in Hedera');
const messageServer = new MessageServer(root.hederaAccountId, root.hederaAccountKey);
const message = new PolicyMessage(MessageType.Policy, MessageAction.CreatePolicy);
message.setDocument(policy);
const messageStatus = await messageServer
.setTopicObject(parent)
.sendMessage(message);
notifier.completedAndStart('Link topic and policy');
await topicHelper.twoWayLink(
topicRow,
parent,
messageStatus.getId()
);

notifier.completedAndStart('Publishing schemas');
const systemSchemas = await PolicyImportExportHelper.getSystemSchemas();
notifier.info(`Found ${systemSchemas.length} schemas`);
messageServer.setTopicObject(topicRow);
await publishSystemSchemas(systemSchemas, messageServer, policyOwner, notifier);
} else {
notifier.completedAndStart('Skip publishing policy in Hedera');
notifier.completedAndStart('Skip publishing schemas');
}

notifier.completed();

Expand Down
1 change: 1 addition & 0 deletions logger-service/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Promise.all([
NestFactory.createMicroservice<MicroserviceOptions>(AppModule,{
transport: Transport.NATS,
options: {
queue: 'logger-service',
name: `${process.env.SERVICE_CHANNEL}`,
servers: [
`nats://${process.env.MQ_ADDRESS}:4222`
Expand Down
22 changes: 6 additions & 16 deletions swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6523,9 +6523,7 @@ paths:
parameters: []
responses:
'200':
description: >-
Successful operation. Suggested next and nested block types
respectively.
description: Successful operation. Returns notifications and count.
headers:
X-Total-Count:
description: Count of notifications
Expand Down Expand Up @@ -6556,9 +6554,7 @@ paths:
parameters: []
responses:
'200':
description: >-
Successful operation. Suggested next and nested block types
respectively.
description: Successful operation. Returns new notifications.
content:
application/json:
schema:
Expand All @@ -6585,9 +6581,7 @@ paths:
parameters: []
responses:
'200':
description: >-
Successful operation. Suggested next and nested block types
respectively.
description: Successful operation. Returns progresses.
content:
application/json:
schema:
Expand All @@ -6614,9 +6608,7 @@ paths:
parameters: []
responses:
'200':
description: >-
Successful operation. Suggested next and nested block types
respectively.
description: Successful operation. Returns notifications.
content:
application/json:
schema:
Expand All @@ -6639,7 +6631,7 @@ paths:
delete:
operationId: NotificationsApi_delete
summary: Delete notifications up to this point
description: Returns deleted count.
description: Returns deleted notifications count.
parameters:
- name: notificationId
required: true
Expand All @@ -6648,9 +6640,7 @@ paths:
type: string
responses:
'200':
description: >-
Successful operation. Suggested next and nested block types
respectively.
description: Successful operation. Returns deleted notifications count.
content:
application/json:
schema:
Expand Down