mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-26 09:55:52 +00:00
parent
a03b3fd59a
commit
c1e20873b1
@ -32,6 +32,7 @@ import java.util.HashMap;
|
|||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
@ -3237,7 +3238,8 @@ public interface CollectionDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Quoted name is stored in fullyQualifiedName column and not in the name column
|
// Quoted name is stored in fullyQualifiedName column and not in the name column
|
||||||
beforeName = FullyQualifiedName.unquoteName(beforeName);
|
beforeName =
|
||||||
|
Optional.ofNullable(beforeName).map(FullyQualifiedName::unquoteName).orElse(null);
|
||||||
return listBefore(
|
return listBefore(
|
||||||
getTableName(),
|
getTableName(),
|
||||||
filter.getQueryParams(),
|
filter.getQueryParams(),
|
||||||
@ -3281,7 +3283,7 @@ public interface CollectionDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Quoted name is stored in fullyQualifiedName column and not in the name column
|
// Quoted name is stored in fullyQualifiedName column and not in the name column
|
||||||
afterName = FullyQualifiedName.unquoteName(afterName);
|
afterName = Optional.ofNullable(afterName).map(FullyQualifiedName::unquoteName).orElse(null);
|
||||||
return listAfter(
|
return listAfter(
|
||||||
getTableName(),
|
getTableName(),
|
||||||
filter.getQueryParams(),
|
filter.getQueryParams(),
|
||||||
|
@ -738,7 +738,7 @@ public class TeamRepository extends EntityRepository<Team> {
|
|||||||
}
|
}
|
||||||
teams.addAll(list);
|
teams.addAll(list);
|
||||||
for (Team teamEntry : list) {
|
for (Team teamEntry : list) {
|
||||||
listTeams(repository, teamEntry.getName(), teams, fields);
|
listTeams(repository, teamEntry.getFullyQualifiedName(), teams, fields);
|
||||||
}
|
}
|
||||||
return teams;
|
return teams;
|
||||||
}
|
}
|
||||||
@ -746,7 +746,8 @@ public class TeamRepository extends EntityRepository<Team> {
|
|||||||
public String exportCsv() throws IOException {
|
public String exportCsv() throws IOException {
|
||||||
TeamRepository repository = (TeamRepository) Entity.getEntityRepository(TEAM);
|
TeamRepository repository = (TeamRepository) Entity.getEntityRepository(TEAM);
|
||||||
final Fields fields = repository.getFields("owners,defaultRoles,parents,policies");
|
final Fields fields = repository.getFields("owners,defaultRoles,parents,policies");
|
||||||
return exportCsv(listTeams(repository, team.getName(), new ArrayList<>(), fields));
|
return exportCsv(
|
||||||
|
listTeams(repository, team.getFullyQualifiedName(), new ArrayList<>(), fields));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -891,7 +891,10 @@ public class TeamResourceTest extends EntityResourceTest<Team, CreateTeam> {
|
|||||||
|
|
||||||
// Add new team x3 to existing rows
|
// Add new team x3 to existing rows
|
||||||
String record3 = getRecord(3, GROUP, team.getName(), null, true, null, (List<Policy>) null);
|
String record3 = getRecord(3, GROUP, team.getName(), null, true, null, (List<Policy>) null);
|
||||||
List<String> newRecords = listOf(record3);
|
// Add new team containing dot character in name
|
||||||
|
String teamNameWithDotRecord =
|
||||||
|
getRecord("team.with.dot", GROUP, team.getName(), null, true, null, (List<Policy>) null);
|
||||||
|
List<String> newRecords = listOf(record3, teamNameWithDotRecord);
|
||||||
testImportExport(team.getName(), TeamCsv.HEADERS, createRecords, updateRecords, newRecords);
|
testImportExport(team.getName(), TeamCsv.HEADERS, createRecords, updateRecords, newRecords);
|
||||||
|
|
||||||
// Import to team111 a user with parent team1 - since team1 is not under team111 hierarchy,
|
// Import to team111 a user with parent team1 - since team1 is not under team111 hierarchy,
|
||||||
@ -1221,4 +1224,54 @@ public class TeamResourceTest extends EntityResourceTest<Team, CreateTeam> {
|
|||||||
defaultRoles,
|
defaultRoles,
|
||||||
policies);
|
policies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getRecord(
|
||||||
|
String teamName,
|
||||||
|
TeamType teamType,
|
||||||
|
String parent,
|
||||||
|
User owner,
|
||||||
|
Boolean isJoinable,
|
||||||
|
List<Role> defaultRoles,
|
||||||
|
List<Policy> policies) {
|
||||||
|
return getRecord(
|
||||||
|
teamName,
|
||||||
|
teamType,
|
||||||
|
parent != null ? parent : "",
|
||||||
|
owner != null ? "user:" + owner.getName() : "",
|
||||||
|
isJoinable,
|
||||||
|
defaultRoles != null
|
||||||
|
? defaultRoles.stream()
|
||||||
|
.flatMap(r -> Stream.of(r.getName()))
|
||||||
|
.collect(Collectors.joining(";"))
|
||||||
|
: "",
|
||||||
|
policies != null
|
||||||
|
? policies.stream()
|
||||||
|
.flatMap(p -> Stream.of(p.getName()))
|
||||||
|
.collect(Collectors.joining(";"))
|
||||||
|
: "");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getRecord(
|
||||||
|
String teamName,
|
||||||
|
TeamType teamType,
|
||||||
|
String parent,
|
||||||
|
String owner,
|
||||||
|
Boolean isJoinable,
|
||||||
|
String defaultRoles,
|
||||||
|
String policies) {
|
||||||
|
// CSV Header
|
||||||
|
// "name", "displayName", "description", "teamType", "parents", "owners", "isJoinable",
|
||||||
|
// "defaultRoles", & "policies"
|
||||||
|
return String.format(
|
||||||
|
"x%s,displayName%s,description%s,%s,%s,%s,%s,%s,%s",
|
||||||
|
teamName,
|
||||||
|
teamName,
|
||||||
|
teamName,
|
||||||
|
teamType.value(),
|
||||||
|
parent,
|
||||||
|
owner,
|
||||||
|
isJoinable == null ? "" : isJoinable,
|
||||||
|
defaultRoles,
|
||||||
|
policies);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -447,4 +447,47 @@ test.describe('Teams Page', () => {
|
|||||||
await afterAction();
|
await afterAction();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Export team', async ({ page }) => {
|
||||||
|
const { apiContext } = await getApiContext(page);
|
||||||
|
const id = uuid();
|
||||||
|
const team = new TeamClass({
|
||||||
|
name: `pw%team.export-${id}`,
|
||||||
|
displayName: `pw team export ${id}`,
|
||||||
|
description: 'playwright team export description',
|
||||||
|
teamType: 'Department',
|
||||||
|
});
|
||||||
|
|
||||||
|
await team.create(apiContext);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await settingClick(page, GlobalSettingOptions.TEAMS);
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
await searchTeam(page, team.responseData?.['displayName']);
|
||||||
|
|
||||||
|
await page
|
||||||
|
.locator(`[data-row-key="${team.data.name}"]`)
|
||||||
|
.getByRole('link')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
await expect(page.getByTestId('team-heading')).toHaveText(
|
||||||
|
team.data.displayName
|
||||||
|
);
|
||||||
|
|
||||||
|
const downloadPromise = page.waitForEvent('download');
|
||||||
|
|
||||||
|
await page.getByTestId('manage-button').click();
|
||||||
|
await page.getByTestId('export-details-container').click();
|
||||||
|
await page.fill('#fileName', team.data.name);
|
||||||
|
await page.click('#submit-button');
|
||||||
|
const download = await downloadPromise;
|
||||||
|
// Wait for the download process to complete and save the downloaded file somewhere.
|
||||||
|
await download.saveAs('downloads/' + download.suggestedFilename());
|
||||||
|
} finally {
|
||||||
|
await team.delete(apiContext);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user