I have the following template for the issues, I would like to do that when for example the second field Additional context is empty, then the user does not put any text.
When the issues is created, instead of writing me "No response", I would like the Additional context field not to be put.
Can you tell me if it can be done?
name: 🐛 Bug Report
description: Create a report to help us improve
title: "🐛 [BUG] - YOUR_DESCRIPTION"
labels: [🐛 bug]
body:
- type: textarea
attributes:
label: Describe the bug
placeholder: A clear and concise description of what the bug is.
- type: textarea
attributes:
label: Additional context
placeholder: Add any other context about the problem here.
Related
I am working on chat functionality using AWS Amplify and I have a simple Post model in my graphql schema:
type Post
...
{
id: ID!
channelId: ID #index(
name: "byChannel", sortKeyFields: ["createdAt"],
queryField: "listPostsByChannel"
)
customerId: ID #index(
name: "byCustomer", sortKeyFields: ["postType", "createdAt"]
)
text: String!
postTempId: String
postType: String
reactions: [PostReaction] #hasMany(fields: ["id"])
createdAt: AWSDateTime
updatedAt: AWSDateTime
}
What I want to achieve is to have similar to other popular chat apps - reactions with emojis attached to each post, so I've created another table and the PostReaction model.
type PostReaction
...
{
postId: ID! #primaryKey(sortKeyFields: ["customerId", "emojiUnicode"])
customerId: String!
customerMeta: CustomerMeta
emojiUnicode: String!
createdAt: AWSDateTime
updatedAt: AWSDateTime
}
Of course, each customer could add multiple emojis to a single post, the custom primary key is for handling duplicates later.
There is one disadvantage here.
Emojis will be listed in an array in the reactions field in the post, even if it's the same emoji added by many people.
Instead of a simple array of reactions that frontend would need to merge for each post, the best would be to get a result from the AppSync query for each Post like:
...
reactions: [{
emojiUnicode: "U+1F44D",
customerIds: ["ID1234", "ID5678"],
...
}, {...}]
I thought that I can use a JSON object in the reactions field, but the DynamoDB has the max size limit for a single item which is 400KB. That's not a problem for now, but next when I will add more attributes to the Post model, and when there will be many reactions from many people at the same time, this might be an issue.
Is there an option how to achieve this in the simplest way?
Best thing to not over-complicate your schema would be to enforce a maximum number of emojis just as Slack does for example:
You can add up to 23 emoji reactions to any message, but the maximum per message is 50 unique emoji.
Other than that, you could keep an item for each emoji reacted
pk
sk
data
thread123
metadata
metadata about thread
thread123
post#001
First message in thread
thread123
post#002
Second message in thread
thread123
post#003
Third message in thread
thread123
post#003#emoji#U+1F44D
[user1, user2, user45]
thread123
post#003#emoji#U+1F33R
[user56, user8, user7, user10]
Now when you want all the data to populate a given thread on your UI, you just issue a query with the pk as a parameter:
SELECT * FROM table WHERE PK = 'thread123'
I'm fairly new to Amplify. I ran the amplify commands to create the src/models/index.d.ts and the generated API file, src/app/API.ts files. Each of these have the same types generated except that embedded collections generated via #belogsTo and #hasMany is not on the type in API.ts but IS on index.d.ts. When I try running the code I have a JSON object that I've cast to the model in src/app/API.ts. Like I say, there is an embedded collection that does NOT show up on the API file. Here is what I have for the schema file schema.graphql.
EDIT: It appears there are multiple ways to do the same thing, such as getting, updating, and deleting data. I think that using API.ts is the latests way to do it? I'm just totally confused by all of this.
type Blog #model {
id: ID! #primaryKey
name: String!
posts: [Post] #hasMany
}
type Post #model {
id: ID! #primaryKey
title: String!
blog: Blog #belongsTo
comments: [Comment] #hasMany
}
type Comment #model {
id: ID! #primaryKey
post: Post #belongsTo
content: String!
}
The API model that was generated does not have comments on type Post. Here is the generated code in the API file:
export type CreatePostInput = {
id?: string | null;
title: string;
blogPostsId?: string | null;
};
That is the type that is passed into CreatePostInput. When I try to specify the json:
const json = {
blogPostsId: 'Some Random UUID String',
title: 'MyPost',
} as Post;
I cannot add a comments array to this json because CreatePostInput and Post models does not contain comments that I specified on the schema.graphql.
My question is, first, what definition of Blog should I be using, the one in the index.t.ds file or the definition in the API file? If the answer is the one in index.d.ts, how to do go about creating one because the CreateBlogInput is the type that CreatePost in API.ts file.
I've tried different things that I've found on the interwebs from AWS blogs to Medium posts.
Is there a way to conditionally set more than one AuthStrategy depending on a field in the table?
Let's say I have a blog Post type:
type Post
#model
#auth(rules: [
{ allow: owner, operations: [read, update, delete] },
])
{
id: ID!
owner: String!
visibility: Visibility!
title: String!
body: String!
whitelist: [String!]
}
enum Visibility {
PUBLIC,
PRIVATE,
PROTECTED,
SECRET
}
I want the creator to be able to set whether the Post is:
Public: anyone can see it, logged in or not.
Private: any logged-in user can see it.
Protected: this array of users can see it.
Secret: only the creator can see it.
I know how to hardcode each of these. But programmatically...
Is this even possible, or are AppSync transforms just too basic, and I need to use a custom resolver?
It turns out, this does require a custom resolver—or custom, nested resolver—which is pretty easy.
The official docs on this authorization scenario: https://docs.aws.amazon.com/appsync/latest/devguide/security-authorization-use-cases.html.
And a great Hacker Noon article on this authorization scenario: https://hackernoon.com/graphql-authorization-with-multiple-data-sources-using-aws-appsync-dfae2e350bf2.
For my custom Drupal 8 (8.7.8) module, I have the following ...
my_module.reports:
route_name: my_module.reports
title: 'Reports'
base_route: my_module.dashboard
weight: 80
in my menu system in my_module.links.menu.yml and it appears as a tab on my dashboard I'm building. On that page, the route controller I have is...
_controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
I'm hoping to make there a list of further links to reports. But this (from my_module.links.menu.yml) ...
my_module.reports.territories:
title: 'Territories'
description: '...'
route_name: my_module.reports.territories
parent: my_module.reports
weight: 10
Doesn't show up. All I get when I go to that page is:
"You do not have any administrative items."
What am I missing? Is it somehow not possible to make children of tasks in this way or is this something else?
Thanks!
Finally worked it out. I had to ALSO add ...
my_module.reports:
title: 'Reports'
parent: system.admin_config
route_name: my_module.reports
... to my_module.links.menu.yml. I could then leave the link in my_module.links.task.yml as well to create the final thing I wanted.
Is there any way to apply a template to the selected value of a ComboBox? I'm using a template to display the drop down values of the ComboBox, but as soon as i select one, the plain value from the datastore is shown.
{
id: 'requestStatusCombo',
hiddenName: 'requestStatus',
tpl: '<tpl for="."><div class="x-combo-list-item">{statusCode:requestStatus}</div></tpl>',
fieldLabel: 'Status',
xtype: 'combo',
mode: 'local',
triggerAction: 'all',
store: new Ext.data.ArrayStore({
fields: ['statusCode'],
data: [['unassigned'],['assigned'],['closed']]
}),
valueField: 'statusCode',
displayField: 'statusCode'
}
I want to use my format function requestStatus to translate the statusCodes into locale spesific status names, and this works well for the drop down list, but as soon as I select something, the statusCode is shown.
So is it possible to assign a template to the displayField, or perhaps do some simple batch modification on the datastore? By processing the input through a reader maybe? Is there another <tpl for="?"> keyword that will make this happen?
I'm looking for some simple method utilizing the Ext library. If the only solution is to pre process the data, I'm capable of doing that myself.
I found a solution!
I changed my datastore, and added a reader to pre-process the status using a convert function:
{
id: 'requestStatusCombo',
hiddenName: 'requestStatus',
fieldLabel: 'Status',
xtype: 'combo',
mode: 'local',
triggerAction: 'all',
store: new Ext.data.Store({
data: [['unassigned'],['assigned'],['closed']],
reader: new Ext.data.ArrayReader({},[
{name: 'statusCode', mapping: 0},
{name: 'displayname', mapping: 0, convert: function(statusCode) {
return Ext.util.Format.requestStatus(statusCode);
}}
])
}),
valueField: 'statusCode',
displayField: 'displayname'
}
Examinig generated DOM you will notice that while list elements are DIVs, the field itself is html INPUT element. You can't have HTML within INPUT element... so no... no xtemplate here.
This does not mean it can't be done by extending Ext.form.ComboBox (or Ext.Component maybe)