Website tweaks

This commit is contained in:
Eike Kettner 2020-07-31 15:13:07 +02:00
parent 808a5a3c94
commit 4f6597f358
13 changed files with 151 additions and 103 deletions

40
project/Cmd.scala Normal file
View File

@ -0,0 +1,40 @@
package docspell.build
import sbt._
import scala.sys.process._
import java.util.concurrent.atomic.AtomicReference
/** Helper for running external commands. */
object Cmd {
case class Result(rc: Int, out: String, err: String) {
def throwIfNot(success: Int): Result =
if (rc != success) sys.error(s"Unsuccessful return: $rc")
else this
}
def run(cmd: Seq[String], wd: File, logger: Logger): Unit = {
val res = Cmd.exec(cmd, Some(wd))
logger.info(res.out)
logger.error(res.err)
res.throwIfNot(0)
}
def exec(cmd: Seq[String], wd: Option[File]): Result = {
val capt = new Capture
val rc = Process(cmd, wd).!(capt.logger)
Result(rc, capt.out.get.mkString("\n"), capt.err.get.mkString("\n"))
}
final private class Capture {
val err = new AtomicReference[List[String]](Nil)
val out = new AtomicReference[List[String]](Nil)
val logger = ProcessLogger(
line => out.getAndAccumulate(List(line), _ ++ _),
line => err.getAndAccumulate(List(line), _ ++ _)
)
}
}

View File

@ -76,38 +76,31 @@ object ZolaPlugin extends AutoPlugin {
runElmCompile("elm", inDir.getParentFile, outDir, logger)
Seq.empty
}
val cmd = Seq(zolaCmd, "build", "-o", outDir.absolutePath.toString) ++ baseUrl
val proc = Process(cmd, Some(inDir))
val out = proc.!!
logger.info(out)
}
def checkSite(zolaCmd: String, inDir: File, logger: Logger): Unit = {
val cmd = Seq(zolaCmd, "check")
val proc = Process(cmd, Some(inDir))
val out = proc.!!
logger.info(out)
}
def runYarnInstall(yarnCmd: String, inDir: File, logger: Logger): Unit = {
val cmd = Seq(yarnCmd, "install")
val proc = Process(cmd, Some(inDir))
val out = proc.!!
logger.info(out)
}
def runElmCompile(elmCmd: String, inDir: File, zolaOut: File, logger: Logger): Unit = {
val cmd = Seq(
elmCmd,
"make",
"--output",
(zolaOut / "static" / "js" / "bundle.js").absolutePath.toString,
"--optimize",
(inDir/"elm"/"Main.elm").toString
Cmd.run(
Seq(zolaCmd, "build", "-o", outDir.absolutePath.toString) ++ baseUrl,
inDir,
logger
)
val proc = Process(cmd, Some(inDir))
val out = proc.!!
logger.info(out)
}
def checkSite(zolaCmd: String, inDir: File, logger: Logger): Unit =
Cmd.run(Seq(zolaCmd, "check"), inDir, logger)
def runYarnInstall(yarnCmd: String, inDir: File, logger: Logger): Unit =
Cmd.run(Seq(yarnCmd, "install"), inDir, logger)
def runElmCompile(elmCmd: String, inDir: File, zolaOut: File, logger: Logger): Unit =
Cmd.run(
Seq(
elmCmd,
"make",
"--output",
(zolaOut / "static" / "js" / "bundle.js").absolutePath.toString,
"--optimize",
(inDir / "elm" / "Main.elm").toString
),
inDir,
logger
)
}

View File

@ -21,7 +21,7 @@ refresh =
logo : Html msg
logo =
img [ src "icons/logo-only.svg" ] []
img [ src "icons/logo-only-36.svg" ] []
logoMC : Html msg

View File

