Merge pull request #609 from frappe/develop
This commit is contained in:
commit
04ec5864b0
11
crm/hooks.py
11
crm/hooks.py
@ -293,7 +293,14 @@ standard_dropdown_items = [
|
||||
"label": "Settings",
|
||||
"type": "Route",
|
||||
"icon": "settings",
|
||||
"route": "#",
|
||||
"route": "#",
|
||||
"is_standard": 1,
|
||||
},
|
||||
{
|
||||
"name1": "login_to_fc",
|
||||
"label": "Login to Frappe Cloud",
|
||||
"type": "Route",
|
||||
"route": "#",
|
||||
"is_standard": 1,
|
||||
},
|
||||
{
|
||||
@ -307,7 +314,7 @@ standard_dropdown_items = [
|
||||
"label": "Log out",
|
||||
"type": "Route",
|
||||
"icon": "log-out",
|
||||
"route": "#",
|
||||
"route": "#",
|
||||
"is_standard": 1,
|
||||
},
|
||||
]
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
|
||||
import frappe
|
||||
from frappe.integrations.frappe_providers.frappecloud_billing import is_fc_site
|
||||
from frappe.utils import cint, get_system_timezone
|
||||
from frappe.utils.telemetry import capture
|
||||
|
||||
@ -36,6 +37,7 @@ def get_boot():
|
||||
"setup_complete": cint(frappe.get_system_settings("setup_complete")),
|
||||
"sysdefaults": frappe.defaults.get_defaults(),
|
||||
"is_demo_site": frappe.conf.get("is_demo_site"),
|
||||
"is_fc_site": is_fc_site(),
|
||||
"timezone": {
|
||||
"system": get_system_timezone(),
|
||||
"user": frappe.db.get_value("User", frappe.session.user, "time_zone")
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit e01b1ee305a0207413cd67ed7345578440c503db
|
||||
Subproject commit 33c9907aa9163d8d3b84f23dc2a2c829e4d8c6f1
|
||||
@ -14,7 +14,7 @@
|
||||
"@vueuse/core": "^10.3.0",
|
||||
"@vueuse/integrations": "^10.3.0",
|
||||
"feather-icons": "^4.28.0",
|
||||
"frappe-ui": "^0.1.110",
|
||||
"frappe-ui": "^0.1.111",
|
||||
"gemoji": "^8.1.0",
|
||||
"lodash": "^4.17.21",
|
||||
"mime": "^4.0.1",
|
||||
|
||||
23
frontend/src/components/Icons/FrappeCloudIcon.vue
Normal file
23
frontend/src/components/Icons/FrappeCloudIcon.vue
Normal file
@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<svg
|
||||
width="32"
|
||||
height="32"
|
||||
viewBox="0 0 32 32"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<rect
|
||||
x="0.75"
|
||||
y="0.75"
|
||||
width="30.5"
|
||||
height="30.5"
|
||||
rx="6.25"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.5"
|
||||
/>
|
||||
<path
|
||||
d="M24.5011 14.1124C23.3954 12.4873 21.532 11.5477 19.594 11.6747C18.7616 10.1384 17.2211 9.12267 15.4198 9.0084C14.1651 8.93222 12.8979 9.3766 11.9165 10.24C11.2456 10.8367 10.7611 11.5223 10.463 12.2968C10.289 12.7539 9.89151 13.0459 9.46912 13.0459H6.5V15.5852H9.46912C10.9226 15.5852 12.2271 14.6584 12.7737 13.2237C12.9227 12.8301 13.1712 12.4873 13.5439 12.1571C14.0284 11.7255 14.662 11.4969 15.2583 11.535C16.1528 11.5985 16.7863 12.0175 17.1839 12.538C17.6063 13.0205 17.8423 13.7696 17.979 14.5187C18.774 14.2902 19.6437 14.0997 20.476 14.2394C21.1593 14.3536 21.7929 14.7218 22.2525 15.2678C22.327 15.3567 22.4016 15.4456 22.4637 15.5471C23.06 16.4232 23.1718 17.5024 22.7743 18.5689C22.414 19.5592 21.0847 20.4607 19.9791 20.4607H11.3326C10.1524 20.4607 9.18339 19.5592 9.03432 18.4038H6.54969C6.71119 20.9686 8.78585 23 11.3326 23H19.9915C22.1283 23 24.3769 21.451 25.1098 19.4704C25.7931 17.6167 25.5695 15.6614 24.5135 14.0997L24.5011 14.1124Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</template>
|
||||
@ -73,6 +73,7 @@
|
||||
</div>
|
||||
<div class="m-2 flex flex-col gap-1">
|
||||
<SignupBanner :isSidebarCollapsed="isSidebarCollapsed" />
|
||||
<TrialBanner v-if="isFCSite" />
|
||||
<SidebarLink
|
||||
:label="isSidebarCollapsed ? __('Expand') : __('Collapse')"
|
||||
:isCollapsed="isSidebarCollapsed"
|
||||
@ -117,15 +118,17 @@ import {
|
||||
unreadNotificationsCount,
|
||||
notificationsStore,
|
||||
} from '@/stores/notifications'
|
||||
import { FeatherIcon } from 'frappe-ui'
|
||||
import { FeatherIcon, TrialBanner } from 'frappe-ui'
|
||||
import { useStorage } from '@vueuse/core'
|
||||
import { computed, h } from 'vue'
|
||||
import { ref, computed, h } from 'vue'
|
||||
|
||||
const { getPinnedViews, getPublicViews } = viewsStore()
|
||||
const { toggle: toggleNotificationPanel } = notificationsStore()
|
||||
|
||||
const isSidebarCollapsed = useStorage('isSidebarCollapsed', false)
|
||||
|
||||
const isFCSite = ref(window.is_fc_site)
|
||||
|
||||
const links = [
|
||||
{
|
||||
label: 'Leads',
|
||||
|
||||
@ -50,11 +50,13 @@
|
||||
|
||||
<script setup>
|
||||
import BrandLogo from '@/components/BrandLogo.vue'
|
||||
import FrappeCloudIcon from '@/components/Icons/FrappeCloudIcon.vue'
|
||||
import Apps from '@/components/Apps.vue'
|
||||
import { sessionStore } from '@/stores/session'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import { getSettings } from '@/stores/settings'
|
||||
import { showSettings, isMobileView } from '@/composables/settings'
|
||||
import { confirmLoginToFrappeCloud } from '@/composables/frappecloud'
|
||||
import { Dropdown } from 'frappe-ui'
|
||||
import { theme, toggleTheme } from '@/stores/theme'
|
||||
import { computed, h, markRaw } from 'vue'
|
||||
@ -156,6 +158,13 @@ function getStandardItem(item) {
|
||||
onClick: () => (showSettings.value = true),
|
||||
condition: () => !isMobileView.value,
|
||||
}
|
||||
case 'login_to_fc':
|
||||
return {
|
||||
icon: h(FrappeCloudIcon),
|
||||
label: __(item.label),
|
||||
onClick: () => confirmLoginToFrappeCloud(),
|
||||
condition: () => !isMobileView.value && window.is_fc_site,
|
||||
}
|
||||
case 'logout':
|
||||
return {
|
||||
icon: item.icon,
|
||||
|
||||
45
frontend/src/composables/frappecloud.js
Normal file
45
frontend/src/composables/frappecloud.js
Normal file
@ -0,0 +1,45 @@
|
||||
import { globalStore } from '@/stores/global'
|
||||
import { createResource } from 'frappe-ui'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const baseEndpoint = ref('https://frappecloud.com')
|
||||
const siteName = ref('')
|
||||
|
||||
export const currentSiteInfo = createResource({
|
||||
url: 'frappe.integrations.frappe_providers.frappecloud_billing.current_site_info',
|
||||
cache: 'currentSiteInfo',
|
||||
onSuccess: (data) => {
|
||||
baseEndpoint.value = data.base_url
|
||||
siteName.value = data.site_name
|
||||
},
|
||||
})
|
||||
|
||||
export const confirmLoginToFrappeCloud = () => {
|
||||
currentSiteInfo.fetch()
|
||||
|
||||
const { $dialog } = globalStore()
|
||||
|
||||
$dialog({
|
||||
title: __('Login to Frappe Cloud?'),
|
||||
message: __(
|
||||
'Are you sure you want to login to your Frappe Cloud dashboard?',
|
||||
),
|
||||
actions: [
|
||||
{
|
||||
label: __('Confirm'),
|
||||
variant: 'solid',
|
||||
onClick(close) {
|
||||
loginToFrappeCloud()
|
||||
close()
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
const loginToFrappeCloud = () => {
|
||||
window.open(
|
||||
`${baseEndpoint.value}/dashboard/sites/${siteName.value}`,
|
||||
'_blank',
|
||||
)
|
||||
}
|
||||
@ -2388,10 +2388,10 @@ fraction.js@^4.3.7:
|
||||
resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.3.7.tgz#06ca0085157e42fda7f9e726e79fefc4068840f7"
|
||||
integrity sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==
|
||||
|
||||
frappe-ui@^0.1.110:
|
||||
version "0.1.110"
|
||||
resolved "https://registry.yarnpkg.com/frappe-ui/-/frappe-ui-0.1.110.tgz#dbe02d294cb0aeb0a4c1b3000682093c309450ae"
|
||||
integrity sha512-kFah6SoPauULXaeSbljNUq595/82VmY4k4+KA8zi4sXxpn4sXYi12qUl/1I8GOBhsCQQizmoh46DO7e/uU2M1A==
|
||||
frappe-ui@^0.1.111:
|
||||
version "0.1.111"
|
||||
resolved "https://registry.yarnpkg.com/frappe-ui/-/frappe-ui-0.1.111.tgz#c7615aa8f02da9af0596074352150d813d0f4b3d"
|
||||
integrity sha512-JCh/SQwcbsQQxTZIFFzEULPgp2QAQZe+vwrM2jqekIx4dBgYW2H1KgXSlf+uO2ng2vqk4Q1MiStA3svHQEXsLQ==
|
||||
dependencies:
|
||||
"@headlessui/vue" "^1.7.14"
|
||||
"@popperjs/core" "^2.11.2"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user