Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
max-db-bundle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pdn-certic
max-db-bundle
Commits
ac4b8516
Commit
ac4b8516
authored
3 months ago
by
Jerome Chauveau
Browse files
Options
Downloads
Patches
Plain Diff
list collections in current collection + delete sub collection action
parent
76f24227
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
static/max-db.js
+17
-4
17 additions, 4 deletions
static/max-db.js
templates/index.html
+43
-20
43 additions, 20 deletions
templates/index.html
with
60 additions
and
24 deletions
static/max-db.js
+
17
−
4
View file @
ac4b8516
...
...
@@ -38,11 +38,16 @@ function downloadSource(source){
});
}
function
deleteCurrentCollection
(){
if
(
confirm
(
`Supprimer
${
currentCollection
}
?`
))
{
fetch
(
`/bundles/max-db/
${
currentCollection
}
`
,
{
method
:
'
DELETE
'
}).
then
((
res
)
=>
{
function
downloadCollection
(
collectionPath
){
console
.
debug
(
'
todo
'
)
}
function
deleteCollection
(
collectionPath
,
current
=
false
){
if
(
confirm
(
`Supprimer
${
collectionPath
}
?`
))
{
fetch
(
`/bundles/max-db/
${
collectionPath
}
`
,
{
method
:
'
DELETE
'
}).
then
((
res
)
=>
{
if
(
res
.
status
==
200
){
window
.
location
.
href
=
'
/bundles/max-db/
'
;
if
(
current
)
window
.
location
.
href
=
'
/bundles/max-db/
'
;
else
window
.
location
.
reload
(
true
)
}
else
{
res
.
text
().
then
((
message
)
=>
alert
(
`Une erreur est survenue, suppression impossible. \n\n
${
message
}
).`
))
...
...
@@ -51,6 +56,10 @@ function deleteCurrentCollection(){
}
}
function
deleteCurrentCollection
(){
deleteCollection
(
currentCollection
,
true
)
}
function
openMoveSourceDialog
(
source
)
{
document
.
getElementById
(
'
modal-title
'
).
innerHTML
=
`Déplacer <em>
${
source
}
</em>`
if
(
!
modal
)
...
...
@@ -59,6 +68,10 @@ function openMoveSourceDialog(source) {
modal
.
show
()
}
function
openMoveCollectionDialog
(
collectionPath
){
console
.
debug
(
'
todo
'
)
}
function
doMoveSource
(){
const
collection
=
document
.
getElementById
(
'
move-collection-select
'
).
value
const
path
=
currentCollection
===
'
/
'
?
currentSource
:
`
${
currentCollection
}
/
${
currentSource
}
`
...
...
This diff is collapsed.
Click to expand it.
templates/index.html
+
43
−
20
View file @
ac4b8516
...
...
@@ -29,7 +29,9 @@
let $parts := tokenize($collection,'/')
return
<sl-breadcrumb>
<sl-breadcrumb-item><a
class=
"text-decoration-none"
href=
"/bundles/max-db?collection=/"
>
/
</a></sl-breadcrumb-item>
<sl-breadcrumb-item><a
class=
"text-decoration-none"
href=
"/bundles/max-db?collection=/"
>
<sl-icon-button
name=
"house"
/>
</a></sl-breadcrumb-item>
{
for $part at $i in $parts
let $href := '/bundles/max-db?collection=' || $part
...
...
@@ -66,12 +68,12 @@
</div>
</section>
<section>
<h3>
Sources XML (
<span
id=
"sources-count"
>
{count($sources[@type='xml'])}
</span>
)
</h3>
<h3><span>
Fichiers
</span><span
class=
"badge bg-light text-dark"
id=
"sources-count"
>
{count($sources[@type='xml'])}
</span><span
class=
"ms-5"
>
Collections
</span><span
class=
"badge bg-light text-dark"
id=
"collections-count"
>
{count($sources[local-name()='dir'])}
</span></h3>
<table
class=
"table"
>
<thead>
<tr>
<th
scope=
"col"
>
Nom du fichier
</th>
<th>
#
</th>
<th
scope=
"col"
>
Nom
</th>
<th
scope=
"col"
>
Taille
</th>
<th
scope=
"col"
>
Dernière modification
</th>
<th
class=
"text-center"
scope=
"col"
>
Actions
</th>
...
...
@@ -80,12 +82,14 @@
<tbody>
{
for $source in $sources
return if($source/@type="xml")
then
<tr
id=
"{$source/data()}"
>
<td>
{$source/data()}
</td>
<td>
{string($source/@size)}
</td>
<td><sl-relative-time
title=
"{string($source/@modified-date)}"
date=
"{string($source/@modified-date)}"
lang=
"fr-FR"
></sl-relative-time></td>
<td
class=
"text-center"
>
where local-name($source)='resource' and $source/@type="xml"
return
<tr
id=
"{$source/data()}"
>
<td
class=
"align-middle"
><div
style=
"font-size: 24px;"
><sl-icon-button
name=
"filetype-xml"
/></div></td>
<td
class=
"align-middle"
>
{$source/data()}
</td>
<td
class=
"align-middle"
>
{string($source/@size)}
</td>
<td
class=
"align-middle"
><sl-relative-time
title=
"{string($source/@modified-date)}"
date=
"{string($source/@modified-date)}"
lang=
"fr-FR"
></sl-relative-time></td>
<td
class=
"text-center align-middle"
>
<sl-icon-button
name=
"download"
title=
"télécharger"
onclick=
"downloadSource('{$source/data()}')"
>
</sl-icon-button>
<sl-icon-button
name=
"hand-index"
title=
"déplacer"
onclick=
"openMoveSourceDialog('{$source/data()}')"
>
...
...
@@ -94,7 +98,26 @@
</sl-icon-button>
</td>
</tr>
else()
}
{
for $dir in $sources
where local-name($dir)='dir'
let $path := if($collection = '/') then $dir/data() else $collection || '/' || $dir/data()
return
<tr
id=
"{$dir/data()}"
>
<td
onclick=
"window.location.href='{concat('/bundles/max-db?collection=',$path)}'"
style=
"cursor:pointer;"
class=
"align-middle"
><div
style=
"font-size: 24px;"
><sl-icon-button
name=
"folder2"
/></div></td>
<td
onclick=
"window.location.href='{concat('/bundles/max-db?collection=',$path)}'"
style=
"cursor:pointer;"
class=
"align-middle"
>
{$dir/data()}
</td>
<td
onclick=
"window.location.href='{concat('/bundles/max-db?collection=',$path)}'"
style=
"cursor:pointer;"
class=
"align-middle"
></td>
<td
onclick=
"window.location.href='{concat('/bundles/max-db?collection=',$path)}'"
style=
"cursor:pointer;"
class=
"align-middle"
><sl-relative-time
title=
"{string($dir/@modified-date)}"
date=
"{string($dir/@modified-date)}"
lang=
"fr-FR"
></sl-relative-time></td>
<td
class=
"text-center align-middle"
onclick=
""
>
<sl-icon-button
name=
"download"
title=
"télécharger"
onclick=
"downloadCollection('{$path}')"
>
</sl-icon-button>
<sl-icon-button
name=
"hand-index"
title=
"déplacer"
onclick=
"openMoveCollectionDialog('{$path}')"
>
</sl-icon-button>
<sl-icon-button
name=
"trash"
title=
"supprimer"
onclick=
"deleteCollection('{$path}')"
>
</sl-icon-button>
</td>
</tr>
}
</tbody>
</table>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment