Skip to content

Commit

Permalink
ISPN-14264 Counters page - double click on Strong/Weak select loads a…
Browse files Browse the repository at this point in the history
…ll counters
  • Loading branch information
dpanshug authored and karesti committed Nov 2, 2022
1 parent e20eaf0 commit 5097632
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 45 deletions.
70 changes: 35 additions & 35 deletions data/create-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,71 +3,71 @@ pass=$2
userPass="$user:$pass"
echo "= Init create data"
echo "= Delete caches"
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/schemas/people
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/caches/json-cache
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/caches/xml-cache
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/caches/java-cache
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/caches/jboss-cache
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/caches/text-cache
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/caches/not-encoded
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/caches/indexed-cache
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/caches/octet-stream-cache
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/caches/java-serialized-cache
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/caches/invalidation-cache
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/caches/scattered-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/schemas/people
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/json-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/xml-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/java-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/jboss-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/text-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/not-encoded
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/indexed-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/octet-stream-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/java-serialized-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/invalidation-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/scattered-cache

echo "= Create schema"

curl -XPOST -u $userPass -H "Content-Type: application/json" --data-binary "@schemas/people.proto" "http://localhost:11222/rest/v2/schemas/people"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" --data-binary "@schemas/people.proto" "http://localhost:11222/rest/v2/schemas/people"

#Creating some more schemas for testing pagination and navigation
for i in {1..10}
do
curl -XPOST -u $userPass -H "Content-Type: application/json" --data-binary "testSchema-$i" "http://localhost:11222/rest/v2/schemas/test-$i"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" --data-binary "testSchema-$i" "http://localhost:11222/rest/v2/schemas/test-$i"
done

echo "= Create caches"
curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@caches/textCache.json" "http://localhost:11222/rest/v2/caches/text-cache"
curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@caches/xmlCache.json" "http://localhost:11222/rest/v2/caches/xml-cache"
curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@caches/jsonCache.json" "http://localhost:11222/rest/v2/caches/json-cache"
curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@caches/jbossCache.json" "http://localhost:11222/rest/v2/caches/jboss-cache"
curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@caches/javaCache.json" "http://localhost:11222/rest/v2/caches/java-cache"
curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@caches/notEncoded.json" "http://localhost:11222/rest/v2/caches/not-encoded"
curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@caches/indexedCache.json" "http://localhost:11222/rest/v2/caches/indexed-cache"
curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@caches/octet-stream.json" "http://localhost:11222/rest/v2/caches/octet-stream-cache"
curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@caches/javaSerializedCache.json" "http://localhost:11222/rest/v2/caches/java-serialized-cache"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/textCache.json" "http://localhost:11222/rest/v2/caches/text-cache"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/xmlCache.json" "http://localhost:11222/rest/v2/caches/xml-cache"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/jsonCache.json" "http://localhost:11222/rest/v2/caches/json-cache"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/jbossCache.json" "http://localhost:11222/rest/v2/caches/jboss-cache"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/javaCache.json" "http://localhost:11222/rest/v2/caches/java-cache"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/notEncoded.json" "http://localhost:11222/rest/v2/caches/not-encoded"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/indexedCache.json" "http://localhost:11222/rest/v2/caches/indexed-cache"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/octet-stream.json" "http://localhost:11222/rest/v2/caches/octet-stream-cache"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/javaSerializedCache.json" "http://localhost:11222/rest/v2/caches/java-serialized-cache"
# curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@caches/invalidationCache.json" "http://localhost:11222/rest/v2/caches/invalidation-cache"
curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@caches/scatteredCache.json" "http://localhost:11222/rest/v2/caches/scattered-cache"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/scatteredCache.json" "http://localhost:11222/rest/v2/caches/scattered-cache"


for i in {1..10}
do
curl -XPOST -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.String" -H "Content-Type: application/x-java-object;type=java.lang.String" -d "val-$i" http://localhost:11222/rest/v2/caches/indexed-cache/key-$i
curl -XPOST --digest -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.String" -H "Content-Type: application/x-java-object;type=java.lang.String" -d "val-$i" http://localhost:11222/rest/v2/caches/indexed-cache/key-$i
done
curl -XPOST -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.String" -H "Content-Type: application/json" -d "@caches/peopleData.json" http://localhost:11222/rest/v2/caches/indexed-cache/elaia
curl -XPOST --digest -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.String" -H "Content-Type: application/json" -d "@caches/peopleData.json" http://localhost:11222/rest/v2/caches/indexed-cache/elaia

