mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 05:57:57 +01:00
#300: custom metadata fields: UI admin
This commit is contained in:
parent
4c7c058e0d
commit
9b1dbf351a
@ -1,3 +1,5 @@
|
||||
create cached table T_METADATA ( MET_ID_C varchar(36) not null, MET_NAME_C varchar(50) not null, MET_TYPE_C varchar(20) not null, MET_DELETEDATE_D datetime, primary key (MET_ID_C) );
|
||||
create cached table T_DOCUMENT_METADATA ( DME_ID_C varchar(36) not null, DME_IDDOCUMENT_C varchar(36) not null, DME_IDMETADATA_C varchar(36) not null, DME_VALUE_C varchar(4000) not null, DME_DELETEDATE_D datetime, primary key (DME_ID_C) );
|
||||
alter table T_DOCUMENT_METADATA add constraint FK_DME_IDDOCUMENT_C foreign key (DME_IDDOCUMENT_C) references T_DOCUMENT (DOC_ID_C) on delete restrict on update restrict;
|
||||
alter table T_DOCUMENT_METADATA add constraint FK_DME_IDMETADATA_C foreign key (DME_IDMETADATA_C) references T_METADATA (MET_ID_C) on delete restrict on update restrict;
|
||||
update T_CONFIG set CFG_VALUE_C = '24' where CFG_ID_C = 'DB_VERSION';
|
||||
|
@ -145,6 +145,15 @@ angular.module('docs',
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('settings.metadata', {
|
||||
url: '/metadata',
|
||||
views: {
|
||||
'settings': {
|
||||
templateUrl: 'partial/docs/settings.metadata.html',
|
||||
controller: 'SettingsMetadata'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('settings.user', {
|
||||
url: '/user',
|
||||
views: {
|
||||
|
@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Settings metadata page controller.
|
||||
*/
|
||||
angular.module('docs').controller('SettingsMetadata', function($scope, Restangular) {
|
||||
// Load metadata
|
||||
Restangular.one('metadata').get().then(function(data) {
|
||||
$scope.metadata = data.metadata;
|
||||
});
|
||||
|
||||
// Add a metadata
|
||||
$scope.addMetadata = function() {
|
||||
Restangular.one('metadata').put($scope.newmetadata).then(function(data) {
|
||||
$scope.metadata.push(data);
|
||||
$scope.newmetadata = {};
|
||||
});
|
||||
};
|
||||
|
||||
// Delete a metadata
|
||||
$scope.deleteMetadata = function(meta) {
|
||||
Restangular.one('metadata', meta.id).remove().then(function() {
|
||||
$scope.metadata.splice($scope.metadata.indexOf(meta), 1);
|
||||
});
|
||||
};
|
||||
|
||||
// Update a metadata
|
||||
$scope.updateMetadata = function(meta) {
|
||||
Restangular.one('metadata', meta.id).post('', meta);
|
||||
};
|
||||
});
|
@ -93,6 +93,7 @@
|
||||
<script src="app/docs/controller/settings/SettingsGroup.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/settings/SettingsGroupEdit.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/settings/SettingsVocabulary.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/settings/SettingsMetadata.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/usergroup/UserGroup.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/usergroup/UserProfile.js" type="text/javascript"></script>
|
||||
<script src="app/docs/controller/usergroup/GroupProfile.js" type="text/javascript"></script>
|
||||
|
@ -278,6 +278,7 @@
|
||||
"menu_vocabularies": "Vocabularies",
|
||||
"menu_configuration": "Configuration",
|
||||
"menu_inbox": "Inbox scanning",
|
||||
"menu_metadata": "Custom metadata",
|
||||
"menu_monitoring": "Monitoring",
|
||||
"user": {
|
||||
"title": "Users management",
|
||||
@ -412,6 +413,12 @@
|
||||
"webhook_create_date": "Create date",
|
||||
"webhook_add": "Add a webhook"
|
||||
},
|
||||
"metadata": {
|
||||
"title": "Custom metadata configuration",
|
||||
"message": "Here you can add custom metadata to your documents like an internal identifier or an expiration date. Please note that the metadata type cannot be changed after creation.",
|
||||
"name": "Metadata name",
|
||||
"type": "Metadata type"
|
||||
},
|
||||
"inbox": {
|
||||
"title": "Inbox scanning",
|
||||
"message": "By enabling this feature, the system will scan the specified inbox every minute for <strong>unread</strong> emails and automatically import them.<br/>After importing an email, it will be marked as read.<br/>Configuration settings for <a href=\"https://support.google.com/mail/answer/7126229?hl=en\" target=\"_blank\">Gmail</a>, <a href=\"https://support.office.com/en-us/article/pop-imap-and-smtp-settings-for-outlook-com-d088b986-291d-42b8-9564-9c414e2aa040\" target=\"_blank\">Outlook.com</a>, <a href=\"https://help.yahoo.com/kb/SLN4075.html\" target=\"_blank\">Yahoo</a>.",
|
||||
|
@ -16,9 +16,10 @@
|
||||
<a class="list-group-item" ui-sref-active="{ active: 'settings.workflow.**' }" href="#/settings/workflow">{{ 'settings.menu_workflow' | translate }}</a>
|
||||
<a class="list-group-item" ui-sref-active="{ active: 'settings.user.**' }" href="#/settings/user">{{ 'settings.menu_users' | translate }}</a>
|
||||
<a class="list-group-item" ui-sref-active="{ active: 'settings.group.**' }" href="#/settings/group">{{ 'settings.menu_groups' | translate }}</a>
|
||||
<a class="list-group-item" ui-sref-active="{ active: 'settings.inbox.**' }" href="#/settings/inbox">{{ 'settings.menu_inbox' | translate }}</a>
|
||||
<a class="list-group-item" ui-sref-active="{ active: 'settings.vocabulary.**' }" href="#/settings/vocabulary">{{ 'settings.menu_vocabularies' | translate }}</a>
|
||||
<a class="list-group-item" ui-sref-active="{ active: 'settings.config.**' }" href="#/settings/config">{{ 'settings.menu_configuration' | translate }}</a>
|
||||
<a class="list-group-item" ui-sref-active="{ active: 'settings.metadata.**' }" href="#/settings/metadata">{{ 'settings.menu_metadata' | translate }}</a>
|
||||
<a class="list-group-item" ui-sref-active="{ active: 'settings.inbox.**' }" href="#/settings/inbox">{{ 'settings.menu_inbox' | translate }}</a>
|
||||
<a class="list-group-item" ui-sref-active="{ active: 'settings.monitoring.**' }" href="#/settings/monitoring">{{ 'settings.menu_monitoring' | translate }}</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -46,7 +46,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="inboxPassword">{{ 'settings.inbox.tag' | translate }}</label>
|
||||
<label class="col-sm-2 control-label" for="inboxTag">{{ 'settings.inbox.tag' | translate }}</label>
|
||||
<div class="col-sm-7">
|
||||
<select class="form-control" ng-model="inbox.tag" id="inboxTag">
|
||||
<option value=""></option>
|
||||
|
@ -0,0 +1,70 @@
|
||||
<h2>
|
||||
<span translate="settings.metadata.title"></span>
|
||||
</h2>
|
||||
<p translate="settings.metadata.message"></p>
|
||||
|
||||
<div class="row">
|
||||
<form class="form-horizontal" name="metadataForm" novalidate>
|
||||
<div class="form-group" ng-class="{ 'has-error': !metadataForm.name.$valid && metadataForm.$dirty }">
|
||||
<label class="col-sm-2 control-label" for="metadataName">{{ 'settings.metadata.name' | translate }}</label>
|
||||
<div class="col-sm-4">
|
||||
<input name="name" type="text" class="form-control" id="metadataName" ng-model="newmetadata.name" required ng-maxlength="50" />
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<span class="help-block" ng-show="metadataForm.name.$error.required && metadataForm.$dirty">{{ 'validation.required' | translate }}</span>
|
||||
<span class="help-block" ng-show="metadataForm.name.$error.maxlength && metadataForm.$dirty">{{ 'validation.too_long' | translate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" ng-class="{ 'has-error': !metadataForm.type.$valid && metadataForm.$dirty }">
|
||||
<label class="col-sm-2 control-label" for="metadataType">{{ 'settings.metadata.type' | translate }}</label>
|
||||
<div class="col-sm-4">
|
||||
<select name="type" class="form-control" ng-model="newmetadata.type" id="metadataType" required>
|
||||
<option value="STRING">String (eg. "myvalue")</option>
|
||||
<option value="INTEGER">Integer (eg. "874")</option>
|
||||
<option value="FLOAT">Float (eg. 54.8)</option>
|
||||
<option value="DATE">Date</option>
|
||||
<option value="BOOLEAN">Boolean (true/false)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<span class="help-block" ng-show="metadataForm.type.$error.required && metadataForm.$dirty">{{ 'validation.required' | translate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button type="submit" class="btn btn-primary" ng-click="addMetadata()" ng-disabled="!metadataForm.$valid">
|
||||
<span class="fas fa-pencil-alt"></span> {{ 'save' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 well">
|
||||
<table class="table" ng-show="metadata">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="70%">{{ 'settings.metadata.name' | translate }}</th>
|
||||
<th width="20%">{{ 'settings.metadata.type' | translate }}</th>
|
||||
<th width="10%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="meta in metadata">
|
||||
<td>
|
||||
<input type="text" class="form-control" ng-model="meta.name" maxlength="50" ng-blur="updateMetadata(meta)" />
|
||||
</td>
|
||||
<td>
|
||||
{{ meta.type }}
|
||||
</td>
|
||||
<td>
|
||||
<span ng-click="deleteMetadata(meta)" class="fas fa-trash pointer"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
@ -11,7 +11,10 @@
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 well">
|
||||
<table class="table" ng-show="entries">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -48,4 +51,5 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user