anyway show rotations form on error, preload user profile to use proper tz
This commit is contained in:
parent
5e58d125c0
commit
034459c46a
5 changed files with 15 additions and 9 deletions
|
|
@ -52,7 +52,7 @@ const RotationTutorial: FC<RotationProps> = (props) => {
|
|||
const base = 60 * 60 * 24 * days;
|
||||
|
||||
return firstShiftOffset / base;
|
||||
}, [events]);
|
||||
}, [events, startMoment]);
|
||||
|
||||
return (
|
||||
<div className={cx('slots', 'slots--tutorial')} style={{ transform: `translate(${x * 100}%, 0)` }}>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import { Schedule, Shift } from 'models/schedule/schedule.types';
|
|||
import { getTzOffsetString } from 'models/timezone/timezone.helpers';
|
||||
import { Timezone } from 'models/timezone/timezone.types';
|
||||
import { User } from 'models/user/user.types';
|
||||
import { getDateTime, getUTCString } from 'pages/schedule/Schedule.helpers';
|
||||
import { getDateTime, getStartOfWeek, getUTCString } from 'pages/schedule/Schedule.helpers';
|
||||
import { SelectOption } from 'state/types';
|
||||
import { useStore } from 'state/useStore';
|
||||
import { getCoords, waitForElement } from 'utils/DOM';
|
||||
|
|
@ -58,7 +58,7 @@ const RotationForm: FC<RotationFormProps> = observer((props) => {
|
|||
onDelete,
|
||||
layerPriority,
|
||||
shiftId,
|
||||
shiftMoment = dayjs().startOf('isoWeek'),
|
||||
shiftMoment = getStartOfWeek(currentTimezone),
|
||||
shiftColor = '#3D71D9',
|
||||
} = props;
|
||||
|
||||
|
|
@ -195,7 +195,7 @@ const RotationForm: FC<RotationFormProps> = observer((props) => {
|
|||
const updatePreview = () => {
|
||||
store.scheduleStore
|
||||
.updateRotationPreview(scheduleId, shiftId, getFromString(startMoment), false, params)
|
||||
.then(() => {
|
||||
.finally(() => {
|
||||
setIsOpen(true);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ class Rotations extends Component<RotationsProps, RotationsState> {
|
|||
<div
|
||||
className={cx('add-rotations-layer')}
|
||||
onClick={() => {
|
||||
this.handleAddLayer(nextPriority);
|
||||
this.handleAddLayer(nextPriority, startMoment);
|
||||
}}
|
||||
>
|
||||
<Text type="primary">+ Add rotations layer</Text>
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ export class UserStore extends BaseStore {
|
|||
[response.pk]: { ...response, timezone },
|
||||
};
|
||||
|
||||
this.rootStore.currentTimezone = timezone;
|
||||
|
||||
this.currentUserPk = response.pk;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,6 @@ export class RootBaseStore {
|
|||
// stores
|
||||
|
||||
async updateBasicData() {
|
||||
this.userStore.loadCurrentUser();
|
||||
this.teamStore.loadCurrentTeam();
|
||||
this.grafanaTeamStore.updateItems();
|
||||
this.updateFeatures();
|
||||
|
|
@ -154,7 +153,14 @@ export class RootBaseStore {
|
|||
}
|
||||
this.backendVersion = get_sync_response.version;
|
||||
this.backendLicense = get_sync_response.license;
|
||||
this.appLoading = false;
|
||||
|
||||
try {
|
||||
await this.userStore.loadCurrentUser();
|
||||
|
||||
this.appLoading = false;
|
||||
} catch (e) {
|
||||
this.initializationError = 'OnCall was not able to initialize current user';
|
||||
}
|
||||
}
|
||||
|
||||
handleSyncException(e: any) {
|
||||
|
|
@ -208,8 +214,6 @@ export class RootBaseStore {
|
|||
async setupPlugin(meta: AppPluginMeta<OnCallAppSettings>) {
|
||||
this.resetStatusToDefault();
|
||||
|
||||
console.log(meta);
|
||||
|
||||
if (!meta.jsonData?.onCallApiUrl) {
|
||||
this.pluginIsInitialized = false;
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue