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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/components/editorPage/editor-page/test/editor-page.e2e.ts

This file was deleted.

18 changes: 0 additions & 18 deletions src/components/editorPage/editor-page/test/editor-page.spec.tsx

This file was deleted.

10 changes: 10 additions & 0 deletions src/components/editorPage/editor-res/editor-res.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ export class EditorRes {
const chips = { ...state.order };
delete chips[item];
state.order = chips;
state.refreshData();
}

removeSearchChip = (item) => {
const chips = { ...state.filter };
delete chips[item];
state.filter = chips;
state.refreshData();
}

computeHeader() {
Expand All @@ -40,20 +42,27 @@ export class EditorRes {
rowsHandler(e) {
state.limit = e.target.value;
state.page = 1;
state.offset = (state.limit*state.page)- state.limit;
state.refreshData();
}

nextPage() {
++state.page;
state.offset = (state.limit*state.page)- state.limit;
state.refreshData();
}

prevPage() {
--state.page;
state.offset = (state.limit*state.page)- state.limit;
state.refreshData();
}

toggleSortMethod = (id: string) => {
const chips = {};
chips[id] = state.order[id] === "desc" ? 'asc' : 'desc';
state.order = chips;
state.refreshData();
};

searchMethod(searchValue: string, colName: string, searchOption: string, textSearchOption: string, numberSearchOption: string) {
Expand All @@ -67,6 +76,7 @@ export class EditorRes {
chips[colName] = searchOperation;

state.filter = chips;
state.refreshData();
}


Expand Down
12 changes: 11 additions & 1 deletion src/components/editorPage/node-item/node-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ const DROPDOWN_ITEMS = ['View'];
})
export class NodeItem {
@Prop() nodeError:null | string;
nodeChangeHandler(nodeName){
state.selectedNodeName = nodeName
state.limit= 10,
state.offset= 0, //remove
state.page= 1,
state.order= {},
state.filter= {},
state.total= 0,
state.refreshData()
}
render() {
return (
<div style={{ overflow: 'visible' }} class={'py-4 px-3 bg-gray-100 rounded-md'}>
Expand All @@ -19,7 +29,7 @@ export class NodeItem {
<li>
<div class="flex justify-between p-2 text-base font-normal text-gray-900 rounded-lg bg-gray-200">
<div class="ml-3">{item}</div>
<menu-drop-down listTitle={item} list={DROPDOWN_ITEMS} fetchData={nodeName => (state.selectedNodeName = nodeName)}></menu-drop-down>
<menu-drop-down listTitle={item} list={DROPDOWN_ITEMS} fetchData={(nodeName) => this.nodeChangeHandler(nodeName)}></menu-drop-down>
</div>
</li>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export class QueryResultTable {
@Prop() toggleSortMethod: any;
@Prop() searchMethod: any;
@Prop() clearSearch: any;
// @Prop() isLoading: boolean;
@Prop() isLoadingError: boolean;

@State() data: any;
Expand All @@ -43,6 +42,21 @@ export class QueryResultTable {
this.from = (this.currentPage - 1) * this.limit + 1;
this.to = this.currentPage * this.limit;
}
dataFormatter(rawData) {
let data: any = rawData;
if(typeof(data) !== 'string' && typeof(data) !== 'number'){
data = JSON.stringify(data);
}
if (data.length > 25) {
return data.slice(0, 25) + '...';
} else {
if (/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z/.test(data)) {
return data.slice(0, 16).split('T')[0] + ' at ' + data.slice(11, 19);
} else {
return data;
}
}
}

render() {
const trList = [];
Expand Down Expand Up @@ -95,17 +109,10 @@ export class QueryResultTable {
this.tableBody.map((item: any) => (
<tr class="hover:bg-gray-100 transition">
{this.tableHeader.map((id: any) => (
// <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{item[id.alias]}</td>
<td title={item[id.alias]} text-overflow:ellipsis class="px-6 py-3 whitespace-nowrap text-sm text-gray-900">
{!id.click.clickable ? (
item[id.alias] ? (
item[id.alias].length > 25 ? (
item[id.alias].slice(0, 25) + '...'
) : /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z/.test(item[id.alias]) ? (
item[id.alias].slice(0, 16).split('T')[0] + ' at ' + item[id.alias].slice(11, 19)
) : (
item[id.alias]
)
this.dataFormatter(item[id.alias])
) : (
item[id.alias]
)
Expand Down
26 changes: 4 additions & 22 deletions src/components/editorPage/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,9 @@ const { state, onChange, reset } = createStore({
timeTaken:null,
refresh:null,

});

onChange('selectedNodeName', value => {
fetchData(value);
});

onChange('order', () => {
fetchData(state.selectedNodeName);
});

onChange('filter', () => {
fetchData(state.selectedNodeName);
refreshData: async () => {
await fetchData(state.selectedNodeName)
}
});

onChange('refresh', () => {
Expand Down Expand Up @@ -130,14 +121,5 @@ const fetchData = async (nodeName: string) => {
}
};

onChange('page', (value) => {
state.offset = (state.limit*value)- state.limit;
fetchData(state.selectedNodeName);
});

onChange('limit', () => {
fetchData(state.selectedNodeName);
});

export default state;
export { fetchData, reset }
export { fetchData, reset }
2 changes: 1 addition & 1 deletion src/components/userProfilePage/last-logs/last-logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class LastLogs {
this.isLoading = true;
this.isLoadingError = false;
try {
const response =await axios.get(`http://localhost:3000/api/editor/query/logs?limit=49&offset=0&filter_ownerId=${this.user}&order=desc`)
const response =await axios.get(`${this.url}api/editor/query/logs?limit=49&offset=0&filter_ownerId=${this.user}&order=desc`)
response.data.respond.map(item=>{item.isCustomQuery===true? item["isCustomQuery"]="Custom Query": item["isCustomQuery"]="Builder Query"});
this.total = response.data.total;
this.total = response.data.total;
Expand Down