Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add owner information to organization #6811

Merged
merged 26 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a22be83
added orga owner to organization REST route
hotzenklotz Feb 3, 2023
bfbde56
add organization owner info to orga page
hotzenklotz Feb 3, 2023
cfca6c7
provide restricted plan message with owner information
hotzenklotz Feb 3, 2023
1574c22
make option to upgrade more prominent
hotzenklotz Feb 3, 2023
b04de23
Merge branch 'master' of github.com:scalableminds/webknossos into org…
hotzenklotz Feb 6, 2023
87474c4
replace tooltips with popovers
hotzenklotz Feb 6, 2023
7de089c
convert owner name information to string
hotzenklotz Feb 6, 2023
46df119
Merge branch 'master' of github.com:scalableminds/webknossos into org…
hotzenklotz Feb 6, 2023
3b33867
updated changelog
hotzenklotz Feb 6, 2023
9690642
remove unused comment
hotzenklotz Feb 6, 2023
fd01e98
Merge branch 'master' of github.com:scalableminds/webknossos into org…
hotzenklotz Feb 7, 2023
b189713
Update app/models/user/User.scala
hotzenklotz Feb 7, 2023
ba8780f
Merge branch 'orga_owner' of github.com:scalableminds/webknossos into…
hotzenklotz Feb 7, 2023
37b549c
Update app/models/organization/OrganizationService.scala
hotzenklotz Feb 7, 2023
f951c47
Merge branch 'orga_owner' of github.com:scalableminds/webknossos into…
hotzenklotz Feb 7, 2023
d11efcc
applied PR feedback
hotzenklotz Feb 7, 2023
3a9e63e
foo
hotzenklotz Feb 7, 2023
5ef0d43
Merge branch 'master' into orga_owner
hotzenklotz Feb 7, 2023
f47dd76
Merge branch 'master' of github.com:scalableminds/webknossos into org…
hotzenklotz Feb 7, 2023
788bee8
Merge branch 'orga_owner' of github.com:scalableminds/webknossos into…
hotzenklotz Feb 7, 2023
cc1c9fb
Merge branch 'master' into orga_owner
hotzenklotz Feb 8, 2023
5dd39a2
Merge branch 'master' of github.com:scalableminds/webknossos into org…
hotzenklotz Feb 8, 2023
ac034c8
applied PR feedback
hotzenklotz Feb 8, 2023
1926512
Merge branch 'orga_owner' of github.com:scalableminds/webknossos into…
hotzenklotz Feb 8, 2023
360332c
fix tests
hotzenklotz Feb 8, 2023
fba3c40
Merge branch 'master' into orga_owner
hotzenklotz Feb 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,13 @@ export function isFeatureAllowedByPricingPlan(
export function getFeatureNotAvailableInPlanMessage(
requiredPricingPlan: PricingPlanEnum,
organization: APIOrganization | null,
activeUser: APIUser | null | undefined,
) {
let organizationOwnerName = "";
if (activeUser?.isOrganizationOwner) {
return messages["organization.plan.feature_not_available.owner"](requiredPricingPlan);
}

let organizationOwnerName = "";
// expected naming schema for owner: "(M. Mustermann)" | ""
philippotto marked this conversation as resolved.
Show resolved Hide resolved
if (organization?.ownerName) {
{
Expand Down
18 changes: 13 additions & 5 deletions frontend/javascripts/components/pricing_enforcers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const PricingEnforcedMenuItem: React.FunctionComponent<
color={PRIMARY_COLOR_HEX}
content={
<div style={popOverStyle}>
{getFeatureNotAvailableInPlanMessage(requiredPricingPlan, activeOrganization)}
{getFeatureNotAvailableInPlanMessage(requiredPricingPlan, activeOrganization, activeUser)}
{getUpgradeNowButton(activeUser, activeOrganization)}
</div>
}
Expand Down Expand Up @@ -100,7 +100,7 @@ export const PricingEnforcedButton: React.FunctionComponent<RequiredPricingProps
color={PRIMARY_COLOR_HEX}
content={
<div style={popOverStyle}>
{getFeatureNotAvailableInPlanMessage(requiredPricingPlan, activeOrganization)}
{getFeatureNotAvailableInPlanMessage(requiredPricingPlan, activeOrganization, activeUser)}
{getUpgradeNowButton(activeUser, activeOrganization)}
</div>
}
Expand Down Expand Up @@ -145,7 +145,7 @@ export const PricingEnforcedBlur: React.FunctionComponent<RequiredPricingProps>
color={PRIMARY_COLOR_HEX}
content={
<div style={popOverStyle}>
{getFeatureNotAvailableInPlanMessage(requiredPricingPlan, activeOrganization)}
{getFeatureNotAvailableInPlanMessage(requiredPricingPlan, activeOrganization, activeUser)}
{getUpgradeNowButton(activeUser, activeOrganization)}
</div>
}
Expand All @@ -172,7 +172,11 @@ export const PricingEnforcedBlur: React.FunctionComponent<RequiredPricingProps>
>
<Alert
showIcon
message={getFeatureNotAvailableInPlanMessage(requiredPricingPlan, activeOrganization)}
message={getFeatureNotAvailableInPlanMessage(
requiredPricingPlan,
activeOrganization,
activeUser,
)}
icon={<LockOutlined />}
/>
</div>
Expand Down Expand Up @@ -203,7 +207,11 @@ export function PageUnavailableForYourPlanView({
title="Feature not available"
subTitle={
<p style={{ maxWidth: "500px", margin: "0 auto" }}>
{getFeatureNotAvailableInPlanMessage(requiredPricingPlan, activeOrganization)}
{getFeatureNotAvailableInPlanMessage(
requiredPricingPlan,
activeOrganization,
activeUser,
)}
</p>
}
extra={[
Expand Down
4 changes: 3 additions & 1 deletion frontend/javascripts/messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -440,5 +440,7 @@ instead. Only enable this option if you understand its effect. All layers will n
requiredPlan: string,
organizationOwnerName: string,
) =>
`This feature is not available in your organization's plan. Ask the owner of your organization ${organizationOwnerName} to upgrade to at least a ${requiredPlan} plan.`,
`This feature is not available in your organization's plan. Ask the owner of your organization ${organizationOwnerName} to upgrade to a ${requiredPlan} plan or higher.`,
"organization.plan.feature_not_available.owner": (requiredPlan: string) =>
`This feature is not available in your organization's plan. Consider upgrading to a ${requiredPlan} plan or higher.`,
};
11 changes: 9 additions & 2 deletions frontend/javascripts/oxalis/model/accessors/tool_accessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import {
} from "oxalis/model/accessors/volumetracing_accessor";
import { getVisibleSegmentationLayer } from "oxalis/model/accessors/dataset_accessor";
import { isMagRestrictionViolated } from "oxalis/model/accessors/flycam_accessor";
import { APIOrganization } from "types/api_flow_types";
import { APIOrganization, APIUser } from "types/api_flow_types";
import {
getFeatureNotAvailableInPlanMessage,
isFeatureAllowedByPricingPlan,
PricingPlanEnum,
} from "admin/organization/pricing_plan_utils";
import { enforceActiveUser } from "./user_accessor";

const zoomInToUseToolMessage = "Please zoom in further to use this tool.";

Expand Down Expand Up @@ -113,6 +114,7 @@ function _getDisabledInfoFromArgs(
hasAgglomerateMappings: boolean,
genericDisabledExplanation: string,
activeOrganization: APIOrganization | null,
activeUser: APIUser,
) {
const isProofReadingToolAllowed = isFeatureAllowedByPricingPlan(
activeOrganization,
Expand Down Expand Up @@ -166,7 +168,11 @@ function _getDisabledInfoFromArgs(
? !hasSkeleton
? disabledSkeletonExplanation
: disabledAgglomerateMappingsExplanation
: getFeatureNotAvailableInPlanMessage(PricingPlanEnum.Power, activeOrganization),
: getFeatureNotAvailableInPlanMessage(
PricingPlanEnum.Power,
activeOrganization,
activeUser,
),
},
};
}
Expand Down Expand Up @@ -236,6 +242,7 @@ export function getDisabledInfoForTools(state: OxalisState): Record<
hasAgglomerateMappings,
genericDisabledExplanation,
state.activeOrganization,
enforceActiveUser(state.activeUser),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why enforce? getFeatureNotAvailableInPlanMessage should be able to handle null for the active user. i think this could crash currently when viewing a public annotation.

);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,15 @@ class SegmentsView extends React.Component<Props, State> {
let disabled = true;

const activeOrganization = useSelector((state: OxalisState) => state.activeOrganization);
const activeUser = useSelector((state: OxalisState) => state.activeUser);
if (!isFeatureAllowedByPricingPlan(activeOrganization, PricingPlanEnum.Team)) {
return {
disabled: true,
title: getFeatureNotAvailableInPlanMessage(PricingPlanEnum.Team, activeOrganization),
title: getFeatureNotAvailableInPlanMessage(
PricingPlanEnum.Team,
activeOrganization,
activeUser,
),
};
}

Expand Down