This commit is contained in:
Will Smythe 2016-02-24 23:34:36 -05:00
Родитель b53401592d
Коммит 2dddc72cb4
15 изменённых файлов: 189 добавлений и 269 удалений

Просмотреть файл

@ -6,8 +6,11 @@
VSS.init( {
usePlatformScripts: true,
moduleLoaderConfig: {
paths: { "enhancer": "dist/enhancer" }
} });
paths: {
"enhancer": "dist/enhancer"
}
}
});
VSS.ready(function() {
require(["enhancer/dump"], function () { });

Просмотреть файл

@ -0,0 +1,19 @@
{
"name": "calendar-public-events",
"homepage": "https://github.com/Microsoft/vsts-extension-samples",
"description": "",
"main": "",
"moduleType": [],
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"vss-web-extension-sdk": "^1.95.2"
}
}

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 20 KiB

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Просмотреть файл

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<title>Public Events</title>
<script src="bower_components/vss-web-extension-sdk/lib/VSS.SDK.min.js"></script>
</head>
<body>
<script type="text/javascript">
VSS.init({
explicitNotifyLoaded: true,
usePlatformScripts: true,
moduleLoaderConfig: {
paths: {
"PublicEvents": "dist/PublicEvents"
}
}
});
VSS.require( [ "PublicEvents/PublicEventsSource" ], function (PubEvents) {
VSS.register("public-events-source", function (context) {
return new PubEvents.PublicEventsSource();
});
VSS.notifyLoadSucceeded();
});
</script>
</body>
</html>

65
calendar-public-events/src/Calendar/Contracts.d.ts поставляемый Normal file
Просмотреть файл

@ -0,0 +1,65 @@
export interface IEventSource {
id: string;
name: string;
order: number;
background?: boolean;
getEvents: (query?: IEventQuery) => IPromise<CalendarEvent[]>;
getCategories(query: IEventQuery): IPromise<IEventCategory[]>;
addEvents?: (events: CalendarEvent[]) => IPromise<CalendarEvent>;
removeEvents?: (events: CalendarEvent[]) => IPromise<CalendarEvent[]>;
updateEvents?: (events: CalendarEvent[]) => IPromise<CalendarEvent[]>;
getTitleUrl(webContext: WebContext): IPromise<string>;
}
export interface IEventCategory {
title: string;
subTitle?: string;
imageUrl?: string;
color?: string;
}
export interface IEventQuery {
startDate?: Date;
endDate?: Date;
}
export interface CalendarEvent {
title: string;
__etag?: number;
startDate: string;
endDate?: string;
id?: string;
category?: string;
member?: ICalendarMember;
}
export interface ICalendarMember {
displayName: string;
id: string;
imageUrl: string;
uniqueName: string;
url: string;
}
export interface IExtendedCalendarEventObject {
color?: string;
backgroundColor?: string;
borderColor?: string;
textColor?: string;
className?: string | string[];
editable?: boolean;
startEditable?: boolean;
durationEditable?: boolean;
rendering?: string;
overlap?: boolean;
constraint?: string;
id?: string;
__etag?: number;
title: string;
allDay?: boolean;
start: Date | string;
end?: Date | string;
url?: string;
source?: any | IExtendedCalendarEventSource;
member?: ICalendarMember;
category?: string;
eventType?: string;
}
export interface IExtendedCalendarEventSource {
events?: IExtendedCalendarEventObject[] | IEventSource;
}

Просмотреть файл

@ -1,4 +1,4 @@
/// <reference path='../../../lib/vss' />
/// <reference path='../../typings/main.d.ts' />
import Calendar_Contracts = require("Calendar/Contracts");
import Q = require("q");

Просмотреть файл

@ -0,0 +1,11 @@
{
"compilerOptions": {
"module": "amd",
"target": "es5",
"outDir": "dist/",
"rootDir": "src/"
},
"files": [
"src/PublicEvents/PublicEventsSource.ts"
]
}

Просмотреть файл

@ -0,0 +1,8 @@
{
"ambientDependencies": {
"Q": "github:DefinitelyTyped/DefinitelyTyped/q/Q.d.ts#4de74cb527395c13ba20b438c3a7a419ad931f1c",
"jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#470954c4f427e0805a2d633636a7c6aa7170def8",
"knockout": "github:DefinitelyTyped/DefinitelyTyped/knockout/knockout.d.ts#4de74cb527395c13ba20b438c3a7a419ad931f1c",
"vss": "github:microsoft/vss-web-extension-sdk/typings/vss.d.ts"
}
}

Просмотреть файл

@ -0,0 +1,51 @@
{
"manifestVersion": 1,
"id": "samples-calendar-public-events",
"version": "0.1.4",
"name": "Team Calendar US Public Events",
"description": "See public United States events and holidays on the Team Calendar extension for Visual Studio Team Services.",
"publisher": "fabrikam",
"public": false,
"icons": {
"default": "images/fabrikam-logo.png"
},
"categories": [
"Developer samples"
],
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"files": [
{
"path": "images",
"addressable": true
},
{
"path": "dist",
"addressable": true
},
{
"path": "main.html",
"addressable": true
},
{
"path": "bower_components/vss-web-extension-sdk/lib/VSS.SDK.min.js",
"addressable": true
}
],
"contributions": [
{
"id": "public-events-source",
"type": "ms-devlabs.team-calendar.calendar-event-source",
"description": "Team Calendar event source for public U.S. events and holidays.",
"targets": [
"ms-devlabs.team-calendar.calendar-event-sources"
],
"properties": {
"uri": "main.html"
}
}
]
}

Просмотреть файл

@ -1,23 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Public Events</title>
<script src="/lib/VSS.SDK.js"></script>
</head>
<body>
<script type="text/javascript">
VSS.init({
explicitNotifyLoaded: true,
usePlatformScripts: true
});
VSS.require([
"out/scripts/PublicEventsSource"
], function (PubEvents) {
VSS.register("publicEvents", function (context) {
return new PubEvents.PublicEventsSource();
});
VSS.notifyLoadSucceeded();
});
</script>
</body>
</html>

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -1,4 +0,0 @@
This sample is implemented with TypeScript (http://typescriptlang.org). For your convenience, the compiled JavaScript files are included in the ./out directory.
If you would like to edit this sample, you can re-compile by running the following command from this directory (you will need the TypeScript compiler in your PATH):
tsc -p .

168
public-events/scripts/Calendar/Contracts.d.ts поставляемый
Просмотреть файл

@ -1,168 +0,0 @@
/// <reference path='../../../lib/vss' />
/**
* Interface for a calendar event provider
*/
export interface IEventSource {
/**
* Unique id of the event source
*/
id: string;
/**
* Friendly display name of the event source
*/
name: string;
/**
* Order used in sorting the event sources
*/
order: number;
/**
* Set to true if events from this source should be rendered in the background.
*/
background?: boolean;
/**
* Get the events that match a certain criteria
*
* @param query Events query
*/
getEvents: (query?: IEventQuery) => IPromise<CalendarEvent[]>;
/**
* Get the event categories that match a certain criteria
*/
getCategories(query: IEventQuery): IPromise<IEventCategory[]>;
/**
* Optional method to add events to a given source
*/
addEvents?: (events: CalendarEvent[]) => IPromise<CalendarEvent>;
/**
* Optional method to remove events from this event source
*/
removeEvents?: (events: CalendarEvent[]) => IPromise<CalendarEvent[]>;
/**
* Optional method to update an event in this event source
*/
updateEvents?: (events: CalendarEvent[]) => IPromise<CalendarEvent[]>;
/**
* Forms the url which is linked to the title of the summary section for the source
*/
getTitleUrl(webContext: WebContext): IPromise<string>;
}
/**
* Summary item for events
*/
export interface IEventCategory {
/**
* Title of the event category
*/
title: string;
/**
* Sub title of the event category
*/
subTitle?: string;
/**
* Image url of this category
*/
imageUrl?: string;
/**
* Color of this category
*/
color?: string;
}
/**
* Query criteria for events
*/
export interface IEventQuery {
/**
* If specified, only include events on or after the given date
*/
startDate?: Date;
/**
* If specified, only include events on or before the given date
*/
endDate?: Date;
}
/**
* Represents a single calendar event
*/
export interface CalendarEvent {
/**
* Title of the event
*/
title: string;
__etag?: number;
/**
* Event start date
*/
startDate: string;
/**
* Event end date
*/
endDate?: string;
/**
* Unique id for the event
*/
id?: string;
/**
* Category of the service
*/
category?: string;
/**
* The member associated with this event
*/
member?: ICalendarMember;
}
export interface ICalendarMember {
/**
* Display name of the member
*/
displayName: string;
/**
* Unique ID for the member
*/
id: string;
/**
* URL to the identity image for the member
*/
imageUrl: string;
/**
* Unique name for the member
*/
uniqueName: string;
/**
* URL for the member
*/
url: string;
}
/**
* Represents a single calendar event
*/
export interface IExtendedCalendarEventObject {
color?: string;
backgroundColor?: string;
borderColor?: string;
textColor?: string;
className?: string | string[];
editable?: boolean;
startEditable?: boolean;
durationEditable?: boolean;
rendering?: string;
overlap?: boolean;
constraint?: string;
id?: string;
__etag?: number;
title: string;
allDay?: boolean;
start: Date | string;
end?: Date | string;
url?: string;
source?: any | IExtendedCalendarEventSource;
member?: ICalendarMember;
category?: string;
eventType?: string;
}
/**
* Represents a single calendar event
*/
export interface IExtendedCalendarEventSource {
events?: IExtendedCalendarEventObject[] | IEventSource;
}

Просмотреть файл

@ -1,8 +0,0 @@
{
"compilerOptions": {
"module": "amd",
"target": "ES5",
"outDir": "out/scripts"
},
"files": ["scripts/PublicEvents/PublicEventsSource.ts"]
}

Просмотреть файл

@ -1,36 +0,0 @@
{
"manifestVersion": 1,
"id": "samples-public-events",
"version": "0.1.0",
"name": "Team Calendar US Public Events",
"description": "See public United States events and holidays on the Team Calendar extension for Visual Studio Online.",
"baseUri": "https://localhost/public-events",
"publisher": "fabrikam",
"icons": {
"default": "images/fabrikam-logo.png"
},
"tags": [
"Sample"
],
"categories": [
"Planning"
],
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"contributions": [
{
"id": "publicEvents",
"type": "ms.team-calendar.calendar-event-source",
"description": "Team Calendar event source for public U.S. events and holidays.",
"targets": [
"ms.team-calendar.calendar-event-sources"
],
"properties": {
"uri": "main.html"
}
}
]
}