Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added filepath in entity data map #732

Merged
merged 8 commits into from
Oct 18, 2023
8 changes: 5 additions & 3 deletions src/web/client/WebExtensionContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,17 @@ class WebExtensionContext implements IWebExtensionContext {
odataEtag: string,
attributePath: IAttributePath,
attributeContent: string,
mappingEntityId?: string
mappingEntityId?: string,
fileUri?: string
) {
this.entityDataMap.setEntity(
entityId,
entityName,
odataEtag,
attributePath,
attributeContent,
mappingEntityId);
mappingEntityId,
fileUri);
}

public async updateSingleFileUrisInContext(uri: vscode.Uri) {
Expand Down Expand Up @@ -606,7 +608,7 @@ class WebExtensionContext implements IWebExtensionContext {
}

/**
* Store a value maintained in Extension context workspaceState.
* Store a value maintained in Extension context workspaceState.
*
* *Note* that using `undefined` as value removes the key from the underlying
* storage.
Expand Down
9 changes: 8 additions & 1 deletion src/web/client/context/entityData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface IEntityData extends IEntityInfo {
entityEtag: string;
entityColumn: Map<string, string | Uint8Array>;
mappingEntityId?: string;
filePath?: Set<string>
}

export class EntityData implements IEntityData {
Expand All @@ -17,6 +18,7 @@ export class EntityData implements IEntityData {
private _entityEtag!: string;
private _entityColumn!: Map<string, string | Uint8Array>;
private _mappingEntityId?: string;
private _filePath?: Set<string>;

public get entityName(): string {
return this._entityName;
Expand All @@ -33,6 +35,9 @@ export class EntityData implements IEntityData {
public get mappingEntityId(): string | undefined {
return this._mappingEntityId;
}
public get filePath(): Set<string> | undefined {
return this._filePath;
}

// Setters
public set setEntityEtag(value: string) {
Expand All @@ -44,12 +49,14 @@ export class EntityData implements IEntityData {
entityName: string,
entityEtag: string,
entityColumn: Map<string, string | Uint8Array>,
mappingEntityId?: string
mappingEntityId?: string,
filePath?: Set<string>
) {
this._entityId = entityId;
this._entityName = entityName;
this._entityEtag = entityEtag;
this._entityColumn = entityColumn;
this._mappingEntityId = mappingEntityId;
this._filePath = filePath;
}
}
11 changes: 9 additions & 2 deletions src/web/client/context/entityDataMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export class EntityDataMap {
odataEtag: string,
attributePath: IAttributePath,
attributeContent: string,
mappingEntityId?: string
mappingEntityId?: string,
fileUri?: string
) {
let entityColumnMap = new Map<string, string | Uint8Array>();
const existingEntity = this.entityMap.get(entityId);
Expand All @@ -44,12 +45,18 @@ export class EntityDataMap {
}
entityColumnMap.set(attributePath.source, attributeContent);

const filePath = this.entityMap.get(entityId)?.filePath ?? new Set();
if (fileUri) {
filePath.add(fileUri);
}

const entityData = new EntityData(
entityId,
entityName,
odataEtag,
entityColumnMap,
mappingEntityId
mappingEntityId,
filePath
ritikramuka marked this conversation as resolved.
Show resolved Hide resolved
);
this.entityMap.set(entityId, entityData);
}
Expand Down
3 changes: 2 additions & 1 deletion src/web/client/dal/remoteFetchProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ async function createVirtualFile(
odataEtag,
attributePath,
originalAttributeContent,
mappingEntityId
mappingEntityId,
fileUri,
);
}
Loading