@diasro/ucsd-its-frontend 0.0.2

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.
Files changed (87) hide show
  1. package/README.md +4 -0
  2. package/dist/CommonRoutes.d.ts +7 -0
  3. package/dist/UcsdPlugin.d.ts +9 -0
  4. package/dist/assets/dark_bg.webp +0 -0
  5. package/dist/assets/light_dock_bg.jpg +0 -0
  6. package/dist/assets/settings.icns +0 -0
  7. package/dist/assets/settings.png +0 -0
  8. package/dist/assets/ucsd-its-frontend.css +1 -0
  9. package/dist/assets/ucsd_logo.png +0 -0
  10. package/dist/assets/ucsd_logo_white.png +0 -0
  11. package/dist/cli.cjs +73 -0
  12. package/dist/components/TileButton.vue.d.ts +113 -0
  13. package/dist/components/authorization/Login.vue.d.ts +2 -0
  14. package/dist/components/authorization/LoginSuccess.vue.d.ts +2 -0
  15. package/dist/components/authorization/Logout.vue.d.ts +2 -0
  16. package/dist/components/authorization/Unauthorized.vue.d.ts +2 -0
  17. package/dist/components/commons/ChangeHistory.vue.d.ts +54 -0
  18. package/dist/components/commons/ProgressDialog.vue.d.ts +2 -0
  19. package/dist/composables/auditLog.d.ts +25 -0
  20. package/dist/composables/layout.d.ts +19 -0
  21. package/dist/composables/utils/ucsdAppUtils.d.ts +15 -0
  22. package/dist/index.d.ts +31 -0
  23. package/dist/layouts/AppLayout.vue.d.ts +2 -0
  24. package/dist/layouts/DefaultLayout.vue.d.ts +20 -0
  25. package/dist/layouts/FixedLayout.vue.d.ts +20 -0
  26. package/dist/layouts/FloatingLayout.vue.d.ts +2 -0
  27. package/dist/layouts/UcsdFooter.vue.d.ts +2 -0
  28. package/dist/layouts/UcsdHeader.vue.d.ts +23 -0
  29. package/dist/layouts/UserPanel.vue.d.ts +2 -0
  30. package/dist/layouts/menu/FloatMenu.vue.d.ts +2 -0
  31. package/dist/layouts/menu/RailMenu.vue.d.ts +24 -0
  32. package/dist/layouts/menu/TopMenu.vue.d.ts +12 -0
  33. package/dist/main.css +63 -0
  34. package/dist/stores/its-app.d.ts +336 -0
  35. package/dist/stores/its-audit.d.ts +184 -0
  36. package/dist/stores/its-auth.d.ts +169 -0
  37. package/dist/templates/.env +9 -0
  38. package/dist/templates/App.vue +17 -0
  39. package/dist/templates/config/ucsd.config.ts +105 -0
  40. package/dist/templates/index.html +17 -0
  41. package/dist/templates/main.ts +6 -0
  42. package/dist/templates/pages/DashBoard.vue +29 -0
  43. package/dist/templates/pages/Home.vue +20 -0
  44. package/dist/templates/pages/admin/AdminPage.vue +19 -0
  45. package/dist/templates/pages/customer/CustomerHome.vue +19 -0
  46. package/dist/templates/pages/customer/CustomerSearch.vue +21 -0
  47. package/dist/templates/pages/customer/SimpleForm.vue +299 -0
  48. package/dist/templates/pages/invoices/InvoiceHome.vue +19 -0
  49. package/dist/templates/plugins/index.ts +43 -0
  50. package/dist/templates/plugins/vuetify.ts +9 -0
  51. package/dist/templates/router/index.ts +17 -0
  52. package/dist/templates/router/routes.ts +49 -0
  53. package/dist/templates/stores/app.ts +74 -0
  54. package/dist/templates/stores/index.ts +9 -0
  55. package/dist/templates/styles/README.md +3 -0
  56. package/dist/templates/styles/settings.scss +10 -0
  57. package/dist/templates/vite.config.ts +75 -0
  58. package/dist/types/ApiError.d.ts +6 -0
  59. package/dist/types/LoginUser.d.ts +12 -0
  60. package/dist/types/TileRecord.d.ts +41 -0
  61. package/dist/types/UcsdConfig.d.ts +29 -0
  62. package/dist/types/audit.d.ts +57 -0
  63. package/dist/ucsd-its-frontend.js +13251 -0
  64. package/dist/ucsd-its-frontend.umd.cjs +345 -0
  65. package/dist/vite.svg +1 -0
  66. package/package.json +109 -0
  67. package/src/lib/templates/.env +9 -0
  68. package/src/lib/templates/App.vue +17 -0
  69. package/src/lib/templates/config/ucsd.config.ts +105 -0
  70. package/src/lib/templates/index.html +17 -0
  71. package/src/lib/templates/main.ts +6 -0
  72. package/src/lib/templates/pages/DashBoard.vue +29 -0
  73. package/src/lib/templates/pages/Home.vue +20 -0
  74. package/src/lib/templates/pages/admin/AdminPage.vue +19 -0
  75. package/src/lib/templates/pages/customer/CustomerHome.vue +19 -0
  76. package/src/lib/templates/pages/customer/CustomerSearch.vue +21 -0
  77. package/src/lib/templates/pages/customer/SimpleForm.vue +299 -0
  78. package/src/lib/templates/pages/invoices/InvoiceHome.vue +19 -0
  79. package/src/lib/templates/plugins/index.ts +43 -0
  80. package/src/lib/templates/plugins/vuetify.ts +9 -0
  81. package/src/lib/templates/router/index.ts +17 -0
  82. package/src/lib/templates/router/routes.ts +49 -0
  83. package/src/lib/templates/stores/app.ts +74 -0
  84. package/src/lib/templates/stores/index.ts +9 -0
  85. package/src/lib/templates/styles/README.md +3 -0
  86. package/src/lib/templates/styles/settings.scss +10 -0
  87. package/src/lib/templates/vite.config.ts +75 -0
