This repository was archived by the owner on Mar 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 403
[PS-248] Feature/manage billing sync connection #1601
Merged
MGibson1
merged 8 commits into
feature/self-hosted-families-for-enterprise
from
feature/manage-billing-sync-connection
Apr 20, 2022
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
781102e
Fix modal footer rounded corners
MGibson1 f491cf4
Add billing sync messages
MGibson1 fbc658c
Add manage billing sync to self hosted org subscription component
MGibson1 f64f892
Handle create vs update in component
MGibson1 5b79150
Update src/app/settings/billing-sync-key.component.html
MGibson1 ebf78f5
update jslib
MGibson1 7d09875
Linter fixes
MGibson1 b55308f
Remove duplicate modalService
MGibson1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule jslib
updated
7 files
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,69 @@ | ||
| <div class="modal fade" role="dialog" aria-modal="true" aria-labelledby="billingSyncTitle"> | ||
| <div class="modal-dialog modal-dialog-scrollable" role="document"> | ||
| <form | ||
| class="modal-content" | ||
| #form | ||
| (ngSubmit)="submit()" | ||
| [appApiAction]="formPromise" | ||
| ngNativeValidate | ||
| > | ||
| <div class="modal-header"> | ||
| <h2 class="modal-title" id="billingSyncTitle">{{ "manageBillingSync" | i18n }}</h2> | ||
| <button | ||
| type="button" | ||
| class="close" | ||
| data-dismiss="modal" | ||
| appA11yTitle="{{ 'close' | i18n }}" | ||
| > | ||
| <span aria-hidden="true">×</span> | ||
| </button> | ||
| </div> | ||
| <div class="modal-body"> | ||
| <p>{{ "billingSyncKeyDesc" | i18n }}</p> | ||
| <div class="form-group"> | ||
| <label for="billingSyncKey" | ||
| >{{ "billingSyncKey" | i18n }} <small>(</small><small>{{ "required" | i18n }}</small | ||
| ><small>)</small></label | ||
| > | ||
| <input | ||
| id="billingSyncKey" | ||
| type="input" | ||
| name="billingSyncKey" | ||
| class="form-control" | ||
| [(ngModel)]="billingSyncKey" | ||
| required | ||
| appAutofocus | ||
| appInputVerbatim | ||
| /> | ||
| </div> | ||
| </div> | ||
| <div class="modal-footer"> | ||
| <button type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading"> | ||
| <i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i> | ||
| <span>{{ "save" | i18n }}</span> | ||
| </button> | ||
| <button type="button" class="btn btn-outline-secondary" data-dismiss="modal"> | ||
| {{ "cancel" | i18n }} | ||
| </button> | ||
| <div class="ml-auto"> | ||
| <button | ||
| #deleteBtn | ||
| type="button" | ||
| (click)="deleteConnection()" | ||
| class="btn btn-outline-danger" | ||
| appA11yTitle="{{ 'delete' | i18n }}" | ||
| [disabled]="form.loading" | ||
| > | ||
| <i class="bwi bwi-trash bwi-lg bwi-fw" [hidden]="form.loading" aria-hidden="true"></i> | ||
| <i | ||
| class="bwi bwi-spinner bwi-spin bwi-lg bwi-fw" | ||
| [hidden]="!form.loading" | ||
| title="{{ 'loading' | i18n }}" | ||
| aria-hidden="true" | ||
| ></i> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </form> | ||
| </div> | ||
| </div> |
This file contains hidden or 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,61 @@ | ||
| import { Component } from "@angular/core"; | ||
|
|
||
| import { ApiService } from "jslib-common/abstractions/api.service"; | ||
| import { LogService } from "jslib-common/abstractions/log.service"; | ||
| import { OrganizationConnectionType } from "jslib-common/enums/organizationConnectionType"; | ||
| import { Utils } from "jslib-common/misc/utils"; | ||
| import { BillingSyncConfigApi } from "jslib-common/models/api/billingSyncConfigApi"; | ||
| import { BillingSyncConfigRequest } from "jslib-common/models/request/billingSyncConfigRequest"; | ||
| import { OrganizationConnectionRequest } from "jslib-common/models/request/organizationConnectionRequest"; | ||
| import { OrganizationConnectionResponse } from "jslib-common/models/response/organizationConnectionResponse"; | ||
|
|
||
| @Component({ | ||
| selector: "app-billing-sync-key", | ||
| templateUrl: "billing-sync-key.component.html", | ||
| }) | ||
| export class BillingSyncKeyComponent { | ||
| entityId: string; | ||
| existingConnectionId: string; | ||
| billingSyncKey: string; | ||
| setParentConnection: (connection: OrganizationConnectionResponse<BillingSyncConfigApi>) => void; | ||
|
|
||
| formPromise: Promise<OrganizationConnectionResponse<BillingSyncConfigApi>> | Promise<void>; | ||
|
|
||
| constructor(private apiService: ApiService, private logService: LogService) {} | ||
|
|
||
| async submit() { | ||
| try { | ||
| const request = new OrganizationConnectionRequest( | ||
| this.entityId, | ||
| OrganizationConnectionType.CloudBillingSync, | ||
| true, | ||
| new BillingSyncConfigRequest(this.billingSyncKey) | ||
| ); | ||
| if (this.existingConnectionId == null) { | ||
| this.formPromise = this.apiService.createOrganizationConnection( | ||
| request, | ||
| BillingSyncConfigApi | ||
| ); | ||
| } else { | ||
| this.formPromise = this.apiService.updateOrganizationConnection( | ||
| request, | ||
| BillingSyncConfigApi, | ||
| this.existingConnectionId | ||
| ); | ||
| } | ||
| const response = (await this | ||
| .formPromise) as OrganizationConnectionResponse<BillingSyncConfigApi>; | ||
| this.existingConnectionId = response?.id; | ||
| this.billingSyncKey = response?.config?.billingSyncKey; | ||
| this.setParentConnection(response); | ||
| } catch (e) { | ||
| this.logService.error(e); | ||
| } | ||
| } | ||
|
|
||
| async deleteConnection() { | ||
| this.formPromise = this.apiService.deleteOrganizationConnection(this.existingConnectionId); | ||
| await this.formPromise; | ||
| this.setParentConnection(null); | ||
| } | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.