forked from MapComplete/MapComplete
Reformat all files with prettier
This commit is contained in:
parent
e22d189376
commit
b541d3eab4
382 changed files with 50893 additions and 35566 deletions
|
@ -1,42 +1,43 @@
|
|||
import {Translation, TypedTranslation} from "../../UI/i18n/Translation";
|
||||
import {TagsFilter} from "../../Logic/Tags/TagsFilter";
|
||||
import {DeleteConfigJson} from "./Json/DeleteConfigJson";
|
||||
import Translations from "../../UI/i18n/Translations";
|
||||
import {TagUtils} from "../../Logic/Tags/TagUtils";
|
||||
import { Translation, TypedTranslation } from "../../UI/i18n/Translation"
|
||||
import { TagsFilter } from "../../Logic/Tags/TagsFilter"
|
||||
import { DeleteConfigJson } from "./Json/DeleteConfigJson"
|
||||
import Translations from "../../UI/i18n/Translations"
|
||||
import { TagUtils } from "../../Logic/Tags/TagUtils"
|
||||
|
||||
export default class DeleteConfig {
|
||||
public static readonly defaultDeleteReasons : {changesetMessage: string, explanation: Translation} [] = [
|
||||
public static readonly defaultDeleteReasons: {
|
||||
changesetMessage: string
|
||||
explanation: Translation
|
||||
}[] = [
|
||||
{
|
||||
changesetMessage: "testing point",
|
||||
explanation: Translations.t.delete.reasons.test
|
||||
explanation: Translations.t.delete.reasons.test,
|
||||
},
|
||||
{
|
||||
changesetMessage:"disused",
|
||||
explanation: Translations.t.delete.reasons.disused
|
||||
changesetMessage: "disused",
|
||||
explanation: Translations.t.delete.reasons.disused,
|
||||
},
|
||||
{
|
||||
changesetMessage: "not found",
|
||||
explanation: Translations.t.delete.reasons.notFound
|
||||
explanation: Translations.t.delete.reasons.notFound,
|
||||
},
|
||||
{
|
||||
changesetMessage: "duplicate",
|
||||
explanation:Translations.t.delete.reasons.duplicate
|
||||
}
|
||||
explanation: Translations.t.delete.reasons.duplicate,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
public readonly extraDeleteReasons?: {
|
||||
explanation: TypedTranslation<object>,
|
||||
explanation: TypedTranslation<object>
|
||||
changesetMessage: string
|
||||
}[]
|
||||
|
||||
public readonly nonDeleteMappings?: { if: TagsFilter, then: TypedTranslation<object> }[]
|
||||
public readonly nonDeleteMappings?: { if: TagsFilter; then: TypedTranslation<object> }[]
|
||||
|
||||
public readonly softDeletionTags?: TagsFilter
|
||||
public readonly neededChangesets?: number
|
||||
|
||||
constructor(json: DeleteConfigJson, context: string) {
|
||||
|
||||
this.extraDeleteReasons = (json.extraDeleteReasons ?? []).map((reason, i) => {
|
||||
const ctx = `${context}.extraDeleteReasons[${i}]`
|
||||
if ((reason.changesetMessage ?? "").length <= 5) {
|
||||
|
@ -44,21 +45,23 @@ export default class DeleteConfig {
|
|||
}
|
||||
return {
|
||||
explanation: Translations.T(reason.explanation, ctx + ".explanation"),
|
||||
changesetMessage: reason.changesetMessage
|
||||
changesetMessage: reason.changesetMessage,
|
||||
}
|
||||
})
|
||||
this.nonDeleteMappings = (json.nonDeleteMappings??[]).map((nonDelete, i) => {
|
||||
this.nonDeleteMappings = (json.nonDeleteMappings ?? []).map((nonDelete, i) => {
|
||||
const ctx = `${context}.extraDeleteReasons[${i}]`
|
||||
return {
|
||||
if: TagUtils.Tag(nonDelete.if, ctx + ".if"),
|
||||
then: Translations.T(nonDelete.then, ctx + ".then")
|
||||
then: Translations.T(nonDelete.then, ctx + ".then"),
|
||||
}
|
||||
})
|
||||
|
||||
this.softDeletionTags = undefined;
|
||||
this.softDeletionTags = undefined
|
||||
if (json.softDeletionTags !== undefined) {
|
||||
this.softDeletionTags = TagUtils.Tag(json.softDeletionTags, `${context}.softDeletionTags`)
|
||||
|
||||
this.softDeletionTags = TagUtils.Tag(
|
||||
json.softDeletionTags,
|
||||
`${context}.softDeletionTags`
|
||||
)
|
||||
}
|
||||
|
||||
if (json["hardDeletionTags"] !== undefined) {
|
||||
|
@ -66,6 +69,4 @@ export default class DeleteConfig {
|
|||
}
|
||||
this.neededChangesets = json.neededChangesets
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue