Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Clean up and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarlow12 authored and wbreza committed Apr 19, 2019
1 parent 1eb23e0 commit 48ac5db
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/react/components/pages/editorPage/editorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ export default class EditorPage extends React.Component<IEditorPageProps, IEdito
this.renameTagConfirm.current.open(tagName, newTagName);
}

/**
* Renames tag in assets and project, and saves files
* @param tagName Name of tag to be renamed
* @param newTagName New name of tag
*/
private onTagRenamed = async (tagName: string, newTagName: string): Promise<void> => {
const { project, selectedAsset } = this.state;
const newProject = {
Expand All @@ -332,6 +337,10 @@ export default class EditorPage extends React.Component<IEditorPageProps, IEdito
this.deleteTagConfirm.current.open(tagName);
}

/**
* Removes tag from assets and projects and saves files
* @param tagName Name of tag to be deleted
*/
private onTagDeleted = async (tagName: string): Promise<void> => {
const { project, selectedAsset } = this.state;
const newProject = {
Expand Down
3 changes: 1 addition & 2 deletions src/services/assetService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ describe("Asset Service", () => {
},
],
),

};

const project = populateProjectAssets();
Expand Down Expand Up @@ -422,8 +421,8 @@ describe("Asset Service", () => {
},
],
),

};

const project = populateProjectAssets();
const assetService = new AssetService(project);
await assetService.renameTag(project.assets, tag1, newTag, assetMetadata);
Expand Down
4 changes: 3 additions & 1 deletion src/services/assetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,11 @@ export class AssetService {
* Update tags within asset metadata files
* @param assets The assets containing tags to update
* @param tagName Name of tag to update within project
* @param transformer Function that accepts array of tags from a region and returns a modified array of tags
* @param currentAsset Current asset being viewed. Makes changes and returns updated asset to avoid
* needing to reload the asset in the editor page
* @param transformer Function that accepts array of tags from a region and returns a modified array of tags
* @returns Modified `currentAsset`. Returns `null` if asset did not need to be modified
* or if `currentAsset` is null or undefined
*/
private async updateAssetTags(
assets: {[id: string]: IAsset},
Expand Down

0 comments on commit 48ac5db

Please sign in to comment.