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

Rename demo instance to wkorg instance #6941

Merged
merged 5 commits into from Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions MIGRATIONS.unreleased.md
Expand Up @@ -8,4 +8,6 @@ User-facing changes are documented in the [changelog](CHANGELOG.released.md).
## Unreleased
[Commits](https://github.com/scalableminds/webknossos/compare/23.04.0...HEAD)

- The config key features.isDemoInstance was renamed to features.isWkorgInstance (only needs to be adapted for the main wkorg instance). [#6941](https://github.com/scalableminds/webknossos/pull/6941/files)

### Postgres Evolutions:
10 changes: 5 additions & 5 deletions app/RequestHandler.scala
@@ -1,5 +1,5 @@
import com.typesafe.scalalogging.LazyLogging
import controllers.{Assets, DemoProxyController, SitemapController}
import controllers.{Assets, WkorgProxyController, SitemapController}
import javax.inject.Inject
import play.api.OptionalDevContext
import play.api.http.{DefaultHttpRequestHandler, HttpConfiguration, HttpErrorHandler, HttpFilters}
Expand All @@ -13,7 +13,7 @@ class RequestHandler @Inject()(webCommands: WebCommands,
router: Router,
errorHandler: HttpErrorHandler,
httpConfiguration: HttpConfiguration,
demoProxyController: DemoProxyController,
wkorgProxyController: WkorgProxyController,
filters: HttpFilters,
conf: WkConf,
assets: Assets,
Expand All @@ -35,11 +35,11 @@ class RequestHandler @Inject()(webCommands: WebCommands,
} else if (request.uri.matches("^(/assets/).*$")) {
val path = request.path.replaceFirst("^(/assets/)", "")
Some(assets.at(path = "/public", file = path))
} else if (request.uri.matches("""^/sitemap.xml$""") && conf.Features.isDemoInstance) {
} else if (request.uri.matches("""^/sitemap.xml$""") && conf.Features.isWkorgInstance) {
Some(sitemapController.getSitemap(conf.Http.uri))
} else if (request.uri.matches("^/sw\\.(.*)\\.js$") && conf.Features.isDemoInstance) {
} else if (request.uri.matches("^/sw\\.(.*)\\.js$") && conf.Features.isWkorgInstance) {
Some(Action { Ok("").as("text/javascript") })
} else if (request.uri == "/favicon.ico") {
Some(Action { NotFound })
} else Some(demoProxyController.proxyPageOrMainView)
} else Some(wkorgProxyController.proxyPageOrMainView)
}
4 changes: 2 additions & 2 deletions app/controllers/AuthenticationController.scala
Expand Up @@ -144,7 +144,7 @@ class AuthenticationController @Inject()(
_ <- Fox.runIf(inviteBox.isDefined)(Fox.runOptional(inviteBox.toOption)(i =>
inviteService.deactivateUsedInvite(i)(GlobalAccessContext)))
brainDBResult <- Fox.runIf(registerBrainDB)(brainTracing.registerIfNeeded(user, password.getOrElse("")))
_ = if (conf.Features.isDemoInstance) {
_ = if (conf.Features.isWkorgInstance) {
mailchimpClient.registerUser(user, multiUser, tag = MailchimpTag.RegisteredAsUser)
} else {
Mailer ! Send(defaultMails.newUserMail(user.name, email, brainDBResult.flatten, autoActivate))
Expand Down Expand Up @@ -597,7 +597,7 @@ class AuthenticationController @Inject()(
defaultMails.newOrganizationMail(organization.displayName,
email.toLowerCase,
request.headers.get("Host").getOrElse("")))
if (conf.Features.isDemoInstance) {
if (conf.Features.isWkorgInstance) {
mailchimpClient.registerUser(user, multiUser, MailchimpTag.RegisteredAsAdmin)
}
Ok
Expand Down
Expand Up @@ -14,7 +14,7 @@ import utils.WkConf
import scala.concurrent.ExecutionContext
import scala.util.matching.Regex

class DemoProxyController @Inject()(ws: WSClient, conf: WkConf, sil: Silhouette[WkEnv], multiUserDAO: MultiUserDAO)(
class WkorgProxyController @Inject()(ws: WSClient, conf: WkConf, sil: Silhouette[WkEnv], multiUserDAO: MultiUserDAO)(
implicit ec: ExecutionContext)
extends Controller {

Expand All @@ -30,7 +30,7 @@ class DemoProxyController @Inject()(ws: WSClient, conf: WkConf, sil: Silhouette[
}

private def matchesProxyPage(request: UserAwareRequest[WkEnv, AnyContent]): Boolean =
conf.Features.isDemoInstance && conf.Proxy.routes
conf.Features.isWkorgInstance && conf.Proxy.routes
.exists(route => matchesPageWithWildcard(route, request.path)) && (request.identity.isEmpty || request.uri != "/")

private def matchesPageWithWildcard(routeWithWildcard: String, actualRequest: String): Boolean = {
Expand Down
4 changes: 2 additions & 2 deletions app/models/organization/OrganizationService.scala
Expand Up @@ -77,7 +77,7 @@ class OrganizationService @Inject()(organizationDAO: OrganizationDAO,

def assertMayCreateOrganization(requestingUser: Option[User]): Fox[Unit] = {
val noOrganizationPresent = initialDataService.assertNoOrganizationsPresent
val activatedInConfig = bool2Fox(conf.Features.isDemoInstance) ?~> "allowOrganizationCreation.notEnabled"
val activatedInConfig = bool2Fox(conf.Features.isWkorgInstance) ?~> "allowOrganizationCreation.notEnabled"
val userIsSuperUser = requestingUser.toFox.flatMap(user =>
multiUserDAO.findOne(user._multiUser)(GlobalAccessContext).flatMap(multiUser => bool2Fox(multiUser.isSuperUser)))

Expand All @@ -93,7 +93,7 @@ class OrganizationService @Inject()(organizationDAO: OrganizationDAO,
.replaceAll(" ", "_")
existingOrganization <- organizationDAO.findOneByName(organizationName)(GlobalAccessContext).futureBox
_ <- bool2Fox(existingOrganization.isEmpty) ?~> "organization.name.alreadyInUse"
initialPricingParameters = if (conf.Features.isDemoInstance) (PricingPlan.Basic, Some(3), Some(50000000000L))
initialPricingParameters = if (conf.Features.isWkorgInstance) (PricingPlan.Basic, Some(3), Some(50000000000L))
else (PricingPlan.Custom, None, None)
organizationRootFolder = Folder(ObjectId.generate, folderService.defaultRootName)

Expand Down
2 changes: 1 addition & 1 deletion app/utils/WkConf.scala
Expand Up @@ -95,7 +95,7 @@ class WkConf @Inject()(configuration: Configuration) extends ConfigReader with L
}

object Features {
val isDemoInstance: Boolean = get[Boolean]("features.isDemoInstance")
val isWkorgInstance: Boolean = get[Boolean]("features.isWkorgInstance")
val jobsEnabled: Boolean = get[Boolean]("features.jobsEnabled")
val voxelyticsEnabled: Boolean = get[Boolean]("features.voxelyticsEnabled")
val taskReopenAllowed: FiniteDuration = get[Int]("features.taskReopenAllowedInSeconds") seconds
Expand Down
4 changes: 2 additions & 2 deletions app/views/main.scala.html
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<meta name="commit-hash" content="@(webknossos.BuildInfo.commitHash)" />
<title>@(conf.WebKnossos.tabTitle)</title>
@if(conf.Features.isDemoInstance){
@if(conf.Features.isWkorgInstance){
<meta
name="description"
content="Annotate and explore large 3D datasets with WEBKNOSSOS. Fast neurite skeletonization. 3D voxel painting. Collaboration, sharing and crowdsourcing."
Expand Down Expand Up @@ -55,7 +55,7 @@
></script>
<script src="/assets/bundle/vendors~main.js?nocache=@(webknossos.BuildInfo.commitHash)"></script>
<script src="/assets/bundle/main.js?nocache=@(webknossos.BuildInfo.commitHash)"></script>
@if(conf.Features.isDemoInstance){
@if(conf.Features.isWkorgInstance){
<script type="text/javascript" src="https://app.olvy.co/script.js" defer="defer"></script>
<script>
// Suppress warning emitted by Olvy because it tries to eagerly initialize
Expand Down
8 changes: 4 additions & 4 deletions conf/application.conf
Expand Up @@ -104,15 +104,15 @@ features {
discussionBoard = "https://forum.image.sc/tag/webknossos"
discussionBoardRequiresAdmin = false
hideNavbarLogin = false
isDemoInstance = false
isWkorgInstance = false
taskReopenAllowedInSeconds = 30
allowDeleteDatasets = true
# to enable jobs for local development, use "yarn enable-jobs" to also activate it in the database
jobsEnabled = false
voxelyticsEnabled = false
# For new users, the dashboard will show a banner which encourages the user to check out the following dataset.
# If isDemoInstance == true, `/createExplorative/hybrid/true` is appended to the URL so that a new tracing is opened.
# If isDemoInstance == false, `/view` is appended to the URL so that it's opened in view mode (since the user might not
# If isWkorgInstance == true, `/createExplorative/hybrid/true` is appended to the URL so that a new tracing is opened.
# If isWkorgInstance == false, `/view` is appended to the URL so that it's opened in view mode (since the user might not
# have an account).
publicDemoDatasetUrl = "https://webknossos.org/datasets/scalable_minds/l4dense_motta_et_al_demo"
exportTiffMaxVolumeMVx = 1024
Expand Down Expand Up @@ -178,7 +178,7 @@ datastore {
agglomerateSkeleton.maxEdges = 100000
}

# Proxy some routes to prefix + route (only if features.isDemoInstance, route "/" only if logged out)
# Proxy some routes to prefix + route (only if features.isWkorgInstance, route "/" only if logged out)
proxy {
prefix = ""
routes = []
Expand Down
2 changes: 1 addition & 1 deletion frontend/javascripts/admin/auth/authentication_modal.tsx
Expand Up @@ -41,7 +41,7 @@ export default function AuthenticationModal({
// SpotlightRegistrationForm always creates a new organization. If an inviteToken
// exists, a normal RegistrationForm needs to be used.
const registrationForm =
inviteToken == null && features().isDemoInstance ? (
inviteToken == null && features().isWkorgInstance ? (
<SpotlightRegistrationForm onRegistered={onRegistered} />
) : (
<RegistrationForm onRegistered={onRegistered} inviteToken={inviteToken} />
Expand Down
2 changes: 1 addition & 1 deletion frontend/javascripts/admin/auth/registration_view.tsx
Expand Up @@ -122,7 +122,7 @@ function RegistrationViewDemo() {
}

function RegistrationView() {
return features().isDemoInstance ? <RegistrationViewDemo /> : <RegistrationViewNotDemo />;
return features().isWkorgInstance ? <RegistrationViewDemo /> : <RegistrationViewNotDemo />;
}

export default RegistrationView;
2 changes: 1 addition & 1 deletion frontend/javascripts/admin/dataset/dataset_add_view.tsx
Expand Up @@ -344,7 +344,7 @@ const banners = [segmentationBanner, alignBanner, manualAnnotationBanner];
function VoxelyticsBanner() {
const [bannerIndex] = useState(Math.floor(Math.random() * banners.length));

if (!features().isDemoInstance) {
if (!features().isWkorgInstance) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions frontend/javascripts/admin/dataset/dataset_upload_view.tsx
Expand Up @@ -648,7 +648,7 @@ class DatasetUploadView extends React.Component<PropsWithFormAndRouter, State> {
targetFolderId: new URLSearchParams(location.search).get("to"),
}}
>
{features().isDemoInstance && (
{features().isWkorgInstance && (
<Alert
message={
<>
Expand Down Expand Up @@ -696,7 +696,7 @@ class DatasetUploadView extends React.Component<PropsWithFormAndRouter, State> {
});
}}
afterFetchedTeams={(fetchedTeams) => {
if (!features().isDemoInstance) {
if (!features().isWkorgInstance) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/javascripts/admin/onboarding.tsx
Expand Up @@ -642,7 +642,7 @@ class OnboardingView extends React.PureComponent<Props, State> {
);

getAvailableSteps() {
if (features().isDemoInstance) {
if (features().isWkorgInstance) {
return [
{
title: "Create Organization",
Expand Down
2 changes: 1 addition & 1 deletion frontend/javascripts/admin/task/task_list_view.tsx
Expand Up @@ -286,7 +286,7 @@ class TaskListView extends React.PureComponent<Props, State> {
>
Tasks
</h3>
{features().isDemoInstance ? (
{features().isWkorgInstance ? (
<>
<a
href="https://webknossos.org/services/annotations"
Expand Down
4 changes: 2 additions & 2 deletions frontend/javascripts/dashboard/dashboard_view.tsx
Expand Up @@ -86,7 +86,7 @@ class DashboardView extends PureComponent<PropsWithRouter, State> {

if (this.props.isAdminView) {
defaultTabKey = "tasks";
} else if (features().isDemoInstance) {
} else if (features().isWkorgInstance) {
defaultTabKey = "publications";
}

Expand Down Expand Up @@ -144,7 +144,7 @@ class DashboardView extends PureComponent<PropsWithRouter, State> {
getValidTabKeys() {
const { isAdminView } = this.props;
return {
publications: features().isDemoInstance,
publications: features().isWkorgInstance,
datasets: !isAdminView,
tasks: true,
explorativeAnnotations: true,
Expand Down
4 changes: 2 additions & 2 deletions frontend/javascripts/dashboard/dataset_view.tsx
Expand Up @@ -78,7 +78,7 @@ const persistence = new Persistence<PersistenceState>(
);

function filterDatasetsForUsersOrganization(datasets: APIDatasetCompact[], user: APIUser) {
return features().isDemoInstance
return features().isWkorgInstance
? datasets.filter((d) => d.owningOrganization === user.organization)
: datasets;
}
Expand Down Expand Up @@ -541,7 +541,7 @@ function renderPlaceholder(
>
<Col span={18}>
<Row gutter={16} justify="center" align="bottom">
{features().isDemoInstance ? openPublicDatasetCard : null}
{features().isWkorgInstance ? openPublicDatasetCard : null}
{Utils.isUserAdminOrDatasetManager(user) ? uploadPlaceholder : null}
</Row>
<div
Expand Down
6 changes: 3 additions & 3 deletions frontend/javascripts/navbar.tsx
Expand Up @@ -77,7 +77,7 @@ function useOlvy() {
const [isInitialized, setIsInitialized] = useState(false);
// Initialize Olvy after mounting
useEffect(() => {
if (!features().isDemoInstance) {
if (!features().isWkorgInstance) {
return;
}

Expand Down Expand Up @@ -118,7 +118,7 @@ function useOlvyUnreadReleasesCount(activeUser: APIUser) {
const unreadCount = useFetch(
async () => {
// @ts-expect-error ts-migrate(2339) FIXME: Property 'Olvy' does not exist on type '(Window & ... Remove this comment to see the full error message
if (!isInitialized || !features().isDemoInstance || !window.Olvy) {
if (!isInitialized || !features().isWkorgInstance || !window.Olvy) {
return null;
}

Expand Down Expand Up @@ -360,7 +360,7 @@ function getHelpSubMenu(
label: "Ask a Question",
});

if (features().isDemoInstance) {
if (features().isWkorgInstance) {
helpSubMenuItems.push({
key: "contact",
label: (
Expand Down
Expand Up @@ -52,7 +52,7 @@ function showWelcomeToast() {
export default function WelcomeToast() {
const activeUser = useSelector((state: OxalisState) => state.activeUser);
useEffect(() => {
if (!features().isDemoInstance) {
if (!features().isWkorgInstance) {
return;
}
const hasSeenToast = UserLocalStorage.getItem(
Expand Down
6 changes: 3 additions & 3 deletions frontend/javascripts/router.tsx
Expand Up @@ -224,7 +224,7 @@ class ReactRouter extends React.Component<Props> {
exact
path="/"
render={() => {
if (!this.props.hasOrganizations && !features().isDemoInstance) {
if (!this.props.hasOrganizations && !features().isWkorgInstance) {
return <Redirect to="/onboarding" />;
}

Expand Down Expand Up @@ -279,7 +279,7 @@ class ReactRouter extends React.Component<Props> {
return <DashboardView userId={null} isAdminView={false} initialTabKey={null} />;
}

// Hard navigate so that webknossos.org is shown for the demo instance.
// Hard navigate so that webknossos.org is shown for the wkorg instance.
window.location.href = "/";
return null;
}}
Expand Down Expand Up @@ -705,7 +705,7 @@ class ReactRouter extends React.Component<Props> {
/>
)}
/>
{!features().isDemoInstance && (
{!features().isWkorgInstance && (
<RouteWithErrorBoundary path="/onboarding" component={Onboarding} />
)}
<RouteWithErrorBoundary component={PageNotFoundView} />
Expand Down
Expand Up @@ -75,7 +75,7 @@ Generated by [AVA](https://avajs.dev).
exportTiffMaxEdgeLengthVx: 8192,
exportTiffMaxVolumeMVx: 1024,
hideNavbarLogin: false,
isDemoInstance: false,
isWkorgInstance: false,
jobsEnabled: false,
openIdConnectEnabled: false,
optInTabs: [],
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion frontend/javascripts/types/api_flow_types.ts
Expand Up @@ -606,7 +606,7 @@ export type APIFeatureToggles = {
readonly discussionBoard: string | false;
readonly discussionBoardRequiresAdmin: boolean;
readonly hideNavbarLogin: boolean;
readonly isDemoInstance: boolean;
readonly isWkorgInstance: boolean;
readonly taskReopenAllowedInSeconds: number;
readonly allowDeleteDatasets: boolean;
readonly jobsEnabled: boolean;
Expand Down