mirror of
https://github.com/jumpserver/lina.git
synced 2026-05-17 21:16:46 +00:00
perf: configurable cookie localStorage base path
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
<script>
|
||||
import Title from './Title.vue'
|
||||
import SwitchDate from './SwitchDate.vue'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
name: {
|
||||
|
||||
@@ -7,6 +7,7 @@ import JsonEditor from '@/components/Form/FormFields/JsonEditor.vue'
|
||||
import { assignIfNot, toSentenceCase } from '@/utils/common/index'
|
||||
import TagInput from '@/components/Form/FormFields/TagInput.vue'
|
||||
import i18n from '@/i18n/i18n'
|
||||
import { vueCookie as VueCookie } from '@/utils/storage'
|
||||
|
||||
export class FormFieldGenerator {
|
||||
constructor() {
|
||||
@@ -174,7 +175,7 @@ export class FormFieldGenerator {
|
||||
const placeholderType = ['input', 'select', 'm2m_related_field']
|
||||
const placeholderComponent = [ObjectSelect2]
|
||||
|
||||
const systemLang = document.cookie.django_language
|
||||
const systemLang = VueCookie.get('django_language')
|
||||
if (helpTextAsPlaceholder !== undefined) {
|
||||
helpTextAsPlaceholder = !!helpTextAsPlaceholder
|
||||
} else if (
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
name: 'PhoneInput',
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import MarkDown from '@/components/Widgets/MarkDown'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
name: 'Announcement',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
Vue.directive('el-drawer-drag-width', {
|
||||
bind(el, binding, vnode, oldVnode) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import { startup } from '@/utils/startup'
|
||||
import store from '@/store'
|
||||
import { isSameView } from '@/utils/jms/index'
|
||||
import { toSentenceCase } from '@/utils/common/index'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
function beforeRouteChange(to, from, next) {
|
||||
localStorage.setItem('activeTab', '')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import VueCookie from 'vue-cookie'
|
||||
import store from '@/store'
|
||||
import { vueCookie as VueCookie } from '@/utils/storage'
|
||||
|
||||
export function getLangCode(withInternalCode = false) {
|
||||
const cookieLang = VueCookie.get('django_language')
|
||||
@@ -15,4 +15,3 @@ export function getLangCode(withInternalCode = false) {
|
||||
}
|
||||
return lang
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
import { mapGetters } from 'vuex'
|
||||
import Icon from '@/components/Widgets/Icon'
|
||||
import store from '@/store'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
name: 'ViewSwitcher',
|
||||
|
||||
@@ -73,6 +73,7 @@ import UserConfirmDialog from '@/components/Apps/UserConfirmDialog/index.vue'
|
||||
import TagsView from '../TagsView/index.vue'
|
||||
import { toSentenceCase } from '@/utils/common/index'
|
||||
import IBox from '@/components/Common/IBox/index.vue'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
name: 'Page',
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
import Page from '../Page/'
|
||||
import Icon from '@/components/Widgets/Icon'
|
||||
import { toSentenceCase } from '@/utils/common/index'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
name: 'TabPage',
|
||||
|
||||
@@ -3,6 +3,7 @@ import ElementUI from 'element-ui'
|
||||
import locale from 'elementLocale'
|
||||
import '@/styles/index.scss' // global css
|
||||
import App from './App'
|
||||
import { vueCookie as VueCookie } from '@/utils/storage'
|
||||
import store from './store'
|
||||
import router from './router'
|
||||
import i18n, { fetchTranslationsFromAPI } from './i18n/i18n'
|
||||
@@ -14,8 +15,6 @@ import '@/icons' // icon
|
||||
import '@/guards' // permission control
|
||||
import '@/directive'
|
||||
import '@/filters'
|
||||
// cookie
|
||||
import VueCookie from 'vue-cookie'
|
||||
import VueLogger from 'vuejs-logger'
|
||||
import loggerOptions from './utils/logger'
|
||||
import ECharts from 'vue-echarts'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Cookies from 'js-cookie'
|
||||
import { jsCookie as Cookies } from '@/utils/storage'
|
||||
|
||||
const state = {
|
||||
sidebar: {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { getCategoryTypes as apiGetCategoryTypes } from '@/api/asset'
|
||||
import request from '@/utils/request'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
const state = {
|
||||
assetCategories: [],
|
||||
|
||||
@@ -3,6 +3,7 @@ import { getPublicSettings } from '@/api/settings'
|
||||
import { changeElementColor, changeThemeColors } from '@/utils/theme/index'
|
||||
import { changeMenuColor } from '@/utils/theme/color'
|
||||
import request from '@/utils/request'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
const { showSettings, fixedHeader, sidebarLogo, tagsView } = defaultSettings
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
function getTableConfigFromLocal() {
|
||||
const configs = localStorage.getItem('tableConfig')
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import i18n from '@/i18n/i18n'
|
||||
import { message } from '@/utils/vue/message'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
const _ = require('lodash')
|
||||
|
||||
@@ -426,7 +427,7 @@ export function getDrawerWidth() {
|
||||
|
||||
export function getShowCurrentAssetValue(cookie, defaultValue = '0') {
|
||||
const stored = typeof window !== 'undefined'
|
||||
? window.localStorage.getItem('show_current_asset')
|
||||
? localStorage.getItem('show_current_asset')
|
||||
: null
|
||||
if (stored === '0' || stored === '1') {
|
||||
return stored
|
||||
@@ -439,7 +440,7 @@ export function getShowCurrentAssetValue(cookie, defaultValue = '0') {
|
||||
|
||||
export function setShowCurrentAssetValue(cookie, value) {
|
||||
if (typeof window !== 'undefined') {
|
||||
window.localStorage.setItem('show_current_asset', String(value))
|
||||
localStorage.setItem('show_current_asset', String(value))
|
||||
}
|
||||
if (cookie && typeof cookie.set === 'function') {
|
||||
cookie.set('show_current_asset', value, 1)
|
||||
@@ -457,7 +458,7 @@ export class ObjectLocalStorage {
|
||||
}
|
||||
|
||||
getObject() {
|
||||
const stored = window.localStorage.getItem(this.key)
|
||||
const stored = localStorage.getItem(this.key)
|
||||
let value = {}
|
||||
try {
|
||||
value = JSON.parse(stored)
|
||||
@@ -491,7 +492,7 @@ export class ObjectLocalStorage {
|
||||
}
|
||||
const attrSafe = this.b64(attr)
|
||||
obj[attrSafe] = value
|
||||
window.localStorage.setItem(this.key, JSON.stringify(obj))
|
||||
localStorage.setItem(this.key, JSON.stringify(obj))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import VueCookie from 'vue-cookie'
|
||||
import request from '@/utils/request'
|
||||
import { scopedLocalStorage as localStorage, vueCookie as VueCookie } from '@/utils/storage'
|
||||
|
||||
const CURRENT_ORG_KEY = 'currentOrg'
|
||||
const CURRENT_ROLE_KEY = 'currentRole'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { constantRoutes } from '@/router'
|
||||
import store from '@/store'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
let openedTaskWindow = null // 保存已打开的窗口对象
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import { message } from '@/utils/vue/message'
|
||||
import store from '@/store'
|
||||
import axiosRetry from 'axios-retry'
|
||||
import router from '@/router'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
// create an axios instance
|
||||
const service = axios.create({
|
||||
|
||||
@@ -46,7 +46,7 @@ const filter = new xss.FilterXSS(options)
|
||||
|
||||
import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
|
||||
import CryptoJS from 'crypto-js'
|
||||
import VueCookie from 'vue-cookie'
|
||||
import { vueCookie as VueCookie } from '@/utils/storage'
|
||||
|
||||
export function fillKey(key) {
|
||||
const KeyLength = 16
|
||||
|
||||
@@ -6,6 +6,7 @@ import { message } from '@/utils/vue/message'
|
||||
import orgUtil from '@/utils/jms/org'
|
||||
import orgs from '@/api/orgs'
|
||||
import { getPropView, isViewHasOrgs } from '@/utils/jms/index'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
const whiteList = ['/login', process.env.VUE_APP_LOGIN_PATH] // no redirect whitelist
|
||||
const autoEnterOrgs = [
|
||||
|
||||
@@ -13,6 +13,7 @@ import { Announcement } from '@/components'
|
||||
import { Page } from '@/layout/components'
|
||||
import Page403 from '@/views/403'
|
||||
import AuditReport from '@/views/reports/audits/Dashboard.vue'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
@@ -55,6 +55,7 @@ import * as echarts from 'echarts'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
import AccountSummary from '@/views/reports/pam/ChangeSecret/AccountSummary.vue'
|
||||
import RiskSummary from '@/views/reports/pam/Dashboard/RiskSummary.vue'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
@@ -85,6 +85,7 @@ import UserAssetActivity from '@/views/reports/console/UserAssetActivity.vue'
|
||||
import * as echarts from 'echarts'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
import { mixColors } from '@/views/reports/const'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
@@ -29,6 +29,7 @@ import CardSummary from './components/CardSummary.vue'
|
||||
import RightSummary from './components/RightSummary.vue'
|
||||
import BaseReport from '../base/BaseReport.vue'
|
||||
import { getRouteUrl } from '@/utils/vue'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
<script>
|
||||
import { download } from '@/utils/common'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
name: 'RightAction',
|
||||
|
||||
@@ -38,6 +38,7 @@ import AccountSummary from './AccountSummary.vue'
|
||||
import FailedAccountSummary from './FailedAccountSummary.vue'
|
||||
import BaseReport from '../../base/BaseReport.vue'
|
||||
import { getRouteUrl } from '@/utils/vue'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
name: 'ChangeSecret',
|
||||
|
||||
@@ -56,6 +56,7 @@ import SummaryCountCard from '@/components/Dashboard/SummaryCountCard.vue'
|
||||
import { mixColors } from '@/views/reports/const'
|
||||
import * as echarts from 'echarts'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
@@ -79,6 +79,7 @@ import * as echarts from 'echarts'
|
||||
import { mixColors } from '@/views/reports/const'
|
||||
import SummaryCountCard from '@/components/Dashboard/SummaryCountCard.vue'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
@@ -22,6 +22,7 @@ import MarkDownEditor from '@/views/settings/Msg/Email/markDownEditor.vue'
|
||||
import { Select2 } from '@/components/Form/FormFields'
|
||||
import VariablesHelpTextDialog from '@/components/Apps/VariablesHelpTextDialog'
|
||||
import variable from '@/views/ops/Template/components/Variable.vue'
|
||||
import { scopedLocalStorage as localStorage } from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
name: 'MsgTemplate',
|
||||
|
||||
Reference in New Issue
Block a user