// Renderers for the connector namespace picker and connector catalog pages.
// Styled to match the reference connector extension UI.
import { CATEGORY } from "./categories.mjs";
import { buildSandboxUrl } from "./sandbox.mjs";
const CONNECT_ICON = ' ';
// Official Azure Connector Namespace mark — a gray viewfinder frame wrapping
// two interlocking blue-gradient chain links. Path + gradient data is lifted
// verbatim from the portal's ConnectorNamespaceIcon brand asset. idSuffix keeps
// the gradient element IDs unique when the mark renders more than once per page.
export function brandMark(size = 28, idSuffix = "m") {
const g0 = `cn-g0-${idSuffix}`;
const g1 = `cn-g1-${idSuffix}`;
return ``
+ ``
+ ``
+ ` `
+ ` `
+ ``
+ ` `
+ ` `
+ ` `
+ ` `
+ ` `
+ ` `
+ ` `
+ ` `
+ ` `
+ ` `
+ ` `
+ ` `
+ ` `
+ ` `
+ ` `
+ ` `;
}
export function baseStyles() {
return ``;
}
// ---------------------------------------------------------------------------
// Setup / Namespace Picker
// ---------------------------------------------------------------------------
export function renderSetupHtml(subscriptions = [], notice = "", capabilityToken = "") {
const subOptions = subscriptions.map((s) =>
`${esc(s.name)} (${s.id.slice(0, 8)}\u2026) `
).join("");
return `
+ New connector namespace
Subscription
-- Select subscription --
${subOptions}
${subscriptions.length ? "Select a subscription to see available connector namespaces." : "Loading subscriptions\u2026"}
`;
}
// ---------------------------------------------------------------------------
// Catalog
// ---------------------------------------------------------------------------
const CSS_HEX_COLOR = /^#[0-9a-fA-F]{6}$/;
function iconBackgroundStyle(brandColor) {
const color = String(brandColor || "").trim();
return CSS_HEX_COLOR.test(color) ? ` style="background:${color}22"` : "";
}
export function renderCatalogHtml(instanceId, catalog, { filter, category, source, config }, capabilityToken = "") {
const renderItem = (c) => {
// Items carry their home grid so hydrateState can move them into
// "My MCPs" when added and back to Microsoft/Partner on remove.
const home = c.category === CATEGORY.microsoft ? "microsoft" : "partner";
const icon = c.iconUri
? `No connectors available.
`;
}
return `
${brandMark(24, "cat")}Connectors
Namespace ${esc(config.gatewayName)} · RG ${esc(config.resourceGroup)}
Switch namespace
Open in portal
Open config file