Add permission-aware datasource search source
This commit is contained in:
@@ -83,7 +83,9 @@ export default function DatasourcesPage({
|
||||
const [stages, setStages] = useState<DatasourceStage[]>([]);
|
||||
const [origins, setOrigins] = useState<DatasourceOrigin[]>([]);
|
||||
const [originsAvailable, setOriginsAvailable] = useState(false);
|
||||
const [selectedDatasourceRef, setSelectedDatasourceRef] = useState("");
|
||||
const [selectedDatasourceRef, setSelectedDatasourceRef] = useState(
|
||||
initialDatasourceRef
|
||||
);
|
||||
const [selectedStageRef, setSelectedStageRef] = useState("");
|
||||
const [selectedOriginRef, setSelectedOriginRef] = useState("");
|
||||
const [preview, setPreview] = useState<DatasourcePreview | null>(null);
|
||||
@@ -1501,6 +1503,11 @@ function filterItems<T>(
|
||||
: items;
|
||||
}
|
||||
|
||||
function initialDatasourceRef(): string {
|
||||
if (typeof window === "undefined") return "";
|
||||
return new URLSearchParams(window.location.search).get("datasource") ?? "";
|
||||
}
|
||||
|
||||
function parseRows(text: string): Record<string, unknown>[] {
|
||||
const value: unknown = JSON.parse(text);
|
||||
if (!Array.isArray(value) || value.some((row) => !isRecord(row))) {
|
||||
|
||||
+3
-2
@@ -10,14 +10,15 @@ const readScopes = ["datasources:catalogue:read", "datasources:source:admin"];
|
||||
export const datasourcesModule: PlatformWebModule = {
|
||||
id: "datasources",
|
||||
label: "i18n:govoplan-datasources.datasources",
|
||||
version: "0.1.14",
|
||||
version: "0.1.18",
|
||||
optionalDependencies: [
|
||||
"access",
|
||||
"audit",
|
||||
"connectors",
|
||||
"files",
|
||||
"notifications",
|
||||
"policy"
|
||||
"policy",
|
||||
"search"
|
||||
],
|
||||
translations: generatedTranslations,
|
||||
viewSurfaces: [
|
||||
|
||||
Reference in New Issue
Block a user