Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -39,11 +39,6 @@ import org.apache.texera.web.resource.dashboard.admin.execution.AdminExecutionRe
import org.apache.texera.web.resource.dashboard.admin.user.AdminUserResource
import org.apache.texera.web.resource.dashboard.hub.HubResource
import org.apache.texera.web.resource.dashboard.user.UserResource
import org.apache.texera.web.resource.dashboard.user.project.{
ProjectAccessResource,
ProjectResource,
PublicProjectResource
}
import org.apache.texera.web.resource.dashboard.user.quota.UserQuotaResource
import org.apache.texera.web.resource.dashboard.user.workflow.{
WorkflowAccessResource,
Expand Down Expand Up @@ -145,14 +140,11 @@ class TexeraWebApplication
environment.jersey.register(classOf[UserConfigResource])
environment.jersey.register(classOf[FeedbackResource])
environment.jersey.register(classOf[AdminUserResource])
environment.jersey.register(classOf[PublicProjectResource])
environment.jersey.register(classOf[WorkflowAccessResource])
environment.jersey.register(classOf[WorkflowResource])
environment.jersey.register(classOf[HubResource])
environment.jersey.register(classOf[UserResource])
environment.jersey.register(classOf[WorkflowVersionResource])
environment.jersey.register(classOf[ProjectResource])
environment.jersey.register(classOf[ProjectAccessResource])
environment.jersey.register(classOf[WorkflowExecutionsResource])
environment.jersey.register(classOf[DashboardResource])
environment.jersey.register(classOf[GmailResource])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ object DashboardResource {
case class DashboardClickableFileEntry(
resourceType: String,
workflow: Option[DashboardWorkflow] = None,
project: Option[Project] = None,
dataset: Option[DashboardDataset] = None
)

Expand All @@ -54,15 +53,14 @@ object DashboardResource {
The following class describe the available params from the frontend for full text search.
* @param user The authenticated user performing the search.
* @param keywords A list of search keywords. The API will return resources that match any of these keywords.
* @param resourceType The type of the resources to include in the search results. Acceptable values are "workflow", "project", "file" and "" (for all types).
* @param resourceType The type of the resources to include in the search results. Acceptable values are "workflow", "file" and "" (for all types).
* @param creationStartDate The start of the date range for the creation time filter. It should be provided in 'yyyy-MM-dd' format.
* @param creationEndDate The end of the date range for the creation time filter. It should be provided in 'yyyy-MM-dd' format.
* @param modifiedStartDate The start of the date range for the modification time filter. It should be provided in 'yyyy-MM-dd' format.
* @param modifiedEndDate The end of the date range for the modification time filter. It should be provided in 'yyyy-MM-dd' format.
* @param owners A list of owner names to include in the search results.
* @param workflowIDs A list of workflow IDs to include in the search results.
* @param operators A list of operators to include in the search results.
* @param projectIds A list of project IDs to include in the search results.
* @param offset The number of initial results to skip. This is useful for implementing pagination.
* @param count The maximum number of results to return.
* @param orderBy The order in which to sort the results. Acceptable values are 'NameAsc', 'NameDesc', 'CreateTimeDesc', and 'EditTimeDesc'.
Expand All @@ -77,7 +75,6 @@ object DashboardResource {
@QueryParam("owner") owners: java.util.List[String] = new util.ArrayList(),
@QueryParam("id") workflowIDs: java.util.List[Integer] = new util.ArrayList(),
@QueryParam("operator") operators: java.util.List[String] = new util.ArrayList(),
@QueryParam("projectId") projectIds: java.util.List[Integer] = new util.ArrayList(),
@QueryParam("datasetId") datasetIds: java.util.List[Integer] = new util.ArrayList(),
@QueryParam("start") @DefaultValue("0") offset: Int = 0,
@QueryParam("count") @DefaultValue("20") count: Int = 20,
Expand All @@ -95,15 +92,12 @@ object DashboardResource {
val query = params.resourceType match {
case SearchQueryBuilder.WORKFLOW_RESOURCE_TYPE =>
WorkflowSearchQueryBuilder.constructQuery(uid, params, includePublic)
case SearchQueryBuilder.PROJECT_RESOURCE_TYPE =>
ProjectSearchQueryBuilder.constructQuery(uid, params, includePublic)
case SearchQueryBuilder.DATASET_RESOURCE_TYPE =>
DatasetSearchQueryBuilder.constructQuery(uid, params, includePublic)
case SearchQueryBuilder.ALL_RESOURCE_TYPE =>
val q1 = WorkflowSearchQueryBuilder.constructQuery(uid, params, includePublic)
val q3 = ProjectSearchQueryBuilder.constructQuery(uid, params, includePublic)
val q4 = DatasetSearchQueryBuilder.constructQuery(uid, params, includePublic)
q1.unionAll(q3).unionAll(q4)
q1.unionAll(q4)
case _ => throw new IllegalArgumentException(s"Unknown resource type: ${params.resourceType}")
}

Expand All @@ -118,8 +112,6 @@ object DashboardResource {
resourceType match {
case SearchQueryBuilder.WORKFLOW_RESOURCE_TYPE =>
WorkflowSearchQueryBuilder.toEntry(uid, record)
case SearchQueryBuilder.PROJECT_RESOURCE_TYPE =>
ProjectSearchQueryBuilder.toEntry(uid, record)
case SearchQueryBuilder.DATASET_RESOURCE_TYPE =>
DatasetSearchQueryBuilder.toEntry(uid, record)
}
Expand Down Expand Up @@ -180,10 +172,10 @@ object DashboardResource {
class DashboardResource {

/**
* This method performs a full-text search across all resources - workflows, projects, and files -
* This method performs a full-text search across all resources - workflows and datasets -
* that match the specified keywords.
* It supports advanced filters such as resource type, creation and modification dates, owner,
* workflow IDs, operators, project IDs and allows to specify the number of results and their ordering.
* workflow IDs and operators, and allows to specify the number of results and their ordering.
*
* This method utilizes MySQL Boolean Full-Text Searches
* reference: https://dev.mysql.com/doc/refman/8.0/en/fulltext-boolean.html
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ object SearchQueryBuilder {
.createDSLContext()
val FILE_RESOURCE_TYPE = "file"
val WORKFLOW_RESOURCE_TYPE = "workflow"
val PROJECT_RESOURCE_TYPE = "project"
val DATASET_RESOURCE_TYPE = "dataset"
val ALL_RESOURCE_TYPE = ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,9 @@ object UnifiedResourceSchema {
ownerId: Field[Integer] = DSL.cast(null, classOf[Integer]),
wid: Field[Integer] = DSL.cast(null, classOf[Integer]),
workflowUserAccess: Field[PrivilegeEnum] = DSL.castNull(classOf[PrivilegeEnum]),
projectsOfWorkflow: Field[String] = DSL.inline(""),
uid: Field[Integer] = DSL.cast(null, classOf[Integer]),
userName: Field[String] = DSL.inline(""),
userEmail: Field[String] = DSL.inline(""),
pid: Field[Integer] = DSL.cast(null, classOf[Integer]),
projectOwnerId: Field[Integer] = DSL.cast(null, classOf[Integer]),
projectColor: Field[String] = DSL.inline(""),
did: Field[Integer] = DSL.cast(null, classOf[Integer]),
datasetStoragePath: Field[String] = DSL.cast(null, classOf[String]),
repositoryName: Field[String] = DSL.inline(""),
Expand All @@ -90,13 +86,9 @@ object UnifiedResourceSchema {
ownerId -> ownerId.as(resourceOwnerIdAlias),
wid -> wid.as("wid"),
workflowUserAccess -> workflowUserAccess.as("workflow_privilege"),
projectsOfWorkflow -> projectsOfWorkflow.as("projects"),
uid -> uid.as("uid"),
userName -> userName.as("userName"),
userEmail -> userEmail.as("email"),
pid -> pid.as("pid"),
projectOwnerId -> projectOwnerId.as("owner_uid"),
projectColor -> projectColor.as("color"),
did -> did.as("did"),
datasetStoragePath -> datasetStoragePath.as("dataset_storage_path"),
repositoryName -> repositoryName.as("repository_name"),
Expand All @@ -114,7 +106,7 @@ object UnifiedResourceSchema {
* Refer to /sql/texera_ddl.sql to understand what each attribute is
*
* Attributes common across all resource types:
* - `resourceType`: The type of the resource (e.g., project, workflow, file) as a `String`.
* - `resourceType`: The type of the resource (e.g., workflow, dataset) as a `String`.
* - `name`: The name of the resource as a `String`.
* - `description`: A textual description of the resource as a `String`.
* - `creationTime`: The timestamp when the resource was created, as a `Timestamp`.
Expand All @@ -124,16 +116,10 @@ object UnifiedResourceSchema {
* Attributes specific to workflows:
* - `wid`: Workflow ID, as an `Integer`.
* - `workflowUserAccess`: Access privileges associated with the workflow, as a `PrivilegeEnum`.
* - `projectsOfWorkflow`: IDs of projects associated with the workflow, concatenated as a `String`.
* - `uid`: User ID associated with the workflow, as an `Integer`.
* - `userName`: Name of the user associated with the workflow, as a `String`.
* - `userEmail`: Email of the user associated with the workflow, as a `String`.
*
* Attributes specific to projects:
* - `pid`: Project ID, as an `Integer`.
* - `projectOwnerId`: ID of the project owner, as an `Integer`.
* - `projectColor`: Color associated with the project, as a `String`.
*
* Attributes specific to files:
* - `fid`: File ID, as an `Integer`.
* - `fileUploadTime`: Timestamp when the file was uploaded, as a `Timestamp`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import org.apache.texera.web.resource.dashboard.DashboardResource.DashboardClick
import org.apache.texera.web.resource.dashboard.FulltextSearchQueryUtils._
import org.apache.texera.web.resource.dashboard.user.workflow.WorkflowResource.DashboardWorkflow
import org.jooq.impl.DSL
import org.jooq.impl.DSL.groupConcatDistinct
import org.jooq.{Condition, GroupField, Record, TableLike}

import scala.jdk.CollectionConverters.CollectionHasAsScala
Expand Down Expand Up @@ -53,7 +52,6 @@ object WorkflowSearchQueryBuilder extends SearchQueryBuilder {
uid = WORKFLOW_OF_USER.UID,
ownerId = WORKFLOW_OF_USER.UID,
userName = USER.NAME,
projectsOfWorkflow = groupConcatDistinct(WORKFLOW_OF_PROJECT.PID),
workflowCoverImage = DSL.max(WORKFLOW_COVER_IMAGE.IMAGE).as("workflow_cover_image")
)
}
Expand All @@ -71,20 +69,14 @@ object WorkflowSearchQueryBuilder extends SearchQueryBuilder {
.on(WORKFLOW_OF_USER.WID.eq(WORKFLOW.WID))
.leftJoin(USER)
.on(USER.UID.eq(WORKFLOW_OF_USER.UID))
.leftJoin(WORKFLOW_OF_PROJECT)
.on(WORKFLOW_OF_PROJECT.WID.eq(WORKFLOW.WID))
.leftJoin(PROJECT_USER_ACCESS)
.on(PROJECT_USER_ACCESS.PID.eq(WORKFLOW_OF_PROJECT.PID))
.and(if (uid == null) DSL.falseCondition() else PROJECT_USER_ACCESS.UID.eq(uid))
.leftJoin(WORKFLOW_COVER_IMAGE)
.on(WORKFLOW_COVER_IMAGE.WID.eq(WORKFLOW.WID))

var condition: Condition = DSL.trueCondition()
if (uid == null) {
condition = WORKFLOW.IS_PUBLIC.eq(true)
} else {
val privateAccessCondition =
WORKFLOW_USER_ACCESS.UID.eq(uid).or(PROJECT_USER_ACCESS.UID.isNotNull)
val privateAccessCondition = WORKFLOW_USER_ACCESS.UID.eq(uid)
if (includePublic) {
condition = privateAccessCondition.or(WORKFLOW.IS_PUBLIC.eq(true))
} else {
Expand Down Expand Up @@ -122,8 +114,6 @@ object WorkflowSearchQueryBuilder extends SearchQueryBuilder {
.and(getContainsFilter(params.owners, USER.EMAIL))
// Apply operators filter
.and(getOperatorsFilter(params.operators, WORKFLOW.CONTENT))
// Apply projectId filter
.and(getContainsFilter(params.projectIds, WORKFLOW_OF_PROJECT.PID))
// Apply fulltext search filter
.and(
getFullTextSearchFilter(
Expand All @@ -150,24 +140,13 @@ object WorkflowSearchQueryBuilder extends SearchQueryBuilder {
uid: Integer,
record: Record
): DashboardResource.DashboardClickableFileEntry = {
val pidField = groupConcatDistinct(WORKFLOW_OF_PROJECT.PID)
val dw = DashboardWorkflow(
record.into(WORKFLOW_OF_USER).getUid == uid,
Option(record.get(WORKFLOW_USER_ACCESS.PRIVILEGE, classOf[PrivilegeEnum]))
.map(_.toString)
.getOrElse(PrivilegeEnum.NONE.toString),
record.into(USER).getName,
record.into(WORKFLOW).into(classOf[Workflow]),
if (record.get(pidField) == null) {
List[Integer]()
} else {
record
.get(pidField)
.asInstanceOf[String]
.split(',')
.map(number => Integer.valueOf(number))
.toList
},
record.into(USER).getUid,
Option(record.get("workflow_cover_image", classOf[String]))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,6 @@ class HubResource {
DashboardClickableFileEntry(
resourceType = entityType.value,
workflow = Some(w),
project = None,
dataset = None
)
}
Expand All @@ -503,7 +502,6 @@ class HubResource {
DashboardClickableFileEntry(
resourceType = entityType.value,
workflow = None,
project = None,
dataset = Some(d)
)
}
Expand Down
Loading
Loading