Skip to content

Commit 204c210

Browse files
authored
Merge pull request #487 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 3681fa6 + cf2a118 commit 204c210

4 files changed

Lines changed: 430 additions & 138 deletions

File tree

src/components/CippStandards/CippStandardAccordion.jsx

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,33 @@ const CippStandardAccordion = ({
560560
selectedActions = [selectedActions];
561561
}
562562

563+
// Get template name for Intune Templates
564+
let templateDisplayName = "";
565+
if (standardName.startsWith("standards.IntuneTemplate")) {
566+
// Check for TemplateList selection
567+
const templateList = _.get(watchedValues, `${standardName}.TemplateList`);
568+
if (templateList && templateList.label) {
569+
templateDisplayName = templateList.label;
570+
}
571+
572+
// Check for TemplateList-Tags selection (takes priority)
573+
const templateListTags = _.get(watchedValues, `${standardName}.TemplateList-Tags`);
574+
if (templateListTags && templateListTags.label) {
575+
templateDisplayName = templateListTags.label;
576+
}
577+
}
578+
579+
// For multiple standards, check the first added component
563580
const selectedTemplateName = standard.multiple
564581
? _.get(watchedValues, `${standardName}.${standard.addedComponent?.[0]?.name}`)
565582
: "";
566-
const accordionTitle =
567-
selectedTemplateName && _.get(selectedTemplateName, "label")
568-
? `${standard.label} - ${_.get(selectedTemplateName, "label")}`
569-
: standard.label;
583+
584+
// Build accordion title with template name if available
585+
const accordionTitle = templateDisplayName
586+
? `${standard.label} - ${templateDisplayName}`
587+
: selectedTemplateName && _.get(selectedTemplateName, "label")
588+
? `${standard.label} - ${_.get(selectedTemplateName, "label")}`
589+
: standard.label;
570590

571591
// Get current values and check if they differ from saved values
572592
const current = _.get(watchedValues, standardName);
@@ -809,6 +829,17 @@ const CippStandardAccordion = ({
809829
{/* Additional components take full width */}
810830
{hasAddedComponents && (
811831
<>
832+
{/* Add catalog button for Intune Template standard - appears first */}
833+
{standardName.startsWith("standards.IntuneTemplate") && (
834+
<Grid size={12}>
835+
<Box sx={{ mb: 2 }}>
836+
<CippPolicyImportDrawer
837+
buttonText="Browse Intune Template Catalog"
838+
mode="Intune"
839+
/>
840+
</Box>
841+
</Grid>
842+
)}
812843
{standard.addedComponent?.map((component, idx) =>
813844
component?.condition ? (
814845
<CippFormCondition

src/data/standards.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4608,7 +4608,10 @@
46084608
"queryKey": "ListIntuneTemplates-tag-autcomplete",
46094609
"url": "/api/ListIntuneTemplates?mode=Tag",
46104610
"labelField": "label",
4611-
"valueField": "value"
4611+
"valueField": "value",
4612+
"addedField": {
4613+
"templates": "templates"
4614+
}
46124615
}
46134616
},
46144617
{

0 commit comments

Comments
 (0)