Versioned Docusaurus site returns 404 for the other languages - docusaurus

I receive the following error message when I want to navigate to a translated page of a versioned Docusaurus site:
Cannot GET /docs/de/...
I followed all the recommendations there are to find on the docs site. Here is what I have.
Crowdin.yaml:
files:
-
source: '/docs/**/*.md'
translation: '/website/translated_docs/%locale%/**/%original_file_name%'
languages_mapping: &anchor
locale:
'de': 'de'
-
source: '/website/i18n/en.json'
translation: '/website/i18n/%locale%.json'
languages_mapping: *anchor
-
source: '/website/versioned_docs/**/*.md'
translation: '/website/translated_docs/%locale%/**/%original_file_name%'
languages_mapping: *anchor
package.json
{
"main": "main.js",
"scripts": {
"examples": "docusaurus-examples",
"start": "docusaurus-start",
"build": "docusaurus-build",
"publish-gh-pages": "docusaurus-publish",
"write-translations": "docusaurus-write-translations",
"version": "docusaurus-version",
"rename-version": "docusaurus-rename-version",
"crowdin-upload": "crowdin --config ../crowdin.yaml upload sources --auto-update -b master",
"crowdin-download": "crowdin --config ../crowdin.yaml download -b master",
"lint": "yarn run markdownlint --config .markdownlint.json ../docs"
},
"devDependencies": {
"docusaurus": "1.13.0",
"markdownlint-cli": "^0.18.0"
}
}
versions.json
[
"2019.6.0",
"2019.5.0"
]
languages.js
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const languages = [
{
enabled: true,
name: "English",
tag: "en"
},
{
enabled: false,
name: "日本語",
tag: "ja"
},
{
enabled: false,
name: "العربية",
tag: "ar"
},
{
enabled: false,
name: "Bosanski",
tag: "bs-BA"
},
{
enabled: false,
name: "Català",
tag: "ca"
},
{
enabled: false,
name: "Čeština",
tag: "cs"
},
{
enabled: false,
name: "Dansk",
tag: "da"
},
{
enabled: true,
name: "Deutsch",
tag: "de"
},
{
enabled: false,
name: "Ελληνικά",
tag: "el"
},
{
enabled: false,
name: "Español",
tag: "es-ES"
},
{
enabled: false,
name: "فارسی",
tag: "fa-IR"
},
{
enabled: false,
name: "Suomi",
tag: "fi"
},
{
enabled: false,
name: "Français",
tag: "fr"
},
{
enabled: false,
name: "עִברִית",
tag: "he"
},
{
enabled: false,
name: "Magyar",
tag: "hu"
},
{
enabled: false,
name: "Bahasa Indonesia",
tag: "id-ID"
},
{
enabled: false,
name: "Italiano",
tag: "it"
},
{
enabled: false,
name: "Afrikaans",
tag: "af"
},
{
enabled: false,
name: "한국어",
tag: "ko"
},
{
enabled: false,
name: "मराठी",
tag: "mr-IN"
},
{
enabled: false,
name: "Nederlands",
tag: "nl"
},
{
enabled: false,
name: "Norsk",
tag: "no-NO"
},
{
enabled: false,
name: "Polskie",
tag: "pl"
},
{
enabled: false,
name: "Português",
tag: "pt-PT"
},
{
enabled: false,
name: "Português (Brasil)",
tag: "pt-BR"
},
{
enabled: false,
name: "Română",
tag: "ro"
},
{
enabled: false,
name: "Русский",
tag: "ru"
},
{
enabled: false,
name: "Slovenský",
tag: "sk-SK"
},
{
enabled: false,
name: "Српски језик (Ћирилица)",
tag: "sr"
},
{
enabled: false,
name: "Svenska",
tag: "sv-SE"
},
{
enabled: false,
name: "Türkçe",
tag: "tr"
},
{
enabled: false,
name: "Українська",
tag: "uk"
},
{
enabled: false,
name: "Tiếng Việt",
tag: "vi"
},
{
enabled: false,
name: "中文",
tag: "zh-CN"
},
{ enabled: false, name: "繁體中文", tag: "zh-TW" }
];
module.exports = languages;
The directory structure:
.
D:\Source\dime-scheduler-docs
.
+---docs
| +---administrator-manual
| | +---administration
| | | +---administration-identity.md
| | | +---administration-roles.md
| | | +---administration-usergroups.md
| | | +---administration-users-generatedcontent.md
| | | \---administration-users.md
| | +---fasttrack
| | +---settings
| | +---troubleshooting
| | +---configuration.md
| +---developer-manual
| +---faq
| +---guides
| +---installation-manual
| +---intro
| +---plugins
| +---user-manual
+---website
| +---blog
| +---core
| +---i18n
| | +---de.json
| | \---en.json
| +---pages
| | +---de
| | | +---index.js
| | | \---versions.js
| | \---en
| | +---index.js
| | \---versions.js
| +---static
| | +---css
| | +---fonts
| | +---img
| | \---js
| +---translated_docs
| | \---de
| | +---user-manual
| | | +---authentication
| | | | +---authentication-intro.md
| | +---version-2019.5.0
| | | +---administrator-manual
| | | | +---administration
| | | | | +---administration-identity.md| |
| | \---version-2019.6.0
| | +---installation-manual
| | | +---backoffice
| | | | \---install-backoffice-service.md
| | | +---dynamics
| | +---plugins
| | \---user-manual
| +---versioned_docs
| | +---version-2019.5.0
| | +---version-2019.6.0
| +---versioned_sidebars
| | \---version-2019.5.0-sidebars.json
| +---.markdownlint.json
| +---languages.js
| +---main.js
| +---package.json
| +---sidebars.json
| +---siteConfig.js
| +---versions.json
| \---yarn.lock
+---.dockerignore
+---.gitignore
+---azure-pipelines.yml
+---crowdin.yaml
+---docker-compose.yml
+---Dockerfile
+---README.md
+---tree.txt
\---yarn.lock
After running the commands yarn crowdin-upload and yarn crowdin-download, the translated_docs folder is populated. Inside the de subfolder, there are the folders of the docs, including another subdirectory for the version version-2019.6.0.
When I run yarn start and switch the language to the other language, the top menu is translated. However, when I navigate to http://localhost:3000/docs/de/user-manual/user-intro, I get a blank page with the error message "Cannot GET/...".
When I remove the versions.json and versions.js from the project, everything works perfectly. Furthermore, if I keep the versioning and navivate to the 'next' version, it's also working fine.
So the issue must be located somewhere in this area. As far as I know, there is no way of debugging or diagnosing the exact problem. Which is why I would like to hear who else has had this problem?

