Skip to content

Commit

Permalink
Merge pull request #1842 from doccano/fix/1762
Browse files Browse the repository at this point in the history
Enable to specify the number of thread in windows
  • Loading branch information
Hironsan committed May 27, 2022
2 parents c146a4c + fab8787 commit a927bb6
Show file tree
Hide file tree
Showing 236 changed files with 1,745 additions and 2,572 deletions.
62 changes: 32 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,35 @@ jobs:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Run migrations
run: |
poetry run task wait_for_db
poetry run task migrate
- name: Lint with flake8
run: |
poetry run task flake8
- name: Lint with isort
run: |
poetry run task isort
- name: Black
run: |
poetry run task black
- name: mypy
run: |
poetry run task mypy
- name: Run tests
run: |
poetry run task test
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Run migrations
run: |
poetry run task wait_for_db
poetry run task migrate
- name: Lint with flake8
run: |
poetry run task flake8
- name: Lint with isort
run: |
poetry run task isort
- name: Black
run: |
poetry run task black
- name: mypy
run: |
poetry run task mypy
- name: Run tests
run: |
poetry run task test
frontend:
runs-on: ubuntu-latest
Expand All @@ -48,13 +48,15 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: "16"
- name: Install Yarn
run: npm install -g yarn
- name: Install npm modules
run: yarn install
- name: Lint
run: yarn lint
- name: Prettier
run: yarn lint:prettier

docker-lint:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion backend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def run_on_windows(args):

from config.wsgi import application

serve(application, port=args.port)
serve(application, port=args.port, threads=args.workers)


def command_db_init(args):
Expand Down
32 changes: 14 additions & 18 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,23 @@ module.exports = {
browser: true,
node: true
},
extends: [
'@nuxtjs',
'plugin:nuxt/recommended',
'@nuxtjs/eslint-config-typescript',
'prettier'
],
extends: ['@nuxtjs/eslint-config-typescript', 'plugin:nuxt/recommended', 'prettier'],
rules: {
'no-console': 'off',
'no-restricted-syntax': [
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-useless-constructor': 'off',
camelcase: 'off',
'max-len': [
'error',
100,
2,
{
selector: "CallExpression[callee.object.name='console'][callee.property.name!=/^(log|warn|error|info|trace)$/]",
message: 'Unexpected property on console object was called'
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true
}
],
// 'vue/valid-template-root': 'off',
// 'space-before-function-paren': ['error', 'never'],
'no-useless-constructor': 'off',
// '@typescript-eslint/no-useless-constructor': 'off',
// 'no-unused-vars': 'off',
// '@typescript-eslint/no-unused-vars': 'off',
'camelcase': 'off'
]
}
}
8 changes: 8 additions & 0 deletions frontend/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.nuxt/
assets/
coverage/
dist/
node_modules/
static/
*.html
*.md
6 changes: 6 additions & 0 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 100,
"semi": false,
"singleQuote": true,
"trailingComma": "none"
}
7 changes: 1 addition & 6 deletions frontend/components/auth/FormLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@
>
<template #content>
<v-form v-model="valid">
<v-alert
v-show="showError"
v-model="showError"
type="error"
dismissible
>
<v-alert v-show="showError" v-model="showError" type="error" dismissible>
{{ $t('errors.invalidUserOrPass') }}
</v-alert>
<v-text-field
Expand Down
60 changes: 14 additions & 46 deletions frontend/components/comment/Comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,26 @@
<v-list-item-content>
<v-list-item-title>{{ comment.username }}</v-list-item-title>
<v-list-item-subtitle>
{{ comment.createdAt | dateParse('YYYY-MM-DDTHH:mm:ss') | dateFormat('DD/MM/YYYY HH:mm') }}
{{
comment.createdAt | dateParse('YYYY-MM-DDTHH:mm:ss') | dateFormat('DD/MM/YYYY HH:mm')
}}
</v-list-item-subtitle>
</v-list-item-content>

