Skip to content

eng-2888-investigate-resource-edit-bug #1273

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

Merged
merged 43 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8d77b94
Update the layout of the /integrations page (#1229)
kenxu95 Apr 21, 2023
607dc74
Update the resource cards on the integrations page (#1237)
kenxu95 Apr 27, 2023
09ad86f
ENG-2862, ENG-2863 Fix broken sidebar styling and add integration lis…
agiron123 Apr 27, 2023
f23789b
Update the resource cards with number of workflows using the resource…
kenxu95 Apr 28, 2023
641a049
ENG-2863 New add integrations styling (#1260)
agiron123 Apr 28, 2023
b963903
fixed rebase bug
kenxu95 May 1, 2023
cdd3c91
ready to make the dropdown for more fields work
kenxu95 Apr 28, 2023
8ab68df
implemented the hide and seek
kenxu95 Apr 28, 2023
ee13045
Seems to work now!
kenxu95 Apr 28, 2023
58d7daa
tiny
kenxu95 Apr 28, 2023
dd8b1e0
golang lint
kenxu95 Apr 28, 2023
5f8a2e1
made changes
kenxu95 Apr 28, 2023
89dd021
hide ellipses
kenxu95 Apr 28, 2023
2599498
fixed the registration crashing bug
kenxu95 Apr 29, 2023
e1fbcba
Rename all user-facing integrations to resources on the UI (#1268)
cw75 May 1, 2023
f553857
dag_results works
kenxu95 Apr 28, 2023
2319394
step 2 works, not building nodes_operators_get.go
kenxu95 Apr 28, 2023
8fafccb
done! Ready to handoff
kenxu95 Apr 28, 2023
6c2e256
Start of work to update the workflows section to show new workflows i…
Apr 30, 2023
6532f2e
integration wf summary card work
Apr 30, 2023
d521f55
Styling improvements
May 1, 2023
d4436d9
Working updated workflows section on Integrations page.
May 1, 2023
5d092a2
null check
May 1, 2023
73ec637
font styling updates
May 1, 2023
390d163
deduplicate the workflows
kenxu95 May 1, 2023
d66b351
fixed the aqueduct server number workflows
kenxu95 May 2, 2023
4db2447
Design feedback updates for WorkflowSummaryCard.
May 2, 2023
e809fec
lint and styling updates
May 2, 2023
9a026a2
finished the polish tasks for ENG-2874
kenxu95 May 2, 2023
5ef5ed9
Clean up comments, logs and lint integration details page
May 2, 2023
1955a49
added arn field to databricks
kenxu95 May 2, 2023
eb9b1a0
ENG-2887 - Fixes 404 error and successfully redirects users to resour…
May 2, 2023
b95f5b8
Fixes issue where BigQuery resource configuration dialog did not enab…
May 2, 2023
03a7173
Fix edit functionality
eunice-chan May 2, 2023
dda7ce5
Merge
eunice-chan May 3, 2023
e2a888d
Remove unwanted changes
eunice-chan May 3, 2023
6174ca5
Add back import
eunice-chan May 3, 2023
ba0cf98
black lint
eunice-chan May 3, 2023
ba19849
isort
eunice-chan May 3, 2023
9624521
isort fic
eunice-chan May 3, 2023
d933ebf
fixed linters
kenxu95 May 3, 2023
2b59c3f
Add workflow_dispatch
eunice-chan May 4, 2023
d3d663d
Merge branch 'eng-2888-investigate-resource-edit-bug' of github.com:a…
eunice-chan May 4, 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ src/python/build/
*.idea/
*.vscode/

# Intellij IDE
src/ui/frontend.iml

# Binaries for programs and plugins
*.exe
*.exe~
Expand Down
2 changes: 1 addition & 1 deletion sdk/aqueduct/constants/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ServiceType(str, Enum, metaclass=MetaEnum):
LAMBDA = "Lambda"
MONGO_DB = "MongoDB"
CONDA = "Conda"
AQUEDUCT_ENGINE = "Aqueduct Engine"
AQUEDUCT_ENGINE = "Aqueduct"
DATABRICKS = "Databricks"
EMAIL = "Email"
SLACK = "Slack"
Expand Down
2 changes: 1 addition & 1 deletion src/golang/cmd/server/handler/connect_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func ConnectIntegration(
}

// The initial integration entry has been written. Any errors from this point on will need to update
// the that entry to reflect the failure. Note that this defer is only relevant for q
// the that entry to reflect the failure.
defer func() {
if err != nil {
execution_state.UpdateOnFailure(
Expand Down
25 changes: 2 additions & 23 deletions src/golang/cmd/server/handler/list_operators_for_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ package handler

import (
"context"
"fmt"
"net/http"

"github.com/aqueducthq/aqueduct/cmd/server/routes"
aq_context "github.com/aqueducthq/aqueduct/lib/context"
"github.com/aqueducthq/aqueduct/lib/database"
"github.com/aqueducthq/aqueduct/lib/dynamic"
"github.com/aqueducthq/aqueduct/lib/models"
"github.com/aqueducthq/aqueduct/lib/models/shared"
"github.com/aqueducthq/aqueduct/lib/repos"
"github.com/aqueducthq/aqueduct/lib/workflow/operator"
"github.com/dropbox/godropbox/errors"
Expand Down Expand Up @@ -92,28 +89,10 @@ func (h *ListOperatorsForIntegrationHandler) Prepare(r *http.Request) (interface
func (h *ListOperatorsForIntegrationHandler) Perform(ctx context.Context, interfaceArgs interface{}) (interface{}, int, error) {
args := interfaceArgs.(*listOperatorsForIntegrationArgs)

integrationID := args.integrationObject.ID

if args.integrationObject.Service == shared.AWS {
// If the requested integration is a cloud integration, substitute the cloud integration ID
// with the ID of the dynamic k8s integration.
k8sIntegration, err := h.IntegrationRepo.GetByNameAndUser(
ctx,
fmt.Sprintf("%s:%s", args.integrationObject.Name, dynamic.K8sIntegrationNameSuffix),
uuid.Nil,
args.OrgID,
h.Database,
)
if err != nil {
return nil, http.StatusInternalServerError, errors.Wrap(err, "Failed to retrieve the Aqueduct-generated k8s integration.")
}

integrationID = k8sIntegration.ID
}

operators, err := operator.GetOperatorsOnIntegration(
ctx,
integrationID,
args.OrgID,
args.integrationObject,
h.IntegrationRepo,
h.OperatorRepo,
h.Database,
Expand Down
8 changes: 7 additions & 1 deletion src/golang/cmd/server/handler/test_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/aqueducthq/aqueduct/lib/database"
"github.com/aqueducthq/aqueduct/lib/errors"
"github.com/aqueducthq/aqueduct/lib/job"
"github.com/aqueducthq/aqueduct/lib/models/shared"
"github.com/aqueducthq/aqueduct/lib/repos"
"github.com/aqueducthq/aqueduct/lib/vault"
"github.com/aqueducthq/aqueduct/lib/workflow/operator/connector/auth"
Expand Down Expand Up @@ -89,11 +90,16 @@ func (h *TestIntegrationHandler) Perform(ctx context.Context, interfaceArgs inte
if errors.Is(err, database.ErrNoRows()) {
return emptyResp, http.StatusBadRequest, err
}

if err != nil {
return emptyResp, http.StatusInternalServerError, errors.Wrap(err, "Failed to retrieve integration")
}

// No need to do any further verification for Aqueduct Compute.
// The fact that it even got here means it works.
if integrationObject.Name == shared.AqueductComputeIntegrationName {
return emptyResp, http.StatusOK, nil
}

storageConfig := config.Storage()
vaultObject, err := vault.NewVault(&storageConfig, config.EncryptionKey())
if err != nil {
Expand Down
101 changes: 101 additions & 0 deletions src/golang/cmd/server/handler/v2/integration_operators_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package v2

import (
"context"
"net/http"

"github.com/aqueducthq/aqueduct/cmd/server/handler"
"github.com/aqueducthq/aqueduct/cmd/server/request/parser"
aq_context "github.com/aqueducthq/aqueduct/lib/context"
"github.com/aqueducthq/aqueduct/lib/database"
"github.com/aqueducthq/aqueduct/lib/functional/slices"
"github.com/aqueducthq/aqueduct/lib/models"
"github.com/aqueducthq/aqueduct/lib/models/views"
"github.com/aqueducthq/aqueduct/lib/repos"
"github.com/aqueducthq/aqueduct/lib/response"
"github.com/aqueducthq/aqueduct/lib/workflow/operator"
"github.com/dropbox/godropbox/errors"
"github.com/google/uuid"
)

// This file should map directly to
// src/ui/common/src/handlers/v2/IntegrationOperatorsGet.ts
//
// Route: /api/v2/integration/{integrationID}/nodes/operators
// Method: GET
// Params:
// `integrationID`: ID for `integration` object
// Request:
// Headers:
// `api-key`: user's API Key
// Response:
// Body:
// A list of `response.operators` that use the given integration.

type integrationOperatorsGetArgs struct {
*aq_context.AqContext
integrationID uuid.UUID
}

type IntegrationOperatorsGetHandler struct {
handler.GetHandler

Database database.Database
IntegrationRepo repos.Integration
OperatorRepo repos.Operator
}

func (*IntegrationOperatorsGetHandler) Name() string {
return "IntegrationOperatorsGet"
}

func (h *IntegrationOperatorsGetHandler) Prepare(r *http.Request) (interface{}, int, error) {
aqContext, statusCode, err := aq_context.ParseAqContext(r.Context())
if err != nil {
return nil, statusCode, err
}

integrationID, err := (parser.IntegrationIDParser{}).Parse(r)
if err != nil {
return nil, http.StatusBadRequest, err
}

return &integrationOperatorsGetArgs{
AqContext: aqContext,

integrationID: *integrationID,
}, http.StatusOK, nil
}

func (h *IntegrationOperatorsGetHandler) Perform(ctx context.Context, interfaceArgs interface{}) (interface{}, int, error) {
args := interfaceArgs.(*integrationOperatorsGetArgs)

integration, err := h.IntegrationRepo.Get(ctx, args.integrationID, h.Database)
if err != nil {
return nil, http.StatusInternalServerError, errors.Wrapf(err, "Unable to find integration %s", args.integrationID)
}

operators, err := operator.GetOperatorsOnIntegration(
ctx,
args.OrgID,
integration,
h.IntegrationRepo,
h.OperatorRepo,
h.Database,
)
if err != nil {
return nil, http.StatusInternalServerError, errors.Wrap(err, "Unable to retrieve operators.")
}

operatorIDs := slices.Map(operators, func(op models.Operator) uuid.UUID {
return op.ID
})
operatorNodes, err := h.OperatorRepo.GetNodeBatch(ctx, operatorIDs, h.Database)
if err != nil {
return nil, http.StatusInternalServerError, errors.Wrap(err, "Unable to retrieve operator nodes.")
}

return slices.Map(operatorNodes, func(node views.OperatorNode) *response.Operator {
return response.NewOperatorFromDBObject(&node)
}), http.StatusOK, nil
}
78 changes: 78 additions & 0 deletions src/golang/cmd/server/handler/v2/integration_workflows_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package v2

import (
"context"
"net/http"

"github.com/aqueducthq/aqueduct/cmd/server/handler"
"github.com/aqueducthq/aqueduct/cmd/server/request/parser"
aq_context "github.com/aqueducthq/aqueduct/lib/context"
"github.com/aqueducthq/aqueduct/lib/database"
"github.com/aqueducthq/aqueduct/lib/errors"
"github.com/aqueducthq/aqueduct/lib/repos"
"github.com/google/uuid"
)

// This file should map directly to
// src/ui/common/src/handlers/v2/IntegrationWorkflowsGet.ts
//
// Route: /v2/integration/{integrationID}/workflows
// Method: GET
// Request:
// Headers:
// `api-key`: user's API Key
// Response:
// Body:
// A list of workflow IDs that use the given integration.

type integrationWorkflowsGetArgs struct {
*aq_context.AqContext
integrationID uuid.UUID
}

type IntegrationWorkflowsGetHandler struct {
handler.GetHandler

Database database.Database
IntegrationRepo repos.Integration
OperatorRepo repos.Operator
}

func (*IntegrationWorkflowsGetHandler) Name() string {
return "IntegrationWorkflowsGet"
}

func (h *IntegrationWorkflowsGetHandler) Prepare(r *http.Request) (interface{}, int, error) {
aqContext, statusCode, err := aq_context.ParseAqContext(r.Context())
if err != nil {
return nil, statusCode, err
}

integrationID, err := (parser.IntegrationIDParser{}).Parse(r)
if err != nil {
return nil, http.StatusBadRequest, err
}

return &integrationWorkflowsGetArgs{
AqContext: aqContext,
integrationID: *integrationID,
}, http.StatusOK, nil
}

func (h *IntegrationWorkflowsGetHandler) Perform(ctx context.Context, interfaceArgs interface{}) (interface{}, int, error) {
args := interfaceArgs.(*integrationWorkflowsGetArgs)

integration, err := h.IntegrationRepo.Get(ctx, args.integrationID, h.Database)
if err != nil {
return nil, http.StatusInternalServerError, errors.Wrapf(err, "Unable to find integration %s", args.integrationID)
}

workflowIDs, err := fetchWorkflowIDsForIntegration(
ctx, args.OrgID, integration, h.IntegrationRepo, h.OperatorRepo, h.Database,
)
if err != nil {
return nil, http.StatusInternalServerError, errors.Wrapf(err, "Unable to find workflows for integration %s", args.integrationID)
}

return workflowIDs, http.StatusOK, nil
}
Loading