mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-28 20:09:59 +00:00
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import Component from '@ember/component';
|
|
// @ts-ignore: Ignore import of compiled template
|
|
import template from '../templates/components/last-saved-by';
|
|
import { classNames, layout } from '@ember-decorators/component';
|
|
import { computed } from '@ember/object';
|
|
import moment from 'moment';
|
|
|
|
@classNames('last-saved-by')
|
|
@layout(template)
|
|
export default class LastSavedBy extends Component {
|
|
/**
|
|
* The entity responsible for the time transaction
|
|
* @type {string}
|
|
* @memberof LastSavedBy
|
|
*/
|
|
actor: string = 'unknown';
|
|
|
|
/**
|
|
* The time at which the related transaction occurred
|
|
* @type {(number | undefined)}
|
|
* @memberof LastSavedBy
|
|
*/
|
|
time: number | undefined;
|
|
|
|
/**
|
|
* Maximum length of characters to display of the actor
|
|
* @type {number}
|
|
* @memberof LastSavedBy
|
|
*/
|
|
maxCharLength: number = 30;
|
|
|
|
/**
|
|
* Alternate title for the component
|
|
* @type {string}
|
|
* @memberof LastSavedBy
|
|
*/
|
|
title: string = 'Last Saved:';
|
|
|
|
/**
|
|
* Resolves the appropriate representation for the time the transaction occurred
|
|
* @readonly
|
|
* @type {string}
|
|
* @memberof LastSavedBy
|
|
*/
|
|
@computed('time')
|
|
get lastSaved(): string {
|
|
const { time } = this;
|
|
|
|
return time ? moment(time).fromNow() : 'Never';
|
|
}
|
|
}
|