gitlabculture
clone your own copy | download snapshot

Snapshots | iceberg

No images in this repository’s iceberg at this time

Inside this repository

vue.html
text/html

Download raw (2.9 KB)

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">

    <title>Vue</title>
    
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

</head>
<body>
    <div id="repos">

        <div class="repo" v-for="repo in repos" v-bind:class="repo.archived">
            <h2>{{repo.name}}</h2>
            <div class='iceberg'>
                <h3>Iceberg</h3>
                <div v-for="image in repo.iceberg">
                    <img v-bind:src="image.src">
                </div>
            </div>
            





            
            <!--<div class='processus'>-->
                <!--<h3>Processus</h3>-->
                <!--<img v-for="image in processus">-->
            <!--</div>-->
        </div>
    </div>

    <script type="text/javascript" charset="utf-8">
        var gitlab_url = "http://gitlab.constantvzw.org";
        var user_name = "osp";
        var reposList = [448, 456, 512]
        var repos = []
        

        for (i=0; i < reposList.length; i++) {
            getMetadata(reposList[i]);
            getIceberg(i, reposList[i]);
        }

        console.log(repos);
        var reposApp = new Vue({
            el: '#repos',
            data: {
              repos
            }
          })

        // METADATA ///////////////////////////////
        function getMetadata(repoID) {
            let repo_url = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID;

            fetch(repo_url).then(function(resp){ return resp.json(); })
            .then(function(data){
                name = data.name.split(".").slice(1);
                repo = {};
                repo.id = repoID;
                repo.repo = data.name;
                repo.name = name.replace(",", " ");
                repo.iceberg = [];

                if (data.default_branch == "archive"){
                    repo.archived = "archived";
                }

                repos.push(repo);
            })
        }
        function getIceberg(i, repoID){
            let icebergURL = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID + "/repository/tree?path=iceberg";

            fetch(icebergURL).then(function(resp){ return resp.json(); })
            .then(function(data){
                return data.map(function(image) {
                    item = {};
                    item.name = image.name;
                    console.log(repos[i]);
                    project_path = [gitlab_url, user_name, repo.repo].join('/');
                    if(repo.archived){ branch = "archive";} else { branch = "master" }
                    item.src = project_path + "/raw/" + branch + "/" + image.path;
                    repo.iceberg.push(item);
                })
            });
        }

    </script>
    
    <script type="text/javascript" charset="utf-8" src="generator/templates/static/pad.js"> </script>
</body>
</html>