mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
Improve creation UI for pages.
This commit is contained in:
parent
2f71d9743b
commit
1762d19787
@ -123,7 +123,8 @@ class ApplicationEditPage extends React.Component {
|
|||||||
<Card size="small" title={
|
<Card size="small" title={
|
||||||
<div>
|
<div>
|
||||||
{i18next.t("application:Edit Application")}
|
{i18next.t("application:Edit Application")}
|
||||||
<Button type="primary" onClick={this.submitApplicationEdit.bind(this)}>{i18next.t("general:Save")}</Button>
|
<Button onClick={() => this.submitApplicationEdit(false)}>{i18next.t("general:Save")}</Button>
|
||||||
|
<Button style={{marginLeft: '20px'}} type="primary" onClick={() => this.submitApplicationEdit(true)}>{i18next.t("general:Save & Exit")}</Button>
|
||||||
</div>
|
</div>
|
||||||
} style={(Setting.isMobile())? {margin: '5px'}:{}} type="inner">
|
} style={(Setting.isMobile())? {margin: '5px'}:{}} type="inner">
|
||||||
<Row style={{marginTop: '10px'}} >
|
<Row style={{marginTop: '10px'}} >
|
||||||
@ -509,7 +510,7 @@ class ApplicationEditPage extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
submitApplicationEdit() {
|
submitApplicationEdit(willExist) {
|
||||||
let application = Setting.deepCopy(this.state.application);
|
let application = Setting.deepCopy(this.state.application);
|
||||||
ApplicationBackend.updateApplication(this.state.application.owner, this.state.applicationName, application)
|
ApplicationBackend.updateApplication(this.state.application.owner, this.state.applicationName, application)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@ -518,7 +519,12 @@ class ApplicationEditPage extends React.Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
applicationName: this.state.application.name,
|
applicationName: this.state.application.name,
|
||||||
});
|
});
|
||||||
this.props.history.push(`/applications/${this.state.application.name}`);
|
|
||||||
|
if (willExist) {
|
||||||
|
this.props.history.push(`/applications`);
|
||||||
|
} else {
|
||||||
|
this.props.history.push(`/applications/${this.state.application.name}`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", res.msg);
|
Setting.showMessage("error", res.msg);
|
||||||
this.updateApplicationField('name', this.state.applicationName);
|
this.updateApplicationField('name', this.state.applicationName);
|
||||||
@ -536,7 +542,8 @@ class ApplicationEditPage extends React.Component {
|
|||||||
this.state.application !== null ? this.renderApplication() : null
|
this.state.application !== null ? this.renderApplication() : null
|
||||||
}
|
}
|
||||||
<div style={{marginTop: '20px', marginLeft: '40px'}}>
|
<div style={{marginTop: '20px', marginLeft: '40px'}}>
|
||||||
<Button type="primary" size="large" onClick={this.submitApplicationEdit.bind(this)}>{i18next.t("general:Save")}</Button>
|
<Button size="large" onClick={() => this.submitApplicationEdit(false)}>{i18next.t("general:Save")}</Button>
|
||||||
|
<Button style={{marginLeft: '20px'}} type="primary" size="large" onClick={() => this.submitApplicationEdit(true)}>{i18next.t("general:Save & Exit")}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -48,7 +48,7 @@ class ApplicationListPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newApplication() {
|
newApplication() {
|
||||||
var randomName = Math.random().toString(36).slice(-6)
|
const randomName = Setting.getRandomName();
|
||||||
return {
|
return {
|
||||||
owner: "admin", // this.props.account.applicationname,
|
owner: "admin", // this.props.account.applicationname,
|
||||||
name: `application_${randomName}`,
|
name: `application_${randomName}`,
|
||||||
@ -83,6 +83,7 @@ class ApplicationListPage extends React.Component {
|
|||||||
applications: Setting.prependRow(this.state.applications, newApplication),
|
applications: Setting.prependRow(this.state.applications, newApplication),
|
||||||
total: this.state.total + 1
|
total: this.state.total + 1
|
||||||
});
|
});
|
||||||
|
this.props.history.push(`/applications/${newApplication.name}`);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -47,7 +47,7 @@ class OrganizationListPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newOrganization() {
|
newOrganization() {
|
||||||
var randomName = Math.random().toString(36).slice(-6)
|
const randomName = Setting.getRandomName();
|
||||||
return {
|
return {
|
||||||
owner: "admin", // this.props.account.organizationname,
|
owner: "admin", // this.props.account.organizationname,
|
||||||
name: `organization_${randomName}`,
|
name: `organization_${randomName}`,
|
||||||
|
@ -181,7 +181,8 @@ class ProviderEditPage extends React.Component {
|
|||||||
<Card size="small" title={
|
<Card size="small" title={
|
||||||
<div>
|
<div>
|
||||||
{i18next.t("provider:Edit Provider")}
|
{i18next.t("provider:Edit Provider")}
|
||||||
<Button type="primary" onClick={this.submitProviderEdit.bind(this)}>{i18next.t("general:Save")}</Button>
|
<Button onClick={() => this.submitProviderEdit(false)}>{i18next.t("general:Save")}</Button>
|
||||||
|
<Button style={{marginLeft: '20px'}} type="primary" onClick={() => this.submitProviderEdit(true)}>{i18next.t("general:Save & Exit")}</Button>
|
||||||
</div>
|
</div>
|
||||||
} style={(Setting.isMobile())? {margin: '5px'}:{}} type="inner">
|
} style={(Setting.isMobile())? {margin: '5px'}:{}} type="inner">
|
||||||
<Row style={{marginTop: '10px'}} >
|
<Row style={{marginTop: '10px'}} >
|
||||||
@ -521,7 +522,7 @@ class ProviderEditPage extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
submitProviderEdit() {
|
submitProviderEdit(willExist) {
|
||||||
let provider = Setting.deepCopy(this.state.provider);
|
let provider = Setting.deepCopy(this.state.provider);
|
||||||
ProviderBackend.updateProvider(this.state.provider.owner, this.state.providerName, provider)
|
ProviderBackend.updateProvider(this.state.provider.owner, this.state.providerName, provider)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@ -530,7 +531,12 @@ class ProviderEditPage extends React.Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
providerName: this.state.provider.name,
|
providerName: this.state.provider.name,
|
||||||
});
|
});
|
||||||
this.props.history.push(`/providers/${this.state.provider.name}`);
|
|
||||||
|
if (willExist) {
|
||||||
|
this.props.history.push(`/providers`);
|
||||||
|
} else {
|
||||||
|
this.props.history.push(`/providers/${this.state.provider.name}`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", res.msg);
|
Setting.showMessage("error", res.msg);
|
||||||
this.updateProviderField('name', this.state.providerName);
|
this.updateProviderField('name', this.state.providerName);
|
||||||
@ -548,7 +554,8 @@ class ProviderEditPage extends React.Component {
|
|||||||
this.state.provider !== null ? this.renderProvider() : null
|
this.state.provider !== null ? this.renderProvider() : null
|
||||||
}
|
}
|
||||||
<div style={{marginTop: '20px', marginLeft: '40px'}}>
|
<div style={{marginTop: '20px', marginLeft: '40px'}}>
|
||||||
<Button type="primary" size="large" onClick={this.submitProviderEdit.bind(this)}>{i18next.t("general:Save")}</Button>
|
<Button size="large" onClick={() => this.submitProviderEdit(false)}>{i18next.t("general:Save")}</Button>
|
||||||
|
<Button style={{marginLeft: '20px'}} type="primary" size="large" onClick={() => this.submitProviderEdit(true)}>{i18next.t("general:Save & Exit")}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -48,7 +48,7 @@ class ProviderListPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newProvider() {
|
newProvider() {
|
||||||
var randomName = Math.random().toString(36).slice(-6)
|
const randomName = Setting.getRandomName();
|
||||||
return {
|
return {
|
||||||
owner: "admin", // this.props.account.providername,
|
owner: "admin", // this.props.account.providername,
|
||||||
name: `provider_${randomName}`,
|
name: `provider_${randomName}`,
|
||||||
@ -75,6 +75,7 @@ class ProviderListPage extends React.Component {
|
|||||||
providers: Setting.prependRow(this.state.providers, newProvider),
|
providers: Setting.prependRow(this.state.providers, newProvider),
|
||||||
total: this.state.total + 1
|
total: this.state.total + 1
|
||||||
});
|
});
|
||||||
|
this.props.history.push(`/providers/${newProvider.name}`);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -554,3 +554,7 @@ export function getTags(tags) {
|
|||||||
export function getApplicationOrgName(application) {
|
export function getApplicationOrgName(application) {
|
||||||
return `${application?.organizationObj.owner}/${application?.organizationObj.name}`;
|
return `${application?.organizationObj.owner}/${application?.organizationObj.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getRandomName() {
|
||||||
|
return Math.random().toString(36).slice(-6);
|
||||||
|
}
|
||||||
|
@ -63,7 +63,8 @@ class TokenEditPage extends React.Component {
|
|||||||
<Card size="small" title={
|
<Card size="small" title={
|
||||||
<div>
|
<div>
|
||||||
{i18next.t("token:Edit Token")}
|
{i18next.t("token:Edit Token")}
|
||||||
<Button type="primary" onClick={this.submitTokenEdit.bind(this)}>{i18next.t("general:Save")}</Button>
|
<Button onClick={() => this.submitTokenEdit(false)}>{i18next.t("general:Save")}</Button>
|
||||||
|
<Button style={{marginLeft: '20px'}} type="primary" onClick={() => this.submitTokenEdit(true)}>{i18next.t("general:Save & Exit")}</Button>
|
||||||
</div>
|
</div>
|
||||||
} style={(Setting.isMobile())? {margin: '5px'}:{}} type="inner">
|
} style={(Setting.isMobile())? {margin: '5px'}:{}} type="inner">
|
||||||
<Row style={{marginTop: '10px'}} >
|
<Row style={{marginTop: '10px'}} >
|
||||||
@ -86,6 +87,26 @@ class TokenEditPage extends React.Component {
|
|||||||
}} />
|
}} />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
|
{i18next.t("general:Organization")}:
|
||||||
|
</Col>
|
||||||
|
<Col span={22} >
|
||||||
|
<Input value={this.state.token.organization} onChange={e => {
|
||||||
|
this.updateTokenField('organization', e.target.value);
|
||||||
|
}} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
|
{i18next.t("general:User")}:
|
||||||
|
</Col>
|
||||||
|
<Col span={22} >
|
||||||
|
<Input value={this.state.token.user} onChange={e => {
|
||||||
|
this.updateTokenField('user', e.target.value);
|
||||||
|
}} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
{i18next.t("general:Authorization code")}:
|
{i18next.t("general:Authorization code")}:
|
||||||
@ -140,7 +161,7 @@ class TokenEditPage extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
submitTokenEdit() {
|
submitTokenEdit(willExist) {
|
||||||
let token = Setting.deepCopy(this.state.token);
|
let token = Setting.deepCopy(this.state.token);
|
||||||
TokenBackend.updateToken(this.state.token.owner, this.state.tokenName, token)
|
TokenBackend.updateToken(this.state.token.owner, this.state.tokenName, token)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@ -149,7 +170,12 @@ class TokenEditPage extends React.Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
tokenName: this.state.token.name,
|
tokenName: this.state.token.name,
|
||||||
});
|
});
|
||||||
this.props.history.push(`/tokens/${this.state.token.name}`);
|
|
||||||
|
if (willExist) {
|
||||||
|
this.props.history.push(`/tokens`);
|
||||||
|
} else {
|
||||||
|
this.props.history.push(`/tokens/${this.state.token.name}`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", res.msg);
|
Setting.showMessage("error", res.msg);
|
||||||
this.updateTokenField('name', this.state.tokenName);
|
this.updateTokenField('name', this.state.tokenName);
|
||||||
@ -167,7 +193,8 @@ class TokenEditPage extends React.Component {
|
|||||||
this.state.token !== null ? this.renderToken() : null
|
this.state.token !== null ? this.renderToken() : null
|
||||||
}
|
}
|
||||||
<div style={{marginTop: '20px', marginLeft: '40px'}}>
|
<div style={{marginTop: '20px', marginLeft: '40px'}}>
|
||||||
<Button type="primary" size="large" onClick={this.submitTokenEdit.bind(this)}>{i18next.t("general:Save")}</Button>
|
<Button size="large" onClick={() => this.submitTokenEdit(false)}>{i18next.t("general:Save")}</Button>
|
||||||
|
<Button style={{marginLeft: '20px'}} type="primary" size="large" onClick={() => this.submitTokenEdit(true)}>{i18next.t("general:Save & Exit")}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -47,11 +47,14 @@ class TokenListPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newToken() {
|
newToken() {
|
||||||
|
const randomName = Setting.getRandomName();
|
||||||
return {
|
return {
|
||||||
owner: "admin", // this.props.account.tokenname,
|
owner: "admin", // this.props.account.tokenname,
|
||||||
name: `token_${Math.random().toString(36).slice(-6)}`,
|
name: `token_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
application: "app-built-in",
|
application: "app-built-in",
|
||||||
|
organization: "built-in",
|
||||||
|
user: "admin",
|
||||||
accessToken: "",
|
accessToken: "",
|
||||||
expiresIn: 7200,
|
expiresIn: 7200,
|
||||||
scope: "read",
|
scope: "read",
|
||||||
@ -68,6 +71,7 @@ class TokenListPage extends React.Component {
|
|||||||
tokens: Setting.prependRow(this.state.tokens, newToken),
|
tokens: Setting.prependRow(this.state.tokens, newToken),
|
||||||
total: this.state.total + 1
|
total: this.state.total + 1
|
||||||
});
|
});
|
||||||
|
this.props.history.push(`/tokens/${newToken.name}`);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -110,7 +110,8 @@ class UserEditPage extends React.Component {
|
|||||||
<Card size="small" title={
|
<Card size="small" title={
|
||||||
<div>
|
<div>
|
||||||
{i18next.t("user:Edit User")}
|
{i18next.t("user:Edit User")}
|
||||||
<Button type="primary" onClick={this.submitUserEdit.bind(this)}>{i18next.t("general:Save")}</Button>
|
<Button onClick={() => this.submitUserEdit(false)}>{i18next.t("general:Save")}</Button>
|
||||||
|
<Button style={{marginLeft: '20px'}} type="primary" onClick={() => this.submitUserEdit(true)}>{i18next.t("general:Save & Exit")}</Button>
|
||||||
</div>
|
</div>
|
||||||
} style={(Setting.isMobile())? {margin: '5px'}:{}} type="inner">
|
} style={(Setting.isMobile())? {margin: '5px'}:{}} type="inner">
|
||||||
<Row style={{marginTop: '10px'}} >
|
<Row style={{marginTop: '10px'}} >
|
||||||
@ -370,7 +371,7 @@ class UserEditPage extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
submitUserEdit() {
|
submitUserEdit(willExist) {
|
||||||
let user = Setting.deepCopy(this.state.user);
|
let user = Setting.deepCopy(this.state.user);
|
||||||
UserBackend.updateUser(this.state.organizationName, this.state.userName, user)
|
UserBackend.updateUser(this.state.organizationName, this.state.userName, user)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@ -382,7 +383,11 @@ class UserEditPage extends React.Component {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (this.props.history !== undefined) {
|
if (this.props.history !== undefined) {
|
||||||
this.props.history.push(`/users/${this.state.user.owner}/${this.state.user.name}`);
|
if (willExist) {
|
||||||
|
this.props.history.push(`/users`);
|
||||||
|
} else {
|
||||||
|
this.props.history.push(`/users/${this.state.user.owner}/${this.state.user.name}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", res.msg);
|
Setting.showMessage("error", res.msg);
|
||||||
@ -402,7 +407,8 @@ class UserEditPage extends React.Component {
|
|||||||
this.state.user !== null ? this.renderUser() : null
|
this.state.user !== null ? this.renderUser() : null
|
||||||
}
|
}
|
||||||
<div style={{marginTop: '20px', marginLeft: '40px'}}>
|
<div style={{marginTop: '20px', marginLeft: '40px'}}>
|
||||||
<Button type="primary" size="large" onClick={this.submitUserEdit.bind(this)}>{i18next.t("general:Save")}</Button>
|
<Button size="large" onClick={() => this.submitUserEdit(false)}>{i18next.t("general:Save")}</Button>
|
||||||
|
<Button style={{marginLeft: '20px'}} type="primary" size="large" onClick={() => this.submitUserEdit(true)}>{i18next.t("general:Save & Exit")}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -60,7 +60,7 @@ class UserListPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newUser() {
|
newUser() {
|
||||||
var randomName = Math.random().toString(36).slice(-6)
|
const randomName = Setting.getRandomName();
|
||||||
return {
|
return {
|
||||||
owner: "built-in", // this.props.account.username,
|
owner: "built-in", // this.props.account.username,
|
||||||
name: `user_${randomName}`,
|
name: `user_${randomName}`,
|
||||||
@ -81,6 +81,7 @@ class UserListPage extends React.Component {
|
|||||||
IsForbidden: false,
|
IsForbidden: false,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
properties: {},
|
properties: {},
|
||||||
|
signupApplication: "app-built-in",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,6 +94,7 @@ class UserListPage extends React.Component {
|
|||||||
users: Setting.prependRow(this.state.users, newUser),
|
users: Setting.prependRow(this.state.users, newUser),
|
||||||
total: this.state.total + 1
|
total: this.state.total + 1
|
||||||
});
|
});
|
||||||
|
this.props.history.push(`/users/${newUser.owner}/${newUser.name}`);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -78,7 +78,8 @@ class WebhookEditPage extends React.Component {
|
|||||||
<Card size="small" title={
|
<Card size="small" title={
|
||||||
<div>
|
<div>
|
||||||
{i18next.t("webhook:Edit Webhook")}
|
{i18next.t("webhook:Edit Webhook")}
|
||||||
<Button type="primary" onClick={this.submitWebhookEdit.bind(this)}>{i18next.t("general:Save")}</Button>
|
<Button onClick={() => this.submitWebhookEdit(false)}>{i18next.t("general:Save")}</Button>
|
||||||
|
<Button style={{marginLeft: '20px'}} type="primary" onClick={() => this.submitWebhookEdit(true)}>{i18next.t("general:Save & Exit")}</Button>
|
||||||
</div>
|
</div>
|
||||||
} style={(Setting.isMobile())? {margin: '5px'}:{}} type="inner">
|
} style={(Setting.isMobile())? {margin: '5px'}:{}} type="inner">
|
||||||
<Row style={{marginTop: '10px'}} >
|
<Row style={{marginTop: '10px'}} >
|
||||||
@ -154,7 +155,7 @@ class WebhookEditPage extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
submitWebhookEdit() {
|
submitWebhookEdit(willExist) {
|
||||||
let webhook = Setting.deepCopy(this.state.webhook);
|
let webhook = Setting.deepCopy(this.state.webhook);
|
||||||
WebhookBackend.updateWebhook(this.state.webhook.owner, this.state.webhookName, webhook)
|
WebhookBackend.updateWebhook(this.state.webhook.owner, this.state.webhookName, webhook)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@ -163,7 +164,12 @@ class WebhookEditPage extends React.Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
webhookName: this.state.webhook.name,
|
webhookName: this.state.webhook.name,
|
||||||
});
|
});
|
||||||
this.props.history.push(`/webhooks/${this.state.webhook.name}`);
|
|
||||||
|
if (willExist) {
|
||||||
|
this.props.history.push(`/webhooks`);
|
||||||
|
} else {
|
||||||
|
this.props.history.push(`/webhooks/${this.state.webhook.name}`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", res.msg);
|
Setting.showMessage("error", res.msg);
|
||||||
this.updateWebhookField('name', this.state.webhookName);
|
this.updateWebhookField('name', this.state.webhookName);
|
||||||
@ -181,7 +187,8 @@ class WebhookEditPage extends React.Component {
|
|||||||
this.state.webhook !== null ? this.renderWebhook() : null
|
this.state.webhook !== null ? this.renderWebhook() : null
|
||||||
}
|
}
|
||||||
<div style={{marginTop: '20px', marginLeft: '40px'}}>
|
<div style={{marginTop: '20px', marginLeft: '40px'}}>
|
||||||
<Button type="primary" size="large" onClick={this.submitWebhookEdit.bind(this)}>{i18next.t("general:Save")}</Button>
|
<Button size="large" onClick={() => this.submitWebhookEdit(false)}>{i18next.t("general:Save")}</Button>
|
||||||
|
<Button style={{marginLeft: '20px'}} type="primary" size="large" onClick={() => this.submitWebhookEdit(true)}>{i18next.t("general:Save & Exit")}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -47,14 +47,14 @@ class WebhookListPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newWebhook() {
|
newWebhook() {
|
||||||
var randomName = Math.random().toString(36).slice(-6)
|
const randomName = Setting.getRandomName();
|
||||||
return {
|
return {
|
||||||
owner: "admin", // this.props.account.webhookname,
|
owner: "admin", // this.props.account.webhookname,
|
||||||
name: `webhook_${randomName}`,
|
name: `webhook_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
url: "https://example.com/callback",
|
url: "https://example.com/callback",
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
events: [],
|
events: ["signup", "login", "logout", "update-user"],
|
||||||
organization: "built-in",
|
organization: "built-in",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,6 +68,7 @@ class WebhookListPage extends React.Component {
|
|||||||
webhooks: Setting.prependRow(this.state.webhooks, newWebhook),
|
webhooks: Setting.prependRow(this.state.webhooks, newWebhook),
|
||||||
total: this.state.total + 1
|
total: this.state.total + 1
|
||||||
});
|
});
|
||||||
|
this.props.history.push(`/webhooks/${newWebhook.name}`);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user