<v-row
align="center"
justify="end"
>
<v-menu
v-if="comment.user == userId"
bottom
left
>
<v-row align="center" justify="end">
<v-menu v-if="comment.user == userId" bottom left>
<template #activator="{ on, attrs }">
<v-btn
icon
v-bind="attrs"
v-on="on"
>
<v-btn icon v-bind="attrs" v-on="on">
<v-icon>{{ mdiDotsVertical }}</v-icon>
</v-btn>
</template>

<v-list>
<v-list-item>
<v-list-item-title
@click="showEdit=true"
>
Edit
</v-list-item-title>
<v-list-item-title @click="showEdit = true"> Edit </v-list-item-title>
</v-list-item>
<v-list-item>
<v-list-item-title
@click="$emit('delete-comment', comment)"
>
<v-list-item-title @click="$emit('delete-comment', comment)">
Delete
</v-list-item-title>
</v-list-item>
Expand All @@ -59,27 +44,12 @@
<span v-if="!showEdit">
{{ comment.text }}
</span>
<v-form
v-else
v-model="valid"
>
<v-form v-else v-model="valid">
<v-row>
<v-textarea
v-model="editText"
auto-grow
rows="1"
solo
:rules="commentRules"
/>
<v-textarea v-model="editText" auto-grow rows="1" solo :rules="commentRules" />
</v-row>
<v-row justify="end">
<v-btn
text
class="text-capitalize"
@click="cancel"
>
Cancel
</v-btn>
<v-btn text class="text-capitalize" @click="cancel"> Cancel </v-btn>
<v-btn
:disabled="!valid"
color="primary"
Expand Down Expand Up @@ -119,9 +89,7 @@ export default Vue.extend({
return {
showEdit: false,
editText: this.comment.text,
commentRules: [
(v: string) => !!v.trim() || 'Comment is required'
],
commentRules: [(v: string) => !!v.trim() || 'Comment is required'],
valid: false,
mdiAccountCircle,
mdiDotsVertical
Expand All @@ -131,10 +99,10 @@ export default Vue.extend({
methods: {
updateComment(newText: string) {
this.showEdit = false
const comment = {...this.comment, text:newText }
const comment = { ...this.comment, text: newText }
this.$emit('update-comment', comment)
},
cancel() {
this.showEdit = false
this.editText = this.comment.text
Expand Down
10 changes: 6 additions & 4 deletions frontend/components/comment/CommentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:loading-text="$t('generic.loading')"
:no-data-text="$t('vuetify.noDataAvailable')"
:footer-props="{
'showFirstLastPage': true,
showFirstLastPage: true,
'items-per-page-options': [10, 50, 100],
'items-per-page-text': $t('vuetify.itemsPerPageText'),
'page-text': $t('dataset.pageText')
Expand All @@ -20,7 +20,9 @@
@input="$emit('input', $event)"
>
<template #[`item.createdAt`]="{ item }">
<span>{{ item.createdAt | dateParse('YYYY-MM-DDTHH:mm:ss') | dateFormat('DD/MM/YYYY HH:mm') }}</span>
<span>{{
item.createdAt | dateParse('YYYY-MM-DDTHH:mm:ss') | dateFormat('DD/MM/YYYY HH:mm')
}}</span>
</template>
<template #top>
<v-text-field
Expand Down Expand Up @@ -88,7 +90,7 @@ export default Vue.extend({
{ text: this.$t('dataset.text'), value: 'text' },
{ text: this.$t('user.username'), value: 'username' },
{ text: this.$t('comments.created_at'), value: 'createdAt' },
{ text: this.$t('dataset.action'), value: 'action' },
{ text: this.$t('dataset.action'), value: 'action' }
],
mdiMagnify
}
Expand Down Expand Up @@ -117,7 +119,7 @@ export default Vue.extend({
})
this.options.page = 1
}
},
}
// methods: {
// toLabeling(item: CommentReadDTO) {
Expand Down
4 changes: 1 addition & 3 deletions frontend/components/comment/FormCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ import Vue from 'vue'
export default Vue.extend({
data() {
return {
commentRules: [
(v: string) => !!v.trim() || 'Comment is required'
],
commentRules: [(v: string) => !!v.trim() || 'Comment is required'],
message: '',
valid: false
}
Expand Down

0 comments on commit a927bb6

Please sign in to comment.