Skip to content

Commit

Permalink
RavenDB-21797 Adjusted studio code to api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lwiel committed Apr 9, 2024
1 parent 26725e3 commit 8baa596
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const conflictResolutionSlice = createSlice({
},
});

const fetchConfig = createAsyncThunk<Raven.Client.ServerWide.ConflictSolver, database>(
const fetchConfig = createAsyncThunk<Raven.Client.ServerWide.ConflictSolver, string>(
"conflictResolution/fetchConfig",
async (db) => {
return await services.databasesService.getConflictSolverConfiguration(db);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export function ChangeLogModal(props: ChangelogModalProps) {
return null;
}

const canUpgrade = asyncGetChangeLog.result.IsLicenseEligibleForUpgrade;
const versionsList =
mode === "whatsNew"
? asyncGetChangeLog.result.BuildCompatibilitiesForLatestMajorMinor
Expand All @@ -72,37 +71,6 @@ export function ChangeLogModal(props: ChangelogModalProps) {
return (
<ModalWrapper onClose={onClose} mode={mode}>
<div className="changelog-modal">
{!isCloud && mode === "whatsNew" && (
<>
<div
className="well px-3 mx-auto w-fit-content mb-4 py-1 small rounded-pill"
id="updateLicenseInfo"
>
{canUpgrade ? (
<>
<Icon icon="check" color="success" /> Your license is compatible{" "}
</>
) : (
<>
<Icon icon="license" color="warning" /> Your license needs to be upgraded in order
to update{" "}
</>
)}
</div>
<UncontrolledPopover trigger="hover" className="bs5" placement="top" target="updateLicenseInfo">
<div className="px-2 py-1">
{canUpgrade ? (
<>Your license can be used with the target version</>
) : (
<>
Your license can&apos;t be used with the target version. Prior updating, please
contact Sales and update your license beforehand.
</>
)}
</div>
</UncontrolledPopover>
</>
)}

{versionsList.map((build, index) => {
const downgradeTooltipId = `canDowngradeTooltip-${index}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { LazyLoad } from "components/common/LazyLoad";
import { LoadError } from "components/common/LoadError";
import ButtonWithSpinner from "components/common/ButtonWithSpinner";
import { useServices } from "hooks/useServices";
import { useAccessManager } from "hooks/useAccessManager";
import forceLicenseUpdateCommand from "commands/licensing/forceLicenseUpdateCommand";
import licenseModel from "models/auth/licenseModel";
import useConfirm from "components/common/ConfirmDialog";
import useId from "hooks/useId";
import {accessManagerSelectors} from "components/common/shell/accessManagerSlice";

interface LicenseSummaryProps {
asyncCheckLicenseServerConnectivity: AsyncState<ConnectivityStatus>;
Expand Down Expand Up @@ -145,10 +145,10 @@ interface LicenseActionsProps {
function LicenseActions(props: LicenseActionsProps) {
const licenseStatus = useAppSelector(licenseSelectors.status);
const licenseRegistered = useAppSelector(licenseSelectors.licenseRegistered);
const isClusterAdminOrClusterNode = useAppSelector(accessManagerSelectors.isClusterAdminOrClusterNode);

const confirm = useConfirm();
const { licenseService } = useServices();
const { isClusterAdminOrClusterNode } = useAccessManager();
const [forcingUpdate, setForcingUpdate] = useState<boolean>(false);
const isCloud = useAppSelector(licenseSelectors.statusValue("IsCloud"));

Expand All @@ -164,9 +164,9 @@ function LicenseActions(props: LicenseActionsProps) {
const licenseConfiguration = asyncGetConfigurationSettings.result;

if (licenseRegistered) {
const isReplaceLicenseEnabled = licenseConfiguration.CanActivate && isClusterAdminOrClusterNode();
const isForceUpdateEnabled = licenseConfiguration.CanForceUpdate && isClusterAdminOrClusterNode();
const isRenewLicenseEnabled = licenseConfiguration.CanRenew && isClusterAdminOrClusterNode();
const isReplaceLicenseEnabled = licenseConfiguration.CanActivate && isClusterAdminOrClusterNode;
const isForceUpdateEnabled = licenseConfiguration.CanForceUpdate && isClusterAdminOrClusterNode;
const isRenewLicenseEnabled = licenseConfiguration.CanRenew && isClusterAdminOrClusterNode;

const forceUpdate = async () => {
const confirmed = await confirm({
Expand Down Expand Up @@ -213,7 +213,7 @@ function LicenseActions(props: LicenseActionsProps) {
<LicenseTooltip
target="renew-license-btn"
operationEnabledInConfiguration={licenseConfiguration.CanRenew}
hasPrivileges={isClusterAdminOrClusterNode()}
hasPrivileges={isClusterAdminOrClusterNode}
operationAction="Renew the current license (expiration date will be extended)"
operationTitle="Renew"
/>
Expand All @@ -234,7 +234,7 @@ function LicenseActions(props: LicenseActionsProps) {
<LicenseTooltip
target="replace-license-btn"
operationEnabledInConfiguration={licenseConfiguration.CanActivate}
hasPrivileges={isClusterAdminOrClusterNode()}
hasPrivileges={isClusterAdminOrClusterNode}
operationAction="Replace the current license with another"
operationTitle="Replacing license"
/>
Expand All @@ -255,15 +255,15 @@ function LicenseActions(props: LicenseActionsProps) {
<LicenseTooltip
target="force-update-license-btn"
operationEnabledInConfiguration={licenseConfiguration.CanForceUpdate}
hasPrivileges={isClusterAdminOrClusterNode()}
hasPrivileges={isClusterAdminOrClusterNode}
operationAction="Synchronize the current license with license server"
operationTitle="Force license update"
/>
</Col>
);
}

const isRegisterLicenseEnabled = licenseConfiguration.CanActivate && isClusterAdminOrClusterNode();
const isRegisterLicenseEnabled = licenseConfiguration.CanActivate && isClusterAdminOrClusterNode;

return (
<Col className="d-flex flex-wrap gap-2 align-items-center justify-content-end">
Expand All @@ -279,7 +279,7 @@ function LicenseActions(props: LicenseActionsProps) {
<LicenseTooltip
target="replace-license-btn"
operationEnabledInConfiguration={licenseConfiguration.CanActivate}
hasPrivileges={isClusterAdminOrClusterNode()}
hasPrivileges={isClusterAdminOrClusterNode}
operationAction="Register a new license"
operationTitle="Registering new license"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/Raven.Studio/typescript/test/stubs/LicenseStubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export class LicenseStubs {

static changeLog(): Raven.Server.Web.Studio.UpgradeInfoHandler.UpgradeInfoResponse {
return {
IsLicenseEligibleForUpgrade: true,
BuildCompatibilitiesForLatestMajorMinor: [
LicenseStubs.buildCompatibilityInfo("6.0.100"),
LicenseStubs.buildCompatibilityInfo("6.0.8"),
Expand All @@ -166,6 +165,7 @@ export class LicenseStubs {
private static buildCompatibilityInfo(fullVersion = "6.0.100"): BuildCompatibilityInfo {
return {
CanDowngradeFollowingUpgrade: true,
CanUpgrade: true,
ChangelogHtml: `<h3>Breaking changes</h3>
<ul>
<li><code>[Backups]</code> compression algorithm was changes from gzip/deflate to zstd, which might introduce some backward compatibility concerns. </li>
Expand Down

0 comments on commit 8baa596

Please sign in to comment.