mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +00:00
remove Account View Style settings
This commit is contained in:
parent
91a6dcc9f6
commit
fe13e4dd66
1 changed files with 57 additions and 32 deletions
|
@ -2,41 +2,67 @@
|
||||||
|
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
def add_default_settings(apps, schema_editor):
|
def add_default_settings(apps, schema_editor):
|
||||||
|
|
||||||
setting = apps.get_model("appsettings", "AppSettings")
|
setting = apps.get_model("appsettings", "AppSettings")
|
||||||
db_alias = schema_editor.connection.alias
|
db_alias = schema_editor.connection.alias
|
||||||
setting.objects.using(db_alias).bulk_create([
|
setting.objects.using(db_alias).bulk_create([
|
||||||
setting(1, "Theme", "BOOTSTRAP_THEME", "flaty", "", "Bootstrap CSS & Bootswatch Theme"),
|
setting(1, "Theme", "BOOTSTRAP_THEME", "flaty",
|
||||||
setting(2, "Theme SASS Path", "SASS_DIR", "dev/scss/", "", "Bootstrap SASS & Bootswatch SASS Directory"),
|
"", "Bootstrap CSS & Bootswatch Theme"),
|
||||||
setting(3, "All Instances View Style", "VIEW_INSTANCES_LIST_STYLE", "grouped", "grouped,nongrouped", "All instances list style"),
|
setting(2, "Theme SASS Path", "SASS_DIR", "dev/scss/",
|
||||||
setting(4, "Account View Style", "VIEW_ACCOUNTS_STYLE", "grid", "grid,list", "User accounts view style"),
|
"", "Bootstrap SASS & Bootswatch SASS Directory"),
|
||||||
setting(5, "Logs per Page", "LOGS_PER_PAGE", "100", "", "Pagination for logs"),
|
setting(3, "All Instances View Style", "VIEW_INSTANCES_LIST_STYLE",
|
||||||
setting(6, "Multiple Owner for VM ", "ALLOW_INSTANCE_MULTIPLE_OWNER", "True", "True,False", "Allow to have multiple owner for instance"),
|
"grouped", "grouped,nongrouped", "All instances list style"),
|
||||||
setting(7, "Quota Debug", "QUOTA_DEBUG", "True", "True,False", "Debug for user quotas"),
|
setting(4, "Logs per Page", "LOGS_PER_PAGE",
|
||||||
setting(8, "Disk Format", "INSTANCE_VOLUME_DEFAULT_FORMAT", "qcow2", "raw,qcow,qcow2", "Instance disk format"),
|
"100", "", "Pagination for logs"),
|
||||||
setting(9, "Disk Bus", "INSTANCE_VOLUME_DEFAULT_BUS", "virtio", "virtio,scsi,ide,usb,sata", "Instance disk bus type"),
|
setting(5, "Multiple Owner for VM ", "ALLOW_INSTANCE_MULTIPLE_OWNER",
|
||||||
setting(10, "Disk SCSI Controller", "INSTANCE_VOLUME_DEFAULT_SCSI_CONTROLLER", "virtio-scsi", "virtio-scsi, lsilogic, virtio-blk", "SCSI controller type"),
|
"True", "True,False", "Allow to have multiple owner for instance"),
|
||||||
setting(11, "Disk Cache", "INSTANCE_VOLUME_DEFAULT_CACHE", "directsync", "default,directsync,none,unsafe,writeback,writethrough", "Disk volume cache type"),
|
setting(6, "Quota Debug", "QUOTA_DEBUG", "True",
|
||||||
setting(12, "Disk IO Type", "INSTANCE_VOLUME_DEFAULT_IO", "default", "default,native,threads", "Volume io modes"),
|
"True,False", "Debug for user quotas"),
|
||||||
setting(13, "Disk Detect Zeroes", "INSTANCE_VOLUME_DEFAULT_DETECT_ZEROES", "default", "default,on,off,unmap", "Volume detect zeroes mode"),
|
setting(7, "Disk Format", "INSTANCE_VOLUME_DEFAULT_FORMAT",
|
||||||
setting(14, "Disk Discard", "INSTANCE_VOLUME_DEFAULT_DISCARD", "default", "default,unmap,ignore", "Volume discard mode"),
|
"qcow2", "raw,qcow,qcow2", "Instance disk format"),
|
||||||
setting(15, "Disk Owner UID", "INSTANCE_VOLUME_DEFAULT_OWNER_UID", "0", "", "Owner UID: up to os, 0=root, 107=qemu or libvirt-bin(for ubuntu)"),
|
setting(8, "Disk Bus", "INSTANCE_VOLUME_DEFAULT_BUS", "virtio",
|
||||||
setting(16, "Disk Owner GID", "INSTANCE_VOLUME_DEFAULT_OWNER_GID", "0", "", "Owner GID: up to os, 0=root, 107=qemu or libvirt-bin(for ubuntu)"),
|
"virtio,scsi,ide,usb,sata", "Instance disk bus type"),
|
||||||
setting(17, "VM CPU Mode", "INSTANCE_CPU_DEFAULT_MODE", "host-model", "no-model,host-model,host-passthrough,custom", "Cpu modes"),
|
setting(9, "Disk SCSI Controller", "INSTANCE_VOLUME_DEFAULT_SCSI_CONTROLLER",
|
||||||
setting(18, "VM Machine Type", "INSTANCE_MACHINE_DEFAULT_TYPE", "q35", "q35,x86_64", "Chipset/Machine type"),
|
"virtio-scsi", "virtio-scsi, lsilogic, virtio-blk", "SCSI controller type"),
|
||||||
setting(19, "VM Firmware Type", "INSTANCE_FIRMWARE_DEFAULT_TYPE", "BIOS", "BIOS,UEFI", "Firmware type for x86_64"),
|
setting(10, "Disk Cache", "INSTANCE_VOLUME_DEFAULT_CACHE", "directsync",
|
||||||
setting(20, "VM Architecture Type", "INSTANCE_ARCH_DEFAULT_TYPE", "x86_64", "x86_64,i686", "Architecture type: x86_64, i686, etc"),
|
"default,directsync,none,unsafe,writeback,writethrough", "Disk volume cache type"),
|
||||||
setting(21, "VM Console Type", "QEMU_CONSOLE_DEFAULT_TYPE", "vnc", "vnc,spice", "Default console type"),
|
setting(11, "Disk IO Type", "INSTANCE_VOLUME_DEFAULT_IO",
|
||||||
setting(22, "VM Clone Name Prefix", "CLONE_INSTANCE_DEFAULT_PREFIX", "instance", "True,False", "Prefix for cloned instance name"),
|
"default", "default,native,threads", "Volume io modes"),
|
||||||
setting(23, "VM Clone Auto Name", "CLONE_INSTANCE_AUTO_NAME", "False", "True,False", "Generated name for cloned instance"),
|
setting(12, "Disk Detect Zeroes", "INSTANCE_VOLUME_DEFAULT_DETECT_ZEROES",
|
||||||
setting(24, "VM Clone Auto Migrate", "CLONE_INSTANCE_AUTO_MIGRATE", "False", "True,False", "Auto migrate instance after clone"),
|
"default", "default,on,off,unmap", "Volume detect zeroes mode"),
|
||||||
setting(25, "VM Bottom Bar", "VIEW_INSTANCE_DETAIL_BOTTOM_BAR", "True", "True,False", "Bottom navbar for instance details"),
|
setting(13, "Disk Discard", "INSTANCE_VOLUME_DEFAULT_DISCARD",
|
||||||
setting(26, "Show Access Root Pass", "SHOW_ACCESS_ROOT_PASSWORD", "False", "True,False", "Show access root password"),
|
"default", "default,unmap,ignore", "Volume discard mode"),
|
||||||
setting(27, "Show Access SSH Keys", "SHOW_ACCESS_SSH_KEYS", "False", "True,False", "Show access ssh keys"),
|
setting(14, "Disk Owner UID", "INSTANCE_VOLUME_DEFAULT_OWNER_UID", "0",
|
||||||
setting(28, "Show Profile Edit Pass", "SHOW_PROFILE_EDIT_PASSWORD", "False", "True,False", "Show profile edit password"),
|
"", "Owner UID: up to os, 0=root, 107=qemu or libvirt-bin(for ubuntu)"),
|
||||||
|
setting(15, "Disk Owner GID", "INSTANCE_VOLUME_DEFAULT_OWNER_GID", "0",
|
||||||
|
"", "Owner GID: up to os, 0=root, 107=qemu or libvirt-bin(for ubuntu)"),
|
||||||
|
setting(16, "VM CPU Mode", "INSTANCE_CPU_DEFAULT_MODE", "host-model",
|
||||||
|
"no-model,host-model,host-passthrough,custom", "Cpu modes"),
|
||||||
|
setting(17, "VM Machine Type", "INSTANCE_MACHINE_DEFAULT_TYPE",
|
||||||
|
"q35", "q35,x86_64", "Chipset/Machine type"),
|
||||||
|
setting(18, "VM Firmware Type", "INSTANCE_FIRMWARE_DEFAULT_TYPE",
|
||||||
|
"BIOS", "BIOS,UEFI", "Firmware type for x86_64"),
|
||||||
|
setting(19, "VM Architecture Type", "INSTANCE_ARCH_DEFAULT_TYPE",
|
||||||
|
"x86_64", "x86_64,i686", "Architecture type: x86_64, i686, etc"),
|
||||||
|
setting(20, "VM Console Type", "QEMU_CONSOLE_DEFAULT_TYPE",
|
||||||
|
"vnc", "vnc,spice", "Default console type"),
|
||||||
|
setting(21, "VM Clone Name Prefix", "CLONE_INSTANCE_DEFAULT_PREFIX",
|
||||||
|
"instance", "True,False", "Prefix for cloned instance name"),
|
||||||
|
setting(22, "VM Clone Auto Name", "CLONE_INSTANCE_AUTO_NAME",
|
||||||
|
"False", "True,False", "Generated name for cloned instance"),
|
||||||
|
setting(23, "VM Clone Auto Migrate", "CLONE_INSTANCE_AUTO_MIGRATE",
|
||||||
|
"False", "True,False", "Auto migrate instance after clone"),
|
||||||
|
setting(24, "VM Bottom Bar", "VIEW_INSTANCE_DETAIL_BOTTOM_BAR",
|
||||||
|
"True", "True,False", "Bottom navbar for instance details"),
|
||||||
|
setting(25, "Show Access Root Pass", "SHOW_ACCESS_ROOT_PASSWORD",
|
||||||
|
"False", "True,False", "Show access root password"),
|
||||||
|
setting(26, "Show Access SSH Keys", "SHOW_ACCESS_SSH_KEYS",
|
||||||
|
"False", "True,False", "Show access ssh keys"),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
def del_default_settings(apps, schema_editor):
|
def del_default_settings(apps, schema_editor):
|
||||||
setting = apps.get_model("appsettings", "AppSettings")
|
setting = apps.get_model("appsettings", "AppSettings")
|
||||||
db_alias = schema_editor.connection.alias
|
db_alias = schema_editor.connection.alias
|
||||||
|
@ -47,7 +73,6 @@ def del_default_settings(apps, schema_editor):
|
||||||
setting.objects.using(db_alias).filter(key="CLONE_INSTANCE_AUTO_MIGRATE").delete()
|
setting.objects.using(db_alias).filter(key="CLONE_INSTANCE_AUTO_MIGRATE").delete()
|
||||||
setting.objects.using(db_alias).filter(key="LOGS_PER_PAGE").delete()
|
setting.objects.using(db_alias).filter(key="LOGS_PER_PAGE").delete()
|
||||||
setting.objects.using(db_alias).filter(key="QUOTA_DEBUG").delete()
|
setting.objects.using(db_alias).filter(key="QUOTA_DEBUG").delete()
|
||||||
setting.objects.using(db_alias).filter(key="VIEW_ACCOUNTS_STYLE").delete()
|
|
||||||
setting.objects.using(db_alias).filter(key="VIEW_INSTANCES_LIST_STYLE").delete()
|
setting.objects.using(db_alias).filter(key="VIEW_INSTANCES_LIST_STYLE").delete()
|
||||||
setting.objects.using(db_alias).filter(key="VIEW_INSTANCE_DETAIL_BOTTOM_BAR").delete()
|
setting.objects.using(db_alias).filter(key="VIEW_INSTANCE_DETAIL_BOTTOM_BAR").delete()
|
||||||
setting.objects.using(db_alias).filter(key="INSTANCE_VOLUME_DEFAULT_FORMAT").delete()
|
setting.objects.using(db_alias).filter(key="INSTANCE_VOLUME_DEFAULT_FORMAT").delete()
|
||||||
|
@ -67,7 +92,7 @@ def del_default_settings(apps, schema_editor):
|
||||||
setting.objects.using(db_alias).filter(key="SASS_DIR").delete()
|
setting.objects.using(db_alias).filter(key="SASS_DIR").delete()
|
||||||
setting.objects.using(db_alias).filter(key="SHOW_ACCESS_ROOT_PASSWORD").delete()
|
setting.objects.using(db_alias).filter(key="SHOW_ACCESS_ROOT_PASSWORD").delete()
|
||||||
setting.objects.using(db_alias).filter(key="SHOW_ACCESS_SSH_KEYS").delete()
|
setting.objects.using(db_alias).filter(key="SHOW_ACCESS_SSH_KEYS").delete()
|
||||||
setting.objects.using(db_alias).filter(key="SHOW_PROFILE_EDIT_PASSWORD").delete()
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
@ -77,4 +102,4 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RunPython(add_default_settings, del_default_settings),
|
migrations.RunPython(add_default_settings, del_default_settings),
|
||||||
]
|
]
|
Loading…
Reference in a new issue