@ -314,9 +314,10 @@ mainHero model =
[ span [ class "unsplash-credit" ]
[ text "Photo by "
, a
[ href "https://unsplash.com/@tersiusvanrhyn"
[ href "https://unsplash.com/@numericcitizen"
, target "_blank"
]
[ text "Tersius van Rhyn"
[ text "JF Martin"
]
]
]

View File

@ -36,7 +36,7 @@ The sbt build is setup such that a file `dev.conf` in the directory
it exists. So you can create a custom config file for development. For
example, a custom database for development may be setup this way:
```
``` conf
#jdbcurl = "jdbc:h2:///home/dev/workspace/projects/docspell/local/docspell-demo.db;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;AUTO_SERVER=TRUE"
jdbcurl = "jdbc:postgresql://localhost:5432/docspelldev"
#jdbcurl = "jdbc:mariadb://localhost:3306/docspelldev"

View File

@ -56,20 +56,21 @@ application is a
in [Elm](https://elm-lang.org) and is a client to the REST api. All
features are available via a http/rest api.
The *joex* is the component that does the “heavy work”, excuting
The *joex* is the component that does the “heavy work”, executing
long-running tasks, like processing files or importing your mails
periodically. While the joex component also exposes a small REST api
for controlling it, the user interface is all inside the rest server
api.
for controlling it, the main user interface is all inside the rest
server api.
The rest server and the job executor can be started multiple times in
order to scale out. It must be ensured, that all connect to the same
database.
database. And it is also recommended (though not strictly required),
that all components can reach each other.
The fulltext search index is another separate component, where
currently only SOLR is supported. SOLR also supports running in a
distributed way. Fulltext search is optional, so the SOLR component is
not required if docspell is run without fulltext search support.
currently only [SOLR](https://lucene.apache.org/solr) is supported.
Fulltext search is optional, so the SOLR component is not required if
docspell is run without fulltext search support.
# Terms
@ -79,39 +80,39 @@ explained.
## Item
An *Item* is roughly your document, only that an item may span
multiple files, which are called **attachments**. An item has **meta
data** associated:
An *item* is roughly your document, only that an item may span
multiple files, which are called *attachments*. An item has *meta
data* associated:
- a **correspondent**: the other side of the communication. It can be
- a *correspondent*: the other side of the communication. It can be
an organization or a person.
- a **concerning person** or **equipment**: a person or thing that
- a *concerning person* or *equipment*: a person or thing that
this item is about. Maybe it is an insurance contract about your
car.
- **tag**: an item can be tagged with one or more tags (or labels). A
- *tag*: an item can be tagged with one or more tags (or labels). A
tag can have a *category*. This is intended for grouping tags, for
example a category `doctype` could be used to group tags like
`bill`, `contract`, `receipt` etc. Usually an item is not tagged
with more than one tag of a category.
- a **folder**: a folder is similiar to a tag, but an item can only be
- a *folder*: a folder is similiar to a tag, but an item can only be
in exactly one folder (or none). Furhtermore folders allow to
associate users, so that items are only visible to the users who are
members of a folder.
- an **item date**: this is the date of the document if this is not
- an *item date*: this is the date of the document if this is not
set, the created date of the item is used.
- a **due date**: an optional date indicating that something has to be
- a *due date*: an optional date indicating that something has to be
done (e.g. paying a bill, submitting it) about this item until this
date
- a **direction**: one of "incoming" or "outgoing"
- a **name**: some item name, defaults to the file name of the
- a *direction*: one of "incoming" or "outgoing"
- a *name*: some item name, defaults to the file name of the
attachments
- some **notes**: arbitrary descriptive text. You can use markdown
- some *notes*: arbitrary descriptive text. You can use markdown
here, which is properly formatted in the web application.
## Collective
The users of the application are part of a **collective**. A
**collective** is a group of users that share access to the same
The users of the application are part of a *collective*. A
*collective* is a group of users that share access to the same
items. The account name is therefore comprised of a *collective name*
and a *user name*.

View File

@ -6,9 +6,10 @@ weight = 10
# Introduction
A bash script to quickly upload files from the command line. It reads
a configuration file containing the URLs to upload to. Then each file
given to the script will be uploaded to al URLs in the config.
The `tools/ds.sh` is a bash script to quickly upload files from the
command line. It reads a configuration file containing the URLs to
upload to. Then each file given to the script will be uploaded to al
URLs in the config.
The config file is expected in
`$XDG_CONFIG_HOME/docspell/ds.conf`. `$XDG_CONFIG_HOME` defaults to

View File

@ -100,8 +100,8 @@ can guess the item-id.
While folders are *not* taken into account when processing documents,
they can be specified with the upload request or a [source
url](uploading#anonymous-upload) to have them automatically set when
they arrive.
url](@/docs/webapp/uploading.md#anonymous-upload) to have them
automatically set when files arrive.
# Document Language

View File

@ -14,8 +14,8 @@ page](@/docs/webapp/emailsettings.md#smtp-settings).
Notifying works simply by searching for due items periodically. It
will be submitted to the job queue and is picked up by an available
[job executor](joex) eventually. This can be setup in the user
settings page.
[job executor](@/docs/joex/_index.md) eventually. This can be setup in
the user settings page.
{{ figure(file="notify-due-items.jpg") }}

View File

@ -30,16 +30,14 @@ scripts. For this the next variant exists.
It is also possible to upload files without authentication. This
should make tools that interact with docspell much easier to write.
# Creating Anonymous Uploads
Go to "Collective Settings" and then to the "Source" tab. A *Source*
identifies an endpoint where files can be uploaded
anonymously. Creating a new source creates a long unique id which is
part on an url that can be used to upload files. You can choose any
time to deactivate or delete the source at which point uploading is
not possible anymore. The idea is to give this URL away safely. You
can delete it any time and no passwords or secrets are visible, even
your username is not visible.
identifies an endpoint where files can be uploaded anonymously.
Creating a new source creates a long unique id which is part of an url
that can be used to upload files. You can choose any time to
deactivate or delete the source at which point uploading is not
possible anymore. The idea is to give this URL away safely. You can
delete it any time and no passwords or secrets are visible, even your
username is not visible.
Example screenshot:
@ -65,9 +63,9 @@ your account. You could give this url to people for sending files
directly into your docspell.
The second url is the API url, which accepts the requests to upload
files (which is used by the first url).
files (it is used by the upload page, the first url).
For example, this url can be used to upload files with curl:
For example, the api url can be used to upload files with curl:
``` bash
$ curl -XPOST -F file=@test.pdf http://localhost:7880/api/v1/open/upload/item/CqpFTb7UmGe-9nMVPZSmnwc-AHH6nWFh52t-M1JFQ9y7cdH
@ -76,11 +74,14 @@ $ curl -XPOST -F file=@test.pdf http://localhost:7880/api/v1/open/upload/item/Cq
You could add more `-F file=@/path/to/your/file.pdf` to upload
multiple files (note, the `@` is required by curl, so it knows that
the following is a file).
the following is a file). There is a [script
provided](@/docs/tools/ds.md) that uses this to upload files from the
command line.
When files are uploaded to an source endpoint, the items resulting
from this uploads are marked with the name of the source. So you know
which source an item originated.
which source an item originated. There is also a counter incremented
for each reqest.
If files are uploaded using the web applications *Upload files* page,
the source is implicitly set to `webapp`. If you also want to let

View File

@ -30,7 +30,7 @@ $info: $infoblue
// background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 1)), url(img/jf-martin-Ofs3LjEUcrk-unsplash.jpg)
//jesse-gardner-EqdpXeemf58-unsplash
#hero-main
background: url(img/tersius-van-rhyn-xcQWMPm9fG8-unsplash.jpg)
background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 1)), url('img/jf-martin-Ofs3LjEUcrk-unsplash.jpg')
background-size: 100% 100%
background-repeat: no-repeat
.hero-body h1, h2, p
@ -51,10 +51,12 @@ h1
.doc
h1
border-bottom: 1px solid #ccc
padding-bottom: 0.15em
a.zola-anchor
padding-left: 0.75rem
display: none
font-family: $family-monospace
h1:hover a.zola-anchor
display: inline
@ -79,13 +81,22 @@ nav.breadcrumb
color: black
span.unsplash-credit
color: #444
color: #555
margin-right: 0.5em
float: right
font-size: smaller
a
color: #444
color: #555
&:hover
color: #666
color: #777
//import all of bulma
@import "../../node_modules/bulma/bulma.sass"
p.has-text
color: $text
.card.full-height
.card-content
height: 100%

View File

@ -1,24 +1,24 @@
<nav class="navbar">
<div class="navbar-brand">
<a class="navbar-item" href="/">
<span class="icon">
<img src="/icons/logo-only.svg">
</span>
<span>
Docspell
</span>
</a>
</div>
<div class="navbar-start">
<a target="_blank"
href="https://github.com/eikek/docspell"
class="navbar-item">
<span class="icon">
<img src="/icons/github-40.svg">
</span>
<span>
Github
</span>
</a>
</div>
<div class="navbar-brand">
<a class="navbar-item" href="/">
<span class="icon">
<img src="/icons/logo-only-36.svg">
</span>
<span>
Docspell
</span>
</a>
</div>
<div class="navbar-start">
<a target="_blank"
href="https://github.com/eikek/docspell"
class="navbar-item">
<span class="icon">
<img src="/icons/github-40.svg">
</span>
<span>
Github
</span>
</a>
</div>
</nav>

View File

@ -39,7 +39,7 @@
<p class="title is-5">
{{ sub.title | title }}
</p>
<p class="subtitle is-6">
<p class="has-text">
{{ sub.description }}
</p>
</div>