]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10696 Move set license form to core-extension-license
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Wed, 30 May 2018 14:33:07 +0000 (16:33 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 12 Jun 2018 18:21:00 +0000 (20:21 +0200)
server/sonar-web/src/main/js/api/marketplace.ts
server/sonar-web/src/main/js/app/components/AdminContainer.tsx
server/sonar-web/src/main/js/app/utils/exposeLibraries.ts
server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx
server/sonar-web/src/main/js/store/marketplace/actions.ts
server/sonar-web/src/main/js/store/marketplace/reducer.ts
server/sonar-web/src/main/js/store/rootReducer.js
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index adbb4442343b68705d04fdca2c64f71cf8929e92..0681931e509d690f2eb9257c42484f1955fa201c 100644 (file)
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
-import { getJSON, postJSON } from '../helpers/request';
+import { getJSON } from '../helpers/request';
 import throwGlobalError from '../app/utils/throwGlobalError';
 
 export interface License {
@@ -37,14 +37,6 @@ export interface License {
   type: string;
 }
 
-export interface EditionStatus {
-  currentEditionKey?: string;
-}
-
-export function getEditionStatus(): Promise<EditionStatus> {
-  return getJSON('/api/editions/status');
-}
-
 export function showLicense(): Promise<License> {
   return getJSON('/api/editions/show_license').catch((e: { response: Response }) => {
     if (e.response && e.response.status === 404) {
@@ -54,19 +46,6 @@ export function showLicense(): Promise<License> {
   });
 }
 
-export function getLicensePreview(data: {
-  license: string;
-}): Promise<{
-  nextEditionKey: string;
-  previewStatus: 'NO_INSTALL' | 'AUTOMATIC_INSTALL' | 'MANUAL_INSTALL';
-}> {
-  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<EditionStatus> {
-  return postJSON('/api/editions/apply_license', data).catch(throwGlobalError);
-}
index 3347e3e922fb5fd934e3d4070423edc05b59a909..c6440c317e027360179606744cc44d72dcd09c06 100644 (file)
@@ -25,7 +25,7 @@ import SettingsNav from './nav/settings/SettingsNav';
 import { getAppState, getMarketplacePendingPlugins } from '../../store/rootReducer';
 import { getSettingsNavigation } from '../../api/nav';
 import { setAdminPages } from '../../store/appState/duck';
-import { fetchCurrentEdition, fetchPendingPlugins } from '../../store/marketplace/actions';
+import { fetchPendingPlugins } from '../../store/marketplace/actions';
 import { translate } from '../../helpers/l10n';
 import { Extension } from '../types';
 import { PluginPendingResult } from '../../api/plugins';
@@ -34,6 +34,7 @@ import handleRequiredAuthorization from '../utils/handleRequiredAuthorization';
 interface StateProps {
   appState: {
     adminPages: Extension[];
+    edition: string;
     organizationsEnabled: boolean;
     version: string;
   };
@@ -42,7 +43,6 @@ interface StateProps {
 
 interface DispatchToProps {
   fetchPendingPlugins: () => void;
-  fetchCurrentEdition: () => void;
   setAdminPages: (adminPages: Extension[]) => void;
 }
 
@@ -62,7 +62,6 @@ class AdminContainer extends React.PureComponent<Props> {
       handleRequiredAuthorization();
     } else {
       this.fetchNavigationSettings();
-      this.props.fetchCurrentEdition();
     }
   }
 
@@ -101,7 +100,6 @@ const mapStateToProps = (state: any): StateProps => ({
 });
 
 const mapDispatchToProps: DispatchToProps = {
-  fetchCurrentEdition,
   fetchPendingPlugins,
   setAdminPages
 };
index ed1178b283aa68a0c2e221f09e87395e2f9eb0e7..2716c21be7db4830056db9e947b6724c310e13c6 100644 (file)
@@ -39,6 +39,7 @@ import CoverageRating from '../../components/ui/CoverageRating';
 import DuplicationsRating from '../../components/ui/DuplicationsRating';
 import Level from '../../components/ui/Level';
 import { EditButton, Button, SubmitButton, ResetButtonLink } from '../../components/ui/buttons';
+import Checkbox from '../../components/controls/Checkbox';
 import DeferredSpinner from '../../components/common/DeferredSpinner';
 import Dropdown from '../../components/controls/Dropdown';
 import ReloadButton from '../../components/controls/ReloadButton';
@@ -65,6 +66,7 @@ const exposeLibraries = () => {
     AlertSuccessIcon,
     AlertWarnIcon,
     Button,
+    Checkbox,
     CheckIcon,
     ClearIcon,
     CoverageRating,
index eabc536fda5da1044903773d215aaa8f8c759361..78f4496d67aa050def40af78b436683e6afe1942 100644 (file)
@@ -22,7 +22,6 @@ import App from './App';
 import {
   getAppState,
   getGlobalSettingValue,
-  getMarketplaceCurrentEdition,
   getMarketplacePendingPlugins
 } from '../../store/rootReducer';
 import { fetchPendingPlugins } from '../../store/marketplace/actions';
@@ -46,7 +45,7 @@ interface DispatchToProps {
 
 const mapStateToProps = (state: any) => {
   return {
-    currentEdition: getMarketplaceCurrentEdition(state),
+    currentEdition: getAppState(state).edition,
     pendingPlugins: getMarketplacePendingPlugins(state),
     standaloneMode: getAppState(state).standalone,
     updateCenterActive:
index 7e9b6156d9caa423ba8d91e140f180561761df07..3f007ae52e130365218a17d26d452bcc5538ac2a 100644 (file)
@@ -18,7 +18,6 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import { Dispatch } from 'react-redux';
-import { getEditionStatus } from '../../api/marketplace';
 import { getPendingPlugins, PluginPendingResult } from '../../api/plugins';
 
 interface SetPendingPluginsAction {
@@ -26,28 +25,12 @@ interface SetPendingPluginsAction {
   pending: PluginPendingResult;
 }
 
-interface SetCurrentEditionAction {
-  type: 'SET_CURRENT_EDITION';
-  currentEdition?: string;
-}
-
-export type Action = SetCurrentEditionAction | SetPendingPluginsAction;
+export type Action = SetPendingPluginsAction;
 
 export function setPendingPlugins(pending: PluginPendingResult): SetPendingPluginsAction {
   return { type: 'SET_PENDING_PLUGINS', pending };
 }
 
-export const setCurrentEdition = (currentEdition?: string) => (dispatch: Dispatch<Action>) => {
-  dispatch({ type: 'SET_CURRENT_EDITION', currentEdition });
-};
-
-export const fetchCurrentEdition = () => (dispatch: Dispatch<Action>) => {
-  getEditionStatus().then(
-    editionStatus => dispatch(setCurrentEdition(editionStatus.currentEditionKey)),
-    () => {}
-  );
-};
-
 export const fetchPendingPlugins = () => (dispatch: Dispatch<Action>) => {
   getPendingPlugins().then(
     pending => {
index 55ad93d69db3abd16a86644c70c68d99f1ef11b4..3ab4d7788489e942fe001aa80e38ff39c5cc843d 100644 (file)
@@ -21,7 +21,6 @@ import { Action } from './actions';
 import { PluginPendingResult } from '../../api/plugins';
 
 interface State {
-  currentEdition?: string;
   pending: PluginPendingResult;
 }
 
@@ -34,14 +33,7 @@ export default function(state: State = defaultState, action: Action): State {
       pending: action.pending
     };
   }
-  if (action.type === 'SET_CURRENT_EDITION') {
-    return {
-      ...state,
-      currentEdition: action.currentEdition
-    };
-  }
   return state;
 }
 
-export const getCurrentEdition = (state: State) => state.currentEdition;
 export const getPendingPlugins = (state: State) => state.pending;
index 7581381ce28802e91d65db1db801de27928febd8..9f724a71fc5428f39db0a86d60c3d434ef0ea8fd 100644 (file)
@@ -73,9 +73,6 @@ export const isFavorite = (state, componentKey) =>
 
 export const getMarketplaceState = state => state.marketplace;
 
-export const getMarketplaceCurrentEdition = state =>
-  fromMarketplace.getCurrentEdition(state.marketplace);
-
 export const getMarketplacePendingPlugins = state =>
   fromMarketplace.getPendingPlugins(state.marketplace);
 
index e0348723652a6a665abfbd537d3161784aa5a309..546935e89ba50972c6995e48cc825090b21c4a75 100644 (file)
@@ -2166,21 +2166,13 @@ marketplace.update_status.COMPATIBLE=Compatible
 marketplace.update_status.INCOMPATIBLE=Incompatible
 marketplace.update_status.REQUIRES_SYSTEM_UPGRADE=Requires system update
 marketplace.update_status.DEPS_REQUIRE_SYSTEM_UPGRADE=Some of dependencies requires system update
-marketplace.license_preview_status.NO_INSTALL=No installation needed, your license will be updated directly.
-marketplace.license_preview_status.AUTOMATIC_INSTALL=After clicking on "Install", your {0} will be automatically downloaded and installed, and you'll need to restart your server once it's completed.
-marketplace.license_preview_status.MANUAL_INSTALL={0} can't automatically be installed because of internet access issues. A manual installation is required.
 marketplace.installing_this_plugin_will_also_install_x=Installing this plugin will also install: {0}
 marketplace.update_to_x=Update to {0}
 marketplace.uninstall=Uninstall
 marketplace.i_accept_the=I accept the
-marketplace.commercial_edition=Commercial Edition
 marketplace.terms_and_conditions=Terms and Conditions
 marketplace.release_notes=Release Notes
 marketplace.how_to_setup_cluster_url=Further configuration is required to set up a cluster. See {url} documentation.
-marketplace.enter_license_for_x=Enter your license key for {0}
-marketplace.wrong_license_type=Your license is not compatible with any existing editions. Please provide a valid license.
-marketplace.wrong_license_type_x=Your license is not compatible with the selected edition. Please provide a valid license for {0}.
-marketplace.i_need_a_license=I need a license key
 marketplace.search=Search by features, tags, or categories...