Skip to content

Commit

Permalink
Linting and other fixes + changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed Aug 3, 2020
1 parent 7b49633 commit 5a602fa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/appprovider-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Refactor AppProvider workflow

Simplified the app-provider configuration: storageID is worked out
automatically and UIURL is suppressed for now.
Implemented the new gRPC protocol from the gateway to the appprovider.

https://github.com/cs3org/reva/pull/1035
14 changes: 7 additions & 7 deletions cmd/reva/open-file-in-app-provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"fmt"
"os"

providerpb "github.com/cs3org/go-cs3apis/cs3/app/provider/v1beta1"
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
)
Expand Down Expand Up @@ -54,7 +54,7 @@ func openFileInAppProviderCommand() *command {
Spec: &provider.Reference_Path{Path: path},
}

openRequest := &providerpb.OpenFileInAppProviderRequest{Ref: ref, ViewMode: viewMode}
openRequest := &gateway.OpenFileInAppProviderRequest{Ref: ref, ViewMode: viewMode}

openRes, err := client.OpenFileInAppProvider(ctx, openRequest)
if err != nil {
Expand All @@ -72,15 +72,15 @@ func openFileInAppProviderCommand() *command {
return cmd
}

func getViewMode(viewMode string) providerpb.OpenFileInAppProviderRequest_ViewMode {
func getViewMode(viewMode string) gateway.OpenFileInAppProviderRequest_ViewMode {
switch viewMode {
case "view":
return providerpb.OpenFileInAppProviderRequest_VIEW_MODE_VIEW_ONLY
return gateway.OpenFileInAppProviderRequest_VIEW_MODE_VIEW_ONLY
case "read":
return providerpb.OpenFileInAppProviderRequest_VIEW_MODE_READ_ONLY
return gateway.OpenFileInAppProviderRequest_VIEW_MODE_READ_ONLY
case "write":
return providerpb.OpenFileInAppProviderRequest_VIEW_MODE_READ_WRITE
return gateway.OpenFileInAppProviderRequest_VIEW_MODE_READ_WRITE
default:
return providerpb.OpenFileInAppProviderRequest_VIEW_MODE_INVALID
return gateway.OpenFileInAppProviderRequest_VIEW_MODE_INVALID
}
}
9 changes: 5 additions & 4 deletions internal/grpc/services/gateway/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ import (

providerpb "github.com/cs3org/go-cs3apis/cs3/app/provider/v1beta1"
registry "github.com/cs3org/go-cs3apis/cs3/app/registry/v1beta1"
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
tokenpkg "github.com/cs3org/reva/pkg/token"
"github.com/cs3org/reva/pkg/errtypes"
"github.com/cs3org/reva/pkg/rgrpc/status"
"github.com/cs3org/reva/pkg/rgrpc/todo/pool"
tokenpkg "github.com/cs3org/reva/pkg/token"
"github.com/pkg/errors"
)

Expand Down Expand Up @@ -94,11 +95,11 @@ func (s *svc) OpenFileInAppProvider(ctx context.Context, req *gateway.OpenFileIn
}, nil
}

// build the appProvider specific request with the required extra info that has been obtained
// build the appProvider specific request with the required extra info that has been obtained
appProviderReq := &providerpb.OpenFileInAppProviderRequest{
ResourceInfo: fileInfo,
ViewMode: req.ViewMode,
AccessToken: accessToken
ViewMode: providerpb.OpenFileInAppProviderRequest_ViewMode(req.ViewMode),
AccessToken: accessToken,
}

res, err := appProviderClient.OpenFileInAppProvider(ctx, appProviderReq)
Expand Down

0 comments on commit 5a602fa

Please sign in to comment.