mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 01:11:25 +00:00
Prettier 2.0 (#393)
This commit is contained in:
@@ -41,26 +41,26 @@ describe("ContainerSampleGenerator", () => {
|
||||
data: [
|
||||
{
|
||||
firstname: "Eva",
|
||||
age: 44
|
||||
age: 44,
|
||||
},
|
||||
{
|
||||
firstname: "Véronique",
|
||||
age: 50
|
||||
age: 50,
|
||||
},
|
||||
{
|
||||
firstname: "亜妃子",
|
||||
age: 5
|
||||
age: 5,
|
||||
},
|
||||
{
|
||||
firstname: "John",
|
||||
age: 23
|
||||
}
|
||||
]
|
||||
age: 23,
|
||||
},
|
||||
],
|
||||
};
|
||||
const collection = { id: ko.observable(sampleCollectionId) } as ViewModels.Collection;
|
||||
const database = {
|
||||
id: ko.observable(sampleDatabaseId),
|
||||
collections: ko.observableArray<ViewModels.Collection>([collection])
|
||||
collections: ko.observableArray<ViewModels.Collection>([collection]),
|
||||
} as ViewModels.Database;
|
||||
database.findCollectionWithId = () => collection;
|
||||
|
||||
@@ -87,9 +87,9 @@ describe("ContainerSampleGenerator", () => {
|
||||
documentEndpoint: "bar",
|
||||
gremlinEndpoint: "foo",
|
||||
tableEndpoint: "foo",
|
||||
cassandraEndpoint: "foo"
|
||||
}
|
||||
}
|
||||
cassandraEndpoint: "foo",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const sampleCollectionId = "SampleCollection";
|
||||
@@ -102,13 +102,13 @@ describe("ContainerSampleGenerator", () => {
|
||||
createNewDatabase: true,
|
||||
collectionId: sampleCollectionId,
|
||||
data: [
|
||||
"g.addV('person').property(id, '1').property('_partitionKey','pk').property('name', 'Eva').property('age', 44)"
|
||||
]
|
||||
"g.addV('person').property(id, '1').property('_partitionKey','pk').property('name', 'Eva').property('age', 44)",
|
||||
],
|
||||
};
|
||||
const collection = { id: ko.observable(sampleCollectionId) } as ViewModels.Collection;
|
||||
const database = {
|
||||
id: ko.observable(sampleDatabaseId),
|
||||
collections: ko.observableArray<ViewModels.Collection>([collection])
|
||||
collections: ko.observableArray<ViewModels.Collection>([collection]),
|
||||
} as ViewModels.Database;
|
||||
database.findCollectionWithId = () => collection;
|
||||
collection.databaseId = database.id();
|
||||
|
||||
@@ -54,7 +54,7 @@ export class ContainerSampleGenerator {
|
||||
|
||||
private async createContainerAsync(): Promise<ViewModels.Collection> {
|
||||
const createRequest: DataModels.CreateCollectionParams = {
|
||||
...this.sampleDataFile
|
||||
...this.sampleDataFile,
|
||||
};
|
||||
|
||||
await createCollection(createRequest);
|
||||
@@ -87,16 +87,16 @@ export class ContainerSampleGenerator {
|
||||
databaseId: databaseId,
|
||||
collectionId: collection.id(),
|
||||
masterKey: userContext.masterKey || "",
|
||||
maxResultSize: 100
|
||||
maxResultSize: 100,
|
||||
});
|
||||
|
||||
await queries
|
||||
.map(query => () => gremlinClient.execute(query))
|
||||
.map((query) => () => gremlinClient.execute(query))
|
||||
.reduce((previous, current) => previous.then(current), Promise.resolve());
|
||||
} else {
|
||||
// For SQL all queries are executed at the same time
|
||||
await Promise.all(
|
||||
this.sampleDataFile.data.map(async doc => {
|
||||
this.sampleDataFile.data.map(async (doc) => {
|
||||
try {
|
||||
await createDocument(collection, doc);
|
||||
} catch (error) {
|
||||
|
||||
@@ -13,7 +13,7 @@ describe("DataSampleUtils", () => {
|
||||
const collection = { id: ko.observable(sampleCollectionId) } as Collection;
|
||||
const database = {
|
||||
id: ko.observable(sampleDatabaseId),
|
||||
collections: ko.observableArray<Collection>([collection])
|
||||
collections: ko.observableArray<Collection>([collection]),
|
||||
} as Database;
|
||||
const explorer = {} as Explorer;
|
||||
explorer.nonSystemDatabases = ko.computed(() => [database]);
|
||||
|
||||
@@ -26,7 +26,7 @@ export class DataSamplesUtil {
|
||||
|
||||
await generator
|
||||
.createSampleContainerAsync()
|
||||
.catch(error =>
|
||||
.catch((error) =>
|
||||
NotificationConsoleUtils.logConsoleMessage(ConsoleDataType.Error, `Error creating sample container: ${error}`)
|
||||
);
|
||||
const msg = `The sample ${containerName} in database ${databaseName} has been successfully created.`;
|
||||
@@ -48,10 +48,10 @@ export class DataSamplesUtil {
|
||||
* @param containerDatabases
|
||||
*/
|
||||
public hasContainer(databaseName: string, containerName: string, containerDatabases: ViewModels.Database[]): boolean {
|
||||
const filteredDatabases = containerDatabases.filter(database => database.id() === databaseName);
|
||||
const filteredDatabases = containerDatabases.filter((database) => database.id() === databaseName);
|
||||
return (
|
||||
filteredDatabases.length > 0 &&
|
||||
filteredDatabases[0].collections().filter(collection => collection.id() === containerName).length > 0
|
||||
filteredDatabases[0].collections().filter((collection) => collection.id() === containerName).length > 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user