@osovitny/anatoly 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/bundles/osovitny-anatoly.umd.js +1476 -0
  2. package/bundles/osovitny-anatoly.umd.js.map +1 -0
  3. package/bundles/osovitny-anatoly.umd.min.js +16 -0
  4. package/bundles/osovitny-anatoly.umd.min.js.map +1 -0
  5. package/esm2015/lib/billing/billing.module.js +60 -0
  6. package/esm2015/lib/billing/components/buyaccess/buyaccess-button.component.js +73 -0
  7. package/esm2015/lib/billing/components/subscriptions/subscribe-plan-button.component.js +63 -0
  8. package/esm2015/lib/billing/components/subscriptions/upgrade-plan-button.component.js +55 -0
  9. package/esm2015/lib/billing/index.js +9 -0
  10. package/esm2015/lib/billing/services/base-billing-api.service.js +53 -0
  11. package/esm2015/lib/core/consts.js +11 -0
  12. package/esm2015/lib/core/core.module.js +45 -0
  13. package/esm2015/lib/core/index.js +9 -0
  14. package/esm2015/lib/core/services/appcontext.service.js +72 -0
  15. package/esm2015/lib/core/services/base-api.service.js +71 -0
  16. package/esm2015/lib/core/services/base-go.service.js +36 -0
  17. package/esm2015/lib/core/services/base-gridedit.service.js +98 -0
  18. package/esm2015/lib/identity/components/signin-button.component.js +30 -0
  19. package/esm2015/lib/identity/components/signout-button.component.js +30 -0
  20. package/esm2015/lib/identity/components/signup-button.component.js +31 -0
  21. package/esm2015/lib/identity/identity.module.js +41 -0
  22. package/esm2015/lib/identity/index.js +7 -0
  23. package/esm2015/lib/ui/components/base-edit.component.js +66 -0
  24. package/esm2015/lib/ui/components/base.component.js +37 -0
  25. package/esm2015/lib/ui/components/content-header/content-header.component.js +35 -0
  26. package/esm2015/lib/ui/components/html-editor/base-html-editor.component.js +86 -0
  27. package/esm2015/lib/ui/components/html-editor/forms-html-editor.component.js +37 -0
  28. package/esm2015/lib/ui/components/html-editor/html-editor.component.js +49 -0
  29. package/esm2015/lib/ui/components/html-editor/html-editor.defaultoptions.js +38 -0
  30. package/esm2015/lib/ui/components/validation/form-validation-summary.component.js +39 -0
  31. package/esm2015/lib/ui/components/validation/item-validation-summary.component.js +37 -0
  32. package/esm2015/lib/ui/components/validation/validation-summary.component.js +60 -0
  33. package/esm2015/lib/ui/index.js +13 -0
  34. package/esm2015/lib/ui/ui.module.js +77 -0
  35. package/esm2015/osovitny-anatoly.js +5 -0
  36. package/esm2015/public-api.js +5 -0
  37. package/esm5/lib/billing/billing.module.js +63 -0
  38. package/esm5/lib/billing/components/buyaccess/buyaccess-button.component.js +75 -0
  39. package/esm5/lib/billing/components/subscriptions/subscribe-plan-button.component.js +65 -0
  40. package/esm5/lib/billing/components/subscriptions/upgrade-plan-button.component.js +56 -0
  41. package/esm5/lib/billing/index.js +9 -0
  42. package/esm5/lib/billing/services/base-billing-api.service.js +56 -0
  43. package/esm5/lib/core/consts.js +11 -0
  44. package/esm5/lib/core/core.module.js +48 -0
  45. package/esm5/lib/core/index.js +9 -0
  46. package/esm5/lib/core/services/appcontext.service.js +76 -0
  47. package/esm5/lib/core/services/base-api.service.js +72 -0
  48. package/esm5/lib/core/services/base-go.service.js +37 -0
  49. package/esm5/lib/core/services/base-gridedit.service.js +104 -0
  50. package/esm5/lib/identity/components/signin-button.component.js +32 -0
  51. package/esm5/lib/identity/components/signout-button.component.js +32 -0
  52. package/esm5/lib/identity/components/signup-button.component.js +32 -0
  53. package/esm5/lib/identity/identity.module.js +44 -0
  54. package/esm5/lib/identity/index.js +7 -0
  55. package/esm5/lib/ui/components/base-edit.component.js +70 -0
  56. package/esm5/lib/ui/components/base.component.js +39 -0
  57. package/esm5/lib/ui/components/content-header/content-header.component.js +38 -0
  58. package/esm5/lib/ui/components/html-editor/base-html-editor.component.js +90 -0
  59. package/esm5/lib/ui/components/html-editor/forms-html-editor.component.js +40 -0
  60. package/esm5/lib/ui/components/html-editor/html-editor.component.js +51 -0
  61. package/esm5/lib/ui/components/html-editor/html-editor.defaultoptions.js +38 -0
  62. package/esm5/lib/ui/components/validation/form-validation-summary.component.js +42 -0
  63. package/esm5/lib/ui/components/validation/item-validation-summary.component.js +39 -0
  64. package/esm5/lib/ui/components/validation/validation-summary.component.js +65 -0
  65. package/esm5/lib/ui/index.js +13 -0
  66. package/esm5/lib/ui/ui.module.js +80 -0
  67. package/esm5/osovitny-anatoly.js +5 -0
  68. package/esm5/public-api.js +5 -0
  69. package/fesm2015/osovitny-anatoly.js +1207 -0
  70. package/fesm2015/osovitny-anatoly.js.map +1 -0
  71. package/fesm5/osovitny-anatoly.js +1267 -0
  72. package/fesm5/osovitny-anatoly.js.map +1 -0
  73. package/lib/billing/billing.module.d.ts +2 -0
  74. package/lib/billing/components/buyaccess/buyaccess-button.component.d.ts +16 -0
  75. package/lib/billing/components/subscriptions/subscribe-plan-button.component.d.ts +15 -0
  76. package/lib/billing/components/subscriptions/upgrade-plan-button.component.d.ts +9 -0
  77. package/{src/lib/billing/index.ts → lib/billing/index.d.ts} +1 -6
  78. package/lib/billing/services/base-billing-api.service.d.ts +9 -0
  79. package/lib/core/consts.d.ts +5 -0
  80. package/lib/core/core.module.d.ts +2 -0
  81. package/{src/lib/core/index.ts → lib/core/index.d.ts} +1 -6
  82. package/lib/core/services/appcontext.service.d.ts +14 -0
  83. package/lib/core/services/base-api.service.d.ts +18 -0
  84. package/lib/core/services/base-go.service.d.ts +7 -0
  85. package/lib/core/services/base-gridedit.service.d.ts +19 -0
  86. package/lib/identity/components/signin-button.component.d.ts +4 -0
  87. package/lib/identity/components/signout-button.component.d.ts +4 -0
  88. package/lib/identity/components/signup-button.component.d.ts +4 -0
  89. package/lib/identity/identity.module.d.ts +2 -0
  90. package/{src/lib/identity/index.ts → lib/identity/index.d.ts} +1 -4
  91. package/lib/ui/components/base-edit.component.d.ts +14 -0
  92. package/lib/ui/components/base.component.d.ts +7 -0
  93. package/lib/ui/components/content-header/content-header.component.d.ts +5 -0
  94. package/lib/ui/components/html-editor/base-html-editor.component.d.ts +16 -0
  95. package/lib/ui/components/html-editor/forms-html-editor.component.d.ts +6 -0
  96. package/lib/ui/components/html-editor/html-editor.component.d.ts +6 -0
  97. package/lib/ui/components/html-editor/html-editor.defaultoptions.d.ts +1 -0
  98. package/lib/ui/components/validation/form-validation-summary.component.d.ts +6 -0
  99. package/lib/ui/components/validation/item-validation-summary.component.d.ts +6 -0
  100. package/lib/ui/components/validation/validation-summary.component.d.ts +6 -0
  101. package/{src/lib/ui/index.ts → lib/ui/index.d.ts} +1 -6
  102. package/lib/ui/ui.module.d.ts +2 -0
  103. package/osovitny-anatoly.d.ts +4 -0
  104. package/osovitny-anatoly.metadata.json +1 -0
  105. package/package.json +13 -2
  106. package/{src/public-api.ts → public-api.d.ts} +4 -4
  107. package/ng-package.json +0 -7
  108. package/src/lib/billing/billing.module.ts +0 -62
  109. package/src/lib/billing/components/buyaccess/buyaccess-button.component.html +0 -15
  110. package/src/lib/billing/components/buyaccess/buyaccess-button.component.ts +0 -70
  111. package/src/lib/billing/components/subscriptions/subscribe-plan-button.component.html +0 -21
  112. package/src/lib/billing/components/subscriptions/subscribe-plan-button.component.ts +0 -60
  113. package/src/lib/billing/components/subscriptions/upgrade-plan-button.component.html +0 -3
  114. package/src/lib/billing/components/subscriptions/upgrade-plan-button.component.ts +0 -47
  115. package/src/lib/billing/services/base-billing-api.service.ts +0 -56
  116. package/src/lib/core/consts.ts +0 -7
  117. package/src/lib/core/core.module.ts +0 -45
  118. package/src/lib/core/services/appcontext.service.ts +0 -81
  119. package/src/lib/core/services/base-api.service.ts +0 -87
  120. package/src/lib/core/services/base-go.service.ts +0 -33
  121. package/src/lib/core/services/base-gridedit.service.ts +0 -124
  122. package/src/lib/identity/components/signin-button.component.html +0 -1
  123. package/src/lib/identity/components/signin-button.component.ts +0 -27
  124. package/src/lib/identity/components/signout-button.component.html +0 -1
  125. package/src/lib/identity/components/signout-button.component.ts +0 -27
  126. package/src/lib/identity/components/signup-button.component.html +0 -1
  127. package/src/lib/identity/components/signup-button.component.ts +0 -28
  128. package/src/lib/identity/identity.module.ts +0 -41
  129. package/src/lib/ui/components/base-edit.component.ts +0 -77
  130. package/src/lib/ui/components/base.component.ts +0 -45
  131. package/src/lib/ui/components/content-header/content-header.component.html +0 -4
  132. package/src/lib/ui/components/content-header/content-header.component.ts +0 -32
  133. package/src/lib/ui/components/html-editor/base-html-editor.component.ts +0 -97
  134. package/src/lib/ui/components/html-editor/forms-html-editor.component.html +0 -14
  135. package/src/lib/ui/components/html-editor/forms-html-editor.component.ts +0 -35
  136. package/src/lib/ui/components/html-editor/html-editor.component.html +0 -6
  137. package/src/lib/ui/components/html-editor/html-editor.component.ts +0 -51
  138. package/src/lib/ui/components/html-editor/html-editor.defaultoptions.ts +0 -38
  139. package/src/lib/ui/components/validation/form-validation-summary.component.html +0 -4
  140. package/src/lib/ui/components/validation/form-validation-summary.component.ts +0 -36
  141. package/src/lib/ui/components/validation/item-validation-summary.component.html +0 -5
  142. package/src/lib/ui/components/validation/item-validation-summary.component.ts +0 -32
  143. package/src/lib/ui/components/validation/validation-summary.component.ts +0 -74
  144. package/src/lib/ui/index.js +0 -13
  145. package/src/lib/ui/index.js.map +0 -1
  146. package/src/lib/ui/ui.module.ts +0 -83
  147. package/tsconfig.lib.json +0 -32
  148. package/tsconfig.lib.prod.json +0 -6
  149. package/tslint.json +0 -17
  150. package/typings/osovitny-ui/index.d.ts +0 -24