@@ -0,0 +1,49 @@
1
+ import type {RouteRecordRaw} from "vue-router";
2
+
3
+ const routes: Array<RouteRecordRaw> = [
4
+ {
5
+ path: '/admin',
6
+ name: 'Admin',
7
+ component: () => import( '../pages/admin/AdminPage.vue'),
8
+ meta: { requiresAuth: true, roles: ['admin'] }
9
+ },
10
+ {
11
+ path: '/',
12
+ name: 'Home',
13
+ component: () => import( '../pages/Home.vue'),
14
+ meta: { /* pageHeader and pageSubHeader is optional */
15
+ pageHeader: 'Main Header'
16
+ },
17
+ },
18
+ {
19
+ path: '/dashboard',
20
+ name: 'Dashboard',
21
+ component: () => import( '../pages/DashBoard.vue'),
22
+ meta: { requiresAuth: true }
23
+ },
24
+ {
25
+ path: '/customer/home',
26
+ name: 'CustomerHome',
27
+ component: () => import( '../pages/customer/CustomerHome.vue'),
28
+ meta: { requiresAuth: true }
29
+ },
30
+ {
31
+ path: '/customer/search',
32
+ name: 'CustomerSearch',
33
+ component: () => import( '../pages/customer/CustomerSearch.vue'),
34
+ meta: { requiresAuth: true }
35
+ },
36
+ {
37
+ path: '/customer/create',
38
+ name: 'CustomerCreate',
39
+ component: () => import( '../pages/customer/SimpleForm.vue'),
40
+ meta: { requiresAuth: true }
41
+ },
42
+ {
43
+ path: '/invoices/home',
44
+ name: 'InvoiceHome',
45
+ component: () => import( '../pages/invoices/InvoiceHome.vue'),
46
+ meta: { requiresAuth: true }
47
+ }
48
+ ];
49
+ export default routes;
@@ -0,0 +1,74 @@
1
+ import {defineStore} from 'pinia'
2
+ import {ref} from 'vue'
3
+ import type {Audit, AuditDetail} from "ucsd-its-frontend";
4
+ import {useUcsdAppUtils} from "ucsd-its-frontend";
5
+ import axios from "axios";
6
+ import {useItsAuthStore} from "ucsd-its-frontend";
7
+ import type {LoginUser} from "ucsd-its-frontend";
8
+
9
+
10
+ export const useAppStore = defineStore('app', () => {
11
+ const appUtils = useUcsdAppUtils();
12
+ const authStore = useItsAuthStore();
13
+ const invoiceCount = ref('10');
14
+
15
+ const initializeStore = () => {
16
+ console.log('Initializing store')
17
+ }
18
+
19
+ const fetchRoles = async () : Promise<{user:LoginUser,path:string}> => {
20
+ try {
21
+ const response = await axios.get(import.meta.env.VITE_USER_ROLES_API_URL, {
22
+ headers: {
23
+ Authorization: `Bearer ${authStore.decryptedToken()}`
24
+ }
25
+ })
26
+ const apiData = response.data[0];
27
+ const loginUser = {
28
+ id: apiData.PERSON_ID,
29
+ email: apiData.EMAIL_ADDRESS,
30
+ firstName: '',
31
+ lastName: '',
32
+ roles: apiData.OFC_ROLES.split(','),
33
+ departmentName: apiData.DEPARTMENT_NAME,
34
+ businessUnitName: apiData.BUSINESS_UNIT_NAME,
35
+ system18Id: apiData.SYSTEM18_ID
36
+ } as LoginUser
37
+ return new Promise((resolve) => {
38
+ resolve({user: loginUser,path:'/'})
39
+ })
40
+ } catch (error) {
41
+ throw error
42
+ }
43
+ }
44
+
45
+ const auditRecord = { // default audit record. Change this based on your domain
46
+ auditId: 0,
47
+ event: 'Update',
48
+ eventIcon: '',
49
+ nameSpace: 'edu.ucsd.its.fis.ciperb',
50
+ auditConstituent : {
51
+ constituentCode: 'Financial Information Systems',
52
+ },
53
+ details: [
54
+ {
55
+ detailKey: "0",
56
+ detailValue: '',
57
+ } as AuditDetail
58
+ ]
59
+ } as Audit;
60
+
61
+
62
+ const getAuditRecord = () : Audit => {
63
+ return <Audit>appUtils.deepClone(auditRecord)
64
+ }
65
+
66
+
67
+ return {
68
+ invoiceCount,
69
+ getAuditRecord,
70
+ initializeStore,
71
+ fetchRoles
72
+ }
73
+
74
+ })
@@ -0,0 +1,9 @@
1
+ // Utilities
2
+ import { createPinia } from 'pinia'
3
+ import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
4
+
5
+
6
+ const pinia = createPinia()
7
+ pinia.use(piniaPluginPersistedstate);
8
+ export default pinia;
9
+
@@ -0,0 +1,3 @@
1
+ # Styles
2
+
3
+ This directory is for configuring the styles of the application.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * src/styles/settings.scss
3
+ *
4
+ * Configures SASS variables and Vuetify overwrites
5
+ */
6
+
7
+ // https://vuetifyjs.com/features/sass-variables/`
8
+ // @use 'vuetify/settings' with (
9
+ // $color-pack: false
10
+ // );
@@ -0,0 +1,75 @@
1
+ import {defineConfig, loadEnv} from 'vite'
2
+ import vuetify, {transformAssetUrls} from "vite-plugin-vuetify";
3
+ import dts from "vite-plugin-dts";
4
+ import Vue from "@vitejs/plugin-vue";
5
+ import Vuetify from "vite-plugin-vuetify";
6
+ import path from 'path';
7
+
8
+ export default defineConfig(({command, mode}) => {
9
+ const env = loadEnv(mode, process.cwd(), '')
10
+ const VITE_BASE_URL = env.VITE_BASE_URL || '';
11
+ console.log('Asset URL: ' + VITE_BASE_URL);
12
+ console.log('Mode:' + mode)
13
+ console.log('Command:' + command)
14
+ if (command === 'serve') {
15
+ return { // dev specific config
16
+ server: {
17
+ proxy: {
18
+ '/api': {
19
+ target: 'http://localhost:8080',
20
+ changeOrigin: true,
21
+ rewrite: (path) => {
22
+ const newPath = path.replace(/^\//, '');
23
+ console.log("Rewritten API URL: ", newPath);
24
+ return newPath;
25
+ }
26
+ }
27
+ }
28
+ },
29
+ resolve: {
30
+ alias: {
31
+ '@': path.resolve(__dirname, './src'),
32
+ },
33
+ },
34
+ plugins: [
35
+ Vue({
36
+ template: { transformAssetUrls: transformAssetUrls },
37
+ }),
38
+ Vuetify({
39
+ autoImport: true,
40
+ styles: {
41
+ configFile: 'src/styles/settings.scss',
42
+ },
43
+ }),
44
+ ],
45
+ }
46
+ } else { // command === 'build'
47
+ return {
48
+ plugins: [ Vue({
49
+ isProduction: true,
50
+ template: { transformAssetUrls },
51
+ features: { propsDestructure : true}
52
+ }
53
+ ), vuetify({ styles: 'none' }),
54
+ dts({exclude: ['node_modules','dist','.storybook']})],
55
+ resolve: {
56
+ alias: {
57
+ '@': path.resolve(__dirname, './src'),
58
+ },
59
+ },
60
+ build: {
61
+ assetsInlineLimit: 0, // Prevent inlining images as Base64
62
+ minify: true,
63
+ emptyOutDir: true,
64
+ target: 'esnext',
65
+ modulePreload: {polyfill: false},
66
+ rollupOptions: {
67
+ output: {
68
+ assetFileNames: 'assets/[name].[hash][extname]'
69
+ },
70
+ },
71
+ },
72
+ base: `${VITE_BASE_URL}`
73
+ }
74
+ }
75
+ })
@@ -0,0 +1,6 @@
1
+ export interface ApiError {
2
+ status: string;
3
+ message: string;
4
+ developerMessage: string;
5
+ errors: Array<string>;
6
+ }
@@ -0,0 +1,12 @@
1
+ export interface LoginUser {
2
+ id: number;
3
+ firstName?: string;
4
+ lastName?: string;
5
+ email: string;
6
+ roles?: string[];
7
+ departmentName?: string;
8
+ businessUnitName?: string;
9
+ system18Id?: string;
10
+ targetEnv?: string;
11
+ appVersion?: string;
12
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Represents a tile record with various properties for display, interaction,
3
+ * and hierarchical relationships.
4
+ *
5
+ * Properties:
6
+ *
7
+ * @property label The display label for the tile.
8
+ * @property value A unique key formatted to represent the hierarchy (e.g., x-x-x...).
9
+ * @property [icon] An optional string for the icon associated with the tile.
10
+ * @property [getIcon] An optional callback function to dynamically retrieve an icon.
11
+ * @property [buttonColor] An optional color for the button.
12
+ * @property [badgeColor] An optional color for the badge.
13
+ * @property [badgeContent] An optional callback function to dynamically retrieve badge content.
14
+ * @property [action] An optional callback function to trigger a specific store action.
15
+ * @property [eventFunc] An optional string to trigger custom events stored in the event map.
16
+ * @property [link] An optional link, either a router link or an external link.
17
+ * @property [linkProp] An optional link param, value returned will be passed as router parameter
18
+ * @property [disabled] An optional flag to mark the tile as disabled.
19
+ * @property [active] An optional flag to mark the tile as active.
20
+ * @property [hide] An optional flag to hide the tile from view
21
+ * @property [childDropdown] An optional flag indicating if the tile has a child dropdown.
22
+ * @property [children] An optional array of child `TileRecord` objects for hierarchical relationships.
23
+ */
24
+ export interface TileRecord {
25
+ label: string;
26
+ key: string;
27
+ icon?: string;
28
+ getIcon?: () => string;
29
+ buttonColor?: string;
30
+ badgeColor?: string;
31
+ badgeContent?: () => string;
32
+ action?: (args: TileRecord) => void;
33
+ eventFunc?: string;
34
+ link?: string;
35
+ linkProp?: () => string;
36
+ disabled?: boolean;
37
+ active?: boolean;
38
+ childDropdown?: boolean;
39
+ hide?: boolean;
40
+ children?: TileRecord[];
41
+ }
@@ -0,0 +1,29 @@
1
+ import { TileRecord } from "../types/TileRecord";
2
+ /**
3
+ * Configuration interface for UCSD application settings.
4
+ *
5
+ * This interface defines the structure and properties required
6
+ * to configure the UCSD application, including layout, themes,
7
+ * headers, and various callback functions.
8
+ *
9
+ * Properties:
10
+ * - `defaultLayout`: Specifies the default layout configuration.
11
+ * - `defaultPageHdr`: Defines the default page header.
12
+ * - `defaultSubHdr`: Defines the default sub-header.
13
+ * - `defaultTheme`: Specifies the default theme of the application.
14
+ * - `initCallback` (optional): A callback function invoked during initialization.
15
+ * - `loginCallback` (optional): A callback function invoked after login with path before login.
16
+ * - `rootMenu`: Defines the main menu structure as a TileRecord.
17
+ * - `menus`: An array of TileRecords representing additional menus.
18
+ */
19
+ export interface UcsdConfig {
20
+ defaultLayout: string;
21
+ defaultPageHdr: string;
22
+ defaultSubHdr: string;
23
+ defaultTheme: string;
24
+ initCallback?: () => void;
25
+ customAuth?: () => Promise<any>;
26
+ loginCallback?: () => Promise<any>;
27
+ rootMenu: TileRecord;
28
+ menus: Array<TileRecord>;
29
+ }
@@ -0,0 +1,57 @@
1
+ export interface AuditDetail {
2
+ detailKey: string;
3
+ detailValue: string;
4
+ }
5
+ export interface AuditDocument {
6
+ documentId: number;
7
+ fileName: string;
8
+ fileDownloadUri: string;
9
+ fileType: string;
10
+ fileSize: number;
11
+ dateCreated: string;
12
+ auditId: number;
13
+ }
14
+ export interface AuditConstituent {
15
+ constituentId?: number;
16
+ constituentCode: string;
17
+ }
18
+ export interface Audit {
19
+ auditId?: number;
20
+ event: string;
21
+ eventIcon?: string;
22
+ eventColor?: string;
23
+ nameSpace: string;
24
+ dateCreated?: string;
25
+ auditConstituent: AuditConstituent;
26
+ documents?: AuditDocument[];
27
+ details?: AuditDetail[];
28
+ }
29
+ export interface Audits {
30
+ audits: Audit[];
31
+ }
32
+ export interface AuditTimeLine {
33
+ auditId: number;
34
+ color: string;
35
+ icon: string;
36
+ fullDate: string;
37
+ date: string;
38
+ time: string;
39
+ name: string;
40
+ email: string;
41
+ event: string;
42
+ details: string;
43
+ }
44
+ export interface KeyValue {
45
+ key: string;
46
+ value: string;
47
+ }
48
+ export interface ChangeData {
49
+ op: string;
50
+ path: string;
51
+ oldValue?: string;
52
+ newValue?: string;
53
+ oldValues?: Array<string>;
54
+ newValues?: Array<string>;
55
+ oldKeyValues?: Array<KeyValue>;
56
+ newKeyValues?: Array<KeyValue>;
57
+ }