MOBILE-4596 data: Move enums to constants

main
Noel De Martin 2024-07-23 12:50:31 +02:00
parent f6bd83ae6c
commit 9943784c30
13 changed files with 67 additions and 58 deletions

View File

@ -15,7 +15,8 @@
import { Input, Output, OnInit, OnChanges, SimpleChange, EventEmitter, Component } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { CoreFormFields } from '@singletons/form';
import { AddonModDataData, AddonModDataEntryField, AddonModDataField, AddonModDataTemplateMode } from '../services/data';
import { AddonModDataData, AddonModDataEntryField, AddonModDataField } from '../services/data';
import { AddonModDataTemplateMode } from '../constants';
/**
* Base class for component to render a field.

View File

@ -20,17 +20,20 @@ import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { CoreEvents } from '@singletons/events';
import {
AddonModDataAction,
AddonModDataData,
AddonModDataEntry,
AddonModDataGetDataAccessInformationWSResponse,
AddonModDataTemplateMode,
} from '../../services/data';
import { AddonModDataHelper } from '../../services/data-helper';
import { AddonModDataOffline } from '../../services/data-offline';
import { CoreDomUtils } from '@services/utils/dom';
import { AddonModDataActionsMenuComponent, AddonModDataActionsMenuItem } from '../actionsmenu/actionsmenu';
import { ADDON_MOD_DATA_ENTRY_CHANGED, ADDON_MOD_DATA_PAGE_NAME } from '../../constants';
import {
ADDON_MOD_DATA_ENTRY_CHANGED,
ADDON_MOD_DATA_PAGE_NAME,
AddonModDataAction,
AddonModDataTemplateMode,
} from '../../constants';
/**
* Component that displays a database action.

View File

@ -17,8 +17,9 @@ import { FormGroup } from '@angular/forms';
import { CoreDynamicComponent } from '@components/dynamic-component/dynamic-component';
import { CoreFormFields } from '@singletons/form';
import { AddonModDataEntryFieldInitialized, AddonModDataFieldPluginBaseComponent } from '../../classes/base-field-plugin-component';
import { AddonModDataData, AddonModDataField, AddonModDataTemplateMode } from '../../services/data';
import { AddonModDataData, AddonModDataField } from '../../services/data';
import { AddonModDataFieldsDelegate } from '../../services/data-fields-delegate';
import { AddonModDataTemplateMode } from '../../constants';
/**
* Component that displays a database field plugin.

View File

@ -31,8 +31,6 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events';
import {
AddonModData,
AddonModDataEntry,
AddonModDataTemplateType,
AddonModDataTemplateMode,
AddonModDataField,
AddonModDataGetDataAccessInformationWSResponse,
AddonModDataData,
@ -51,6 +49,8 @@ import {
ADDON_MOD_DATA_ENTRIES_PER_PAGE,
ADDON_MOD_DATA_ENTRY_CHANGED,
ADDON_MOD_DATA_PAGE_NAME,
AddonModDataTemplateType,
AddonModDataTemplateMode,
} from '../../constants';
const contentToken = '<!-- CORE-DATABASE-CONTENT-GOES-HERE -->';

View File

@ -23,13 +23,13 @@ import { ModalController } from '@singletons';
import {
AddonModDataField,
AddonModDataData,
AddonModDataTemplateType,
AddonModDataSearchEntriesAdvancedField,
} from '../../services/data';
import { AddonModDataFieldsDelegate } from '../../services/data-fields-delegate';
import { AddonModDataHelper } from '../../services/data-helper';
import { AddonModDataComponentsCompileModule } from '../components-compile.module';
import { AddonModDataSearchDataParams } from '../index';
import { AddonModDataTemplateType } from '../../constants';
/**
* Page that displays the search modal.

View File

@ -26,3 +26,41 @@ export const ADDON_MOD_DATA_AUTO_SYNCED = 'addon_mod_data_autom_synced';
export const ADDON_MOD_DATA_PREFETCH_NAME = 'AddonModData';
export const ADDON_MOD_DATA_PREFETCH_MODNAME = 'data';
export const ADDON_MOD_DATA_PREFETCH_COMPONENT = ADDON_MOD_DATA_COMPONENT;
export enum AddonModDataAction {
ADD = 'add',
EDIT = 'edit',
DELETE = 'delete',
APPROVE = 'approve',
DISAPPROVE = 'disapprove',
USER = 'user',
USERPICTURE = 'userpicture',
MORE = 'more',
MOREURL = 'moreurl',
COMMENTS = 'comments',
TIMEADDED = 'timeadded',
TIMEMODIFIED = 'timemodified',
TAGS = 'tags',
APPROVALSTATUS = 'approvalstatus',
APPROVALSTATUSCLASS = 'approvalstatusclass',
DELCHECK = 'delcheck', // Unused.
EXPORT = 'export', // Unused.
ACTIONSMENU = 'actionsmenu',
ID = 'id',
}
export enum AddonModDataTemplateType {
LIST_HEADER = 'listtemplateheader',
LIST = 'listtemplate',
LIST_FOOTER = 'listtemplatefooter',
ADD = 'addtemplate',
SEARCH = 'asearchtemplate',
SINGLE = 'singletemplate',
}
export enum AddonModDataTemplateMode {
LIST = 'list',
EDIT = 'edit',
SHOW = 'show',
SEARCH = 'search',
}

View File

@ -31,7 +31,6 @@ import {
AddonModDataData,
AddonModDataField,
AddonModData,
AddonModDataTemplateType,
AddonModDataEntry,
AddonModDataEntryFields,
AddonModDataEditEntryResult,
@ -44,7 +43,7 @@ import { AddonModDataEntryFieldInitialized } from '../../classes/base-field-plug
import { CoreTextUtils } from '@services/utils/text';
import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_DATA_COMPONENT, ADDON_MOD_DATA_ENTRY_CHANGED } from '../../constants';
import { ADDON_MOD_DATA_COMPONENT, ADDON_MOD_DATA_ENTRY_CHANGED, AddonModDataTemplateType } from '../../constants';
/**
* Page that displays the view edit page.

View File

@ -30,8 +30,6 @@ import {
AddonModDataData,
AddonModDataGetDataAccessInformationWSResponse,
AddonModDataField,
AddonModDataTemplateType,
AddonModDataTemplateMode,
AddonModDataEntry,
} from '../../services/data';
import { AddonModDataHelper } from '../../services/data-helper';
@ -42,6 +40,8 @@ import {
ADDON_MOD_DATA_COMPONENT,
ADDON_MOD_DATA_ENTRIES_PER_PAGE,
ADDON_MOD_DATA_ENTRY_CHANGED,
AddonModDataTemplateType,
AddonModDataTemplateMode,
} from '../../constants';
/**

View File

@ -31,19 +31,22 @@ import {
AddonModDataSearchEntriesOptions,
AddonModDataEntries,
AddonModDataEntryFields,
AddonModDataAction,
AddonModDataGetEntryFormatted,
AddonModDataData,
AddonModDataTemplateType,
AddonModDataGetDataAccessInformationWSResponse,
AddonModDataTemplateMode,
AddonModDataField,
AddonModDataEntryWSField,
} from './data';
import { AddonModDataFieldsDelegate } from './data-fields-delegate';
import { AddonModDataOffline, AddonModDataOfflineAction } from './data-offline';
import { CoreFileEntry } from '@services/file-helper';
import { ADDON_MOD_DATA_COMPONENT, ADDON_MOD_DATA_ENTRY_CHANGED } from '../constants';
import {
ADDON_MOD_DATA_COMPONENT,
ADDON_MOD_DATA_ENTRY_CHANGED,
AddonModDataAction,
AddonModDataTemplateType,
AddonModDataTemplateMode,
} from '../constants';
/**
* Service that provides helper functions for datas.

View File

@ -20,8 +20,9 @@ import { CoreTextUtils } from '@services/utils/text';
import { CoreUtils } from '@services/utils/utils';
import { makeSingleton } from '@singletons';
import { CorePath } from '@singletons/path';
import { AddonModDataAction, AddonModDataEntryWSField } from './data';
import { AddonModDataEntryWSField } from './data';
import { AddonModDataEntryDBRecord, DATA_ENTRY_TABLE } from './database/data';
import { AddonModDataAction } from '../constants';
/**
* Service to handle Offline data.

View File

@ -29,10 +29,10 @@ import { CoreTextUtils } from '@services/utils/text';
import { CoreUtils } from '@services/utils/utils';
import { Translate, makeSingleton } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { AddonModData, AddonModDataData, AddonModDataAction } from './data';
import { AddonModData, AddonModDataData } from './data';
import { AddonModDataHelper } from './data-helper';
import { AddonModDataOffline, AddonModDataOfflineAction } from './data-offline';
import { ADDON_MOD_DATA_AUTO_SYNCED, ADDON_MOD_DATA_COMPONENT } from '../constants';
import { ADDON_MOD_DATA_AUTO_SYNCED, ADDON_MOD_DATA_COMPONENT, AddonModDataAction } from '../constants';
/**
* Service to sync databases.

View File

@ -35,6 +35,7 @@ import {
ADDON_MOD_DATA_COMPONENT,
ADDON_MOD_DATA_ENTRIES_PER_PAGE,
ADDON_MOD_DATA_ENTRY_CHANGED,
AddonModDataAction,
} from '../constants';
declare module '@singletons/events' {
@ -50,44 +51,6 @@ declare module '@singletons/events' {
}
}
export enum AddonModDataAction {
ADD = 'add',
EDIT = 'edit',
DELETE = 'delete',
APPROVE = 'approve',
DISAPPROVE = 'disapprove',
USER = 'user',
USERPICTURE = 'userpicture',
MORE = 'more',
MOREURL = 'moreurl',
COMMENTS = 'comments',
TIMEADDED = 'timeadded',
TIMEMODIFIED = 'timemodified',
TAGS = 'tags',
APPROVALSTATUS = 'approvalstatus',
APPROVALSTATUSCLASS = 'approvalstatusclass',
DELCHECK = 'delcheck', // Unused.
EXPORT = 'export', // Unused.
ACTIONSMENU = 'actionsmenu',
ID = 'id',
}
export enum AddonModDataTemplateType {
LIST_HEADER = 'listtemplateheader',
LIST = 'listtemplate',
LIST_FOOTER = 'listtemplatefooter',
ADD = 'addtemplate',
SEARCH = 'asearchtemplate',
SINGLE = 'singletemplate',
}
export enum AddonModDataTemplateMode {
LIST = 'list',
EDIT = 'edit',
SHOW = 'show',
SEARCH = 'search',
}
/**
* Service that provides some features for databases.
*/

View File

@ -13,7 +13,7 @@
// limitations under the License.
import { CoreSiteSchema } from '@services/sites';
import { AddonModDataAction } from '../data';
import { AddonModDataAction } from '../../constants';
/**
* Database variables for AddonModDataOfflineProvider.