How to enable multiple views at once using dojox/app? - dojo

I am building a web application using dojox/app, and my config.json file is the following:
{
"id": "app",
"name": "app",
"description": "My app",
"dependencies": [
"commonapp/app",
"commonapp/BaseViewController",
"dojo/store/Memory",
"dojox/app/utils/mvcModel",
"dojox/mvc/EditStoreRefListController",
"dojo/store/Observable"
],
"controllers": [
"dojox/app/controllers/Load",
"dojox/app/controllers/Transition",
"dojox/app/controllers/Layout",
"dojox/app/controllers/HistoryHash"],
"stores": {
},
"models": {
},
"defaultView": "MainTemplate",
"views": {
"MainTemplate": {
"template": "commonapp/templates/MainTemplate.html",
"controller": "commonapp/templates/MainTemplate.js",
"nls": "commonapp/templates/nls/MainTemplate",
"defaultView": "LoginView",
"views": {
"LoginView": {
"template": "commonapp/login/LoginView.html",
"controller": "commonapp/login/LoginView.js",
"nls": "commonapp/login/nls/LoginView"
},
"AppView": {
"template": "commonapp/app/AppView.html",
"controller": "commonapp/app/AppView.js",
"nls": "commonapp/app/nls/AppView",
"views": {
"LeftContainerView": {
"template": "commonapp/app/leftContainer/LeftContainerView.html",
"controller": "commonapp/app/leftContainer/LeftContainerView.js",
"nls": "commonapp/app/leftContainer/nls/LeftContainerView"
},
"RightContainerView": {
"template": "commonapp/app/rightContainer/RightContainerView.html",
"controller": "commonapp/app/rightContainer/RightContainerView.js",
"nls": "commonapp/app/rightContainer/nls/RightContainerView"
}
}
}
}
}
}
}
Everything works fine until I added the LeftContainerView and RightContainerView. In this particular case, I want both views to be active at the same time. The problem is, if I set a default view for either LeftContainerView or RightContainerView, one the default one appears. But, if I programatically trigger events to show both views when the AppView is loaded, one of them will be automatically hidden, and the problem stays.
Basically, the idea is that AppView will have a fixedsplitter, and on each of the panes, I want to place one of the child views. Does anyone have an idea of how can I get both LeftContainerView and RightContainerView active at the same time?

Did you try this way:
"defaultView": "LeftContainerView+RightContainerView"
as indicated in https://dojotoolkit.org/reference-guide/1.9/dojox/app.html#defaultview ?
(Would also be useful to tell the Dojo version you are using.)

Related

Change syntax highlighting of embedded code based on a previous line's keyword?

