|
|
@@ -12,29 +12,26 @@ You should have received a copy of the GNU Affero General Public License
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*/
|
|
|
|
|
|
-import type { InstanceScript } from '@src/@types/Instance'
|
|
|
import type { Field } from '@src/@types/Field'
|
|
|
-import type { OptionValues, StorageMap } from '@src/@types/Endpoint'
|
|
|
+import type { OptionValues } from '@src/@types/Endpoint'
|
|
|
import type { SchemaProperties, SchemaDefinitions } from '@src/@types/Schema'
|
|
|
-import type { NetworkMap } from '@src/@types/Network'
|
|
|
-import { UserScriptData } from '@src/@types/MainItem'
|
|
|
-import DefaultOptionsSchemaPlugin, {
|
|
|
+import OptionsSchemaPluginBase, {
|
|
|
defaultFillMigrationImageMapValues,
|
|
|
defaultFillFieldValues,
|
|
|
defaultGetDestinationEnv,
|
|
|
defaultGetMigrationImageMap,
|
|
|
} from '../default/OptionsSchemaPlugin'
|
|
|
|
|
|
-export default class OptionsSchemaParser {
|
|
|
- static migrationImageMapFieldName = 'migr_template_map'
|
|
|
+export default class OptionsSchemaParser extends OptionsSchemaPluginBase {
|
|
|
+ override migrationImageMapFieldName = 'migr_template_map'
|
|
|
|
|
|
- static parseSchemaToFields(opts: {
|
|
|
+ override parseSchemaToFields(opts: {
|
|
|
schema: SchemaProperties,
|
|
|
schemaDefinitions?: SchemaDefinitions | null | undefined,
|
|
|
dictionaryKey?: string,
|
|
|
requiresWindowsImage?: boolean,
|
|
|
}) {
|
|
|
- const fields: Field[] = DefaultOptionsSchemaPlugin.parseSchemaToFields(opts)
|
|
|
+ const fields: Field[] = super.parseSchemaToFields(opts)
|
|
|
const makeRequired = (fieldName: string) => {
|
|
|
const field = fields.find(f => f.name === fieldName)
|
|
|
if (field) {
|
|
|
@@ -99,18 +96,14 @@ export default class OptionsSchemaParser {
|
|
|
return fields
|
|
|
}
|
|
|
|
|
|
- static sortFields(fields: Field[]) {
|
|
|
- DefaultOptionsSchemaPlugin.sortFields(fields)
|
|
|
- }
|
|
|
-
|
|
|
- static fillFieldValues(opts: { field: Field, options: OptionValues[], requiresWindowsImage: boolean }) {
|
|
|
+ override fillFieldValues(opts: { field: Field, options: OptionValues[], requiresWindowsImage: boolean }) {
|
|
|
const { field, options, requiresWindowsImage } = opts
|
|
|
|
|
|
if (field.name === 'use_coriolis_exporter') {
|
|
|
field.subFields?.forEach(sf => {
|
|
|
if (sf.properties) {
|
|
|
sf.properties.forEach(f => {
|
|
|
- DefaultOptionsSchemaPlugin.fillFieldValues({
|
|
|
+ super.fillFieldValues({
|
|
|
field: f, options, customFieldName: f.name.split('/')[1], requiresWindowsImage,
|
|
|
})
|
|
|
if (f.name === 'export_template' && f.enum) {
|
|
|
@@ -141,7 +134,7 @@ export default class OptionsSchemaParser {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- static getDestinationEnv(options: { [prop: string]: any } | null, oldOptions?: any) {
|
|
|
+ override getDestinationEnv(options: { [prop: string]: any } | null, oldOptions?: any) {
|
|
|
let newOptions: any = { ...options }
|
|
|
if (newOptions.use_coriolis_exporter != null) {
|
|
|
newOptions = { use_coriolis_exporter: newOptions.use_coriolis_exporter }
|
|
|
@@ -159,25 +152,4 @@ export default class OptionsSchemaParser {
|
|
|
}
|
|
|
return env
|
|
|
}
|
|
|
-
|
|
|
- static getNetworkMap(networkMappings: NetworkMap[] | null | undefined) {
|
|
|
- return DefaultOptionsSchemaPlugin.getNetworkMap(networkMappings)
|
|
|
- }
|
|
|
-
|
|
|
- static getStorageMap(
|
|
|
- defaultStorage: { value: string | null, busType?: string | null },
|
|
|
- storageMap: StorageMap[] | null,
|
|
|
- configDefault?: string | null,
|
|
|
- ) {
|
|
|
- return DefaultOptionsSchemaPlugin.getStorageMap(defaultStorage, storageMap, configDefault)
|
|
|
- }
|
|
|
-
|
|
|
- static getUserScripts(
|
|
|
- uploadedUserScripts: InstanceScript[],
|
|
|
- removedUserScripts: InstanceScript[],
|
|
|
- userScriptData: UserScriptData | null | undefined,
|
|
|
- ) {
|
|
|
- return DefaultOptionsSchemaPlugin
|
|
|
- .getUserScripts(uploadedUserScripts, removedUserScripts, userScriptData)
|
|
|
- }
|
|
|
}
|