Skip to content

Commit 3bb2d05

Browse files
author
Erin Peach
committed
Log element id when deleting an image
1 parent e12381e commit 3bb2d05

File tree

8 files changed

+34
-12
lines changed

8 files changed

+34
-12
lines changed

apps/src/applab/designElements/ImagePickerPropertyRow.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default class ImagePickerPropertyRow extends React.Component {
1717
initialValue: PropTypes.string.isRequired,
1818
handleChange: PropTypes.func,
1919
desc: PropTypes.node,
20+
elementId: PropTypes.string
2021
};
2122

2223
componentDidMount() {
@@ -61,7 +62,8 @@ export default class ImagePickerPropertyRow extends React.Component {
6162
// However today the `createModalDialog` function and `Dialog` component
6263
// are intertwined with `StudioApp` which is why we have this direct call.
6364
dashboard.assets.showAssetManager(this.changeImage, 'image', null, {
64-
showUnderageWarning: !getStore().getState().pageConstants.is13Plus
65+
showUnderageWarning: !getStore().getState().pageConstants.is13Plus,
66+
elementId: this.props.elementId
6567
});
6668
};
6769

apps/src/applab/designElements/button.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class ButtonProperties extends React.Component {
103103
desc={'image'}
104104
initialValue={element.getAttribute('data-canonical-image-url') || ''}
105105
handleChange={this.props.handleChange.bind(this, 'image')}
106+
elementId={elementUtils.getId(element)}
106107
/>
107108
{iconColorPicker}
108109
<BooleanPropertyRow

apps/src/applab/designElements/image.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class ImageProperties extends React.Component {
7676
desc={'image'}
7777
initialValue={element.getAttribute('data-canonical-image-url') || ''}
7878
handleChange={this.props.handleChange.bind(this, 'picture')}
79+
elementId={elementUtils.getId(element)}
7980
/>
8081
{iconColorPicker}
8182
<EnumPropertyRow

apps/src/applab/designElements/screen.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class ScreenProperties extends React.Component {
5252
desc={'image'}
5353
initialValue={element.getAttribute('data-canonical-image-url') || ''}
5454
handleChange={this.props.handleChange.bind(this, 'screen-image')}
55+
elementId={elementUtils.getId(element)}
5556
/>
5657
{iconColorPicker}
5758
<DefaultScreenButtonPropertyRow

apps/src/code-studio/assets/show.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var Dialog = require('../LegacyDialog');
1818
* @param [options.showUnderageWarning] {boolean} Warn if underage.
1919
* @param [options.useFilesApi] {boolean} Use files API instead of assets API.
2020
* @param [options.disableAudioRecording] {boolean} Do not display option to record and upload audio files
21+
* @param [options.elementId] {string} Logging Purposes: which element is the image chosen for
2122
*/
2223
module.exports = function showAssetManager(assetChosen, typeFilter, onClose, options) {
2324
options = options || {};
@@ -48,7 +49,8 @@ module.exports = function showAssetManager(assetChosen, typeFilter, onClose, opt
4849
showUnderageWarning: !!options.showUnderageWarning,
4950
projectId: dashboard.project.getCurrentId(),
5051
soundPlayer: sounds,
51-
disableAudioRecording: options.disableAudioRecording
52+
disableAudioRecording: options.disableAudioRecording,
53+
elementId: options.elementId
5254
}), codeDiv);
5355

5456
dialog.show();

apps/src/code-studio/components/AssetManager.jsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ export default class AssetManager extends React.Component {
4848
allowedExtensions: PropTypes.string,
4949
uploadsEnabled: PropTypes.bool.isRequired,
5050
useFilesApi: PropTypes.bool,
51-
//For logging upload failures
52-
projectId: PropTypes.string,
5351
soundPlayer: PropTypes.object,
5452
disableAudioRecording: PropTypes.bool,
55-
//Temp prop for logging - identifies if displayed by 'Manage Assets' flow
56-
imagePicker: PropTypes.bool
53+
54+
// For logging purposes
55+
imagePicker: PropTypes.bool, // identifies if displayed by 'Manage Assets' flow
56+
projectId: PropTypes.string,
57+
elementId: PropTypes.string
5758
};
5859

5960
constructor(props) {
@@ -149,7 +150,12 @@ export default class AssetManager extends React.Component {
149150
study_group: this.props.assetChosen && typeof this.props.assetChosen === 'function' ? 'choose-assets' : 'manage-assets',
150151
event: 'confirm',
151152
project_id: this.props.projectId,
152-
data_string: name
153+
data_json: JSON.stringify(
154+
{
155+
assetName: name,
156+
elementId: this.props.elementId
157+
}
158+
)
153159
}
154160
);
155161

@@ -234,6 +240,7 @@ export default class AssetManager extends React.Component {
234240
soundPlayer={this.props.soundPlayer}
235241
imagePicker={this.props.imagePicker}
236242
projectId={this.props.projectId}
243+
elementId={this.props.elementId}
237244
/>
238245
);
239246
}.bind(this));

apps/src/code-studio/components/AssetRow.jsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ export default class AssetRow extends React.Component {
1919
soundPlayer: PropTypes.object,
2020
projectId: PropTypes.string,
2121

22-
//temporary prop to differentiate choosing images and sounds
23-
imagePicker: PropTypes.bool
22+
// For logging purposes
23+
imagePicker: PropTypes.bool, // identifies if displayed by 'Manage Assets' flow
24+
elementId: PropTypes.string
2425
};
2526

2627
state = {
@@ -39,7 +40,12 @@ export default class AssetRow extends React.Component {
3940
study_group: this.props.onChoose && typeof this.props.onChoose === 'function' ? 'choose-assets' : 'manage-assets',
4041
event: 'initiate',
4142
project_id: this.props.projectId,
42-
data_string: this.props.name
43+
data_json: JSON.stringify(
44+
{
45+
assetName: this.props.name,
46+
elementId: this.props.elementId
47+
}
48+
)
4349
}
4450
);
4551
};

apps/src/code-studio/components/ImagePicker.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ export default class ImagePicker extends React.Component {
2323
useFilesApi: PropTypes.bool,
2424
soundPlayer: PropTypes.object,
2525
disableAudioRecording: PropTypes.bool,
26-
//For logging upload failures
27-
projectId: PropTypes.string
26+
//For logging purposes
27+
projectId: PropTypes.string,
28+
elementId: PropTypes.string
2829
};
2930

3031
state = {mode: 'files'};
@@ -93,6 +94,7 @@ export default class ImagePicker extends React.Component {
9394
soundPlayer={this.props.soundPlayer}
9495
disableAudioRecording={this.props.disableAudioRecording}
9596
imagePicker={true}
97+
elementId={this.props.elementId}
9698
/> :
9799
<IconLibrary assetChosen={this.getAssetNameWithPrefix}/>;
98100

0 commit comments

Comments
 (0)