modified: hasConfigChanges()

in src/config/config.ts [17:53]


    modified: hasConfigChanges(template.id),
  }));
}

/**
 * Returns the id of the currently used config template.
 */
export function getActiveTemplateId(): TemplateId {
  return (localStorage.getItem(ACTIVE_TEMPLATE) as TemplateId | null) ?? 'kibana';
}

export function setActiveTemplate(templateId: TemplateId) {
  localStorage.setItem(ACTIVE_TEMPLATE, templateId);
  activeConfig$.next(getConfig(templateId));
  return getTemplateInfos();
}

export function hasConfigChanges(id: TemplateId): boolean {
  return localStorage.getItem(localStorageConfigKey(id)) !== null;
}

/**
 * Returns the default (unmodified) config for a specific template.
 */
export function getDefaultConfig(id: TemplateId): Config {
  // We know that there is one template for each id, so we can assume this is not null here.
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  return templates.find((template) => template.id === id)!.config;
}

/**
 * Returns the specified config including potential customizations the user made.
 * If no id will be specified the currently active config will be used.
 */
export function getConfig(id: TemplateId = getActiveTemplateId()): Config {
  const customizedConfig = localStorage.getItem(localStorageConfigKey(id));
  if (customizedConfig) {