forked from MapComplete/MapComplete
Performance: split validation into multiple files, avoid using 'fixImages' and 'exractImages' into well-known themes as it takes a big chunk of data
This commit is contained in:
parent
ac853ab021
commit
8c779fe09b
16 changed files with 1009 additions and 949 deletions
28
src/Models/ThemeConfig/Conversion/ValidateThemeAndLayers.ts
Normal file
28
src/Models/ThemeConfig/Conversion/ValidateThemeAndLayers.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import { Bypass, Each, Fuse, On } from "./Conversion"
|
||||
import { LayoutConfigJson } from "../Json/LayoutConfigJson"
|
||||
import Constants from "../../Constants"
|
||||
import { DoesImageExist, ValidateLayerConfig } from "./Validation"
|
||||
import { ValidateTheme } from "./ValidateTheme"
|
||||
|
||||
export class ValidateThemeAndLayers extends Fuse<LayoutConfigJson> {
|
||||
constructor(
|
||||
doesImageExist: DoesImageExist,
|
||||
path: string,
|
||||
isBuiltin: boolean,
|
||||
sharedTagRenderings?: Set<string>,
|
||||
) {
|
||||
super(
|
||||
"Validates a theme and the contained layers",
|
||||
new ValidateTheme(doesImageExist, path, isBuiltin, sharedTagRenderings),
|
||||
new On(
|
||||
"layers",
|
||||
new Each(
|
||||
new Bypass(
|
||||
(layer) => Constants.added_by_default.indexOf(<any>layer.id) < 0,
|
||||
new ValidateLayerConfig(undefined, isBuiltin, doesImageExist, false, true),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue