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
cc506a08
Unverified
Commit
cc506a08
authored
Jun 18, 2022
by
Nicolas Giard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(admin): sites save / activate / delete mutations
parent
4bfd9f52
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
32 deletions
+35
-32
site.js
server/graph/resolvers/site.js
+7
-6
sites.js
server/models/sites.js
+2
-0
storage.js
server/models/storage.js
+2
-3
package.json
ux/package.json
+14
-14
SiteActivateDialog.vue
ux/src/components/SiteActivateDialog.vue
+8
-8
AdminSites.vue
ux/src/pages/AdminSites.vue
+2
-1
yarn.lock
ux/yarn.lock
+0
-0
No files found.
server/graph/resolvers/site.js
View file @
cc506a08
...
...
@@ -8,7 +8,7 @@ const path = require('path')
module
.
exports
=
{
Query
:
{
async
sites
()
{
const
sites
=
await
WIKI
.
models
.
sites
.
query
()
const
sites
=
await
WIKI
.
models
.
sites
.
query
()
.
orderBy
(
'hostname'
)
return
sites
.
map
(
s
=>
({
...
s
.
config
,
id
:
s
.
id
,
...
...
@@ -69,10 +69,11 @@ module.exports = {
title
:
args
.
title
})
return
{
status
:
graphHelper
.
generateSuccess
(
'Site created successfully'
),
operation
:
graphHelper
.
generateSuccess
(
'Site created successfully'
),
site
:
newSite
}
}
catch
(
err
)
{
WIKI
.
logger
.
warn
(
err
)
return
graphHelper
.
generateError
(
err
)
}
},
...
...
@@ -109,7 +110,7 @@ module.exports = {
})
return
{
status
:
graphHelper
.
generateSuccess
(
'Site updated successfully'
)
operation
:
graphHelper
.
generateSuccess
(
'Site updated successfully'
)
}
}
catch
(
err
)
{
WIKI
.
logger
.
warn
(
err
)
...
...
@@ -129,7 +130,7 @@ module.exports = {
// -> Delete site
await
WIKI
.
models
.
sites
.
deleteSite
(
args
.
id
)
return
{
status
:
graphHelper
.
generateSuccess
(
'Site deleted successfully'
)
operation
:
graphHelper
.
generateSuccess
(
'Site deleted successfully'
)
}
}
catch
(
err
)
{
WIKI
.
logger
.
warn
(
err
)
...
...
@@ -161,7 +162,7 @@ module.exports = {
})
WIKI
.
logger
.
info
(
'New site logo processed successfully.'
)
return
{
status
:
graphHelper
.
generateSuccess
(
'Site logo uploaded successfully'
)
operation
:
graphHelper
.
generateSuccess
(
'Site logo uploaded successfully'
)
}
}
catch
(
err
)
{
return
graphHelper
.
generateError
(
err
)
...
...
@@ -174,7 +175,7 @@ module.exports = {
const
{
filename
,
mimetype
,
createReadStream
}
=
await
args
.
image
console
.
info
(
filename
,
mimetype
)
return
{
status
:
graphHelper
.
generateSuccess
(
'Site favicon uploaded successfully'
)
operation
:
graphHelper
.
generateSuccess
(
'Site favicon uploaded successfully'
)
}
}
}
...
...
server/models/sites.js
View file @
cc506a08
...
...
@@ -78,6 +78,8 @@ module.exports = class Site extends Model {
})
})
WIKI
.
logger
.
debug
(
`Creating new DB storage for site
${
newSite
.
id
}
`
)
await
WIKI
.
models
.
storage
.
query
().
insert
({
module
:
'db'
,
siteId
:
newSite
.
id
,
...
...
server/models/storage.js
View file @
cc506a08
...
...
@@ -12,7 +12,7 @@ const commonHelper = require('../helpers/common')
*/
module
.
exports
=
class
Storage
extends
Model
{
static
get
tableName
()
{
return
'storage'
}
static
get
idColumn
()
{
return
'
key
'
}
static
get
idColumn
()
{
return
'
id
'
}
static
get
jsonSchema
()
{
return
{
...
...
@@ -21,8 +21,7 @@ module.exports = class Storage extends Model {
properties
:
{
module
:
{
type
:
'string'
},
isEnabled
:
{
type
:
'boolean'
},
SVGAnimatedInteger
:
{
type
:
'string'
}
isEnabled
:
{
type
:
'boolean'
}
}
}
}
...
...
ux/package.json
View file @
cc506a08
...
...
@@ -11,8 +11,8 @@
"lint"
:
"eslint --ext .js,.vue ./"
},
"dependencies"
:
{
"@apollo/client"
:
"3.6.
5
"
,
"@codemirror/autocomplete"
:
"0.20.
2
"
,
"@apollo/client"
:
"3.6.
8
"
,
"@codemirror/autocomplete"
:
"0.20.
3
"
,
"@codemirror/basic-setup"
:
"0.20.0"
,
"@codemirror/closebrackets"
:
"0.19.2"
,
"@codemirror/commands"
:
"0.20.0"
,
...
...
@@ -23,15 +23,15 @@
"@codemirror/history"
:
"0.19.2"
,
"@codemirror/lang-css"
:
"0.20.0"
,
"@codemirror/lang-html"
:
"0.20.0"
,
"@codemirror/lang-javascript"
:
"0.20.
0
"
,
"@codemirror/lang-javascript"
:
"0.20.
1
"
,
"@codemirror/lang-json"
:
"0.20.0"
,
"@codemirror/lang-markdown"
:
"0.20.1"
,
"@codemirror/matchbrackets"
:
"0.19.4"
,
"@codemirror/search"
:
"0.20.1"
,
"@codemirror/state"
:
"0.20.
0
"
,
"@codemirror/state"
:
"0.20.
1
"
,
"@codemirror/tooltip"
:
"0.19.16"
,
"@codemirror/view"
:
"0.20.
6
"
,
"@lezer/common"
:
"0.16.
0
"
,
"@codemirror/view"
:
"0.20.
7
"
,
"@lezer/common"
:
"0.16.
1
"
,
"@quasar/extras"
:
"1.14.0"
,
"@tiptap/core"
:
"2.0.0-beta.176"
,
"@tiptap/extension-code-block"
:
"2.0.0-beta.37"
,
...
...
@@ -59,9 +59,9 @@
"@tiptap/vue-3"
:
"2.0.0-beta.91"
,
"@vue/apollo-option"
:
"4.0.0-alpha.17"
,
"apollo-upload-client"
:
"17.0.0"
,
"browser-fs-access"
:
"0.29.
5
"
,
"browser-fs-access"
:
"0.29.
6
"
,
"clipboard"
:
"2.0.11"
,
"filesize"
:
"9.0.
0
"
,
"filesize"
:
"9.0.
9
"
,
"filesize-parser"
:
"1.5.0"
,
"graphql"
:
"16.5.0"
,
"graphql-tag"
:
"2.12.6"
,
...
...
@@ -74,11 +74,11 @@
"quasar"
:
"2.7.1"
,
"tippy.js"
:
"6.3.7"
,
"uuid"
:
"8.3.2"
,
"v-network-graph"
:
"0.5.1
7
"
,
"v-network-graph"
:
"0.5.1
9
"
,
"vue"
:
"3.2.31"
,
"vue-codemirror"
:
"5.
0.1
"
,
"vue-codemirror"
:
"5.
1.0
"
,
"vue-i18n"
:
"9.1.10"
,
"vue-router"
:
"4.0.1
5
"
,
"vue-router"
:
"4.0.1
6
"
,
"vuedraggable"
:
"4.1.0"
,
"zxcvbn"
:
"4.4.2"
},
...
...
@@ -87,12 +87,12 @@
"@quasar/app-vite"
:
"1.0.1"
,
"@types/lodash"
:
"4.14.182"
,
"autoprefixer"
:
"10.4.7"
,
"eslint"
:
"8.1
6
.0"
,
"eslint"
:
"8.1
7
.0"
,
"eslint-config-standard"
:
"17.0.0"
,
"eslint-plugin-import"
:
"2.26.0"
,
"eslint-plugin-n"
:
"15.2.
0
"
,
"eslint-plugin-n"
:
"15.2.
3
"
,
"eslint-plugin-promise"
:
"6.0.0"
,
"eslint-plugin-vue"
:
"9.
0
.1"
"eslint-plugin-vue"
:
"9.
1
.1"
},
"engines"
:
{
"node"
:
"^18 || ^16"
,
...
...
ux/src/components/SiteActivateDialog.vue
View file @
cc506a08
...
...
@@ -3,10 +3,10 @@ q-dialog(ref='dialogRef', @hide='onDialogHide')
q-card(style='min-width: 350px; max-width: 450px;')
q-card-section.card-header
q-icon(name='img:/_assets/icons/fluent-shutdown.svg', left, size='sm')
span
{{
modelValu
e
?
t
(
`admin.sites.activate`
)
:
t
(
`admin.sites.deactivate`
)
}}
span
{{
props
.
targetStat
e
?
t
(
`admin.sites.activate`
)
:
t
(
`admin.sites.deactivate`
)
}}
q-card-section
.text-body2
i18n-t(:keypath='
modelValu
e ? `admin.sites.activateConfirm` : `admin.sites.deactivateConfirm`')
i18n-t(:keypath='
props.targetStat
e ? `admin.sites.activateConfirm` : `admin.sites.deactivateConfirm`')
template(v-slot:siteTitle)
strong
{{
props
.
site
.
title
}}
q-card-actions.card-actions
...
...
@@ -20,8 +20,8 @@ q-dialog(ref='dialogRef', @hide='onDialogHide')
)
q-btn(
unelevated
:label='
modelValu
e ? t(`common.actions.activate`) : t(`common.actions.deactivate`)'
:color='
modelValu
e ? `positive` : `negative`'
:label='
props.targetStat
e ? t(`common.actions.activate`) : t(`common.actions.deactivate`)'
:color='
props.targetStat
e ? `positive` : `negative`'
padding='xs md'
@click='confirm'
:loading='state.isLoading'
...
...
@@ -44,7 +44,7 @@ const props = defineProps({
type
:
Object
,
required
:
true
},
modelValu
e
:
{
targetStat
e
:
{
type
:
Boolean
,
default
:
false
}
...
...
@@ -101,19 +101,19 @@ async function confirm () {
`
,
variables
:
{
id
:
props
.
site
.
id
,
newState
:
props
.
modelValu
e
newState
:
props
.
targetStat
e
}
})
if
(
resp
?.
data
?.
updateSite
?.
operation
?.
succeeded
)
{
$q
.
notify
({
type
:
'positive'
,
message
:
t
his
.
$t
(
'admin.sites.updateSuccess'
)
message
:
t
(
'admin.sites.updateSuccess'
)
})
adminStore
.
$patch
({
sites
:
adminStore
.
sites
.
map
(
s
=>
{
if
(
s
.
id
===
props
.
site
.
id
)
{
const
ns
=
cloneDeep
(
s
)
ns
.
isEnabled
=
props
.
modelValu
e
ns
.
isEnabled
=
props
.
targetStat
e
return
ns
}
else
{
return
s
...
...
ux/src/pages/AdminSites.vue
View file @
cc506a08
...
...
@@ -156,11 +156,12 @@ function editSite (st) {
})
}
function
toggleSiteState
(
st
,
newState
)
{
console
.
info
(
newState
)
$q
.
dialog
({
component
:
SiteActivateDialog
,
componentProps
:
{
site
:
st
,
valu
e
:
newState
targetStat
e
:
newState
}
})
}
...
...
ux/yarn.lock
View file @
cc506a08
This diff was suppressed by a .gitattributes entry.
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