Add custom fields + warranty plugin, rework settings into two-pane shell
Feature work from the 2026-07 session: Settings IA - Replace the flat 27-card settings hub with a persistent two-pane shell (SettingsLayout.vue): grouped, searchable left rail + content pane. - Nest all settings/* routes under the shell via router post-processing; shared nav catalog in settingsNav.js. Group by asset class (PCs, Printers, Equipment, Network) so per-type settings stop scattering. Custom fields (core) - customfields + customfieldvalues tables (migration 7d14), CRUD API at /api/customfields, per-asset value get/save. - Settings management page + reusable CustomFieldsSection (detail) and CustomFieldsInputs (form) wired into all four asset types. Warranty (new plugin) - plugins/warranty: warranties + warrantyassets (migration 7d15), derived coverage status, provider abstraction (manual now; Dell/Lenovo/HP stubs). - API CRUD + per-asset panel + report buckets; WarrantyPanel on all four detail pages; Warranties management page; Warranty report + Reports card. - Seed warranty.* permissions. Printer drivers - printerdrivers table (migration 7d13) linked to printer models; drivers now surface on the matching printer's detail page. Other - PCDetail rebalanced (Network + Status + Warranty + custom fields on the right). - Rename PCs list "Features" column to "Remote Access"; fix badge hover underline. - Drop equipment islocationonly field. - Centralize asset-type label/route maps into utils/assetTypes.js. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
76
migrations/versions/7d05_pc_access_protocols.py
Normal file
76
migrations/versions/7d05_pc_access_protocols.py
Normal file
@@ -0,0 +1,76 @@
|
||||
"""PC access protocols: catalog + per-PC links, retire isvnc/iswinrm
|
||||
|
||||
Adds an admin-managed protocol catalog (accessprotocols) and a per-PC link
|
||||
table (computeraccess). Seeds VNC/WinRM/RDP, migrates each PC's isvnc/iswinrm
|
||||
into computeraccess rows, then drops the two boolean columns.
|
||||
|
||||
Revision ID: 7d05_pc_access_protocols
|
||||
Revises: 7d04_notificationtype_display
|
||||
Create Date: 2026-07-08
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = '7d05_pc_access_protocols'
|
||||
down_revision = '7d04_notificationtype_display'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'accessprotocols',
|
||||
sa.Column('protocolid', sa.Integer(), primary_key=True),
|
||||
sa.Column('name', sa.String(length=50), nullable=False),
|
||||
sa.Column('scheme', sa.String(length=20), nullable=False),
|
||||
sa.Column('defaultport', sa.Integer(), nullable=True),
|
||||
sa.Column('linktemplate', sa.String(length=255), nullable=False),
|
||||
sa.Column('isactive', sa.Boolean(), nullable=False, server_default='1'),
|
||||
sa.UniqueConstraint('name', name='uq_accessprotocol_name'),
|
||||
)
|
||||
op.create_table(
|
||||
'computeraccess',
|
||||
sa.Column('id', sa.Integer(), primary_key=True),
|
||||
sa.Column('computerid', sa.Integer(), nullable=False),
|
||||
sa.Column('protocolid', sa.Integer(), nullable=False),
|
||||
sa.Column('portoverride', sa.Integer(), nullable=True),
|
||||
sa.Column('isactive', sa.Boolean(), nullable=False, server_default='1'),
|
||||
sa.ForeignKeyConstraint(['computerid'], ['computers.computerid'], ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['protocolid'], ['accessprotocols.protocolid']),
|
||||
sa.UniqueConstraint('computerid', 'protocolid', name='uq_computer_protocol'),
|
||||
)
|
||||
op.create_index('idx_compaccess_computer', 'computeraccess', ['computerid'])
|
||||
|
||||
conn = op.get_bind()
|
||||
# Seed the protocol catalog. exec_driver_sql so the ':' / '{}' in the
|
||||
# templates are not parsed as bind params.
|
||||
conn.exec_driver_sql(
|
||||
"INSERT INTO accessprotocols (name, scheme, defaultport, linktemplate, isactive) VALUES "
|
||||
"('VNC','vnc',5900,'vnc://{host}:{port}',1),"
|
||||
"('WinRM','https',5986,'https://{host}:{port}/wsman',1),"
|
||||
"('RDP','rdp',3389,'rdp://{host}:{port}',1)"
|
||||
)
|
||||
# Migrate the old booleans into per-PC access rows.
|
||||
conn.exec_driver_sql(
|
||||
"INSERT INTO computeraccess (computerid, protocolid, isactive) "
|
||||
"SELECT c.computerid, p.protocolid, 1 FROM computers c "
|
||||
"JOIN accessprotocols p ON p.name='VNC' WHERE c.isvnc = 1"
|
||||
)
|
||||
conn.exec_driver_sql(
|
||||
"INSERT INTO computeraccess (computerid, protocolid, isactive) "
|
||||
"SELECT c.computerid, p.protocolid, 1 FROM computers c "
|
||||
"JOIN accessprotocols p ON p.name='WinRM' WHERE c.iswinrm = 1"
|
||||
)
|
||||
|
||||
op.drop_column('computers', 'isvnc')
|
||||
op.drop_column('computers', 'iswinrm')
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.add_column('computers', sa.Column('iswinrm', sa.Boolean(), nullable=True))
|
||||
op.add_column('computers', sa.Column('isvnc', sa.Boolean(), nullable=True))
|
||||
op.drop_index('idx_compaccess_computer', table_name='computeraccess')
|
||||
op.drop_table('computeraccess')
|
||||
op.drop_table('accessprotocols')
|
||||
Reference in New Issue
Block a user