@@ -1,70 +0,0 @@
1
- /*
2
- <file>
3
- Authors:
4
- Vadim Osovitny
5
-
6
- Created:
7
- 14 Aug 2018
8
-
9
- Version:
10
- 1.0
11
-
12
- Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
- </file>
14
- */
15
-
16
- //Node
17
- import { Component, Input, OnInit } from '@angular/core';
18
-
19
- //Services
20
- import { AppContextService } from '../../../core/services/appcontext.service';
21
- import { BaseBillingApiService } from '../../services/base-billing-api.service';
22
-
23
- @Component({
24
- selector: 'anatoly-buyaccess-button',
25
- templateUrl: './buyaccess-button.component.html'
26
- })
27
-
28
- export class BuyAccessButtonComponent implements OnInit {
29
- public contextUpdated: boolean = false;
30
- public isUserSignedIn: boolean = false;
31
- public currentPlan: number = 0;
32
- public currentPlanTitle: string = "";
33
-
34
- @Input() plan: number;
35
- @Input() plantitle: string;
36
-
37
- constructor(private appcontext: AppContextService, private api: BaseBillingApiService) {
38
- }
39
-
40
- ngOnInit() {
41
- if (!this.appcontext.isUserSignedIn()) {
42
- this.contextUpdated = true;
43
- return;
44
- }
45
-
46
- this.appcontext.getCurrent((current) => {
47
- this.isUserSignedIn = current.isUserSignedIn;
48
-
49
- if (this.isUserSignedIn) {
50
- this.currentPlan = current.account.billingPlan;
51
- this.currentPlanTitle = current.account.billingPlanAsString;
52
- }
53
-
54
- this.contextUpdated = true;
55
- });
56
- }
57
-
58
- onBuyPlan() {
59
- const text = `Requested plan: ${this.plantitle} `;
60
-
61
- var that = this;
62
- osovitny.ui.areYouSure(text, 'Buying access', 'Confirm change', 'Cancel', () => {
63
- that.api.buyAccess(that.plan, () => {
64
- osovitny.ui.alertSuccess('Access Granted', null, () => {
65
- (<any>window).location.reload();
66
- });
67
- });
68
- });
69
- }
70
- }
@@ -1,21 +0,0 @@
1
- <div *ngIf="contextUpdated">
2
- <div *ngIf="!isUserSignedIn">
3
- <anatoly-signup-button classbtn="btn btn-block btn-primary"></anatoly-signup-button>
4
- </div>
5
-
6
- <div *ngIf="isUserSignedIn">
7
- <button class="btn btn-block btn-success selectPlan" *ngIf="plan == currentPlan">
8
- Your Plan
9
- </button>
10
-
11
- <button class="btn btn-block btn-warning selectPlan" *ngIf="requestedPlan != null && requestedPlan != 0 && plan == requestedPlan">
12
- Requested
13
- </button>
14
-
15
- <anatoly-upgrade-plan-button *ngIf="plan != currentPlan && plan != requestedPlan"
16
- [currentplantitle]="currentPlanTitle"
17
- [requestedplan]=plan
18
- [requestedplantitle]="plantitle">
19
- </anatoly-upgrade-plan-button>
20
- </div>
21
- </div>
@@ -1,60 +0,0 @@
1
- /*
2
- <file>
3
- Authors:
4
- Vadim Osovitny
5
-
6
- Created:
7
- 1 Jun 2018
8
-
9
- Version:
10
- 1.0
11
-
12
- Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
- </file>
14
- */
15
-
16
- //Node
17
- import { Component, Input, OnInit } from '@angular/core';
18
-
19
- //Services
20
- import { AppContextService } from '../../../core/services/appcontext.service';
21
-
22
- @Component({
23
- selector: 'anatoly-subscribe-plan-button',
24
- templateUrl: './subscribe-plan-button.component.html'
25
- })
26
-
27
- export class SubscribePlanButtonComponent implements OnInit {
28
- public contextUpdated: boolean = false;
29
- public isUserSignedIn: boolean = false;
30
- public currentPlan: number = 0;
31
- public currentPlanTitle: string = "";
32
- public requestedPlan: number = 0;
33
- public requestedPlanTitle: string = "";
34
-
35
- @Input() plan: number;
36
- @Input() plantitle: string;
37
-
38
- constructor(private appcontext: AppContextService) {
39
- }
40
-
41
- ngOnInit() {
42
- if (!this.appcontext.isUserSignedIn()) {
43
- this.contextUpdated = true;
44
- return;
45
- }
46
-
47
- this.appcontext.getCurrent((current) => {
48
- this.isUserSignedIn = current.isUserSignedIn;
49
-
50
- if (this.isUserSignedIn) {
51
- this.currentPlan = current.account.billingPlan;
52
- this.currentPlanTitle = current.account.billingPlanAsString;
53
- this.requestedPlan = current.account.requestedBillingPlan;
54
- this.requestedPlanTitle = current.account.requestedBillingPlanAsString;
55
- }
56
-
57
- this.contextUpdated = true;
58
- });
59
- }
60
- }
@@ -1,3 +0,0 @@
1
- <button class="btn btn-block btn-primary" (click)="onUpgradePlan()">
2
- Upgrade
3
- </button>
@@ -1,47 +0,0 @@
1
- /*
2
- <file>
3
- Authors:
4
- Vadim Osovitny
5
-
6
- Created:
7
- 12 Nov 2017
8
-
9
- Version:
10
- 1.0
11
-
12
- Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
- </file>
14
- */
15
-
16
- //Node
17
- import { Component, Input } from '@angular/core';
18
-
19
- //Services
20
- import { BaseBillingApiService } from '../../services/base-billing-api.service';
21
-
22
- @Component({
23
- selector: 'anatoly-upgrade-plan-button',
24
- templateUrl: './upgrade-plan-button.component.html'
25
- })
26
-
27
- export class UpgradePlanButtonComponent {
28
- @Input() currentplantitle: string;
29
- @Input() requestedplan: number;
30
- @Input() requestedplantitle: string;
31
-
32
- constructor(private api: BaseBillingApiService) {
33
- }
34
-
35
- onUpgradePlan() {
36
- const text = `Current plan: ${this.currentplantitle} New plan: ${this.requestedplantitle}`;
37
-
38
- var that = this;
39
- osovitny.ui.areYouSure(text, 'Change billing plan', 'Confirm change', 'Cancel', () => {
40
- that.api.requestNewSubscription(that.requestedplan, () => {
41
- osovitny.ui.alertSuccess('Your request for changing plan has been sent.', null, () => {
42
- (<any>window).location.reload();
43
- });
44
- });
45
- });
46
- }
47
- }
@@ -1,56 +0,0 @@
1
- /*
2
- <file>
3
- Authors:
4
- Vadim Osovitny
5
-
6
- Created:
7
- 12 Nov 2017
8
-
9
- Version:
10
- 1.0
11
-
12
- Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
- </file>
14
- */
15
-
16
- //Node
17
- import { Injectable } from '@angular/core';
18
- import { HttpClient } from '@angular/common/http';
19
-
20
- //@osovitny/anatoly
21
- import { BaseApiService } from '../../core'
22
-
23
- @Injectable()
24
- export class BaseBillingApiService extends BaseApiService {
25
- constructor(protected http: HttpClient) {
26
- super(http);
27
- this.baseUrl += 'billing/';
28
- }
29
-
30
- public requestNewSubscription(requestedPlan: Number, success?: Function, error?: Function) {
31
- this.postQS('requestNewSubscription', { requestedPlan: requestedPlan })
32
- .subscribe(
33
- data => { },
34
- e => { if (error) error() },
35
- () => { if (success) success() }
36
- );
37
- }
38
-
39
- public cancelRequestedSubscription(success?: Function, error?: Function) {
40
- this.postQS('cancelRequestedSubscription', null)
41
- .subscribe(
42
- data => { },
43
- e => { if (error) error() },
44
- () => { if (success) success() }
45
- );
46
- }
47
-
48
- public buyAccess(requestedPlan: Number, success?: Function, error?: Function) {
49
- this.postQS('buyAccess', { requestedPlan: requestedPlan })
50
- .subscribe(
51
- data => { },
52
- e => { if (error) error() },
53
- () => { if (success) success() }
54
- );
55
- }
56
- }
@@ -1,7 +0,0 @@
1
- namespace anatoly.consts {
2
- export const jsonUrl: string = "/dist/json/";
3
- export const appUrl = "/";
4
- export const apiUrl = "/api/";
5
- }
6
-
7
- (<any>window).anatoly = anatoly;
@@ -1,45 +0,0 @@
1
- /*
2
- <file>
3
- Authors:
4
- Vadim Osovitny
5
-
6
- Created:
7
- 10 Nov 2017
8
-
9
- Version:
10
- 1.0
11
-
12
- Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
- </file>
14
- */
15
-
16
- //Node
17
- import { NgModule } from '@angular/core';
18
- import { CommonModule } from '@angular/common';
19
- import { HttpClientModule, HttpClientXsrfModule, HttpClientJsonpModule, HttpClient } from '@angular/common/http';
20
-
21
- //Services
22
- import { AppContextService } from './services/appcontext.service';
23
-
24
- @NgModule({
25
- imports: [
26
- CommonModule,
27
- HttpClientModule,
28
- HttpClientXsrfModule,
29
- HttpClientJsonpModule
30
- ],
31
- exports: [
32
- CommonModule,
33
- HttpClientModule,
34
- HttpClientXsrfModule,
35
- HttpClientJsonpModule
36
- ],
37
- declarations: [
38
- ],
39
- providers: [
40
- AppContextService
41
- ]
42
- })
43
-
44
- export class AnatolyCoreModule {
45
- }
@@ -1,81 +0,0 @@
1
- /*
2
- <file>
3
- Authors:
4
- Vadim Osovitny
5
-
6
- Created:
7
- 13 Nov 2017
8
-
9
- Version:
10
- 1.0
11
-
12
- Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
- </file>
14
- */
15
-
16
- //Node
17
- import { Injectable } from '@angular/core';
18
- import { HttpClient } from '@angular/common/http';
19
- import { Subscription } from 'rxjs';
20
-
21
- //Custom
22
- import { BaseApiService } from './base-api.service';
23
- import '../consts';
24
-
25
- @Injectable()
26
- export class AppContextService extends BaseApiService {
27
- private current = null;
28
- private successes = [];
29
- private subscription: Subscription = null;
30
-
31
- constructor(protected http: HttpClient) {
32
- super(http);
33
- this.baseUrl = anatoly.consts.apiUrl + 'appcontext/';
34
- }
35
-
36
- getCurrent(success: Function) {
37
- if (typeof success == "undefined") {
38
- return;
39
- }
40
-
41
- if (this.current != null) {
42
- success(this.current);
43
- return;
44
- }
45
-
46
- this.successes.push(success);
47
-
48
- if (this.subscription != null) {
49
- return;
50
- }
51
-
52
- this.subscription = this.get('GetCurrentContext', null).subscribe(
53
- data => {
54
- this.dataReceived(data);
55
- },
56
- e => { }
57
- );
58
- }
59
-
60
- dataReceived(data) {
61
- this.current = data;
62
-
63
- for (var i = 0; i < this.successes.length; i++) {
64
- var success = this.successes[i];
65
- success(data);
66
- }
67
-
68
- this.successes = [];
69
- this.subscription.unsubscribe();
70
- this.subscription = null;
71
- this.current = null;
72
- }
73
-
74
- isUserSignedIn() {
75
- return (<any>window).__context_isUserSignedIn;
76
- }
77
-
78
- isUserAdmin() {
79
- return (<any>window).__context_isUserAdmin;
80
- }
81
- }
@@ -1,87 +0,0 @@
1
- /*
2
- <file>
3
- Authors:
4
- Vadim Osovitny
5
-
6
- Created:
7
- 13 Nov 2017
8
-
9
- Version:
10
- 1.0
11
-
12
- Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
- </file>
14
- */
15
-
16
- import { Injectable } from '@angular/core';
17
- import { HttpClient } from '@angular/common/http';
18
-
19
- //RxJs
20
- import { Observable } from 'rxjs';
21
- import { map } from 'rxjs/operators';
22
-
23
- import '../consts';
24
-
25
- @Injectable()
26
- export class BaseApiService {
27
- protected baseUrl: string;
28
- protected jsonUrl: string;
29
-
30
- constructor(protected http: HttpClient) {
31
- this.baseUrl = anatoly.consts.apiUrl;
32
- }
33
-
34
- private serializeParams(data?: any): string {
35
- return data ? ('?' + $.param(data)) : '';
36
- }
37
-
38
- //webApi
39
- public get<T>(action: String, data?: any): Observable<T> {
40
- var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
41
- return this.http.get(url).pipe(
42
- map(res => <T>res)
43
- );
44
- }
45
-
46
- public post(action: String, data?: any): Observable<any> {
47
- var url = this.baseUrl + `${action}`;
48
- return this.http.post(url, data, { responseType: 'text' });
49
- }
50
-
51
- public postQS(action: String, data?: any): Observable<any> {
52
- var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
53
- return this.http.post(url, null, { responseType: 'text' });
54
- }
55
-
56
- //gets
57
- public getAll<T>(data?: any): Observable<T[]> {
58
- return this.get('getall', data).pipe(
59
- map(res => <T[]>res)
60
- );
61
- }
62
-
63
- public getJsonFile(fileName: string, jsonVersion: string): Observable<any[]> {
64
- if (!jsonVersion) {
65
- jsonVersion = "1.0";
66
- }
67
-
68
- var url = anatoly.consts.jsonUrl + fileName + '?' + jsonVersion;
69
- return this.http.get(url).pipe(
70
- map(res => <any[]>res)
71
- );
72
- }
73
-
74
- public getNewGuid(): Observable<string> {
75
- var url = this.baseUrl + 'getNewGuid';
76
- return this.http.get(url, { responseType: 'text' });
77
- }
78
-
79
- //CRUD function
80
- public getById<T>(id: any): Observable<T> {
81
- return this.get<T>('getById', { id: id });
82
- }
83
-
84
- public remove(id: any): Observable<string> {
85
- return this.postQS('remove', { id: id });
86
- }
87
- }
@@ -1,33 +0,0 @@
1
- /*
2
- <file>
3
- Authors:
4
- Vadim Osovitny
5
-
6
- Created:
7
- 17 Jun 2018
8
-
9
- Version:
10
- 1.0
11
-
12
- Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
- </file>
14
- */
15
-
16
- import { Injectable } from '@angular/core';
17
- import { ActivatedRoute, Router } from '@angular/router';
18
-
19
- @Injectable()
20
- export class BaseGoService {
21
- protected route: ActivatedRoute;
22
- protected router: Router;
23
-
24
- constructor(route: ActivatedRoute, router: Router) {
25
- this.route = route;
26
- this.router = router;
27
- }
28
-
29
- locationReload() {
30
- //this.router.navigate([this.route.url]);
31
- (<any>window).location.reload();
32
- }
33
- }
@@ -1,124 +0,0 @@
1
- /*
2
- <file>
3
- Authors:
4
- Vadim Osovitny
5
-
6
- Created:
7
- 29 Apr 2018
8
-
9
- Version:
10
- 1.0
11
-
12
- Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
- </file>
14
- */
15
-
16
- import { Injectable } from '@angular/core';
17
- import { HttpClient } from '@angular/common/http';
18
-
19
- //RxJs
20
- import { Observable } from 'rxjs';
21
- import { BehaviorSubject } from 'rxjs';
22
- import { map } from 'rxjs/operators';
23
-
24
- import '../consts';
25
-
26
- @Injectable()
27
- export class BaseGridEditService extends BehaviorSubject<any[]> {
28
- protected baseUrl: string;
29
- protected baseReadUrl: string;
30
- protected savedReadParams: any;
31
- private data: any[] = [];
32
-
33
- constructor(protected http: HttpClient) {
34
- super([]);
35
-
36
- this.baseUrl = anatoly.consts.apiUrl;
37
- this.baseReadUrl = this.baseUrl + "getAll";
38
- }
39
-
40
- private serializeParams(data?: any): string {
41
- return data ? ('?' + $.param(data)) : '';
42
- }
43
-
44
- private reset() {
45
- this.data = [];
46
- }
47
-
48
- public resetItem(dataItem: any) {
49
- if (!dataItem) { return; }
50
-
51
- //find orignal data item
52
- const originalDataItem = this.data.find(item => item.Id === dataItem.Id);
53
-
54
- //revert changes
55
- Object.assign(originalDataItem, dataItem);
56
- super.next(this.data);
57
- }
58
-
59
- public read(params?: any) {
60
- if (this.data.length) {
61
- return super.next(this.data);
62
- }
63
-
64
- var url = this.baseReadUrl;
65
-
66
- if (typeof params === 'undefined') {
67
- params = this.savedReadParams;
68
- }
69
-
70
- if (typeof params !== 'undefined') {
71
- url = this.baseReadUrl + `${this.serializeParams(params)}`;
72
- this.savedReadParams = params;
73
- }
74
-
75
- // this.http.get(url)
76
- // .map(res => <any[]>res)
77
- // .do(data => { this.data = data; }).subscribe(data => { super.next(data); });
78
- //}
79
-
80
- this.http.get(url).pipe(
81
- map(res => <any[]>res)
82
- ).subscribe(data => { super.next(data) });
83
- }
84
-
85
-
86
- public save(data: any, isNew: boolean, sucess?: Function) {
87
- const action = isNew ? 'add' : 'update';
88
-
89
- this.reset();
90
- this.post(action, data).subscribe(
91
- () => {
92
- },
93
- () => {
94
- this.read();
95
- },
96
- () => {
97
- this.read();
98
- if (sucess) sucess();
99
- }
100
- );
101
- }
102
-
103
- public remove(data: any, sucess?: Function) {
104
- this.reset();
105
- this.post('remove', data).subscribe(
106
- () => {
107
- },
108
- () => {
109
- this.read();
110
- },
111
- () => {
112
- this.read();
113
- if (sucess) sucess();
114
- }
115
- );
116
- }
117
-
118
- post(action: any, data?: any): Observable<any[]> {
119
- var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
120
- return this.http.post(url, data).pipe(
121
- map(res => <any[]>res)
122
- );
123
- }
124
- }
@@ -1 +0,0 @@
1
- <a href="identity/signIn" class="{{classbtn}}">Sign In</a>
@@ -1,27 +0,0 @@
1
- /*
2
- <file>
3
- Authors:
4
- Vadim Osovitny
5
-
6
- Created:
7
- 4 Jul 2018
8
-
9
- Version:
10
- 1.0
11
-
12
- Copyright (c) 2018 Osovitny Inc. All rights reserved.
13
- </file>
14
- */
15
-
16
- import { Component, Input } from '@angular/core';
17
-
18
- @Component({
19
- selector: 'anatoly-signin-button',
20
- templateUrl: './signin-button.component.html'
21
- })
22
-
23
- export class SignInButtonComponent {
24
- @Input() classbtn: string;
25
-
26
- constructor() { }
27
- }
@@ -1 +0,0 @@
1
- <a href="identity/signOut" class="{{classbtn}}">Sign Out</a>
@@ -1,27 +0,0 @@
1
- /*
2
- <file>
3
- Authors:
4
- Vadim Osovitny
5
-
6
- Created:
7
- 4 Jul 2018
8
-
9
- Version:
10
- 1.0
11
-
12
- Copyright (c) 2018 Osovitny Inc. All rights reserved.
13
- </file>
14
- */
15
-
16
- import { Component, Input } from '@angular/core';
17
-
18
- @Component({
19
- selector: 'anatoly-signout-button',
20
- templateUrl: './signout-button.component.html'
21
- })
22
-
23
- export class SignOutButtonComponent {
24
- @Input() classbtn: string;
25
-
26
- constructor() { }
27
- }