Horizon 二次开发 - 主题简单修改

14 篇文章 0 订阅
10 篇文章 0 订阅

环境准备

  • ssh 允许root(不安全,但是为了使用pycharm代码提交方便,最简单的方法)登陆
  • 修改/etc/ssh/sshd_config 将 PermitRootLogin prohibit-password -> PermitRootLogin yes
  • 备份一下目录:

    
    # cp /user/share/openstack_dashboard /user/share/openstack_dashboard.bak
    
  • 说明:请开发中间阶段,即使备份,或制作快照,保存本地

pycharm 远程同步/user/share/openstack_dashboard 所有文件
注:使用pycharm登陆服务器,请使用root+passwd 否则会出现上传代码没权限的情况


初步修改

  • cp /openstack_dashboard/themes/default /openstack_dashboard/themes/smalleaf
  • 对openstack_dashboard/setting.py的修改
    这里写图片描述
DEBUG=TRUE
....
AVAILABLE_THEMES = [
    (
        'ubuntu',
        pgettext_lazy('Ubuntu theme', 'Ubuntu'),
        'themes/ubuntu'
    ), (
        'default',
        pgettext_lazy('Default style theme', 'Default'),
        'themes/default'
    ), (
        'material',
        pgettext_lazy("Google's Material Design style theme", "Material"),
        'themes/material'
    ),
    (
        'smalleaf',
        pgettext_lazy("Design theme by Longruan", "SmallLeaf"),
        'themes/smalleaf'
    ),
]

这样就能增加了一个SmallLeaf的主题格式,接下来,进行修改Smalleaf内容

themes 文件准备

mkdir ./openstack_dashboard/smalleaf/static
mkdir ./openstack_dashboard/smalleaf/templstes
cp -r ./horizon/templates/auth ./openstack_dashboard/themes/smalleaf/auth
cp -r ./horizon/templates/horizon ./openstack_dashboard/themes/smalleaf/horizon
cp -r ./openstack_dashboard/templates/* ./openstack_dashboard/themes/smalleaf/templates/
cp -r ./openstack_dashboard/static/dashboard ./openstack_dashboard/themes/smalleaf/static/
mv ./openstack_dashboard/themes/smalleaf/_styles.scss ./openstack_dashboard/themes/smalleaf/static/
mv ./openstack_dashboard/themes/smalleaf/_variables.scss ./openstack_dashboard/themes/smalleaf/static/

文件说明

两个非常重要的文件:
_styles.scss ->horizon样式
_variables.scss->全局变量定义

修改部分html

  • 修改图标
    themes/smalleaf/auth/_splash.html
{% load themes %}

<div class="text-center">
    <img class="splash-logo" src="{{ STATIC_URL }}themes/smalleaf/img/login_logo.png">
</div>
  • 固定右侧侧边栏
    themes/smalleaf/horizon/_sidebar.html
{% load horizon i18n %}
<!--solve fixed sidebar problem by gqw-->
<!--主要是增加这个fixed-->
<style>.fixed{  position:fixed;  width: 220px;  background:#333744;  height: 100%;}</style>
...
  • themes/smalleaf/templates/horizon/commen/_sidebar.html
{% load branding horizon i18n %}

<nav id='sidebar' class="fixed">
  {% horizon_nav %}
</nav>
  • themes/smalleaf/static/_styles.scss
// all this line
@import "dashboard/scss/horizon";
  • 修改图标
    themes/smalleaf/teamplates/head/_brand.html
{% load branding %}
{% load themes %}

<a class="navbar-brand" href="{% site_branding_link %}" target="_self">
        <img class="openstack-logo" src="{{ STATIC_URL }}themes/smalleaf/img/head_logo.png" alt="{% site_branding %}">
    {#  <img class="openstack-logo" src="{% themable_asset 'img/logo.svg' %}" alt="{% site_branding %}">#}
</a>

初步效果图

  • 登陆
    这里写图片描述

  • 界面展示

这里写图片描述

总结

  1. 没有对*.py文件进行任何修改
  2. 所有工作都是在Smalleaf文件夹中进行
  3. _styles.scss _variables.scss能够完成绝大部分主题颜色修改
  4. 目前工作仅仅是最简答的修改,系统性的修改,后期会进行
vmware-horizon-client-5.2.0-14570289.exe是一款由VMware公司开发的桌面虚拟化客户端软件。该软件主要用于连接和访问VMware Horizon平台上的虚拟桌面和应用程序。 VMware Horizon是一种集中式虚拟化解决方案,它可以将用户的个人计算环境(包括操作系统、应用程序和数据)移动到数据中心中的虚拟机上。这样一来,用户可以通过任何设备(如PC、笔记本电脑、平板电脑和智能手机)远程访问其个人虚拟机,而不受硬件限制。通过使用vmware-horizon-client-5.2.0-14570289.exe,用户可以方便地连接到虚拟机并且享受流畅的桌面体验。 该客户端软件提供了一些特色功能。首先,它支持多种操作系统,包括Windows、Mac和Linux等。用户可以根据自己的需求选择适合自己设备的版本进行安装。其次,该客户端具有强大的图形性能,可以实现高质量的图像和视频呈现,确保用户在远程访问虚拟机时获得流畅的视觉体验。此外,该软件还提供了丰富的安全功能,包括SSL加密通信、双因素身份验证和数据保护等,确保用户的数据和隐私安全。 总之,vmware-horizon-client-5.2.0-14570289.exe是一款功能强大的桌面虚拟化客户端软件,它可以让用户通过任何设备远程访问和管理其个人虚拟机,并提供了出色的图形性能和安全功能。对于需要频繁访问虚拟机的用户来说,这是一款非常实用的软件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值