Skip to content

Commit

Permalink
EFRS-1173 examples number displayes only amount of uploaded images ev…
Browse files Browse the repository at this point in the history
…en while uploading is still in process
  • Loading branch information
smchedlidze826 committed Nov 27, 2021
1 parent d6a2e46 commit 78885bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
>{{ 'manage_collection.right_side.selected_examples' | translate }} {{ selectedIds.length }}</ng-container
>
<ng-container *ngSwitchDefault
>{{ 'manage_collection.right_side.examples' | translate }} {{ collectionItems.length }}</ng-container
>{{ 'manage_collection.right_side.examples' | translate }} {{ uploadedExamples.length }}</ng-container
>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { CircleLoadingProgressEnum } from 'src/app/data/enums/circle-loading-progress.enum';
import { SubjectModeEnum } from 'src/app/data/enums/subject-mode.enum';
import { CollectionItem } from 'src/app/data/interfaces/collection';

Expand All @@ -22,10 +23,11 @@ import { CollectionItem } from 'src/app/data/interfaces/collection';
templateUrl: './collection-manager-subject-right.component.html',
styleUrls: ['./collection-manager-subject-right.component.scss'],
})
export class CollectionManagerSubjectRightComponent {
export class CollectionManagerSubjectRightComponent implements OnChanges {
scrollWindow: boolean = false;
prevItemCollection: CollectionItem[] = [];
subjectModeEnum = SubjectModeEnum;
uploadedExamples: CollectionItem[] = [];

@Input() isPending: boolean;
@Input() isCollectionPending: boolean;
Expand All @@ -49,8 +51,18 @@ export class CollectionManagerSubjectRightComponent {
@Output() selectExample = new EventEmitter<CollectionItem>();
@Output() loadMore = new EventEmitter<CollectionItem>();

ngOnChanges(changes: SimpleChanges) {
const change = changes['collectionItems'];

if (change && change['currentValue'] !== change['previousValue']) {
const examples = this.collectionItems.filter(item => item.status === CircleLoadingProgressEnum.Uploaded);

this.uploadedExamples = examples;
}
}

onScrollDown(): void {
const lastItem = this.collectionItems[this.collectionItems.length - 1];
const lastItem = this.uploadedExamples[this.uploadedExamples.length - 1];
const nextPage = lastItem['page'] + 1;
const totalPages = lastItem['totalPages'];

Expand Down

0 comments on commit 78885bc

Please sign in to comment.