Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 797 #1322

Merged
merged 3 commits into from
Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/v1/pages/approve_manage/approve_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
path=tag,
name=name,
page=page,
icon='archive'
)

page.create_actions(
Expand Down
3 changes: 2 additions & 1 deletion api/v1/pages/developer_manage/api_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
router = FrontRouter(
path=tag,
name=name,
url='/api/v1/tenant/{tenant_id}/docs/redoc/'
url='/api/v1/tenant/{tenant_id}/docs/redoc/',
icon='api'
)
4 changes: 3 additions & 1 deletion api/v1/views/loginpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ def login_page(request, tenant_id: str):
}
data[AuthFactorExtension.RESET_PASSWORD]['bottoms'].insert(0, bottom)

tenant_expanded = Tenant.expand_objects.get(id=tenant.id)
tenant_expanded["is_platform_tenant"] = tenant.is_platform_tenant
return {
'tenant': tenant,
'tenant': tenant_expanded,
'data': data,
}
4 changes: 3 additions & 1 deletion api/v1/views/tenant.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ def default_tenant(request):
""" 获取当前域名下的默认租户(如无slug则为平台租户)
"""
tenant = Tenant.platform_tenant()
return {"data":tenant}
tenant_expanded = Tenant.expand_objects.get(id=tenant.id)
tenant_expanded["is_platform_tenant"] = tenant.is_platform_tenant
return {"data":tenant_expanded}

@api.post("/tenants/{tenant_id}/logout/", response=TenantLogoutOut,tags=["租户管理"])
@operation(TenantLogoutOut,roles=[TENANT_ADMIN])
Expand Down
23 changes: 23 additions & 0 deletions extension_root/com_longgui_default_desktop/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from arkid.core import extension
from arkid.core.translation import gettext_default as _
from .models import DefaultDesktop
from typing import List, Optional
from pydantic import Field

class DefaultDesktopExtension(extension.Extension):

def load(self):
super().load()
self.register_extend_field(DefaultDesktop, 'default_desktop')
from api.v1.schema.tenant import TenantConfigItemOut,TenantConfigUpdateIn,TenantItemOut,DefaultTenantItemOut
from api.v1.views.loginpage import LoginPageTenantSchema
self.register_extend_api(
TenantConfigItemOut,
TenantConfigUpdateIn,
TenantItemOut,
DefaultTenantItemOut,
LoginPageTenantSchema,
default_desktop=(Optional[str],Field(title=_("默认桌面路径")))
)

extension = DefaultDesktopExtension()
7 changes: 7 additions & 0 deletions extension_root/com_longgui_default_desktop/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package='com.longgui.other.defaultdesktop'
name="租户默认桌面设置"
version='1.0'
labels='defaultdesktop'
homepage='https://www.company.com'
logo=''
author='guancyxx@guancyxx.cn'
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 3.2.13 on 2022-09-30 02:01

from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

initial = True

dependencies = [
('core', '0030_userpersonalsettings'),
]

operations = [
migrations.CreateModel(
name='DefaultDesktop',
fields=[
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False, unique=True, verbose_name='ID')),
('is_del', models.BooleanField(default=False, verbose_name='是否删除')),
('is_active', models.BooleanField(default=True, verbose_name='是否可用')),
('updated', models.DateTimeField(auto_now=True, null=True, verbose_name='更新时间')),
('created', models.DateTimeField(auto_now_add=True, null=True, verbose_name='创建时间')),
('default_desktop', models.CharField(blank=True, max_length=1024, null=True, verbose_name='Default Desktop')),
('target', models.OneToOneField(blank=True, default=None, on_delete=django.db.models.deletion.PROTECT, related_name='com_longgui_default_desktop_defaultdesktop', to='core.tenant')),
],
),
]
Empty file.
17 changes: 17 additions & 0 deletions extension_root/com_longgui_default_desktop/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.db import models
from arkid.core.translation import gettext_default as _
from django.apps import AppConfig
from arkid.core.models import TenantExpandAbstract

app_label = "com_longgui_default_desktop"

class LongguiDefaultDesktopAppConfig(AppConfig):
name = app_label

class DefaultDesktop(TenantExpandAbstract):
class Meta:
app_label = app_label

default_desktop = models.CharField(verbose_name=_('Default Desktop', '默认桌面'),blank=True,null=True, max_length=1024)