-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into f/10461-discussion-board-map-settings
- Loading branch information
Showing
24 changed files
with
308 additions
and
210 deletions.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
66 changes: 66 additions & 0 deletions
66
packages/common/src/core/schemas/internal/fetchCategoriesUiSchemaElement.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,66 @@ | ||
import { IArcGISContext } from "../../../ArcGISContext"; | ||
import { | ||
IUiSchemaElement, | ||
IUiSchemaMessage, | ||
UiSchemaMessageTypes, | ||
} from "../types"; | ||
import { fetchCategoryItems } from "./fetchCategoryItems"; | ||
|
||
/** | ||
* Returns the UI schema element needed to render | ||
* the categories editing control for an entity. | ||
* | ||
* @param i18nScope i18n scope for the entity translations | ||
* @param entity The entity to build the UI schema for | ||
* @returns the UI schema element for thumbnail editing | ||
*/ | ||
export async function fetchCategoriesUiSchemaElement( | ||
i18nScope: string, | ||
context: IArcGISContext | ||
): Promise<IUiSchemaElement> { | ||
const categoryItems = await fetchCategoryItems( | ||
context.portal.id, | ||
context.hubRequestOptions | ||
); | ||
|
||
const result: IUiSchemaElement = { | ||
labelKey: `shared.fields.categories.label`, | ||
scope: "/properties/categories", | ||
type: "Control", | ||
options: { | ||
control: "hub-field-input-combobox", | ||
items: categoryItems, | ||
allowCustomValues: false, | ||
selectionMode: "ancestors", | ||
placeholderIcon: "select-category", | ||
helperText: { | ||
// helper text varies between entity types | ||
labelKey: `${i18nScope}.fields.categories.helperText`, | ||
}, | ||
}, | ||
}; | ||
|
||
if (!categoryItems.length) { | ||
result.options.disabled = true; | ||
result.options.messages = [ | ||
{ | ||
type: UiSchemaMessageTypes.custom, | ||
display: "notice", | ||
kind: "warning", | ||
icon: "exclamation-mark-triangle", | ||
labelKey: "shared.fields.categories.noCategoriesNotice.body", | ||
link: { | ||
kind: "external", | ||
label: | ||
"{{shared.fields.categories.noCategoriesNotice.link:translate}}", | ||
href: "https://doc.arcgis.com/en/arcgis-online/reference/content-categories.htm", | ||
target: "_blank", | ||
}, | ||
allowShowBeforeInteract: true, | ||
alwaysShow: true, | ||
} as IUiSchemaMessage, | ||
]; | ||
} | ||
|
||
return result; | ||
} |
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
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
Oops, something went wrong.