I'm trying to write a TextMate grammar for a VS Code language extension. Take the following example
(lang=css attribute2=something-else)
"""
.css-class {
background: gray;
}
"""
The (...) part is an "attributes" section, and the """ ... """ is a code section. I'm trying to highlight everything in the code section according to the lang attribute.
The problem is, they are two distinct sections where one might be present without the other in other parts of the file. For example, you can have attributes without the code block.
In the grammars section of package.json I have
"embeddedLanguages": {
"meta.embedded.block.css": "css",
"meta.embedded.block.javascript": "javascript"
}
In the tmLanguage.json file I have both patterns in the repository property.
"attributes": {
"begin": "\\(",
"end": "\\)",
"captures": {
"0": {
"name": "punctuation.definition.annotation punctuation.section.group punctuation.section.parens"
}
},
"patterns": [
{
"begin": "[a-zA-Z_][a-zA-Z0-9_\\.-]*",
"beginCaptures": {
"0": {
"name": "entity.other.attribute-name"
}
},
"end": "(?=\\s*+[^=\\s])",
"patterns": [
{
"begin": "=",
"beginCaptures": {
"0": {
"name": "punctuation.separator.key-value"
}
},
"end": "(?<=[^\\s=])(?!\\s*=)|(?=/?>)",
"patterns": [
{
"match": "([^0-9-.\\s='\"][^\\s='\")]*)",
"name": "string.unquoted.html"
},
{
"match": "=",
"name": "invalid.illegal.unexpected-equals-sign"
},
{
"include": "#strings"
},
{
"include": "#number"
}
]
}
]
}
]
},
"fenced-code": {
"begin": "\\(.*lang=(css|javascript).*\\)\\s*(\"\"\")",
"beginCaptures": {
"1": {
"name": "string.quoted.triple"
}
},
"end": "\"\"\"",
"endCaptures": {
"0": {
"name": "string.quoted.triple"
}
},
"contentName": "meta.embedded.block.$1",
"patterns": [
{
"include": "source.css"
}
]
}
I have a third pattern not shown where I'm using these together by including them in its patterns array. They seem to be mutually exclusive though. I can have the attributes, and I can have a code block if I start the pattern at """, but if I start the code pattern with \\(.*lang=(css|javascript).*\\)\\s*(\"\"\") to capture the lang attribute, the attributes stop getting highlighting.
Is this even possible? I've never worked with TextMate grammars outside of a VS Code theme and VS Code doesn't seem to have deep documentation on the more "advanced" (I guess) things like this.
I tried using VS Code's HTML grammar for its uses of embedded code, but I don't think the HTML one needs to swap syntax based on something in a previous line.
Update
The fenced-code pattern I have below allows the attributes pattern highlighting while also having the code block with dynamic contentName property, i.e. "meta.embedded.block.$2" becomes meta.embedded.block.css when "css" is found in attributes.
"fenced-code": {
"begin": "(\\(.*lang=(css|javascript).*\\))\\s*(\"\"\")",
"beginCaptures": {
"1": {
"patterns": [
{
"include": "#attributes"
}
]
},
"3": {
"name": "string.quoted.triple"
}
},
"end": "\"\"\"",
"endCaptures": {
"0": {
"name": "string.quoted.triple"
}
},
"contentName": "meta.embedded.block.$2",
"patterns": [
{
"include": "source.css"
},
{
"include": "source.js"
}
]
}
However, there's two things wrong so far.
It only works when the opening """ is on the same line as the attributes section
fenced-code's patterns array doesn't seem to allow a dynamic include, i.e. "patterns": [{"include": "source.$2}]. I'm not sure if including the different languages as I did above will work

How to update the status on a Jira issue vis Jira Rest Api

I want to change the status of the project issue on Jira. The status is Open and I want to make it Fixed. My url is PUT https://jiradbg-sandbox.deutsche-boerse.de/rest/api/latest/issue/PID-XX
{
"update": {
"fields":{
"status": [
{
"set": "Fixed"
}
]
}
}
}
and the response is:
{
"errorMessages": ["Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n at [Source: org.apache.catalina.connector.CoyoteInputStream#5de98556; line: 3, column: 9]
(through reference chain: com.atlassian.jira.rest.v2.issue.IssueUpdateBean[\"update\"])"]
}
There are two problems that you are encountering here.
The first problem is update or fields should be provided separately to Jira's edit issue API, not one inside of the other. They have equivalent functionality so normally only one is used. For example to update the summary field provide either update:
{
"update": {
"summary": [
{
"set": "Updated by update"
}
]
}
}
or fields:
{
"fields": {
"summary": "Summary set by fields"
}
}
However the status field is a special case and can't be updated directly, which is the second problem here. Changing a status in Jira is called a transition. You need to trigger the transition to move the issue into the status you want.
Start by identifying the available transitions by calling the get transitions API:
GET https://example.net/rest/api/latest/issue/PID-XX/transitions
This tells you which transitions are currently available, something like this:
{
"expand": "transitions",
"transitions": [
{
"id": "21",
"name": "Fixed",
"to": {
"self": "https://example.net/rest/api/2/status/10001",
"description": "",
"iconUrl": "https://example.net/images/icons/status_generic.gif",
"name": "Fixed",
"id": "10001",
"statusCategory": {
"self": "https://example.net/rest/api/2/statuscategory/3",
"id": 3,
"key": "done",
"colorName": "green",
"name": "Done"
}
}
}
]
}
Take the id of the transition you want, in this case 21, then post it to the issue transition API:
POST https://example.net/rest/api/latest/issue/PID-XX/transitions
Use a request body like this:
{
"transition": {
"id": 21
}
}
You should get a 204 HTTP response from Jira which indicates the transition was successful.

Importing Data to Contentful programatically from a json file

I am trying to import some data programatically into contentful:
I am following the docs here
And running the command inside my integrated terminal
contentful space import --config config.json
Where the config file is
{
"spaceId": "abc123",
"managementToken": "112323132321adfWWExample",
"contentFile": "./dataToImport.json"
}
And the dataToImport.json file is
{
"data": [
{
"address": "11234 New York City"
},
{
"address": "1212 New York City"
}
]
}
The thing is I don't understand what format my dataToImport.json should be and what is missing inside this file or in my config file so that the array of addresses from the .json file get added as new entries to an already created content model inside the Contentful UI show in the screenshot below
I am not specifying the content model for the data to go into so I believe that is one issue, and I don't know how I do that. An example or repo would help me out greatly
The types of data you can import are listed : in their documentation
your json top level should say "entries" and not data, if new content of a content type is what you would like to import.
This is an example of a blog post as per content model of the tutorial they provide.
The only thing i didn't work out yet is where the user id is :D so i substituted for one of the content type 'person' also provided in their tutorial (I think it's called Gatsby Starter)
{"entries": [
{
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "theSpaceIdToReceiveYourImport"
}
},
"type": "Entry",
"createdAt": "2019-04-17T00:56:24.722Z",
"updatedAt": "2019-04-27T09:11:56.769Z",
"environment": {
"sys": {
"id": "master",
"type": "Link",
"linkType": "Environment"
}
},
"publishedVersion": 149, -- these are not compulsory, you can skip
"publishedAt": "2019-04-27T09:11:56.769Z", -- you can skip
"firstPublishedAt": "2019-04-17T00:56:28.525Z", -- you can skip
"publishedCounter": 3, -- you can skip
"version": 150,
"publishedBy": { -- this is an example of a linked content
"sys": {
"type": "Link",
"linkType": "person",
"id": "personId"
}
},
"contentType": {
"sys": {
"type": "Link",
"linkType": "ContentType",
"id": "blogPost" -- here should be your content type 'RealtorProperties'
}
}
},
"fields": { -- here should go your content type fields, i can't see it in your post
"title": {
"en-US": "Test 1"
},
"slug": {
"en-US": "Test-1"
},
"description": {
"en-US": "some description"
},
"body": {
"en-US": "some body..."
},
"publishDate": {
"en-US": "2016-12-19"
},
"heroImage": { -- another example of a linked content
"en-US": {
"sys": {
"type": "Link",
"linkType": "Asset",
"id": "idOfTHisImage"
}
}
}
}
},
--another entry, ...]}
Have a look at this repo. I am also trying to figure this out. Looks like there's quite a lot of fields that need to be included in the json file. I was hoping there'd be a simple solution but it seems you (me too actually) will need to create scripts to "convert" your json file to data contentful can read and import.
I'll let you know if I find anything better.

How to specify an analyzer while creating an index in ElasticSearch

I'd like to specify an analyzer, name it, and use that name in a mapping while creating an index. I'm lost, my ES instance always returns me an error message.
This is, roughly, what I'd like to do:
"settings": {
"mappings": {
"alfedoc": {
"properties": {
"id": { "type": "string" },
"alfefield": { "type": "string", "analyzer": "alfeanalyzer" }
}
}
},
"analysis": {
"analyzer": {
"alfeanalyzer": {
"type": "pattern",
"pattern":"\\s+"
}
}
}
}
But this does not seem to work; the ES instance always returns me an error like
MapperParsingException[mapping [alfedoc]]; nested: MapperParsingException[Analyzer [alfeanalyzer] not found for field [alfefield]];
I tried putting the "analysis" branch of the dictionary at several places (inside the mapping etc.) but to no avail. I guess a working complete example (which I couldn't find up to now) would help me along as well. Probably I'm missing something rather basic.
"analysis" goes in the "settings" block, which goes either before or after the "mappings" block when creating an index.
"settings": {
"analysis": {
"analyzer": {
"alfeanalyzer": {
"type": "pattern",
"pattern": "\\s+"
}
}
}
},
"mappings": {
"alfedoc": { ... }
}
Here's a good complete, example: Example 1

Is it possible to RECEIVE job applications through the LinkedIn API?

I see LinkedIn documentation on how to post job, apply for jobs, and search jobs. But I'm curious if it's possible to post a job on LinkedIn normally and then receive an API notification when people apply to it. In other words, I want to integrate with the application rather then the job posting. Is this possible?
Yes this is possible, you want to integrate the job applications you receive with your own Applicant Tracking System. Check the processing job applications developer documentation for more details.
Yes. It looks like documentation moved to microsoft: https://learn.microsoft.com/en-us/linkedin/talent/apply-connect/receive-applications
Essentially you create a webhook and register it with the job post. Then linkedin will POST the job application to that hook.
"Content-Type":"application/json",
"X-LI-Signature":"d3756e445a8065c0f38c2182c502f8229800eb2c6a9f3b4a1fdf152af867e6fc",
"Content-Length":"107",
"Connection":"Keep-Alive",
"Accept-Encoding":"gzip,deflate"
{
"type": "JOB_APPLICATION_EXPORT",
"externalJobId": "jobIdOnAtsPartner",
"jobApplicationId": "urn:li:jobApplication:12345678",
"jobApplicant": "urn:li:person:abc123",
"appliedAt": 1602137400011,
"applicantSkills": [
{
"skillUrn": "urn:li:skill:12345",
"skillName": "Java",
"jobMatched": true,
"assessmentVerified": true
}
],
"questionResponses": {
"resumeQuestionResponses":
{"resumeQuestionAnswer":
{"mediaUrl":"https://www.linkedin.com/ambry/?x-li-ambry-ep=AQFBV...",
"mediaUrn":"urn:li:media:AgAAA..."}​
},
"contactInformationQuestionResponses": {
"firstNameAnswer": {
"value": "First"
},
"lastNameAnswer": {
"value": "Last"
},
"emailAnswer": {
"value": "applicant#linkedin.com"
}
},
"voluntarySelfIdentificationQuestionResponses": {
"disabilityAnswer": "NO",
"genderAnswer": "MALE",
"raceAnswer": "ASIAN",
"veteranStatusAnswer": "NOT_PROTECTED_VETERAN"
},
"educationQuestionResponses": {
"educationExperienceQuestionSetResponses": [
{
"school": {
"value": "UC Berkeley"
}
}
]
},
"workQuestionResponses": {
"workExperienceQuestionSetResponses": [
{
"company": {
"value": "LinkedIn"
},
"title": {
"value": "Software Engineer"
}
}
]
},
"additionalQuestionResponses": {
"customQuestionSetResponses": [
{
"customQuestionResponses": [
{
"questionIdentifier": "question1",
"answer": {
"multipleChoiceAnswerValue": {
"symbolicNames": [
"right"
]
}
}
}
]
}
]
}
}
}