Skip to content

Commit ee6ba18

Browse files
committed
more minor fixes
1 parent 34fb461 commit ee6ba18

File tree

9 files changed

+31
-13
lines changed

9 files changed

+31
-13
lines changed

src/components/template-pages/api-details-page/ko/runtime/staticPages/api-products-cards.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ <h5>Legal</h5>
8282
<hr class="mt-20 mb-20" />
8383

8484
<div class="commands">
85-
<a class="outlined" href="#" data-bind="attr: { href: getProductUrl(quickViewProduct) }">
85+
<a class="outlined" href="#" data-bind="attr: { href: getProductUrl(quickViewProduct()) }">
8686
View Product
8787
</a>
8888
</div>

src/components/template-pages/api-details-page/ko/runtime/staticPages/api-products-cards.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class ApiProductsCards {
7878
}
7979

8080
public getProductUrl(product: Product): string {
81-
return this.routeHelper.getProductReferenceUrl(product.name, "product");
81+
return this.routeHelper.getProductReferenceUrl(product.name, "/product");
8282
}
8383

8484
private async onRouteChange(): Promise<void> {

src/components/template-pages/product-details-page/ko/runtime/product-details-page.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div id="widgetPopupContainer" class="widget-popup-container" data-bind="css: { 'show': showSubscribeForm() }">
22
<div class="popup-content">
33
<subscription-form
4-
params="{closeSubscriptionForm: closeSubscriptionForm, product: product}"></subscription-form>
4+
params="{closeSubscriptionForm: closeSubscriptionForm, product: product, subscriptionCreated: subscriptionCreated}"></subscription-form>
55
</div>
66
</div>
77

@@ -58,7 +58,7 @@ <h3>About this Product</h3>
5858

5959
<!-- ko if: selectedMenuItem()?.value === 'subscriptions' -->
6060
<product-details-page-subscriptions
61-
params="{ product: product, openSubscriptionForm: openSubscriptionForm, canCreateNewSubscription: canCreateNewSubscription, calculateCanCreateNewSubscription: calculateCanCreateNewSubscription }"></product-details-page-subscriptions>
61+
params="{ product: product, openSubscriptionForm: openSubscriptionForm, canCreateNewSubscription: canCreateNewSubscription, calculateCanCreateNewSubscription: calculateCanCreateNewSubscription, subscriptionCreated: subscriptionCreated }"></product-details-page-subscriptions>
6262
<!-- /ko -->
6363
<!-- /ko -->
6464

src/components/template-pages/product-details-page/ko/runtime/product-details-page.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class ProductDetailsPage {
2323
public readonly selectedMenuItem: ko.Observable<menuItem>;
2424
public readonly showSubscribeForm: ko.Observable<boolean>;
2525
public readonly canCreateNewSubscription: ko.Observable<boolean>;
26+
public readonly subscriptionCreated: ko.Observable<boolean>;
2627

2728
@Param()
2829
public wrapText: ko.Observable<boolean>;
@@ -41,6 +42,7 @@ export class ProductDetailsPage {
4142
this.showSubscribeForm = ko.observable(false);
4243
this.canCreateNewSubscription = ko.observable(false);
4344
this.calculateCanCreateNewSubscription = this.calculateCanCreateNewSubscription.bind(this);
45+
this.subscriptionCreated = ko.observable();
4446
}
4547

4648
@OnMounted()

src/components/template-pages/product-details-page/ko/runtime/staticPages/product-apis-cards.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ <h5>Legal</h5>
8282
<hr class="mt-20 mb-20" />
8383

8484
<div class="commands">
85-
<a class="outlined" href="#" data-bind="attr: { href: getApiUrl(quickViewApi) }">
85+
<a class="outlined" data-bind="attr: { href: getApiUrl(quickViewApi()) }">
8686
View API
8787
</a>
8888
</div>

src/components/template-pages/product-details-page/ko/runtime/staticPages/product-apis-cards.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ export class ProductApisCards {
9999
}
100100

101101
public getApiUrl(api: Api): string {
102-
return this.routeHelper.getApiReferenceUrl(api.name, "api-details");
102+
return this.routeHelper.getApiReferenceUrl(api.name, "/api-details");
103103
}
104-
105104
}

src/components/template-pages/product-details-page/ko/runtime/staticPages/product-details-page-subscriptions.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<h3>Subscriptions</h3>
22

3+
<!-- ko if: working -->
4+
<spinner class="fit"></spinner>
5+
<!-- /ko -->
6+
7+
<!-- ko ifnot: working -->
38
<!-- ko ifnot: isUserSignedIn() -->
49
<p>
510
You need to sign in or create an account to see your subscriptions.
@@ -10,11 +15,6 @@ <h3>Subscriptions</h3>
1015
</div>
1116
<!-- /ko -->
1217

13-
<!-- ko if: working -->
14-
<spinner class="fit"></spinner>
15-
<!-- /ko -->
16-
17-
<!-- ko ifnot: working -->
1818
<!-- ko if: isUserSignedIn() -->
1919
<p>Below are your subscriptions for this product</p>
2020

src/components/template-pages/product-details-page/ko/runtime/staticPages/product-details-page-subscriptions.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ export class ProdutDetailsPageSubscriptions {
3939
@Param()
4040
public readonly calculateCanCreateNewSubscription: () => Promise<void>;
4141

42+
@Param()
43+
public readonly subscriptionCreated: ko.Observable<boolean>;
44+
4245
constructor(
4346
private readonly usersService: UsersService,
4447
private readonly productService: ProductService,
@@ -55,6 +58,14 @@ export class ProdutDetailsPageSubscriptions {
5558
this.product = ko.observable();
5659
this.loadModeSubscriptions = ko.observable(false);
5760
this.canCreateNewSubscription = ko.observable();
61+
this.subscriptionCreated = ko.observable(false);
62+
63+
this.subscriptionCreated.subscribe(async (isCreated) => {
64+
if(isCreated) {
65+
await this.loadProductSubscriptions();
66+
}
67+
});
68+
5869
}
5970

6071
@OnMounted()
@@ -133,12 +144,14 @@ export class ProdutDetailsPageSubscriptions {
133144
this.isUserSignedIn(!!userId);
134145

135146
if (!userId) {
147+
this.working(false);
136148
return;
137149
}
138150

139151
const productName = this.routeHelper.getProductName();
140152

141153
if (!productName) {
154+
this.working(false);
142155
return;
143156
}
144157

src/components/template-pages/product-details-page/ko/runtime/subscripion-form/subscription-form.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export class SubscriptionForm {
2626
@Param()
2727
closeSubscriptionForm: () => void;
2828

29+
@Param()
30+
subscriptionCreated: ko.Observable<boolean>;
31+
2932
constructor(private readonly usersService: UsersService,
3033
private readonly productService: ProductService,
3134
private readonly tenantService: TenantService,
@@ -37,6 +40,7 @@ export class SubscriptionForm {
3740
this.working = ko.observable(false);
3841
this.hasError = ko.observable(false);
3942
this.isDelegationEnabled = ko.observable(false);
43+
this.subscriptionCreated = ko.observable(false);
4044

4145
this.product = ko.observable();
4246

@@ -92,7 +96,7 @@ export class SubscriptionForm {
9296
const subscriptionId = `/subscriptions/${Utils.getBsonObjectId()}`;
9397
await this.productService.createSubscription(subscriptionId, userId, `/products/${this.product().name}`, this.subscriptionName());
9498

95-
99+
this.subscriptionCreated(true);
96100
this.closeSubscriptionForm();
97101
}
98102
catch (error) {

0 commit comments

Comments
 (0)