-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GT-1968 - Adding new async publish feature for single and bulk. (#707)
* Adding new async publish feature for single and bulk. * Fixing type errors. Disabling buttons during active requests * Adding get single resource * Adding ability to publish without Draft. Added draft/live support. Now calling resource instead of allResources when fetching publish status * Adding more tests coverage and ensuring the code is simplified. Fixed publishing error issue on the initial Post request to publish the language. * Adding an error label to show if the language had a publishing error.
- Loading branch information
Showing
14 changed files
with
818 additions
and
114 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/app/components/multiple-draft-generator/multiple-draft-generator.component.css
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.toggle-drafts { | ||
width: 100%; | ||
display: flex; | ||
margin-bottom: 15px; | ||
} | ||
|
||
.toggle-drafts label.btn { | ||
flex: 0 1 50%; | ||
} | ||
|
||
.translation-btn { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
max-width: 350px; | ||
margin: 0 auto 8px; | ||
} |
101 changes: 79 additions & 22 deletions
101
src/app/components/multiple-draft-generator/multiple-draft-generator.component.html
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,35 +1,92 @@ | ||
<div class="modal-body"> | ||
<h5>Languages without a Draft</h5> | ||
<div class="btn-group btn-group-toggle toggle-drafts" data-toggle="buttons"> | ||
<label | ||
class="btn btn-success {{ | ||
actionType === 'publish' ? 'btn-success' : 'btn-outline-success' | ||
}}" | ||
(click)="switchActionType('publish')" | ||
> | ||
Publish Languages | ||
</label> | ||
<label | ||
class="btn {{ | ||
actionType === 'createDrafts' | ||
? 'btn-secondary' | ||
: 'btn-outline-secondary' | ||
}}" | ||
(click)="switchActionType('createDrafts')" | ||
> | ||
Generate Drafts | ||
</label> | ||
</div> | ||
|
||
<div *ngFor="let translation of resource['latest-drafts-translations']"> | ||
<label | ||
class="btn-secondary btn-block" | ||
class="btn-outline-secondary btn-block translation-btn" | ||
ngbButtonLabel | ||
*ngIf="translation.is_published" | ||
*ngIf=" | ||
actionType === 'publish' || | ||
(actionType === 'createDrafts' && translation['is-published']) | ||
" | ||
> | ||
<input | ||
type="checkbox" | ||
ngbButton | ||
[(ngModel)]="translation.generateDraft" | ||
/> | ||
{{ translation.language.name }} | ||
<div class="translation-btn-text"> | ||
<input | ||
type="checkbox" | ||
ngbButton | ||
[(ngModel)]="translation.selectedForAction" | ||
/> | ||
{{ translation.language.name }} | ||
</div> | ||
<admin-translation-version-badge [translation]="translation"> | ||
</admin-translation-version-badge> | ||
</label> | ||
</div> | ||
<br /> | ||
<ngb-alert type="info" [dismissible]="false" *ngIf="saving"> | ||
Saving... | ||
|
||
<ngb-alert | ||
type="success" | ||
[dismissible]="true" | ||
*ngFor="let successMessage of sucessfulMessages" | ||
> | ||
{{ successMessage }} | ||
</ngb-alert> | ||
<ngb-alert type="danger" [dismissible]="false" *ngIf="errorMessage"> | ||
{{ errorMessage }} | ||
<ngb-alert type="info" [dismissible]="false" *ngIf="alertMessage"> | ||
{{ alertMessage }} | ||
</ngb-alert> | ||
<button class="btn btn-danger" (click)="cancel()">Cancel</button> | ||
<button class="btn btn-success" (click)="showConfirmAlert()"> | ||
Generate drafts | ||
</button> | ||
<ngb-alert type="danger" [dismissible]="false" *ngIf="confirmMessage"> | ||
{{ confirmMessage }} | ||
<button (click)="generateDrafts()" class="btn btn-dark">Confirm</button> | ||
<button (click)="confirmMessage = null" class="btn btn-secondary"> | ||
<ngb-alert | ||
type="danger" | ||
[dismissible]="false" | ||
*ngFor="let error of errorMessage" | ||
> | ||
{{ error }} | ||
</ngb-alert> | ||
|
||
<ngb-alert type="info" [dismissible]="false" *ngIf="confirmMessage"> | ||
<p>{{ confirmMessage }}</p> | ||
<div class="btn-toolbar justify-content-between"> | ||
<button (click)="confirmMessage = null" class="btn btn-danger"> | ||
Cancel | ||
</button> | ||
<button (click)="publishOrCreateDrafts()" class="btn btn-success"> | ||
Confirm | ||
</button> | ||
</div> | ||
</ngb-alert> | ||
|
||
<div class="modal-footer justify-content-between"> | ||
<button | ||
class="btn btn-secondary" | ||
(click)="cancel()" | ||
[disabled]="disableButtons" | ||
> | ||
Cancel | ||
</button> | ||
</ngb-alert> | ||
<button | ||
class="btn btn-success" | ||
(click)="showConfirmAlert()" | ||
[disabled]="disableButtons" | ||
> | ||
{{ actionType === 'publish' ? 'Publish' : 'Generate drafts' }} | ||
</button> | ||
</div> | ||
</div> |
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
Oops, something went wrong.