Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
a9784c34
Unverified
Commit
a9784c34
authored
Sep 04, 2023
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: rerender page
parent
add3631b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
7 deletions
+101
-7
page.mjs
server/graph/resolvers/page.mjs
+3
-3
page.graphql
server/graph/schemas/page.graphql
+2
-2
en.json
server/locales/en.json
+2
-0
PageActionsCol.vue
ux/src/components/PageActionsCol.vue
+13
-2
RerenderPageDialog.vue
ux/src/components/RerenderPageDialog.vue
+81
-0
No files found.
server/graph/resolvers/page.mjs
View file @
a9784c34
...
...
@@ -603,9 +603,9 @@ export default {
}
},
/**
* RENDER PAGE
* RE
RE
NDER PAGE
*/
async
renderPage
(
obj
,
args
,
context
)
{
async
re
re
nderPage
(
obj
,
args
,
context
)
{
try
{
const
page
=
await
WIKI
.
db
.
pages
.
query
().
findById
(
args
.
id
)
if
(
!
page
)
{
...
...
@@ -613,7 +613,7 @@ export default {
}
await
WIKI
.
db
.
pages
.
renderPage
(
page
)
return
{
operation
:
generateSuccess
(
'Page rendered successfully.'
)
operation
:
generateSuccess
(
'Page re
re
ndered successfully.'
)
}
}
catch
(
err
)
{
return
generateError
(
err
)
...
...
server/graph/schemas/page.graphql
View file @
a9784c34
...
...
@@ -191,8 +191,8 @@ extend type Mutation {
rebuildPageTree
:
DefaultResponse
renderPage
(
id
:
Int
!
re
re
nderPage
(
id
:
UUID
!
):
DefaultResponse
restorePage
(
...
...
server/locales/en.json
View file @
a9784c34
...
...
@@ -1798,6 +1798,8 @@
"profile.title"
:
"Profile"
,
"profile.uploadNewAvatar"
:
"Upload New Image"
,
"profile.viewPublicProfile"
:
"View Public Profile"
,
"renderPageDialog.loading"
:
"Rendering page..."
,
"renderPageDialog.success"
:
"Page rerendered successfully."
,
"search.editorAny"
:
"Any editor"
,
"search.emptyQuery"
:
"Enter a query in the search field above and press Enter."
,
"search.filterEditor"
:
"Editor"
,
...
...
ux/src/components/PageActionsCol.vue
View file @
a9784c34
...
...
@@ -100,11 +100,11 @@
q-icon(color='deep-orange-9', name='las la-atom', size='sm')
q-item-section
q-item-label Convert Page
q-item(clickable, v-if='userStore.can(`edit:pages`)')
q-item(clickable, v-if='userStore.can(`edit:pages`)'
, @click='rerenderPage'
)
q-item-section.items-center(avatar)
q-icon(color='deep-orange-9', name='las la-magic', size='sm')
q-item-section
q-item-label Re
-
render Page
q-item-label Rerender Page
q-item(clickable)
q-item-section.items-center(avatar)
q-icon(color='deep-orange-9', name='las la-sun', size='sm')
...
...
@@ -204,6 +204,17 @@ function viewPageSource () {
siteStore
.
$patch
({
overlay
:
'PageSource'
,
overlayOpts
:
{
}
})
}
function
rerenderPage
()
{
$q
.
dialog
({
component
:
defineAsyncComponent
(()
=>
import
(
'../components/RerenderPageDialog.vue'
)),
componentProps
:
{
id
:
pageStore
.
id
}
}).
onOk
(()
=>
{
pageStore
.
pageLoad
({
id
:
pageStore
.
id
})
})
}
function
duplicatePage
()
{
$q
.
dialog
({
component
:
defineAsyncComponent
(()
=>
import
(
'../components/TreeBrowserDialog.vue'
)),
...
...
ux/src/components/RerenderPageDialog.vue
0 → 100644
View file @
a9784c34
<
template
lang=
"pug"
>
q-dialog(ref='dialogRef', @hide='onDialogHide' position='bottom', persistent)
q-card(style='width: 350px;')
q-linear-progress(query, color='page')
q-card-section.text-center
{{
t
(
'renderPageDialog.loading'
)
}}
</
template
>
<
script
setup
>
import
gql
from
'graphql-tag'
import
{
useI18n
}
from
'vue-i18n'
import
{
useDialogPluginComponent
,
useQuasar
}
from
'quasar'
import
{
computed
,
onMounted
,
reactive
}
from
'vue'
import
{
usePageStore
}
from
'src/stores/page'
// EMITS
defineEmits
([
...
useDialogPluginComponent
.
emits
])
// QUASAR
const
{
dialogRef
,
onDialogHide
,
onDialogOK
,
onDialogCancel
}
=
useDialogPluginComponent
()
const
$q
=
useQuasar
()
// STORES
const
pageStore
=
usePageStore
()
// I18N
const
{
t
}
=
useI18n
()
// METHODS
async
function
rerenderPage
()
{
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
1000
))
// allow for dialog to show
try
{
const
resp
=
await
APOLLO_CLIENT
.
mutate
({
mutation
:
gql
`
mutation rerenderPage(
$id: UUID!
) {
rerenderPage (
id: $id
) {
operation {
succeeded
message
}
}
}
`
,
variables
:
{
id
:
pageStore
.
id
}
})
if
(
resp
?.
data
?.
rerenderPage
?.
operation
?.
succeeded
)
{
$q
.
notify
({
type
:
'positive'
,
message
:
t
(
'renderPageDialog.success'
)
})
onDialogOK
()
}
else
{
throw
new
Error
(
resp
?.
data
?.
rerenderPage
?.
operation
?.
message
||
'An unexpected error occured.'
)
}
}
catch
(
err
)
{
$q
.
notify
({
type
:
'negative'
,
message
:
err
.
message
})
onDialogCancel
()
}
}
// MOUNTED
onMounted
(()
=>
{
rerenderPage
()
})
</
script
>
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