Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
16862386
Commit
16862386
authored
Mar 29, 2019
by
Phil Hughes
Committed by
Bob Van Landuyt
Apr 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the correct design permissions from GraphQL response
Cache some project data in the apollo store
parent
70bb5adb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
13 deletions
+53
-13
ee/app/assets/javascripts/design_management/index.js
ee/app/assets/javascripts/design_management/index.js
+10
-1
ee/app/assets/javascripts/design_management/pages/index.vue
ee/app/assets/javascripts/design_management/pages/index.vue
+29
-8
ee/app/assets/javascripts/design_management/queries/appData.graphql
...ets/javascripts/design_management/queries/appData.graphql
+4
-0
ee/app/assets/javascripts/design_management/queries/canUploadDesignPermission.graphql
...sign_management/queries/canUploadDesignPermission.graphql
+0
-3
ee/app/assets/javascripts/design_management/queries/permissions.graphql
...javascripts/design_management/queries/permissions.graphql
+9
-0
ee/app/views/projects/issues/_discussion.html.haml
ee/app/views/projects/issues/_discussion.html.haml
+1
-1
No files found.
ee/app/assets/javascripts/design_management/index.js
View file @
16862386
...
...
@@ -5,6 +5,8 @@ import App from './components/app.vue';
import
apolloProvider
from
'
./graphql
'
;
export
default
()
=>
{
const
el
=
document
.
getElementById
(
'
js-design-management
'
);
$
(
'
.js-issue-tabs
'
).
on
(
'
shown.bs.tab
'
,
({
target
:
{
id
}
})
=>
{
if
(
id
===
'
designs
'
&&
router
.
currentRoute
.
name
===
'
root
'
)
{
router
.
push
(
'
/designs
'
);
...
...
@@ -13,8 +15,15 @@ export default () => {
}
});
apolloProvider
.
clients
.
defaultClient
.
cache
.
writeData
({
data
:
{
projectFullPath
:
el
.
dataset
.
projectPath
,
issueIid
:
el
.
dataset
.
issueIid
,
},
});
return
new
Vue
({
el
:
document
.
getElementById
(
'
js-design-management
'
)
,
el
,
router
,
apolloProvider
,
render
(
createElement
)
{
...
...
ee/app/assets/javascripts/design_management/pages/index.vue
View file @
16862386
...
...
@@ -6,7 +6,8 @@ import DesignList from '../components/list/index.vue';
import
UploadForm
from
'
../components/upload/form.vue
'
;
import
allDesignsQuery
from
'
../queries/allDesigns.graphql
'
;
import
uploadDesignQuery
from
'
../queries/uploadDesign.graphql
'
;
import
canUploadDesignPermission
from
'
../queries/canUploadDesignPermission.graphql
'
;
import
appDataQuery
from
'
../queries/appData.graphql
'
;
import
permissionsQuery
from
'
../queries/permissions.graphql
'
;
export
default
{
components
:
{
...
...
@@ -15,32 +16,52 @@ export default {
UploadForm
,
},
apollo
:
{
appData
:
{
query
:
appDataQuery
,
manual
:
true
,
result
({
data
:
{
projectFullPath
,
issueIid
}
})
{
this
.
projectFullPath
=
projectFullPath
;
this
.
issueIid
=
issueIid
;
},
},
designs
:
{
query
:
allDesignsQuery
,
error
()
{
this
.
error
=
true
;
},
},
canUploadDesign
:
{
query
:
canUploadDesignPermission
,
permissions
:
{
query
:
permissionsQuery
,
variables
()
{
return
{
fullPath
:
this
.
projectFullPath
,
iid
:
this
.
issueIid
,
};
},
update
:
data
=>
data
.
project
.
issue
.
userPermissions
,
},
},
data
()
{
return
{
designs
:
[],
canUploadDesign
:
false
,
permissions
:
{}
,
error
:
false
,
isSaving
:
false
,
projectFullPath
:
''
,
issueIid
:
null
,
};
},
computed
:
{
isLoading
()
{
return
this
.
$apollo
.
queries
.
designs
.
loading
;
return
this
.
$apollo
.
queries
.
designs
.
loading
&&
this
.
$apollo
.
queries
.
permissions
.
loading
;
},
canCreateDesign
()
{
return
this
.
permissions
.
createDesign
;
},
},
methods
:
{
onUploadDesign
(
files
)
{
if
(
!
this
.
can
Upload
Design
)
return
null
;
if
(
!
this
.
can
Create
Design
)
return
null
;
const
optimisticResponse
=
[...
files
].
map
(
file
=>
({
__typename
:
'
Design
'
,
...
...
@@ -88,8 +109,8 @@ export default {
<
template
>
<div>
<upload-form
v-if=
"can
Upload
Design"
:can-upload-design=
"can
Upload
Design"
v-if=
"can
Create
Design"
:can-upload-design=
"can
Create
Design"
:is-saving=
"isSaving"
@
upload=
"onUploadDesign"
/>
...
...
ee/app/assets/javascripts/design_management/queries/appData.graphql
0 → 100644
View file @
16862386
query
projectFullPath
{
projectFullPath
@client
issueIid
@client
}
ee/app/assets/javascripts/design_management/queries/canUploadDesignPermission.graphql
deleted
100644 → 0
View file @
70bb5adb
query
canUploadDesign
{
canUploadDesign
@client
}
ee/app/assets/javascripts/design_management/queries/permissions.graphql
0 → 100644
View file @
16862386
query
permissions
(
$fullPath
:
ID
!,
$iid
:
ID
!)
{
project
(
fullPath
:
$fullPath
)
{
issue
(
iid
:
$iid
)
{
userPermissions
{
createDesign
}
}
}
}
ee/app/views/projects/issues/_discussion.html.haml
View file @
16862386
...
...
@@ -12,6 +12,6 @@
#discussion-tab
.tab-pane.show.active
{
role:
'tabpanel'
,
'aria-labelledby'
:
'discussion'
}
=
render_ce
'projects/issues/discussion'
#designs-tab
.tab-pane
{
role:
'tabpanel'
,
'aria-labelledby'
:
'designs'
}
#js-design-management
#js-design-management
{
data:
{
project_path:
@project
.
full_path
,
issue_iid:
@issue
.
iid
}
}
-
else
=
render_ce
'projects/issues/discussion'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment