Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Toolkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Web Component Framework
Toolkit
Commits
2126fd02
Commit
2126fd02
authored
5 years ago
by
Bekerle, Patrizio
Committed by
Reiter, Christoph
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add jsonld server connection and other error notifications
parent
04e8cfe3
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/common/i18n/de/translation.json
+5
-0
5 additions, 0 deletions
packages/common/i18n/de/translation.json
packages/common/i18n/en/translation.json
+5
-0
5 additions, 0 deletions
packages/common/i18n/en/translation.json
packages/common/jsonld.js
+24
-6
24 additions, 6 deletions
packages/common/jsonld.js
with
34 additions
and
6 deletions
packages/common/i18n/de/translation.json
+
5
−
0
View file @
2126fd02
...
@@ -2,5 +2,10 @@
...
@@ -2,5 +2,10 @@
"error"
:
{
"error"
:
{
"summary"
:
"Ein Fehler ist aufgetreten"
,
"summary"
:
"Ein Fehler ist aufgetreten"
,
"connection-to-server-refused"
:
"Verbindungs zum Server verweigert!"
"connection-to-server-refused"
:
"Verbindungs zum Server verweigert!"
},
"jsonld"
:
{
"error-api-server"
:
"Verbindung zum API Server {{apiUrl}} fehlgeschlagen!"
,
"error-hydra-documentation-url-not-set"
:
"Hydra apiDocumentation URL wurden für server {{apiUrl}} nicht gesetzt!"
,
"api-documentation-server"
:
"Verbindung zum apiDocumentation API Server {{apiDocUrl}} fehlgeschlagen!"
}
}
}
}
This diff is collapsed.
Click to expand it.
packages/common/i18n/en/translation.json
+
5
−
0
View file @
2126fd02
...
@@ -2,5 +2,10 @@
...
@@ -2,5 +2,10 @@
"error"
:
{
"error"
:
{
"summary"
:
"An error occurred"
,
"summary"
:
"An error occurred"
,
"connection-to-server-refused"
:
"Connection to server refused!"
"connection-to-server-refused"
:
"Connection to server refused!"
},
"jsonld"
:
{
"error-api-server"
:
"Connection to api server {{apiUrl}} failed!"
,
"error-hydra-documentation-url-not-set"
:
"Hydra apiDocumentation url was not set for server {{apiUrl}}!"
,
"api-documentation-server"
:
"Connection to apiDocumentation server {{apiDocUrl}} failed!"
}
}
}
}
This diff is collapsed.
Click to expand it.
packages/common/jsonld.js
+
24
−
6
View file @
2126fd02
"
use strict
"
;
"
use strict
"
;
import
{
send
as
notify
}
from
'
./notification
'
;
import
*
as
utils
from
"
./utils
"
;
import
*
as
utils
from
"
./utils
"
;
import
{
i18n
}
from
"
./i18n
"
;
let
instances
=
{};
let
instances
=
{};
let
successFunctions
=
{};
let
successFunctions
=
{};
...
@@ -106,25 +108,41 @@ export default class JSONLD {
...
@@ -106,25 +108,41 @@ export default class JSONLD {
for
(
const
fnc
of
successFunctions
[
apiUrl
])
if
(
typeof
fnc
==
'
function
'
)
fnc
(
instance
);
for
(
const
fnc
of
successFunctions
[
apiUrl
])
if
(
typeof
fnc
==
'
function
'
)
fnc
(
instance
);
successFunctions
[
apiUrl
]
=
[];
successFunctions
[
apiUrl
]
=
[];
}
else
{
}
else
{
for
(
const
fnc
of
failureFunctions
[
apiUrl
])
if
(
typeof
fnc
==
'
function
'
)
fnc
();
JSONLD
.
executeFailureFunctions
(
apiUrl
,
i18n
.
t
(
'
jsonld.api-documentation-server
'
,
{
apiUrl
:
apiDocUrl
}));
failureFunctions
[
apiUrl
]
=
[];
}
}
};
};
docXhr
.
send
();
docXhr
.
send
();
}
else
{
}
else
{
for
(
const
fnc
of
failureFunctions
[
apiUrl
])
if
(
typeof
fnc
==
'
function
'
)
fnc
();
JSONLD
.
executeFailureFunctions
(
apiUrl
,
i18n
.
t
(
'
jsonld.error-hydra-documentation-url-not-set
'
,
{
apiUrl
:
apiUrl
}));
failureFunctions
[
apiUrl
]
=
[];
}
}
}
else
{
}
else
{
for
(
const
fnc
of
failureFunctions
[
apiUrl
])
if
(
typeof
fnc
==
'
function
'
)
fnc
();
JSONLD
.
executeFailureFunctions
(
apiUrl
,
i18n
.
t
(
'
jsonld.error-api-server
'
,
{
apiUrl
:
apiUrl
}));
failureFunctions
[
apiUrl
]
=
[];
}
}
};
};
xhr
.
send
();
xhr
.
send
();
}
}
/**
* Execute failure functions and send general notification
*
* @param apiUrl
* @param message
*/
static
executeFailureFunctions
(
apiUrl
,
message
=
""
)
{
for
(
const
fnc
of
failureFunctions
[
apiUrl
])
if
(
typeof
fnc
==
'
function
'
)
fnc
();
failureFunctions
[
apiUrl
]
=
[];
if
(
message
!==
""
)
{
notify
({
"
summary
"
:
i18n
.
t
(
'
error.summary
'
),
"
body
"
:
message
,
"
type
"
:
"
danger
"
,
});
}
}
static
getInstance
(
apiUrl
)
{
static
getInstance
(
apiUrl
)
{
return
instances
[
apiUrl
];
return
instances
[
apiUrl
];
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment