Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Implement CSV import #95

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/controllers/issue.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/*
* Class that represents an issue loaded from an external source
* or from a file.
*/
class Issue
{
// Id of the issue
public $id;

// Topic of the issue
public $topic;

// Create issue with id and topic
function _ctor($id, $topic)
{
$this->id = $id;
$this->topic = $topic;
}
}
35 changes: 35 additions & 0 deletions src/js/csv-plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*globals scrum */

// Add a plugin for github integration
scrum.sources.push({
// Fixed properties and methods
name: "CSV",
position: 5,
view: "templates/csv_source.html",
feedback: false,
// Feedback call for completed poll
completed: function(result) {
},

// Custom properties and methods
loaded: false,
format: '',

// Issues after parsing the file
issues: [],
issue: {},
event: ['poll', 'start', 'CSV'],

// Load issues from github
load: function() {
var self = this;
// Upload file http://stackoverflow.com/a/22538760
var file = document.getElementById('csv_issues').files[0];
var reader = new FileReader();
reader.addEventListener("load", function (event) {
var textFile = event.target;
var content = textFile.result;
});
reader.readAsText(file);
}
});
4 changes: 3 additions & 1 deletion src/sample-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
// Plugin to load issues from github
'GitHub',
// Plugin to load issues from JIRA
'JIRA'
'JIRA',
// Import issues from CSV file
'CSV',
];

// Configuration for the server side JIRA controller
Expand Down
27 changes: 27 additions & 0 deletions src/templates/csv_source.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!-- Initial screen till static information was put in -->
<div ng-if="!master.current.loaded">
<form role="form">
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="form-group">
<label>Format:</label>
<input type="text" class="form-control" placeholder="%Id;;;%Topic;" ng-model="master.current.format">
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="form-group">
<label>File:</label>
<input id="csv_issues" type="file" class="form-control" name="issues" accept="text/csv">
</div>
</div>
</div>
<button class="btn btn-default" ng-click="master.current.load()">Load issues</button>
</form>
</div>

<!-- Screen after static process was completed -->
<div ng-if="master.current.loaded">
<div class="row">

</div>
</div>