Browse Source

Set user default tenant (#13909)

3.2.0-release
Wenjun Ruan 2 years ago committed by GitHub
parent
commit
2177d70150
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
  2. 7
      dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-save-modal.tsx

5
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java

@ -1071,6 +1071,11 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService {
} }
} }
Tenant tenant = tenantMapper.selectById(user.getTenantId());
if (tenant != null) {
user.setTenantCode(tenant.getTenantCode());
}
// add system default timezone if not user timezone // add system default timezone if not user timezone
if (StringUtils.isEmpty(user.getTimeZone())) { if (StringUtils.isEmpty(user.getTimeZone())) {
user.setTimeZone(TimeZone.getDefault().toZoneId().getId()); user.setTimeZone(TimeZone.getDefault().toZoneId().getId());

7
dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-save-modal.tsx

@ -38,10 +38,12 @@ import {
} from 'naive-ui' } from 'naive-ui'
import { queryTenantList } from '@/service/modules/tenants' import { queryTenantList } from '@/service/modules/tenants'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { useUserStore } from '@/store/user/user'
import { verifyName } from '@/service/modules/process-definition' import { verifyName } from '@/service/modules/process-definition'
import './x6-style.scss' import './x6-style.scss'
import { positiveIntegerRegex } from '@/utils/regex' import { positiveIntegerRegex } from '@/utils/regex'
import type { SaveForm, WorkflowDefinition, WorkflowInstance } from './types' import type { SaveForm, WorkflowDefinition, WorkflowInstance } from './types'
import type { UserInfoRes } from '@/service/modules/users/types'
const props = { const props = {
visible: { visible: {
@ -73,6 +75,7 @@ export default defineComponent({
const { t } = useI18n() const { t } = useI18n()
const projectCode = Number(route.params.projectCode) const projectCode = Number(route.params.projectCode)
const userInfo = useUserStore().getUserInfo as UserInfoRes
const tenants = ref<Tenant[]>([]) const tenants = ref<Tenant[]>([])
const tenantsDropdown = computed(() => { const tenantsDropdown = computed(() => {
if (tenants.value) { if (tenants.value) {
@ -93,7 +96,7 @@ export default defineComponent({
const formValue = ref<SaveForm>({ const formValue = ref<SaveForm>({
name: '', name: '',
description: '', description: '',
tenantCode: 'default', tenantCode: userInfo.tenantCode || 'default',
executionType: 'PARALLEL', executionType: 'PARALLEL',
timeoutFlag: false, timeoutFlag: false,
timeout: 0, timeout: 0,
@ -167,7 +170,7 @@ export default defineComponent({
if (process) { if (process) {
formValue.value.name = process.name formValue.value.name = process.name
formValue.value.description = process.description formValue.value.description = process.description
formValue.value.tenantCode = process.tenantCode || 'default' formValue.value.tenantCode = process.tenantCode || userInfo.tenantCode || 'default'
formValue.value.executionType = process.executionType || 'PARALLEL' formValue.value.executionType = process.executionType || 'PARALLEL'
if (process.timeout && process.timeout > 0) { if (process.timeout && process.timeout > 0) {
formValue.value.timeoutFlag = true formValue.value.timeoutFlag = true

Loading…
Cancel
Save