Compare commits

...

6 Commits

Author SHA1 Message Date
Tudor Stanciu 8856f25eac [1.1.2] 2023-02-04 13:33:39 +02:00
Tudor Stanciu aae42cb2f9 remove old scripts 2023-02-04 13:27:41 +02:00
Tudor Stanciu 4f35866f99 remove old notes 2023-02-04 13:25:53 +02:00
Tudor Stanciu 51a7e0faa9 tuitio url 2023-02-04 13:24:19 +02:00
Tudor Stanciu 446e00cab4 fix 2023-01-30 00:50:00 +02:00
Tudor Stanciu 0907c9cedd use functions from @flare/js-utils 2023-01-30 00:48:47 +02:00
12 changed files with 50 additions and 149 deletions

View File

@ -1,5 +1,5 @@
PUBLIC_URL=/network-resurrector/ PUBLIC_URL=/network-resurrector/
REACT_APP_IDENTITY_AUTHENTICATION_URL=https://lab.code-rove.com/identity-server-api/identity/authenticate?UserName={username}&Password={password} REACT_APP_IDENTITY_AUTHENTICATION_URL=https://lab.code-rove.com/tuitio/identity/authenticate?UserName={username}&Password={password}
REACT_APP_NETWORK_RESURRECTOR_API_URL=https://lab.code-rove.com/network-resurrector-api REACT_APP_NETWORK_RESURRECTOR_API_URL=https://lab.code-rove.com/network-resurrector-api
#900000 milliseconds = 15 minutes #900000 milliseconds = 15 minutes

