Skip to content

Commit a0b3497

Browse files
Merge pull request #390 from albrechtflo-hg/bugfix_producer_staging
Bugfix: Include add. producers in staging when topic is to be created
2 parents 25b4352 + b991a1c commit a0b3497

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

src/main/java/com/hermesworld/ais/galapagos/staging/impl/StagingImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,13 @@ private static ApplicableChange checkForCreateTopic(TopicMetadata topic, String
190190

191191
ChangeBase createChange = ChangeBase.createTopic(topic, createParams);
192192
if (topic.getType() != TopicType.INTERNAL) {
193+
List<ChangeBase> additionalChanges = new ArrayList<>();
193194
ChangeBase firstSchemaChange = ChangeBase.publishTopicSchemaVersion(topic.getName(), firstSchema);
194-
return ChangeBase.compoundChange(createChange, List.of(firstSchemaChange));
195+
additionalChanges.add(firstSchemaChange);
196+
for (String producer : topic.getProducers()) {
197+
additionalChanges.add(ChangeBase.addTopicProducer(topic.getName(), producer));
198+
}
199+
return ChangeBase.compoundChange(createChange, additionalChanges);
195200
}
196201

197202
return createChange;
@@ -237,7 +242,6 @@ private static List<ApplicableChange> checkForTopicChanges(TopicMetadata oldTopi
237242

238243
toBeDeletedIds
239244
.forEach(producerId -> result.add(ChangeBase.removeTopicProducer(newTopic.getName(), producerId)));
240-
241245
}
242246

243247
return result;

ui/src/app/layout/staging/staging.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ <h2 class="text-muted">{{ 'Staging' }}</h2>
8282
<li *ngFor="let result of stagingResult" [class.text-danger]="!result.stagingSuccessful" [class.text-success]="result.stagingSuccessful">
8383
<span *ngIf="!result.stagingSuccessful" class="me-3"><i class="fas fa-times"></i></span>
8484
<span *ngIf="result.stagingSuccessful" class="me-3"><i class="fas fa-check"></i></span>
85-
<span [innerHTML]="stagingText(result.change)"></span>
85+
<span [innerHTML]="stagingText(result.change, true)"></span>
8686
<span *ngIf="!result.stagingSuccessful">
8787
<br>
8888
<span style="font-size: smaller">{{ result.errorMessage }}</span>

ui/src/app/layout/staging/staging.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class StagingComponent implements OnInit {
123123
});
124124
}
125125

126-
stagingText(change: any): string {
126+
stagingText(change: any, isResult: boolean = false): string {
127127
const changeType = change.changeType;
128128

129129
switch (changeType) {
@@ -158,6 +158,9 @@ export class StagingComponent implements OnInit {
158158
return this.translate.instant('TOPIC_SUBSCRIPTION_APPROVAL_REQUIRED_FLAG_UPDATED_STAGING',
159159
{ topicName: change.topicMetadata.name });
160160
case 'COMPOUND_CHANGE':
161+
if (isResult && change.additionalChanges && change.additionalChanges.length) {
162+
return this.stagingText(change.mainChange) + this.translate.instant('COMPOUND_CHANGE_COUNT', { count: change.additionalChanges.length });
163+
}
161164
return this.stagingText(change.mainChange);
162165
}
163166
return this.translate.instant('OTHER_CHANGE_STAGING', { changeType: changeType });

ui/src/assets/i18n/de.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@
301301
"APP_SUBSCRIPTION_CANNOT_BE_REVOKED": "Der Anwendung konnten die Rechte für dieses Topic nicht entzogen werden.",
302302
"APP_SUCCESSFUL_TOPIC_APPROVED": "Die Anwendung wurde erfolgreich für dieses Topic freigegeben.",
303303
"APP_TOPIC_APPROVED_FAILED": "Die Anwendung konnte nicht für dieses Topic freigegeben werden'",
304-
"INVALID_APP_TOOLTIP": "Diese Anwendung sollte nicht mehr verwendet werden."
304+
"INVALID_APP_TOOLTIP": "Diese Anwendung sollte nicht mehr verwendet werden.",
305+
"COMPOUND_CHANGE_COUNT": " (und {{count}} weitere Aktion(en))"
305306
}
306307

ui/src/assets/i18n/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,6 @@
208208
"APP_SUBSCRIPTION_CANNOT_BE_REVOKED": "The application's rights for this topic could not be revoked.",
209209
"APP_SUCCESSFUL_TOPIC_APPROVED": "The application was successfully approved for this topic.",
210210
"APP_TOPIC_APPROVED_FAILED": "The application could not be approved for this topic",
211-
"INVALID_APP_TOOLTIP": "This application should no longer be used."
211+
"INVALID_APP_TOOLTIP": "This application should no longer be used.",
212+
"COMPOUND_CHANGE_COUNT": " (and {{count}} more action(s))"
212213
}
213-

0 commit comments

Comments
 (0)