+
{tagElem}
);
@@ -170,13 +175,13 @@ class ManageTags extends React.Component {
};
handleInputConfirm = () => {
- const {inputValue, categories} = this.state;
+ const {inputValue, tags} = this.state;
let {tempElements} = this.state;
if (inputValue) {
- if ((categories.findIndex(i => i.categoryName === inputValue) === -1) && (tempElements.findIndex(i => i.categoryName === inputValue) === -1)) {
- tempElements = [...tempElements, {categoryName: inputValue, isTagDeletable: true}];
+ if ((tags.findIndex(i => i.tagName === inputValue) === -1) && (tempElements.findIndex(i => i.tagName === inputValue) === -1)) {
+ tempElements = [...tempElements, {tagName: inputValue, isTagDeletable: true}];
} else {
- message.warning('Category already exists');
+ message.warning('Tag already exists');
}
}
@@ -188,25 +193,27 @@ class ManageTags extends React.Component {
};
handleSave = () => {
- const {tempElements, categories} = this.state;
+ const {tempElements, tags} = this.state;
this.setState({
loading: true
});
- const dataArray = JSON.stringify(tempElements.map(category => category.categoryName));
+ const data = tempElements.map(tag => tag.tagName);
- const request = "method=post&content-type=application/json&payload=" + dataArray + "&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories";
- axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
- ).then(res => {
+ axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri+"/applications/tags",
+ data,
+ {
+ headers: { 'X-Platform': config.serverConfig.platform }
+ }).then(res => {
if (res.status === 200) {
notification["success"]({
message: "Done!",
description:
- "New Categories were added successfully",
+ "New tags were added successfully",
});
this.setState({
- categories: [...categories, ...tempElements],
+ tags: [...tags, ...tempElements],
tempElements: [],
inputVisible: false,
inputValue: '',
@@ -250,26 +257,31 @@ class ManageTags extends React.Component {
editItem = () => {
- const {editingValue, currentlyEditingId, categories} = this.state;
+ const {editingValue, currentlyEditingId, tags} = this.state;
this.setState({
loading: true,
isEditModalVisible: false,
});
- const request = "method=put&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories?from="+currentlyEditingId+"%26to="+editingValue;
- axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
+
+ axios.put(
+ config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri+"/applications/tags/rename?from="+currentlyEditingId+"&to="+editingValue,
+ {},
+ {
+ headers: { 'X-Platform': config.serverConfig.platform }
+ }
).then(res => {
if (res.status === 200) {
notification["success"]({
message: "Done!",
description:
- "Category was edited successfully",
+ "Tag was edited successfully",
});
- categories[categories.findIndex(i => i.categoryName === currentlyEditingId)].categoryName = editingValue;
+ tags[tags.findIndex(i => i.tagName === currentlyEditingId)].tagName = editingValue;
this.setState({
- categories: categories,
+ tags: tags,
loading: false,
editingValue: null
});
@@ -298,8 +310,8 @@ class ManageTags extends React.Component {
};
render() {
- const {categories, inputVisible, inputValue, tempElements, isAddNewVisible} = this.state;
- const categoriesElements = categories.map(this.renderElement);
+ const {tags, inputVisible, inputValue, tempElements, isAddNewVisible} = this.state;
+ const tagsElements = tags.map(this.renderElement);
const temporaryElements = tempElements.map(this.renderTempElement);
return (
@@ -349,7 +361,7 @@ class ManageTags extends React.Component {
{!inputVisible && (
- New Category
+ New Tag
)}
@@ -386,7 +398,7 @@ class ManageTags extends React.Component {
leave={{opacity: 0, width: 0, scale: 0, duration: 200}}
appear={false}
>
- {categoriesElements}
+ {tagsElements}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppList.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppList.js
index 767843d710..49d30d8d10 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppList.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppList.js
@@ -14,9 +14,7 @@ class AppList extends React.Component {
}
componentDidMount() {
- console.log("mounted");
const {deviceType} = this.props;
- console.log(this.props);
this.props.changeSelectedMenuItem(deviceType);
this.fetchData(deviceType);
}