41
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "network-resurrector-frontend", "name": "network-resurrector-frontend",
"version": "1.1.1", "version": "1.1.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -1328,9 +1328,9 @@
} }
}, },
"@flare/js-utils": { "@flare/js-utils": {
"version": "1.0.1", "version": "1.0.2",
"resolved": "https://lab.code-rove.com/public-node-registry/@flare%2fjs-utils/-/js-utils-1.0.1.tgz", "resolved": "https://lab.code-rove.com/public-node-registry/@flare%2fjs-utils/-/js-utils-1.0.2.tgz",
"integrity": "sha512-54zfXBeof4ns9wEGvUeORd6SiAvCcUNEIiamnLtbASVMY6TxrpGp7UL+Dm7iGdC5jmDb5stla6I8aHroQuvvqg==" "integrity": "sha512-49KjpcRUD6fXPC60bmCsPa8frU6wlQyI5RsjMD70zsuvk8BZFdopsETsjsCembbmzTScIhfMACU4RnimOEwg9Q=="
}, },
"@gar/promisify": { "@gar/promisify": {
"version": "1.1.3", "version": "1.1.3",
@ -4033,6 +4033,15 @@
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"optional": true "optional": true
}, },
"bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"optional": true,
"requires": {
"file-uri-to-path": "1.0.0"
}
},
"bluebird": { "bluebird": {
"version": "3.7.2", "version": "3.7.2",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
@ -7001,6 +7010,12 @@
} }
} }
}, },
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
"optional": true
},
"filesize": { "filesize": {
"version": "6.1.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/filesize/-/filesize-6.1.0.tgz", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.1.0.tgz",
@ -11134,6 +11149,12 @@
"resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz",
"integrity": "sha512-cnAsSVxIDsYt0v7HmC0hWZFwwXSh+E6PgCrREDuN/EsjgLwA5XRmlMHhSiDPrt6HxY1gTivEa/Zh7GtODoLevQ==" "integrity": "sha512-cnAsSVxIDsYt0v7HmC0hWZFwwXSh+E6PgCrREDuN/EsjgLwA5XRmlMHhSiDPrt6HxY1gTivEa/Zh7GtODoLevQ=="
}, },
"nan": {
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==",
"optional": true
},
"nanoid": { "nanoid": {
"version": "3.3.4", "version": "3.3.4",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
@ -16285,7 +16306,11 @@
"version": "1.2.13", "version": "1.2.13",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"optional": true "optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
}, },
"glob-parent": { "glob-parent": {
"version": "3.1.0", "version": "3.1.0",
@ -16863,7 +16888,11 @@
"version": "1.2.13", "version": "1.2.13",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"optional": true "optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
}, },
"glob-parent": { "glob-parent": {
"version": "3.1.0", "version": "3.1.0",

View File

@ -1,7 +1,7 @@
{ {
"name": "network-resurrector-frontend", "name": "network-resurrector-frontend",
"version": "1.1.1", "version": "1.1.2",
"description": "Frontend component of Network resurrector", "description": "Frontend component of Network resurrector system",
"author": { "author": {
"name": "Tudor Stanciu", "name": "Tudor Stanciu",
"email": "tudor.stanciu94@gmail.com", "email": "tudor.stanciu94@gmail.com",
@ -9,11 +9,11 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://dev.azure.com/tstanciu94/NetworkResurrector/_git/NetworkResurrector_Frontend" "url": "https://lab.code-rove.com/gitea/tudor.stanciu/network-resurrector-frontend"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@flare/js-utils": "^1.0.0", "@flare/js-utils": "^1.0.2",
"@material-ui/core": "^4.11.2", "@material-ui/core": "^4.11.2",
"@material-ui/icons": "^4.11.2", "@material-ui/icons": "^4.11.2",
"@testing-library/jest-dom": "^5.11.6", "@testing-library/jest-dom": "^5.11.6",

View File

@ -1,20 +1,3 @@
#######################################################################################################################################################
Azure DevOps Repository Password: nih65lpohjpmyru3sarcsg62rc26nknsksi7fqo7bas37ssqhpna
#######################################################################################################################################################
***********
** INFO: **
***********
In gridul de retea, pe fiecare linie va fi un buton care va deschide un log.
Log-ul va fi popup iar continutul lui poate fi ultima componenta de aici https://material-ui.com/components/app-bar/
**************************************************************************************************************************
https://medium.com/@tacomanator/environments-with-create-react-app-7b645312c09d
https://create-react-app.dev/docs/adding-custom-environment-variables/
https://stackoverflow.com/questions/55690143/what-is-the-difference-between-env-local-and-env-development-local
REACT v4: REACT v4:
https://v4.mui.com/getting-started/installation/ https://v4.mui.com/getting-started/installation/
https://v4.mui.com/components/material-icons/ https://v4.mui.com/components/material-icons/

View File

@ -1,37 +0,0 @@
#######################################################################################################################################################
Docker commands:
*****************
Create image:
--from solution folder:
docker image build -t "network-resurrector-frontend:1.0.0" .
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t "tstanciu/sta-registry:network-resurrector-frontend-1.0.0-arm32v7" --push .
Run image:
docker run -p 5053:80 -it network-resurrector-frontend:1.0.0
Push image to registry:
--tag image
docker tag network-resurrector-frontend:1.0.0 alpine-nexus:8500/network-resurrector/network-resurrector-frontend:1.0.0
--login to registry
docker login --username=admin --password="***********" alpine-nexus:8500
--push image
docker push alpine-nexus:8500/network-resurrector/network-resurrector-frontend:1.0.0
Pull image from registry
--login to registry
--pull image
docker pull alpine-nexus:8500/network-resurrector/network-resurrector-frontend:1.0.0
Run container in prod env
docker run -d --name network-resurrector-frontend --restart=always -p 5009:80 alpine-nexus:8500/network-resurrector/network-resurrector-frontend:1.0.0
Rename container
docker rename <container_id> network-resurrector-frontend
#######################################################################################################################################################
Docker container last version: 1.0.0
#######################################################################################################################################################

View File

@ -1,19 +0,0 @@
#!/bin/bash
echo "Welcome!"
version="1.1.0"
registryPass="***********"
echo "Create docker image with version $version."
docker image build --build-arg APP_VERSION=$version -t "network-resurrector-frontend:$version" .
echo "Tag docker image with registry prefix."
docker tag network-resurrector-frontend:$version alpine-nexus:8500/network-resurrector/network-resurrector-frontend:$version
echo "Login to alpine-nexus registry."
docker login --username=admin --password=$registryPass alpine-nexus:8500
echo "Push image network-resurrector-frontend:$version to registry."
docker push alpine-nexus:8500/network-resurrector/network-resurrector-frontend:$version
echo "DONE!"

View File

@ -1,22 +0,0 @@
#!/bin/sh
echo "Welcome!"
version="1.1.0"
oldver="1.0.1"
echo "Pull docker image network-resurrector-frontend:$version from registry."
docker pull alpine-nexus:8500/network-resurrector/network-resurrector-frontend:$version
echo "Stop old container."
docker stop network-resurrector-frontend && docker rm network-resurrector-frontend
echo "Run new container."
docker run -d --name network-resurrector-frontend --restart=always -p 5009:80 alpine-nexus:8500/network-resurrector/network-resurrector-frontend:$version
echo "Remove old image network-resurrector-frontend:$oldver."
docker rmi alpine-nexus:8500/network-resurrector/network-resurrector-frontend:$oldver
echo "Get container logs:"
docker logs network-resurrector-frontend
echo "DONE!"

View File

@ -11,7 +11,7 @@ const useApi = () => {
let message; let message;
switch (err?.status) { switch (err?.status) {
case 500: case 500:
message = `${err.title} ${err.correlationId}`; message = err.title;
break; break;
case 404: case 404:
@ -19,7 +19,7 @@ const useApi = () => {
break; break;
default: default:
message = `${err.title} ${err.correlationId}`; message = err.title;
} }
error(message); error(message);

View File

@ -1,6 +1,7 @@
import { getItem } from "../utils/localStorage"; import { localStorage } from "@flare/js-utils";
import { storageKeys } from "../utils/identity"; import { storageKeys } from "../utils/identity";
const { getItem } = localStorage;
const token = getItem(storageKeys.TOKEN); const token = getItem(storageKeys.TOKEN);
const userName = getItem(storageKeys.USER); const userName = getItem(storageKeys.USER);

View File

@ -1,8 +1,10 @@
import axios from "axios"; import axios from "axios";
import i18next from "i18next"; import i18next from "i18next";
import { getItem } from "./localStorage"; import { localStorage } from "@flare/js-utils";
import { storageKeys } from "./identity"; import { storageKeys } from "./identity";
const { getItem } = localStorage;
function getHeaders() { function getHeaders() {
const token = getItem(storageKeys.TOKEN); const token = getItem(storageKeys.TOKEN);
const language = i18next.language; const language = i18next.language;

View File

@ -1,5 +1,7 @@
import { request } from "./axios"; import { request } from "./axios";
import { setItem, getItem, removeItem } from "./localStorage"; import { localStorage } from "@flare/js-utils";
const { setItem, getItem, removeItem } = localStorage;
const storageKeys = { const storageKeys = {
TOKEN: "AUTHORIZATION_TOKEN", TOKEN: "AUTHORIZATION_TOKEN",

View File

@ -1,38 +0,0 @@
import { typeValidator } from "@flare/js-utils";
const setItem = (key, value) => {
const { isArray, isObject } = typeValidator;
let valueToStore = value;
if (isArray(value) || isObject(value)) {
valueToStore = JSON.stringify(value);
}
window.localStorage.setItem(key, valueToStore);
};
const getItem = key => {
var value = window.localStorage.getItem(key);
const { isJson } = typeValidator;
var { data, success } = isJson(value);
if (success) {
return data;
} else {
return value;
}
};
const removeItem = key => {
window.localStorage.removeItem(key);
};
const clear = () => {
window.localStorage.clear();
};
const key = index => {
var keyName = window.localStorage.key(index);
return keyName;
};
export { setItem, getItem, removeItem, clear, key };