Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new readonly plugin configuration field #1106

Merged
merged 1 commit into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ enum AccountErrorCode {
JWT_DECODE_ERROR
JWT_MISSING_TOKEN
JWT_INVALID_CSRF_TOKEN
CHANNEL_INACTIVE
MISSING_CHANNEL_SLUG
}

input AccountInput {
Expand All @@ -91,6 +93,7 @@ input AccountRegisterInput {
redirectUrl: String
languageCode: LanguageCodeEnum
metadata: [MetadataInput!]
channel: String
}

type AccountRequestDeletion {
Expand Down Expand Up @@ -887,7 +890,6 @@ type Checkout implements Node & ObjectWithMetadata {
created: DateTime!
lastChange: DateTime!
user: User
quantity: Int!
channel: Channel!
billingAddress: Address
shippingAddress: Address
Expand All @@ -904,6 +906,7 @@ type Checkout implements Node & ObjectWithMetadata {
availablePaymentGateways: [PaymentGateway!]!
email: String!
isShippingRequired: Boolean!
quantity: Int!
lines: [CheckoutLine]
shippingPrice: TaxedMoney
shippingMethod: ShippingMethod
Expand Down Expand Up @@ -1299,6 +1302,7 @@ enum ConfigurationTypeFieldEnum {
SECRET
PASSWORD
SECRETMULTILINE
OUTPUT
}

type ConfirmAccount {
Expand Down Expand Up @@ -2751,7 +2755,7 @@ type Mutation {
paymentCapture(amount: PositiveDecimal, paymentId: ID!): PaymentCapture
paymentRefund(amount: PositiveDecimal, paymentId: ID!): PaymentRefund
paymentVoid(paymentId: ID!): PaymentVoid
paymentInitialize(gateway: String!, paymentData: JSONString): PaymentInitialize
paymentInitialize(channel: String, gateway: String!, paymentData: JSONString): PaymentInitialize
pageCreate(input: PageCreateInput!): PageCreate
pageDelete(id: ID!): PageDelete
pageBulkDelete(ids: [ID]!): PageBulkDelete
Expand Down Expand Up @@ -2891,19 +2895,19 @@ type Mutation {
externalRefresh(input: JSONString!, pluginId: String!): ExternalRefresh
externalLogout(input: JSONString!, pluginId: String!): ExternalLogout
externalVerify(input: JSONString!, pluginId: String!): ExternalVerify
requestPasswordReset(email: String!, redirectUrl: String!): RequestPasswordReset
requestPasswordReset(channel: String, email: String!, redirectUrl: String!): RequestPasswordReset
confirmAccount(email: String!, token: String!): ConfirmAccount
setPassword(email: String!, password: String!, token: String!): SetPassword
passwordChange(newPassword: String!, oldPassword: String!): PasswordChange
requestEmailChange(newEmail: String!, password: String!, redirectUrl: String!): RequestEmailChange
confirmEmailChange(token: String!): ConfirmEmailChange
requestEmailChange(channel: String, newEmail: String!, password: String!, redirectUrl: String!): RequestEmailChange
confirmEmailChange(channel: String, token: String!): ConfirmEmailChange
accountAddressCreate(input: AddressInput!, type: AddressTypeEnum): AccountAddressCreate
accountAddressUpdate(id: ID!, input: AddressInput!): AccountAddressUpdate
accountAddressDelete(id: ID!): AccountAddressDelete
accountSetDefaultAddress(id: ID!, type: AddressTypeEnum!): AccountSetDefaultAddress
accountRegister(input: AccountRegisterInput!): AccountRegister
accountUpdate(input: AccountInput!): AccountUpdate
accountRequestDeletion(redirectUrl: String!): AccountRequestDeletion
accountRequestDeletion(channel: String, redirectUrl: String!): AccountRequestDeletion
accountDelete(token: String!): AccountDelete
addressCreate(input: AddressInput!, userId: ID!): AddressCreate
addressUpdate(id: ID!, input: AddressInput!): AddressUpdate
Expand Down Expand Up @@ -3579,9 +3583,9 @@ enum PageErrorCode {
}

input PageFilterInput {
pageTypes: [ID!]
search: String
metadata: [MetadataInput]
pageTypes: [ID]
}

type PageInfo {
Expand Down Expand Up @@ -5185,7 +5189,7 @@ input ShippingZoneUpdateInput {
}

type Shop {
availablePaymentGateways(currency: String): [PaymentGateway!]!
availablePaymentGateways(currency: String, channel: String): [PaymentGateway!]!
availableExternalAuthentications: [ExternalAuthentication!]!
availableShippingMethods(channel: String!, address: AddressInput): [ShippingMethod]
countries(languageCode: LanguageCodeEnum): [CountryDisplay!]!
Expand Down Expand Up @@ -5609,7 +5613,7 @@ type User implements Node & ObjectWithMetadata {
editableGroups: [Group]
avatar(size: Int): Image
events: [CustomerEvent]
storedPaymentSources: [PaymentSource]
storedPaymentSources(channel: String): [PaymentSource]
languageCode: LanguageCodeEnum!
}

Expand Down Expand Up @@ -5652,6 +5656,7 @@ input UserCreateInput {
note: String
languageCode: LanguageCodeEnum
redirectUrl: String
channel: String
}

type UserPermission {
Expand Down Expand Up @@ -6150,4 +6155,4 @@ union _Entity = Address | User | Group | App | ProductVariant | Product | Produc

type _Service {
sdl: String
}
}
9 changes: 8 additions & 1 deletion src/plugins/components/PluginSettings/PluginSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ const PluginSettings: React.FC<PluginSettingsProps> = ({
fieldData.type === ConfigurationTypeFieldEnum.MULTILINE
}
InputProps={{
rowsMax: 6
rowsMax: 6,
readOnly:
fieldData.type === ConfigurationTypeFieldEnum.OUTPUT
}}
onFocus={event => {
if (fieldData.type === ConfigurationTypeFieldEnum.OUTPUT) {
event.target.select();
}
}}
fullWidth
value={field.value}
Expand Down
6 changes: 5 additions & 1 deletion src/types/globalTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
export enum AccountErrorCode {
ACTIVATE_OWN_ACCOUNT = "ACTIVATE_OWN_ACCOUNT",
ACTIVATE_SUPERUSER_ACCOUNT = "ACTIVATE_SUPERUSER_ACCOUNT",
CHANNEL_INACTIVE = "CHANNEL_INACTIVE",
DEACTIVATE_OWN_ACCOUNT = "DEACTIVATE_OWN_ACCOUNT",
DEACTIVATE_SUPERUSER_ACCOUNT = "DEACTIVATE_SUPERUSER_ACCOUNT",
DELETE_NON_STAFF_USER = "DELETE_NON_STAFF_USER",
Expand All @@ -28,6 +29,7 @@ export enum AccountErrorCode {
JWT_MISSING_TOKEN = "JWT_MISSING_TOKEN",
JWT_SIGNATURE_EXPIRED = "JWT_SIGNATURE_EXPIRED",
LEFT_NOT_MANAGEABLE_PERMISSION = "LEFT_NOT_MANAGEABLE_PERMISSION",
MISSING_CHANNEL_SLUG = "MISSING_CHANNEL_SLUG",
NOT_FOUND = "NOT_FOUND",
OUT_OF_SCOPE_GROUP = "OUT_OF_SCOPE_GROUP",
OUT_OF_SCOPE_PERMISSION = "OUT_OF_SCOPE_PERMISSION",
Expand Down Expand Up @@ -155,6 +157,7 @@ export enum CollectionSortField {
export enum ConfigurationTypeFieldEnum {
BOOLEAN = "BOOLEAN",
MULTILINE = "MULTILINE",
OUTPUT = "OUTPUT",
PASSWORD = "PASSWORD",
SECRET = "SECRET",
SECRETMULTILINE = "SECRETMULTILINE",
Expand Down Expand Up @@ -1534,9 +1537,9 @@ export interface PageCreateInput {
}

export interface PageFilterInput {
pageTypes?: string[] | null;
search?: string | null;
metadata?: (MetadataInput | null)[] | null;
pageTypes?: (string | null)[] | null;
}

export interface PageInput {
Expand Down Expand Up @@ -1945,6 +1948,7 @@ export interface UserCreateInput {
note?: string | null;
languageCode?: LanguageCodeEnum | null;
redirectUrl?: string | null;
channel?: string | null;
}

export interface UserSortingInput {
Expand Down