From aafe47cb7a65120450693aae1e300be1ffbe2e20 Mon Sep 17 00:00:00 2001 From: Matteo Cominetti Date: Fri, 9 Oct 2020 20:25:34 +0100 Subject: [PATCH] feat(ui): adds edit user and edit server, list item commit --- frontend/src/AppFrontend.vue | 18 +++ frontend/src/components/FeedStream.vue | 14 +- frontend/src/components/ListItemCommit.vue | 30 ++++ .../{StreamBox.vue => ListItemStream.vue} | 2 +- frontend/src/components/SidebarHome.vue | 120 ++++++++++----- frontend/src/components/SidebarStream.vue | 12 +- .../src/components/dialogs/ServerDialog.vue | 140 ++++++++++++++++++ .../src/components/dialogs/StreamDialog.vue | 8 +- .../src/components/dialogs/UserDialog.vue | 2 +- frontend/src/views/Home.vue | 3 + frontend/src/views/Stream.vue | 29 ++-- frontend/src/views/Streams.vue | 20 +-- .../graph/schemas/branchesAndCommits.graphql | 38 ++--- modules/core/graph/schemas/server.graphql | 4 +- 14 files changed, 325 insertions(+), 115 deletions(-) create mode 100644 frontend/src/components/ListItemCommit.vue rename frontend/src/components/{StreamBox.vue => ListItemStream.vue} (98%) create mode 100644 frontend/src/components/dialogs/ServerDialog.vue diff --git a/frontend/src/AppFrontend.vue b/frontend/src/AppFrontend.vue index 6a9c000c5..2e071837a 100644 --- a/frontend/src/AppFrontend.vue +++ b/frontend/src/AppFrontend.vue @@ -55,3 +55,21 @@ export default { }) } + diff --git a/frontend/src/components/FeedStream.vue b/frontend/src/components/FeedStream.vue index 66a9c4a03..b40552028 100644 --- a/frontend/src/components/FeedStream.vue +++ b/frontend/src/components/FeedStream.vue @@ -81,16 +81,4 @@ export default { } } - + diff --git a/frontend/src/components/ListItemCommit.vue b/frontend/src/components/ListItemCommit.vue new file mode 100644 index 000000000..01165b9d0 --- /dev/null +++ b/frontend/src/components/ListItemCommit.vue @@ -0,0 +1,30 @@ + + diff --git a/frontend/src/components/StreamBox.vue b/frontend/src/components/ListItemStream.vue similarity index 98% rename from frontend/src/components/StreamBox.vue rename to frontend/src/components/ListItemStream.vue index e3ed0dff5..760a1e1fe 100644 --- a/frontend/src/components/StreamBox.vue +++ b/frontend/src/components/ListItemStream.vue @@ -6,7 +6,7 @@ {{ stream.name }} -
+
{{ stream.description }}
diff --git a/frontend/src/components/SidebarHome.vue b/frontend/src/components/SidebarHome.vue index 5895f8e6d..07b912547 100644 --- a/frontend/src/components/SidebarHome.vue +++ b/frontend/src/components/SidebarHome.vue @@ -1,47 +1,72 @@ diff --git a/frontend/src/components/dialogs/StreamDialog.vue b/frontend/src/components/dialogs/StreamDialog.vue index eb9eb7b41..5177e80d5 100644 --- a/frontend/src/components/dialogs/StreamDialog.vue +++ b/frontend/src/components/dialogs/StreamDialog.vue @@ -82,7 +82,13 @@ export default { if (this.$refs.form) this.$refs.form.resetValidation() if (stream) { - this.stream = { ...stream } + this.stream = { + id: stream.id, + name: stream.name, + description: stream.description, + isPublic: stream.isPublic + } + this.isEdit = true } else { this.stream = { isPublic: true } diff --git a/frontend/src/components/dialogs/UserDialog.vue b/frontend/src/components/dialogs/UserDialog.vue index 7ffe4ecee..6cfb3bdc0 100644 --- a/frontend/src/components/dialogs/UserDialog.vue +++ b/frontend/src/components/dialogs/UserDialog.vue @@ -79,7 +79,7 @@ export default { this.dialog = true if (this.$refs.form) this.$refs.form.resetValidation() - this.user = { ...user } + this.user = { name: user.name, company: user.company, bio: user.bio } return new Promise((resolve, reject) => { this.resolve = resolve diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue index 398627f94..9ce12b3ce 100644 --- a/frontend/src/views/Home.vue +++ b/frontend/src/views/Home.vue @@ -80,6 +80,9 @@ export default { ) { activity.push(...this.user.commits.items) } + + if (activity.length === 1) return activity + activity.sort(this.compareUpdates) let group = [] diff --git a/frontend/src/views/Stream.vue b/frontend/src/views/Stream.vue index ff59580ef..f73427d54 100644 --- a/frontend/src/views/Stream.vue +++ b/frontend/src/views/Stream.vue @@ -76,14 +76,18 @@ {{ branches[selectedBranch].name }} branch just yet, try sending something...

+
-
- {{ commit.message }} -
- + +
@@ -97,11 +101,12 @@ import gql from "graphql-tag" import SidebarStream from "../components/SidebarStream" import BranchDialog from "../components/dialogs/BranchDialog" +import ListItemCommit from "../components/ListItemCommit" import streamQuery from "../graphql/stream.gql" export default { name: "Stream", - components: { SidebarStream, BranchDialog }, + components: { SidebarStream, BranchDialog, ListItemCommit }, data: () => ({ selectedBranch: 0 }), apollo: { stream: { @@ -122,7 +127,7 @@ export default { } }, watch: { - selectedBranch(val) { + stream(val) { console.log(val) } }, @@ -164,18 +169,6 @@ export default { } + diff --git a/modules/core/graph/schemas/branchesAndCommits.graphql b/modules/core/graph/schemas/branchesAndCommits.graphql index 80bf62393..24abbc6c9 100644 --- a/modules/core/graph/schemas/branchesAndCommits.graphql +++ b/modules/core/graph/schemas/branchesAndCommits.graphql @@ -1,12 +1,12 @@ extend type Stream { - commits( limit: Int! = 25, cursor: String ): CommitCollection - commit( id: String! ): Commit - branches( limit: Int! = 25, cursor: String ): BranchCollection - branch( name: String! ): Branch + commits(limit: Int! = 25, cursor: String): CommitCollection + commit(id: String!): Commit + branches(limit: Int! = 25, cursor: String): BranchCollection + branch(name: String!): Branch } extend type User { - commits( limit: Int! = 25, cursor: String ): CommitCollectionUser + commits(limit: Int! = 25, cursor: String): CommitCollectionUser } type Branch { @@ -14,7 +14,7 @@ type Branch { name: String! author: User! description: String! - commits( limit: Int! = 25, cursor: String ): CommitCollection + commits(limit: Int! = 25, cursor: String): CommitCollection } type Commit { @@ -34,7 +34,7 @@ type CommitCollectionUserNode { message: String streamId: String streamName: String - createdAt: String + createdAt: DateTime } type BranchCollection { @@ -56,23 +56,23 @@ type CommitCollectionUser { } extend type Mutation { - branchCreate( branch: BranchCreateInput! ): String! + branchCreate(branch: BranchCreateInput!): String! @hasRole(role: "server:user") @hasScope(scope: "streams:write") - branchUpdate( branch: BranchUpdateInput! ): Boolean! + branchUpdate(branch: BranchUpdateInput!): Boolean! @hasRole(role: "server:user") @hasScope(scope: "streams:write") - branchDelete( branch: BranchDeleteInput! ): Boolean! + branchDelete(branch: BranchDeleteInput!): Boolean! @hasRole(role: "server:user") @hasScope(scope: "streams:write") - commitCreate( commit: CommitCreateInput! ): String! + commitCreate(commit: CommitCreateInput!): String! @hasRole(role: "server:user") @hasScope(scope: "streams:write") - commitUpdate( commit: CommitUpdateInput! ): Boolean! + commitUpdate(commit: CommitUpdateInput!): Boolean! @hasRole(role: "server:user") @hasScope(scope: "streams:write") - commitDelete( commit: CommitDeleteInput! ): Boolean! + commitDelete(commit: CommitDeleteInput!): Boolean! @hasRole(role: "server:user") @hasScope(scope: "streams:write") } @@ -82,38 +82,38 @@ extend type Subscription { """ Subscribe to branch created event """ - branchCreated( streamId: String! ): JSONObject + branchCreated(streamId: String!): JSONObject @hasRole(role: "server:user") @hasScope(scope: "streams:read") """ Subscribe to branch updated event. """ - branchUpdated( streamId: String!, branchId: String ): JSONObject + branchUpdated(streamId: String!, branchId: String): JSONObject @hasRole(role: "server:user") @hasScope(scope: "streams:read") """ Subscribe to branch deleted event """ - branchDeleted( streamId: String! ): JSONObject + branchDeleted(streamId: String!): JSONObject @hasRole(role: "server:user") @hasScope(scope: "streams:read") """ Subscribe to commit created event """ - commitCreated( streamId: String! ): JSONObject + commitCreated(streamId: String!): JSONObject @hasRole(role: "server:user") @hasScope(scope: "streams:read") """ Subscribe to commit updated event. """ - commitUpdated( streamId: String!, commitId: String ): JSONObject + commitUpdated(streamId: String!, commitId: String): JSONObject @hasRole(role: "server:user") @hasScope(scope: "streams:read") """ Subscribe to commit deleted event """ - commitDeleted( streamId: String! ): JSONObject + commitDeleted(streamId: String!): JSONObject @hasRole(role: "server:user") @hasScope(scope: "streams:read") } diff --git a/modules/core/graph/schemas/server.graphql b/modules/core/graph/schemas/server.graphql index ac73607ab..b3416adfe 100644 --- a/modules/core/graph/schemas/server.graphql +++ b/modules/core/graph/schemas/server.graphql @@ -34,7 +34,9 @@ type Scope { } extend type Mutation { - serverInfoUpdate( info: ServerInfoUpdateInput! ): Boolean + serverInfoUpdate(info: ServerInfoUpdateInput!): Boolean + @hasRole(role: "server:admin") + @hasScope(scope: "server:setup") } input ServerInfoUpdateInput {