* along with this program; if not, write to the Free Software Foundation, | * along with this program; if not, write to the Free Software Foundation, | ||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | * 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'; | import throwGlobalError from '../app/utils/throwGlobalError'; | ||||
export interface License { | export interface License { | ||||
type: string; | type: string; | ||||
} | } | ||||
export interface EditionStatus { | |||||
currentEditionKey?: string; | |||||
} | |||||
export function getEditionStatus(): Promise<EditionStatus> { | |||||
return getJSON('/api/editions/status'); | |||||
} | |||||
export function showLicense(): Promise<License> { | export function showLicense(): Promise<License> { | ||||
return getJSON('/api/editions/show_license').catch((e: { response: Response }) => { | return getJSON('/api/editions/show_license').catch((e: { response: Response }) => { | ||||
if (e.response && e.response.status === 404) { | if (e.response && e.response.status === 404) { | ||||
}); | }); | ||||
} | } | ||||
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 }> { | export function getFormData(): Promise<{ serverId: string; ncloc: number }> { | ||||
return getJSON('/api/editions/form_data').catch(throwGlobalError); | 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); | |||||
} |
import { getAppState, getMarketplacePendingPlugins } from '../../store/rootReducer'; | import { getAppState, getMarketplacePendingPlugins } from '../../store/rootReducer'; | ||||
import { getSettingsNavigation } from '../../api/nav'; | import { getSettingsNavigation } from '../../api/nav'; | ||||
import { setAdminPages } from '../../store/appState/duck'; | 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 { translate } from '../../helpers/l10n'; | ||||
import { Extension } from '../types'; | import { Extension } from '../types'; | ||||
import { PluginPendingResult } from '../../api/plugins'; | import { PluginPendingResult } from '../../api/plugins'; | ||||
interface StateProps { | interface StateProps { | ||||
appState: { | appState: { | ||||
adminPages: Extension[]; | adminPages: Extension[]; | ||||
edition: string; | |||||
organizationsEnabled: boolean; | organizationsEnabled: boolean; | ||||
version: string; | version: string; | ||||
}; | }; | ||||
interface DispatchToProps { | interface DispatchToProps { | ||||
fetchPendingPlugins: () => void; | fetchPendingPlugins: () => void; | ||||
fetchCurrentEdition: () => void; | |||||
setAdminPages: (adminPages: Extension[]) => void; | setAdminPages: (adminPages: Extension[]) => void; | ||||
} | } | ||||
handleRequiredAuthorization(); | handleRequiredAuthorization(); | ||||
} else { | } else { | ||||
this.fetchNavigationSettings(); | this.fetchNavigationSettings(); | ||||
this.props.fetchCurrentEdition(); | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
const mapDispatchToProps: DispatchToProps = { | const mapDispatchToProps: DispatchToProps = { | ||||
fetchCurrentEdition, | |||||
fetchPendingPlugins, | fetchPendingPlugins, | ||||
setAdminPages | setAdminPages | ||||
}; | }; |
import DuplicationsRating from '../../components/ui/DuplicationsRating'; | import DuplicationsRating from '../../components/ui/DuplicationsRating'; | ||||
import Level from '../../components/ui/Level'; | import Level from '../../components/ui/Level'; | ||||
import { EditButton, Button, SubmitButton, ResetButtonLink } from '../../components/ui/buttons'; | import { EditButton, Button, SubmitButton, ResetButtonLink } from '../../components/ui/buttons'; | ||||
import Checkbox from '../../components/controls/Checkbox'; | |||||
import DeferredSpinner from '../../components/common/DeferredSpinner'; | import DeferredSpinner from '../../components/common/DeferredSpinner'; | ||||
import Dropdown from '../../components/controls/Dropdown'; | import Dropdown from '../../components/controls/Dropdown'; | ||||
import ReloadButton from '../../components/controls/ReloadButton'; | import ReloadButton from '../../components/controls/ReloadButton'; | ||||
AlertSuccessIcon, | AlertSuccessIcon, | ||||
AlertWarnIcon, | AlertWarnIcon, | ||||
Button, | Button, | ||||
Checkbox, | |||||
CheckIcon, | CheckIcon, | ||||
ClearIcon, | ClearIcon, | ||||
CoverageRating, | CoverageRating, |
import { | import { | ||||
getAppState, | getAppState, | ||||
getGlobalSettingValue, | getGlobalSettingValue, | ||||
getMarketplaceCurrentEdition, | |||||
getMarketplacePendingPlugins | getMarketplacePendingPlugins | ||||
} from '../../store/rootReducer'; | } from '../../store/rootReducer'; | ||||
import { fetchPendingPlugins } from '../../store/marketplace/actions'; | import { fetchPendingPlugins } from '../../store/marketplace/actions'; | ||||
const mapStateToProps = (state: any) => { | const mapStateToProps = (state: any) => { | ||||
return { | return { | ||||
currentEdition: getMarketplaceCurrentEdition(state), | |||||
currentEdition: getAppState(state).edition, | |||||
pendingPlugins: getMarketplacePendingPlugins(state), | pendingPlugins: getMarketplacePendingPlugins(state), | ||||
standaloneMode: getAppState(state).standalone, | standaloneMode: getAppState(state).standalone, | ||||
updateCenterActive: | updateCenterActive: |
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
*/ | */ | ||||
import { Dispatch } from 'react-redux'; | import { Dispatch } from 'react-redux'; | ||||
import { getEditionStatus } from '../../api/marketplace'; | |||||
import { getPendingPlugins, PluginPendingResult } from '../../api/plugins'; | import { getPendingPlugins, PluginPendingResult } from '../../api/plugins'; | ||||
interface SetPendingPluginsAction { | interface SetPendingPluginsAction { | ||||
pending: PluginPendingResult; | 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 { | export function setPendingPlugins(pending: PluginPendingResult): SetPendingPluginsAction { | ||||
return { type: 'SET_PENDING_PLUGINS', pending }; | 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>) => { | export const fetchPendingPlugins = () => (dispatch: Dispatch<Action>) => { | ||||
getPendingPlugins().then( | getPendingPlugins().then( | ||||
pending => { | pending => { |
import { PluginPendingResult } from '../../api/plugins'; | import { PluginPendingResult } from '../../api/plugins'; | ||||
interface State { | interface State { | ||||
currentEdition?: string; | |||||
pending: PluginPendingResult; | pending: PluginPendingResult; | ||||
} | } | ||||
pending: action.pending | pending: action.pending | ||||
}; | }; | ||||
} | } | ||||
if (action.type === 'SET_CURRENT_EDITION') { | |||||
return { | |||||
...state, | |||||
currentEdition: action.currentEdition | |||||
}; | |||||
} | |||||
return state; | return state; | ||||
} | } | ||||
export const getCurrentEdition = (state: State) => state.currentEdition; | |||||
export const getPendingPlugins = (state: State) => state.pending; | export const getPendingPlugins = (state: State) => state.pending; |
export const getMarketplaceState = state => state.marketplace; | export const getMarketplaceState = state => state.marketplace; | ||||
export const getMarketplaceCurrentEdition = state => | |||||
fromMarketplace.getCurrentEdition(state.marketplace); | |||||
export const getMarketplacePendingPlugins = state => | export const getMarketplacePendingPlugins = state => | ||||
fromMarketplace.getPendingPlugins(state.marketplace); | fromMarketplace.getPendingPlugins(state.marketplace); | ||||
marketplace.update_status.INCOMPATIBLE=Incompatible | marketplace.update_status.INCOMPATIBLE=Incompatible | ||||
marketplace.update_status.REQUIRES_SYSTEM_UPGRADE=Requires system update | marketplace.update_status.REQUIRES_SYSTEM_UPGRADE=Requires system update | ||||
marketplace.update_status.DEPS_REQUIRE_SYSTEM_UPGRADE=Some of dependencies 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.installing_this_plugin_will_also_install_x=Installing this plugin will also install: {0} | ||||
marketplace.update_to_x=Update to {0} | marketplace.update_to_x=Update to {0} | ||||
marketplace.uninstall=Uninstall | marketplace.uninstall=Uninstall | ||||
marketplace.i_accept_the=I accept the | marketplace.i_accept_the=I accept the | ||||
marketplace.commercial_edition=Commercial Edition | |||||
marketplace.terms_and_conditions=Terms and Conditions | marketplace.terms_and_conditions=Terms and Conditions | ||||
marketplace.release_notes=Release Notes | marketplace.release_notes=Release Notes | ||||
marketplace.how_to_setup_cluster_url=Further configuration is required to set up a cluster. See {url} documentation. | 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... | marketplace.search=Search by features, tags, or categories... | ||||