diff --git a/pkg/satellite/satelliteweb/gateway.go b/pkg/satellite/satelliteweb/gateway.go index 8fdd6e772..bd912f846 100644 --- a/pkg/satellite/satelliteweb/gateway.go +++ b/pkg/satellite/satelliteweb/gateway.go @@ -26,6 +26,7 @@ type gateway struct { func (gw *gateway) run() { mux := http.NewServeMux() + //gw.config.StaticPath = "./web/satellite" fs := http.FileServer(http.Dir(gw.config.StaticPath)) mux.Handle("/api/graphql/v0", http.HandlerFunc(gw.grapqlHandler)) diff --git a/pkg/satellite/service.go b/pkg/satellite/service.go index d7ea792b2..6252478f1 100644 --- a/pkg/satellite/service.go +++ b/pkg/satellite/service.go @@ -159,7 +159,7 @@ func (s *Service) GetUsersProjects(ctx context.Context) ([]Project, error) { return s.store.Projects().GetAll(ctx) } -// CreateProject is a method for querying all projects +// CreateProject is a method for creating new project func (s *Service) CreateProject(ctx context.Context, projectInfo ProjectInfo) (*Project, error) { // TODO: auth will be moved in future user, err := s.Authorize(ctx) diff --git a/web/satellite/package.json b/web/satellite/package.json index 534ccb6b7..a55c17386 100644 --- a/web/satellite/package.json +++ b/web/satellite/package.json @@ -13,7 +13,8 @@ "@types/graphql": "^14.0.3", "apollo-cache-inmemory": "^1.3.9", "apollo-client": "^2.4.5", - "apollo-link": "^1.2.3", + "apollo-link": "^1.2.4", + "apollo-link-context": "^1.0.10", "apollo-link-http": "^1.5.5", "graphql": "^14.0.2", "graphql-tag": "^2.10.0", diff --git a/web/satellite/src/components/common/HeaderedInput.vue b/web/satellite/src/components/common/HeaderedInput.vue index f2155aa7a..17875d980 100644 --- a/web/satellite/src/components/common/HeaderedInput.vue +++ b/web/satellite/src/components/common/HeaderedInput.vue @@ -6,14 +6,24 @@

{{label}}

-

{{additionalLabel}}

+

{{additionalLabel}}

{{error}}

{{label}}

Optional

- + @setData=""> + @setData="setProjectDescription">
- +

I agree to the Storj Bridge Hosting Terms & Conditions

@@ -64,9 +67,53 @@ import Button from "@/components/common/Button.vue"; type: Function } }, + data: function() { + return { + name: "", + description: "", + isTermsAccepted: false, + termsAcceptedError: false, + nameError: "", + } + }, methods: { - onCloseClick: function () : void { + setProjectName: function(value: string) : void { + this.$data.name = value; + this.$data.nameError = ""; + }, + setProjectDescription: function(value: string) : void { + this.$data.description = value; + }, + setTermsAccepted: function(value: boolean) : void { + this.$data.isTermsAccepted = value; + this.$data.termsAcceptedError = false; + }, + onCloseClick: function() : void { + // TODO: save popup states in store this.$emit("onClose"); + }, + createProject: function() : void { + if (!this.$data.isTermsAccepted) { + this.$data.termsAcceptedError = true; + } + + if (!this.$data.name) { + this.$data.nameError = "Name is required!"; + } + + if (this.$data.name.length > 20) { + this.$data.nameError = "Name should be less than 21 character!"; + } + + if (this.$data.nameError || this.$data.isTermsAcceptedError) { + return; + } + + this.$store.dispatch("createProject", { + name: this.$data.name, + description: this.$data.description, + isTermsAccepted: this.$data.isTermsAccepted, + }) } }, components: { diff --git a/web/satellite/src/components/dashboard/projectSelection/ProjectSelectionArea.vue b/web/satellite/src/components/dashboard/projectSelection/ProjectSelectionArea.vue index a3fe37b57..2fb0e81db 100644 --- a/web/satellite/src/components/dashboard/projectSelection/ProjectSelectionArea.vue +++ b/web/satellite/src/components/dashboard/projectSelection/ProjectSelectionArea.vue @@ -4,7 +4,7 @@