Related

How to Customize GROUP_CONCAT Separator in Sequelize?

Assuming I have this seqeulize code bellow
groupAccess.findAll({
attributes: [
'id',
'group_name',
'description',
[sequelize.fn('GROUP_CONCAT', sequelize.col('module_name')), 'module_name']
],
group: ['group_name']
})
The result of it's query will be like
id | group_name | description | module_name
----+--------------+---------------+---------------------------
1 | A | desc A | mod_1,mod_2,mod_3
4 | B | desc B | mod_4,mod_5,mod_6,mod_7
8 | C | desc C | mod_8,mod_9,mod_10
11 | D | desc D | mod_11,mod_12
and sequelize.js res will be like:
[
{
id: "1",
group_name: "A",
description: "desc A",
module_name: "mod_1,mod_2,mod_3"
},
{
id: "4",
group_name: "B",
description: "desc B",
module_name: "mod_4,mod_5,mod_6,mod_7"
},
{
id: "8",
group_name: "C",
description: "desc C",
module_name: "mod_8,mod_9,mod_10"
},
{
id: "11",
group_name: "D",
description: "desc D",
module_name: "mod_11,mod_12"
},
]
Problem: How to change the commas (separators) to another symbol as the separator (in e.g: dash-arrow -> symbol as the separator) IN SEQUELIZE?
Expected query:
id | group_name | description | module_name
----+--------------+---------------+---------------------------
1 | A | desc A | mod_1->mod_2->mod_3
4 | B | desc B | mod_4->mod_5->mod_6->mod_7
8 | C | desc C | mod_8->mod_9->mod_10
11 | D | desc D | mod_11->mod_12
Expected res of sequelize.js:
[
{
id: "1",
group_name: "A",
description: "desc A",
module_name: "mod_1->mod_2->mod_3"
},
{
id: "4",
group_name: "B",
description: "desc B",
module_name: "mod_4->mod_5->mod_6->mod_7"
},
{
id: "8",
group_name: "C",
description: "desc C",
module_name: "mod_8->mod_9->mod_10"
},
{
id: "11",
group_name: "D",
description: "desc D",
module_name: "mod_11->mod_12"
},
]
Found this on GitHub (https://github.com/sequelize/sequelize/issues/3390#issuecomment-84649641); not 100% sure if this works (since I'm not familiar with sequelize), but you can try:
groupAccess.findAll({
attributes: [
'id',
'group_name',
'description',
[sequelize.fn('GROUP_CONCAT', sequelize.literal(`module_name SEPARATOR '->'`)), 'module_name']
],
group: ['group_name']
})

Template Request Scenario Outline empty secondary array object causes invalid JSON to form

I am trying to formulate a template request which can be used via a scenario outline which will be used to test the API without the need for many payloads to be constructed & maintained.
But I've struck a problem when an array is included in the request which contains different optional blocks - that if left empty cause an invalid JSON to be formed and sent.
How can I have an array set correctly (disclude the ",{}" when there is the absence of values from in the scenario outline?
Background:
* def template_request = read('./request/request.json')
Scenario Outline: blah
* def request_payload = karate.filterKeys(template_request, <request_filter>)
Given request request_payload
When method post
Examples:
|denominationType1 |amount1|denominationType2 |amount2 |request_filter |
|NOTE |10 | | | 'depositDetail' |
|NOTE |10 |COINS |20 | 'depositDetail' |
The request sent from the first row of tbl (which has empty value for denomination type 2 (COINS) is: **See below the second array object which is still set (albeit with no values - which is as per tbl) -> the comma and curly braces , {} which is setting the second array is causing the problem
{
"depositDetail": {
"denomination": [
{
"amount": "10",
"denominationType": "NOTE"
},
{
}
]
}
The request for the second row is fine
{
"depositDetail": {
"denomination": [
{
"amount": "10",
"denominationType": "NOTE"
},
{
"amount": "20",
"denominationType": "COINS"
}
]
}
requestTemplate.json
{
"depositDetail": {
"denomination": [
{
"denominationType": ##(denominationType1),
"count": ##(count),
"amount": ##(amount1)
},
{
"denominationType": ##(denominationType2),
"amount": ##(amount2)
}
]
}
}
I am having no luck with filters or functions - could you please help me.
You still haven't provided the template. Anyway, this is how I would do it. You can try it and see it work.
Scenario Outline:
* def payload = { denomination: [] }
* if (type1) payload.denomination.push({ type: type1, amount: amount1 })
* if (type2) payload.denomination.push({ type: type2, amount: amount2 })
* url 'https://httpbin.org/anything'
* request payload
* method post
Examples:
| type1 | amount1 | type2 | amount2 |
| NOTE | 10 | | |
| NOTE | 10 | COIN | 20 |
But even the above is not elegant in my opinion. I recommend you don't overcomplicate your tests and just do something like this:
Scenario Outline:
* def payload = {}
* payload[key] = items
* url 'https://httpbin.org/anything'
* request payload
* method post
Examples:
| key | items! |
| foo | [{ type: 'NOTE', amount: 10 }] |
| bar | [{ type: 'NOTE', amount: 10 }, { type: 'COIN', amount: 20 }] |

MongoDB Aggregating counts with different conditions at once

I'm totally new to MongoDB.
I wonder if it is possible to aggregate counts with different conditions at once.
Such as, there is a collection like below.
_id | no | val |
--------------------
1 | 1 | a |
--------------------
2 | 2 | a |
--------------------
3 | 3 | b |
--------------------
4 | 4 | c |
--------------------
And I want result like below.
Value a : 2
Value b : 1
Value c : 1
How can I get this result all at once?
Thank you:)
db.collection.aggregate([
{
"$match": {}
},
{
"$group": {
"_id": "$val",
"count": { "$sum": 1 }
}
},
{
"$project": {
"field": {
"$arrayToObject": [
[ { k: { "$concat": [ "Value ", "$_id" ] }, v: "$count" } ]
]
}
}
},
{
"$replaceWith": "$field"
}
])
mongoplayground

How to setup properties on CSV import in OrientDB?

I have a CSV file like:
FN | MI | LN | ADDR | CITY | ZIP | GENDER
------------------------------------------------------------------------------
Patricia | | Faddar | 7063 Carr xxx | Carolina | 00979-7033 | F
------------------------------------------------------------------------------
Lui | E | Baves | PO Box xxx | Boqueron | 00622-1240 | F
------------------------------------------------------------------------------
Janine | S | Perez | 25 Calle xxx | Salinas | 00751-3332 | F
------------------------------------------------------------------------------
Rose | | Mary | 229 Calle xxx | Aguadilla | 00603-5536 | F
And I am importing it into OrientDB like:
{
"source": { "file": { "path": "/sample.csv" } },
"extractor": { "csv": {} },
"transformers": [
{ "vertex": { "class": "Users" } }
],
"loader": {
"orientdb": {
"dbURL": "plocal:/orientdb/databases/test",
"dbType": "graph",
"classes": [
{"name": "Users", "extends": "V"}
]
}
}
}
I would like to set the import so that it created properties so that FN becomes first_name, MI becomes middle_name and so on, as well as set some values to lowercase. For ex: Carolina to become carolina
I could probably make this changes from the SCHEMA once the data is added. My reason to do this here is that I have multiple CSV files and I want to keep the the same schema for all
Any ideas?
To rename a field, take a look at the Field transformer:
http://orientdb.com/docs/last/Transformer.html#field-transformer
Rename the field from salary to renumeration:
{ "field":
{ "fieldName": "remuneration",
"expression": "salary"
}
},
{ "field":
{ "fieldName": "salary",
"operation": "remove"
}
}
in the same way, you can apply the lowerCase function to the property
{field: {fieldName:'name', expression: '$input.name.toLowerCase()'}}
Try it and let me know if it works.

MongoDB Aggregation SQL Union and SQL Exists like clause

I would like to make a MongoDB aggregation Query on data like this :
Collection A
{
_id : 1,
Active : true,
hasQuery : false,
Running : false,
}
{
_id : 2,
Active : true,
hasQuery : true,
Running : false,
}
{
_id : 3,
Active : true,
hasQuery : false,
Running : true,
}
{
_id : 4,
Active : true,
hasQuery : true,
Running : true,
}
{
_id : 5,
Active : false,
hasQuery : false,
Running : false,
}
{
_id : 6,
Active : false,
hasQuery : false,
Running : true,
}
This JSON data could be represented by a table architechture like this
Table A
PrimaryKey | Active | hasQuery | Running
1 | true | false | false
2 | true | true | false
3 | true | false | true
4 | true | true | true
5 | false | false | false
6 | false | false | true
If I apply the following query on the table :
select * from A where Exists(Select * from A where A.Running=true and A.hasQuery=true) and A.Running=false and A.hasQuery=false and A.Active=true
union
select * from A where not Exists(Select * from A where A.Running=true and A.hasQuery=true) and A.Running=false and A.Active=true
I get theses results :
In MongoDB :
{
_id : 1,
Active : true,
hasQuery : false,
Running : false,
}
{
_id : 2,
Active : true,
hasQuery : true,
Running : false,
}
{
_id : 5,
Active : false,
hasQuery : false,
Running : false,
}
in SQL :
PrimaryKey | Active | hasQuery | Running
1 | true | false | false
2 | true | true | false
5 | false | false | false
How to do the same thing with mongoDB aggregation ?
I managed to do it with that code :
db.test.aggregate(
{
$project:
{
RunningActiveRecordHasQuery:
{
$cond: { if: { $and: [ "$Running", "$hasQuery", "$Active"] }, then: true, else: false }
}
}
}
,
{
$match: {
RunningActiveRecordHasQuery : true
}
},
function (err, results) {
if (!err ) {
console.log (results.result);
match={}
if (results.length>0) {
match.AnyNotRunningActiveRecordHavingNoQuery=true;
} else {
match.AnyActiveRecordNotRunning=true;
}
db.test.aggregate(
{
$project:
{
_id: 1,
Running : 1,
Active : 1,
hasQuery : 1,
AnyNotRunningActiveRecordHavingNoQuery:
{
$cond: { if: { $and: [ {$eq: [ "$Running", false ] }, {$eq : [ "$hasQuery", false]}, "$Active"] }, then: true, else: false }
},
AnyActiveRecordNotRunning:
{
$cond: { if: { $and: [ {$eq: [ "$Running", false ] }, "$Active"] }, then: true, else: false }
}
}
}
,
{
$match: match
},
function (err, docs) {
}
)
}
}
)
It uses to aggregation to make things working.