From 1dc612122fde774d7f8e3781b6020b535722ee32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Thu, 19 Oct 2017 10:26:51 +0200 Subject: [PATCH] SONAR-9954 Add serverId and nloc query to the request license url --- .../sonar-web/src/main/js/api/marketplace.ts | 4 ++ .../components/LicenseEditionForm.tsx | 14 +++--- .../components/LicenseEditionSet.tsx | 38 ++++++++++++-- .../LicenseEditionSet-test.tsx.snap | 2 +- ...DeferredSpinner.js => DeferredSpinner.tsx} | 49 +++++++------------ 5 files changed, 64 insertions(+), 43 deletions(-) rename server/sonar-web/src/main/js/components/common/{DeferredSpinner.js => DeferredSpinner.tsx} (72%) diff --git a/server/sonar-web/src/main/js/api/marketplace.ts b/server/sonar-web/src/main/js/api/marketplace.ts index 30c801ae0f2..57ee9128883 100644 --- a/server/sonar-web/src/main/js/api/marketplace.ts +++ b/server/sonar-web/src/main/js/api/marketplace.ts @@ -65,6 +65,10 @@ export function getLicensePreview(data: { return postJSON('/api/editions/preview', data).catch(throwGlobalError); } +export function getFormData(): Promise<{ serverId: string; ncloc: number }> { + return getJSON('/api/editions/form_data').catch(throwGlobalError); +} + export function applyLicense(data: { license: string }): Promise { return postJSON('/api/editions/apply_license', data).catch(throwGlobalError); } diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionForm.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionForm.tsx index 857a40e4058..6971889135c 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionForm.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/LicenseEditionForm.tsx @@ -32,13 +32,13 @@ export interface Props { interface State { license: string; - loading: boolean; status?: string; + submitting: boolean; } export default class LicenseEditionForm extends React.PureComponent { mounted: boolean; - state: State = { license: '', loading: false }; + state: State = { license: '', submitting: false }; componentDidMount() { this.mounted = true; @@ -63,7 +63,7 @@ export default class LicenseEditionForm extends React.PureComponent { this.props.updateEditionStatus(editionStatus); @@ -71,7 +71,7 @@ export default class LicenseEditionForm extends React.PureComponent { if (this.mounted) { - this.setState({ loading: false }); + this.setState({ submitting: false }); } } ); @@ -80,7 +80,7 @@ export default class LicenseEditionForm extends React.PureComponent