scaffolder: rename dry-run contents -> directoryContents

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-05-31 12:18:29 +02:00
parent 03a467ebc9
commit c7a5d8d7ae
9 changed files with 28 additions and 18 deletions
+1 -1
View File
@@ -187,7 +187,7 @@ export class ScaffolderClient implements ScaffolderApi {
template: options.template,
values: options.values,
secrets: options.secrets,
content: options.content,
directoryContents: options.directoryContents,
}),
});
@@ -108,7 +108,7 @@ export function DryRunProvider(props: DryRunProviderProps) {
template: parsed,
values: options.values,
secrets: {},
content: options.files.map(file => ({
directoryContents: options.files.map(file => ({
path: file.path,
base64Content: btoa(file.content),
})),
@@ -51,7 +51,12 @@ function DryRunRemote({
}
const mockScaffolderApi = {
dryRun: async () => ({ content: [], log: [], output: {}, steps: [] }),
dryRun: async () => ({
directoryContents: [],
log: [],
output: {},
steps: [],
}),
};
describe('DryRunResults', () => {
@@ -40,7 +40,12 @@ function DryRunRemote({ execute }: { execute?: number }) {
}
const mockScaffolderApi = {
dryRun: async () => ({ content: [], log: [], output: {}, steps: [] }),
dryRun: async () => ({
directoryContents: [],
log: [],
output: {},
steps: [],
}),
};
describe('DryRunResultsList', () => {
@@ -55,7 +55,7 @@ describe('DryRunResultsView', () => {
scaffolderApiRef,
{
dryRun: async () => ({
content: [
directoryContents: [
{
path: 'foo.txt',
base64Content: btoa('Foo Content'),
@@ -61,13 +61,13 @@ function FilesContent() {
const classes = useStyles();
const { selectedResult } = useDryRun();
const [selectedPath, setSelectedPath] = useState<string>('');
const selectedFile = selectedResult?.content.find(
const selectedFile = selectedResult?.directoryContents.find(
f => f.path === selectedPath,
);
useEffect(() => {
if (selectedResult) {
const [firstFile] = selectedResult.content;
const [firstFile] = selectedResult.directoryContents;
if (firstFile) {
setSelectedPath(firstFile.path);
} else {
@@ -85,7 +85,7 @@ function FilesContent() {
<FileBrowser
selected={selectedPath}
onSelect={setSelectedPath}
filePaths={selectedResult.content.map(file => file.path)}
filePaths={selectedResult.directoryContents.map(file => file.path)}
/>
<CodeMirror
className={classes.codeMirror}
+2 -2
View File
@@ -155,12 +155,12 @@ export interface ScaffolderDryRunOptions {
template: JsonValue;
values: JsonObject;
secrets: JsonObject;
content: { path: string; base64Content: string }[];
directoryContents: { path: string; base64Content: string }[];
}
/** @public */
export interface ScaffolderDryRunResponse {
content: Array<{
directoryContents: Array<{
path: string;
base64Content: string;
executable: boolean;