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

[SER-1298] fix for warnings #5107

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
}

return {
localDefaultSort: this.defaultSort,
controlParams: controlParams,
firstPage: 1
};
Expand Down Expand Up @@ -305,14 +306,14 @@
sort: [],
selectedDynamicCols: false
};
if (this.defaultSort && this.preventDefaultSort === false) {
if (this.localDefaultSort && this.preventDefaultSort === false) {
defaultState.sort = [{
field: this.defaultSort.prop,
type: this.defaultSort.order === "ascending" ? "asc" : "desc"
field: this.localDefaultSort.prop,
type: this.localDefaultSort.order === "ascending" ? "asc" : "desc"
}];
}
else {
this.defaultSort = {};
this.localDefaultSort = {};
}

if (!this.persistKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
:row-key="keyFn"
:data="mutatedRows"
:span-method="tableSpanMethod"
:default-sort="defaultSort"
:default-sort="localDefaultSort"
v-bind="$attrs"
v-on="$listeners"
@sort-change="onSortChange"
Expand Down
66 changes: 41 additions & 25 deletions plugins/dbviewer/frontend/public/javascripts/countly.views.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
}
for (var i = 0; i < response.aaData.length; i++) {
response.aaData[i]._view = JSON.stringify(response.aaData[i]);
if (self.index) {
response.aaData[i]._id = response.aaData[i].name;
}
if (!self.isRefresh) {
self.expandKeysHolder.push(response.aaData[i]._id);
}
Expand Down Expand Up @@ -103,6 +106,8 @@
sortEnabled: false,
projection: [],
sort: "",
localCollection: this.collection,
localDb: this.db,
projectionOptions: {},
isDescentSort: false,
isIndexRequest: false,
Expand All @@ -121,19 +126,29 @@
watch: {
selectedCollection: function(newVal) {
if (!this.$route || !this.$route.params || !this.$route.params.query) {
this.collection = newVal;
this.localCollection = newVal;
this.queryFilter = null;
this.projectionEnabled = false;
this.projection = [];
this.sortEnabled = false;
this.sort = "";
app.navigate("#/manage/db/" + this.db + "/" + newVal, false);
if (this.index) {
app.navigate("#/manage/db/indexes/" + this.localDb + "/" + newVal, false);
}
else {
app.navigate("#/manage/db/" + this.localDb + "/" + newVal, false);
}
this.tableStore.dispatch("fetchDbviewerTable", {_silent: false});
store.set('dbviewer_app_filter', this.appFilter);
}
else {
this.collection = newVal;
app.navigate("#/manage/db/" + this.db + "/" + newVal + "/" + this.$route.params.query, false);
this.localCollection = newVal;
if (this.index) {
app.navigate("#/manage/db/indexes/" + this.localDb + "/" + newVal + "/" + this.$route.params.query, false);
}
else {
app.navigate("#/manage/db/" + this.localDb + "/" + newVal + "/" + this.$route.params.query, false);
}
this.tableStore.dispatch("fetchDbviewerTable", {_silent: false});
store.set('dbviewer_app_filter', this.appFilter);
}
Expand All @@ -160,13 +175,13 @@
dbviewerActions: function(command) {
switch (command) {
case 'aggregation':
window.location.hash = "#/manage/db/aggregate/" + this.db + "/" + this.collection;
window.location.hash = "#/manage/db/aggregate/" + this.localDb + "/" + this.localCollection;
break;
case 'indexes':
window.location.hash = "#/manage/db/indexes/" + this.db + "/" + this.collection;
window.location.hash = "#/manage/db/indexes/" + this.localDb + "/" + this.localCollection;
break;
case 'data':
window.location.hash = "#/manage/db/" + this.db + "/" + this.collection;
window.location.hash = "#/manage/db/" + this.localDb + "/" + this.localCollection;
break;
}
},
Expand Down Expand Up @@ -203,7 +218,7 @@
this.projection = [];
this.sortEnabled = false;
this.sort = "";
app.navigate("#/manage/db/" + this.db + "/" + this.selectedCollection);
app.navigate("#/manage/db/" + this.localDb + "/" + this.selectedCollection);
this.fetch(true);
},
clearFilters: function() {
Expand Down Expand Up @@ -241,8 +256,8 @@
projection: JSON.stringify(this.preparedProjectionFields),
query: this.queryFilter,
sort: sort,
collection: this.collection,
db: this.db,
collection: this.localCollection,
db: this.localDb,
url: "/o/export/db",
get_index: this.index
};
Expand All @@ -251,6 +266,7 @@
refresh: function(force) {
this.isRefresh = true;
this.fetch(force);
this.isExpanded = true;
},
highlight: function(content) {
return hljs.highlightAuto(content).value;
Expand All @@ -269,10 +285,10 @@
return 'bu-is-clickable';
},
updatePath: function(query) {
if (this.collection && this.db) {
window.location.hash = "#/manage/db/" + this.db + "/" + this.collection + "/" + JSON.stringify(query);
if (this.localCollection && this.localDb) {
window.location.hash = "#/manage/db/" + this.localDb + "/" + this.localCollection + "/" + JSON.stringify(query);
if (this.index) {
window.location.hash = "#/manage/db/indexes/" + this.db + "/" + this.collection + "/" + JSON.stringify(query);
window.location.hash = "#/manage/db/indexes/" + this.localDb + "/" + this.localCollection + "/" + JSON.stringify(query);
}
}
},
Expand All @@ -287,7 +303,7 @@
},
computed: {
dbviewerAPIEndpoint: function() {
var url = '/db?api_key=' + countlyGlobal.member.api_key + '&app_id=' + countlyCommon.ACTIVE_APP_ID + '&dbs=' + this.db + '&collection=' + this.collection;
var url = '/db?api_key=' + countlyGlobal.member.api_key + '&app_id=' + countlyCommon.ACTIVE_APP_ID + '&dbs=' + this.localDb + '&collection=' + this.localCollection;
if (this.queryFilter) {
url += '&filter=' + encodeURIComponent(this.queryFilter);
}
Expand All @@ -304,7 +320,7 @@
},
preparedCollectionList: function() {
var self = this;
return this.collections[this.db].list.filter(function(collection) {
return this.collections[this.localDb].list.filter(function(collection) {
if (self.appFilter !== "all") {
return collection.label.indexOf(self.appFilter) > -1;
}
Expand Down Expand Up @@ -334,19 +350,19 @@
this.isRefresh = false;
var routeHashItems = window.location.hash.split("/");
if (routeHashItems.length === 6) {
this.collection = routeHashItems[5];
this.selectedCollection = this.collection;
this.localCollection = routeHashItems[5];
this.selectedCollection = this.localCollection;
if (store.get('dbviewer_app_filter')) {
this.appFilter = store.get('dbviewer_app_filter');
}
else {
this.appFilter = "all";
}
this.db = routeHashItems[4];
this.localDb = routeHashItems[4];
}

if (!this.db) {
this.db = 'countly';
if (!this.localDb) {
this.localDb = 'countly';
}
if (this.$route.params && this.$route.params.query && JSON.parse(this.$route.params.query)) {
this.queryFilter = JSON.parse(this.$route.params.query).filter;
Expand All @@ -357,11 +373,11 @@
this.isDescentSort = JSON.parse(this.$route.params.query).isDescentSort;
}

if (!this.collection) {
if (this.collections[this.db].list.length) {
this.collection = this.collections[this.db].list[0].value;
this.selectedCollection = this.collection;
window.location = '#/manage/db/' + this.db + '/' + this.collections[this.db].list[0].value;
if (!this.localCollection) {
if (this.collections[this.localDb].list.length) {
this.localCollection = this.collections[this.localDb].list[0].value;
this.selectedCollection = this.localCollection;
window.location = '#/manage/db/' + this.localDb + '/' + this.collections[this.localDb].list[0].value;
}
}
for (var collectionKey in this.collections) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/dbviewer/frontend/public/templates/tab.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
<div class="bu-column">
<div class="bu-level">
<div class="bu-level-left">
<div v-if="db" class="dbviewer-tab__content">
<div v-if="localDb" class="dbviewer-tab__content">
<div class="bu-has-text-weight-normal bu-is-size-5" data-test-id="collection-and-app-name-label">
<span v-if="index">{{ i18n('dbviewer.indexes-of') }} </span>{{ decodeHtml(collections[db].map[collection]) }}
<span v-if="index">{{ i18n('dbviewer.indexes-of') }} </span>{{ decodeHtml(collections[localDb].map[localCollection]) }}
</div>
</div>
</div>
Expand Down
Loading