Policy-Export: mehrere Policies als Einzeldateien statt Bundle
Bei mehreren ausgewaehlten Policies wird jede als eigene JSON-Datei heruntergeladen (statt einer gebuendelten Datei). 150ms Pause zwischen den Downloads gegen verschluckte Browser-Downloads; Dateinamen bei gleichem Anzeigenamen automatisch eindeutig. Import liest alte Bundles weiterhin. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+12
-12
@@ -5660,19 +5660,19 @@ async function polExportSelected() {
|
|||||||
if (res.exports) allExports = allExports.concat(res.exports);
|
if (res.exports) allExports = allExports.concat(res.exports);
|
||||||
}
|
}
|
||||||
if (!allExports.length) { toast('Nichts exportiert.', 'warn'); return; }
|
if (!allExports.length) { toast('Nichts exportiert.', 'warn'); return; }
|
||||||
if (allExports.length === 1) {
|
// Jede ausgewählte Policy als eigene JSON-Datei herunterladen.
|
||||||
polDownloadJson(allExports[0].data, allExports[0].fileName || 'policy.json');
|
const usedNames = new Set();
|
||||||
} else {
|
for (let i = 0; i < allExports.length; i++) {
|
||||||
const stamp = new Date().toISOString().slice(0, 19).replace(/[:T]/g, '').replace(/-/g, '');
|
const e = allExports[i];
|
||||||
const bundle = {
|
let fn = e.fileName || `policy_${i + 1}.json`;
|
||||||
type: 'IntuneManagerPolicyBundle',
|
// Dateinamens-Kollisionen (z.B. gleicher Anzeigename) eindeutig machen.
|
||||||
exportDate: new Date().toISOString(),
|
if (usedNames.has(fn)) fn = fn.replace(/\.json$/i, '') + `_${i + 1}.json`;
|
||||||
count: allExports.length,
|
usedNames.add(fn);
|
||||||
policies: allExports.map(e => e.data),
|
polDownloadJson(e.data, fn);
|
||||||
};
|
// Kurze Pause, damit der Browser mehrere aufeinanderfolgende Downloads nicht verwirft.
|
||||||
polDownloadJson(bundle, `intune-policies_${stamp}.json`);
|
if (i < allExports.length - 1) await new Promise(r => setTimeout(r, 150));
|
||||||
}
|
}
|
||||||
toast(`${allExports.length} Policy(s) exportiert (auch im Server-Archiv abgelegt).`, 'ok');
|
toast(`${allExports.length} Policy(s) als Einzeldatei(en) exportiert (auch im Server-Archiv abgelegt).`, 'ok');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toast('Export fehlgeschlagen: ' + e.message, 'err');
|
toast('Export fehlgeschlagen: ' + e.message, 'err');
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user