-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat(hub-common): adding view for content edit #1116
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b8508f2
feat(hub-common): adding view for content edit
abp6318 75ea54f
feat(hub-common): updating tests
abp6318 00fa970
feat(hub-common): trying to get thumbnails to save
abp6318 a5aeec8
feat(hub-common): adding _thumbnail
abp6318 9916d4f
Merge branch 'master' into f/7207-edit-content-details
abp6318 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { PROJECT_STATUSES, IConfigurationSchema } from "../../core"; | ||
import { HubItemEntitySchema } from "../../core/schemas/shared/HubItemEntitySchema"; | ||
|
||
export type ContentEditorType = (typeof ContentEditorTypes)[number]; | ||
export const ContentEditorTypes = ["hub:content:edit"] as const; | ||
|
||
/** | ||
* defines the JSON schema for a Hub Project's editable fields | ||
*/ | ||
export const ContentSchema: IConfigurationSchema = { | ||
...HubItemEntitySchema, | ||
properties: { | ||
...HubItemEntitySchema.properties, | ||
}, | ||
} as IConfigurationSchema; |
119 changes: 119 additions & 0 deletions
119
packages/common/src/content/_internal/ContentUiSchemaEdit.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import { IUiSchema } from "../../core"; | ||
|
||
export const uiSchema: IUiSchema = { | ||
type: "Layout", | ||
elements: [ | ||
{ | ||
type: "Section", | ||
labelKey: "{{i18nScope}}.sections.basic.title", | ||
elements: [ | ||
// title | ||
{ | ||
labelKey: "{{i18nScope}}.fields.title.label", | ||
scope: "/properties/name", | ||
type: "Control", | ||
options: { | ||
helperText: { | ||
labelKey: "{{i18nScope}}.fields.title.hint", | ||
}, | ||
messages: [ | ||
{ | ||
type: "ERROR", | ||
keyword: "required", | ||
icon: true, | ||
labelKey: "{{i18nScope}}.fields.title.requiredError", | ||
}, | ||
], | ||
}, | ||
}, | ||
// summary | ||
{ | ||
labelKey: "{{i18nScope}}.fields.summary.label", | ||
scope: "/properties/summary", | ||
type: "Control", | ||
options: { | ||
control: "hub-field-input-input", | ||
type: "textarea", | ||
helperText: { | ||
labelKey: "{{i18nScope}}.fields.summary.hint", | ||
}, | ||
}, | ||
}, | ||
// description | ||
{ | ||
labelKey: "{{i18nScope}}.fields.description.label", | ||
scope: "/properties/description", | ||
type: "Control", | ||
options: { | ||
control: "hub-field-input-input", | ||
type: "textarea", | ||
helperText: { | ||
labelKey: "{{i18nScope}}.fields.description.hint", | ||
}, | ||
}, | ||
}, | ||
// thumbnail image | ||
{ | ||
labelKey: "{{i18nScope}}.fields._thumbnail.label", | ||
scope: "/properties/_thumbnail", | ||
type: "Control", | ||
options: { | ||
control: "hub-field-input-image-picker", | ||
maxWidth: 727, | ||
maxHeight: 484, | ||
aspectRatio: 1.5, | ||
helperText: { | ||
labelKey: "{{i18nScope}}.fields._thumbnail.helperText", | ||
}, | ||
}, | ||
}, | ||
// tags | ||
{ | ||
labelKey: "{{i18nScope}}.fields.tags.label", | ||
scope: "/properties/tags", | ||
type: "Control", | ||
options: { | ||
control: "hub-field-input-combobox", | ||
allowCustomValues: true, | ||
selectionMode: "multiple", | ||
placeholderIcon: "label", | ||
helperText: { labelKey: "{{i18nScope}}.fields.tags.hint" }, | ||
}, | ||
}, | ||
// categories | ||
{ | ||
labelKey: "{{i18nScope}}.fields.categories.label", | ||
scope: "/properties/categories", | ||
type: "Control", | ||
options: { | ||
control: "hub-field-input-combobox", | ||
allowCustomValues: false, | ||
selectionMode: "multiple", | ||
placeholderIcon: "select-category", | ||
helperText: { | ||
labelKey: "{{i18nScope}}.fields.categories.agolHint", // TODO: hint should describe whether it can be set on Enterprise or Online | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
// { // TODO: in another PR | ||
// type: "Section", | ||
// labelKey: "{{i18nScope}}.sections.location.label", | ||
// options: { | ||
// helperText: { | ||
// labelKey: "{{i18nScope}}.sections.location.helperText", | ||
// }, | ||
// }, | ||
// elements: [ | ||
// { | ||
// scope: "/properties/location", | ||
// type: "Control", | ||
// options: { | ||
// control: "hub-field-input-location-picker", | ||
// }, | ||
// }, | ||
// ], | ||
// }, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { IRequestOptions } from "@esri/arcgis-rest-request"; | ||
import { UserSession } from "@esri/arcgis-rest-auth"; | ||
import { getItemThumbnailUrl } from "../../resources"; | ||
import { IHubEditableContent } from "../../core"; | ||
import { IModel } from "../../types"; | ||
|
||
export function computeProps( | ||
model: IModel, | ||
content: Partial<IHubEditableContent>, | ||
requestOptions: IRequestOptions | ||
): IHubEditableContent { | ||
let token: string; | ||
if (requestOptions.authentication) { | ||
const session: UserSession = requestOptions.authentication as UserSession; | ||
token = session.token; | ||
} | ||
// thumbnail url | ||
content.thumbnailUrl = getItemThumbnailUrl(model.item, requestOptions, token); | ||
|
||
return content as IHubEditableContent; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good to be forward thinking. I suspect that it will need to be added to
ContentSchema
as well?