feat: add users with correct application (#2570)

This commit is contained in:
Yaodong Yu 2024-01-02 23:49:04 +08:00 committed by GitHub
parent e3f28e8b4c
commit 369de36987
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -392,7 +392,7 @@ class App extends Component {
</div> </div>
</Tooltip> </Tooltip>
<OpenTour /> <OpenTour />
{Setting.isAdminUser(this.state.account) && !Setting.isMobile() && {Setting.isAdminUser(this.state.account) && !Setting.isMobile() && (this.state.uri.indexOf("/trees") === -1) &&
<OrganizationSelect <OrganizationSelect
initValue={Setting.getOrganization()} initValue={Setting.getOrganization()}
withAll={true} withAll={true}

View File

@ -25,6 +25,7 @@ class BaseListPage extends React.Component {
super(props); super(props);
this.state = { this.state = {
classes: props, classes: props,
organizationName: this.props.match?.params.organizationName || Setting.getRequestOrganization(this.props.account),
data: [], data: [],
pagination: { pagination: {
current: 1, current: 1,
@ -39,6 +40,10 @@ class BaseListPage extends React.Component {
} }
handleOrganizationChange = () => { handleOrganizationChange = () => {
this.setState({
organizationName: this.props.match?.params.organizationName || Setting.getRequestOrganization(this.props.account),
});
const {pagination} = this.state; const {pagination} = this.state;
this.fetch({pagination}); this.fetch({pagination});
}; };

View File

@ -30,7 +30,6 @@ class UserListPage extends BaseListPage {
super(props); super(props);
this.state = { this.state = {
...this.state, ...this.state,
organizationName: this.props.organizationName ?? this.props.match?.params.organizationName ?? this.props.account.owner,
organization: null, organization: null,
}; };
} }
@ -62,7 +61,7 @@ class UserListPage extends BaseListPage {
newUser() { newUser() {
const randomName = Setting.getRandomName(); const randomName = Setting.getRandomName();
const owner = Setting.isDefaultOrganizationSelected(this.props.account) ? this.state.organizationName : Setting.getRequestOrganization(this.props.account); const owner = (Setting.isDefaultOrganizationSelected(this.props.account) || this.props.groupName) ? this.state.organizationName : Setting.getRequestOrganization(this.props.account);
return { return {
owner: owner, owner: owner,
name: `user_${randomName}`, name: `user_${randomName}`,
@ -85,7 +84,7 @@ class UserListPage extends BaseListPage {
score: this.state.organization.initScore, score: this.state.organization.initScore,
isDeleted: false, isDeleted: false,
properties: {}, properties: {},
signupApplication: "app-built-in", signupApplication: this.state.organization.defaultApplication,
}; };
} }