initial commit
This commit is contained in:
commit
9ac4a20119
16 changed files with 21727 additions and 0 deletions
9
.devcontainer/devcontainer.json
Normal file
9
.devcontainer/devcontainer.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "swabsite",
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/node": {}
|
||||||
|
},
|
||||||
|
"containerUser": "vscode",
|
||||||
|
"runArgs": ["--userns=keep-id", "--security-opt=label=disable"]
|
||||||
|
}
|
7
.env
Normal file
7
.env
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
HOST="0.0.0.0"
|
||||||
|
PORT=8055
|
||||||
|
PUBLIC_URL="/"
|
||||||
|
DB_CLIENT="sqlite3"
|
||||||
|
DB_FILENAME="./data.db"
|
||||||
|
SECRET="jLk0sEjVI3-lJaUwsQmzgW8tucsVHLka"
|
||||||
|
EXTENSIONS_AUTO_RELOAD=true
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.DS_Store
|
||||||
|
dist
|
||||||
|
node_modules
|
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.organizeImports": "explicit"
|
||||||
|
},
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
}
|
20
.vscode/tasks.json
vendored
Normal file
20
.vscode/tasks.json
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "start directus",
|
||||||
|
"command": "npx directus start",
|
||||||
|
"type": "shell",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "dev",
|
||||||
|
"command": "npm run dev",
|
||||||
|
"type": "shell",
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}/extensions/directus-extension-swablab"
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
14
LICENSE
Normal file
14
LICENSE
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
BSD Zero Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2023 swablab e.V.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
PERFORMANCE OF THIS SOFTWARE.
|
BIN
data.db
Normal file
BIN
data.db
Normal file
Binary file not shown.
3
extensions/directus-extension-swablab/.gitignore
vendored
Normal file
3
extensions/directus-extension-swablab/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
dist
|
5694
extensions/directus-extension-swablab/package-lock.json
generated
Normal file
5694
extensions/directus-extension-swablab/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
35
extensions/directus-extension-swablab/package.json
Normal file
35
extensions/directus-extension-swablab/package.json
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"name": "swablab",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"directus:extension": {
|
||||||
|
"type": "bundle",
|
||||||
|
"path": {
|
||||||
|
"app": "dist/app.js",
|
||||||
|
"api": "dist/api.js"
|
||||||
|
},
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "layout",
|
||||||
|
"name": "tasks",
|
||||||
|
"source": "src/tasks/index.js"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"host": "^10.10.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "directus-extension build",
|
||||||
|
"dev": "directus-extension build -w --no-minify",
|
||||||
|
"link": "directus-extension link",
|
||||||
|
"add": "directus-extension add"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@directus/extensions-sdk": "13.0.1",
|
||||||
|
"@types/vue-router": "^2.0.0",
|
||||||
|
"typescript": "^5.7.3",
|
||||||
|
"vue": "^3.5.13"
|
||||||
|
}
|
||||||
|
}
|
44
extensions/directus-extension-swablab/src/tasks/index.ts
Normal file
44
extensions/directus-extension-swablab/src/tasks/index.ts
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
import { defineLayout } from '@directus/extensions';
|
||||||
|
import { useCollection, useItems } from '@directus/extensions-sdk';
|
||||||
|
import { ref, toRefs } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import LayoutComponent from './layout.vue';
|
||||||
|
|
||||||
|
export default defineLayout({
|
||||||
|
id: 'tasks',
|
||||||
|
name: 'swablab tasks',
|
||||||
|
icon: 'box',
|
||||||
|
component: LayoutComponent,
|
||||||
|
slots: {
|
||||||
|
options: () => null,
|
||||||
|
sidebar: () => null,
|
||||||
|
actions: () => null,
|
||||||
|
},
|
||||||
|
setup(props) {
|
||||||
|
const router = useRouter();
|
||||||
|
const { collection, filter, search } = toRefs(props);
|
||||||
|
const { info, fields } = useCollection(collection);
|
||||||
|
|
||||||
|
const { items, loading, error } = useItems(collection, {
|
||||||
|
sort: ref(['date_due', 'date_created']),
|
||||||
|
limit: ref(-1),
|
||||||
|
fields: ref(['*', '*.*']),
|
||||||
|
page: ref(null),
|
||||||
|
filter,
|
||||||
|
search,
|
||||||
|
})
|
||||||
|
|
||||||
|
const me = ref('')
|
||||||
|
fetch("/users/me").then(x => x.json()).then(x => me.value = x.data.id)
|
||||||
|
|
||||||
|
return {
|
||||||
|
info,
|
||||||
|
items,
|
||||||
|
loading,
|
||||||
|
fields,
|
||||||
|
error,
|
||||||
|
router,
|
||||||
|
me,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
79
extensions/directus-extension-swablab/src/tasks/layout.vue
Normal file
79
extensions/directus-extension-swablab/src/tasks/layout.vue
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
<template>
|
||||||
|
<VListGroup v-if="!loading" class="swablab-tasks"
|
||||||
|
v-for="status in fields.find(f => f.field == 'status')?.meta?.options?.choices" open arrowPlacement="">
|
||||||
|
<template #activator>
|
||||||
|
<VListItem>
|
||||||
|
{{ status.text }}
|
||||||
|
</VListItem>
|
||||||
|
</template>
|
||||||
|
<VList v-for="item in items.filter(i => i.status == status.value)" :key="item.id">
|
||||||
|
<VListItem :clickable="true" @click="router.push(`${collection}/${item.id}`)">
|
||||||
|
<VListItemIcon>
|
||||||
|
<VIcon
|
||||||
|
:name="fields.find(f => f.field == 'category')?.meta?.options?.choices.find((c: any) => c.value == item.category).icon" />
|
||||||
|
</VListItemIcon>
|
||||||
|
<VListItemContent>
|
||||||
|
{{ item.title }}
|
||||||
|
</VListItemContent>
|
||||||
|
|
||||||
|
<VIcon v-if="item.responsibles.length == 0" name="person_search" color="green" />
|
||||||
|
<VIcon v-if="item.responsibles.find(x => x.directus_users_id == me)" name="account_circle" color="blue" />
|
||||||
|
<VChip v-if="item.date_due" :small="true">
|
||||||
|
<display-datetime format="short" :value="item.date_due" :use24="true" />
|
||||||
|
</VChip>
|
||||||
|
</VListItem>
|
||||||
|
</VList>
|
||||||
|
</VListGroup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.swablab-tasks {
|
||||||
|
--v-list-padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swablab-tasks .v-chip {
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Field } from '@directus/types';
|
||||||
|
import { defineComponent, PropType } from 'vue';
|
||||||
|
|
||||||
|
type Task = {
|
||||||
|
id: string
|
||||||
|
title: string
|
||||||
|
status: string
|
||||||
|
date_due?: string
|
||||||
|
priority: string
|
||||||
|
category: string
|
||||||
|
description: string
|
||||||
|
responsibles: {
|
||||||
|
directus_users_id: {
|
||||||
|
id: string
|
||||||
|
}
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
inheritAttrs: false,
|
||||||
|
props: {
|
||||||
|
collection: String,
|
||||||
|
items: {
|
||||||
|
type: Array as PropType<Task[]>,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
loading: Boolean,
|
||||||
|
error: Array,
|
||||||
|
router: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
fields: {
|
||||||
|
type: Array as PropType<Field[]>,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
me: Object,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
5
extensions/directus-extension-swablab/src/tasks/shims.d.ts
vendored
Normal file
5
extensions/directus-extension-swablab/src/tasks/shims.d.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
declare module '*.vue' {
|
||||||
|
import { DefineComponent } from 'vue';
|
||||||
|
const component: DefineComponent<{}, {}, any>;
|
||||||
|
export default component;
|
||||||
|
}
|
28
extensions/directus-extension-swablab/tsconfig.json
Normal file
28
extensions/directus-extension-swablab/tsconfig.json
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2019",
|
||||||
|
"lib": ["ES2019", "DOM"],
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"strict": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUncheckedIndexedAccess": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"alwaysStrict": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"strictFunctionTypes": true,
|
||||||
|
"strictBindCallApply": true,
|
||||||
|
"strictPropertyInitialization": true,
|
||||||
|
"resolveJsonModule": false,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"rootDir": "./src"
|
||||||
|
},
|
||||||
|
"include": ["./src/**/*.ts"]
|
||||||
|
}
|
15764
package-lock.json
generated
Normal file
15764
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
16
package.json
Normal file
16
package.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"name": "dist",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"description": "",
|
||||||
|
"dependencies": {
|
||||||
|
"directus": "^11.4.1",
|
||||||
|
"sqlite3": "^5.1.7"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue