@intellias/menu 1.0.2 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -9
- package/dist/css/main.css +155 -2
- package/dist/index.html +9 -0
- package/dist/js/{1.js → kudosForm.js} +24 -58
- package/dist/js/main.js +654 -689
- package/dist/js/rejectComponent.js +363 -0
- package/dist/js/{6.js → vendors~kudosForm.js} +5 -5
- package/dist/js/{0.js → vendors~kudosForm~rejectComponent.js} +27 -27
- package/dist/js/vue.js +2 -2
- package/package.json +100 -112
- package/Menu.ts +0 -625
- package/assets/icons/arrow-down.svg +0 -13
- package/assets/icons/arrow-left.svg +0 -3
- package/assets/icons/arrow-submenu.svg +0 -8
- package/assets/icons/close.svg +0 -3
- package/assets/icons/delete.svg +0 -13
- package/assets/icons/faq-new.svg +0 -4
- package/assets/icons/kudos.svg +0 -14
- package/assets/icons/loading-spinner.svg +0 -40
- package/assets/icons/notification.svg +0 -11
- package/assets/icons/notifications/assessment.svg +0 -10
- package/assets/icons/notifications/buddy_program.svg +0 -8
- package/assets/icons/notifications/compensation_packages.svg +0 -10
- package/assets/icons/notifications/dsat.svg +0 -8
- package/assets/icons/notifications/feedback.svg +0 -7
- package/assets/icons/notifications/kudos.svg +0 -4
- package/assets/icons/notifications/overtime_requests.svg +0 -15
- package/assets/icons/notifications/pdu_program.svg +0 -4
- package/assets/icons/notifications/profile_update.svg +0 -6
- package/assets/icons/notifications/recommendation_program.svg +0 -7
- package/assets/icons/notifications/reminders.svg +0 -4
- package/assets/icons/notifications/sick_leaves.svg +0 -5
- package/assets/icons/notifications/smarts.svg +0 -4
- package/assets/icons/notifications/survey.svg +0 -8
- package/assets/icons/notifications/unpaid_leave.svg +0 -4
- package/assets/icons/notifications/vacations.svg +0 -4
- package/assets/icons/pause.svg +0 -13
- package/assets/icons/play.svg +0 -13
- package/assets/icons/smart.svg +0 -14
- package/assets/icons/smarts-kudos.svg +0 -11
- package/assets/icons/spinner-solid.svg +0 -1
- package/assets/icons/vacation.svg +0 -14
- package/assets/icons/visibility.svg +0 -1
- package/assets/intems-logo.svg +0 -3
- package/babel.config.js +0 -6
- package/buses/eventBus.ts +0 -19
- package/buses/events/GiveKudosEvent.ts +0 -7
- package/components/buttons/action-button/ActionButton.scss +0 -133
- package/components/buttons/action-button/ActionButton.ts +0 -57
- package/components/buttons/action-button/ActionButton.vue +0 -50
- package/components/buttons/secondary-button/SecondaryButton.scss +0 -48
- package/components/buttons/secondary-button/SecondaryButton.ts +0 -28
- package/components/buttons/secondary-button/SecondaryButton.vue +0 -27
- package/components/confirm/Confirm.scss +0 -44
- package/components/confirm/Confirm.ts +0 -82
- package/components/confirm/Confirm.vue +0 -64
- package/components/give-kudos-form/GiveKudosForm.scss +0 -114
- package/components/give-kudos-form/GiveKudosForm.ts +0 -159
- package/components/give-kudos-form/GiveKudosForm.vue +0 -131
- package/components/give-kudos-form/mixins/UserSelectMixin.ts +0 -57
- package/components/give-kudos-form/models/KudosShareModel.ts +0 -6
- package/components/give-kudos-form/models/UserListModel.ts +0 -5
- package/components/give-kudos-form/validators/InEnglishValidatorRegex.ts +0 -17
- package/components/give-kudos-form/validators/KudosBalance.ts +0 -10
- package/components/modal/Modal.scss +0 -53
- package/components/modal/Modal.ts +0 -70
- package/components/modal/Modal.vue +0 -28
- package/components/notifications-sidebar/NotificationsSidebar.scss +0 -665
- package/components/notifications-sidebar/NotificationsSidebar.ts +0 -203
- package/components/notifications-sidebar/NotificationsSidebar.vue +0 -171
- package/components/notifications-sidebar/models/BroadcastNotificationPayload.ts +0 -8
- package/components/notifications-sidebar/models/TotalCounter.ts +0 -50
- package/components/notifications-sidebar/notification/Notification.ts +0 -17
- package/components/notifications-sidebar/notification/Notification.vue +0 -87
- package/components/play-pause/PlayPause.scss +0 -33
- package/components/play-pause/PlayPause.ts +0 -156
- package/components/play-pause/PlayPause.vue +0 -36
- package/components/play-pause/PlayPauseStatus.ts +0 -4
- package/components/play-pause/helpers/LatestTrackedTimeDurationHelper.ts +0 -55
- package/components/play-pause/helpers/PauseHelper.ts +0 -55
- package/components/play-pause/helpers/TrackedTimeHelper.ts +0 -80
- package/components/preloader/Preloader.vue +0 -34
- package/components/request-loader/RequestLoader.scss +0 -20
- package/components/request-loader/RequestLoader.ts +0 -80
- package/components/request-loader/RequestLoader.vue +0 -15
- package/components/sub-menu/SubMenu.scss +0 -33
- package/components/sub-menu/SubMenu.ts +0 -38
- package/components/sub-menu/SubMenu.vue +0 -21
- package/components/time-ago/TimeAgo.ts +0 -34
- package/components/time-ago/TimeAgo.vue +0 -9
- package/components/user-picture/UserPicture.scss +0 -62
- package/components/user-picture/UserPicture.ts +0 -105
- package/components/user-picture/UserPicture.vue +0 -23
- package/components/v-select-intems/VSelectIntems.ts +0 -112
- package/components/v-select-intems/VSelectIntems.vue +0 -68
- package/components/v-select-intems/open-indicator/OpenIndicator.vue +0 -3
- package/dist/css/1.css +0 -85
- package/dist/css/2.css +0 -34
- package/dist/css/3.css +0 -34
- package/dist/css/4.css +0 -34
- package/dist/css/5.css +0 -34
- package/dist/html/app.html +0 -19
- package/dist/html/styles.html +0 -1
- package/dist/js/2.js +0 -217
- package/dist/js/3.js +0 -181
- package/dist/js/4.js +0 -181
- package/dist/js/5.js +0 -181
- package/helpers/GeneralHelper.ts +0 -61
- package/helpers/PublisherSubscriber.ts +0 -34
- package/helpers/QueryFilter.ts +0 -204
- package/helpers/TimeHelper.ts +0 -54
- package/helpers/Validations.ts +0 -7
- package/helpers/model/ModelHelper.ts +0 -155
- package/helpers/model/decorators/AsCollection.ts +0 -26
- package/helpers/model/decorators/AsModel.ts +0 -25
- package/helpers/model/decorators/DateTime.ts +0 -26
- package/helpers/model/decorators/TimeDuration.ts +0 -33
- package/helpers/moment/Duration.ts +0 -64
- package/helpers/moment/Moment.ts +0 -17
- package/helpers/moment/index.d.ts +0 -20
- package/helpers/response/AxiosProxy.ts +0 -72
- package/helpers/response/ErrorsToToastHelper.ts +0 -42
- package/helpers/response/ResponseCode.ts +0 -16
- package/helpers/response/ResponseHelper.ts +0 -42
- package/helpers/response/ResponseInterface.ts +0 -34
- package/helpers/response/ResponseState.ts +0 -6
- package/jsconfig.json +0 -19
- package/mixins/IntemsMath.ts +0 -29
- package/mixins/notifications/ActionProcessing.ts +0 -134
- package/mixins/notifications/confirms/AssetRejectionConfirm.vue +0 -59
- package/mixins/notifications/confirms/SickLeaveRejectionConfirm.vue +0 -31
- package/mixins/notifications/confirms/UnpaidLeaveRejectionConfirm.vue +0 -31
- package/mixins/notifications/confirms/VacationRejectionConfirm.vue +0 -31
- package/models/AssetModel.ts +0 -80
- package/models/AssetRequestModel.ts +0 -25
- package/models/ConfigModel.ts +0 -20
- package/models/EmployeeStartEndDateModel.ts +0 -16
- package/models/EmploymentTypeModel.ts +0 -95
- package/models/LogoutModel.ts +0 -3
- package/models/Model.ts +0 -12
- package/models/ModuleOptions.ts +0 -24
- package/models/PublicInfoModel.ts +0 -38
- package/models/PublicLocationModel.ts +0 -36
- package/models/StatusModel.ts +0 -8
- package/models/TrackedTimeModel.ts +0 -32
- package/models/location/PublicLocationModel.ts +0 -36
- package/models/timezones/LocalTimezoneHistoryModel.ts +0 -8
- package/models/timezones/TimezoneModel.ts +0 -9
- package/models/user/ExtendedInfoModel.ts +0 -37
- package/models/user/NotificationActionModel.ts +0 -53
- package/models/user/NotificationModel.ts +0 -84
- package/models/user/PublicInfoModel.ts +0 -38
- package/models/user/WelcomeProgram.ts +0 -4
- package/repositories/BaseRepository.ts +0 -42
- package/repositories/BaseUrl.ts +0 -107
- package/repositories/Repository.ts +0 -291
- package/repositories/ResourceRepository.ts +0 -99
- package/repositories/TrackedTimeRepository.ts +0 -43
- package/repositories/UserRepository.ts +0 -75
- package/repositories/subscribers/CreateSubscribers.ts +0 -28
- package/repositories/subscribers/DefaultSubscribers.ts +0 -82
- package/repositories/subscribers/DeleteSubscribers.ts +0 -28
- package/repositories/subscribers/DownloadSubscribers.ts +0 -28
- package/repositories/subscribers/Subscribers.ts +0 -13
- package/repositories/subscribers/UpdateSubscribers.ts +0 -32
- package/scss/components/_global.scss +0 -66
- package/scss/components/_mixins.scss +0 -31
- package/scss/components/_tooltip.scss +0 -45
- package/scss/components/_utils.scss +0 -26
- package/scss/components/_variables.scss +0 -103
- package/scss/main.scss +0 -7
- package/shims-vue.d.ts +0 -9
- package/tsconfig.json +0 -31
- package/webpack.config.js +0 -126
- package/wrapper.ts +0 -51
package/repositories/BaseUrl.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
export enum BaseUrl {
|
|
2
|
-
Default = "",
|
|
3
|
-
LoggedInUser = "/api/users/me",
|
|
4
|
-
ProgressBar = "/api/users/me/progress-bar",
|
|
5
|
-
LogOut = "/logout",
|
|
6
|
-
SessionMessages = "/api/session-messages",
|
|
7
|
-
Config = "/api/config",
|
|
8
|
-
DescribedTime = "/api/described-times",
|
|
9
|
-
TrackedTimes = "/api/tracked-times",
|
|
10
|
-
Holidays = "/api/holidays",
|
|
11
|
-
News = "/api/news",
|
|
12
|
-
Tags = "/api/tags",
|
|
13
|
-
Roles = "/api/roles",
|
|
14
|
-
ScheduledMaintenance = "/api/scheduled-maintenance",
|
|
15
|
-
StatsFilter = "api/stats/filter",
|
|
16
|
-
MinReportDate = "api/stats/min-date",
|
|
17
|
-
AnniversaryUsers = "/api/anniversary-users",
|
|
18
|
-
RequestedDays = "/api/requested-days",
|
|
19
|
-
WallOfGlory = "/api/wall-of-glory",
|
|
20
|
-
WorkingNorm = "api/users/working-norm",
|
|
21
|
-
BirthdayUsers = "/api/birthday-users",
|
|
22
|
-
SendRecommendation = "/api/send-recommendation",
|
|
23
|
-
Stats = "/api/stats",
|
|
24
|
-
TalentPlanner = "/api/talent-planner",
|
|
25
|
-
Projects = "api/projects",
|
|
26
|
-
ProjectsTree = "api/projects-tree",
|
|
27
|
-
ImportEffort = "api/users/import-effort",
|
|
28
|
-
JobProfileGroup = "/api/users/job-profiles",
|
|
29
|
-
WelcomeProgram = "/api/welcome-program",
|
|
30
|
-
Rotation = "api/rotation",
|
|
31
|
-
Cities = "api/cities",
|
|
32
|
-
ReleaseNotes = "api/release-notes",
|
|
33
|
-
ZabbixMap = "api/network-map",
|
|
34
|
-
Sows = "/api/sows",
|
|
35
|
-
Clients = "/api/clients",
|
|
36
|
-
Engagements = "/api/engagements",
|
|
37
|
-
OrganisationStructure = "/api/organisation-structure",
|
|
38
|
-
NewCollegues = "/api/new-collegues",
|
|
39
|
-
OvertimeRequests = "/api/overtime-requests",
|
|
40
|
-
CompensationPackage = "/api/users/me/compensation-package",
|
|
41
|
-
BabyBorn = "/api/baby-born",
|
|
42
|
-
WeddingUser = "/api/wedding-user",
|
|
43
|
-
CostCenters = "/api/cost-centers",
|
|
44
|
-
Users = "/api/users",
|
|
45
|
-
KudosAndSmartsStatistic = "/api/kudos-and-smarts/statistic",
|
|
46
|
-
MyReferrals = "/api/referrals/my-referrals",
|
|
47
|
-
MyReferralLogs = "/api/referrals/my-referral-logs",
|
|
48
|
-
TopRecommenders = "/api/referrals/top-recommenders",
|
|
49
|
-
LastActions = "/api/kudos-and-smarts/last-actions",
|
|
50
|
-
GiveKudos = "/api/kudos-and-smarts/give-kudos",
|
|
51
|
-
CostCenterCategory = "/api/cost-center-category",
|
|
52
|
-
Department = "/api/departments",
|
|
53
|
-
GiveKudosUsersList = "/api/kudos-and-smarts/users-list",
|
|
54
|
-
Tasks = "/api/tasks",
|
|
55
|
-
Folder = "api/tasks/folder",
|
|
56
|
-
DonationCampaign = "/api/donation-campaign",
|
|
57
|
-
Donation = "/api/donation-transaction",
|
|
58
|
-
Upload = "/api/upload",
|
|
59
|
-
DonationAttachment = "/api/donation-attachment",
|
|
60
|
-
PipeDriveOption = "/api/pipedrive-option",
|
|
61
|
-
Banner = "/api/banners",
|
|
62
|
-
Assets = "/api/users/assets",
|
|
63
|
-
PositionSubscription = "/api/position-subscription",
|
|
64
|
-
Currency = "/api/currency",
|
|
65
|
-
Rate = "/api/rates",
|
|
66
|
-
Timesheet = "/api/timesheets",
|
|
67
|
-
TimesheetDiscount = "/api/timesheets/discount",
|
|
68
|
-
TimesheetReimbursed = "/api/timesheets/reimbursed",
|
|
69
|
-
JobProfile = "/api/job-profile",
|
|
70
|
-
EmployeeReport = "/api/report/employees",
|
|
71
|
-
Locations = "/api/location",
|
|
72
|
-
MyProfile = "/api/users/my-profile",
|
|
73
|
-
Employees = "/api/employees",
|
|
74
|
-
EmploymentTypes = "/api/employment-types",
|
|
75
|
-
EmergencyContacts = "/api/emergency-contact",
|
|
76
|
-
LeavesAndAbsences = "/api/leaves-and-absences",
|
|
77
|
-
Delivery = "/api/delivery-address",
|
|
78
|
-
Trainings = "/api/events",
|
|
79
|
-
Skills = "/api/skills",
|
|
80
|
-
JiraSatisfactionSurvey = "/api/enps-survey",
|
|
81
|
-
IntelliStoreCategory = "/api/smart-catalog/category",
|
|
82
|
-
IntelliStoreType = "/api/smart-catalog/type",
|
|
83
|
-
IntelliStoreAttribute = "/api/smart-catalog/attribute",
|
|
84
|
-
IntelliStoreProduct = "/api/smart-catalog/product",
|
|
85
|
-
IntelliStoreOrder = "/api/smart-catalog/order",
|
|
86
|
-
IntelliStoreStat = "/api/smart-catalog/statistic",
|
|
87
|
-
IntelliStoreClient = "/api/smart-catalog/shop",
|
|
88
|
-
IntelliStoreWishlist = "/api/smart-catalog/wish-list",
|
|
89
|
-
Dictionary = "/api/dictionary",
|
|
90
|
-
Offices = "/api/offices",
|
|
91
|
-
Calendars = "/api/calendars",
|
|
92
|
-
ImprovementsHub = "/api/improvements-hub",
|
|
93
|
-
ViewLogs = "/api/logs",
|
|
94
|
-
TotalRewardsPortal = "/api/total-rewards-portal",
|
|
95
|
-
CompensationPackages = "/api/compensation-package",
|
|
96
|
-
Timezones = "/api/available-timezones",
|
|
97
|
-
AccessCards = "/api/access_card",
|
|
98
|
-
ValidationCompensation = "/api/validation-compensations",
|
|
99
|
-
VacationAndSickBalance = "/api/vacation-and-sick-balance",
|
|
100
|
-
TechnicalWorks = "/api/technical-work",
|
|
101
|
-
PDUSystem = "/api/pdu-system",
|
|
102
|
-
Logger = "/api/logger",
|
|
103
|
-
BenefitsPackages = "/api/benefits-package",
|
|
104
|
-
OnCallRate = "/api/on-call-rate",
|
|
105
|
-
OnCallSupport = "/api/on-call-support",
|
|
106
|
-
OnCallSupportEmployee = "/api/on-call-support-employee",
|
|
107
|
-
}
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
2
|
-
import * as moment from "moment";
|
|
3
|
-
import { Collection } from "collect.js";
|
|
4
|
-
import DefaultSubscribers from "./subscribers/DefaultSubscribers";
|
|
5
|
-
import { BaseUrl } from "./BaseUrl";
|
|
6
|
-
import AxiosProxy from "../helpers/response/AxiosProxy";
|
|
7
|
-
import * as Response from "../helpers/response/ResponseInterface";
|
|
8
|
-
import * as ModelHelper from "../helpers/model/ModelHelper";
|
|
9
|
-
import { ResponseCode } from "../helpers/response/ResponseCode";
|
|
10
|
-
import { Meta } from "../helpers/response/ResponseInterface";
|
|
11
|
-
import NotificationModel from "../models/user/NotificationModel";
|
|
12
|
-
import Model from "../models/Model";
|
|
13
|
-
import ResponseHelper, {
|
|
14
|
-
DefaultContext,
|
|
15
|
-
} from "../helpers/response/ResponseHelper";
|
|
16
|
-
|
|
17
|
-
export type PaginatedResponse = {
|
|
18
|
-
collection: Collection<Model>;
|
|
19
|
-
meta: Meta;
|
|
20
|
-
};
|
|
21
|
-
export default abstract class Repository {
|
|
22
|
-
protected baseUrl: BaseUrl;
|
|
23
|
-
protected responseHelper: ResponseHelper;
|
|
24
|
-
protected axiosProxy: AxiosProxy;
|
|
25
|
-
|
|
26
|
-
protected constructor(baseUrl: BaseUrl) {
|
|
27
|
-
this.baseUrl = baseUrl;
|
|
28
|
-
this.responseHelper = new ResponseHelper();
|
|
29
|
-
this.responseHelper.applySubscribers(
|
|
30
|
-
new DefaultSubscribers(),
|
|
31
|
-
DefaultContext
|
|
32
|
-
);
|
|
33
|
-
this.axiosProxy = new AxiosProxy(this.responseHelper);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getResponseHelper() {
|
|
37
|
-
return this.responseHelper;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
protected async getData<TData>(
|
|
41
|
-
resource = "",
|
|
42
|
-
parameters?,
|
|
43
|
-
context: string = DefaultContext
|
|
44
|
-
) {
|
|
45
|
-
const response = await this.axiosProxy.get<TData>(
|
|
46
|
-
this.getUrl(resource),
|
|
47
|
-
this.getConfig({ params: parameters }),
|
|
48
|
-
context
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
return response.data;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
protected async getResource<TData>(
|
|
55
|
-
model,
|
|
56
|
-
resource = "",
|
|
57
|
-
parameters?,
|
|
58
|
-
context: string = DefaultContext
|
|
59
|
-
) {
|
|
60
|
-
const response = await this.axiosProxy.get<Response.Read<TData>>(
|
|
61
|
-
this.getUrl(resource),
|
|
62
|
-
this.getConfig({ params: parameters }),
|
|
63
|
-
context
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
if (response.data.data === undefined) {
|
|
67
|
-
console.error(
|
|
68
|
-
'Key "data" does not exist in response from API',
|
|
69
|
-
response.data
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return response.status < ResponseCode.BadRequest
|
|
74
|
-
? this.map(model, response.data.data)
|
|
75
|
-
: null;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
protected async getPaginatedResource<TData>(
|
|
79
|
-
model: typeof Model,
|
|
80
|
-
resource = "",
|
|
81
|
-
parameters?: Record<string, unknown>,
|
|
82
|
-
context: string = DefaultContext
|
|
83
|
-
): Promise<PaginatedResponse> {
|
|
84
|
-
const response = await this.axiosProxy.get<{
|
|
85
|
-
data: { data: Record<string, unknown> };
|
|
86
|
-
meta: Meta;
|
|
87
|
-
}>(this.getUrl(resource), this.getConfig({ params: parameters }), context);
|
|
88
|
-
if (response.status < ResponseCode.BadRequest) {
|
|
89
|
-
return {
|
|
90
|
-
collection: this.map(
|
|
91
|
-
model !== undefined ? model : NotificationModel,
|
|
92
|
-
response.data.data
|
|
93
|
-
),
|
|
94
|
-
meta: response.data.meta,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
protected async getFile<TData>(
|
|
102
|
-
model,
|
|
103
|
-
resource = "",
|
|
104
|
-
parameters?,
|
|
105
|
-
context: string = DefaultContext
|
|
106
|
-
) {
|
|
107
|
-
const response = await this.axiosProxy.get<Response.Read<TData>>(
|
|
108
|
-
this.getUrl(resource),
|
|
109
|
-
this.getConfig({ params: parameters, responseType: "blob" }),
|
|
110
|
-
context
|
|
111
|
-
);
|
|
112
|
-
return response.status < ResponseCode.BadRequest
|
|
113
|
-
? this.map(model, response.data)
|
|
114
|
-
: null;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
protected async postData<TData>(
|
|
118
|
-
resource = "",
|
|
119
|
-
data?,
|
|
120
|
-
parameters?,
|
|
121
|
-
context: string = DefaultContext
|
|
122
|
-
) {
|
|
123
|
-
const response = await this.axiosProxy.post<TData>(
|
|
124
|
-
this.getUrl(resource),
|
|
125
|
-
data,
|
|
126
|
-
this.getConfig({ params: parameters }),
|
|
127
|
-
context
|
|
128
|
-
);
|
|
129
|
-
return response.data;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
protected async post<TData>(
|
|
133
|
-
resource = "",
|
|
134
|
-
data?,
|
|
135
|
-
parameters?,
|
|
136
|
-
context: string = DefaultContext
|
|
137
|
-
): Promise<AxiosResponse<TData>> {
|
|
138
|
-
return this.axiosProxy.post<TData>(
|
|
139
|
-
this.getUrl(resource),
|
|
140
|
-
data,
|
|
141
|
-
this.getConfig({ params: parameters }),
|
|
142
|
-
context
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
protected async putResource<TData>(
|
|
147
|
-
model,
|
|
148
|
-
resource = "",
|
|
149
|
-
data?,
|
|
150
|
-
context: string = DefaultContext
|
|
151
|
-
) {
|
|
152
|
-
const response = await this.axiosProxy.put<Response.Read<TData>>(
|
|
153
|
-
this.getUrl(resource),
|
|
154
|
-
data,
|
|
155
|
-
this.getConfig({ params: {} }),
|
|
156
|
-
context
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
return response.status < ResponseCode.BadRequest
|
|
160
|
-
? this.map(model, response.data.data)
|
|
161
|
-
: null;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
protected async postResource<TData>(
|
|
165
|
-
model,
|
|
166
|
-
resource = "",
|
|
167
|
-
data?,
|
|
168
|
-
context: string = DefaultContext
|
|
169
|
-
) {
|
|
170
|
-
const response = await this.axiosProxy.post<Response.Read<TData>>(
|
|
171
|
-
this.getUrl(resource),
|
|
172
|
-
data,
|
|
173
|
-
this.getConfig({ params: {} }),
|
|
174
|
-
context
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
return response.status < ResponseCode.BadRequest
|
|
178
|
-
? this.map(model, response.data.data)
|
|
179
|
-
: null;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
protected async putData<TData>(
|
|
183
|
-
resource = "",
|
|
184
|
-
data?,
|
|
185
|
-
parameters?,
|
|
186
|
-
context: string = DefaultContext
|
|
187
|
-
) {
|
|
188
|
-
const response = await this.axiosProxy.put<TData>(
|
|
189
|
-
this.getUrl(resource),
|
|
190
|
-
data,
|
|
191
|
-
this.getConfig({ params: parameters }),
|
|
192
|
-
context
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
return response.data;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
protected async put<TData>(
|
|
199
|
-
resource = "",
|
|
200
|
-
data?,
|
|
201
|
-
parameters?,
|
|
202
|
-
context: string = DefaultContext
|
|
203
|
-
): Promise<AxiosResponse<TData>> {
|
|
204
|
-
return this.axiosProxy.put<TData>(
|
|
205
|
-
this.getUrl(resource),
|
|
206
|
-
data,
|
|
207
|
-
this.getConfig({ params: parameters }),
|
|
208
|
-
context
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
protected async deleteData(
|
|
213
|
-
resource = "",
|
|
214
|
-
parameters?: unknown,
|
|
215
|
-
context: string = DefaultContext
|
|
216
|
-
) {
|
|
217
|
-
const response = await this.axiosProxy.delete(
|
|
218
|
-
this.getUrl(resource),
|
|
219
|
-
this.getConfig({ params: parameters }),
|
|
220
|
-
context
|
|
221
|
-
);
|
|
222
|
-
|
|
223
|
-
return response.data;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
protected async deleteResource(
|
|
227
|
-
resource = "",
|
|
228
|
-
parameters?: unknown,
|
|
229
|
-
context: string = DefaultContext
|
|
230
|
-
): Promise<AxiosResponse> {
|
|
231
|
-
return this.axiosProxy.delete(
|
|
232
|
-
this.getUrl(resource),
|
|
233
|
-
this.getConfig({ params: parameters }),
|
|
234
|
-
context
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
protected async patch(resource = "", context: string = DefaultContext) {
|
|
239
|
-
return this.axiosProxy.patch(
|
|
240
|
-
this.getUrl(resource),
|
|
241
|
-
this.getConfig(),
|
|
242
|
-
context
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
protected async patchData<TData>(
|
|
247
|
-
resource = "",
|
|
248
|
-
data?,
|
|
249
|
-
parameters?,
|
|
250
|
-
context: string = DefaultContext
|
|
251
|
-
) {
|
|
252
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
253
|
-
const response = await this.axiosProxy.patch<TData>(
|
|
254
|
-
this.getUrl(resource),
|
|
255
|
-
{ ...data, ...this.getConfig({ params: parameters }) },
|
|
256
|
-
context
|
|
257
|
-
);
|
|
258
|
-
return response.data;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
protected map(model, resource) {
|
|
262
|
-
// Todo: model must be specified each time, remove this!!!
|
|
263
|
-
if (!model) {
|
|
264
|
-
return resource;
|
|
265
|
-
}
|
|
266
|
-
return ModelHelper.map(model, resource);
|
|
267
|
-
}
|
|
268
|
-
protected getUrl(resource: string): string {
|
|
269
|
-
if (this.baseUrl === null) {
|
|
270
|
-
throw new Error("baseUrl is not specified");
|
|
271
|
-
}
|
|
272
|
-
return this.baseUrl + resource;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
protected getQueryString(params): string {
|
|
276
|
-
return Object.keys(params)
|
|
277
|
-
.map((key) => `${key}=${params[key]}`)
|
|
278
|
-
.join("&");
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
protected getConfig(
|
|
282
|
-
parameters?: Record<string, unknown>
|
|
283
|
-
): AxiosRequestConfig {
|
|
284
|
-
return {
|
|
285
|
-
...parameters,
|
|
286
|
-
headers: {
|
|
287
|
-
tz: moment.tz?.guess(),
|
|
288
|
-
},
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Collection } from "collect.js";
|
|
2
|
-
import { ResponseCode } from "../helpers/response/ResponseCode";
|
|
3
|
-
import { BaseUrl } from "./BaseUrl";
|
|
4
|
-
import { Read } from "../helpers/response/ResponseInterface";
|
|
5
|
-
import { DefaultContext } from "../helpers/response/ResponseHelper";
|
|
6
|
-
import CreateSubscribers from "./subscribers/CreateSubscribers";
|
|
7
|
-
import UpdateSubscribers from "./subscribers/UpdateSubscribers";
|
|
8
|
-
import DeleteSubscribers from "./subscribers/DeleteSubscribers";
|
|
9
|
-
import Repository from "./Repository";
|
|
10
|
-
import DownloadSubscribers from "./subscribers/DownloadSubscribers";
|
|
11
|
-
|
|
12
|
-
export type Config = {
|
|
13
|
-
resourceName?: string;
|
|
14
|
-
successMessage?: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const CreateContext = "create";
|
|
18
|
-
export const UpdateContext = "update";
|
|
19
|
-
export const DeleteContext = "delete";
|
|
20
|
-
export const DownloadContext = "download";
|
|
21
|
-
export const RejectContext = "reject";
|
|
22
|
-
export const ConfirmContext = "confirm";
|
|
23
|
-
export const ApproveContext = "approve";
|
|
24
|
-
export const HeadContext = "head";
|
|
25
|
-
|
|
26
|
-
export default abstract class ResourceRepository<
|
|
27
|
-
TModel extends new (...args: any) => any
|
|
28
|
-
> extends Repository {
|
|
29
|
-
protected model: TModel;
|
|
30
|
-
protected config: Config;
|
|
31
|
-
|
|
32
|
-
protected constructor(baseUrl: BaseUrl, model: TModel, config?: Config) {
|
|
33
|
-
super(baseUrl);
|
|
34
|
-
this.model = model;
|
|
35
|
-
this.responseHelper.applySubscribers(
|
|
36
|
-
new CreateSubscribers(config?.resourceName),
|
|
37
|
-
CreateContext
|
|
38
|
-
);
|
|
39
|
-
this.responseHelper.applySubscribers(
|
|
40
|
-
new UpdateSubscribers(config?.resourceName, config?.successMessage),
|
|
41
|
-
UpdateContext
|
|
42
|
-
);
|
|
43
|
-
this.responseHelper.applySubscribers(
|
|
44
|
-
new DeleteSubscribers(config?.resourceName),
|
|
45
|
-
DeleteContext
|
|
46
|
-
);
|
|
47
|
-
this.responseHelper.applySubscribers(
|
|
48
|
-
new DownloadSubscribers(config?.resourceName),
|
|
49
|
-
DownloadContext
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async getById(
|
|
54
|
-
id: number | string,
|
|
55
|
-
context: string = DefaultContext
|
|
56
|
-
): Promise<TModel> {
|
|
57
|
-
return await this.getResource(this.model, `/${id}`, {}, context);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async all(
|
|
61
|
-
parameters?,
|
|
62
|
-
context: string = DefaultContext
|
|
63
|
-
): Promise<Collection<TModel>> {
|
|
64
|
-
return await this.getResource(this.model, "", parameters, context);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async create(model: TModel) {
|
|
68
|
-
const response = await this.axiosProxy.post<Read<TModel>>(
|
|
69
|
-
this.getUrl(""),
|
|
70
|
-
model,
|
|
71
|
-
this.getConfig(),
|
|
72
|
-
CreateContext
|
|
73
|
-
);
|
|
74
|
-
return response.status === ResponseCode.Created
|
|
75
|
-
? this.map(this.model, response.data.data)
|
|
76
|
-
: null;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async update(id: number | string, model: InstanceType<TModel>) {
|
|
80
|
-
const response = await this.axiosProxy.put<Read<TModel>>(
|
|
81
|
-
this.getUrl(`/${id}`),
|
|
82
|
-
model,
|
|
83
|
-
this.getConfig(),
|
|
84
|
-
UpdateContext
|
|
85
|
-
);
|
|
86
|
-
return response.status === ResponseCode.Ok
|
|
87
|
-
? this.map(this.model, response.data.data)
|
|
88
|
-
: null;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async delete(id: number | string) {
|
|
92
|
-
const response = await this.axiosProxy.delete(
|
|
93
|
-
this.getUrl(`/${id}`),
|
|
94
|
-
this.getConfig(),
|
|
95
|
-
DeleteContext
|
|
96
|
-
);
|
|
97
|
-
return response.status === ResponseCode.NoContent;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import TrackedTimeModel from "../models/TrackedTimeModel";
|
|
2
|
-
import * as Response from "../helpers/response/ResponseInterface";
|
|
3
|
-
import { ResponseCode } from "../helpers/response/ResponseCode";
|
|
4
|
-
import ResourceRepository from "./ResourceRepository";
|
|
5
|
-
import { BaseUrl } from "./BaseUrl";
|
|
6
|
-
|
|
7
|
-
export const PlayContext = "play";
|
|
8
|
-
export const PauseContext = "pause";
|
|
9
|
-
|
|
10
|
-
export default class TrackedTimeRepository extends ResourceRepository<
|
|
11
|
-
typeof TrackedTimeModel
|
|
12
|
-
> {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(BaseUrl.TrackedTimes, TrackedTimeModel, {
|
|
15
|
-
resourceName: "Worked Time",
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async latest(): Promise<TrackedTimeModel> {
|
|
20
|
-
return await this.getResource(this.model, "/latest");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async play() {
|
|
24
|
-
const response = await this.axiosProxy.post<
|
|
25
|
-
Response.Read<TrackedTimeModel>
|
|
26
|
-
>(this.baseUrl, {}, this.getConfig(), PlayContext);
|
|
27
|
-
return response.status === ResponseCode.Created
|
|
28
|
-
? this.map(this.model, response.data.data)
|
|
29
|
-
: null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async pause() {
|
|
33
|
-
const response = await this.axiosProxy.put<Response.Read<string>>(
|
|
34
|
-
this.baseUrl,
|
|
35
|
-
{},
|
|
36
|
-
this.getConfig(),
|
|
37
|
-
PauseContext
|
|
38
|
-
);
|
|
39
|
-
return response.status === ResponseCode.Ok
|
|
40
|
-
? this.map(this.model, response.data.data)
|
|
41
|
-
: null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { AxiosResponse } from "axios";
|
|
2
|
-
import { Collection } from "collect.js";
|
|
3
|
-
import { BaseUrl } from "./BaseUrl";
|
|
4
|
-
import BaseRepository from "./BaseRepository";
|
|
5
|
-
import ExtendedInfoModel from "../models/user/ExtendedInfoModel";
|
|
6
|
-
import NotificationModel from "../models/user/NotificationModel";
|
|
7
|
-
import QueryFilter from "../helpers/QueryFilter";
|
|
8
|
-
import { DefaultContext } from "../helpers/response/ResponseHelper";
|
|
9
|
-
import { UpdateContext } from "./ResourceRepository";
|
|
10
|
-
import { NotificationTotal } from "../components/notifications-sidebar/models/TotalCounter";
|
|
11
|
-
import { ResponseCode } from "../helpers/response/ResponseCode";
|
|
12
|
-
import { Meta } from "../helpers/response/ResponseInterface";
|
|
13
|
-
|
|
14
|
-
// Todo: maybe rename or what, because this repository is only to get logged in user data
|
|
15
|
-
export default class UserRepository extends BaseRepository<
|
|
16
|
-
typeof ExtendedInfoModel
|
|
17
|
-
> {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(BaseUrl.LoggedInUser, ExtendedInfoModel);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async notifications(filter: QueryFilter, model = undefined) {
|
|
23
|
-
const response = await this.axiosProxy.get<{
|
|
24
|
-
data: { data: Record<string, unknown> };
|
|
25
|
-
total_unread: NotificationTotal;
|
|
26
|
-
total: number;
|
|
27
|
-
meta: Meta;
|
|
28
|
-
}>(
|
|
29
|
-
this.getUrl(`/notifications`),
|
|
30
|
-
{ params: filter.toObject() },
|
|
31
|
-
DefaultContext
|
|
32
|
-
);
|
|
33
|
-
if (response.status < ResponseCode.BadRequest) {
|
|
34
|
-
return {
|
|
35
|
-
collection: this.map(
|
|
36
|
-
model !== undefined ? model : NotificationModel,
|
|
37
|
-
response.data.data
|
|
38
|
-
),
|
|
39
|
-
total: response.data.total_unread,
|
|
40
|
-
meta: response.data.meta,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async readNotifications(
|
|
48
|
-
notifications?: Collection<NotificationModel>
|
|
49
|
-
): Promise<AxiosResponse> {
|
|
50
|
-
let data = {};
|
|
51
|
-
if (notifications) {
|
|
52
|
-
data = { notifications: notifications.pluck("id").all() };
|
|
53
|
-
}
|
|
54
|
-
return this.putData(`/notifications/read-all`, data, {}, UpdateContext);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async dismissNotifications(
|
|
58
|
-
notification?: NotificationModel
|
|
59
|
-
): Promise<AxiosResponse> {
|
|
60
|
-
return this.patch(
|
|
61
|
-
`/notifications/dismiss-all${notification ? `/${notification.id}` : ""}`,
|
|
62
|
-
UpdateContext
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async processNotifications(
|
|
67
|
-
notification?: NotificationModel
|
|
68
|
-
): Promise<AxiosResponse> {
|
|
69
|
-
return this.patch(
|
|
70
|
-
`/notifications/process/${notification.id}`,
|
|
71
|
-
UpdateContext
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { AxiosResponse } from "axios";
|
|
2
|
-
import { ResponseState } from "../../helpers/response/ResponseState";
|
|
3
|
-
import { ResponseCode } from "../../helpers/response/ResponseCode";
|
|
4
|
-
import { Subscribers, SubscribersEvents } from "./Subscribers";
|
|
5
|
-
import { myOptions } from "../../wrapper";
|
|
6
|
-
|
|
7
|
-
export default class CreateSubscribers implements Subscribers {
|
|
8
|
-
private readonly resourceName: string;
|
|
9
|
-
constructor(resourceName = "Item") {
|
|
10
|
-
this.resourceName = resourceName;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
generate(): SubscribersEvents {
|
|
14
|
-
return {
|
|
15
|
-
[ResponseState.Resolved]: (result: AxiosResponse) => {
|
|
16
|
-
if (result.status === ResponseCode.Created) {
|
|
17
|
-
myOptions.storeAdapter.Toasts.mutations.addMessage(
|
|
18
|
-
`${this.resourceName} was successfully created`
|
|
19
|
-
);
|
|
20
|
-
} else if (result.status !== ResponseCode.Ok) {
|
|
21
|
-
myOptions.storeAdapter.Toasts.mutations.addError(
|
|
22
|
-
`Unable to create ${this.resourceName}`
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|