fix: replace the wrong param name willExist (#2389)

This commit is contained in:
wxy
2023-10-10 21:47:38 +08:00
committed by GitHub
parent 9aec69ef47
commit 684cbdb951
20 changed files with 41 additions and 41 deletions

View File

@ -272,7 +272,7 @@ class AdapterEditPage extends React.Component {
);
}
submitAdapterEdit(willExist) {
submitAdapterEdit(exitAfterSave) {
const adapter = Setting.deepCopy(this.state.adapter);
AdapterBackend.updateAdapter(this.state.organizationName, this.state.adapterName, adapter)
.then((res) => {
@ -282,7 +282,7 @@ class AdapterEditPage extends React.Component {
adapterName: this.state.adapter.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/adapters");
} else {
this.props.history.push(`/adapters/${this.state.organizationName}/${this.state.adapter.name}`);

View File

@ -1001,7 +1001,7 @@ class ApplicationEditPage extends React.Component {
);
}
submitApplicationEdit(willExist) {
submitApplicationEdit(exitAfterSave) {
const application = Setting.deepCopy(this.state.application);
application.providers = application.providers?.filter(provider => this.state.providers.map(provider => provider.name).includes(provider.name));
@ -1013,7 +1013,7 @@ class ApplicationEditPage extends React.Component {
applicationName: this.state.application.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/applications");
} else {
this.props.history.push(`/applications/${this.state.application.organization}/${this.state.application.name}`);

View File

@ -251,7 +251,7 @@ class CertEditPage extends React.Component {
);
}
submitCertEdit(willExist) {
submitCertEdit(exitAfterSave) {
const cert = Setting.deepCopy(this.state.cert);
CertBackend.updateCert(this.state.owner, this.state.certName, cert)
.then((res) => {
@ -261,7 +261,7 @@ class CertEditPage extends React.Component {
certName: this.state.cert.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/certs");
} else {
this.props.history.push(`/certs/${this.state.cert.owner}/${this.state.cert.name}`);

View File

@ -198,7 +198,7 @@ class EnforcerEditPage extends React.Component {
);
}
submitEnforcerEdit(willExist) {
submitEnforcerEdit(exitAfterSave) {
const enforcer = Setting.deepCopy(this.state.enforcer);
EnforcerBackend.updateEnforcer(this.state.organizationName, this.state.enforcerName, enforcer)
.then((res) => {
@ -208,7 +208,7 @@ class EnforcerEditPage extends React.Component {
enforcerName: this.state.enforcer.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/enforcers");
} else {
this.props.history.push(`/enforcers/${this.state.enforcer.owner}/${this.state.enforcer.name}`);

View File

@ -191,7 +191,7 @@ class GroupEditPage extends React.Component {
);
}
submitGroupEdit(willExist) {
submitGroupEdit(exitAfterSave) {
const group = Setting.deepCopy(this.state.group);
group["isTopGroup"] = this.state.organizations.some((organization) => organization.name === group.parentId);
@ -203,7 +203,7 @@ class GroupEditPage extends React.Component {
groupName: this.state.group.name,
});
if (willExist) {
if (exitAfterSave) {
const groupTreeUrl = sessionStorage.getItem("groupTreeUrl");
if (groupTreeUrl !== null) {
sessionStorage.removeItem("groupTreeUrl");

View File

@ -230,7 +230,7 @@ class LdapEditPage extends React.Component {
);
}
submitLdapEdit(willExist) {
submitLdapEdit(exitAfterSave) {
LddpBackend.updateLdap(this.state.ldap)
.then((res) => {
if (res.status === "ok") {
@ -239,7 +239,7 @@ class LdapEditPage extends React.Component {
organizationName: this.state.ldap.owner,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push(`/organizations/${this.state.organizationName}`);
}
} else {

View File

@ -165,7 +165,7 @@ class ModelEditPage extends React.Component {
);
}
submitModelEdit(willExist) {
submitModelEdit(exitAfterSave) {
const model = Setting.deepCopy(this.state.model);
ModelBackend.updateModel(this.state.organizationName, this.state.modelName, model)
.then((res) => {
@ -175,7 +175,7 @@ class ModelEditPage extends React.Component {
modelName: this.state.model.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/models");
} else {
this.props.history.push(`/models/${this.state.model.owner}/${this.state.model.name}`);

View File

@ -411,7 +411,7 @@ class OrganizationEditPage extends React.Component {
);
}
submitOrganizationEdit(willExist) {
submitOrganizationEdit(exitAfterSave) {
const organization = Setting.deepCopy(this.state.organization);
organization.accountItems = organization.accountItems?.filter(accountItem => accountItem.name !== "Please select an account item");
@ -429,7 +429,7 @@ class OrganizationEditPage extends React.Component {
});
window.dispatchEvent(new Event("storageOrganizationsChanged"));
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/organizations");
} else {
this.props.history.push(`/organizations/${this.state.organization.name}`);

View File

@ -438,7 +438,7 @@ class PaymentEditPage extends React.Component {
return "";
}
submitPaymentEdit(willExist) {
submitPaymentEdit(exitAfterSave) {
const errorText = this.checkError();
if (errorText !== "") {
Setting.showMessage("error", errorText);
@ -454,7 +454,7 @@ class PaymentEditPage extends React.Component {
paymentName: this.state.payment.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/payments");
} else {
this.props.history.push(`/payments/${this.state.payment.name}`);

View File

@ -444,7 +444,7 @@ class PermissionEditPage extends React.Component {
);
}
submitPermissionEdit(willExist) {
submitPermissionEdit(exitAfterSave) {
if (this.state.permission.users.length === 0 && this.state.permission.roles.length === 0) {
Setting.showMessage("error", "The users and roles cannot be empty at the same time");
return;
@ -475,7 +475,7 @@ class PermissionEditPage extends React.Component {
permissionName: this.state.permission.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/permissions");
} else {
this.props.history.push(`/permissions/${this.state.permission.owner}/${encodeURIComponent(this.state.permission.name)}`);

View File

@ -263,7 +263,7 @@ class PlanEditPage extends React.Component {
);
}
submitPlanEdit(willExist) {
submitPlanEdit(exitAfterSave) {
const plan = Setting.deepCopy(this.state.plan);
PlanBackend.updatePlan(this.state.organizationName, this.state.planName, plan)
.then((res) => {
@ -273,7 +273,7 @@ class PlanEditPage extends React.Component {
planName: this.state.plan.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/plans");
} else {
this.props.history.push(`/plans/${this.state.plan.owner}/${this.state.plan.name}`);

View File

@ -226,7 +226,7 @@ class PricingEditPage extends React.Component {
);
}
submitPricingEdit(willExist) {
submitPricingEdit(exitAfterSave) {
const pricing = Setting.deepCopy(this.state.pricing);
PricingBackend.updatePricing(this.state.organizationName, this.state.pricingName, pricing)
.then((res) => {
@ -236,7 +236,7 @@ class PricingEditPage extends React.Component {
pricingName: this.state.pricing.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/pricings");
} else {
this.props.history.push(`/pricings/${this.state.pricing.owner}/${this.state.pricing.name}`);

View File

@ -311,7 +311,7 @@ class ProductEditPage extends React.Component {
);
}
submitProductEdit(willExist) {
submitProductEdit(exitAfterSave) {
const product = Setting.deepCopy(this.state.product);
ProductBackend.updateProduct(this.state.organizationName, this.state.productName, product)
.then((res) => {
@ -321,7 +321,7 @@ class ProductEditPage extends React.Component {
productName: this.state.product.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/products");
} else {
this.props.history.push(`/products/${this.state.product.owner}/${this.state.product.name}`);

View File

@ -1198,7 +1198,7 @@ class ProviderEditPage extends React.Component {
);
}
submitProviderEdit(willExist) {
submitProviderEdit(exitAfterSave) {
const provider = Setting.deepCopy(this.state.provider);
ProviderBackend.updateProvider(this.state.owner, this.state.providerName, provider)
.then((res) => {
@ -1209,7 +1209,7 @@ class ProviderEditPage extends React.Component {
providerName: this.state.provider.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/providers");
} else {
this.props.history.push(`/providers/${this.state.provider.owner}/${this.state.provider.name}`);

View File

@ -240,7 +240,7 @@ class RoleEditPage extends React.Component {
);
}
submitRoleEdit(willExist) {
submitRoleEdit(exitAfterSave) {
const role = Setting.deepCopy(this.state.role);
RoleBackend.updateRole(this.state.organizationName, this.state.roleName, role)
.then((res) => {
@ -250,7 +250,7 @@ class RoleEditPage extends React.Component {
roleName: this.state.role.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/roles");
} else {
this.props.history.push(`/roles/${this.state.role.owner}/${encodeURIComponent(this.state.role.name)}`);

View File

@ -294,7 +294,7 @@ class SubscriptionEditPage extends React.Component {
);
}
submitSubscriptionEdit(willExist) {
submitSubscriptionEdit(exitAfterSave) {
const subscription = Setting.deepCopy(this.state.subscription);
SubscriptionBackend.updateSubscription(this.state.organizationName, this.state.subscriptionName, subscription)
.then((res) => {
@ -304,7 +304,7 @@ class SubscriptionEditPage extends React.Component {
subscriptionName: this.state.subscription.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/subscriptions");
} else {
this.props.history.push(`/subscriptions/${this.state.subscription.owner}/${this.state.subscription.name}`);

View File

@ -425,7 +425,7 @@ class SyncerEditPage extends React.Component {
);
}
submitSyncerEdit(willExist) {
submitSyncerEdit(exitAfterSave) {
const syncer = Setting.deepCopy(this.state.syncer);
SyncerBackend.updateSyncer(this.state.syncer.owner, this.state.syncerName, syncer)
.then((res) => {
@ -435,7 +435,7 @@ class SyncerEditPage extends React.Component {
syncerName: this.state.syncer.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/syncers");
} else {
this.props.history.push(`/syncers/${this.state.syncer.name}`);

View File

@ -173,7 +173,7 @@ class TokenEditPage extends React.Component {
);
}
submitTokenEdit(willExist) {
submitTokenEdit(exitAfterSave) {
const token = Setting.deepCopy(this.state.token);
TokenBackend.updateToken(this.state.token.owner, this.state.tokenName, token)
.then((res) => {
@ -183,7 +183,7 @@ class TokenEditPage extends React.Component {
tokenName: this.state.token.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/tokens");
} else {
this.props.history.push(`/tokens/${this.state.token.name}`);

View File

@ -1043,7 +1043,7 @@ class UserEditPage extends React.Component {
}
}
submitUserEdit(needExit) {
submitUserEdit(exitAfterSave) {
const user = Setting.deepCopy(this.state.user);
UserBackend.updateUser(this.state.organizationName, this.state.userName, user)
.then((res) => {
@ -1055,7 +1055,7 @@ class UserEditPage extends React.Component {
});
if (this.props.history !== undefined) {
if (needExit) {
if (exitAfterSave) {
const userListUrl = sessionStorage.getItem("userListUrl");
if (userListUrl !== null) {
this.props.history.push(userListUrl);
@ -1066,7 +1066,7 @@ class UserEditPage extends React.Component {
this.props.history.push(`/users/${this.state.user.owner}/${this.state.user.name}`);
}
} else {
if (needExit) {
if (exitAfterSave) {
if (this.state.returnUrl) {
window.location.href = this.state.returnUrl;
}

View File

@ -322,7 +322,7 @@ class WebhookEditPage extends React.Component {
);
}
submitWebhookEdit(willExist) {
submitWebhookEdit(exitAfterSave) {
const webhook = Setting.deepCopy(this.state.webhook);
WebhookBackend.updateWebhook(this.state.webhook.owner, this.state.webhookName, webhook)
.then((res) => {
@ -332,7 +332,7 @@ class WebhookEditPage extends React.Component {
webhookName: this.state.webhook.name,
});
if (willExist) {
if (exitAfterSave) {
this.props.history.push("/webhooks");
} else {
this.props.history.push(`/webhooks/${this.state.webhook.name}`);