#Java data
curl -XPOST -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.String" -H "Content-Type: application/x-java-object;type=java.lang.String" -d string http://localhost:11222/rest/v2/caches/java-cache/key
curl -XPOST -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.Long" -H "Content-Type: application/x-java-object;type=java.lang.String" -d long http://localhost:11222/rest/v2/caches/java-cache/12345678
curl -XPOST -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.Integer" -H "Content-Type: application/x-java-object;type=java.lang.String" -d integer http://localhost:11222/rest/v2/caches/java-cache/123
curl -XPOST -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.Double" -H "Content-Type: application/x-java-object;type=java.lang.String" -d double http://localhost:11222/rest/v2/caches/java-cache/123.909
curl -XPOST -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.Float" -H "Content-Type: application/x-java-object;type=java.lang.String" -d float http://localhost:11222/rest/v2/caches/java-cache/12.87
curl -XPOST --digest -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.String" -H "Content-Type: application/x-java-object;type=java.lang.String" -d string http://localhost:11222/rest/v2/caches/java-cache/key
curl -XPOST --digest -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.Long" -H "Content-Type: application/x-java-object;type=java.lang.String" -d long http://localhost:11222/rest/v2/caches/java-cache/12345678
curl -XPOST --digest -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.Integer" -H "Content-Type: application/x-java-object;type=java.lang.String" -d integer http://localhost:11222/rest/v2/caches/java-cache/123
curl -XPOST --digest -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.Double" -H "Content-Type: application/x-java-object;type=java.lang.String" -d double http://localhost:11222/rest/v2/caches/java-cache/123.909
curl -XPOST --digest -u $userPass -H "Key-Content-Type: application/x-java-object;type=java.lang.Float" -H "Content-Type: application/x-java-object;type=java.lang.String" -d float http://localhost:11222/rest/v2/caches/java-cache/12.87

#Jboss data


echo "= Delete counters"
for i in {1..5}
do
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/counters/weak-$i
curl -XDELETE -u $userPass http://localhost:11222/rest/v2/counters/strong-$i
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/counters/weak-$i
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/counters/strong-$i
done

echo "= Create some counters"
for i in {1..5}
do
curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@counters/weakCounter.json" "http://localhost:11222/rest/v2/counters/weak-$i"
curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@counters/strongCounter.json" "http://localhost:11222/rest/v2/counters/strong-$i"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@counters/weakCounter.json" "http://localhost:11222/rest/v2/counters/weak-$i"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@counters/strongCounter.json" "http://localhost:11222/rest/v2/counters/strong-$i"
done

#echo "= Create some tasks"
Expand Down
20 changes: 10 additions & 10 deletions src/app/CacheManagers/CounterTableDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ const CounterTableDisplay = (props: { setCountersCount: (number) => void; isVisi
});
const [rows, setRows] = useState<(string | any)[]>([]);

useEffect(() => {
if (filteredCounters) {
const initSlice = (countersPagination.page - 1) * countersPagination.perPage;
updateRows(filteredCounters.slice(initSlice, initSlice + countersPagination.perPage));
}
}, [countersPagination, filteredCounters]);

const columns = [
{
title: t('cache-managers.counter-name'),
Expand Down Expand Up @@ -104,27 +111,21 @@ const CounterTableDisplay = (props: { setCountersCount: (number) => void; isVisi

setFilteredCounters(currentCounters);
props.setCountersCount(counters.length);
const initSlice = (countersPagination.page - 1) * countersPagination.perPage;
updateRows(currentCounters.slice(initSlice, initSlice + countersPagination.perPage));
}
};

const onSetPage = (_event, pageNumber) => {
setCountersPagination({
page: pageNumber,
perPage: countersPagination.perPage
...countersPagination,
page: pageNumber
});
const initSlice = (pageNumber - 1) * countersPagination.perPage;
updateRows(filteredCounters.slice(initSlice, initSlice + countersPagination.perPage));
};

const onPerPageSelect = (_event, perPage) => {
setCountersPagination({
page: countersPagination.page,
page: 1,
perPage: perPage
});
const initSlice = (countersPagination.page - 1) * perPage;
updateRows(filteredCounters.slice(initSlice, initSlice + perPage));
};

const displayConfig = (config: CounterConfig) => {
Expand Down Expand Up @@ -216,7 +217,6 @@ const CounterTableDisplay = (props: { setCountersCount: (number) => void; isVisi
}

setFilteredCounters(switchCounters);
updateRows(switchCounters);
setSelectedCounterType(id);
setIsOpenFilter(false);
};
Expand Down

0 comments on commit 5097632

Please sign in to comment.