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
22078f8a
Commit
22078f8a
authored
Apr 30, 2020
by
Enrique Alcantara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate isSupportedContent to Apollo
Use VueApollo to handle the isSupportedContent business logic
parent
bac995be
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
9 deletions
+25
-9
app/assets/javascripts/static_site_editor/graphql/queries/app_data.query.graphql
...static_site_editor/graphql/queries/app_data.query.graphql
+3
-0
app/assets/javascripts/static_site_editor/graphql/typedefs.graphql
...s/javascripts/static_site_editor/graphql/typedefs.graphql
+1
-1
app/assets/javascripts/static_site_editor/index.js
app/assets/javascripts/static_site_editor/index.js
+9
-2
app/assets/javascripts/static_site_editor/pages/home.vue
app/assets/javascripts/static_site_editor/pages/home.vue
+7
-1
app/assets/javascripts/static_site_editor/store/state.js
app/assets/javascripts/static_site_editor/store/state.js
+0
-1
spec/frontend/static_site_editor/pages/home_spec.js
spec/frontend/static_site_editor/pages/home_spec.js
+5
-4
No files found.
app/assets/javascripts/static_site_editor/graphql/queries/app_data.query.graphql
0 → 100644
View file @
22078f8a
query
appData
{
isSupportedContent
@client
}
app/assets/javascripts/static_site_editor/graphql/typedefs.graphql
View file @
22078f8a
extend
type
Query
{
isSupportedContent
:
Boolean
!
project
Id
:
String
!
project
:
String
!
returnUrl
:
String
sourcePath
:
String
!
username
:
String
!
...
...
app/assets/javascripts/static_site_editor/index.js
View file @
22078f8a
...
...
@@ -6,7 +6,14 @@ import createRouter from './router';
import
createApolloProvider
from
'
./graphql
'
;
const
initStaticSiteEditor
=
el
=>
{
const
{
isSupportedContent
,
projectId
,
path
:
sourcePath
,
baseUrl
}
=
el
.
dataset
;
const
{
isSupportedContent
,
projectId
,
path
:
sourcePath
,
baseUrl
,
namespace
,
project
,
}
=
el
.
dataset
;
const
{
current_username
:
username
}
=
window
.
gon
;
const
returnUrl
=
el
.
dataset
.
returnUrl
||
null
;
...
...
@@ -22,7 +29,7 @@ const initStaticSiteEditor = el => {
const
router
=
createRouter
(
baseUrl
);
const
apolloProvider
=
createApolloProvider
({
isSupportedContent
:
parseBoolean
(
isSupportedContent
),
project
Id
,
project
:
`
${
namespace
}
/
${
project
}
`
,
returnUrl
,
sourcePath
,
username
,
...
...
app/assets/javascripts/static_site_editor/pages/home.vue
View file @
22078f8a
...
...
@@ -11,6 +11,8 @@ import PublishToolbar from '../components/publish_toolbar.vue';
import
InvalidContentMessage
from
'
../components/invalid_content_message.vue
'
;
import
SubmitChangesError
from
'
../components/submit_changes_error.vue
'
;
import
appDataQuery
from
'
../graphql/queries/app_data.query.graphql
'
;
export
default
{
components
:
{
RichContentEditor
,
...
...
@@ -23,13 +25,17 @@ export default {
SubmitChangesError
,
},
mixins
:
[
glFeatureFlagsMixin
()],
apollo
:
{
isSupportedContent
:
{
query
:
appDataQuery
,
},
},
computed
:
{
...
mapState
([
'
content
'
,
'
isLoadingContent
'
,
'
isSavingChanges
'
,
'
isContentLoaded
'
,
'
isSupportedContent
'
,
'
returnUrl
'
,
'
title
'
,
'
submitChangesError
'
,
...
...
app/assets/javascripts/static_site_editor/store/state.js
View file @
22078f8a
...
...
@@ -6,7 +6,6 @@ const createState = (initialState = {}) => ({
isLoadingContent
:
false
,
isSavingChanges
:
false
,
isSupportedContent
:
false
,
isContentLoaded
:
false
,
...
...
spec/frontend/static_site_editor/pages/home_spec.js
View file @
22078f8a
...
...
@@ -40,7 +40,6 @@ describe('static_site_editor/pages/home', () => {
store
=
new
Vuex
.
Store
({
state
:
createState
({
isSupportedContent
:
true
,
...
initialState
,
}),
getters
:
{
...
...
@@ -67,13 +66,16 @@ describe('static_site_editor/pages/home', () => {
});
};
const
buildWrapper
=
()
=>
{
const
buildWrapper
=
(
data
=
{
isSupportedContent
:
true
}
)
=>
{
wrapper
=
shallowMount
(
Home
,
{
localVue
,
store
,
provide
:
{
glFeatures
:
{
richContentEditor
:
true
},
},
data
()
{
return
data
;
},
});
};
...
...
@@ -194,8 +196,7 @@ describe('static_site_editor/pages/home', () => {
});
it
(
'
displays invalid content message when content is not supported
'
,
()
=>
{
buildStore
({
initialState
:
{
isSupportedContent
:
false
}
});
buildWrapper
();
buildWrapper
({
isSupportedContent
:
false
});
expect
(
findInvalidContentMessage
().
exists
()).
toBe
(
true
);
});
...
...
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