<commit_before>import View from 'girder/views/View';
import { formatDate, DATE_SECOND, renderMarkdown, formatSize } from 'girder/misc';

import CollectionInfoDialogTemplate from 'girder/templates/widgets/collectionInfoDialog.pug';

import 'girder/utilities/jquery/girderModal';

/**
 * This view shows a dialog containing detailed collection information.
 */
var CollectionInfoWidget = View.extend({
    initialize: function () {
        this.needToFetch = !this.model.has('nFolders');
        if (this.needToFetch) {
            this.model.once('g:fetched.details', function () {
                this.needToFetch = false;
                this.render();
            }, this).fetch({extraPath: 'details'});
        }
    },

    render: function () {
        if (this.needToFetch) {
            return;
        }

        this.$el.html(CollectionInfoDialogTemplate({
            collection: this.model,
            formatDate: formatDate,
            formatSize: formatSize,
            DATE_SECOND: DATE_SECOND,
            renderMarkdown: renderMarkdown<commit_msg>Client: Fetch the collection if 'timestamp' change<commit_after>import View from 'girder/views/View';
import { formatDate, DATE_SECOND, renderMarkdown, formatSize } from 'girder/misc';

import CollectionInfoDialogTemplate from 'girder/templates/widgets/collectionInfoDialog.pug';

import 'girder/utilities/jquery/girderModal';

/**
 * This view shows a dialog containing detailed collection information.
 */
var CollectionInfoWidget = View.extend({
    initialize: function () {
        this.needToFetch = !this.model.has('nFolders');
        if (this.needToFetch || this.timestamp !== this.model.get('updated')) {
            this.model.once('g:fetched.details', function () {
                this.needToFetch = false;
                this.timestamp = this.model.get('updated');
                this.render();
            }, this).fetch({extraPath: 'details'});
        }
    },

    render: function () {
        if (this.needToFetch) {
            return;
        }

        this.$el.html(CollectionInfoDialogTemplate({
            collection: this.model,
            formatDate: formatDate,
            formatSize: formatSize,
            DATE_SECOND: DATE_SECOND,
            renderMarkdown: renderMarkdown
{'fraction_non_alphanumeric': 0.11418533157663592, 'fraction_numerical': 0.0, 'mean_word_length': 2.5817610062893084, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4328183', 'n_tokens_mistral': 638, 'n_tokens_neox': 622, 'n_words': 125}