commit
d0dbc4207a
8 changed files with 25 additions and 27 deletions
|
|
@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## v1.1.4 (2022-11-23)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bug fix for [#882](https://github.com/grafana/oncall/pull/882) which was causing the OnCall web calendars to not load
|
||||
- Bug fix which, when installing the plugin, or after removing a Grafana API token, caused the plugin to not load properly
|
||||
|
||||
## v1.1.3 (2022-11-22)
|
||||
|
||||
- Bug Fixes
|
||||
|
|
|
|||
|
|
@ -373,6 +373,8 @@ class CustomOnCallShift(models.Model):
|
|||
expected_start_day = min(CustomOnCallShift.ICAL_WEEKDAY_REVERSE_MAP[d] for d in self.by_day)
|
||||
delta = (expected_start_day - start.weekday()) % 7
|
||||
start = start + timezone.timedelta(days=delta)
|
||||
if self.until is not None:
|
||||
self.until = self.until + timezone.timedelta(days=delta)
|
||||
|
||||
if self.frequency == CustomOnCallShift.FREQUENCY_DAILY and self.by_day:
|
||||
result = self._daily_by_day_to_ical(time_zone, start, users_queue)
|
||||
|
|
|
|||
|
|
@ -1,16 +1,5 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`PluginState.checkIfPluginIsConnected token_ok: false 1`] = `
|
||||
"There was an issue with the communication between your OnCall API and your Grafana instance.
|
||||
Please ensure that your OnCall API is properly configured to communicate with your Grafana instance."
|
||||
`;
|
||||
|
||||
exports[`PluginState.checkIfPluginIsConnected token_ok: true 1`] = `
|
||||
Object {
|
||||
"token_ok": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`PluginState.generateInvalidOnCallApiURLErrorMsg it returns the proper error message - configured through env var: false 1`] = `
|
||||
"Could not communicate with your OnCall API at http://hello.com.
|
||||
Validate that the URL is correct, your OnCall API is running, and that it is accessible from your Grafana instance."
|
||||
|
|
|
|||
|
|
@ -297,14 +297,9 @@ class PluginState {
|
|||
onCallApiUrlIsConfiguredThroughEnvVar = false
|
||||
): Promise<PluginConnectedStatusResponse | string> => {
|
||||
try {
|
||||
const resp = await makeRequest<PluginConnectedStatusResponse>(`${this.ONCALL_BASE_URL}/status`, {
|
||||
return await makeRequest<PluginConnectedStatusResponse>(`${this.ONCALL_BASE_URL}/status`, {
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
if (!resp.token_ok) {
|
||||
return `There was an issue with the communication between your OnCall API and your Grafana instance.\nPlease ensure that your OnCall API is properly configured to communicate with your Grafana instance.`;
|
||||
}
|
||||
return resp;
|
||||
} catch (e) {
|
||||
return this.getHumanReadableErrorFromOnCallError(
|
||||
e,
|
||||
|
|
|
|||
|
|
@ -643,9 +643,9 @@ describe('PluginState.selfHostedInstallPlugin', () => {
|
|||
});
|
||||
|
||||
describe('PluginState.checkIfPluginIsConnected', () => {
|
||||
test.each([true, false])('token_ok: %s', async (tokenOk) => {
|
||||
test('it returns the API response', async () => {
|
||||
// mocks
|
||||
const mockedResp = { token_ok: tokenOk };
|
||||
const mockedResp = { foo: 'bar' };
|
||||
const onCallApiUrl = 'http://hello.com';
|
||||
makeRequest.mockResolvedValueOnce(mockedResp);
|
||||
|
||||
|
|
@ -653,7 +653,7 @@ describe('PluginState.checkIfPluginIsConnected', () => {
|
|||
const response = await PluginState.checkIfPluginIsConnected(onCallApiUrl);
|
||||
|
||||
// assertions
|
||||
expect(response).toMatchSnapshot();
|
||||
expect(response).toEqual(mockedResp);
|
||||
|
||||
expect(makeRequest).toHaveBeenCalledTimes(1);
|
||||
expect(makeRequest).toHaveBeenCalledWith(`${ONCALL_BASE_URL}/status`, { method: 'GET' });
|
||||
|
|
|
|||
|
|
@ -129,6 +129,9 @@ export class RootBaseStore {
|
|||
*
|
||||
* Otherwise, get the plugin connection status from the OnCall API and check a few pre-conditions:
|
||||
* - plugin must be considered installed by the OnCall API
|
||||
* - token_ok must be true
|
||||
* - This represents the status of the Grafana API token. It can be false in the event that either the token
|
||||
* hasn't been created, or if the API token was revoked in Grafana.
|
||||
* - user must be not "anonymous" (this is determined by the plugin-proxy)
|
||||
* - the OnCall API must be currently allowing signup
|
||||
* - the user must have an Admin role
|
||||
|
|
@ -151,12 +154,12 @@ export class RootBaseStore {
|
|||
return this.setupPluginError(pluginConnectionStatus);
|
||||
}
|
||||
|
||||
const { allow_signup, is_installed, is_user_anonymous } = pluginConnectionStatus;
|
||||
const { allow_signup, is_installed, is_user_anonymous, token_ok } = pluginConnectionStatus;
|
||||
if (is_user_anonymous) {
|
||||
return this.setupPluginError(
|
||||
'😞 Unfortunately Grafana OnCall is available for authorized users only, please sign in to proceed.'
|
||||
);
|
||||
} else if (!is_installed) {
|
||||
} else if (!is_installed || !token_ok) {
|
||||
if (!allow_signup) {
|
||||
return this.setupPluginError('🚫 OnCall has temporarily disabled signup of new users. Please try again later.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,16 +144,18 @@ describe('rootBaseStore', () => {
|
|||
);
|
||||
});
|
||||
|
||||
test('plugin is not installed, signup is allowed, user is an admin, plugin installation is triggered', async () => {
|
||||
test.each([
|
||||
{ is_installed: false, token_ok: true },
|
||||
{ is_installed: true, token_ok: false },
|
||||
])('signup is allowed, user is an admin, plugin installation is triggered', async (scenario) => {
|
||||
// mocks/setup
|
||||
const onCallApiUrl = 'http://asdfasdf.com';
|
||||
const rootBaseStore = new RootBaseStore();
|
||||
const mockedLoadCurrentUser = jest.fn();
|
||||
|
||||
PluginState.checkIfPluginIsConnected = jest.fn().mockResolvedValueOnce({
|
||||
...scenario,
|
||||
is_user_anonymous: false,
|
||||
is_installed: false,
|
||||
token_ok: true,
|
||||
allow_signup: true,
|
||||
version: 'asdfasdf',
|
||||
license: 'asdfasdf',
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ type: application
|
|||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 1.0.11
|
||||
version: 1.0.12
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
# It is recommended to use it with quotes.
|
||||
appVersion: "v1.0.51"
|
||||
appVersion: "v1.1.0"
|
||||
dependencies:
|
||||
- name: cert-manager
|
||||
version: v1.8.0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue