Skip to content

Commit

Permalink
update checking
Browse files Browse the repository at this point in the history
  • Loading branch information
ntqdinh-axonivy committed Sep 6, 2024
1 parent 7216708 commit 93e19e1
Show file tree
Hide file tree
Showing 19 changed files with 118 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const MAX_ELEMENTS = 6;
export class ProductDetailFeedbackComponent {
isMobileMode = input<boolean>();
isShowBtnMore: Signal<boolean> = computed(() => {
console.log(48);
if (
this.productFeedbackService.areAllFeedbacksLoaded() &&
(this.isMobileMode() ||
Expand All @@ -47,6 +48,7 @@ export class ProductDetailFeedbackComponent {
showPopup!: boolean;

openShowFeedbacksDialog(): void {
console.log(47);
if (this.isMobileMode()) {
this.productFeedbackService.loadMoreFeedbacks();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class FeedbackFilterComponent {
selectedSortTypeLabel: string = CommonUtils.getLabel(FEEDBACK_SORT_TYPES[0].value, FEEDBACK_SORT_TYPES);

onSortChange(event: ItemDropdown<FeedbackSortType>): void {
console.log(64);
this.selectedSortTypeLabel = CommonUtils.getLabel(event.value, FEEDBACK_SORT_TYPES);
this.sortChange.emit(event.sortFn);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,19 @@ export class ProductFeedbackComponent {

@HostListener('window:resize', ['$event'])
onResize() {
console.log(61);
this.setShowToggle();
}

private setShowToggle() {
console.log(60);

this.showToggle.set(this.contentElement.nativeElement.scrollHeight > this.contentElement.nativeElement.clientHeight);
}

toggleContent() {
console.log(59);

this.isExpanded.set(!this.isExpanded());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ export class ProductFeedbacksPanelComponent {
this.productFeedbackService.feedbacks;

onSortChange(sort: string): void {
console.log(57);

this.productFeedbackService.changeSort(sort);
}

onScrollCheckAllFeedbacksLoaded(e: Event): void {
console.log(56);
const element = e.target as CustomElement;
const threshold = 50;
const position = element.scrollTop + element.offsetHeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class AddFeedbackDialogComponent {
}

onSubmitFeedback(): void {
console.log(54);
this.productFeedbackService.submitFeedback(this.feedback).subscribe({
complete: () => {
this.activeModal.close();
Expand All @@ -65,6 +66,7 @@ export class AddFeedbackDialogComponent {
}

onRateChange(newRate: number) {
console.log(55);
this.feedback.rating = newRate;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class ProductStarRatingService {
);

fetchData(productId: string = this.productDetailService.productId()): void {
console.log(50);
const requestURL = `api/feedback/product/${productId}/rating`;
this.http
.get<StarRatingCounting[]>(requestURL, {context: new HttpContext().set(SkipLoading, true)})
Expand All @@ -41,10 +42,14 @@ export class ProductStarRatingService {
}

private sortByStar(starRatings: StarRatingCounting[]): void {
console.log(51);
console.log(starRatings);

starRatings.sort((a, b) => b.starRating - a.starRating);
}

private calculateTotalComments(starRatings: StarRatingCounting[]): number {
console.log(52);
let totalComments = 0;
starRatings.forEach(starRating => {
totalComments += starRating.commentNumber ?? 0;
Expand All @@ -53,6 +58,7 @@ export class ProductStarRatingService {
}

private calculateReviewNumber(starRatings: StarRatingCounting[]): number {
console.log(53);
let reviewNumber = 0;
const totalComments = this.calculateTotalComments(starRatings);
starRatings.forEach(starRating => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class ShowFeedbacksDialogComponent {

@HostListener('window:resize', ['$event'])
onResize() {
console.log(49);
const mediaQuery = window.matchMedia('(max-width: 767px)');
if (mediaQuery.matches) {
this.activeModal.dismiss();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,17 @@
</div>
} @else {
<button [lang]="languageService.selectedLanguage()" class="btn btn__install flex-grow-1" data-bs-toggle="tooltip"
data-bs-placement="bottom" data-bs-html="true" [attr.data-bs-title]="getInstallationTooltipText()"
data-bs-placement="bottom" data-bs-html="true" data-bs-title="<p class='text-primary'>
Please open the
<a href='https://market.axonivy.com' class='ivy__link'>
Axon Ivy Market
</a>
inside your
<a class='ivy__link' href='https://developer.axonivy.com/download'>
Axon Ivy Designer
</a>
(minimum version 9.2.0)
</p>"
(click)="onUpdateInstallationCountForDesigner()" data-bs-custom-class="custom-tooltip"
[ngClass]="themeService.isDarkMode() ? 'btn-light' : 'btn-primary'">
{{ 'common.product.detail.install.buttonLabel' | translate }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class ProductDetailVersionActionComponent implements AfterViewInit {
languageService = inject(LanguageService);

ngAfterViewInit() {
console.log(34);
const tooltipTriggerList = [].slice.call(
document.querySelectorAll('[data-bs-toggle="tooltip"]')
);
Expand All @@ -78,15 +79,8 @@ export class ProductDetailVersionActionComponent implements AfterViewInit {

}

getInstallationTooltipText() {
return `<p class="text-primary">Please open the
<a href="https://market.axonivy.com" class="ivy__link">Axon Ivy Market</a>
inside your
<a class="ivy__link" href="https://developer.axonivy.com/download">Axon Ivy Designer</a>
(minimum version 9.2.0)</p>`;
}

onSelectVersion(version : string) {
console.log(36);
this.selectedVersion.set(version);
this.artifacts.set(this.versionMap.get(this.selectedVersion()) ?? []);
this.artifacts().forEach(artifact => {
Expand All @@ -101,28 +95,33 @@ export class ProductDetailVersionActionComponent implements AfterViewInit {
}

onSelectVersionInDesigner(version: string) {
console.log(37);
this.selectedVersion.set(version);
}

onSelectArtifact(artifact: ItemDropdown) {
console.log(38);
this.selectedArtifactName = artifact.name;
this.selectedArtifact = artifact.downloadUrl;
}

onShowDevVersion(event: Event) {
console.log(39);
event.preventDefault();
this.isDevVersionsDisplayed.set(!this.isDevVersionsDisplayed());
this.getVersionWithArtifact();
}

onShowVersionAndArtifact() {
console.log(40);
if (!this.isDropDownDisplayed() && this.artifacts().length === 0) {
this.getVersionWithArtifact();
}
this.isDropDownDisplayed.set(!this.isDropDownDisplayed());
}

getVersionWithArtifact() {
console.log(41);
this.sanitizeDataBeforeFetching();
this.productService
.sendRequestToProductDetailVersionAPI(
Expand Down Expand Up @@ -150,6 +149,7 @@ export class ProductDetailVersionActionComponent implements AfterViewInit {


getVersionInDesigner(): void {
console.log(42);
if (this.versions().length === 0) {
this.productService.sendRequestToGetProductVersionsForDesigner(this.productId
).subscribe(data => {
Expand All @@ -165,13 +165,15 @@ export class ProductDetailVersionActionComponent implements AfterViewInit {
}

sanitizeDataBeforeFetching() {
console.log(43);
this.versions.set([]);
this.artifacts.set([]);
this.selectedArtifact = '';
this.selectedVersion.set('');
}

downloadArtifact() {
console.log(44);
this.onUpdateInstallationCount();
const newTab = window.open(this.selectedArtifact, '_blank');
if (newTab) {
Expand All @@ -181,12 +183,14 @@ export class ProductDetailVersionActionComponent implements AfterViewInit {
}

onUpdateInstallationCount() {
console.log(45);
this.productService
.sendRequestToUpdateInstallationCount(this.productId)
.subscribe((data: number) => this.installationCount.emit(data));
}

onUpdateInstallationCountForDesigner() {
console.log(46);
if (this.isDesignerEnvironment()) {
this.onUpdateInstallationCount();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ <h4 class="analysis-title text-primary text-capitalize mb-0">
[(selectedVersion)]="selectedVersion!"
[(metaDataJsonUrl)]="metaProductJsonUrl!"
[productId]="productDetail().id"
[product]="productDetail()"
(selectedVersionChange)="
loadDetailTabs($event)
"></app-product-version-action>
Expand Down Expand Up @@ -152,8 +151,9 @@ <h4 class="analysis-title text-primary text-capitalize mb-0">
</div>
</div>
</div>
{{ productModuleContent() | missingReadmeContent }}
<div class="tab-content col-12 default-cursor">
@if (!isEmptyProductContent()) {
@if (!(productModuleContent() | missingReadmeContent)) {
<div
class="tab-pane fade show"
[class.active]="activeTab === 'description'"
Expand Down
Loading

0 comments on commit 93e19e1

Please sign in to comment.